From a3b7f2764c93d114c29256d6ca461523194e783c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 14 Feb 2024 00:54:03 +0000 Subject: [PATCH] CodeGen from PR 27767 in Azure/azure-rest-api-specs Merge 52aa4b1bcedff239e6c68f87021ec906c3762409 into dc15daf7fe1aecbac15cdc0f98c8579441897bda --- sdk/apicenter/azure-mgmt-apicenter/_meta.json | 4 +- .../mgmt/apicenter/_api_center_mgmt_client.py | 45 +- .../azure/mgmt/apicenter/_configuration.py | 8 +- .../apicenter/aio/_api_center_mgmt_client.py | 45 +- .../mgmt/apicenter/aio/_configuration.py | 8 +- .../mgmt/apicenter/aio/operations/__init__.py | 14 + .../operations/_api_definitions_operations.py | 1044 + .../operations/_api_versions_operations.py | 586 + .../aio/operations/_apis_operations.py | 544 + .../aio/operations/_deployments_operations.py | 586 + .../operations/_environments_operations.py | 545 + .../_metadata_schemas_operations.py | 516 + .../aio/operations/_services_operations.py | 336 +- .../aio/operations/_workspaces_operations.py | 515 + .../azure/mgmt/apicenter/models/__init__.py | 98 +- .../models/_api_center_mgmt_client_enums.py | 128 +- .../mgmt/apicenter/models/_models_py3.py | 1702 +- .../mgmt/apicenter/operations/__init__.py | 14 + .../operations/_api_definitions_operations.py | 1422 + .../operations/_api_versions_operations.py | 835 + .../apicenter/operations/_apis_operations.py | 753 + .../operations/_deployments_operations.py | 835 + .../operations/_environments_operations.py | 774 + .../_metadata_schemas_operations.py | 724 + .../mgmt/apicenter/operations/_operations.py | 2 +- .../operations/_services_operations.py | 410 +- .../operations/_workspaces_operations.py | 701 + .../api_definitions_delete.py | 44 + .../api_definitions_export_specification.py | 45 + .../generated_samples/api_definitions_get.py | 45 + .../generated_samples/api_definitions_head.py | 45 + .../generated_samples/api_definitions_list.py | 45 + .../generated_samples/api_versions_delete.py | 43 + .../generated_samples/api_versions_get.py | 44 + .../generated_samples/api_versions_head.py | 44 + .../generated_samples/api_versions_list.py | 44 + .../generated_samples/apis_delete.py | 42 + .../generated_samples/apis_get.py | 43 + .../generated_samples/apis_head.py | 43 + .../generated_samples/apis_list.py | 43 + .../generated_samples/deployments_delete.py | 43 + .../generated_samples/deployments_get.py | 44 + .../generated_samples/deployments_head.py | 44 + .../generated_samples/deployments_list.py | 44 + .../generated_samples/environments_delete.py | 42 + .../generated_samples/environments_get.py | 43 + .../generated_samples/environments_head.py | 43 + .../generated_samples/environments_list.py | 43 + .../metadata_schemas_delete.py | 41 + .../generated_samples/metadata_schemas_get.py | 42 + .../metadata_schemas_head.py | 42 + .../metadata_schemas_list.py | 42 + .../generated_samples/operations_list.py | 2 +- .../services_create_or_update.py | 13 +- .../generated_samples/services_delete.py | 2 +- .../generated_samples/services_get.py | 2 +- .../services_list_by_resource_group.py | 2 +- .../services_list_by_subscription.py | 2 +- .../generated_samples/workspaces_delete.py | 41 + .../{services_update.py => workspaces_get.py} | 7 +- .../generated_samples/workspaces_head.py | 42 + .../generated_samples/workspaces_list.py | 42 + .../azure-mgmt-appplatform/_meta.json | 7 +- .../_app_platform_management_client.py | 98 +- .../aio/_app_platform_management_client.py | 98 +- .../azure/mgmt/appplatform/models.py | 1 - .../v2024_01_01_preview/__init__.py | 26 + .../_app_platform_management_client.py | 293 + .../v2024_01_01_preview/_configuration.py | 67 + .../v2024_01_01_preview/_metadata.json | 140 + .../appplatform/v2024_01_01_preview/_patch.py | 20 + .../v2024_01_01_preview/_vendor.py | 16 + .../v2024_01_01_preview/_version.py | 9 + .../v2024_01_01_preview/aio/__init__.py | 23 + .../aio/_app_platform_management_client.py | 293 + .../v2024_01_01_preview/aio/_configuration.py | 67 + .../v2024_01_01_preview/aio/_patch.py | 20 + .../aio/operations/__init__.py | 79 + .../_api_portal_custom_domains_operations.py | 618 + .../aio/operations/_api_portals_operations.py | 749 + .../aio/operations/_apms_operations.py | 665 + .../_application_accelerators_operations.py | 600 + .../_application_live_views_operations.py | 598 + .../aio/operations/_apps_operations.py | 1319 + .../aio/operations/_bindings_operations.py | 875 + .../_build_service_agent_pool_operations.py | 490 + .../_build_service_builder_operations.py | 687 + .../operations/_build_service_operations.py | 1564 + .../_buildpack_binding_operations.py | 754 + .../operations/_certificates_operations.py | 596 + .../operations/_config_servers_operations.py | 828 + .../_configuration_services_operations.py | 1098 + .../_container_registries_operations.py | 853 + .../operations/_custom_domains_operations.py | 876 + .../_customized_accelerators_operations.py | 898 + .../aio/operations/_deployments_operations.py | 2650 + .../_dev_tool_portals_operations.py | 598 + .../operations/_eureka_servers_operations.py | 669 + .../_gateway_custom_domains_operations.py | 618 + .../_gateway_route_configs_operations.py | 621 + .../aio/operations/_gateways_operations.py | 1197 + .../_monitoring_settings_operations.py | 593 + .../aio/operations/_operations.py | 136 + .../aio/operations/_patch.py | 20 + .../_predefined_accelerators_operations.py | 515 + .../_runtime_versions_operations.py | 106 + .../_service_registries_operations.py | 480 + .../aio/operations/_services_operations.py | 2380 + .../aio/operations/_skus_operations.py | 137 + .../aio/operations/_storages_operations.py | 595 + .../v2024_01_01_preview/models/__init__.py | 647 + .../_app_platform_management_client_enums.py | 577 + .../v2024_01_01_preview/models/_models_py3.py | 10915 ++ .../v2024_01_01_preview/models/_patch.py | 20 + .../operations/__init__.py | 79 + .../_api_portal_custom_domains_operations.py | 764 + .../operations/_api_portals_operations.py | 906 + .../operations/_apms_operations.py | 819 + .../_application_accelerators_operations.py | 731 + .../_application_live_views_operations.py | 729 + .../operations/_apps_operations.py | 1585 + .../operations/_bindings_operations.py | 1041 + .../_build_service_agent_pool_operations.py | 599 + .../_build_service_builder_operations.py | 870 + .../operations/_build_service_operations.py | 2086 + .../_buildpack_binding_operations.py | 942 + .../operations/_certificates_operations.py | 721 + .../operations/_config_servers_operations.py | 957 + .../_configuration_services_operations.py | 1301 + .../_container_registries_operations.py | 1020 + .../operations/_custom_domains_operations.py | 1042 + .../_customized_accelerators_operations.py | 1102 + .../operations/_deployments_operations.py | 3269 + .../_dev_tool_portals_operations.py | 729 + .../operations/_eureka_servers_operations.py | 792 + .../_gateway_custom_domains_operations.py | 764 + .../_gateway_route_configs_operations.py | 767 + .../operations/_gateways_operations.py | 1450 + .../_monitoring_settings_operations.py | 687 + .../operations/_operations.py | 158 + .../v2024_01_01_preview/operations/_patch.py | 20 + .../_predefined_accelerators_operations.py | 672 + .../_runtime_versions_operations.py | 128 + .../_service_registries_operations.py | 602 + .../operations/_services_operations.py | 2948 + .../operations/_skus_operations.py | 164 + .../operations/_storages_operations.py | 718 + .../appplatform/v2024_01_01_preview/py.typed | 1 + sdk/astro/azure-mgmt-astro/CHANGELOG.md | 5 + sdk/astro/azure-mgmt-astro/LICENSE | 21 + sdk/astro/azure-mgmt-astro/MANIFEST.in | 8 + sdk/astro/azure-mgmt-astro/README.md | 61 + sdk/astro/azure-mgmt-astro/_meta.json | 11 + sdk/astro/azure-mgmt-astro/azure/__init__.py | 1 + .../azure-mgmt-astro/azure/mgmt/__init__.py | 1 + .../azure/mgmt/astro/__init__.py | 26 + .../azure/mgmt/astro/_astro_mgmt_client.py | 92 + .../azure/mgmt/astro/_configuration.py | 66 + .../azure/mgmt/astro/_patch.py | 20 + .../azure/mgmt/astro/_serialization.py | 2006 + .../azure/mgmt/astro/_vendor.py | 16 + .../azure/mgmt/astro/_version.py | 9 + .../azure/mgmt/astro/aio/__init__.py | 23 + .../mgmt/astro/aio/_astro_mgmt_client.py | 92 + .../azure/mgmt/astro/aio/_configuration.py | 66 + .../azure/mgmt/astro/aio/_patch.py | 20 + .../mgmt/astro/aio/operations/__init__.py | 21 + .../mgmt/astro/aio/operations/_operations.py | 133 + .../operations/_organizations_operations.py | 885 + .../azure/mgmt/astro/aio/operations/_patch.py | 20 + .../azure/mgmt/astro/models/__init__.py | 79 + .../astro/models/_astro_mgmt_client_enums.py | 89 + .../azure/mgmt/astro/models/_models_py3.py | 1140 + .../azure/mgmt/astro/models/_patch.py | 20 + .../azure/mgmt/astro/operations/__init__.py | 21 + .../mgmt/astro/operations/_operations.py | 155 + .../operations/_organizations_operations.py | 1095 + .../azure/mgmt/astro/operations/_patch.py | 20 + .../azure/mgmt/astro/py.typed | 1 + .../operations_list_maximum_set_gen.py | 39 + ...ations_create_or_update_maximum_set_gen.py | 81 + .../organizations_delete_maximum_set_gen.py | 40 + .../organizations_get_maximum_set_gen.py | 41 + ..._list_by_resource_group_maximum_set_gen.py | 41 + ...ns_list_by_subscription_maximum_set_gen.py | 39 + .../organizations_update_maximum_set_gen.py | 67 + sdk/astro/azure-mgmt-astro/sdk_packaging.toml | 11 + sdk/astro/azure-mgmt-astro/setup.py | 82 + sdk/astro/ci.yml | 34 + .../azure-mgmt-automation/_meta.json | 10 +- .../mgmt/automation/_automation_client.py | 10 +- .../azure/mgmt/automation/_serialization.py | 119 +- .../azure/mgmt/automation/_vendor.py | 11 - .../azure/mgmt/automation/_version.py | 2 +- .../mgmt/automation/aio/_automation_client.py | 11 +- .../automation/aio/operations/__init__.py | 2 + .../aio/operations/_activity_operations.py | 21 +- ...ent_registration_information_operations.py | 38 +- .../_automation_account_operations.py | 73 +- .../_automation_client_operations.py | 17 +- .../aio/operations/_certificate_operations.py | 66 +- .../aio/operations/_connection_operations.py | 66 +- .../operations/_connection_type_operations.py | 48 +- .../aio/operations/_credential_operations.py | 66 +- ..._deleted_automation_accounts_operations.py | 10 +- .../_dsc_compilation_job_operations.py | 60 +- .../_dsc_compilation_job_stream_operations.py | 15 +- .../_dsc_configuration_operations.py | 73 +- .../_dsc_node_configuration_operations.py | 58 +- .../aio/operations/_dsc_node_operations.py | 56 +- .../aio/operations/_fields_operations.py | 13 +- ..._hybrid_runbook_worker_group_operations.py | 67 +- .../_hybrid_runbook_workers_operations.py | 66 +- .../aio/operations/_job_operations.py | 82 +- .../operations/_job_schedule_operations.py | 48 +- .../aio/operations/_job_stream_operations.py | 21 +- .../aio/operations/_keys_operations.py | 10 +- .../_linked_workspace_operations.py | 13 +- .../aio/operations/_module_operations.py | 70 +- .../_node_count_information_operations.py | 15 +- .../operations/_node_reports_operations.py | 34 +- .../_object_data_types_operations.py | 21 +- .../automation/aio/operations/_operations.py | 10 +- .../_power_shell72_module_operations.py | 611 + ...private_endpoint_connections_operations.py | 46 +- .../_private_link_resources_operations.py | 12 +- .../operations/_python2_package_operations.py | 70 +- .../operations/_python3_package_operations.py | 70 +- .../operations/_runbook_draft_operations.py | 39 +- .../aio/operations/_runbook_operations.py | 87 +- .../aio/operations/_schedule_operations.py | 68 +- ...e_configuration_machine_runs_operations.py | 21 +- ...re_update_configuration_runs_operations.py | 21 +- ...ftware_update_configurations_operations.py | 49 +- .../operations/_source_control_operations.py | 66 +- .../_source_control_sync_job_operations.py | 40 +- ...rce_control_sync_job_streams_operations.py | 21 +- .../aio/operations/_statistics_operations.py | 13 +- .../aio/operations/_test_job_operations.py | 58 +- .../_test_job_streams_operations.py | 21 +- .../aio/operations/_usages_operations.py | 13 +- .../aio/operations/_variable_operations.py | 68 +- .../aio/operations/_watcher_operations.py | 100 +- .../aio/operations/_webhook_operations.py | 78 +- .../models/_automation_client_enums.py | 8 +- .../mgmt/automation/models/_models_py3.py | 798 +- .../mgmt/automation/operations/__init__.py | 2 + .../operations/_activity_operations.py | 31 +- ...ent_registration_information_operations.py | 52 +- .../_automation_account_operations.py | 99 +- .../_automation_client_operations.py | 23 +- .../operations/_certificate_operations.py | 88 +- .../operations/_connection_operations.py | 88 +- .../operations/_connection_type_operations.py | 66 +- .../operations/_credential_operations.py | 88 +- ..._deleted_automation_accounts_operations.py | 16 +- .../_dsc_compilation_job_operations.py | 86 +- .../_dsc_compilation_job_stream_operations.py | 23 +- .../_dsc_configuration_operations.py | 99 +- .../_dsc_node_configuration_operations.py | 76 +- .../operations/_dsc_node_operations.py | 82 +- .../operations/_fields_operations.py | 19 +- ..._hybrid_runbook_worker_group_operations.py | 89 +- .../_hybrid_runbook_workers_operations.py | 88 +- .../automation/operations/_job_operations.py | 116 +- .../operations/_job_schedule_operations.py | 66 +- .../operations/_job_stream_operations.py | 31 +- .../automation/operations/_keys_operations.py | 16 +- .../_linked_workspace_operations.py | 19 +- .../operations/_module_operations.py | 92 +- .../_node_count_information_operations.py | 23 +- .../operations/_node_reports_operations.py | 54 +- .../_object_data_types_operations.py | 31 +- .../mgmt/automation/operations/_operations.py | 12 +- .../_power_shell72_module_operations.py | 791 + ...private_endpoint_connections_operations.py | 72 +- .../_private_link_resources_operations.py | 20 +- .../operations/_python2_package_operations.py | 92 +- .../operations/_python3_package_operations.py | 92 +- .../operations/_runbook_draft_operations.py | 65 +- .../operations/_runbook_operations.py | 129 +- .../operations/_schedule_operations.py | 90 +- ...e_configuration_machine_runs_operations.py | 31 +- ...re_update_configuration_runs_operations.py | 31 +- ...ftware_update_configurations_operations.py | 67 +- .../operations/_source_control_operations.py | 88 +- .../_source_control_sync_job_operations.py | 54 +- ...rce_control_sync_job_streams_operations.py | 31 +- .../operations/_statistics_operations.py | 19 +- .../operations/_test_job_operations.py | 90 +- .../_test_job_streams_operations.py | 35 +- .../operations/_usages_operations.py | 19 +- .../operations/_variable_operations.py | 90 +- .../operations/_watcher_operations.py | 144 +- .../operations/_webhook_operations.py | 104 +- .../generated_samples/create_job_schedule.py | 2 +- .../create_or_update_automation_account.py | 2 +- .../create_or_update_certificate.py | 2 +- .../create_or_update_connection.py | 2 +- .../create_or_update_connection_type.py | 2 +- .../create_or_update_credential.py | 2 +- .../create_or_update_dsc_configuration.py | 2 +- ...create_or_update_dsc_node_configuration.py | 2 +- .../create_or_update_module.py | 2 +- .../create_or_update_power_shell72_module.py | 54 + .../create_or_update_python2_package.py | 2 +- .../create_or_update_python3_package.py | 2 +- .../create_or_update_runbook.py | 2 +- .../create_or_update_schedule.py | 2 +- .../create_or_update_variable.py | 2 +- .../create_runbook_as_draft.py | 2 +- .../generated_samples/create_test_job.py | 2 +- .../delete_automation_account.py | 5 +- .../generated_samples/delete_certificate.py | 5 +- .../generated_samples/delete_connection.py | 5 +- .../delete_connection_type.py | 5 +- .../delete_credential_existing.py | 5 +- .../delete_dsc_configuration.py | 5 +- .../generated_samples/delete_dsc_node.py | 3 +- .../delete_dsc_node_configuration.py | 5 +- .../delete_hybrid_runbook_worker.py | 5 +- .../delete_hybrid_runbook_worker_group.py | 5 +- .../generated_samples/delete_job_schedule.py | 5 +- .../generated_samples/delete_module.py | 5 +- .../delete_power_shell72_module.py | 41 + .../delete_python2_package.py | 5 +- .../delete_python3_package.py | 5 +- .../generated_samples/delete_runbook.py | 5 +- .../generated_samples/delete_schedule.py | 5 +- .../generated_samples/delete_variable.py | 5 +- .../generated_samples/delete_watcher.py | 3 +- .../generated_samples/delete_webhook.py | 3 +- .../deserialize_graph_runbook_content.py | 2 +- .../get_activity_in_amodule.py | 2 +- .../get_all_connection_types_first100.py | 2 +- .../get_all_connection_types_next100.py | 2 +- .../get_all_dsc_configurations.py | 2 +- .../get_automation_account.py | 2 +- .../generated_samples/get_certificate.py | 2 +- .../generated_samples/get_connection.py | 2 +- .../generated_samples/get_connection_type.py | 2 +- .../generated_samples/get_credential.py | 2 +- .../get_dsc_configuration.py | 2 +- .../get_dsc_configuration_content.py | 2 +- .../get_dsc_node_configuration.py | 2 +- .../get_hybrid_runbook_worker.py | 2 +- .../get_hybrid_runbook_worker_group.py | 2 +- .../generated_samples/get_job_schedule.py | 2 +- .../generated_samples/get_linked_workspace.py | 2 +- .../generated_samples/get_module.py | 2 +- ...paged_dsc_configurations_with_no_filter.py | 2 +- ...edl_dsc_configurations_with_name_filter.py | 2 +- .../get_power_shell72_module.py | 42 + .../generated_samples/get_python2_package.py | 2 +- .../generated_samples/get_python3_package.py | 2 +- .../generated_samples/get_runbook.py | 2 +- .../generated_samples/get_runbook_content.py | 2 +- .../generated_samples/get_runbook_draft.py | 2 +- .../get_runbook_draft_content.py | 2 +- .../generated_samples/get_schedule.py | 2 +- .../get_statistics_of_automation_account.py | 2 +- .../generated_samples/get_test_job.py | 2 +- .../generated_samples/get_test_job_stream.py | 2 +- .../get_usages_of_automation_account.py | 2 +- .../generated_samples/get_variable.py | 2 +- .../generated_samples/{ => job}/create_job.py | 2 +- .../generated_samples/{ => job}/get_job.py | 2 +- .../{ => job}/get_job_output.py | 2 +- .../{ => job}/get_job_runbook_content.py | 2 +- .../{ => job}/get_job_stream.py | 2 +- .../{ => job}/list_job_streams_by_job.py | 2 +- .../list_jobs_by_automation_account.py | 2 +- .../generated_samples/{ => job}/resume_job.py | 5 +- .../generated_samples/{ => job}/stop_job.py | 5 +- .../{ => job}/suspend_job.py | 5 +- .../list_activities_by_module.py | 2 +- ...all_job_schedules_by_automation_account.py | 2 +- .../list_automation_account_keys.py | 2 +- ...t_automation_accounts_by_resource_group.py | 2 +- ...ist_automation_accounts_by_subscription.py | 2 +- ...list_certificates_by_automation_account.py | 2 +- ...nections_by_automation_account_first100.py | 2 +- ...nnections_by_automation_account_next100.py | 2 +- .../list_credentials_by_automation_account.py | 2 +- ...omation_account_next100_using_next_link.py | 2 +- .../list_dsc_node_configurations.py | 2 +- .../list_fields_by_module_and_type.py | 2 +- .../generated_samples/list_fields_by_type.py | 2 +- .../list_hybrid_runbook_worker.py | 2 +- .../list_hybrid_runbook_worker_group.py | 2 +- .../list_modules_by_automation_account.py | 2 +- ...sc_node_configurations_with_name_filter.py | 2 +- ..._dsc_node_configurations_with_no_filter.py | 2 +- ...r_shell72_modules_by_automation_account.py | 42 + ..._python2_packages_by_automation_account.py | 2 +- ..._python3_packages_by_automation_account.py | 2 +- .../list_rest_api_operations.py | 2 +- .../list_runbooks_by_automation_account.py | 2 +- ...chedules_by_automation_account_first100.py | 2 +- ...schedules_by_automation_account_next100.py | 2 +- .../list_test_job_streams_by_job.py | 2 +- .../list_variables_first100.py | 2 +- .../list_variables_next100.py | 2 +- .../move_hybrid_runbook_worker.py | 43 + .../private_endpoint_connection_delete.py | 3 +- .../generated_samples/publish_runbook.py | 5 +- .../put_hybrid_runbook_worker.py | 48 + .../put_hybrid_runbook_worker_group.py | 45 + .../replace_runbook_draft_content.py | 2 +- .../generated_samples/resume_test_job.py | 5 +- .../serialize_graph_runbook_content.py | 2 +- .../create_software_update_configuration.py | 0 .../delete_software_update_configuration.py | 3 +- ...t_software_update_configuration_by_name.py | 0 .../list_software_update_configurations.py | 0 ...st_software_update_configurations_by_vm.py | 0 ..._update_configuration_machine_run_by_id.py | 2 +- ...tware_update_configuration_machine_runs.py | 2 +- ...pdate_configuration_machine_runs_by_run.py | 2 +- ...software_update_configuration_run_by_id.py | 2 +- ...iled_software_update_configuration_runs.py | 2 +- ...list_software_update_configuration_runs.py | 2 +- .../create_or_update_source_control.py | 7 +- .../delete_source_control.py | 5 +- .../get_all_source_controls.py | 2 +- .../get_source_control.py | 2 +- .../update_source_control_patch.py | 7 +- .../create_source_control_sync_job.py | 2 +- .../get_all_source_control_sync_jobs.py | 2 +- .../get_source_control_sync_job.py | 2 +- .../get_source_control_sync_job_streams.py | 2 +- ...e_control_sync_job_streams_by_stream_id.py | 2 +- .../generated_samples/start_watcher.py | 3 +- .../generated_samples/stop_test_job.py | 5 +- .../generated_samples/stop_watcher.py | 3 +- .../generated_samples/suspend_test_job.py | 5 +- ...raft_edit_to_last_known_published_state.py | 2 +- .../update_automation_account.py | 2 +- .../generated_samples/update_certificate.py | 2 +- .../generated_samples/update_connection.py | 2 +- .../update_credential_patch.py | 2 +- .../update_dsc_configuration.py | 2 +- .../update_hybrid_runbook_worker_group.py | 45 + .../generated_samples/update_module.py | 2 +- .../update_power_shell72_module.py | 54 + .../update_python2_package.py | 2 +- .../update_python3_package.py | 2 +- .../generated_samples/update_runbook.py | 2 +- .../generated_samples/update_schedule.py | 2 +- .../update_variable_patch.py | 2 +- .../azure-mgmt-azuredatatransfer/CHANGELOG.md | 5 + .../azure-mgmt-azuredatatransfer/LICENSE | 21 + .../azure-mgmt-azuredatatransfer/MANIFEST.in | 8 + .../azure-mgmt-azuredatatransfer/README.md | 61 + .../azure-mgmt-azuredatatransfer/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/azuredatatransfer/__init__.py | 26 + .../azuredatatransfer/_azuredatatransferrp.py | 129 + .../mgmt/azuredatatransfer/_configuration.py | 66 + .../azure/mgmt/azuredatatransfer/_patch.py | 20 + .../mgmt/azuredatatransfer/_serialization.py | 2006 + .../azure/mgmt/azuredatatransfer/_vendor.py | 16 + .../azure/mgmt/azuredatatransfer/_version.py | 9 + .../mgmt/azuredatatransfer/aio/__init__.py | 23 + .../aio/_azuredatatransferrp.py | 130 + .../azuredatatransfer/aio/_configuration.py | 66 + .../mgmt/azuredatatransfer/aio/_patch.py | 20 + .../aio/operations/__init__.py | 33 + .../_azure_data_transfer_operations.py | 266 + .../aio/operations/_connections_operations.py | 1089 + .../aio/operations/_flows_operations.py | 1326 + .../_list_pending_connections_operations.py | 146 + .../_list_pending_flows_operations.py | 146 + .../operations/_list_schemas_operations.py | 190 + .../aio/operations/_operations.py | 133 + .../aio/operations/_patch.py | 20 + .../aio/operations/_pipelines_operations.py | 1301 + .../mgmt/azuredatatransfer/models/__init__.py | 129 + .../models/_azuredatatransferrp_enums.py | 140 + .../azuredatatransfer/models/_models_py3.py | 2174 + .../mgmt/azuredatatransfer/models/_patch.py | 20 + .../azuredatatransfer/operations/__init__.py | 33 + .../_azure_data_transfer_operations.py | 310 + .../operations/_connections_operations.py | 1311 + .../operations/_flows_operations.py | 1628 + .../_list_pending_connections_operations.py | 183 + .../_list_pending_flows_operations.py | 181 + .../operations/_list_schemas_operations.py | 231 + .../operations/_operations.py | 155 + .../azuredatatransfer/operations/_patch.py | 20 + .../operations/_pipelines_operations.py | 1555 + .../azure/mgmt/azuredatatransfer/py.typed | 1 + .../approve_or_reject_connection.py | 45 + .../create_or_update_connection.py | 45 + .../create_or_update_flow.py | 53 + .../create_or_update_pipeline.py | 42 + .../generated_samples/delete_connection.py | 40 + .../generated_samples/delete_flow.py | 41 + .../generated_samples/delete_pipeline.py | 40 + .../enable_or_disable_flow.py | 42 + .../generated_samples/get_connection.py | 41 + .../generated_samples/get_flow.py | 42 + .../generated_samples/get_pipeline.py | 41 + .../generated_samples/link_connection.py | 44 + .../generated_samples/link_flow.py | 45 + .../list_connections_by_resource_group.py | 41 + .../list_connections_by_subscription.py | 39 + .../list_flows_by_connection.py | 42 + .../generated_samples/list_operations.py} | 14 +- .../list_pending_connections.py | 42 + .../generated_samples/list_pending_flows.py | 42 + .../list_pipelines_by_resource_group.py | 41 + .../list_pipelines_by_subscription.py | 39 + .../generated_samples/list_schemas.py | 45 + .../post_list_approved_schemas.py | 40 + .../generated_samples/post_validate_schema.py | 40 + .../sdk_packaging.toml | 11 + .../azure-mgmt-azuredatatransfer/setup.py | 82 + sdk/azuredatatransfer/ci.yml | 34 + .../CHANGELOG.md | 5 + .../azure-mgmt-azurelargeinstance/LICENSE | 21 + .../azure-mgmt-azurelargeinstance/MANIFEST.in | 8 + .../azure-mgmt-azurelargeinstance/README.md | 61 + .../azure-mgmt-azurelargeinstance/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/azurelargeinstance/__init__.py | 26 + .../mgmt/azurelargeinstance/_configuration.py | 66 + .../_large_instance_mgmt_client.py | 103 + .../azure/mgmt/azurelargeinstance/_patch.py | 20 + .../mgmt/azurelargeinstance/_serialization.py | 2006 + .../azure/mgmt/azurelargeinstance/_vendor.py | 16 + .../azure/mgmt/azurelargeinstance/_version.py | 9 + .../mgmt/azurelargeinstance/aio/__init__.py | 23 + .../azurelargeinstance/aio/_configuration.py | 66 + .../aio/_large_instance_mgmt_client.py | 103 + .../mgmt/azurelargeinstance/aio/_patch.py | 20 + .../aio/operations/__init__.py | 23 + .../_azure_large_instance_operations.py | 957 + ...azure_large_storage_instance_operations.py | 452 + .../aio/operations/_operations.py | 134 + .../aio/operations/_patch.py | 20 + .../azurelargeinstance/models/__init__.py | 93 + .../_large_instance_mgmt_client_enums.py | 256 + .../azurelargeinstance/models/_models_py3.py | 1196 + .../mgmt/azurelargeinstance/models/_patch.py | 20 + .../azurelargeinstance/operations/__init__.py | 23 + .../_azure_large_instance_operations.py | 1184 + ...azure_large_storage_instance_operations.py | 579 + .../operations/_operations.py | 155 + .../azurelargeinstance/operations/_patch.py | 20 + .../azure/mgmt/azurelargeinstance/py.typed | 1 + .../azure_large_instance_get.py | 41 + ...e_large_instance_list_by_resource_group.py | 41 + ...ure_large_instance_list_by_subscription.py | 39 + .../azure_large_instance_operations_list.py | 39 + .../azure_large_instance_restart.py | 41 + .../azure_large_instance_shutdown.py | 41 + .../azure_large_instance_start.py | 41 + .../azure_large_storage_instance_get.py | 41 + ...storage_instance_list_by_resource_group.py | 41 + ...e_storage_instance_list_by_subscription.py | 39 + .../sdk_packaging.toml | 11 + .../azure-mgmt-azurelargeinstance/setup.py | 82 + sdk/azurelargeinstance/ci.yml | 34 + .../azure-mgmt-cognitiveservices/_meta.json | 10 +- .../_cognitive_services_management_client.py | 32 +- .../mgmt/cognitiveservices/_configuration.py | 6 +- .../mgmt/cognitiveservices/_serialization.py | 26 +- .../azure/mgmt/cognitiveservices/_vendor.py | 14 +- .../azure/mgmt/cognitiveservices/_version.py | 2 +- .../_cognitive_services_management_client.py | 33 +- .../cognitiveservices/aio/_configuration.py | 6 +- .../aio/operations/__init__.py | 10 + .../aio/operations/_deployments_operations.py | 344 + .../_encryption_scopes_operations.py | 508 + .../_rai_blocklist_items_operations.py | 551 + .../operations/_rai_blocklists_operations.py | 508 + .../_rai_content_filters_operations.py} | 38 +- .../operations/_rai_policies_operations.py | 507 + .../mgmt/cognitiveservices/models/__init__.py | 56 + ...nitive_services_management_client_enums.py | 63 + .../cognitiveservices/models/_models_py3.py | 965 +- .../cognitiveservices/operations/__init__.py | 10 + .../operations/_accounts_operations.py | 46 +- ...e_services_management_client_operations.py | 10 +- .../_commitment_plans_operations.py | 58 +- .../_commitment_tiers_operations.py | 6 +- .../_deleted_accounts_operations.py | 14 +- .../operations/_deployments_operations.py | 431 +- .../_encryption_scopes_operations.py | 651 + .../operations/_models_operations.py | 6 +- .../operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 18 +- .../_private_link_resources_operations.py | 6 +- .../_rai_blocklist_items_operations.py | 725 + .../operations/_rai_blocklists_operations.py | 653 + .../_rai_content_filters_operations.py} | 50 +- .../operations/_rai_policies_operations.py | 653 + .../operations/_resource_skus_operations.py | 6 +- .../operations/_usages_operations.py | 6 +- .../generated_samples/create_account.py | 2 +- .../generated_samples/create_account_min.py | 2 +- .../create_shared_commitment_plan.py | 2 +- ...eate_shared_commitment_plan_association.py | 2 +- .../generated_samples/delete_account.py | 2 +- .../delete_commitment_plan.py | 2 +- .../generated_samples/delete_deployment.py | 2 +- .../delete_encryption_scope.py | 41 + .../delete_private_endpoint_connection.py | 2 +- .../generated_samples/delete_rai_blocklist.py | 41 + .../delete_rai_blocklist_item.py | 42 + .../generated_samples/delete_rai_policy.py | 41 + .../delete_shared_commitment_plan.py | 2 +- ...lete_shared_commitment_plan_association.py | 2 +- .../generated_samples/get_account.py | 2 +- .../generated_samples/get_commitment_plan.py | 2 +- .../generated_samples/get_deleted_account.py | 2 +- .../generated_samples/get_deployment.py | 2 +- .../generated_samples/get_encryption_scope.py | 42 + .../generated_samples/get_operations.py | 2 +- .../get_private_endpoint_connection.py | 2 +- .../generated_samples/get_rai_blocklist.py | 42 + .../get_rai_blocklist_item.py | 43 + .../generated_samples/get_rai_policy.py | 42 + .../get_shared_commitment_plan.py | 2 +- .../get_shared_commitment_plan_association.py | 2 +- .../generated_samples/get_skus.py | 2 +- .../generated_samples/get_usages.py | 2 +- .../generated_samples/list_account_models.py | 2 +- .../list_accounts_by_resource_group.py | 2 +- .../list_accounts_by_subscription.py | 2 +- .../generated_samples/list_blocklist_items.py | 43 + .../generated_samples/list_blocklists.py | 42 + .../list_commitment_plans.py | 2 +- .../list_commitment_tiers.py | 2 +- .../list_deleted_accounts_by_subscription.py | 2 +- .../generated_samples/list_deployment_skus.py | 43 + .../generated_samples/list_deployments.py | 2 +- .../list_encryption_scopes.py | 42 + .../generated_samples/list_keys.py | 2 +- .../generated_samples/list_models.py | 2 +- .../list_private_endpoint_connections.py | 2 +- .../list_private_link_resources.py | 2 +- .../list_rai_content_filters.py | 41 + .../generated_samples/list_rai_policies.py | 42 + ...ist_shared_commitment_plan_associations.py | 2 +- ...ared_commitment_plans_by_resource_group.py | 2 +- ...shared_commitment_plans_by_subscription.py | 2 +- .../generated_samples/list_skus.py | 2 +- .../generated_samples/list_usages.py | 2 +- .../purge_deleted_account.py | 2 +- .../generated_samples/put_commitment_plan.py | 2 +- .../generated_samples/put_deployment.py | 2 +- .../generated_samples/put_encryption_scope.py | 54 + .../put_private_endpoint_connection.py | 2 +- .../generated_samples/put_rai_blocklist.py | 43 + .../put_rai_blocklist_item.py | 44 + .../generated_samples/put_rai_policy.py | 53 + .../generated_samples/update_account.py | 2 +- .../generated_samples/update_deployment.py | 43 + .../update_shared_commitment_plan.py | 2 +- .../azure-mgmt-communitytraining/CHANGELOG.md | 5 + .../azure-mgmt-communitytraining/LICENSE | 21 + .../azure-mgmt-communitytraining/MANIFEST.in | 8 + .../azure-mgmt-communitytraining/README.md | 61 + .../azure-mgmt-communitytraining/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/communitytraining/__init__.py | 26 + .../mgmt/communitytraining/_configuration.py | 66 + .../communitytraining/_microsoft_community.py | 95 + .../azure/mgmt/communitytraining/_patch.py | 20 + .../mgmt/communitytraining/_serialization.py | 2006 + .../azure/mgmt/communitytraining/_vendor.py | 16 + .../azure/mgmt/communitytraining/_version.py | 9 + .../mgmt/communitytraining/aio/__init__.py | 23 + .../communitytraining/aio/_configuration.py | 66 + .../aio/_microsoft_community.py | 95 + .../mgmt/communitytraining/aio/_patch.py | 20 + .../aio/operations/__init__.py | 21 + .../_community_trainings_operations.py | 893 + .../aio/operations/_operations.py | 133 + .../aio/operations/_patch.py | 20 + .../mgmt/communitytraining/models/__init__.py | 57 + .../models/_microsoft_community_enums.py | 65 + .../communitytraining/models/_models_py3.py | 864 + .../mgmt/communitytraining/models/_patch.py | 20 + .../communitytraining/operations/__init__.py | 21 + .../_community_trainings_operations.py | 1075 + .../operations/_operations.py | 155 + .../communitytraining/operations/_patch.py | 20 + .../azure/mgmt/communitytraining/py.typed | 1 + .../community_trainings_create.py | 64 + .../community_trainings_delete.py | 40 + .../community_trainings_get.py | 41 + ...munity_trainings_list_by_resource_group.py | 41 + ...ommunity_trainings_list_by_subscription.py | 39 + .../community_trainings_update.py | 58 + .../generated_samples/operations_list.py | 39 + .../sdk_packaging.toml | 11 + .../azure-mgmt-communitytraining/setup.py | 82 + sdk/communitytraining/ci.yml | 34 + .../azure-mgmt-containerservice/_meta.json | 7 +- .../_container_service_client.py | 46 +- .../aio/_container_service_client.py | 46 +- .../azure/mgmt/containerservice/models.py | 1 - .../v2023_11_02_preview/__init__.py | 26 + .../v2023_11_02_preview/_configuration.py | 66 + .../_container_service_client.py | 179 + .../v2023_11_02_preview/_metadata.json | 122 + .../v2023_11_02_preview/_patch.py | 20 + .../v2023_11_02_preview/_vendor.py | 16 + .../v2023_11_02_preview/_version.py | 9 + .../v2023_11_02_preview/aio/__init__.py | 23 + .../v2023_11_02_preview/aio/_configuration.py | 66 + .../aio/_container_service_client.py | 179 + .../v2023_11_02_preview/aio/_patch.py | 20 + .../aio/operations/__init__.py | 43 + .../aio/operations/_agent_pools_operations.py | 1288 + .../aio/operations/_machines_operations.py | 228 + .../_maintenance_configurations_operations.py | 462 + .../_managed_cluster_snapshots_operations.py | 679 + .../_managed_clusters_operations.py | 3594 + .../_operation_status_result_operations.py | 301 + .../aio/operations/_operations.py | 138 + .../aio/operations/_patch.py | 20 + ...private_endpoint_connections_operations.py | 491 + .../_private_link_resources_operations.py | 121 + ...olve_private_link_service_id_operations.py | 204 + .../aio/operations/_snapshots_operations.py | 665 + ...trusted_access_role_bindings_operations.py | 612 + .../_trusted_access_roles_operations.py | 144 + .../v2023_11_02_preview/models/__init__.py | 493 + .../models/_container_service_client_enums.py | 670 + .../v2023_11_02_preview/models/_models_py3.py | 10106 ++ .../v2023_11_02_preview/models/_patch.py | 20 + .../operations/__init__.py | 43 + .../operations/_agent_pools_operations.py | 1673 + .../operations/_machines_operations.py | 324 + .../_maintenance_configurations_operations.py | 625 + .../_managed_cluster_snapshots_operations.py | 894 + .../_managed_clusters_operations.py | 4750 + .../_operation_status_result_operations.py | 429 + .../operations/_operations.py | 160 + .../v2023_11_02_preview/operations/_patch.py | 20 + ...private_endpoint_connections_operations.py | 673 + .../_private_link_resources_operations.py | 164 + ...olve_private_link_service_id_operations.py | 250 + .../operations/_snapshots_operations.py | 878 + ...trusted_access_role_bindings_operations.py | 808 + .../_trusted_access_roles_operations.py | 175 + .../v2023_11_02_preview/py.typed | 1 + .../_meta.json | 15 +- .../_container_service_fleet_mgmt_client.py | 19 + .../_container_service_fleet_mgmt_client.py | 19 + .../v2022_06_02_preview/_version.py | 2 +- .../v2023_03_15_preview/_version.py | 2 +- ...ntainer_service_fleet_mgmt_client_enums.py | 6 +- .../v2023_03_15_preview/models/_models_py3.py | 12 +- .../v2023_06_15_preview/_version.py | 2 +- .../operations/_fleet_members_operations.py | 3 +- .../aio/operations/_fleets_operations.py | 3 +- ...ntainer_service_fleet_mgmt_client_enums.py | 6 +- .../v2023_06_15_preview/models/_models_py3.py | 12 +- .../operations/_fleet_members_operations.py | 2 +- .../operations/_fleets_operations.py | 2 +- .../v2023_08_15_preview/_version.py | 2 +- .../operations/_fleet_members_operations.py | 3 +- .../aio/operations/_fleets_operations.py | 3 +- ...ntainer_service_fleet_mgmt_client_enums.py | 6 +- .../v2023_08_15_preview/models/_models_py3.py | 12 +- .../operations/_fleet_members_operations.py | 2 +- .../operations/_fleets_operations.py | 2 +- .../v2023_10_15/_version.py | 2 +- .../operations/_fleet_members_operations.py | 3 +- .../aio/operations/_fleets_operations.py | 3 +- ...ntainer_service_fleet_mgmt_client_enums.py | 6 +- .../v2023_10_15/models/_models_py3.py | 12 +- .../operations/_fleet_members_operations.py | 2 +- .../operations/_fleets_operations.py | 2 +- .../v2024_02_02_preview/__init__.py | 26 + .../v2024_02_02_preview/_configuration.py | 66 + .../_container_service_fleet_mgmt_client.py | 123 + .../v2024_02_02_preview/_metadata.json | 114 + .../v2024_02_02_preview/_patch.py | 20 + .../v2024_02_02_preview/_vendor.py | 16 + .../v2024_02_02_preview/_version.py | 9 + .../v2024_02_02_preview/aio/__init__.py | 23 + .../v2024_02_02_preview/aio/_configuration.py | 66 + .../_container_service_fleet_mgmt_client.py | 124 + .../v2024_02_02_preview/aio/_patch.py | 20 + .../aio/operations/__init__.py | 27 + .../operations/_fleet_members_operations.py | 922 + .../_fleet_update_strategies_operations.py | 656 + .../aio/operations/_fleets_operations.py | 1020 + .../aio/operations/_operations.py | 137 + .../aio/operations/_patch.py | 20 + .../aio/operations/_update_runs_operations.py | 1228 + .../v2024_02_02_preview/models/__init__.py | 127 + ...ntainer_service_fleet_mgmt_client_enums.py | 167 + .../v2024_02_02_preview/models/_models_py3.py | 1823 + .../v2024_02_02_preview/models/_patch.py | 20 + .../operations/__init__.py | 27 + .../operations/_fleet_members_operations.py | 1156 + .../_fleet_update_strategies_operations.py | 837 + .../operations/_fleets_operations.py | 1259 + .../operations/_operations.py | 159 + .../v2024_02_02_preview/operations/_patch.py | 20 + .../operations/_update_runs_operations.py | 1551 + .../v2024_02_02_preview/py.typed | 1 + .../azure-mgmt-containerstorage/CHANGELOG.md | 5 + .../azure-mgmt-containerstorage/LICENSE | 21 + .../azure-mgmt-containerstorage/MANIFEST.in | 8 + .../azure-mgmt-containerstorage/README.md | 61 + .../azure-mgmt-containerstorage/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/containerstorage/__init__.py | 26 + .../_azure_container_storage_rp.py | 100 + .../mgmt/containerstorage/_configuration.py | 66 + .../azure/mgmt/containerstorage/_patch.py | 20 + .../mgmt/containerstorage/_serialization.py | 2006 + .../azure/mgmt/containerstorage/_vendor.py | 16 + .../azure/mgmt/containerstorage/_version.py | 9 + .../mgmt/containerstorage/aio/__init__.py | 23 + .../aio/_azure_container_storage_rp.py | 100 + .../containerstorage/aio/_configuration.py | 66 + .../azure/mgmt/containerstorage/aio/_patch.py | 20 + .../aio/operations/__init__.py | 25 + .../aio/operations/_operations.py | 133 + .../containerstorage/aio/operations/_patch.py | 20 + .../aio/operations/_pools_operations.py | 855 + .../aio/operations/_snapshots_operations.py | 589 + .../aio/operations/_volumes_operations.py | 829 + .../mgmt/containerstorage/models/__init__.py | 111 + .../_azure_container_storage_rp_enums.py | 137 + .../containerstorage/models/_models_py3.py | 1485 + .../mgmt/containerstorage/models/_patch.py | 20 + .../containerstorage/operations/__init__.py | 25 + .../operations/_operations.py | 155 + .../containerstorage/operations/_patch.py | 20 + .../operations/_pools_operations.py | 1064 + .../operations/_snapshots_operations.py | 766 + .../operations/_volumes_operations.py | 1057 + .../azure/mgmt/containerstorage/py.typed | 1 + .../generated_samples/operations_list.py | 39 + .../pools_create_or_update_azure_disk.py | 67 + .../pools_create_or_update_elastic_san.py | 67 + .../pools_create_or_update_ephemeral.py | 58 + .../generated_samples/pools_delete.py | 40 + .../generated_samples/pools_get_azure_disk.py | 41 + .../pools_get_elastic_san.py | 41 + .../generated_samples/pools_get_ephemeral.py | 41 + ...pools_list_by_resource_group_azure_disk.py | 41 + ...ools_list_by_resource_group_elastic_san.py | 41 + .../pools_list_by_resource_group_ephemeral.py | 41 + .../pools_list_by_subscription_azure_disk.py | 39 + .../pools_list_by_subscription_elastic_san.py | 39 + .../pools_list_by_subscription_ephemeral.py | 39 + .../pools_update_azure_disk.py | 57 + .../pools_update_elastic_san.py | 57 + .../pools_update_ephemeral.py | 57 + .../snapshots_create_or_update.py | 49 + .../generated_samples/snapshots_delete.py | 41 + .../generated_samples/snapshots_get.py | 42 + .../snapshots_list_by_pool.py | 42 + .../volumes_create_or_update.py | 50 + .../generated_samples/volumes_delete.py | 41 + .../generated_samples/volumes_get.py | 42 + .../generated_samples/volumes_list_by_pool.py | 42 + .../generated_samples/volumes_update.py | 43 + .../sdk_packaging.toml | 11 + .../azure-mgmt-containerstorage/setup.py | 82 + sdk/containerstorage/ci.yml | 34 + sdk/databox/azure-mgmt-databox/_meta.json | 27 +- .../databox/_data_box_management_client.py | 49 +- .../azure/mgmt/databox/_operations_mixin.py | 9 +- .../azure/mgmt/databox/_serialization.py | 30 +- .../aio/_data_box_management_client.py | 49 +- .../mgmt/databox/aio/_operations_mixin.py | 9 +- .../azure/mgmt/databox/models.py | 2 +- .../_data_box_management_client.py | 6 +- .../azure/mgmt/databox/v2018_01_01/_vendor.py | 14 - .../mgmt/databox/v2018_01_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2018_01_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 10 +- .../operations/_jobs_operations.py | 54 +- .../v2018_01_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 16 +- .../_data_box_management_client.py | 6 +- .../azure/mgmt/databox/v2019_09_01/_vendor.py | 14 - .../mgmt/databox/v2019_09_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2019_09_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../operations/_jobs_operations.py | 54 +- .../v2019_09_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 44 +- .../_data_box_management_client.py | 6 +- .../azure/mgmt/databox/v2020_04_01/_vendor.py | 14 - .../mgmt/databox/v2020_04_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2020_04_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../operations/_jobs_operations.py | 54 +- .../v2020_04_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../azure/mgmt/databox/v2020_11_01/_vendor.py | 14 - .../mgmt/databox/v2020_11_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2020_11_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../operations/_jobs_operations.py | 54 +- .../v2020_11_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2021_03_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2021_03_01/_vendor.py | 14 +- .../mgmt/databox/v2021_03_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2021_03_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 54 +- .../v2021_03_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2021_05_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2021_05_01/_vendor.py | 14 +- .../mgmt/databox/v2021_05_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 34 +- .../v2021_05_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 54 +- .../v2021_05_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 10 +- .../v2021_08_01_preview/_metadata.json | 4 +- .../databox/v2021_08_01_preview/_vendor.py | 14 +- .../databox/v2021_08_01_preview/_version.py | 2 +- .../aio/_data_box_management_client.py | 10 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 64 +- .../aio/operations/_operations.py | 5 +- .../aio/operations/_service_operations.py | 38 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 86 +- .../operations/_operations.py | 5 +- .../operations/_service_operations.py | 58 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2021_12_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2021_12_01/_vendor.py | 14 +- .../mgmt/databox/v2021_12_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 38 +- .../v2021_12_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 60 +- .../v2021_12_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2022_02_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2022_02_01/_vendor.py | 14 +- .../mgmt/databox/v2022_02_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 38 +- .../v2022_02_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 60 +- .../v2022_02_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2022_09_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2022_09_01/_vendor.py | 14 +- .../mgmt/databox/v2022_09_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 38 +- .../v2022_09_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 60 +- .../v2022_09_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2022_10_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2022_10_01/_vendor.py | 14 +- .../mgmt/databox/v2022_10_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 38 +- .../v2022_10_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 60 +- .../v2022_10_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../_data_box_management_client.py | 6 +- .../mgmt/databox/v2022_12_01/_metadata.json | 4 +- .../azure/mgmt/databox/v2022_12_01/_vendor.py | 14 +- .../mgmt/databox/v2022_12_01/_version.py | 2 +- .../aio/_data_box_management_client.py | 6 +- .../_data_box_management_client_operations.py | 13 +- .../aio/operations/_jobs_operations.py | 38 +- .../v2022_12_01/aio/operations/_operations.py | 3 +- .../aio/operations/_service_operations.py | 26 +- .../_data_box_management_client_operations.py | 17 +- .../operations/_jobs_operations.py | 60 +- .../v2022_12_01/operations/_operations.py | 3 +- .../operations/_service_operations.py | 46 +- .../mgmt/databox/v2023_03_01/__init__.py | 26 + .../databox/v2023_03_01/_configuration.py | 66 + .../_data_box_management_client.py | 99 + .../mgmt/databox/v2023_03_01/_metadata.json | 133 + .../azure/mgmt/databox/v2023_03_01/_patch.py | 20 + .../azure/mgmt/databox/v2023_03_01/_vendor.py | 36 + .../mgmt/databox/v2023_03_01/_version.py | 9 + .../mgmt/databox/v2023_03_01/aio/__init__.py | 23 + .../databox/v2023_03_01/aio/_configuration.py | 66 + .../aio/_data_box_management_client.py | 99 + .../mgmt/databox/v2023_03_01/aio/_patch.py | 20 + .../mgmt/databox/v2023_03_01/aio/_vendor.py | 28 + .../v2023_03_01/aio/operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 185 + .../aio/operations/_jobs_operations.py | 1434 + .../v2023_03_01/aio/operations/_operations.py | 136 + .../v2023_03_01/aio/operations/_patch.py | 20 + .../aio/operations/_service_operations.py | 899 + .../databox/v2023_03_01/models/__init__.py | 331 + .../_data_box_management_client_enums.py | 505 + .../databox/v2023_03_01/models/_models_py3.py | 6457 + .../mgmt/databox/v2023_03_01/models/_patch.py | 20 + .../v2023_03_01/operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 219 + .../operations/_jobs_operations.py | 1741 + .../v2023_03_01/operations/_operations.py | 156 + .../databox/v2023_03_01/operations/_patch.py | 20 + .../operations/_service_operations.py | 1085 + .../azure/mgmt/databox/v2023_03_01/py.typed | 1 + .../mgmt/databox/v2023_12_01/__init__.py | 26 + .../databox/v2023_12_01/_configuration.py | 66 + .../_data_box_management_client.py | 99 + .../mgmt/databox/v2023_12_01/_metadata.json | 133 + .../azure/mgmt/databox/v2023_12_01/_patch.py | 20 + .../azure/mgmt/databox/v2023_12_01/_vendor.py | 36 + .../mgmt/databox/v2023_12_01/_version.py | 9 + .../mgmt/databox/v2023_12_01/aio/__init__.py | 23 + .../databox/v2023_12_01/aio/_configuration.py | 66 + .../aio/_data_box_management_client.py | 99 + .../mgmt/databox/v2023_12_01/aio/_patch.py | 20 + .../mgmt/databox/v2023_12_01/aio/_vendor.py | 28 + .../v2023_12_01/aio/operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 185 + .../aio/operations/_jobs_operations.py | 1434 + .../v2023_12_01/aio/operations/_operations.py | 136 + .../v2023_12_01/aio/operations/_patch.py | 20 + .../aio/operations/_service_operations.py | 899 + .../databox/v2023_12_01/models/__init__.py | 337 + .../_data_box_management_client_enums.py | 514 + .../databox/v2023_12_01/models/_models_py3.py | 6544 + .../mgmt/databox/v2023_12_01/models/_patch.py | 20 + .../v2023_12_01/operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 219 + .../operations/_jobs_operations.py | 1741 + .../v2023_12_01/operations/_operations.py | 156 + .../databox/v2023_12_01/operations/_patch.py | 20 + .../operations/_service_operations.py | 1085 + .../azure/mgmt/databox/v2023_12_01/py.typed | 1 + .../databox/v2024_02_01_preview/__init__.py | 26 + .../v2024_02_01_preview/_configuration.py | 66 + .../_data_box_management_client.py | 103 + .../v2024_02_01_preview/_metadata.json | 133 + .../databox/v2024_02_01_preview/_patch.py | 20 + .../databox/v2024_02_01_preview/_vendor.py | 36 + .../databox/v2024_02_01_preview/_version.py | 9 + .../v2024_02_01_preview/aio/__init__.py | 23 + .../v2024_02_01_preview/aio/_configuration.py | 66 + .../aio/_data_box_management_client.py | 103 + .../databox/v2024_02_01_preview/aio/_patch.py | 20 + .../v2024_02_01_preview/aio/_vendor.py | 28 + .../aio/operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 186 + .../aio/operations/_jobs_operations.py | 1468 + .../aio/operations/_operations.py | 138 + .../aio/operations/_patch.py | 20 + .../aio/operations/_service_operations.py | 914 + .../v2024_02_01_preview/models/__init__.py | 337 + .../_data_box_management_client_enums.py | 514 + .../v2024_02_01_preview/models/_models_py3.py | 6656 ++ .../v2024_02_01_preview/models/_patch.py | 20 + .../operations/__init__.py | 25 + .../_data_box_management_client_operations.py | 220 + .../operations/_jobs_operations.py | 1777 + .../operations/_operations.py | 158 + .../v2024_02_01_preview/operations/_patch.py | 20 + .../operations/_service_operations.py | 1103 + .../mgmt/databox/v2024_02_01_preview/py.typed | 1 + .../generated_samples/available_skus_post.py | 2 +- .../book_shipment_pickup_post.py | 2 +- .../generated_samples/job_mitigate.py | 5 +- .../generated_samples/jobs_cancel_post.py | 5 +- .../generated_samples/jobs_create.py | 2 +- .../jobs_create_device_password.py | 2 +- .../jobs_create_double_encryption.py | 2 +- .../generated_samples/jobs_create_export.py | 2 +- ...jobs_create_with_user_assigned_identity.py | 2 +- .../generated_samples/jobs_delete.py | 5 +- .../generated_samples/jobs_get.py | 2 +- .../generated_samples/jobs_get_cmk.py | 2 +- .../generated_samples/jobs_get_copy_stuck.py | 2 +- .../generated_samples/jobs_get_export.py | 2 +- .../jobs_get_waiting_for_action.py | 2 +- .../generated_samples/jobs_list.py | 2 +- .../jobs_list_by_resource_group.py | 2 +- .../jobs_list_credentials.py | 2 +- .../generated_samples/jobs_patch.py | 2 +- .../generated_samples/jobs_patch_cmk.py | 2 +- ..._patch_system_assigned_to_user_assigned.py | 2 +- .../generated_samples/mark_devices_shipped.py | 5 +- .../generated_samples/operations_get.py | 2 +- .../generated_samples/region_configuration.py | 2 +- .../region_configuration_by_resource_group.py | 2 +- .../validate_address_post.py | 2 +- .../generated_samples/validate_inputs.py | 2 +- .../validate_inputs_by_resource_group.py | 2 +- .../azure-mgmt-databoxedge/_meta.json | 22 +- .../_data_box_edge_management_client.py | 48 +- .../azure/mgmt/databoxedge/_serialization.py | 36 +- .../aio/_data_box_edge_management_client.py | 48 +- .../databoxedge/v2019_03_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 26 +- .../mgmt/databoxedge/v2019_03_01/_vendor.py | 14 - .../mgmt/databoxedge/v2019_03_01/_version.py | 2 +- .../v2019_03_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 26 +- .../aio/operations/_alerts_operations.py | 16 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_devices_operations.py | 97 +- .../aio/operations/_jobs_operations.py | 11 +- .../v2019_03_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 33 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_alerts_operations.py | 26 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_devices_operations.py | 155 +- .../operations/_jobs_operations.py | 17 +- .../v2019_03_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 51 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../databoxedge/v2019_07_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 28 +- .../mgmt/databoxedge/v2019_07_01/_vendor.py | 14 - .../mgmt/databoxedge/v2019_07_01/_version.py | 2 +- .../v2019_07_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 28 +- .../aio/operations/_alerts_operations.py | 16 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_devices_operations.py | 97 +- .../aio/operations/_jobs_operations.py | 11 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2019_07_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 33 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_alerts_operations.py | 26 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_devices_operations.py | 155 +- .../operations/_jobs_operations.py | 17 +- .../operations/_nodes_operations.py | 17 +- .../v2019_07_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 51 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../databoxedge/v2019_08_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 36 +- .../mgmt/databoxedge/v2019_08_01/_vendor.py | 14 - .../mgmt/databoxedge/v2019_08_01/_version.py | 2 +- .../v2019_08_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 36 +- .../aio/operations/_alerts_operations.py | 16 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_containers_operations.py | 40 +- .../aio/operations/_devices_operations.py | 97 +- .../aio/operations/_jobs_operations.py | 11 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2019_08_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 33 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- .../aio/operations/_skus_operations.py | 11 +- ..._storage_account_credentials_operations.py | 33 +- .../_storage_accounts_operations.py | 33 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_alerts_operations.py | 26 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_containers_operations.py | 62 +- .../operations/_devices_operations.py | 155 +- .../operations/_jobs_operations.py | 17 +- .../operations/_nodes_operations.py | 17 +- .../v2019_08_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 51 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- .../operations/_skus_operations.py | 17 +- ..._storage_account_credentials_operations.py | 51 +- .../_storage_accounts_operations.py | 51 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../v2020_05_01_preview/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 58 +- .../v2020_05_01_preview/_vendor.py | 14 - .../v2020_05_01_preview/_version.py | 2 +- .../v2020_05_01_preview/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 58 +- .../aio/operations/_alerts_operations.py | 20 +- .../operations/_available_skus_operations.py | 13 +- .../_bandwidth_schedules_operations.py | 45 +- .../aio/operations/_containers_operations.py | 56 +- .../aio/operations/_devices_operations.py | 137 +- .../aio/operations/_jobs_operations.py | 13 +- .../aio/operations/_nodes_operations.py | 13 +- .../aio/operations/_operations.py | 13 +- .../_operations_status_operations.py | 13 +- .../aio/operations/_orders_operations.py | 45 +- .../aio/operations/_roles_operations.py | 45 +- .../aio/operations/_shares_operations.py | 56 +- .../aio/operations/_skus_operations.py | 13 +- ..._storage_account_credentials_operations.py | 45 +- .../_storage_accounts_operations.py | 45 +- .../aio/operations/_triggers_operations.py | 45 +- .../aio/operations/_users_operations.py | 45 +- .../operations/_alerts_operations.py | 34 +- .../operations/_available_skus_operations.py | 21 +- .../_bandwidth_schedules_operations.py | 71 +- .../operations/_containers_operations.py | 88 +- .../operations/_devices_operations.py | 223 +- .../operations/_jobs_operations.py | 21 +- .../operations/_nodes_operations.py | 21 +- .../operations/_operations.py | 17 +- .../_operations_status_operations.py | 21 +- .../operations/_orders_operations.py | 71 +- .../operations/_roles_operations.py | 71 +- .../operations/_shares_operations.py | 88 +- .../operations/_skus_operations.py | 21 +- ..._storage_account_credentials_operations.py | 71 +- .../_storage_accounts_operations.py | 71 +- .../operations/_triggers_operations.py | 71 +- .../operations/_users_operations.py | 71 +- .../databoxedge/v2020_09_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 42 +- .../mgmt/databoxedge/v2020_09_01/_vendor.py | 14 - .../mgmt/databoxedge/v2020_09_01/_version.py | 2 +- .../v2020_09_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 42 +- .../aio/operations/_addons_operations.py | 33 +- .../aio/operations/_alerts_operations.py | 16 +- .../operations/_available_skus_operations.py | 11 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_containers_operations.py | 40 +- .../aio/operations/_devices_operations.py | 109 +- .../aio/operations/_jobs_operations.py | 11 +- .../_monitoring_config_operations.py | 33 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2020_09_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 38 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../_storage_accounts_operations.py | 33 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_addons_operations.py | 51 +- .../operations/_alerts_operations.py | 26 +- .../operations/_available_skus_operations.py | 17 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_containers_operations.py | 62 +- .../operations/_devices_operations.py | 175 +- .../operations/_jobs_operations.py | 17 +- .../_monitoring_config_operations.py | 51 +- .../operations/_nodes_operations.py | 17 +- .../v2020_09_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 60 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../_storage_accounts_operations.py | 51 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../v2020_09_01_preview/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 62 +- .../v2020_09_01_preview/_vendor.py | 14 - .../v2020_09_01_preview/_version.py | 2 +- .../v2020_09_01_preview/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 62 +- .../aio/operations/_addons_operations.py | 45 +- .../aio/operations/_alerts_operations.py | 20 +- .../operations/_available_skus_operations.py | 13 +- .../_bandwidth_schedules_operations.py | 45 +- .../aio/operations/_containers_operations.py | 56 +- .../aio/operations/_devices_operations.py | 153 +- .../aio/operations/_jobs_operations.py | 13 +- .../_monitoring_config_operations.py | 45 +- .../aio/operations/_nodes_operations.py | 13 +- .../aio/operations/_operations.py | 13 +- .../_operations_status_operations.py | 13 +- .../aio/operations/_orders_operations.py | 52 +- .../aio/operations/_roles_operations.py | 45 +- .../aio/operations/_shares_operations.py | 56 +- ..._storage_account_credentials_operations.py | 45 +- .../_storage_accounts_operations.py | 45 +- .../aio/operations/_triggers_operations.py | 45 +- .../aio/operations/_users_operations.py | 45 +- .../operations/_addons_operations.py | 71 +- .../operations/_alerts_operations.py | 34 +- .../operations/_available_skus_operations.py | 21 +- .../_bandwidth_schedules_operations.py | 71 +- .../operations/_containers_operations.py | 88 +- .../operations/_devices_operations.py | 251 +- .../operations/_jobs_operations.py | 21 +- .../_monitoring_config_operations.py | 71 +- .../operations/_nodes_operations.py | 21 +- .../operations/_operations.py | 17 +- .../_operations_status_operations.py | 21 +- .../operations/_orders_operations.py | 84 +- .../operations/_roles_operations.py | 71 +- .../operations/_shares_operations.py | 88 +- ..._storage_account_credentials_operations.py | 71 +- .../_storage_accounts_operations.py | 71 +- .../operations/_triggers_operations.py | 71 +- .../operations/_users_operations.py | 71 +- .../databoxedge/v2020_12_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 42 +- .../mgmt/databoxedge/v2020_12_01/_vendor.py | 14 - .../mgmt/databoxedge/v2020_12_01/_version.py | 2 +- .../v2020_12_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 42 +- .../aio/operations/_addons_operations.py | 33 +- .../aio/operations/_alerts_operations.py | 16 +- .../operations/_available_skus_operations.py | 11 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_containers_operations.py | 40 +- .../aio/operations/_devices_operations.py | 109 +- .../aio/operations/_jobs_operations.py | 11 +- .../_monitoring_config_operations.py | 33 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2020_12_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 38 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../_storage_accounts_operations.py | 33 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_addons_operations.py | 51 +- .../operations/_alerts_operations.py | 26 +- .../operations/_available_skus_operations.py | 17 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_containers_operations.py | 62 +- .../operations/_devices_operations.py | 175 +- .../operations/_jobs_operations.py | 17 +- .../_monitoring_config_operations.py | 51 +- .../operations/_nodes_operations.py | 17 +- .../v2020_12_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 60 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../_storage_accounts_operations.py | 51 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../databoxedge/v2021_02_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 46 +- .../mgmt/databoxedge/v2021_02_01/_vendor.py | 14 - .../mgmt/databoxedge/v2021_02_01/_version.py | 2 +- .../v2021_02_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 46 +- .../aio/operations/_addons_operations.py | 33 +- .../aio/operations/_alerts_operations.py | 16 +- .../operations/_available_skus_operations.py | 11 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_containers_operations.py | 40 +- .../aio/operations/_devices_operations.py | 107 +- .../_diagnostic_settings_operations.py | 35 +- .../aio/operations/_jobs_operations.py | 11 +- .../_monitoring_config_operations.py | 33 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2021_02_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 38 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../_storage_accounts_operations.py | 33 +- .../_support_packages_operations.py | 16 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_addons_operations.py | 51 +- .../operations/_alerts_operations.py | 26 +- .../operations/_available_skus_operations.py | 17 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_containers_operations.py | 62 +- .../operations/_devices_operations.py | 173 +- .../_diagnostic_settings_operations.py | 53 +- .../operations/_jobs_operations.py | 17 +- .../_monitoring_config_operations.py | 51 +- .../operations/_nodes_operations.py | 17 +- .../v2021_02_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 60 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../_storage_accounts_operations.py | 51 +- .../_support_packages_operations.py | 22 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../v2021_02_01_preview/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 62 +- .../v2021_02_01_preview/_vendor.py | 14 - .../v2021_02_01_preview/_version.py | 2 +- .../v2021_02_01_preview/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 62 +- .../aio/operations/_addons_operations.py | 45 +- .../aio/operations/_alerts_operations.py | 20 +- .../operations/_available_skus_operations.py | 13 +- .../_bandwidth_schedules_operations.py | 45 +- .../aio/operations/_containers_operations.py | 56 +- .../aio/operations/_devices_operations.py | 153 +- .../aio/operations/_jobs_operations.py | 13 +- .../_monitoring_config_operations.py | 45 +- .../aio/operations/_nodes_operations.py | 13 +- .../aio/operations/_operations.py | 13 +- .../_operations_status_operations.py | 13 +- .../aio/operations/_orders_operations.py | 52 +- .../aio/operations/_roles_operations.py | 45 +- .../aio/operations/_shares_operations.py | 56 +- ..._storage_account_credentials_operations.py | 45 +- .../_storage_accounts_operations.py | 45 +- .../aio/operations/_triggers_operations.py | 45 +- .../aio/operations/_users_operations.py | 45 +- .../operations/_addons_operations.py | 71 +- .../operations/_alerts_operations.py | 34 +- .../operations/_available_skus_operations.py | 21 +- .../_bandwidth_schedules_operations.py | 71 +- .../operations/_containers_operations.py | 88 +- .../operations/_devices_operations.py | 251 +- .../operations/_jobs_operations.py | 21 +- .../_monitoring_config_operations.py | 71 +- .../operations/_nodes_operations.py | 21 +- .../operations/_operations.py | 17 +- .../_operations_status_operations.py | 21 +- .../operations/_orders_operations.py | 84 +- .../operations/_roles_operations.py | 71 +- .../operations/_shares_operations.py | 88 +- ..._storage_account_credentials_operations.py | 71 +- .../_storage_accounts_operations.py | 71 +- .../operations/_triggers_operations.py | 71 +- .../operations/_users_operations.py | 71 +- .../databoxedge/v2022_03_01/_configuration.py | 8 +- .../_data_box_edge_management_client.py | 50 +- .../mgmt/databoxedge/v2022_03_01/_vendor.py | 14 - .../mgmt/databoxedge/v2022_03_01/_version.py | 2 +- .../v2022_03_01/aio/_configuration.py | 8 +- .../aio/_data_box_edge_management_client.py | 50 +- .../aio/operations/_addons_operations.py | 33 +- .../aio/operations/_alerts_operations.py | 16 +- .../operations/_available_skus_operations.py | 11 +- .../_bandwidth_schedules_operations.py | 33 +- .../aio/operations/_containers_operations.py | 40 +- .../_device_capacity_check_operations.py | 16 +- .../_device_capacity_info_operations.py | 11 +- .../aio/operations/_devices_operations.py | 107 +- .../_diagnostic_settings_operations.py | 35 +- .../aio/operations/_jobs_operations.py | 11 +- .../_monitoring_config_operations.py | 33 +- .../aio/operations/_nodes_operations.py | 11 +- .../v2022_03_01/aio/operations/_operations.py | 11 +- .../_operations_status_operations.py | 11 +- .../aio/operations/_orders_operations.py | 38 +- .../aio/operations/_roles_operations.py | 33 +- .../aio/operations/_shares_operations.py | 40 +- ..._storage_account_credentials_operations.py | 33 +- .../_storage_accounts_operations.py | 33 +- .../_support_packages_operations.py | 16 +- .../aio/operations/_triggers_operations.py | 33 +- .../aio/operations/_users_operations.py | 33 +- .../operations/_addons_operations.py | 51 +- .../operations/_alerts_operations.py | 26 +- .../operations/_available_skus_operations.py | 17 +- .../_bandwidth_schedules_operations.py | 51 +- .../operations/_containers_operations.py | 62 +- .../_device_capacity_check_operations.py | 22 +- .../_device_capacity_info_operations.py | 17 +- .../operations/_devices_operations.py | 173 +- .../_diagnostic_settings_operations.py | 53 +- .../operations/_jobs_operations.py | 17 +- .../_monitoring_config_operations.py | 51 +- .../operations/_nodes_operations.py | 17 +- .../v2022_03_01/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- .../operations/_orders_operations.py | 60 +- .../operations/_roles_operations.py | 51 +- .../operations/_shares_operations.py | 62 +- ..._storage_account_credentials_operations.py | 51 +- .../_storage_accounts_operations.py | 51 +- .../_support_packages_operations.py | 22 +- .../operations/_triggers_operations.py | 51 +- .../operations/_users_operations.py | 51 +- .../bandwidth_schedule_delete.py | 3 +- .../generated_samples/container_delete.py | 3 +- .../generated_samples/container_refresh.py | 3 +- .../data_box_edge_device_delete.py | 3 +- .../generated_samples/delete_addons.py | 3 +- .../delete_monitoring_config.py | 3 +- .../device_capacity_request_post.py | 3 +- .../download_updates_post.py | 3 +- .../generated_samples/install_updates_post.py | 3 +- .../generated_samples/order_delete.py | 3 +- .../generated_samples/role_delete.py | 3 +- .../generated_samples/sac_delete.py | 3 +- .../scan_for_updates_post.py | 3 +- .../security_settings_update_post.py | 3 +- .../generated_samples/share_delete.py | 3 +- .../generated_samples/share_refresh_post.py | 3 +- .../storage_account_delete.py | 3 +- .../generated_samples/trigger_delete.py | 3 +- .../trigger_support_package.py | 3 +- .../generated_samples/user_delete.py | 3 +- .../azure-mgmt-databricks/_meta.json | 10 +- .../azure/mgmt/databricks/_serialization.py | 26 +- .../azure/mgmt/databricks/_vendor.py | 14 - .../azure/mgmt/databricks/_version.py | 2 +- .../databricks/aio/operations/_operations.py | 2 +- ...twork_dependencies_endpoints_operations.py | 2 +- ...private_endpoint_connections_operations.py | 12 +- .../_private_link_resources_operations.py | 4 +- .../operations/_vnet_peering_operations.py | 12 +- .../aio/operations/_workspaces_operations.py | 29 +- .../azure/mgmt/databricks/models/__init__.py | 26 + ...zure_databricks_management_client_enums.py | 60 +- .../mgmt/databricks/models/_models_py3.py | 272 +- .../_access_connectors_operations.py | 14 +- .../mgmt/databricks/operations/_operations.py | 4 +- ...twork_dependencies_endpoints_operations.py | 8 +- ...private_endpoint_connections_operations.py | 30 +- .../_private_link_resources_operations.py | 14 +- .../operations/_vnet_peering_operations.py | 30 +- .../operations/_workspaces_operations.py | 64 +- .../generated_samples/disable_encryption.py | 2 +- .../generated_samples/enable_encryption.py | 2 +- .../list_private_endpoint_connections.py | 2 +- .../list_private_link_resources.py | 2 +- .../generated_samples/operations_list.py | 2 +- ...und_network_dependencies_endpoints_list.py | 2 +- .../generated_samples/prepare_encryption.py | 2 +- .../private_endpoint_connections_delete.py | 2 +- .../private_endpoint_connections_get.py | 2 +- .../private_endpoint_connections_update.py | 2 +- .../private_link_resources_get.py | 2 +- .../generated_samples/workspace_create.py | 12 +- .../workspace_create_with_parameters.py | 9 +- .../generated_samples/workspace_delete.py | 2 +- .../workspace_delete_retain_uc_data.py | 40 + ...ed_security_compliance_create_or_update.py | 52 + ...kspace_enhanced_security_compliance_get.py | 41 + .../generated_samples/workspace_get.py | 2 +- .../workspace_get_parameters.py | 2 +- ...orkspace_managed_disk_encryption_create.py | 2 +- .../workspace_managed_disk_encryption_get.py | 2 +- ...orkspace_managed_disk_encryption_update.py | 2 +- .../generated_samples/workspace_update.py | 2 +- .../workspace_virtual_net_peering_get.py | 2 +- .../workspace_virtual_net_peering_list.py | 2 +- ...irtual_network_peering_create_or_update.py | 2 +- ...orkspace_virtual_network_peering_delete.py | 2 +- .../workspaces_list_by_resource_group.py | 2 +- .../workspaces_list_by_subscription.py | 2 +- .../azure-mgmt-datafactory/_meta.json | 4 +- .../azure/mgmt/datafactory/_version.py | 2 +- .../azure/mgmt/datafactory/models/__init__.py | 20 +- .../_data_factory_management_client_enums.py | 15 +- .../mgmt/datafactory/models/_models_py3.py | 2138 +- .../_meta.json | 4 +- .../desktopvirtualization/_configuration.py | 6 +- .../_desktop_virtualization_mgmt_client.py | 75 +- .../mgmt/desktopvirtualization/_version.py | 2 +- .../aio/_configuration.py | 6 +- .../_desktop_virtualization_mgmt_client.py | 75 +- .../aio/operations/__init__.py | 20 + ..._session_host_configurations_operations.py | 215 + .../_app_attach_package_info_operations.py | 230 + .../_app_attach_package_operations.py | 671 + ..._control_session_host_update_operations.py | 280 + ...initiate_session_host_update_operations.py | 284 + ...figurations_operation_status_operations.py | 227 + ..._session_host_configurations_operations.py | 724 + ...managements_operation_status_operations.py | 247 + .../_session_host_managements_operations.py | 511 + .../operations/_session_host_operations.py | 115 + .../desktopvirtualization/models/__init__.py | 138 + ...esktop_virtualization_mgmt_client_enums.py | 184 + .../models/_models_py3.py | 3029 +- .../operations/__init__.py | 20 + ..._session_host_configurations_operations.py | 280 + .../_app_attach_package_info_operations.py | 266 + .../_app_attach_package_operations.py | 897 + .../_application_groups_operations.py | 12 +- .../operations/_applications_operations.py | 10 +- ..._control_session_host_update_operations.py | 319 + .../operations/_desktops_operations.py | 6 +- .../operations/_host_pools_operations.py | 14 +- ...initiate_session_host_update_operations.py | 323 + .../operations/_msix_images_operations.py | 2 +- .../operations/_msix_packages_operations.py | 10 +- .../operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 16 +- .../_private_link_resources_operations.py | 4 +- ...ling_plan_personal_schedules_operations.py | 10 +- ...caling_plan_pooled_schedules_operations.py | 10 +- .../operations/_scaling_plans_operations.py | 14 +- ...figurations_operation_status_operations.py | 306 + ..._session_host_configurations_operations.py | 856 + ...managements_operation_status_operations.py | 338 + .../_session_host_managements_operations.py | 646 + .../operations/_session_host_operations.py | 152 + .../operations/_session_hosts_operations.py | 8 +- .../_start_menu_items_operations.py | 2 +- .../operations/_user_sessions_operations.py | 12 +- .../operations/_workspaces_operations.py | 12 +- .../active_session_host_configurations_get.py | 41 + ...n_host_configurations_list_by_host_pool.py | 42 + .../app_attach_package_create.py | 82 + .../app_attach_package_delete.py | 40 + .../app_attach_package_get.py | 41 + .../app_attach_package_info_import_post.py | 43 + ...p_attach_package_list_by_resource_group.py | 41 + ...app_attach_package_list_by_subscription.py | 39 + .../app_attach_package_update.py | 41 + .../generated_samples/application_create.py | 2 +- .../generated_samples/application_delete.py | 2 +- .../generated_samples/application_get.py | 2 +- .../application_group_create.py | 2 +- .../application_group_delete.py | 2 +- .../application_group_get.py | 2 +- ...pplication_group_list_by_resource_group.py | 2 +- .../application_group_list_by_subscription.py | 2 +- .../application_group_update.py | 2 +- .../generated_samples/application_list.py | 2 +- .../generated_samples/application_update.py | 2 +- .../generated_samples/desktop_get.py | 2 +- .../generated_samples/desktop_list.py | 2 +- .../generated_samples/desktop_update.py | 2 +- .../generated_samples/host_pool_create.py | 7 +- .../generated_samples/host_pool_delete.py | 2 +- .../generated_samples/host_pool_get.py | 2 +- .../generated_samples/host_pool_list.py | 2 +- .../host_pool_list_by_resource_group.py | 2 +- .../generated_samples/host_pool_update.py | 2 +- ..._pools_retrieve_registration_token_post.py | 2 +- .../msix_image_expand_post.py | 2 +- .../generated_samples/msix_package_create.py | 2 +- .../generated_samples/msix_package_delete.py | 2 +- .../generated_samples/msix_package_get.py | 2 +- .../generated_samples/msix_package_list.py | 2 +- .../generated_samples/msix_package_update.py | 2 +- .../operation_description_list.py | 2 +- ...endpoint_connection_delete_by_host_pool.py | 2 +- ...endpoint_connection_delete_by_workspace.py | 2 +- ...te_endpoint_connection_get_by_host_pool.py | 2 +- ...te_endpoint_connection_get_by_workspace.py | 2 +- ...e_endpoint_connection_list_by_host_pool.py | 2 +- ...e_endpoint_connection_list_by_workspace.py | 2 +- ...endpoint_connection_update_by_host_pool.py | 2 +- ...endpoint_connection_update_by_workspace.py | 2 +- ...rivate_link_resources_list_by_host_pool.py | 2 +- ...rivate_link_resources_list_by_workspace.py | 2 +- .../generated_samples/scaling_plan_create.py | 2 +- .../generated_samples/scaling_plan_delete.py | 2 +- .../generated_samples/scaling_plan_get.py | 2 +- .../scaling_plan_list_by_host_pool.py | 2 +- .../scaling_plan_list_by_resource_group.py | 2 +- .../scaling_plan_list_by_subscription.py | 2 +- .../scaling_plan_personal_schedule_create.py | 2 +- .../scaling_plan_personal_schedule_delete.py | 2 +- .../scaling_plan_personal_schedule_get.py | 2 +- .../scaling_plan_personal_schedule_list.py | 2 +- .../scaling_plan_personal_schedule_update.py | 2 +- .../scaling_plan_pooled_schedule_create.py | 2 +- .../scaling_plan_pooled_schedule_delete.py | 2 +- .../scaling_plan_pooled_schedule_get.py | 2 +- .../scaling_plan_pooled_schedule_list.py | 2 +- .../scaling_plan_pooled_schedule_update.py | 2 +- .../generated_samples/scaling_plan_update.py | 2 +- .../session_host_configurations_create.py | 91 + .../session_host_configurations_get.py | 41 + ...n_host_configurations_list_by_host_pool.py | 42 + ...ost_configurations_operation_status_get.py | 42 + ...st_configurations_operation_status_list.py | 42 + .../session_host_configurations_update.py | 41 + .../generated_samples/session_host_delete.py | 2 +- .../generated_samples/session_host_get.py | 2 +- .../generated_samples/session_host_list.py | 2 +- ...ements_control_session_host_update_post.py | 41 + .../session_host_managements_create.py | 52 + .../session_host_managements_get.py | 41 + ...sion_host_managements_list_by_host_pool.py | 42 + ...n_host_managements_operation_status_get.py | 42 + ..._host_managements_operation_status_list.py | 42 + .../session_host_managements_update.py | 41 + ...t_managements_update_session_hosts_post.py | 40 + .../session_host_retry_provisioning_post.py | 41 + .../generated_samples/session_host_update.py | 2 +- .../generated_samples/start_menu_item_list.py | 2 +- .../generated_samples/user_session_delete.py | 2 +- .../user_session_disconnect_post.py | 2 +- .../generated_samples/user_session_get.py | 2 +- .../generated_samples/user_session_list.py | 2 +- .../user_session_list_by_host_pool.py | 2 +- .../user_session_send_message_post.py | 2 +- .../generated_samples/workspace_create.py | 2 +- .../generated_samples/workspace_delete.py | 2 +- .../generated_samples/workspace_get.py | 2 +- .../workspace_list_by_resource_group.py | 2 +- .../workspace_list_by_subscription.py | 2 +- .../generated_samples/workspace_update.py | 2 +- .../CHANGELOG.md | 5 + .../azure-mgmt-devopsinfrastructure/LICENSE | 21 + .../MANIFEST.in | 8 + .../azure-mgmt-devopsinfrastructure/README.md | 61 + .../_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/devopsinfrastructure/__init__.py | 26 + .../devopsinfrastructure/_configuration.py | 66 + .../_managed_dev_ops_infrastructure.py | 94 + .../azure/mgmt/devopsinfrastructure/_patch.py | 20 + .../devopsinfrastructure/_serialization.py | 2006 + .../mgmt/devopsinfrastructure/_vendor.py | 16 + .../mgmt/devopsinfrastructure/_version.py | 9 + .../mgmt/devopsinfrastructure/aio/__init__.py | 23 + .../aio/_configuration.py | 66 + .../aio/_managed_dev_ops_infrastructure.py | 94 + .../mgmt/devopsinfrastructure/aio/_patch.py | 20 + .../aio/operations/__init__.py | 21 + .../aio/operations/_operations.py | 134 + .../aio/operations/_patch.py | 20 + .../aio/operations/_pools_operations.py | 856 + .../devopsinfrastructure/models/__init__.py | 95 + .../_managed_dev_ops_infrastructure_enums.py | 96 + .../models/_models_py3.py | 1348 + .../devopsinfrastructure/models/_patch.py | 20 + .../operations/__init__.py | 21 + .../operations/_operations.py | 155 + .../devopsinfrastructure/operations/_patch.py | 20 + .../operations/_pools_operations.py | 1036 + .../azure/mgmt/devopsinfrastructure/py.typed | 1 + .../create_or_update_pool.py | 59 + .../generated_samples/delete_pool.py | 40 + .../generated_samples/get_pool.py | 41 + .../generated_samples/list_operations.py | 39 + .../list_pools_by_subscription.py | 39 + ...ools_by_subscription_and_resource_group.py | 41 + .../sdk_packaging.toml | 11 + .../azure-mgmt-devopsinfrastructure/setup.py | 82 + sdk/devopsinfrastructure/ci.yml | 34 + .../azure-mgmt-edgemarketplace/CHANGELOG.md | 5 + .../azure-mgmt-edgemarketplace/LICENSE | 21 + .../azure-mgmt-edgemarketplace/MANIFEST.in | 8 + .../azure-mgmt-edgemarketplace/README.md | 61 + .../azure-mgmt-edgemarketplace/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/edgemarketplace/__init__.py | 26 + .../mgmt/edgemarketplace/_configuration.py | 66 + .../_edge_market_place_mgmt_client.py | 97 + .../azure/mgmt/edgemarketplace/_patch.py | 20 + .../mgmt/edgemarketplace/_serialization.py | 2006 + .../azure/mgmt/edgemarketplace/_vendor.py | 16 + .../azure/mgmt/edgemarketplace/_version.py | 9 + .../mgmt/edgemarketplace/aio/__init__.py | 23 + .../edgemarketplace/aio/_configuration.py | 66 + .../aio/_edge_market_place_mgmt_client.py | 97 + .../azure/mgmt/edgemarketplace/aio/_patch.py | 20 + .../aio/operations/__init__.py | 23 + .../aio/operations/_offers_operations.py | 685 + .../aio/operations/_operations.py | 133 + .../edgemarketplace/aio/operations/_patch.py | 20 + .../aio/operations/_publishers_operations.py | 332 + .../mgmt/edgemarketplace/models/__init__.py | 79 + .../_edge_market_place_mgmt_client_enums.py | 64 + .../edgemarketplace/models/_models_py3.py | 1206 + .../mgmt/edgemarketplace/models/_patch.py | 20 + .../edgemarketplace/operations/__init__.py | 23 + .../operations/_offers_operations.py | 852 + .../edgemarketplace/operations/_operations.py | 155 + .../mgmt/edgemarketplace/operations/_patch.py | 20 + .../operations/_publishers_operations.py | 441 + .../azure/mgmt/edgemarketplace/py.typed | 1 + .../generate_access_token.py | 51 + .../generated_samples/get_access_token.py | 42 + .../generated_samples/get_offer.py | 41 + .../generated_samples/get_publisher.py | 41 + .../generated_samples/list_offers.py | 41 + .../list_offers_by_subscription.py | 39 + .../generated_samples/list_operations.py | 39 + .../generated_samples/list_publishers.py | 41 + .../list_publishers_by_subscription.py | 39 + .../sdk_packaging.toml | 11 + .../azure-mgmt-edgemarketplace/setup.py | 82 + sdk/edgemarketplace/ci.yml | 34 + sdk/edgeorder/azure-mgmt-edgeorder/_meta.json | 15 +- .../_edge_order_management_client.py | 12 +- .../azure/mgmt/edgeorder/_operations_mixin.py | 1 + .../azure/mgmt/edgeorder/_serialization.py | 36 +- .../aio/_edge_order_management_client.py | 12 +- .../mgmt/edgeorder/aio/_operations_mixin.py | 1 + .../v2020_12_01_preview/_configuration.py | 8 +- .../_edge_order_management_client.py | 2 +- .../v2020_12_01_preview/_metadata.json | 6 +- .../edgeorder/v2020_12_01_preview/_vendor.py | 14 +- .../edgeorder/v2020_12_01_preview/_version.py | 2 +- .../v2020_12_01_preview/aio/_configuration.py | 8 +- .../aio/_edge_order_management_client.py | 2 +- ...edge_order_management_client_operations.py | 232 +- .../_edge_order_management_client_enums.py | 2 + .../v2020_12_01_preview/models/_models_py3.py | 2 +- ...edge_order_management_client_operations.py | 358 +- .../edgeorder/v2021_12_01/_configuration.py | 8 +- .../_edge_order_management_client.py | 2 +- .../mgmt/edgeorder/v2021_12_01/_metadata.json | 6 +- .../mgmt/edgeorder/v2021_12_01/_vendor.py | 14 +- .../mgmt/edgeorder/v2021_12_01/_version.py | 2 +- .../v2021_12_01/aio/_configuration.py | 8 +- .../aio/_edge_order_management_client.py | 2 +- ...edge_order_management_client_operations.py | 213 +- .../_edge_order_management_client_enums.py | 2 + .../v2021_12_01/models/_models_py3.py | 2 +- ...edge_order_management_client_operations.py | 297 +- .../v2022_05_01_preview/_configuration.py | 8 +- .../_edge_order_management_client.py | 20 +- .../edgeorder/v2022_05_01_preview/_vendor.py | 14 - .../edgeorder/v2022_05_01_preview/_version.py | 2 +- .../v2022_05_01_preview/aio/_configuration.py | 8 +- .../aio/_edge_order_management_client.py | 20 +- .../aio/operations/_addresses_operations.py | 77 +- .../aio/operations/_operations.py | 13 +- .../aio/operations/_order_items_operations.py | 117 +- .../aio/operations/_orders_operations.py | 27 +- ..._products_and_configurations_operations.py | 32 +- .../_edge_order_management_client_enums.py | 2 + .../v2022_05_01_preview/models/_models_py3.py | 2 +- .../operations/_addresses_operations.py | 115 +- .../operations/_operations.py | 17 +- .../operations/_order_items_operations.py | 167 +- .../operations/_orders_operations.py | 47 +- ..._products_and_configurations_operations.py | 52 +- .../generated_samples/cancel_order_item.py | 3 +- .../delete_address_by_name.py | 3 +- .../delete_order_item_by_name.py | 3 +- .../generated_samples/return_order_item.py | 3 +- sdk/elastic/azure-mgmt-elastic/_meta.json | 10 +- .../azure/mgmt/elastic/_configuration.py | 7 +- .../azure/mgmt/elastic/_microsoft_elastic.py | 20 +- .../azure/mgmt/elastic/_serialization.py | 26 +- .../azure/mgmt/elastic/_vendor.py | 14 - .../azure/mgmt/elastic/_version.py | 2 +- .../azure/mgmt/elastic/aio/_configuration.py | 7 +- .../mgmt/elastic/aio/_microsoft_elastic.py | 20 +- .../mgmt/elastic/aio/operations/__init__.py | 6 + .../_all_traffic_filters_operations.py | 4 +- .../_associate_traffic_filter_operations.py | 4 +- .../operations/_billing_info_operations.py | 118 + ..._connected_partner_resources_operations.py | 153 + ...eate_and_associate_ip_filter_operations.py | 4 +- ...eate_and_associate_pl_filter_operations.py | 4 +- .../operations/_deployment_info_operations.py | 4 +- ...ch_and_delete_traffic_filter_operations.py | 4 +- .../_detach_traffic_filter_operations.py | 4 +- .../operations/_external_user_operations.py | 15 +- ...t_associated_traffic_filters_operations.py | 4 +- .../aio/operations/_monitor_operations.py | 15 +- .../_monitored_resources_operations.py | 4 +- .../aio/operations/_monitors_operations.py | 41 +- .../aio/operations/_open_ai_operations.py | 538 + .../operations/_organizations_operations.py | 70 +- .../aio/operations/_tag_rules_operations.py | 27 +- .../operations/_traffic_filters_operations.py | 4 +- .../_upgradable_versions_operations.py | 4 +- .../operations/_vm_collection_operations.py | 15 +- .../aio/operations/_vm_host_operations.py | 4 +- .../operations/_vm_ingestion_operations.py | 4 +- .../azure/mgmt/elastic/models/__init__.py | 26 + .../azure/mgmt/elastic/models/_models_py3.py | 530 +- .../azure/mgmt/elastic/operations/__init__.py | 6 + .../_all_traffic_filters_operations.py | 14 +- .../_associate_traffic_filter_operations.py | 14 +- .../operations/_billing_info_operations.py | 152 + ..._connected_partner_resources_operations.py | 187 + ...eate_and_associate_ip_filter_operations.py | 14 +- ...eate_and_associate_pl_filter_operations.py | 14 +- .../operations/_deployment_info_operations.py | 14 +- ...ch_and_delete_traffic_filter_operations.py | 14 +- .../_detach_traffic_filter_operations.py | 14 +- .../_elastic_versions_operations.py | 6 +- .../operations/_external_user_operations.py | 25 +- ...t_associated_traffic_filters_operations.py | 14 +- .../elastic/operations/_monitor_operations.py | 25 +- .../_monitored_resources_operations.py | 14 +- .../operations/_monitors_operations.py | 87 +- .../elastic/operations/_open_ai_operations.py | 703 + .../mgmt/elastic/operations/_operations.py | 2 +- .../operations/_organizations_operations.py | 98 +- .../operations/_tag_rules_operations.py | 61 +- .../operations/_traffic_filters_operations.py | 14 +- .../_upgradable_versions_operations.py | 14 +- .../operations/_vm_collection_operations.py | 25 +- .../elastic/operations/_vm_host_operations.py | 14 +- .../operations/_vm_ingestion_operations.py | 14 +- .../all_traffic_filters_list.py | 2 +- .../associate_traffic_filter_update.py | 5 +- .../associated_filters_for_deployment_list.py | 2 +- .../generated_samples/billing_info_get.py | 41 + .../connected_partner_resources_list.py | 42 + .../generated_samples/deployment_info_list.py | 2 +- ...detach_and_delete_traffic_filter_delete.py | 5 +- .../detach_traffic_filters_update.py | 5 +- .../elastic_versions_list.py | 2 +- .../generated_samples/external_user_info.py | 2 +- .../ip_traffic_filter_create.py | 5 +- .../generated_samples/monitor_upgrade.py | 5 +- .../monitored_resources_list.py | 2 +- .../generated_samples/monitors_create.py | 2 +- .../generated_samples/monitors_delete.py | 5 +- .../generated_samples/monitors_get.py | 2 +- .../generated_samples/monitors_list.py | 2 +- .../monitors_list_by_resource_group.py | 2 +- .../generated_samples/monitors_update.py | 2 +- .../open_ai_create_or_update.py | 42 + .../generated_samples/open_ai_delete.py | 41 + .../generated_samples/open_ai_get.py | 42 + .../generated_samples/open_ai_get_status.py | 42 + .../generated_samples/open_ai_list.py | 42 + .../generated_samples/operations_list.py | 2 +- .../organizations_get_api_key.py | 2 +- ...t_elastic_to_azure_subscription_mapping.py | 38 + .../private_link_traffic_filters_create.py | 5 +- .../tag_rules_create_or_update.py | 2 +- .../generated_samples/tag_rules_delete.py | 5 +- .../generated_samples/tag_rules_get.py | 2 +- .../generated_samples/tag_rules_list.py | 2 +- .../traffic_filters_delete.py | 5 +- .../upgradable_versions_details.py | 2 +- .../generated_samples/vm_collection_update.py | 5 +- .../generated_samples/vm_host_list.py | 2 +- .../generated_samples/vm_ingestion_details.py | 2 +- .../azure-mgmt-elasticsan/_meta.json | 4 +- .../azure/mgmt/elasticsan/_version.py | 2 +- .../_meta.json | 4 +- .../mgmt/hardwaresecuritymodules/_version.py | 2 +- .../azure-mgmt-hdinsightcontainers/_meta.json | 4 +- .../hdinsightcontainers/_configuration.py | 4 +- .../_hd_insight_containers_mgmt_client.py | 18 +- .../hdinsightcontainers/aio/_configuration.py | 4 +- .../aio/_hd_insight_containers_mgmt_client.py | 18 +- .../aio/operations/__init__.py | 4 + .../_cluster_available_upgrades_operations.py | 150 + .../operations/_cluster_jobs_operations.py | 11 +- ...ster_pool_available_upgrades_operations.py | 147 + .../operations/_cluster_pools_operations.py | 234 +- .../aio/operations/_clusters_operations.py | 245 +- .../hdinsightcontainers/models/__init__.py | 100 + ...hd_insight_containers_mgmt_client_enums.py | 123 + .../hdinsightcontainers/models/_models_py3.py | 2415 +- .../operations/__init__.py | 4 + ...ilable_cluster_pool_versions_operations.py | 2 +- .../_available_cluster_versions_operations.py | 2 +- .../_cluster_available_upgrades_operations.py | 187 + .../operations/_cluster_jobs_operations.py | 25 +- ...ster_pool_available_upgrades_operations.py | 183 + .../operations/_cluster_pools_operations.py | 281 +- .../operations/_clusters_operations.py | 296 +- .../operations/_locations_operations.py | 2 +- .../operations/_operations.py | 2 +- .../create_autoscale_cluster.py | 17 +- .../generated_samples/create_cluster_pool.py | 2 +- .../create_cluster_pool_with_private_aks.py} | 36 +- .../create_cluster_pool_with_udr_aks.py | 52 + .../create_ranger_cluster.py | 77 + .../generated_samples/create_spark_cluster.py | 2 +- ...ate_spark_cluster_with_internal_ingress.py | 99 + .../generated_samples/delete_cluster.py | 2 +- .../generated_samples/delete_cluster_pool.py | 2 +- .../generated_samples/get_cluster.py | 2 +- .../get_cluster_instance_view.py | 2 +- .../generated_samples/get_cluster_pool.py | 2 +- .../generated_samples/get_operations.py | 2 +- .../list_available_cluster_pool_versions.py | 2 +- .../list_available_cluster_versions.py | 2 +- .../list_cluster_available_upgrades.py | 43 + .../list_cluster_instance_views.py | 2 +- .../generated_samples/list_cluster_jobs.py | 4 +- .../list_cluster_pool_available_upgrades.py | 42 + .../generated_samples/list_cluster_pools.py | 2 +- .../list_cluster_pools_subscription.py | 2 +- .../list_cluster_service_configs.py | 2 +- .../list_clusters_by_cluster_pool_name.py | 2 +- .../locations_name_availability.py | 2 +- .../generated_samples/patch_cluster.py | 5 +- .../generated_samples/patch_cluster_pool.py | 2 +- .../generated_samples/patch_ranger_cluster.py | 66 + .../generated_samples/resize_cluster.py | 2 +- .../generated_samples/run_cluster_job.py | 4 +- .../upgrade_aks_patch_version_for_cluster.py | 43 + ...rade_aks_patch_version_for_cluster_pool.py | 48 + .../upgrade_hotfix_for_cluster.py | 51 + .../upgrade_node_os_for_cluster_pool.py | 42 + .../azure-mgmt-healthcareapis/_meta.json | 4 +- .../mgmt/healthcareapis/_configuration.py | 4 +- .../_healthcare_apis_management_client.py | 2 +- .../azure/mgmt/healthcareapis/_version.py | 2 +- .../mgmt/healthcareapis/aio/_configuration.py | 4 +- .../aio/_healthcare_apis_management_client.py | 2 +- .../mgmt/healthcareapis/models/__init__.py | 6 + ...healthcare_apis_management_client_enums.py | 6 + .../mgmt/healthcareapis/models/_models_py3.py | 94 + .../operations/_dicom_services_operations.py | 10 +- .../_fhir_destinations_operations.py | 2 +- .../operations/_fhir_services_operations.py | 10 +- ...t_connector_fhir_destination_operations.py | 6 +- .../operations/_iot_connectors_operations.py | 10 +- .../_operation_results_operations.py | 2 +- .../healthcareapis/operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 8 +- .../_private_link_resources_operations.py | 4 +- .../operations/_services_operations.py | 14 +- ...private_endpoint_connections_operations.py | 8 +- ...space_private_link_resources_operations.py | 4 +- .../operations/_workspaces_operations.py | 12 +- .../check_name_availability_post.py | 2 +- .../dicomservices/dicom_services_create.py | 2 +- .../dicomservices/dicom_services_delete.py | 2 +- .../dicomservices/dicom_services_get.py | 2 +- .../dicomservices/dicom_services_list.py | 2 +- .../dicomservices/dicom_services_patch.py | 2 +- .../fhirservices/fhir_services_create.py | 14 +- .../fhirservices/fhir_services_delete.py | 2 +- .../fhirservices/fhir_services_get.py | 2 +- .../fhirservices/fhir_services_list.py | 2 +- .../fhirservices/fhir_services_patch.py | 2 +- .../iotconnectors/iotconnector_create.py | 2 +- .../iotconnectors/iotconnector_delete.py | 2 +- .../iotconnector_fhirdestination_create.py | 2 +- .../iotconnector_fhirdestination_delete.py | 2 +- .../iotconnector_fhirdestination_get.py | 2 +- .../iotconnector_fhirdestination_list.py | 2 +- .../iotconnectors/iotconnector_get.py | 2 +- .../iotconnectors/iotconnector_list.py | 2 +- .../iotconnectors/iotconnector_patch.py | 2 +- .../legacy/private_link_resource_get.py | 2 +- .../private_link_resources_list_by_service.py | 2 +- .../legacy/service_create.py | 2 +- ..._data_sovereign_region_with_cmk_enabled.py | 2 +- .../legacy/service_create_minimum.py | 2 +- ...vice_create_private_endpoint_connection.py | 2 +- .../legacy/service_delete.py | 2 +- ...vice_delete_private_endpoint_connection.py | 2 +- .../generated_samples/legacy/service_get.py | 2 +- ..._data_sovereign_region_with_cmk_enabled.py | 2 +- ...service_get_private_endpoint_connection.py | 2 +- .../generated_samples/legacy/service_list.py | 2 +- .../legacy/service_list_by_resource_group.py | 2 +- ...rvice_list_private_endpoint_connections.py | 2 +- .../generated_samples/legacy/service_patch.py | 2 +- .../operation_results_get.py | 2 +- .../generated_samples/operations_list.py | 2 +- ...rivate_link_resources_list_by_workspace.py | 2 +- ...pace_create_private_endpoint_connection.py | 2 +- ...pace_delete_private_endpoint_connection.py | 2 +- ...rkspace_get_private_endpoint_connection.py | 2 +- ...space_list_private_endpoint_connections.py | 2 +- .../workspace_private_link_resource_get.py | 2 +- .../workspaces/workspaces_create.py | 2 +- .../workspaces/workspaces_delete.py | 2 +- .../workspaces/workspaces_get.py | 2 +- .../workspaces_list_by_resource_group.py | 2 +- .../workspaces_list_by_subscription.py | 2 +- .../workspaces/workspaces_patch.py | 2 +- .../_meta.json | 4 +- .../mgmt/hybridcontainerservice/_version.py | 2 +- .../azure-mgmt-hybridkubernetes/_meta.json | 10 +- .../azure/mgmt/hybridkubernetes/__init__.py | 2 +- .../mgmt/hybridkubernetes/_configuration.py | 15 +- .../_connected_kubernetes_client.py | 17 +- .../mgmt/hybridkubernetes/_serialization.py | 206 +- .../azure/mgmt/hybridkubernetes/_vendor.py | 11 - .../azure/mgmt/hybridkubernetes/_version.py | 2 +- .../mgmt/hybridkubernetes/aio/__init__.py | 2 +- .../hybridkubernetes/aio/_configuration.py | 10 +- .../aio/_connected_kubernetes_client.py | 10 +- .../aio/operations/__init__.py | 2 +- .../_connected_cluster_operations.py | 203 +- .../aio/operations/_operations.py | 24 +- .../mgmt/hybridkubernetes/models/__init__.py | 14 +- .../_connected_kubernetes_client_enums.py | 30 + .../hybridkubernetes/models/_models_py3.py | 239 +- .../hybridkubernetes/operations/__init__.py | 2 +- .../_connected_cluster_operations.py | 239 +- .../operations/_operations.py | 26 +- ...ist_cluster_credential_result_csp_token.py | 42 + ...s_list_cluster_credential_result_cspaad.py | 42 + ...list_cluster_credential_result_hp_token.py | 42 + ...rs_list_cluster_credential_result_hpaad.py | 42 + .../create_cluster_example.py | 52 + .../create_cluster_kind_example.py | 59 + .../create_cluster_private_link_example.py | 54 + .../delete_cluster_example.py | 5 +- .../generated_samples/get_cluster_example.py | 2 +- ...get_clusters_by_resource_group_example.py} | 4 +- .../get_clusters_by_subscription_example.py | 39 + .../get_provisioned_cluster_example.py | 41 + ...st_connected_cluster_operations_example.py | 2 +- .../update_cluster_example.py | 45 + .../_meta.json | 10 +- .../machinelearningservices/_configuration.py | 6 +- .../_machine_learning_services_mgmt_client.py | 156 +- .../machinelearningservices/_serialization.py | 26 +- .../mgmt/machinelearningservices/_vendor.py | 14 - .../mgmt/machinelearningservices/_version.py | 2 +- .../aio/_configuration.py | 6 +- .../_machine_learning_services_mgmt_client.py | 157 +- .../aio/operations/__init__.py | 54 +- ..._capacity_reservation_groups_operations.py | 683 + .../operations/_code_versions_operations.py | 254 +- .../_component_versions_operations.py | 258 +- .../aio/operations/_compute_operations.py | 765 +- .../operations/_data_versions_operations.py | 258 +- .../_endpoint_deployment_operations.py | 750 + .../aio/operations/_endpoint_operations.py | 823 + .../_environment_versions_operations.py | 259 +- .../aio/operations/_features_operations.py | 269 + .../_featureset_containers_operations.py | 649 + .../_featureset_versions_operations.py | 945 + ...aturestore_entity_containers_operations.py | 650 + ...featurestore_entity_versions_operations.py | 681 + .../_inference_endpoints_operations.py | 832 + .../_inference_groups_operations.py | 1123 + .../operations/_inference_pools_operations.py | 1083 + .../aio/operations/_jobs_operations.py | 183 + .../operations/_labeling_jobs_operations.py | 1027 + .../_managed_network_provisions_operations.py | 299 + ...anaged_network_settings_rule_operations.py | 609 + .../_marketplace_subscriptions_operations.py | 619 + .../operations/_model_versions_operations.py | 523 +- .../aio/operations/_operations.py | 12 +- ...private_endpoint_connections_operations.py | 205 +- .../_private_link_resources_operations.py | 134 +- ..._registry_component_versions_operations.py | 4 + .../_registry_data_references_operations.py | 224 + ...egistry_environment_versions_operations.py | 5 + .../_registry_model_versions_operations.py | 268 + .../aio/operations/_schedules_operations.py | 160 + .../_serverless_endpoints_operations.py | 1270 + .../_workspace_connections_operations.py | 787 +- .../aio/operations/_workspaces_operations.py | 1343 +- .../models/__init__.py | 724 +- ...ine_learning_services_mgmt_client_enums.py | 968 +- .../models/_models_py3.py | 39857 +++++-- .../operations/__init__.py | 54 +- .../_batch_deployments_operations.py | 22 +- .../operations/_batch_endpoints_operations.py | 26 +- ..._capacity_reservation_groups_operations.py | 875 + .../operations/_code_containers_operations.py | 18 +- .../operations/_code_versions_operations.py | 315 +- .../_component_containers_operations.py | 18 +- .../_component_versions_operations.py | 318 +- .../operations/_compute_operations.py | 1074 +- .../operations/_data_containers_operations.py | 18 +- .../operations/_data_versions_operations.py | 318 +- .../operations/_datastores_operations.py | 22 +- .../_endpoint_deployment_operations.py | 970 + .../operations/_endpoint_operations.py | 1058 + .../_environment_containers_operations.py | 18 +- .../_environment_versions_operations.py | 319 +- .../operations/_features_operations.py | 381 + .../_featureset_containers_operations.py | 814 + .../_featureset_versions_operations.py | 1162 + ...aturestore_entity_containers_operations.py | 815 + ...featurestore_entity_versions_operations.py | 859 + .../_inference_endpoints_operations.py | 1067 + .../_inference_groups_operations.py | 1410 + .../operations/_inference_pools_operations.py | 1361 + .../operations/_jobs_operations.py | 255 +- .../operations/_labeling_jobs_operations.py | 1280 + .../_managed_network_provisions_operations.py | 340 + ...anaged_network_settings_rule_operations.py | 752 + .../_marketplace_subscriptions_operations.py | 761 + .../_model_containers_operations.py | 18 +- .../operations/_model_versions_operations.py | 622 +- .../_online_deployments_operations.py | 30 +- .../_online_endpoints_operations.py | 34 +- .../operations/_operations.py | 14 +- ...private_endpoint_connections_operations.py | 243 +- .../_private_link_resources_operations.py | 134 +- .../operations/_quotas_operations.py | 10 +- .../operations/_registries_operations.py | 30 +- .../_registry_code_containers_operations.py | 18 +- .../_registry_code_versions_operations.py | 22 +- ...egistry_component_containers_operations.py | 18 +- ..._registry_component_versions_operations.py | 25 +- .../_registry_data_containers_operations.py | 18 +- .../_registry_data_references_operations.py | 267 + .../_registry_data_versions_operations.py | 22 +- ...istry_environment_containers_operations.py | 18 +- ...egistry_environment_versions_operations.py | 26 +- .../_registry_model_containers_operations.py | 18 +- .../_registry_model_versions_operations.py | 329 +- .../operations/_schedules_operations.py | 216 +- .../_serverless_endpoints_operations.py | 1558 + .../operations/_usages_operations.py | 6 +- .../_virtual_machine_sizes_operations.py | 6 +- .../_workspace_connections_operations.py | 1025 +- .../_workspace_features_operations.py | 6 +- .../operations/_workspaces_operations.py | 1522 +- .../create_or_update.py | 49 + .../capacity_reservation_group/delete.py | 40 + .../capacity_reservation_group/get.py | 41 + .../capacity_reservation_group/list.py | 41 + .../list_by_subscription.py | 39 + .../capacity_reservation_group/update.py | 46 + .../compute/create_or_update/aks_compute.py | 2 +- .../compute/create_or_update/aml_compute.py | 2 +- .../create_or_update/basic_aks_compute.py | 2 +- .../create_or_update/basic_aml_compute.py | 2 +- .../basic_data_factory_compute.py | 2 +- .../create_or_update/compute_instance.py | 36 +- .../compute_instance_minimal.py | 2 +- .../compute_instance_with_schedules.py | 2 +- .../create_or_update/kubernetes_compute.py | 2 +- .../generated_samples/compute/delete.py | 2 +- .../compute/get/aks_compute.py | 2 +- .../compute/get/aml_compute.py | 2 +- .../compute/get/compute_instance.py | 2 +- .../compute/get/kubernetes_compute.py | 2 +- .../get_allowed_vm_sizes_for_resize.py | 42 + .../generated_samples/compute/list.py | 2 +- .../generated_samples/compute/list_keys.py | 2 +- .../generated_samples/compute/list_nodes.py | 2 +- .../generated_samples/compute/patch.py | 2 +- .../generated_samples/compute/resize.py | 42 + .../generated_samples/compute/restart.py | 2 +- .../generated_samples/compute/start.py | 2 +- .../generated_samples/compute/stop.py | 2 +- .../compute/update_custom_services.py | 57 + .../compute/update_data_mounts.py | 51 + .../compute/update_idle_shutdown_setting.py | 42 + .../data_reference/get_blob_reference_sas.py | 44 + .../create_or_update.py | 2 +- .../create_or_update.py | 2 +- .../create_or_update.py | 2 +- .../create_or_update.py | 2 +- .../generated_samples/datastore/delete.py | 2 +- .../generated_samples/datastore/get.py | 2 +- .../generated_samples/datastore/list.py | 2 +- .../datastore/list_secrets.py | 2 +- .../generated_samples/endpoint/create.py | 49 + .../endpoint/deployment/create.py | 50 + .../endpoint/deployment/delete.py | 42 + .../endpoint/deployment/get.py | 43 + .../endpoint/deployment/get_deployments.py | 43 + .../endpoint/deployment/get_in_workspace.py | 42 + .../generated_samples/endpoint/get.py | 42 + .../generated_samples/endpoint/get_models.py | 43 + .../generated_samples/endpoint/list.py | 42 + .../generated_samples/endpoint/list_keys.py | 42 + .../endpoint/regenerate_key.py | 43 + .../generated_samples/external_fqdn/get.py | 2 +- .../generated_samples/feature/get.py | 44 + .../generated_samples/feature/list.py | 44 + .../job/auto_ml_job/create_or_update.py | 31 +- .../generated_samples/job/auto_ml_job/get.py | 2 +- .../generated_samples/job/auto_ml_job/list.py | 2 +- .../generated_samples/job/cancel.py | 2 +- .../job/command_job/create_or_update.py | 17 +- .../generated_samples/job/command_job/get.py | 2 +- .../generated_samples/job/command_job/list.py | 2 +- .../generated_samples/job/delete.py | 4 +- .../job/fine_tuning_job/create_or_update.py | 74 + .../job/fine_tuning_job/get.py | 42 + .../job/fine_tuning_job/list.py | 42 + .../job/pipeline_job/create_or_update.py | 2 +- .../generated_samples/job/pipeline_job/get.py | 2 +- .../job/pipeline_job/list.py | 2 +- .../job/sweep_job/create_or_update.py | 56 +- .../generated_samples/job/sweep_job/get.py | 2 +- .../generated_samples/job/sweep_job/list.py | 2 +- .../generated_samples/job/update.py | 47 + .../labeling_job/create_or_update.py | 75 + .../generated_samples/labeling_job/delete.py | 41 + .../labeling_job/export_labels.py | 43 + .../generated_samples/labeling_job/get.py | 42 + .../generated_samples/labeling_job/list.py | 42 + .../generated_samples/labeling_job/pause.py | 42 + .../generated_samples/labeling_job/resume.py | 42 + .../managed_network/create_or_update_rule.py | 45 + .../managed_network/delete_rule.py | 41 + .../managed_network/get_rule.py | 42 + .../managed_network/list_rule.py | 42 + .../managed_network/provision.py | 41 + .../generated_samples/notebook/list_keys.py | 2 +- .../generated_samples/notebook/prepare.py | 2 +- .../online_deployment/get_logs.py | 2 +- .../create_or_update.py | 2 +- .../kubernetes_online_deployment/get.py | 2 +- .../kubernetes_online_deployment/list_skus.py | 2 +- .../kubernetes_online_deployment/update.py | 2 +- .../online_deployment/list.py | 2 +- .../create_or_update.py | 2 +- .../managed_online_deployment/get.py | 2 +- .../managed_online_deployment/list_skus.py | 2 +- .../managed_online_deployment/update.py | 2 +- .../create_or_update.py | 4 +- .../private_endpoint_connection/delete.py | 2 +- .../private_endpoint_connection/get.py | 2 +- .../private_endpoint_connection/list.py | 2 +- .../private_link_resource/list.py | 5 +- .../generated_samples/quota/list.py | 2 +- .../generated_samples/quota/update.py | 2 +- .../create_or_update_system_created.py | 2 +- .../create_or_update_user_created.py | 2 +- .../generated_samples/registries/delete.py | 2 +- .../registries/get_system_created.py | 2 +- .../registries/get_user_created.py | 2 +- .../registries/list_by_subscription.py | 2 +- .../registries/list_system_created.py | 2 +- .../registries/list_user_created.py | 2 +- .../registries/remove_regions.py | 2 +- .../registries/update_system_created.py | 2 +- .../registries/update_user_created.py | 2 +- .../code_container/create_or_update.py | 2 +- .../registry/code_container/delete.py | 2 +- .../registry/code_container/get.py | 2 +- .../registry/code_container/list.py | 2 +- .../create_or_get_start_pending_upload.py | 4 +- .../registry/code_version/create_or_update.py | 2 +- .../registry/code_version/delete.py | 2 +- .../registry/code_version/get.py | 2 +- .../registry/code_version/list.py | 2 +- .../component_container/create_or_update.py | 2 +- .../registry/component_container/delete.py | 2 +- .../registry/component_container/get.py | 2 +- .../registry/component_container/list.py | 2 +- .../component_version/create_or_update.py | 2 +- .../registry/component_version/delete.py | 2 +- .../registry/component_version/get.py | 2 +- .../registry/component_version/list.py | 2 +- .../data_container/create_or_update.py | 2 +- .../registry/data_container/delete.py | 2 +- .../registry/data_container/get.py | 2 +- .../registry/data_container/registry_list.py | 2 +- .../create_or_get_start_pending_upload.py | 2 +- .../data_version_base/create_or_update.py | 2 +- .../registry/data_version_base/delete.py | 2 +- .../registry/data_version_base/get.py | 2 +- .../data_version_base/registry_list.py | 2 +- .../model_container/create_or_update.py | 2 +- .../registry/model_container/delete.py | 2 +- .../registry/model_container/get.py | 2 +- .../registry/model_container/list.py | 2 +- .../create_or_get_start_pending_upload.py | 4 +- .../model_version/create_or_update.py | 2 +- .../registry/model_version/delete.py | 2 +- .../registry/model_version/get.py | 2 +- .../registry/model_version/list.py | 2 +- .../registry/model_version/package.py | 62 + .../schedule/create_or_update.py | 2 +- .../generated_samples/schedule/delete.py | 2 +- .../generated_samples/schedule/get.py | 2 +- .../generated_samples/schedule/list.py | 2 +- .../generated_samples/schedule/trigger.py | 43 + .../generated_samples/usage/list.py | 2 +- .../virtual_machine_size/list.py | 2 +- .../batch_deployment/create_or_update.py | 2 +- .../workspace/batch_deployment/delete.py | 2 +- .../workspace/batch_deployment/get.py | 2 +- .../workspace/batch_deployment/list.py | 2 +- .../workspace/batch_deployment/update.py | 2 +- .../batch_endpoint/create_or_update.py | 2 +- .../workspace/batch_endpoint/delete.py | 2 +- .../workspace/batch_endpoint/get.py | 2 +- .../workspace/batch_endpoint/list.py | 2 +- .../workspace/batch_endpoint/list_keys.py | 2 +- .../workspace/batch_endpoint/update.py | 2 +- .../code_container/create_or_update.py | 2 +- .../workspace/code_container/delete.py | 2 +- .../workspace/code_container/get.py | 2 +- .../workspace/code_container/list.py | 2 +- .../create_or_get_start_pending_upload.py | 4 +- .../code_version/create_or_update.py | 2 +- .../workspace/code_version/delete.py | 2 +- .../workspace/code_version/get.py | 2 +- .../workspace/code_version/list.py | 2 +- .../workspace/code_version/publish.py | 43 + .../component_container/create_or_update.py | 2 +- .../workspace/component_container/delete.py | 2 +- .../workspace/component_container/get.py | 2 +- .../workspace/component_container/list.py | 2 +- .../component_version/create_or_update.py | 2 +- .../workspace/component_version/delete.py | 2 +- .../workspace/component_version/get.py | 2 +- .../workspace/component_version/list.py | 2 +- .../workspace/component_version/publish.py | 43 + .../generated_samples/workspace/create.py | 4 +- .../data_container/create_or_update.py | 2 +- .../workspace/data_container/delete.py | 2 +- .../workspace/data_container/get.py | 2 +- .../workspace/data_container/list.py | 2 +- .../data_version_base/create_or_update.py | 2 +- .../workspace/data_version_base/delete.py | 2 +- .../workspace/data_version_base/get.py | 2 +- .../workspace/data_version_base/list.py | 2 +- .../workspace/data_version_base/publish.py | 43 + .../generated_samples/workspace/delete.py | 2 +- .../generated_samples/workspace/diagnose.py | 2 +- .../featureset_container/create_or_update.py | 50 + .../workspace/featureset_container/delete.py | 41 + .../featureset_container/get_entity.py | 42 + .../workspace/featureset_container/list.py | 42 + .../workspace/featureset_version/backfill.py | 56 + .../featureset_version/create_or_update.py | 70 + .../workspace/featureset_version/delete.py | 42 + .../workspace/featureset_version/get.py | 43 + .../workspace/featureset_version/list.py | 43 + .../create_or_update.py | 50 + .../featurestore_entity_container/delete.py | 41 + .../get_entity.py | 42 + .../featurestore_entity_container/list.py | 42 + .../create_or_update.py | 53 + .../featurestore_entity_version/delete.py | 42 + .../featurestore_entity_version/get.py | 43 + .../featurestore_entity_version/list.py | 43 + .../generated_samples/workspace/get.py | 2 +- .../inference_endpoint/create_or_update.py | 56 + .../workspace/inference_endpoint/delete.py | 42 + .../workspace/inference_endpoint/get.py | 43 + .../workspace/inference_endpoint/list.py | 43 + .../workspace/inference_endpoint/update.py | 44 + .../inference_group/create_or_update.py | 57 + .../workspace/inference_group/delete.py | 42 + .../workspace/inference_group/get.py | 43 + .../workspace/inference_group/get_status.py | 43 + .../workspace/inference_group/list.py | 43 + .../workspace/inference_group/list_skus.py | 44 + .../workspace/inference_group/update.py | 47 + .../inference_pool/create_or_update.py | 82 + .../workspace/inference_pool/delete.py | 41 + .../workspace/inference_pool/get.py | 42 + .../workspace/inference_pool/get_status.py | 42 + .../workspace/inference_pool/list.py | 42 + .../workspace/inference_pool/list_skus.py | 43 + .../workspace/inference_pool/update.py | 47 + .../workspace/list_by_resource_group.py | 2 +- .../workspace/list_by_subscription.py | 2 +- .../generated_samples/workspace/list_keys.py | 2 +- .../workspace/list_notebook_access_token.py | 2 +- .../workspace/list_storage_account_keys.py | 2 +- .../create_or_update.py | 43 + .../marketplace_subscription/delete.py} | 20 +- .../workspace/marketplace_subscription/get.py | 42 + .../marketplace_subscription/list.py | 42 + .../model_container/create_or_update.py | 2 +- .../workspace/model_container/delete.py | 2 +- .../workspace/model_container/get.py | 2 +- .../workspace/model_container/list.py | 2 +- .../model_version/create_or_update.py | 2 +- .../workspace/model_version/delete.py | 2 +- .../workspace/model_version/get.py | 2 +- .../workspace/model_version/list.py | 2 +- .../workspace/model_version/package.py | 62 + .../workspace/model_version/publish.py | 43 + .../workspace/online_deployment/delete.py | 2 +- .../online_endpoint/create_or_update.py | 2 +- .../workspace/online_endpoint/delete.py | 2 +- .../workspace/online_endpoint/get.py | 2 +- .../workspace/online_endpoint/get_token.py | 2 +- .../workspace/online_endpoint/list.py | 2 +- .../workspace/online_endpoint/list_keys.py | 2 +- .../online_endpoint/regenerate_keys.py | 2 +- .../workspace/online_endpoint/update.py | 2 +- .../workspace/operations_list.py | 2 +- .../workspace/resync_keys.py | 2 +- .../serverless_endpoint/create_or_update.py | 54 + .../workspace/serverless_endpoint/delete.py | 41 + .../workspace/serverless_endpoint/get.py | 42 + .../serverless_endpoint/get_status.py | 42 + .../workspace/serverless_endpoint/list.py | 42 + .../serverless_endpoint/list_keys.py | 42 + .../serverless_endpoint/regenerate_keys.py | 43 + .../workspace/serverless_endpoint/update.py | 47 + .../generated_samples/workspace/update.py | 4 +- .../workspace_connection/create.py | 3 +- .../workspace_connection/delete.py | 2 +- .../workspace_connection/get.py | 2 +- .../workspace_connection/list.py | 2 +- .../workspace_connection/list_secrets.py | 42 + .../workspace_connection/test_connection.py | 41 + .../workspace_connection/update.py | 42 + .../workspace_feature/list.py | 2 +- sdk/network/azure-mgmt-network/README.md | 4 +- sdk/network/azure-mgmt-network/_meta.json | 9 +- .../azure/mgmt/network/_client.py | 266 +- .../azure/mgmt/network/_version.py | 2 +- .../azure/mgmt/network/aio/_client.py | 266 +- .../network/aio/operations/_operations.py | 2016 +- .../azure/mgmt/network/models/_enums.py | 2 + .../azure/mgmt/network/models/_models.py | 13 +- .../mgmt/network/operations/_operations.py | 3240 +- .../mgmt/network/v2023_05_01/_version.py | 2 +- .../v2023_05_01/aio/operations/_operations.py | 6 +- .../v2023_05_01/operations/_operations.py | 6 +- .../mgmt/network/v2023_09_01/__init__.py | 26 + .../network/v2023_09_01/_configuration.py | 61 + .../mgmt/network/v2023_09_01/_metadata.json | 496 + .../v2023_09_01/_network_management_client.py | 989 + .../azure/mgmt/network/v2023_09_01/_patch.py | 20 + .../azure/mgmt/network/v2023_09_01/_vendor.py | 36 + .../mgmt/network/v2023_09_01/_version.py | 9 + .../mgmt/network/v2023_09_01/aio/__init__.py | 23 + .../network/v2023_09_01/aio/_configuration.py | 61 + .../aio/_network_management_client.py | 1000 + .../mgmt/network/v2023_09_01/aio/_patch.py | 20 + .../mgmt/network/v2023_09_01/aio/_vendor.py | 28 + .../v2023_09_01/aio/operations/__init__.py | 283 + .../v2023_09_01/aio/operations/_operations.py | 79630 +++++++++++++ .../v2023_09_01/aio/operations/_patch.py | 20 + .../network/v2023_09_01/models/__init__.py | 1847 + .../network/v2023_09_01/models/_models_py3.py | 39079 ++++++ .../_network_management_client_enums.py | 1938 + .../mgmt/network/v2023_09_01/models/_patch.py | 20 + .../v2023_09_01/operations/__init__.py | 283 + .../v2023_09_01/operations/_operations.py | 99172 ++++++++++++++++ .../network/v2023_09_01/operations/_patch.py | 20 + .../azure/mgmt/network/v2023_09_01/py.typed | 1 + ...n_gateway_available_request_headers_get.py | 2 +- ..._gateway_available_response_headers_get.py | 2 +- ..._gateway_available_server_variables_get.py | 2 +- ...ation_gateway_available_ssl_options_get.py | 2 +- ...ble_ssl_options_predefined_policies_get.py | 2 +- ...lable_ssl_options_predefined_policy_get.py | 2 +- ...ion_gateway_available_waf_rule_sets_get.py | 2 +- .../application_gateway_backend_health_get.py | 2 +- ...application_gateway_backend_health_test.py | 2 +- .../application_gateway_create.py | 2 +- .../application_gateway_delete.py | 2 +- .../application_gateway_get.py | 2 +- .../application_gateway_list.py | 2 +- .../application_gateway_list_all.py | 2 +- ...eway_private_endpoint_connection_delete.py | 2 +- ...gateway_private_endpoint_connection_get.py | 2 +- ...ateway_private_endpoint_connection_list.py | 2 +- ...eway_private_endpoint_connection_update.py | 2 +- ...tion_gateway_private_link_resource_list.py | 2 +- .../application_gateway_start.py | 2 +- .../application_gateway_stop.py | 2 +- .../application_gateway_update_tags.py | 2 +- .../application_security_group_create.py | 2 +- .../application_security_group_delete.py | 2 +- .../application_security_group_get.py | 2 +- .../application_security_group_list.py | 2 +- .../application_security_group_list_all.py | 2 +- .../application_security_group_update_tags.py | 2 +- ...auto_approved_private_link_services_get.py | 2 +- ...rivate_link_services_resource_group_get.py | 2 +- ...vailable_delegations_resource_group_get.py | 2 +- .../available_delegations_subscription_get.py | 2 +- .../available_private_endpoint_types_get.py | 2 +- ...ivate_endpoint_types_resource_group_get.py | 2 +- .../available_service_aliases_list.py | 2 +- ..._service_aliases_list_by_resource_group.py | 2 +- .../azure_firewall_delete.py | 2 +- ...firewall_fqdn_tags_list_by_subscription.py | 2 +- .../generated_samples/azure_firewall_get.py | 2 +- ...firewall_get_with_additional_properties.py | 2 +- .../azure_firewall_get_with_ip_groups.py | 2 +- .../azure_firewall_get_with_mgmt_subnet.py | 2 +- .../azure_firewall_get_with_zones.py | 2 +- .../azure_firewall_list_by_resource_group.py | 2 +- .../azure_firewall_list_by_subscription.py | 2 +- ...azure_firewall_list_learned_ip_prefixes.py | 2 +- .../azure_firewall_packet_capture.py | 2 +- .../generated_samples/azure_firewall_put.py | 2 +- .../azure_firewall_put_in_hub.py | 2 +- ...firewall_put_with_additional_properties.py | 2 +- .../azure_firewall_put_with_ip_groups.py | 2 +- .../azure_firewall_put_with_mgmt_subnet.py | 2 +- .../azure_firewall_put_with_zones.py | 2 +- .../azure_firewall_update_tags.py | 2 +- ...ure_web_categories_list_by_subscription.py | 2 +- .../azure_web_category_get.py | 2 +- .../generated_samples/bastion_host_delete.py | 2 +- .../bastion_host_developer_delete.py | 2 +- .../bastion_host_developer_get.py | 2 +- .../bastion_host_developer_put.py | 2 +- .../generated_samples/bastion_host_get.py | 2 +- .../bastion_host_get_with_zones.py | 41 + .../bastion_host_list_by_resource_group.py | 2 +- .../bastion_host_list_by_subscription.py | 2 +- .../generated_samples/bastion_host_patch.py | 2 +- .../generated_samples/bastion_host_put.py | 2 +- .../bastion_host_put_with_zones.py | 58 + .../bastion_session_delete.py | 2 +- .../bastion_sessions_list.py | 2 +- .../bastion_shareable_link_create.py | 2 +- .../bastion_shareable_link_delete.py | 2 +- .../bastion_shareable_link_delete_by_token.py | 2 +- .../bastion_shareable_link_get.py | 2 +- .../check_dns_name_availability.py | 2 +- .../check_private_link_service_visibility.py | 2 +- ...nk_service_visibility_by_resource_group.py | 2 +- .../cloud_service_network_interface_get.py | 2 +- .../cloud_service_network_interface_list.py | 2 +- .../cloud_service_public_ip_get.py | 2 +- .../cloud_service_public_ip_list_all.py | 2 +- ...ce_role_instance_network_interface_list.py | 2 +- ...ud_service_role_instance_public_ip_list.py | 2 +- .../cloud_service_swap_get.py | 2 +- .../cloud_service_swap_list.py | 2 +- .../cloud_service_swap_put.py | 2 +- .../configuration_policy_group_delete.py | 2 +- .../configuration_policy_group_get.py | 2 +- ..._group_list_by_vpn_server_configuration.py | 2 +- .../configuration_policy_group_put.py | 2 +- ...stom_ip_prefix_create_customized_values.py | 2 +- .../custom_ip_prefix_delete.py | 2 +- .../generated_samples/custom_ip_prefix_get.py | 2 +- .../custom_ip_prefix_list.py | 2 +- .../custom_ip_prefix_list_all.py | 2 +- .../custom_ip_prefix_update_tags.py | 2 +- .../ddos_custom_policy_create.py | 2 +- .../ddos_custom_policy_delete.py | 2 +- .../ddos_custom_policy_get.py | 2 +- .../ddos_custom_policy_update_tags.py | 2 +- .../ddos_protection_plan_create.py | 2 +- .../ddos_protection_plan_delete.py | 2 +- .../ddos_protection_plan_get.py | 2 +- .../ddos_protection_plan_list.py | 2 +- .../ddos_protection_plan_list_all.py | 2 +- .../ddos_protection_plan_update_tags.py | 2 +- .../default_security_rule_get.py | 2 +- .../default_security_rule_list.py | 2 +- .../dscp_configuration_create.py | 2 +- .../dscp_configuration_delete.py | 2 +- .../dscp_configuration_get.py | 2 +- .../dscp_configuration_list.py | 2 +- .../dscp_configuration_list_all.py | 2 +- .../effective_routes_list_for_connection.py | 2 +- .../effective_routes_list_for_route_table.py | 2 +- .../effective_routes_list_for_virtual_hub.py | 2 +- .../endpoint_services_list.py | 2 +- .../express_route_circuit_arp_table_list.py | 2 +- ...ress_route_circuit_authorization_create.py | 2 +- ...ress_route_circuit_authorization_delete.py | 2 +- ...express_route_circuit_authorization_get.py | 2 +- ...xpress_route_circuit_authorization_list.py | 2 +- ...express_route_circuit_connection_create.py | 2 +- ...express_route_circuit_connection_delete.py | 2 +- .../express_route_circuit_connection_get.py | 2 +- .../express_route_circuit_connection_list.py | 2 +- .../express_route_circuit_create.py | 2 +- ...te_circuit_create_on_express_route_port.py | 2 +- .../express_route_circuit_delete.py | 2 +- .../express_route_circuit_get.py | 2 +- ...ss_route_circuit_list_by_resource_group.py | 2 +- ...ress_route_circuit_list_by_subscription.py | 2 +- .../express_route_circuit_peering_create.py | 2 +- .../express_route_circuit_peering_delete.py | 2 +- .../express_route_circuit_peering_get.py | 2 +- .../express_route_circuit_peering_list.py | 2 +- .../express_route_circuit_peering_stats.py | 2 +- .../express_route_circuit_route_table_list.py | 2 +- ..._route_circuit_route_table_summary_list.py | 2 +- .../express_route_circuit_stats.py | 2 +- .../express_route_circuit_update_tags.py | 2 +- .../express_route_connection_create.py | 2 +- .../express_route_connection_delete.py | 2 +- .../express_route_connection_get.py | 2 +- .../express_route_connection_list.py | 2 +- ...ute_cross_connection_bgp_peering_create.py | 2 +- ...ute_cross_connection_bgp_peering_delete.py | 2 +- ..._route_cross_connection_bgp_peering_get.py | 2 +- ...route_cross_connection_bgp_peering_list.py | 2 +- .../express_route_cross_connection_get.py | 2 +- .../express_route_cross_connection_list.py | 2 +- ...cross_connection_list_by_resource_group.py | 2 +- .../express_route_cross_connection_update.py | 2 +- ...ress_route_cross_connection_update_tags.py | 2 +- ...press_route_cross_connections_arp_table.py | 2 +- ...ess_route_cross_connections_route_table.py | 2 +- ...e_cross_connections_route_table_summary.py | 2 +- .../express_route_gateway_create.py | 2 +- .../express_route_gateway_delete.py | 2 +- .../express_route_gateway_get.py | 2 +- ...ss_route_gateway_list_by_resource_group.py | 2 +- ...ress_route_gateway_list_by_subscription.py | 2 +- .../express_route_gateway_update_tags.py | 2 +- .../express_route_link_get.py | 2 +- .../express_route_link_list.py | 2 +- ...express_route_port_authorization_create.py | 2 +- ...express_route_port_authorization_delete.py | 2 +- .../express_route_port_authorization_get.py | 2 +- .../express_route_port_authorization_list.py | 2 +- .../express_route_port_create.py | 2 +- .../express_route_port_delete.py | 2 +- .../express_route_port_get.py | 2 +- .../express_route_port_list.py | 2 +- ...press_route_port_list_by_resource_group.py | 2 +- .../express_route_port_update_link.py | 2 +- .../express_route_port_update_tags.py | 2 +- .../express_route_ports_location_get.py | 2 +- .../express_route_ports_location_list.py | 2 +- .../express_route_provider_list.py | 2 +- .../express_route_provider_port.py | 2 +- .../express_route_provider_port_list.py | 2 +- .../firewall_policy_delete.py | 2 +- .../generated_samples/firewall_policy_get.py | 2 +- .../firewall_policy_list_by_resource_group.py | 2 +- .../firewall_policy_list_by_subscription.py | 2 +- ...ll_policy_nat_rule_collection_group_get.py | 2 +- ...ll_policy_nat_rule_collection_group_put.py | 2 +- .../firewall_policy_patch.py | 2 +- .../generated_samples/firewall_policy_put.py | 2 +- ...rewall_policy_query_signature_overrides.py | 2 +- ...query_signature_overrides_filter_values.py | 2 +- ...all_policy_rule_collection_group_delete.py | 2 +- ...rewall_policy_rule_collection_group_get.py | 2 +- ...ewall_policy_rule_collection_group_list.py | 2 +- ...rewall_policy_rule_collection_group_put.py | 2 +- ...ction_group_with_http_headers_to_insert.py | 2 +- ...ule_collection_group_with_ip_groups_get.py | 2 +- ...le_collection_group_with_ip_groups_list.py | 2 +- ...ule_collection_group_with_ip_groups_put.py | 2 +- ...ollection_group_with_web_categories_get.py | 2 +- ...llection_group_with_web_categories_list.py | 2 +- ...ollection_group_with_web_categories_put.py | 2 +- ...firewall_policy_signature_overrides_get.py | 2 +- ...irewall_policy_signature_overrides_list.py | 2 +- ...rewall_policy_signature_overrides_patch.py | 2 +- ...firewall_policy_signature_overrides_put.py | 2 +- .../generate_express_route_ports_loa.py | 2 +- ...an_vpn_server_configuration_vpn_profile.py | 2 +- ...plication_gateway_waf_dynamic_manifests.py | 2 +- ...n_gateway_waf_dynamic_manifests_default.py | 2 +- .../generated_samples/get_inbound_routes.py | 2 +- .../generated_samples/get_outbound_routes.py | 2 +- ...t_virtual_wan_vpn_server_configurations.py | 2 +- .../hub_route_table_delete.py | 2 +- .../generated_samples/hub_route_table_get.py | 2 +- .../generated_samples/hub_route_table_list.py | 2 +- .../generated_samples/hub_route_table_put.py | 2 +- .../hub_virtual_network_connection_delete.py | 2 +- .../hub_virtual_network_connection_get.py | 2 +- .../hub_virtual_network_connection_list.py | 2 +- .../hub_virtual_network_connection_put.py | 2 +- .../inbound_nat_rule_create.py | 2 +- .../inbound_nat_rule_delete.py | 2 +- .../generated_samples/inbound_nat_rule_get.py | 2 +- .../inbound_nat_rule_list.py | 2 +- .../inbound_security_rule_put.py | 2 +- .../generated_samples/ip_allocation_create.py | 2 +- .../generated_samples/ip_allocation_delete.py | 2 +- .../generated_samples/ip_allocation_get.py | 2 +- .../generated_samples/ip_allocation_list.py | 2 +- .../ip_allocation_list_by_resource_group.py | 2 +- .../ip_allocation_update_tags.py | 2 +- .../generated_samples/ip_groups_create.py | 2 +- .../generated_samples/ip_groups_delete.py | 2 +- .../generated_samples/ip_groups_get.py | 2 +- .../ip_groups_list_by_resource_group.py | 2 +- .../ip_groups_list_by_subscription.py | 2 +- .../ip_groups_update_tags.py | 2 +- ...l_list_with_backend_addresses_pool_type.py | 2 +- ...address_pool_with_backend_addresses_get.py | 2 +- ...address_pool_with_backend_addresses_put.py | 2 +- ...ad_balancer_backend_address_pool_delete.py | 2 +- .../load_balancer_backend_address_pool_get.py | 2 +- ...load_balancer_backend_address_pool_list.py | 2 +- .../generated_samples/load_balancer_create.py | 2 +- ...r_create_gateway_load_balancer_consumer.py | 2 +- ...balancer_provider_with_one_backend_pool.py | 2 +- ...balancer_provider_with_two_backend_pool.py | 2 +- .../load_balancer_create_global_tier.py | 2 +- .../load_balancer_create_standard_sku.py | 2 +- ...d_balancer_create_with_inbound_nat_pool.py | 2 +- ...oad_balancer_create_with_outbound_rules.py | 2 +- ..._create_with_sync_mode_property_on_pool.py | 2 +- .../load_balancer_create_with_zones.py | 2 +- .../generated_samples/load_balancer_delete.py | 2 +- ..._balancer_frontend_ip_configuration_get.py | 2 +- ...balancer_frontend_ip_configuration_list.py | 2 +- .../generated_samples/load_balancer_get.py | 2 +- ...ancer_get_inbound_nat_rule_port_mapping.py | 2 +- .../generated_samples/load_balancer_list.py | 2 +- .../load_balancer_list_all.py | 2 +- .../load_balancer_load_balancing_rule_get.py | 2 +- .../load_balancer_load_balancing_rule_list.py | 2 +- ..._balancer_network_interface_list_simple.py | 2 +- ...ad_balancer_network_interface_list_vmss.py | 2 +- .../load_balancer_outbound_rule_get.py | 2 +- .../load_balancer_outbound_rule_list.py | 2 +- .../load_balancer_probe_get.py | 2 +- .../load_balancer_probe_list.py | 2 +- .../load_balancer_update_tags.py | 2 +- ...load_balancers_swap_public_ip_addresses.py | 2 +- .../local_network_gateway_create.py | 2 +- .../local_network_gateway_delete.py | 2 +- .../local_network_gateway_get.py | 2 +- .../local_network_gateway_list.py | 2 +- .../local_network_gateway_update_tags.py | 2 +- .../migrate_load_balancer_to_ip_based.py | 2 +- .../nat_gateway_create_or_update.py | 2 +- .../generated_samples/nat_gateway_delete.py | 2 +- .../generated_samples/nat_gateway_get.py | 2 +- .../generated_samples/nat_gateway_list.py | 2 +- .../generated_samples/nat_gateway_list_all.py | 2 +- .../nat_gateway_update_tags.py | 2 +- .../generated_samples/nat_rule_delete.py | 2 +- .../generated_samples/nat_rule_get.py | 2 +- .../generated_samples/nat_rule_list.py | 2 +- .../generated_samples/nat_rule_put.py | 2 +- .../network_interface_create.py | 2 +- ...e_create_gateway_load_balancer_consumer.py | 2 +- .../network_interface_delete.py | 2 +- .../network_interface_effective_nsg_list.py | 2 +- ...rk_interface_effective_route_table_list.py | 2 +- .../network_interface_get.py | 2 +- .../network_interface_ip_configuration_get.py | 2 +- ...network_interface_ip_configuration_list.py | 2 +- .../network_interface_list.py | 2 +- .../network_interface_list_all.py | 2 +- .../network_interface_load_balancer_list.py | 2 +- ...work_interface_tap_configuration_create.py | 2 +- ...work_interface_tap_configuration_delete.py | 2 +- ...network_interface_tap_configuration_get.py | 2 +- ...etwork_interface_tap_configuration_list.py | 2 +- .../network_interface_update_tags.py | 2 +- ...active_connectivity_configurations_list.py | 2 +- ...anager_active_security_admin_rules_list.py | 2 +- ...rk_manager_admin_rule_collection_delete.py | 2 +- ...twork_manager_admin_rule_collection_get.py | 2 +- ...work_manager_admin_rule_collection_list.py | 2 +- ...twork_manager_admin_rule_collection_put.py | 2 +- .../network_manager_admin_rule_delete.py | 2 +- .../network_manager_admin_rule_get.py | 2 +- .../network_manager_admin_rule_list.py | 2 +- .../network_manager_admin_rule_put.py | 2 +- .../network_manager_commit_post.py | 2 +- ...ager_connection_management_group_delete.py | 2 +- ...manager_connection_management_group_get.py | 2 +- ...anager_connection_management_group_list.py | 2 +- ...manager_connection_management_group_put.py | 2 +- ..._manager_connection_subscription_delete.py | 2 +- ...ork_manager_connection_subscription_get.py | 2 +- ...rk_manager_connection_subscription_list.py | 2 +- ...ork_manager_connection_subscription_put.py | 2 +- ...nager_connectivity_configuration_delete.py | 2 +- ..._manager_connectivity_configuration_get.py | 2 +- ...manager_connectivity_configuration_list.py | 2 +- ..._manager_connectivity_configuration_put.py | 2 +- .../network_manager_default_admin_rule_get.py | 2 +- .../network_manager_default_admin_rule_put.py | 2 +- .../network_manager_delete.py | 2 +- .../network_manager_deployment_status_list.py | 2 +- ...ective_connectivity_configurations_list.py | 2 +- ...ger_effective_security_admin_rules_list.py | 2 +- .../generated_samples/network_manager_get.py | 2 +- .../network_manager_group_delete.py | 2 +- .../network_manager_group_get.py | 2 +- .../network_manager_group_list.py | 2 +- .../network_manager_group_put.py | 2 +- .../generated_samples/network_manager_list.py | 2 +- .../network_manager_list_all.py | 2 +- .../network_manager_patch.py | 2 +- .../generated_samples/network_manager_put.py | 2 +- ...network_manager_scope_connection_delete.py | 2 +- .../network_manager_scope_connection_get.py | 2 +- .../network_manager_scope_connection_list.py | 2 +- .../network_manager_scope_connection_put.py | 2 +- ...ger_security_admin_configuration_delete.py | 2 +- ...anager_security_admin_configuration_get.py | 2 +- ...nager_security_admin_configuration_list.py | 2 +- ...anager_security_admin_configuration_put.py | 2 +- .../network_manager_static_member_delete.py | 2 +- .../network_manager_static_member_get.py | 2 +- .../network_manager_static_member_list.py | 2 +- .../network_manager_static_member_put.py | 2 +- .../network_profile_create_config_only.py | 2 +- .../network_profile_delete.py | 2 +- .../network_profile_get_config_only.py | 2 +- .../network_profile_get_with_container_nic.py | 2 +- .../generated_samples/network_profile_list.py | 2 +- .../network_profile_list_all.py | 2 +- .../network_profile_update_tags.py | 2 +- .../network_security_group_create.py | 2 +- ...network_security_group_create_with_rule.py | 2 +- .../network_security_group_delete.py | 2 +- .../network_security_group_get.py | 2 +- .../network_security_group_list.py | 2 +- .../network_security_group_list_all.py | 2 +- .../network_security_group_rule_create.py | 2 +- .../network_security_group_rule_delete.py | 2 +- .../network_security_group_rule_get.py | 2 +- .../network_security_group_rule_list.py | 2 +- .../network_security_group_update_tags.py | 2 +- ...ork_virtual_appliance_connection_delete.py | 2 +- ...etwork_virtual_appliance_connection_get.py | 2 +- ...twork_virtual_appliance_connection_list.py | 2 +- ...etwork_virtual_appliance_connection_put.py | 2 +- .../network_virtual_appliance_delete.py | 2 +- .../network_virtual_appliance_get.py | 2 +- ...irtual_appliance_list_by_resource_group.py | 2 +- ..._virtual_appliance_list_by_subscription.py | 2 +- .../network_virtual_appliance_put.py | 2 +- .../network_virtual_appliance_saa_sput.py | 2 +- .../network_virtual_appliance_site_delete.py | 2 +- .../network_virtual_appliance_site_get.py | 2 +- .../network_virtual_appliance_site_list.py | 2 +- .../network_virtual_appliance_site_put.py | 2 +- .../network_virtual_appliance_sku_get.py | 2 +- .../network_virtual_appliance_sku_list.py | 2 +- .../network_virtual_appliance_update_tags.py | 2 +- ...rk_watcher_available_providers_list_get.py | 2 +- ...k_watcher_azure_reachability_report_get.py | 2 +- ...twork_watcher_connection_monitor_create.py | 2 +- ...twork_watcher_connection_monitor_delete.py | 2 +- .../network_watcher_connection_monitor_get.py | 2 +- ...network_watcher_connection_monitor_list.py | 2 +- ...etwork_watcher_connection_monitor_query.py | 2 +- ...etwork_watcher_connection_monitor_start.py | 2 +- ...network_watcher_connection_monitor_stop.py | 2 +- ..._watcher_connection_monitor_update_tags.py | 2 +- ...rk_watcher_connection_monitor_v2_create.py | 2 +- .../network_watcher_connectivity_check.py | 2 +- .../network_watcher_create.py | 2 +- .../network_watcher_delete.py | 2 +- .../network_watcher_flow_log_configure.py | 2 +- .../network_watcher_flow_log_create.py | 2 +- .../network_watcher_flow_log_delete.py | 2 +- .../network_watcher_flow_log_get.py | 2 +- .../network_watcher_flow_log_list.py | 2 +- .../network_watcher_flow_log_status_query.py | 2 +- .../network_watcher_flow_log_update_tags.py | 2 +- .../generated_samples/network_watcher_get.py | 2 +- .../network_watcher_ip_flow_verify.py | 2 +- .../generated_samples/network_watcher_list.py | 2 +- .../network_watcher_list_all.py | 2 +- ...atcher_network_configuration_diagnostic.py | 2 +- .../network_watcher_next_hop_get.py | 2 +- .../network_watcher_packet_capture_create.py | 2 +- .../network_watcher_packet_capture_delete.py | 2 +- .../network_watcher_packet_capture_get.py | 2 +- ...ork_watcher_packet_capture_query_status.py | 2 +- .../network_watcher_packet_capture_stop.py | 2 +- .../network_watcher_packet_captures_list.py | 2 +- ...network_watcher_security_group_view_get.py | 2 +- .../network_watcher_topology_get.py | 2 +- .../network_watcher_troubleshoot_get.py | 2 +- ...twork_watcher_troubleshoot_result_query.py | 2 +- .../network_watcher_update_tags.py | 2 +- .../generated_samples/operation_list.py | 2 +- .../p2_svpn_gateway_delete.py | 2 +- .../p2_svpn_gateway_generate_vpn_profile.py | 2 +- .../generated_samples/p2_svpn_gateway_get.py | 2 +- .../p2_svpn_gateway_get_connection_health.py | 2 +- ..._gateway_get_connection_health_detailed.py | 2 +- .../generated_samples/p2_svpn_gateway_list.py | 2 +- .../p2_svpn_gateway_list_by_resource_group.py | 2 +- .../p2_svpn_gateway_reset.py | 2 +- ...er_express_route_circuit_connection_get.py | 2 +- ...r_express_route_circuit_connection_list.py | 2 +- .../private_endpoint_create.py | 2 +- ...ate_endpoint_create_for_manual_approval.py | 2 +- .../private_endpoint_create_with_asg.py | 2 +- .../private_endpoint_delete.py | 2 +- .../private_endpoint_dns_zone_group_create.py | 2 +- .../private_endpoint_dns_zone_group_delete.py | 2 +- .../private_endpoint_dns_zone_group_get.py | 2 +- .../private_endpoint_dns_zone_group_list.py | 2 +- .../generated_samples/private_endpoint_get.py | 2 +- ...rivate_endpoint_get_for_manual_approval.py | 2 +- .../private_endpoint_get_with_asg.py | 2 +- .../private_endpoint_list.py | 2 +- .../private_endpoint_list_all.py | 2 +- .../private_link_service_create.py | 2 +- .../private_link_service_delete.py | 2 +- ...vice_delete_private_endpoint_connection.py | 2 +- .../private_link_service_get.py | 2 +- ...service_get_private_endpoint_connection.py | 2 +- .../private_link_service_list.py | 2 +- .../private_link_service_list_all.py | 2 +- ...ervice_list_private_endpoint_connection.py | 2 +- ...vice_update_private_endpoint_connection.py | 2 +- ...lic_ip_address_create_customized_values.py | 2 +- .../public_ip_address_create_defaults.py | 2 +- .../public_ip_address_create_dns.py | 2 +- ...create_dns_with_domain_name_label_scope.py | 2 +- .../public_ip_address_delete.py | 2 +- .../public_ip_address_get.py | 2 +- ...c_ip_address_get_ddos_protection_status.py | 2 +- .../public_ip_address_list.py | 2 +- .../public_ip_address_list_all.py | 2 +- .../public_ip_address_update_tags.py | 2 +- ...blic_ip_prefix_create_customized_values.py | 2 +- .../public_ip_prefix_create_defaults.py | 2 +- .../public_ip_prefix_delete.py | 2 +- .../generated_samples/public_ip_prefix_get.py | 2 +- .../public_ip_prefix_list.py | 2 +- .../public_ip_prefix_list_all.py | 2 +- .../public_ip_prefix_update_tags.py | 2 +- .../query_inbound_nat_rule_port_mapping.py | 2 +- .../generated_samples/route_filter_create.py | 2 +- .../generated_samples/route_filter_delete.py | 2 +- .../generated_samples/route_filter_get.py | 2 +- .../generated_samples/route_filter_list.py | 2 +- .../route_filter_list_by_resource_group.py | 2 +- .../route_filter_rule_create.py | 2 +- .../route_filter_rule_delete.py | 2 +- .../route_filter_rule_get.py | 2 +- .../route_filter_rule_list_by_route_filter.py | 2 +- .../route_filter_update_tags.py | 2 +- .../generated_samples/route_map_delete.py | 2 +- .../generated_samples/route_map_get.py | 2 +- .../generated_samples/route_map_list.py | 2 +- .../generated_samples/route_map_put.py | 2 +- .../generated_samples/route_table_create.py | 2 +- .../route_table_create_with_route.py | 2 +- .../generated_samples/route_table_delete.py | 2 +- .../generated_samples/route_table_get.py | 2 +- .../generated_samples/route_table_list.py | 2 +- .../generated_samples/route_table_list_all.py | 2 +- .../route_table_route_create.py | 2 +- .../route_table_route_delete.py | 2 +- .../route_table_route_get.py | 2 +- .../route_table_route_list.py | 2 +- .../route_table_update_tags.py | 2 +- .../routing_intent_delete.py | 2 +- .../generated_samples/routing_intent_get.py | 2 +- .../generated_samples/routing_intent_list.py | 2 +- .../generated_samples/routing_intent_put.py | 2 +- .../security_partner_provider_delete.py | 2 +- .../security_partner_provider_get.py | 2 +- ...partner_provider_list_by_resource_group.py | 2 +- ...y_partner_provider_list_by_subscription.py | 2 +- .../security_partner_provider_put.py | 2 +- .../security_partner_provider_update_tags.py | 2 +- .../service_community_list.py | 2 +- .../service_endpoint_policy_create.py | 2 +- ..._endpoint_policy_create_with_definition.py | 2 +- ...rvice_endpoint_policy_definition_create.py | 2 +- ...rvice_endpoint_policy_definition_delete.py | 2 +- .../service_endpoint_policy_definition_get.py | 2 +- ...service_endpoint_policy_definition_list.py | 2 +- .../service_endpoint_policy_delete.py | 2 +- .../service_endpoint_policy_get.py | 2 +- .../service_endpoint_policy_list.py | 2 +- .../service_endpoint_policy_list_all.py | 2 +- .../service_endpoint_policy_update_tags.py | 2 +- .../service_tag_information_list_result.py | 2 +- ...on_list_result_with_no_address_prefixes.py | 2 +- ...ag_information_list_result_with_tagname.py | 2 +- .../generated_samples/service_tags_list.py | 2 +- .../generated_samples/subnet_create.py | 2 +- .../subnet_create_service_endpoint.py | 2 +- .../subnet_create_with_delegation.py | 2 +- .../generated_samples/subnet_delete.py | 2 +- .../generated_samples/subnet_get.py | 2 +- .../subnet_get_with_delegation.py | 2 +- .../generated_samples/subnet_list.py | 2 +- .../subnet_prepare_network_policies.py | 2 +- .../subnet_unprepare_network_policies.py | 2 +- .../generated_samples/usage_list.py | 2 +- .../usage_list_spaced_location.py | 2 +- .../virtual_hub_bgp_connection_delete.py | 2 +- .../virtual_hub_bgp_connection_get.py | 2 +- .../virtual_hub_bgp_connection_list.py | 2 +- .../virtual_hub_bgp_connection_put.py | 2 +- .../generated_samples/virtual_hub_delete.py | 2 +- .../generated_samples/virtual_hub_get.py | 2 +- .../virtual_hub_ip_configuration_delete.py | 2 +- .../virtual_hub_ip_configuration_get.py | 2 +- .../virtual_hub_ip_configuration_list.py | 2 +- .../virtual_hub_ip_configuration_put.py | 2 +- .../generated_samples/virtual_hub_list.py | 2 +- .../virtual_hub_list_by_resource_group.py | 2 +- .../generated_samples/virtual_hub_put.py | 2 +- .../virtual_hub_route_table_v2_delete.py | 2 +- .../virtual_hub_route_table_v2_get.py | 2 +- .../virtual_hub_route_table_v2_list.py | 2 +- .../virtual_hub_route_table_v2_put.py | 2 +- .../virtual_hub_update_tags.py | 2 +- ...l_network_check_ip_address_availability.py | 2 +- .../virtual_network_create.py | 2 +- ..._network_create_service_endpoint_policy.py | 2 +- ...irtual_network_create_service_endpoints.py | 2 +- .../virtual_network_create_subnet.py | 2 +- ...ork_create_subnet_with_address_prefixes.py | 2 +- ...l_network_create_subnet_with_delegation.py | 2 +- ...ual_network_create_with_bgp_communities.py | 2 +- .../virtual_network_create_with_encryption.py | 2 +- .../virtual_network_delete.py | 2 +- ...rtual_network_gateway_connection_create.py | 2 +- ...rtual_network_gateway_connection_delete.py | 2 +- .../virtual_network_gateway_connection_get.py | 2 +- ..._network_gateway_connection_get_ike_sas.py | 2 +- ...twork_gateway_connection_get_shared_key.py | 2 +- ...irtual_network_gateway_connection_reset.py | 2 +- ...ork_gateway_connection_reset_shared_key.py | 2 +- ...twork_gateway_connection_set_shared_key.py | 2 +- ...gateway_connection_start_packet_capture.py | 2 +- ...ection_start_packet_capture_filter_data.py | 2 +- ..._gateway_connection_stop_packet_capture.py | 2 +- ..._network_gateway_connection_update_tags.py | 2 +- ...irtual_network_gateway_connections_list.py | 2 +- .../virtual_network_gateway_delete.py | 2 +- .../virtual_network_gateway_get.py | 2 +- ...l_network_gateway_get_advertised_routes.py | 2 +- ...ual_network_gateway_get_bgp_peer_status.py | 2 +- ...gateway_get_vpn_client_ipsec_parameters.py | 2 +- ...ork_gateway_get_vpn_profile_package_url.py | 2 +- ...gateway_get_vpnclient_connection_health.py | 2 +- .../virtual_network_gateway_learned_routes.py | 2 +- .../virtual_network_gateway_list.py | 2 +- ...virtual_network_gateway_nat_rule_delete.py | 2 +- .../virtual_network_gateway_nat_rule_get.py | 2 +- .../virtual_network_gateway_nat_rule_list.py | 2 +- .../virtual_network_gateway_nat_rule_put.py | 2 +- .../virtual_network_gateway_reset.py | 2 +- ...ork_gateway_reset_vpn_client_shared_key.py | 2 +- ...gateway_set_vpn_client_ipsec_parameters.py | 2 +- ...al_network_gateway_start_packet_capture.py | 2 +- ...ateway_start_packet_capture_filter_data.py | 2 +- ...ual_network_gateway_stop_packet_capture.py | 2 +- ...al_network_gateway_supported_vpn_device.py | 2 +- .../virtual_network_gateway_update.py | 2 +- .../virtual_network_gateway_update_tags.py | 2 +- ...gateway_vpn_device_configuration_script.py | 2 +- ...gateways_disconnect_p2s_vpn_connections.py | 2 +- ...rtual_network_gateways_list_connections.py | 2 +- .../generated_samples/virtual_network_get.py | 2 +- ...tual_network_get_ddos_protection_status.py | 2 +- ...l_network_get_resource_navigation_links.py | 2 +- ...l_network_get_service_association_links.py | 2 +- ...twork_get_with_service_association_link.py | 2 +- ...tual_network_get_with_subnet_delegation.py | 2 +- .../generated_samples/virtual_network_list.py | 2 +- .../virtual_network_list_all.py | 2 +- .../virtual_network_list_usage.py | 2 +- .../virtual_network_peering_create.py | 2 +- ..._with_remote_virtual_network_encryption.py | 2 +- .../virtual_network_peering_delete.py | 2 +- .../virtual_network_peering_get.py | 2 +- ..._with_remote_virtual_network_encryption.py | 2 +- .../virtual_network_peering_list.py | 2 +- ..._with_remote_virtual_network_encryption.py | 2 +- .../virtual_network_peering_sync.py | 2 +- .../virtual_network_scalable_gateway_get.py | 2 +- ...virtual_network_scalable_gateway_update.py | 2 +- .../virtual_network_tap_create.py | 2 +- .../virtual_network_tap_delete.py | 2 +- .../virtual_network_tap_get.py | 2 +- .../virtual_network_tap_list.py | 2 +- .../virtual_network_tap_list_all.py | 2 +- .../virtual_network_tap_update_tags.py | 2 +- .../virtual_network_update_tags.py | 2 +- .../virtual_router_delete.py | 2 +- .../generated_samples/virtual_router_get.py | 2 +- .../virtual_router_list_by_resource_group.py | 2 +- .../virtual_router_list_by_subscription.py | 2 +- ...rtual_router_peer_list_advertised_route.py | 2 +- .../virtual_router_peer_list_learned_route.py | 2 +- .../virtual_router_peering_delete.py | 2 +- .../virtual_router_peering_get.py | 2 +- .../virtual_router_peering_list.py | 2 +- .../virtual_router_peering_put.py | 2 +- .../generated_samples/virtual_router_put.py | 2 +- .../generated_samples/virtual_wan_delete.py | 2 +- .../generated_samples/virtual_wan_get.py | 2 +- .../generated_samples/virtual_wan_list.py | 2 +- .../virtual_wan_list_by_resource_group.py | 2 +- .../generated_samples/virtual_wan_put.py | 2 +- ...irtual_wan_supported_security_providers.py | 2 +- .../virtual_wan_update_tags.py | 2 +- .../vpn_connection_delete.py | 2 +- .../generated_samples/vpn_connection_get.py | 2 +- .../generated_samples/vpn_connection_list.py | 2 +- .../generated_samples/vpn_connection_put.py | 2 +- .../vpn_connection_start_packet_capture.py | 2 +- ...ection_start_packet_capture_filter_data.py | 2 +- .../vpn_connection_stop_packet_capture.py | 2 +- .../generated_samples/vpn_gateway_delete.py | 2 +- .../generated_samples/vpn_gateway_get.py | 2 +- .../generated_samples/vpn_gateway_list.py | 2 +- .../vpn_gateway_list_by_resource_group.py | 2 +- .../generated_samples/vpn_gateway_put.py | 2 +- .../generated_samples/vpn_gateway_reset.py | 2 +- .../vpn_gateway_start_packet_capture.py | 2 +- ...ateway_start_packet_capture_filter_data.py | 2 +- .../vpn_gateway_stop_packet_capture.py | 2 +- .../vpn_gateway_update_tags.py | 2 +- .../vpn_server_configuration_delete.py | 2 +- .../vpn_server_configuration_get.py | 2 +- .../vpn_server_configuration_list.py | 2 +- ...er_configuration_list_by_resource_group.py | 2 +- .../vpn_server_configuration_put.py | 2 +- .../vpn_server_configuration_update_tags.py | 2 +- .../generated_samples/vpn_site_delete.py | 2 +- .../generated_samples/vpn_site_get.py | 2 +- .../vpn_site_link_connection_get.py | 2 +- .../vpn_site_link_connection_get_ike_sas.py | 2 +- .../vpn_site_link_connection_list.py | 2 +- .../vpn_site_link_connection_reset.py | 2 +- .../generated_samples/vpn_site_link_get.py | 2 +- .../vpn_site_link_list_by_vpn_site.py | 2 +- .../generated_samples/vpn_site_list.py | 2 +- .../vpn_site_list_by_resource_group.py | 2 +- .../generated_samples/vpn_site_put.py | 2 +- .../generated_samples/vpn_site_update_tags.py | 2 +- .../vpn_sites_configuration_download.py | 2 +- .../waf_list_all_policies.py | 2 +- .../generated_samples/waf_list_policies.py | 2 +- .../waf_policy_create_or_update.py | 2 +- .../generated_samples/waf_policy_delete.py | 2 +- .../generated_samples/waf_policy_get.py | 2 +- sdk/network/azure-mgmt-network/setup.py | 5 +- .../azure-mgmt-networkanalytics/_meta.json | 4 +- .../azure/mgmt/networkanalytics/_version.py | 2 +- sdk/nginx/azure-mgmt-nginx/_meta.json | 4 +- .../azure/mgmt/nginx/_configuration.py | 4 +- .../mgmt/nginx/_nginx_management_client.py | 2 +- .../azure/mgmt/nginx/_version.py | 2 +- .../azure/mgmt/nginx/aio/_configuration.py | 4 +- .../nginx/aio/_nginx_management_client.py | 2 +- .../operations/_configurations_operations.py | 168 + .../mgmt/nginx/aio/operations/_operations.py | 4 +- .../azure/mgmt/nginx/models/__init__.py | 18 +- .../azure/mgmt/nginx/models/_models_py3.py | 341 +- .../operations/_certificates_operations.py | 36 +- .../operations/_configurations_operations.py | 247 +- .../operations/_deployments_operations.py | 40 +- .../mgmt/nginx/operations/_operations.py | 6 +- .../certificates_create_or_update.py | 2 +- .../generated_samples/certificates_delete.py | 2 +- .../generated_samples/certificates_get.py | 2 +- .../generated_samples/certificates_list.py | 2 +- .../configurations_analysis.py | 42 + .../configurations_create_or_update.py | 2 +- .../configurations_delete.py | 2 +- .../generated_samples/configurations_get.py | 2 +- .../generated_samples/configurations_list.py | 2 +- .../generated_samples/deployments_create.py | 2 +- .../generated_samples/deployments_delete.py | 2 +- .../generated_samples/deployments_get.py | 2 +- .../generated_samples/deployments_list.py | 2 +- .../deployments_list_by_resource_group.py | 2 +- .../generated_samples/deployments_update.py | 2 +- .../generated_samples/operations_list.py | 2 +- sdk/orbital/azure-mgmt-orbital/_meta.json | 10 +- .../azure/mgmt/orbital/_azure_orbital.py | 2 +- .../azure/mgmt/orbital/_configuration.py | 8 +- .../azure/mgmt/orbital/_serialization.py | 32 +- .../azure/mgmt/orbital/_vendor.py | 14 - .../azure/mgmt/orbital/_version.py | 2 +- .../azure/mgmt/orbital/aio/_azure_orbital.py | 2 +- .../azure/mgmt/orbital/aio/_configuration.py | 8 +- .../_available_ground_stations_operations.py | 12 +- .../_contact_profiles_operations.py | 62 +- .../aio/operations/_contacts_operations.py | 44 +- .../orbital/aio/operations/_operations.py | 12 +- .../_operations_results_operations.py | 16 +- .../aio/operations/_spacecrafts_operations.py | 76 +- .../_available_ground_stations_operations.py | 18 +- .../_contact_profiles_operations.py | 88 +- .../operations/_contacts_operations.py | 62 +- .../mgmt/orbital/operations/_operations.py | 14 +- .../_operations_results_operations.py | 22 +- .../operations/_spacecrafts_operations.py | 106 +- .../generated_samples/contact_delete.py | 3 +- .../contact_profile_delete.py | 3 +- .../generated_samples/spacecraft_delete.py | 3 +- .../_meta.json | 4 +- .../paloaltonetworksngfw/_configuration.py | 6 +- .../_palo_alto_networks_ngfw_mgmt_client.py | 11 +- .../mgmt/paloaltonetworksngfw/_version.py | 2 +- .../aio/_configuration.py | 6 +- .../_palo_alto_networks_ngfw_mgmt_client.py | 11 +- .../aio/operations/__init__.py | 2 + ...palo_alto_networks_cloudngfw_operations.py | 280 + .../paloaltonetworksngfw/models/__init__.py | 18 + .../models/_models_py3.py | 359 +- ...lo_alto_networks_ngfw_mgmt_client_enums.py | 21 + .../operations/__init__.py | 2 + ...cate_object_global_rulestack_operations.py | 8 +- ...icate_object_local_rulestack_operations.py | 8 +- .../operations/_firewall_status_operations.py | 4 +- .../operations/_firewalls_operations.py | 20 +- .../_fqdn_list_global_rulestack_operations.py | 8 +- .../_fqdn_list_local_rulestack_operations.py | 8 +- .../_global_rulestack_operations.py | 28 +- .../operations/_local_rules_operations.py | 14 +- .../_local_rulestacks_operations.py | 26 +- .../operations/_operations.py | 2 +- ...palo_alto_networks_cloudngfw_operations.py | 383 + .../operations/_post_rules_operations.py | 14 +- .../operations/_pre_rules_operations.py | 14 +- ...prefix_list_global_rulestack_operations.py | 8 +- ..._prefix_list_local_rulestack_operations.py | 8 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ...global_rulestack_delete_maximum_set_gen.py | 2 +- ...global_rulestack_delete_minimum_set_gen.py | 2 +- ...ct_global_rulestack_get_maximum_set_gen.py | 2 +- ...ct_global_rulestack_get_minimum_set_gen.py | 2 +- ...t_global_rulestack_list_maximum_set_gen.py | 2 +- ...t_global_rulestack_list_minimum_set_gen.py | 2 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ..._local_rulestack_delete_maximum_set_gen.py | 2 +- ..._local_rulestack_delete_minimum_set_gen.py | 2 +- ...ect_local_rulestack_get_maximum_set_gen.py | 2 +- ...ect_local_rulestack_get_minimum_set_gen.py | 2 +- ...ist_by_local_rulestacks_maximum_set_gen.py | 2 +- ...ist_by_local_rulestacks_minimum_set_gen.py | 2 +- .../firewall_status_get_maximum_set_gen.py | 2 +- .../firewall_status_get_minimum_set_gen.py | 2 +- ...tatus_list_by_firewalls_maximum_set_gen.py | 2 +- ...tatus_list_by_firewalls_minimum_set_gen.py | 2 +- ...ewalls_create_or_update_maximum_set_gen.py | 3 +- ...ewalls_create_or_update_minimum_set_gen.py | 2 +- .../firewalls_delete_maximum_set_gen.py | 2 +- .../firewalls_delete_minimum_set_gen.py | 2 +- ...ls_get_global_rulestack_maximum_set_gen.py | 2 +- ...ls_get_global_rulestack_minimum_set_gen.py | 2 +- ...rewalls_get_log_profile_maximum_set_gen.py | 2 +- ...rewalls_get_log_profile_minimum_set_gen.py | 2 +- .../firewalls_get_maximum_set_gen.py | 2 +- .../firewalls_get_minimum_set_gen.py | 2 +- ...ewalls_get_support_info_maximum_set_gen.py | 2 +- ...ewalls_get_support_info_minimum_set_gen.py | 2 +- ..._list_by_resource_group_maximum_set_gen.py | 2 +- ..._list_by_resource_group_minimum_set_gen.py | 2 +- ...ls_list_by_subscription_maximum_set_gen.py | 2 +- ...ls_list_by_subscription_minimum_set_gen.py | 2 +- ...ewalls_save_log_profile_maximum_set_gen.py | 2 +- ...ewalls_save_log_profile_minimum_set_gen.py | 2 +- .../firewalls_update_maximum_set_gen.py | 3 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ...global_rulestack_delete_maximum_set_gen.py | 2 +- ...global_rulestack_delete_minimum_set_gen.py | 2 +- ...st_global_rulestack_get_maximum_set_gen.py | 2 +- ...st_global_rulestack_get_minimum_set_gen.py | 2 +- ...t_global_rulestack_list_maximum_set_gen.py | 2 +- ...t_global_rulestack_list_minimum_set_gen.py | 2 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ..._local_rulestack_delete_maximum_set_gen.py | 2 +- ..._local_rulestack_delete_minimum_set_gen.py | 2 +- ...ist_local_rulestack_get_maximum_set_gen.py | 2 +- ...ist_local_rulestack_get_minimum_set_gen.py | 2 +- ...ist_by_local_rulestacks_maximum_set_gen.py | 2 +- ...ist_by_local_rulestacks_minimum_set_gen.py | 2 +- ...global_rulestack_commit_maximum_set_gen.py | 2 +- ...global_rulestack_commit_minimum_set_gen.py | 2 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ...global_rulestack_delete_maximum_set_gen.py | 2 +- ...global_rulestack_delete_minimum_set_gen.py | 2 +- ...ulestack_get_change_log_maximum_set_gen.py | 2 +- ...ulestack_get_change_log_minimum_set_gen.py | 2 +- .../global_rulestack_get_maximum_set_gen.py | 2 +- .../global_rulestack_get_minimum_set_gen.py | 2 +- ...vanced_security_objects_maximum_set_gen.py | 2 +- ...vanced_security_objects_minimum_set_gen.py | 2 +- ..._rulestack_list_app_ids_maximum_set_gen.py | 2 +- ..._rulestack_list_app_ids_minimum_set_gen.py | 2 +- ...ulestack_list_countries_maximum_set_gen.py | 2 +- ...ulestack_list_countries_minimum_set_gen.py | 2 +- ...ulestack_list_firewalls_maximum_set_gen.py | 2 +- ...ulestack_list_firewalls_minimum_set_gen.py | 2 +- .../global_rulestack_list_maximum_set_gen.py | 2 +- .../global_rulestack_list_minimum_set_gen.py | 2 +- ...edefined_url_categories_maximum_set_gen.py | 2 +- ...edefined_url_categories_minimum_set_gen.py | 2 +- ..._list_security_services_maximum_set_gen.py | 2 +- ..._list_security_services_minimum_set_gen.py | 2 +- ...global_rulestack_revert_maximum_set_gen.py | 2 +- ...global_rulestack_revert_minimum_set_gen.py | 2 +- ...global_rulestack_update_maximum_set_gen.py | 2 +- ..._rules_create_or_update_maximum_set_gen.py | 2 +- ..._rules_create_or_update_minimum_set_gen.py | 2 +- .../local_rules_delete_maximum_set_gen.py | 2 +- .../local_rules_delete_minimum_set_gen.py | 2 +- ...ocal_rules_get_counters_maximum_set_gen.py | 2 +- ...ocal_rules_get_counters_minimum_set_gen.py | 2 +- .../local_rules_get_maximum_set_gen.py | 2 +- .../local_rules_get_minimum_set_gen.py | 2 +- ...ist_by_local_rulestacks_maximum_set_gen.py | 2 +- ...ist_by_local_rulestacks_minimum_set_gen.py | 2 +- ..._rules_refresh_counters_maximum_set_gen.py | 2 +- ..._rules_refresh_counters_minimum_set_gen.py | 2 +- ...al_rules_reset_counters_maximum_set_gen.py | 2 +- ...al_rules_reset_counters_minimum_set_gen.py | 2 +- ...local_rulestacks_commit_maximum_set_gen.py | 2 +- ...local_rulestacks_commit_minimum_set_gen.py | 2 +- ...stacks_create_or_update_maximum_set_gen.py | 2 +- ...stacks_create_or_update_minimum_set_gen.py | 2 +- ...local_rulestacks_delete_maximum_set_gen.py | 2 +- ...local_rulestacks_delete_minimum_set_gen.py | 2 +- ...lestacks_get_change_log_maximum_set_gen.py | 2 +- ...lestacks_get_change_log_minimum_set_gen.py | 2 +- .../local_rulestacks_get_maximum_set_gen.py | 2 +- .../local_rulestacks_get_minimum_set_gen.py | 2 +- ...stacks_get_support_info_maximum_set_gen.py | 2 +- ...stacks_get_support_info_minimum_set_gen.py | 2 +- ...vanced_security_objects_maximum_set_gen.py | 2 +- ...vanced_security_objects_minimum_set_gen.py | 2 +- ..._list_by_resource_group_maximum_set_gen.py | 2 +- ..._list_by_resource_group_minimum_set_gen.py | 2 +- ...ks_list_by_subscription_maximum_set_gen.py | 2 +- ...ks_list_by_subscription_minimum_set_gen.py | 2 +- ...lestacks_list_firewalls_maximum_set_gen.py | 2 +- ...lestacks_list_firewalls_minimum_set_gen.py | 2 +- ..._list_security_services_maximum_set_gen.py | 2 +- ..._list_security_services_minimum_set_gen.py | 2 +- ...local_rulestacks_revert_maximum_set_gen.py | 2 +- ...local_rulestacks_revert_minimum_set_gen.py | 2 +- ...local_rulestacks_update_maximum_set_gen.py | 2 +- .../operations_list_maximum_set_gen.py | 2 +- .../operations_list_minimum_set_gen.py | 2 +- ...e_product_serial_number_maximum_set_gen.py | 38 + ...e_product_serial_number_minimum_set_gen.py | 38 + ...t_cloud_manager_tenants_maximum_set_gen.py | 38 + ...t_cloud_manager_tenants_minimum_set_gen.py | 38 + ...ct_serial_number_status_maximum_set_gen.py | 38 + ...ct_serial_number_status_minimum_set_gen.py | 38 + ...dngfw_list_support_info_maximum_set_gen.py | 38 + ...dngfw_list_support_info_minimum_set_gen.py | 38 + ..._rules_create_or_update_maximum_set_gen.py | 2 +- ..._rules_create_or_update_minimum_set_gen.py | 2 +- .../post_rules_delete_maximum_set_gen.py | 2 +- .../post_rules_delete_minimum_set_gen.py | 2 +- ...post_rules_get_counters_maximum_set_gen.py | 2 +- ...post_rules_get_counters_minimum_set_gen.py | 2 +- .../post_rules_get_maximum_set_gen.py | 2 +- .../post_rules_get_minimum_set_gen.py | 2 +- .../post_rules_list_maximum_set_gen.py | 2 +- .../post_rules_list_minimum_set_gen.py | 2 +- ..._rules_refresh_counters_maximum_set_gen.py | 2 +- ..._rules_refresh_counters_minimum_set_gen.py | 2 +- ...st_rules_reset_counters_maximum_set_gen.py | 2 +- ...st_rules_reset_counters_minimum_set_gen.py | 2 +- ..._rules_create_or_update_maximum_set_gen.py | 2 +- ..._rules_create_or_update_minimum_set_gen.py | 2 +- .../pre_rules_delete_maximum_set_gen.py | 2 +- .../pre_rules_delete_minimum_set_gen.py | 2 +- .../pre_rules_get_counters_maximum_set_gen.py | 2 +- .../pre_rules_get_counters_minimum_set_gen.py | 2 +- .../pre_rules_get_maximum_set_gen.py | 2 +- .../pre_rules_get_minimum_set_gen.py | 2 +- .../pre_rules_list_maximum_set_gen.py | 2 +- .../pre_rules_list_minimum_set_gen.py | 2 +- ..._rules_refresh_counters_maximum_set_gen.py | 2 +- ..._rules_refresh_counters_minimum_set_gen.py | 2 +- ...re_rules_reset_counters_maximum_set_gen.py | 2 +- ...re_rules_reset_counters_minimum_set_gen.py | 2 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ...global_rulestack_delete_maximum_set_gen.py | 2 +- ...global_rulestack_delete_minimum_set_gen.py | 2 +- ...st_global_rulestack_get_maximum_set_gen.py | 2 +- ...st_global_rulestack_get_minimum_set_gen.py | 2 +- ...t_global_rulestack_list_maximum_set_gen.py | 2 +- ...t_global_rulestack_list_minimum_set_gen.py | 2 +- ...estack_create_or_update_maximum_set_gen.py | 2 +- ...estack_create_or_update_minimum_set_gen.py | 2 +- ..._local_rulestack_delete_maximum_set_gen.py | 2 +- ..._local_rulestack_delete_minimum_set_gen.py | 2 +- ...ist_local_rulestack_get_maximum_set_gen.py | 2 +- ...ist_local_rulestack_get_minimum_set_gen.py | 2 +- ...ist_by_local_rulestacks_maximum_set_gen.py | 2 +- ...ist_by_local_rulestacks_minimum_set_gen.py | 2 +- .../azure-mgmt-playwrighttesting/_meta.json | 4 +- .../mgmt/playwrighttesting/_configuration.py | 6 +- .../_playwright_testing_mgmt_client.py | 11 +- .../playwrighttesting/aio/_configuration.py | 6 +- .../aio/_playwright_testing_mgmt_client.py | 11 +- .../aio/operations/__init__.py | 2 + .../operations/_account_quotas_operations.py | 215 + .../aio/operations/_accounts_operations.py | 190 +- .../aio/operations/_quotas_operations.py | 12 +- .../mgmt/playwrighttesting/models/__init__.py | 20 + .../playwrighttesting/models/_models_py3.py | 537 +- .../_playwright_testing_mgmt_client_enums.py | 23 +- .../playwrighttesting/operations/__init__.py | 2 + .../operations/_account_quotas_operations.py | 291 + .../operations/_accounts_operations.py | 279 +- .../operations/_operations.py | 2 +- .../operations/_quotas_operations.py | 26 +- .../generated_samples/account_quotas_get.py | 42 + .../account_quotas_list_by_account.py | 42 + .../accounts_check_name_availability.py | 40 + .../accounts_create_or_update.py | 13 +- .../generated_samples/accounts_delete.py | 4 +- .../generated_samples/accounts_get.py | 4 +- .../accounts_list_by_resource_group.py | 2 +- .../accounts_list_by_subscription.py | 2 +- .../generated_samples/accounts_update.py | 4 +- .../generated_samples/operations_list.py | 2 +- .../generated_samples/quotas_get.py | 4 +- .../quotas_list_by_subscription.py | 2 +- sdk/quantum/azure-mgmt-quantum/_meta.json | 10 +- .../_azure_quantum_management_client.py | 4 +- .../azure/mgmt/quantum/_configuration.py | 6 +- .../azure/mgmt/quantum/_serialization.py | 26 +- .../azure/mgmt/quantum/_vendor.py | 14 - .../azure/mgmt/quantum/_version.py | 2 +- .../aio/_azure_quantum_management_client.py | 4 +- .../azure/mgmt/quantum/aio/_configuration.py | 6 +- .../aio/operations/_workspace_operations.py | 213 +- .../aio/operations/_workspaces_operations.py | 31 +- .../azure/mgmt/quantum/models/__init__.py | 8 + .../_azure_quantum_management_client_enums.py | 7 + .../azure/mgmt/quantum/models/_models_py3.py | 148 +- .../operations/_offerings_operations.py | 6 +- .../mgmt/quantum/operations/_operations.py | 2 +- .../operations/_workspace_operations.py | 286 +- .../operations/_workspaces_operations.py | 93 +- .../generated_samples/list_keys.py | 41 + .../generated_samples/offerings_list.py | 2 +- .../generated_samples/operations.py | 2 +- ...ntum_workspaces_check_name_availability.py | 2 +- .../quantum_workspaces_delete.py | 2 +- .../quantum_workspaces_get.py | 2 +- .../quantum_workspaces_list_resource_group.py | 2 +- .../quantum_workspaces_list_subscription.py | 2 +- .../quantum_workspaces_patch.py | 2 +- .../quantum_workspaces_put.py | 2 +- .../generated_samples/regenerate_key.py | 41 + .../_meta.json | 4 +- .../_configuration.py | 4 +- .../_site_recovery_management_client.py | 2 +- .../recoveryservicessiterecovery/_version.py | 2 +- .../aio/_configuration.py | 4 +- .../aio/_site_recovery_management_client.py | 2 +- .../_replication_fabrics_operations.py | 118 + .../models/__init__.py | 6 + .../models/_models_py3.py | 104 + .../_migration_recovery_points_operations.py | 4 +- .../operations/_operations.py | 2 +- .../operations/_recovery_points_operations.py | 4 +- .../_replication_alert_settings_operations.py | 6 +- .../_replication_appliances_operations.py | 2 +- ...lication_eligibility_results_operations.py | 4 +- .../_replication_events_operations.py | 4 +- .../_replication_fabrics_operations.py | 171 +- .../_replication_jobs_operations.py | 12 +- ...replication_logical_networks_operations.py | 4 +- ..._replication_migration_items_operations.py | 24 +- ...replication_network_mappings_operations.py | 12 +- .../_replication_networks_operations.py | 6 +- .../_replication_policies_operations.py | 10 +- ...eplication_protectable_items_operations.py | 4 +- ..._replication_protected_items_operations.py | 44 +- ...rotection_container_mappings_operations.py | 14 +- ...cation_protection_containers_operations.py | 14 +- ...plication_protection_intents_operations.py | 6 +- .../_replication_recovery_plans_operations.py | 24 +- ..._recovery_services_providers_operations.py | 14 +- ...rage_classification_mappings_operations.py | 10 +- ...tion_storage_classifications_operations.py | 6 +- .../_replication_vault_health_operations.py | 4 +- .../_replication_vault_setting_operations.py | 6 +- .../_replicationv_centers_operations.py | 12 +- ..._supported_operating_systems_operations.py | 2 +- .../_target_compute_sizes_operations.py | 2 +- .../migration_recovery_points_get.py | 2 +- ...nts_list_by_replication_migration_items.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../generated_samples/recovery_points_get.py | 2 +- ...nts_list_by_replication_protected_items.py | 2 +- .../replication_alert_settings_create.py | 2 +- .../replication_alert_settings_get.py | 2 +- .../replication_alert_settings_list.py | 2 +- .../replication_appliances_list.py | 2 +- .../replication_eligibility_results_get.py | 2 +- .../replication_eligibility_results_list.py | 2 +- .../replication_events_get.py | 2 +- .../replication_events_list.py | 2 +- .../replication_fabrics_check_consistency.py | 2 +- .../replication_fabrics_create.py | 2 +- .../replication_fabrics_delete.py | 2 +- .../replication_fabrics_get.py | 2 +- .../replication_fabrics_list.py | 2 +- .../replication_fabrics_migrate_to_aad.py | 2 +- .../replication_fabrics_purge.py | 2 +- ...replication_fabrics_reassociate_gateway.py | 2 +- .../replication_fabrics_renew_certificate.py | 2 +- .../replication_infrastructure_delete.py | 42 + .../replication_jobs_cancel.py | 2 +- .../replication_jobs_export.py | 2 +- .../generated_samples/replication_jobs_get.py | 2 +- .../replication_jobs_list.py | 2 +- .../replication_jobs_restart.py | 2 +- .../replication_jobs_resume.py | 2 +- .../replication_logical_networks_get.py | 2 +- ...al_networks_list_by_replication_fabrics.py | 2 +- .../replication_migration_items_create.py | 2 +- .../replication_migration_items_delete.py | 2 +- .../replication_migration_items_get.py | 2 +- .../replication_migration_items_list.py | 2 +- ...st_by_replication_protection_containers.py | 2 +- .../replication_migration_items_migrate.py | 2 +- ...ation_migration_items_pause_replication.py | 2 +- ...tion_migration_items_resume_replication.py | 2 +- .../replication_migration_items_resync.py | 2 +- ...eplication_migration_items_test_migrate.py | 2 +- ...on_migration_items_test_migrate_cleanup.py | 2 +- .../replication_migration_items_update.py | 2 +- .../replication_network_mappings_create.py | 2 +- .../replication_network_mappings_delete.py | 2 +- .../replication_network_mappings_get.py | 2 +- .../replication_network_mappings_list.py | 2 +- ...k_mappings_list_by_replication_networks.py | 2 +- .../replication_network_mappings_update.py | 2 +- .../replication_networks_get.py | 2 +- .../replication_networks_list.py | 2 +- ...on_networks_list_by_replication_fabrics.py | 2 +- .../replication_policies_create.py | 2 +- .../replication_policies_delete.py | 2 +- .../replication_policies_get.py | 2 +- .../replication_policies_list.py | 2 +- .../replication_policies_update.py | 2 +- .../replication_protectable_items_get.py | 2 +- ...st_by_replication_protection_containers.py | 2 +- .../replication_protected_items_add_disks.py | 2 +- ...on_protected_items_apply_recovery_point.py | 2 +- .../replication_protected_items_create.py | 2 +- .../replication_protected_items_delete.py | 2 +- ...ication_protected_items_failover_cancel.py | 2 +- ...ication_protected_items_failover_commit.py | 2 +- .../replication_protected_items_get.py | 2 +- .../replication_protected_items_list.py | 2 +- ...st_by_replication_protection_containers.py | 2 +- ...cation_protected_items_planned_failover.py | 2 +- .../replication_protected_items_purge.py | 2 +- ...eplication_protected_items_remove_disks.py | 2 +- ...tion_protected_items_repair_replication.py | 2 +- .../replication_protected_items_reprotect.py | 2 +- ...n_protected_items_resolve_health_errors.py | 2 +- ...ication_protected_items_switch_provider.py | 2 +- ...plication_protected_items_test_failover.py | 2 +- ...n_protected_items_test_failover_cleanup.py | 2 +- ...tion_protected_items_unplanned_failover.py | 2 +- .../replication_protected_items_update.py | 2 +- ...cation_protected_items_update_appliance.py | 2 +- ...protected_items_update_mobility_service.py | 2 +- ...on_protection_container_mappings_create.py | 2 +- ...on_protection_container_mappings_delete.py | 2 +- ...ation_protection_container_mappings_get.py | 2 +- ...tion_protection_container_mappings_list.py | 2 +- ...st_by_replication_protection_containers.py | 2 +- ...ion_protection_container_mappings_purge.py | 2 +- ...on_protection_container_mappings_update.py | 2 +- ...eplication_protection_containers_create.py | 2 +- ...eplication_protection_containers_delete.py | 2 +- ...on_containers_discover_protectable_item.py | 2 +- .../replication_protection_containers_get.py | 2 +- .../replication_protection_containers_list.py | 2 +- ..._containers_list_by_replication_fabrics.py | 2 +- ...protection_containers_switch_protection.py | 2 +- .../replication_protection_intents_create.py | 2 +- .../replication_protection_intents_get.py | 2 +- .../replication_protection_intents_list.py | 2 +- .../replication_recovery_plans_create.py | 2 +- .../replication_recovery_plans_delete.py | 2 +- ...lication_recovery_plans_failover_cancel.py | 2 +- ...lication_recovery_plans_failover_commit.py | 2 +- .../replication_recovery_plans_get.py | 2 +- .../replication_recovery_plans_list.py | 2 +- ...ication_recovery_plans_planned_failover.py | 2 +- .../replication_recovery_plans_reprotect.py | 2 +- ...eplication_recovery_plans_test_failover.py | 2 +- ...on_recovery_plans_test_failover_cleanup.py | 2 +- ...ation_recovery_plans_unplanned_failover.py | 2 +- .../replication_recovery_plans_update.py | 2 +- ...tion_recovery_services_providers_create.py | 2 +- ...tion_recovery_services_providers_delete.py | 2 +- ...ication_recovery_services_providers_get.py | 2 +- ...cation_recovery_services_providers_list.py | 2 +- ...s_providers_list_by_replication_fabrics.py | 2 +- ...ation_recovery_services_providers_purge.py | 2 +- ...ery_services_providers_refresh_provider.py | 2 +- ..._storage_classification_mappings_create.py | 2 +- ..._storage_classification_mappings_delete.py | 2 +- ...ion_storage_classification_mappings_get.py | 2 +- ...on_storage_classification_mappings_list.py | 2 +- ..._by_replication_storage_classifications.py | 2 +- ...replication_storage_classifications_get.py | 2 +- ...eplication_storage_classifications_list.py | 2 +- ...sifications_list_by_replication_fabrics.py | 2 +- .../replication_vault_health_get.py | 2 +- .../replication_vault_health_refresh.py | 2 +- .../replication_vault_setting_create.py | 2 +- .../replication_vault_setting_get.py | 2 +- .../replication_vault_setting_list.py | 2 +- .../replicationv_centers_delete.py | 2 +- .../replicationv_centers_get.py | 2 +- .../replicationv_centers_list.py | 2 +- ...onv_centers_list_by_replication_fabrics.py | 2 +- .../supported_operating_systems_get.py | 2 +- ...zes_list_by_replication_protected_items.py | 2 +- .../azure-mgmt-redisenterprise/_meta.json | 10 +- .../mgmt/redisenterprise/_configuration.py | 12 +- .../_redis_enterprise_management_client.py | 10 +- .../mgmt/redisenterprise/_serialization.py | 32 +- .../azure/mgmt/redisenterprise/_vendor.py | 14 - .../azure/mgmt/redisenterprise/_version.py | 2 +- .../redisenterprise/aio/_configuration.py | 12 +- .../_redis_enterprise_management_client.py | 10 +- .../aio/operations/__init__.py | 2 - .../aio/operations/_databases_operations.py | 99 +- .../aio/operations/_operations.py | 9 +- .../_operations_status_operations.py | 9 +- ...private_endpoint_connections_operations.py | 133 +- .../_private_link_resources_operations.py | 9 +- .../_redis_enterprise_operations.py | 46 +- .../mgmt/redisenterprise/models/__init__.py | 14 - .../redisenterprise/models/_models_py3.py | 273 +- ...edis_enterprise_management_client_enums.py | 16 +- .../redisenterprise/operations/__init__.py | 2 - .../operations/_databases_operations.py | 166 +- .../redisenterprise/operations/_operations.py | 13 +- .../_operations_status_operations.py | 17 +- ...private_endpoint_connections_operations.py | 159 +- .../_private_link_resources_operations.py | 17 +- .../_redis_enterprise_operations.py | 84 +- .../generated_samples/operations_list.py | 2 +- .../operations_status_get.py | 2 +- .../redis_enterprise_create.py | 2 +- .../redis_enterprise_databases_create.py | 2 +- ...e_databases_create_with_geo_replication.py | 2 +- .../redis_enterprise_databases_delete.py | 5 +- .../redis_enterprise_databases_export.py | 5 +- .../redis_enterprise_databases_flush.py | 5 +- ...redis_enterprise_databases_force_unlink.py | 5 +- .../redis_enterprise_databases_get.py | 2 +- .../redis_enterprise_databases_import.py | 5 +- ...is_enterprise_databases_list_by_cluster.py | 2 +- .../redis_enterprise_databases_list_keys.py | 2 +- ...dis_enterprise_databases_regenerate_key.py | 2 +- .../redis_enterprise_databases_update.py | 2 +- .../redis_enterprise_delete.py | 5 +- ...rise_delete_private_endpoint_connection.py | 7 +- .../generated_samples/redis_enterprise_get.py | 2 +- ...erprise_get_private_endpoint_connection.py | 2 +- .../redis_enterprise_list.py | 2 +- ...redis_enterprise_list_by_resource_group.py | 2 +- ...prise_list_private_endpoint_connections.py | 2 +- ..._enterprise_list_private_link_resources.py | 2 +- ...erprise_put_private_endpoint_connection.py | 2 +- .../redis_enterprise_update.py | 2 +- sdk/scvmm/azure-mgmt-scvmm/_meta.json | 10 +- .../azure/mgmt/scvmm/_configuration.py | 15 +- .../azure/mgmt/scvmm/_scvmm.py | 38 +- .../azure/mgmt/scvmm/_serialization.py | 119 +- .../azure/mgmt/scvmm/_vendor.py | 11 - .../azure/mgmt/scvmm/_version.py | 2 +- .../azure/mgmt/scvmm/aio/_configuration.py | 15 +- .../azure/mgmt/scvmm/aio/_scvmm.py | 39 +- .../mgmt/scvmm/aio/operations/__init__.py | 10 +- .../_availability_sets_operations.py | 204 +- .../aio/operations/_clouds_operations.py | 206 +- .../operations/_inventory_items_operations.py | 111 +- .../mgmt/scvmm/aio/operations/_operations.py | 24 +- ...nce_hybrid_identity_metadata_operations.py | 208 + ... _virtual_machine_instances_operations.py} | 1297 +- .../_virtual_machine_templates_operations.py | 130 +- .../_virtual_networks_operations.py | 129 +- .../_vm_instance_guest_agents_operations.py | 479 + .../aio/operations/_vmm_servers_operations.py | 130 +- .../azure/mgmt/scvmm/models/__init__.py | 104 +- .../azure/mgmt/scvmm/models/_models_py3.py | 2684 +- .../azure/mgmt/scvmm/models/_scvmm_enums.py | 76 +- .../azure/mgmt/scvmm/operations/__init__.py | 10 +- .../_availability_sets_operations.py | 318 +- .../scvmm/operations/_clouds_operations.py | 307 +- .../operations/_inventory_items_operations.py | 214 +- .../mgmt/scvmm/operations/_operations.py | 27 +- ...nce_hybrid_identity_metadata_operations.py | 260 + ... _virtual_machine_instances_operations.py} | 1581 +- .../_virtual_machine_templates_operations.py | 220 +- .../_virtual_networks_operations.py | 207 +- .../_vm_instance_guest_agents_operations.py | 579 + .../operations/_vmm_servers_operations.py | 213 +- .../create_availability_set.py | 4 +- ...ate_checkpoint_virtual_machine_instance.py | 39 + .../generated_samples/create_cloud.py | 6 +- .../create_inventory_item.py | 4 +- .../create_virtual_machine.py | 54 - .../create_virtual_machine_instance.py | 40 + .../create_virtual_machine_template.py | 4 +- .../create_virtual_network.py | 4 +- ...e.py => create_vm_instance_guest_agent.py} | 11 +- .../generated_samples/create_vmm_server.py | 2 +- .../delete_availability_set.py | 7 +- ...ete_checkpoint_virtual_machine_instance.py | 39 + .../generated_samples/delete_cloud.py | 7 +- .../delete_inventory_item.py | 7 +- ....py => delete_virtual_machine_instance.py} | 12 +- .../delete_virtual_machine_template.py | 5 +- .../delete_virtual_network.py | 5 +- ...e.py => delete_vm_instance_guest_agent.py} | 12 +- .../generated_samples/delete_vmm_server.py | 5 +- .../generated_samples/get_availability_set.py | 4 +- .../generated_samples/get_cloud.py | 4 +- .../generated_samples/get_inventory_item.py | 4 +- ...ine.py => get_virtual_machine_instance.py} | 13 +- .../get_virtual_machine_template.py | 2 +- .../generated_samples/get_virtual_network.py | 2 +- ...hine.py => get_vm_instance_guest_agent.py} | 13 +- ...et_vm_instance_hybrid_identity_metadata.py | 40 + .../generated_samples/get_vmm_server.py | 2 +- ...d_identity_metadata_list_by_vm_instance.py | 41 + ...ist_availability_sets_by_resource_group.py | 2 +- .../list_availability_sets_by_subscription.py | 2 +- .../list_clouds_by_resource_group.py | 2 +- .../list_clouds_by_subscription.py | 2 +- .../list_inventory_items_by_vmm_server.py | 2 +- .../generated_samples/list_operations.py | 2 +- ...p.py => list_virtual_machine_instances.py} | 10 +- ...ual_machine_templates_by_resource_group.py | 2 +- ...rtual_machine_templates_by_subscription.py | 2 +- ...list_virtual_networks_by_resource_group.py | 2 +- .../list_virtual_networks_by_subscription.py | 2 +- .../list_vmm_servers_by_resource_group.py | 2 +- .../list_vmm_servers_by_subscription.py | 2 +- .../restart_virtual_machine_instance.py | 39 + ...ore_checkpoint_virtual_machine_instance.py | 39 + ...e.py => start_virtual_machine_instance.py} | 12 +- ...ne.py => stop_virtual_machine_instance.py} | 12 +- .../update_availability_set.py | 4 +- .../generated_samples/update_cloud.py | 4 +- .../update_virtual_machine_instance.py | 40 + .../update_virtual_machine_template.py | 2 +- .../update_virtual_network.py | 2 +- .../generated_samples/update_vmm_server.py | 2 +- ... => vm_instance_guest_agent_list_by_vm.py} | 10 +- .../azure-mgmt-securityinsight/_meta.json | 10 +- .../mgmt/securityinsight/_configuration.py | 10 +- .../securityinsight/_security_insights.py | 134 +- .../mgmt/securityinsight/_serialization.py | 119 +- .../azure/mgmt/securityinsight/_vendor.py | 11 - .../azure/mgmt/securityinsight/_version.py | 2 +- .../securityinsight/aio/_configuration.py | 10 +- .../securityinsight/aio/_security_insights.py | 137 +- .../aio/operations/__init__.py | 46 +- .../aio/operations/_actions_operations.py | 38 +- .../aio/operations/_alert_rule_operations.py | 287 + .../_alert_rule_templates_operations.py | 19 +- .../aio/operations/_alert_rules_operations.py | 38 +- .../_automation_rules_operations.py | 39 +- .../_billing_statistics_operations.py | 215 + .../aio/operations/_bookmark_operations.py | 17 +- .../_bookmark_relations_operations.py | 38 +- .../aio/operations/_bookmarks_operations.py | 38 +- .../operations/_content_package_operations.py | 271 + .../_content_packages_operations.py | 250 + .../_content_template_operations.py | 343 + .../_content_templates_operations.py | 192 + .../_data_connector_definitions_operations.py | 440 + ...onnectors_check_requirements_operations.py | 17 +- .../operations/_data_connectors_operations.py | 58 +- .../operations/_domain_whois_operations.py | 12 +- .../_entities_get_timeline_operations.py | 17 +- .../aio/operations/_entities_operations.py | 203 +- .../_entities_relations_operations.py | 12 +- .../operations/_entity_queries_operations.py | 44 +- .../_entity_query_templates_operations.py | 23 +- .../_entity_relations_operations.py | 12 +- .../operations/_file_imports_operations.py | 42 +- .../aio/operations/_get_operations.py | 12 +- .../_get_recommendations_operations.py | 12 +- ...riggered_analytics_rule_runs_operations.py | 146 + .../operations/_hunt_comments_operations.py | 479 + .../operations/_hunt_relations_operations.py | 480 + .../aio/operations/_hunts_operations.py | 452 + .../_incident_comments_operations.py | 39 +- .../_incident_relations_operations.py | 38 +- .../operations/_incident_tasks_operations.py | 38 +- .../aio/operations/_incidents_operations.py | 82 +- .../aio/operations/_ip_geodata_operations.py | 12 +- .../aio/operations/_metadata_operations.py | 50 +- .../operations/_office_consents_operations.py | 26 +- .../aio/operations/_operations.py | 12 +- .../operations/_product_package_operations.py | 118 + .../_product_packages_operations.py | 173 + .../_product_settings_operations.py | 38 +- .../_product_template_operations.py | 118 + .../_product_templates_operations.py | 183 + ...curity_ml_analytics_settings_operations.py | 40 +- .../_sentinel_onboarding_states_operations.py | 38 +- .../operations/_source_control_operations.py | 96 +- .../operations/_source_controls_operations.py | 230 +- ...telligence_indicator_metrics_operations.py | 12 +- ...hreat_intelligence_indicator_operations.py | 76 +- ...reat_intelligence_indicators_operations.py | 12 +- ...triggered_analytics_rule_run_operations.py | 118 + .../aio/operations/_update_operations.py | 23 +- .../operations/_watchlist_items_operations.py | 39 +- .../aio/operations/_watchlists_operations.py | 38 +- ...pace_manager_assignment_jobs_operations.py | 393 + ...orkspace_manager_assignments_operations.py | 468 + ...space_manager_configurations_operations.py | 468 + .../_workspace_manager_groups_operations.py | 461 + .../_workspace_manager_members_operations.py | 461 + .../mgmt/securityinsight/models/__init__.py | 212 +- .../securityinsight/models/_models_py3.py | 25777 ++-- .../models/_security_insights_enums.py | 841 +- .../securityinsight/operations/__init__.py | 46 +- .../operations/_actions_operations.py | 64 +- .../operations/_alert_rule_operations.py | 334 + .../_alert_rule_templates_operations.py | 33 +- .../operations/_alert_rules_operations.py | 64 +- .../_automation_rules_operations.py | 65 +- .../_billing_statistics_operations.py | 299 + .../operations/_bookmark_operations.py | 25 +- .../_bookmark_relations_operations.py | 64 +- .../operations/_bookmarks_operations.py | 64 +- .../operations/_content_package_operations.py | 359 + .../_content_packages_operations.py | 357 + .../_content_template_operations.py | 472 + .../_content_templates_operations.py | 262 + .../_data_connector_definitions_operations.py | 621 + ...onnectors_check_requirements_operations.py | 25 +- .../operations/_data_connectors_operations.py | 96 +- .../operations/_domain_whois_operations.py | 20 +- .../_entities_get_timeline_operations.py | 25 +- .../operations/_entities_operations.py | 278 +- .../_entities_relations_operations.py | 20 +- .../operations/_entity_queries_operations.py | 72 +- .../_entity_query_templates_operations.py | 39 +- .../_entity_relations_operations.py | 20 +- .../operations/_file_imports_operations.py | 68 +- .../operations/_get_operations.py | 20 +- .../_get_recommendations_operations.py | 20 +- ...riggered_analytics_rule_runs_operations.py | 189 + .../operations/_hunt_comments_operations.py | 678 + .../operations/_hunt_relations_operations.py | 678 + .../operations/_hunts_operations.py | 631 + .../_incident_comments_operations.py | 65 +- .../_incident_relations_operations.py | 64 +- .../operations/_incident_tasks_operations.py | 64 +- .../operations/_incidents_operations.py | 138 +- .../operations/_ip_geodata_operations.py | 20 +- .../operations/_metadata_operations.py | 90 +- .../operations/_office_consents_operations.py | 46 +- .../securityinsight/operations/_operations.py | 16 +- .../operations/_product_package_operations.py | 162 + .../_product_packages_operations.py | 231 + .../_product_settings_operations.py | 64 +- .../_product_template_operations.py | 162 + .../_product_templates_operations.py | 250 + ...curity_ml_analytics_settings_operations.py | 66 +- .../_sentinel_onboarding_states_operations.py | 64 +- .../operations/_source_control_operations.py | 113 +- .../operations/_source_controls_operations.py | 269 +- ...telligence_indicator_metrics_operations.py | 20 +- ...hreat_intelligence_indicator_operations.py | 120 +- ...reat_intelligence_indicators_operations.py | 20 +- ...triggered_analytics_rule_run_operations.py | 162 + .../operations/_update_operations.py | 31 +- .../operations/_watchlist_items_operations.py | 65 +- .../operations/_watchlists_operations.py | 64 +- ...pace_manager_assignment_jobs_operations.py | 604 + ...orkspace_manager_assignments_operations.py | 671 + ...space_manager_configurations_operations.py | 671 + .../_workspace_manager_groups_operations.py | 663 + .../_workspace_manager_members_operations.py | 663 + .../create_action_of_alert_rule.py | 2 +- .../delete_action_of_alert_rule.py | 5 +- .../get_action_of_alert_rule_by_id.py | 2 +- .../get_all_actions_by_alert_rule.py | 2 +- .../get_alert_rule_template_by_id.py | 2 +- .../get_alert_rule_templates.py | 2 +- .../create_fusion_alert_rule.py | 2 +- ...ert_rule_with_fusion_scenario_exclusion.py | 2 +- ...t_security_incident_creation_alert_rule.py | 2 +- .../create_nrt_alert_rule.py | 2 +- .../create_scheduled_alert_rule.py | 2 +- .../{ => alert_rules}/delete_alert_rule.py | 5 +- .../{ => alert_rules}/get_all_alert_rules.py | 2 +- .../get_fusion_alert_rule.py | 2 +- ...t_security_incident_creation_alert_rule.py | 2 +- .../{ => alert_rules}/get_nrt_alert_rule.py | 2 +- .../get_scheduled_alert_rule.py | 2 +- .../automation_rules_create_or_update.py | 2 +- .../automation_rules_delete.py | 2 +- .../automation_rules_get.py | 2 +- .../automation_rules_list.py | 2 +- .../get_all_billing_statistics.py | 42 + .../get_billing_statistic.py} | 8 +- .../{ => bookmarks}/create_bookmark.py | 2 +- .../{ => bookmarks}/delete_bookmark.py | 5 +- .../expand}/post_expand_bookmark.py | 2 +- .../{ => bookmarks}/get_bookmark_by_id.py | 2 +- .../{ => bookmarks}/get_bookmarks.py | 2 +- .../relations}/create_bookmark_relation.py | 2 +- .../relations}/delete_bookmark_relation.py | 5 +- .../relations}/get_all_bookmark_relations.py | 2 +- .../get_bookmark_relation_by_name.py | 2 +- .../content_packages/get_package_by_id.py | 42 + .../content_packages/get_packages.py | 42 + .../get_product_package_by_id.py | 42 + .../content_packages/get_product_packages.py | 42 + .../content_packages/install_package.py | 52 + .../content_packages/uninstall_package.py | 41 + .../content_templates/delete_template.py | 41 + .../get_product_template_by_id.py | 42 + .../get_product_templates.py | 42 + .../content_templates/get_template_by_id.py | 42 + .../content_templates/get_templates.py | 42 + .../content_templates/install_template.py | 115 + ..._customizable_data_connector_definition.py | 110 + .../delete_data_connector_definition_by_id.py | 41 + ...mizable_data_connectoe_definition_by_id.py | 42 + .../get_data_connector_definitions.py | 42 + ...eck_requirements_azure_active_directory.py | 45 + ...azure_active_directory_no_authorization.py | 45 + ...ments_azure_active_directory_no_license.py | 45 + ...heck_requirements_azure_security_center.py | 45 + .../check_requirements_dynamics365.py | 45 + .../check_requirements_io_t.py | 45 + .../check_requirements_mdatp.py | 45 + ...quirements_microsoft_cloud_app_security.py | 45 + ...icrosoft_purview_information_protection.py | 45 + ...uirements_microsoft_threat_intelligence.py | 45 + ...equirements_microsoft_threat_protection.py | 45 + .../check_requirements_office365_project.py | 45 + .../check_requirements_office_atp.py | 45 + .../check_requirements_office_irm.py | 45 + .../check_requirements_office_power_bi.py | 45 + .../check_requirements_threat_intelligence.py | 45 + ..._requirements_threat_intelligence_taxii.py | 45 + .../connect_api_polling.py | 5 +- .../connect_api_polling_v2_logs.py | 5 +- .../create_api_polling.py | 2 +- .../create_dynamics365_data_connetor.py | 2 +- .../create_generic_ui.py | 2 +- .../create_google_cloud_platform.py | 60 + ...ew_information_protection_data_connetor.py | 50 + ...soft_threat_intelligence_data_connector.py | 51 + ...crosoft_threat_protection_data_connetor.py | 51 + .../create_office365_project_data_connetor.py | 2 +- .../create_office_data_connetor.py | 2 +- .../create_office_power_bi_data_connector.py | 2 +- ...eate_threat_intelligence_data_connector.py | 2 +- ...hreat_intelligence_taxii_data_connector.py | 2 +- .../delete_api_polling.py | 5 +- .../delete_generic_ui.py | 5 +- .../delete_google_cloud_platform.py | 41 + ...ew_information_protection_data_connetor.py | 41 + ...soft_threat_intelligence_data_connector.py | 41 + .../delete_office365_project_data_connetor.py | 5 +- .../delete_office_data_connetor.py | 5 +- .../delete_office_power_bi_data_connetor.py | 5 +- .../disconnect_api_polling.py | 5 +- ...t_amazon_web_services_cloud_trail_by_id.py | 2 +- .../get_amazon_web_services_s3_by_id.py | 2 +- .../{ => data_connectors}/get_api_polling.py | 2 +- .../get_azure_active_directory_by_id.py | 2 +- ..._azure_advanced_threat_protection_by_id.py | 2 +- .../get_azure_security_center_by_id.py | 2 +- .../get_data_connectors.py | 2 +- .../get_dynamics365_data_connector_by_id.py | 2 +- .../{ => data_connectors}/get_generic_ui.py | 2 +- .../get_google_cloud_platform_by_id.py | 42 + .../{ => data_connectors}/get_io_tby_id.py | 2 +- .../get_microsoft_cloud_app_security_by_id.py | 2 +- ...fender_advanced_threat_protection_by_id.py | 2 +- ...microsoft_insider_risk_management_by_id.py | 2 +- ...ormation_protection_data_connetor_by_id.py | 42 + ...get_microsoft_threat_intelligence_by_id.py | 2 +- .../get_microsoft_threat_protection_by_id.py | 2 +- ...ice365_advanced_threat_protection_by_id.py | 2 +- ...t_office365_project_data_connetor_by_id.py | 2 +- .../get_office_data_connetor_by_id.py | 2 +- ...get_office_power_bi_data_connetor_by_id.py | 2 +- .../get_threat_intelligence_by_id.py | 42 + .../get_threat_intelligence_taxii_by_id.py | 2 +- .../{ => enrichment}/get_geodata_by_ip.py | 2 +- .../get_whois_by_domain_name.py | 2 +- .../expand}/post_expand_entity.py | 2 +- .../get_account_entity_by_id.py | 2 +- .../get_azure_resource_entity_by_id.py | 2 +- .../get_cloud_application_entity_by_id.py | 2 +- .../{ => entities}/get_dns_entity_by_id.py | 2 +- .../{ => entities}/get_entities.py | 2 +- .../{ => entities}/get_file_entity_by_id.py | 2 +- .../get_file_hash_entity_by_id.py | 2 +- .../{ => entities}/get_host_entity_by_id.py | 2 +- .../get_io_tdevice_entity_by_id.py | 2 +- .../{ => entities}/get_ip_entity_by_id.py | 2 +- .../get_mail_cluster_entity_by_id.py | 2 +- .../get_mail_message_entity_by_id.py | 2 +- .../get_mailbox_entity_by_id.py | 2 +- .../get_malware_entity_by_id.py | 2 +- .../get_process_entity_by_id.py | 2 +- .../{ => entities}/get_queries.py | 2 +- .../get_registry_key_entity_by_id.py | 2 +- .../get_registry_value_entity_by_id.py | 2 +- .../get_security_alert_entity_by_id.py | 2 +- .../get_security_group_entity_by_id.py | 2 +- .../get_submission_mail_entity_by_id.py | 2 +- .../{ => entities}/get_url_entity_by_id.py | 2 +- .../insights}/post_get_insights.py | 2 +- .../relations}/get_all_entity_relations.py | 2 +- .../relations}/get_entity_relation_by_name.py | 2 +- .../timeline}/post_timeline_entity.py | 2 +- .../create_entity_query_activity.py | 2 +- .../delete_entity_query.py | 5 +- .../get_activity_entity_query_by_id.py | 2 +- .../get_entity_queries.py | 2 +- .../get_expansion_entity_query_by_id.py | 2 +- ...et_activity_entity_query_template_by_id.py | 2 +- .../get_entity_query_templates.py | 2 +- .../{ => file_imports}/create_file_import.py | 2 +- .../{ => file_imports}/delete_file_import.py | 2 +- .../get_file_import_by_id.py | 2 +- .../{ => file_imports}/get_file_imports.py | 2 +- .../generated_samples/hunts/create_hunt.py | 54 + .../hunts/create_hunt_comment.py | 44 + .../hunts/create_hunt_relation.py | 49 + .../generated_samples/hunts/delete_hunt.py | 41 + .../hunts/delete_hunt_comment.py | 42 + .../hunts/delete_hunt_relation.py | 42 + .../generated_samples/hunts/get_hunt_by_id.py | 42 + .../hunts/get_hunt_comment_by_id.py | 43 + .../hunts/get_hunt_comments.py | 43 + .../hunts/get_hunt_relation_by_id.py | 43 + .../hunts/get_hunt_relations.py | 43 + .../generated_samples/hunts/get_hunts.py | 42 + .../incident_alerts}/incidents_list_alerts.py | 2 +- .../incidents_list_bookmarks.py | 2 +- .../incident_comments_create_or_update.py | 2 +- .../incident_comments_delete.py | 5 +- .../incident_comments_get.py | 2 +- .../incident_comments_list.py | 2 +- .../incidents_list_entities.py | 2 +- .../incident_tasks_create_or_update.py | 2 +- .../incident_tasks}/incident_tasks_delete.py | 5 +- .../incident_tasks}/incident_tasks_get.py | 2 +- .../incident_tasks}/incident_tasks_list.py | 2 +- .../incident_team}/incidents_create_team.py | 2 +- .../incidents_create_or_update.py | 2 +- .../{ => incidents}/incidents_delete.py | 5 +- .../{ => incidents}/incidents_get.py | 2 +- .../{ => incidents}/incidents_list.py | 2 +- .../relations}/create_incident_relation.py | 2 +- .../relations}/delete_incident_relation.py | 5 +- .../relations}/get_all_incident_relations.py | 2 +- .../get_incident_relation_by_name.py | 2 +- .../manual_trigger/entities_run_playbook.py | 41 + .../incidents_run_playbook.py | 2 +- .../{ => metadata}/delete_metadata.py | 5 +- .../{ => metadata}/get_all_metadata.py | 2 +- .../{ => metadata}/get_all_metadata_odata.py | 2 +- .../{ => metadata}/get_metadata.py | 2 +- .../{ => metadata}/patch_metadata.py | 2 +- .../{ => metadata}/put_metadata.py | 2 +- .../{ => metadata}/put_metadata_minimal.py | 2 +- .../delete_office_consents.py | 5 +- .../get_office_consents.py | 2 +- .../get_office_consents_by_id.py | 2 +- .../create_sentinel_onboarding_state.py | 2 +- .../delete_sentinel_onboarding_state.py | 5 +- .../get_all_sentinel_onboarding_states.py | 2 +- .../get_sentinel_onboarding_state.py | 2 +- .../{ => operations}/list_operations.py | 2 +- .../get_recommendation.py | 2 +- .../get_recommendations.py | 2 +- .../patch_recommendation.py | 2 +- .../{ => repositories}/get_repositories.py | 14 +- ...e_anomaly_security_ml_analytics_setting.py | 97 + .../delete_security_ml_analytics_setting.py | 5 +- .../get_all_security_ml_analytics_settings.py | 2 +- ...t_anomaly_security_ml_analytics_setting.py | 2 +- .../{ => settings}/delete_eyes_on_setting.py | 5 +- .../{ => settings}/get_all_settings.py | 2 +- .../{ => settings}/get_eyes_on_setting.py | 2 +- .../{ => settings}/update_eyes_on_setting.py | 2 +- .../create_source_control.py | 12 +- .../sourcecontrols/delete_source_control.py | 52 + .../get_source_control_by_id.py | 2 +- .../get_source_controls.py | 2 +- .../append_tags_threat_intelligence.py | 42 + .../collect_threat_intelligence_metrics.py | 2 +- .../create_threat_intelligence.py | 63 + .../delete_threat_intelligence.py | 5 +- .../get_threat_intelligence.py | 2 +- .../get_threat_intelligence_by_id.py | 2 +- .../query_threat_intelligence.py | 51 + .../replace_tags_threat_intelligence.py | 47 + .../update_threat_intelligence.py | 64 + .../trigger_rule_run_post.py | 42 + .../triggered_analytics_rule_run_get.py | 42 + .../triggered_analytics_rule_runs_get.py | 42 + .../{ => watchlists}/create_watchlist.py | 2 +- .../create_watchlist_and_watchlist_items.py | 2 +- .../{ => watchlists}/create_watchlist_item.py | 2 +- .../{ => watchlists}/delete_watchlist.py | 5 +- .../{ => watchlists}/delete_watchlist_item.py | 5 +- .../get_watchlist_by_alias.py | 2 +- .../get_watchlist_item_by_id.py | 2 +- .../{ => watchlists}/get_watchlist_items.py | 2 +- .../{ => watchlists}/get_watchlists.py | 2 +- .../create_job.py | 42 + ..._or_update_workspace_manager_assignment.py | 55 + .../delete_job.py | 42 + .../delete_workspace_manager_assignment.py | 41 + .../get_all_jobs.py | 43 + .../get_all_workspace_manager_assignments.py | 42 + .../workspace_manager_assignments/get_job.py | 43 + .../get_workspace_manager_assignment.py | 42 + ..._update_workspace_manager_configuration.py | 43 + .../delete_workspace_manager_configuration.py | 41 + ...et_all_workspace_manager_configurations.py | 42 + .../get_workspace_manager_configuration.py | 42 + ...reate_or_update_workspace_manager_group.py | 49 + .../delete_workspace_manager_group.py | 41 + .../get_all_workspace_manager_groups.py | 42 + .../get_workspace_manager_group.py | 42 + ...eate_or_update_workspace_manager_member.py | 48 + .../delete_workspace_manager_member.py | 41 + .../get_all_workspace_manager_members.py | 42 + .../get_workspace_manager_member.py | 42 + .../azure-mgmt-servicefabric/_meta.json | 4 +- .../azure/mgmt/servicefabric/_version.py | 2 +- .../_meta.json | 4 +- .../_configuration.py | 4 +- ...bric_managed_clusters_management_client.py | 2 +- .../servicefabricmanagedclusters/_version.py | 2 +- .../aio/_configuration.py | 4 +- ...bric_managed_clusters_management_client.py | 2 +- .../models/_models_py3.py | 26 + .../_application_type_versions_operations.py | 10 +- .../_application_types_operations.py | 10 +- .../operations/_applications_operations.py | 16 +- ...ged_apply_maintenance_window_operations.py | 2 +- ...managed_az_resiliency_status_operations.py | 2 +- .../_managed_cluster_version_operations.py | 8 +- .../_managed_clusters_operations.py | 12 +- ...ed_maintenance_window_status_operations.py | 2 +- ...managed_unsupported_vm_sizes_operations.py | 4 +- .../operations/_node_type_skus_operations.py | 2 +- .../operations/_node_types_operations.py | 16 +- .../_operation_results_operations.py | 2 +- .../_operation_status_operations.py | 2 +- .../operations/_operations.py | 2 +- .../operations/_services_operations.py | 10 +- .../application_action_get_upgrade_example.py | 2 +- ...plication_action_resume_upgrade_example.py | 2 +- ...plication_action_start_rollback_example.py | 2 +- .../application_delete_operation_example.py | 2 +- .../application_get_operation_example.py | 2 +- .../application_list_operation_example.py | 2 +- .../application_patch_operation_example.py | 2 +- .../application_put_operation_example_max.py | 2 +- .../application_put_operation_example_min.py | 2 +- ...tion_type_name_delete_operation_example.py | 2 +- ...ication_type_name_get_operation_example.py | 2 +- ...cation_type_name_list_operation_example.py | 2 +- ...ation_type_name_patch_operation_example.py | 2 +- ...ication_type_name_put_operation_example.py | 2 +- ...n_type_version_delete_operation_example.py | 2 +- ...tion_type_version_get_operation_example.py | 2 +- ...ion_type_version_list_operation_example.py | 2 +- ...on_type_version_patch_operation_example.py | 2 +- ...tion_type_version_put_operation_example.py | 2 +- .../generated_samples/delete_nodes_example.py | 2 +- .../long_running_operation_result.py | 2 +- .../long_running_operation_status_failed.py | 2 +- ...long_running_operation_status_succeeded.py | 2 +- ...d_apply_maintenance_window_post_example.py | 2 +- ...anaged_az_resiliency_status_get_example.py | 2 +- ...anaged_cluster_delete_operation_example.py | 2 +- .../managed_cluster_get_operation_example.py | 2 +- ...ist_by_resource_group_operation_example.py | 2 +- ..._list_by_subscription_operation_example.py | 2 +- ...managed_cluster_patch_operation_example.py | 2 +- ...naged_cluster_put_operation_example_max.py | 4 +- ...naged_cluster_put_operation_example_min.py | 2 +- ...ster_version_get_by_environment_example.py | 2 +- .../managed_cluster_version_get_example.py | 2 +- ...ged_cluster_version_list_by_environment.py | 2 +- .../managed_cluster_version_list_example.py | 2 +- ...d_maintenance_window_status_get_example.py | 2 +- ...anaged_unsupported_vm_sizes_get_example.py | 2 +- ...naged_unsupported_vm_sizes_list_example.py | 2 +- .../node_type_delete_operation_example.py | 2 +- .../node_type_get_operation_example.py | 2 +- .../node_type_list_operation_example.py | 2 +- ...type_patch_operation_auto_scale_example.py | 2 +- .../node_type_patch_operation_example.py | 2 +- ...e_type_put_operation_auto_scale_example.py | 2 +- ...type_put_operation_custom_image_example.py | 2 +- ...n_custom_shared_galleries_image_example.py | 2 +- ...pe_put_operation_dedicated_host_example.py | 2 +- .../node_type_put_operation_example_max.py | 2 +- .../node_type_put_operation_example_min.py | 2 +- ...de_type_put_operation_stateless_example.py | 2 +- ...ype_put_operation_vm_image_plan_example.py | 2 +- .../node_type_skus_list_operation_example.py | 2 +- .../generated_samples/operations_example.py | 2 +- .../reimage_nodes_example.py | 2 +- .../reimage_nodes_ud_example.py | 2 +- .../restart_nodes_example.py | 2 +- .../service_delete_operation_example.py | 2 +- .../service_get_operation_example.py | 2 +- .../service_list_operation_example.py | 2 +- .../service_patch_operation_example.py | 2 +- .../service_put_operation_example_max.py | 2 +- .../service_put_operation_example_min.py | 2 +- .../azure-mgmt-servicenetworking/_meta.json | 4 +- .../azure/mgmt/servicenetworking/_version.py | 2 +- .../azure-mgmt-storageactions/CHANGELOG.md | 5 + .../azure-mgmt-storageactions/LICENSE | 21 + .../azure-mgmt-storageactions/MANIFEST.in | 8 + .../azure-mgmt-storageactions/README.md | 61 + .../azure-mgmt-storageactions/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/storageactions/__init__.py | 26 + .../mgmt/storageactions/_configuration.py | 66 + .../azure/mgmt/storageactions/_patch.py | 20 + .../mgmt/storageactions/_serialization.py | 2006 + .../_storage_actions_mgmt_client.py | 111 + .../azure/mgmt/storageactions/_vendor.py | 16 + .../azure/mgmt/storageactions/_version.py | 9 + .../azure/mgmt/storageactions/aio/__init__.py | 23 + .../mgmt/storageactions/aio/_configuration.py | 66 + .../azure/mgmt/storageactions/aio/_patch.py | 20 + .../aio/_storage_actions_mgmt_client.py | 111 + .../storageactions/aio/operations/__init__.py | 25 + .../aio/operations/_operations.py | 133 + .../storageactions/aio/operations/_patch.py | 20 + .../_storage_task_assignment_operations.py | 153 + .../operations/_storage_tasks_operations.py | 1034 + .../_storage_tasks_report_operations.py | 162 + .../mgmt/storageactions/models/__init__.py | 99 + .../mgmt/storageactions/models/_models_py3.py | 1395 + .../mgmt/storageactions/models/_patch.py | 20 + .../_storage_actions_mgmt_client_enums.py | 94 + .../storageactions/operations/__init__.py | 25 + .../storageactions/operations/_operations.py | 155 + .../mgmt/storageactions/operations/_patch.py | 20 + .../_storage_task_assignment_operations.py | 197 + .../operations/_storage_tasks_operations.py | 1257 + .../_storage_tasks_report_operations.py | 210 + .../azure/mgmt/storageactions/py.typed | 1 + .../generated_samples/misc/operations_list.py | 39 + .../perform_storage_task_actions_preview.py | 86 + .../storage_tasks_crud/delete_storage_task.py | 40 + .../storage_tasks_crud/get_storage_task.py | 41 + .../storage_tasks_crud/patch_storage_task.py | 61 + .../storage_tasks_crud/put_storage_task.py | 62 + .../list_storage_task_assignment_ids.py | 42 + .../list_storage_tasks_by_resource_group.py | 41 + .../list_storage_tasks_by_subscription.py | 39 + .../list_storage_tasks_run_report_summary.py | 42 + .../sdk_packaging.toml | 11 + .../azure-mgmt-storageactions/setup.py | 82 + sdk/storageactions/ci.yml | 34 + .../CHANGELOG.md | 5 + .../LICENSE | 21 + .../MANIFEST.in | 9 + .../README.md | 61 + .../_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/workloads/__init__.py | 1 + .../workloads/sapvirtualinstance/__init__.py | 26 + .../sapvirtualinstance/_configuration.py | 66 + .../workloads/sapvirtualinstance/_patch.py | 20 + .../sapvirtualinstance/_serialization.py | 2006 + .../workloads/sapvirtualinstance/_vendor.py | 36 + .../workloads/sapvirtualinstance/_version.py | 9 + .../sapvirtualinstance/_workloads_client.py | 120 + .../sapvirtualinstance/aio/__init__.py | 23 + .../sapvirtualinstance/aio/_configuration.py | 66 + .../sapvirtualinstance/aio/_patch.py | 20 + .../sapvirtualinstance/aio/_vendor.py | 28 + .../aio/_workloads_client.py | 120 + .../aio/operations/__init__.py | 29 + .../aio/operations/_operations.py | 135 + .../aio/operations/_patch.py | 20 + ...application_server_instances_operations.py | 1289 + .../_sap_central_instances_operations.py | 1290 + .../_sap_database_instances_operations.py | 1287 + .../_sap_virtual_instances_operations.py | 1397 + .../_workloads_client_operations.py | 587 + .../sapvirtualinstance/models/__init__.py | 273 + .../sapvirtualinstance/models/_models_py3.py | 4874 + .../sapvirtualinstance/models/_patch.py | 20 + .../models/_workloads_client_enums.py | 217 + .../sapvirtualinstance/operations/__init__.py | 29 + .../operations/_operations.py | 155 + .../sapvirtualinstance/operations/_patch.py | 20 + ...application_server_instances_operations.py | 1581 + .../_sap_central_instances_operations.py | 1570 + .../_sap_database_instances_operations.py | 1579 + .../_sap_virtual_instances_operations.py | 1663 + .../_workloads_client_operations.py | 708 + .../workloads/sapvirtualinstance/py.typed | 1 + .../generated_samples/operations_list.py | 39 + ...sap_application_server_instances_create.py | 42 + ...ation_server_instances_create_ha_av_set.py | 42 + ...sap_application_server_instances_delete.py | 41 + .../sap_application_server_instances_get.py | 42 + .../sap_application_server_instances_list.py | 42 + ...ication_server_instances_start_instance.py | 42 + ...es_start_instance_with_infra_operations.py | 42 + ...lication_server_instances_stop_instance.py | 42 + ...ces_stop_instance_with_infra_operations.py | 42 + ...sap_application_server_instances_update.py | 42 + .../sap_central_instances_create.py | 42 + .../sap_central_instances_create_ha_av_set.py | 42 + .../sap_central_instances_delete.py | 41 + .../sap_central_instances_get.py | 42 + .../sap_central_instances_list.py | 42 + .../sap_central_instances_start_instance.py | 42 + ...es_start_instance_with_infra_operations.py | 42 + .../sap_central_instances_stop_instance.py | 42 + ...ces_stop_instance_with_infra_operations.py | 42 + .../sap_central_instances_update.py | 42 + .../sap_database_instances_create.py | 42 + ...sap_database_instances_create_ha_av_set.py | 42 + .../sap_database_instances_delete.py | 41 + .../sap_database_instances_get.py | 42 + .../sap_database_instances_list.py | 42 + .../sap_database_instances_start_instance.py | 42 + ...es_start_instance_with_infra_operations.py | 42 + .../sap_database_instances_stop_instance.py | 42 + ...ces_stop_instance_with_infra_operations.py | 42 + .../sap_database_instances_update.py | 42 + .../sap_availability_zone_details_eastus.py | 40 + ...p_availability_zone_details_northeurope.py | 40 + .../sap_disk_configurations_non_prod.py | 40 + .../sap_disk_configurations_prod.py | 40 + ...ing_recommendations_s4_hana_distributed.py | 40 + ...izing_recommendations_s4_hana_ha_av_set.py | 40 + ...zing_recommendations_s4_hana_ha_av_zone.py | 40 + ...g_recommendations_s4_hana_single_server.py | 40 + .../sap_supported_skus_distributed.py | 40 + ...ap_supported_skus_distributed_ha_av_set.py | 40 + ...p_supported_skus_distributed_ha_av_zone.py | 40 + .../sap_supported_skus_single_server.py | 40 + ..._custom_full_resource_names_distributed.py | 41 + ...te_custom_full_resource_names_ha_av_set.py | 41 + ...e_custom_full_resource_names_ha_av_zone.py | 41 + ...ustom_full_resource_names_single_server.py | 41 + ...p_virtual_instances_create_custom_image.py | 41 + .../sap_virtual_instances_create_discover.py | 41 + ...iscover_custom_mrg_storage_account_name.py | 41 + ...s_create_discover_trusted_access_enable.py | 41 + ...stances_create_disk_details_distributed.py | 41 + ...instances_create_disk_details_ha_av_set.py | 41 + ...nstances_create_disk_details_ha_av_zone.py | 41 + ...ances_create_disk_details_single_server.py | 41 + ...ap_virtual_instances_create_distributed.py | 41 + ...ces_create_distributed_create_transport.py | 41 + ...nces_create_distributed_mount_transport.py | 41 + ...ances_create_distributed_skip_transport.py | 41 + .../sap_virtual_instances_create_ha_av_set.py | 41 + ...sap_virtual_instances_create_ha_av_zone.py | 41 + ..._virtual_instances_create_single_server.py | 41 + ...ances_create_with_os_config_distributed.py | 41 + ...stances_create_with_os_config_ha_av_set.py | 41 + ...tances_create_with_os_config_ha_av_zone.py | 41 + ...ces_create_with_os_config_single_server.py | 41 + ...eate_with_os_config_with_trusted_access.py | 41 + .../sap_virtual_instances_delete.py | 40 + ...stances_detect_installation_distributed.py | 41 + ...instances_detect_installation_ha_av_set.py | 41 + ...nstances_detect_installation_ha_av_zone.py | 41 + ...ances_detect_installation_single_server.py | 41 + .../sap_virtual_instances_get.py | 41 + ..._instances_get_acssinstallation_blocked.py | 41 + ...p_virtual_instances_install_distributed.py | 41 + ...virtual_instances_install_single_server.py | 41 + ...irtual_instances_list_by_resource_group.py | 41 + ..._virtual_instances_list_by_subscription.py | 39 + .../sap_virtual_instances_start.py | 41 + ...l_instances_start_with_infra_operations.py | 41 + .../sap_virtual_instances_stop.py | 41 + ...al_instances_stop_with_infra_operations.py | 41 + ..._instances_trusted_access_enable_update.py | 41 + .../sap_virtual_instances_update.py | 41 + .../sdk_packaging.toml | 11 + .../setup.py | 83 + sdk/workloads/ci.yml | 2 + 4550 files changed, 668504 insertions(+), 53960 deletions(-) create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_definitions_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_versions_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_apis_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_deployments_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_environments_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_metadata_schemas_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_workspaces_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_definitions_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_versions_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_apis_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_deployments_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_environments_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_metadata_schemas_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_workspaces_operations.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_export_specification.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_delete.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_get.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_list.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_delete.py rename sdk/apicenter/azure-mgmt-apicenter/generated_samples/{services_update.py => workspaces_get.py} (89%) create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_head.py create mode 100644 sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_list.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed create mode 100644 sdk/astro/azure-mgmt-astro/CHANGELOG.md create mode 100644 sdk/astro/azure-mgmt-astro/LICENSE create mode 100644 sdk/astro/azure-mgmt-astro/MANIFEST.in create mode 100644 sdk/astro/azure-mgmt-astro/README.md create mode 100644 sdk/astro/azure-mgmt-astro/_meta.json create mode 100644 sdk/astro/azure-mgmt-astro/azure/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_astro_mgmt_client.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_configuration.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_patch.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_serialization.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_vendor.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_version.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_astro_mgmt_client.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_configuration.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_patch.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_operations.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_organizations_operations.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_patch.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_astro_mgmt_client_enums.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_models_py3.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_patch.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/__init__.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_operations.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_organizations_operations.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_patch.py create mode 100644 sdk/astro/azure-mgmt-astro/azure/mgmt/astro/py.typed create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/operations_list_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_create_or_update_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_delete_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_get_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/generated_samples/organizations_update_maximum_set_gen.py create mode 100644 sdk/astro/azure-mgmt-astro/sdk_packaging.toml create mode 100644 sdk/astro/azure-mgmt-astro/setup.py create mode 100644 sdk/astro/ci.yml create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_power_shell72_module_operations.py create mode 100644 sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_power_shell72_module_operations.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_power_shell72_module.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/delete_power_shell72_module.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/get_power_shell72_module.py rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/create_job.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/get_job.py (95%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/get_job_output.py (95%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/get_job_runbook_content.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/get_job_stream.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/list_job_streams_by_job.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/list_jobs_by_automation_account.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/resume_job.py (92%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/stop_job.py (92%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => job}/suspend_job.py (92%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/list_power_shell72_modules_by_automation_account.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration}/create_software_update_configuration.py (100%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration}/delete_software_update_configuration.py (95%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration}/get_software_update_configuration_by_name.py (100%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration}/list_software_update_configurations.py (100%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration}/list_software_update_configurations_by_vm.py (100%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_machine_run}/get_software_update_configuration_machine_run_by_id.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_machine_run}/list_software_update_configuration_machine_runs.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_machine_run}/list_software_update_configuration_machine_runs_by_run.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_run}/get_software_update_configuration_run_by_id.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_run}/list_failed_software_update_configuration_runs.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => software_update_configuration_run}/list_software_update_configuration_runs.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control}/create_or_update_source_control.py (88%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control}/delete_source_control.py (91%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control}/get_all_source_controls.py (95%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control}/get_source_control.py (95%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control}/update_source_control_patch.py (87%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control_sync_job}/create_source_control_sync_job.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control_sync_job}/get_all_source_control_sync_jobs.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control_sync_job}/get_source_control_sync_job.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control_sync_job_streams}/get_source_control_sync_job_streams.py (96%) rename sdk/automation/azure-mgmt-automation/generated_samples/{ => source_control_sync_job_streams}/get_source_control_sync_job_streams_by_stream_id.py (96%) create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py create mode 100644 sdk/automation/azure-mgmt-automation/generated_samples/update_power_shell72_module.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/CHANGELOG.md create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/LICENSE create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/MANIFEST.in create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/README.md create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/_meta.json create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_azuredatatransferrp.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_configuration.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_patch.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_serialization.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_vendor.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_version.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_azuredatatransferrp.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_configuration.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_patch.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_azure_data_transfer_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_connections_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_flows_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_connections_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_flows_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_schemas_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_patch.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_pipelines_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_azuredatatransferrp_enums.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_models_py3.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_patch.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/__init__.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_azure_data_transfer_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_connections_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_flows_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_connections_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_flows_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_schemas_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_patch.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_pipelines_operations.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/py.typed create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/approve_or_reject_connection.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_connection.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_flow.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_pipeline.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_connection.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_flow.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_pipeline.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/enable_or_disable_flow.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_connection.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_flow.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_pipeline.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_connection.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_flow.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_resource_group.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_subscription.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_flows_by_connection.py rename sdk/{redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_skus_list.py => azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_operations.py} (72%) create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_connections.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_flows.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_resource_group.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_subscription.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_schemas.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_list_approved_schemas.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_validate_schema.py create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/sdk_packaging.toml create mode 100644 sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/setup.py create mode 100644 sdk/azuredatatransfer/ci.yml create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/CHANGELOG.md create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/LICENSE create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/MANIFEST.in create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/README.md create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/_meta.json create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_configuration.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_large_instance_mgmt_client.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_patch.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_serialization.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_vendor.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_version.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_configuration.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_large_instance_mgmt_client.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_patch.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_instance_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_storage_instance_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_patch.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_large_instance_mgmt_client_enums.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_models_py3.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_patch.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/__init__.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_instance_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_storage_instance_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_operations.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_patch.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/py.typed create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_get.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_resource_group.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_subscription.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_operations_list.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_restart.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_shutdown.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_start.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_get.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_resource_group.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_subscription.py create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/sdk_packaging.toml create mode 100644 sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/setup.py create mode 100644 sdk/azurelargeinstance/ci.yml create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py rename sdk/{redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_skus_operations.py => cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py} (79%) create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py rename sdk/{redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_skus_operations.py => cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py} (77%) create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/CHANGELOG.md create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/LICENSE create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/MANIFEST.in create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/README.md create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/_meta.json create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_configuration.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_microsoft_community.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_patch.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_serialization.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_vendor.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_version.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_configuration.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_microsoft_community.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_patch.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_community_trainings_operations.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_operations.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_patch.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_microsoft_community_enums.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_models_py3.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_patch.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/__init__.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_community_trainings_operations.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_operations.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_patch.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/py.typed create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_create.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_delete.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_get.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_resource_group.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_subscription.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_update.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/operations_list.py create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/sdk_packaging.toml create mode 100644 sdk/communitytraining/azure-mgmt-communitytraining/setup.py create mode 100644 sdk/communitytraining/ci.yml create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_configuration.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_container_service_client.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_metadata.json create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_vendor.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_version.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_configuration.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_container_service_client.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_agent_pools_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_machines_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_maintenance_configurations_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_cluster_snapshots_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_clusters_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operation_status_result_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_resolve_private_link_service_id_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_snapshots_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_role_bindings_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_roles_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_container_service_client_enums.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_models_py3.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_agent_pools_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_machines_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_maintenance_configurations_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_cluster_snapshots_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_clusters_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operation_status_result_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_link_resources_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_resolve_private_link_service_id_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_snapshots_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_role_bindings_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_roles_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/py.typed create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_vendor.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py create mode 100644 sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/CHANGELOG.md create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/LICENSE create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/MANIFEST.in create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/README.md create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/_meta.json create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_azure_container_storage_rp.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_configuration.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_patch.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_serialization.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_vendor.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_version.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_azure_container_storage_rp.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_configuration.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_patch.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_patch.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_pools_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_snapshots_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_volumes_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_azure_container_storage_rp_enums.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_models_py3.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_patch.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/__init__.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_patch.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_pools_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_snapshots_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_volumes_operations.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/py.typed create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/operations_list.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_azure_disk.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_elastic_san.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_ephemeral.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_delete.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_azure_disk.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_elastic_san.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_ephemeral.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_azure_disk.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_elastic_san.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_ephemeral.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_azure_disk.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_elastic_san.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_ephemeral.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_azure_disk.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_elastic_san.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_ephemeral.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_create_or_update.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_delete.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_get.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_list_by_pool.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_create_or_update.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_delete.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_get.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_list_by_pool.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_update.py create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/sdk_packaging.toml create mode 100644 sdk/containerstorage/azure-mgmt-containerstorage/setup.py create mode 100644 sdk/containerstorage/ci.yml create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_metadata.json create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_version.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_data_box_management_client_enums.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_models_py3.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/py.typed create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_metadata.json create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_version.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_configuration.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_data_box_management_client.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_vendor.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_data_box_management_client_enums.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_models_py3.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/__init__.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_data_box_management_client_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_jobs_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_patch.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_service_operations.py create mode 100644 sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/py.typed create mode 100644 sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete_retain_uc_data.py create mode 100644 sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_create_or_update.py create mode 100644 sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operation_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operation_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operation_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operation_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_list.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_list.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/LICENSE create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_managed_dev_ops_infrastructure.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_vendor.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_managed_dev_ops_infrastructure.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_pools_operations.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_managed_dev_ops_infrastructure_enums.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models_py3.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_pools_operations.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/py.typed create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml create mode 100644 sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py create mode 100644 sdk/devopsinfrastructure/ci.yml create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/CHANGELOG.md create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/LICENSE create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/MANIFEST.in create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/README.md create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/_meta.json create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_configuration.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_edge_market_place_mgmt_client.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_patch.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_serialization.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_vendor.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_version.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_configuration.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_edge_market_place_mgmt_client.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_patch.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_offers_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_patch.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_publishers_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_edge_market_place_mgmt_client_enums.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_models_py3.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_patch.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/__init__.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_offers_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_patch.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_publishers_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/py.typed create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/generate_access_token.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_access_token.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_offer.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_publisher.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers_by_subscription.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_operations.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers_by_subscription.py create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/sdk_packaging.toml create mode 100644 sdk/edgemarketplace/azure-mgmt-edgemarketplace/setup.py create mode 100644 sdk/edgemarketplace/ci.yml create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_available_upgrades_operations.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pool_available_upgrades_operations.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_available_upgrades_operations.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pool_available_upgrades_operations.py rename sdk/{scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py => hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_private_aks.py} (54%) create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_udr_aks.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_ranger_cluster.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster_with_internal_ingress.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_available_upgrades.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pool_available_upgrades.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_ranger_cluster.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster_pool.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_hotfix_for_cluster.py create mode 100644 sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_node_os_for_cluster_pool.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_csp_token.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_cspaad.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hp_token.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hpaad.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_example.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_kind_example.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_private_link_example.py rename sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/{get_clusters_example.py => get_clusters_by_resource_group_example.py} (92%) create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_subscription_example.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_provisioned_cluster_example.py create mode 100644 sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/update_cluster_example.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capacity_reservation_groups_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/_labeling_jobs_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/_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/_capacity_reservation_groups_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/_labeling_jobs_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/_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/capacity_reservation_group/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list_by_subscription.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/update.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/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/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/job/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/export_labels.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/pause.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/resume.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/registry/model_version/package.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/trigger.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/get_status.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/list_skus.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 rename sdk/{scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py => machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py} (63%) 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/package.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/get_status.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/list_secrets.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/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/__init__.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_configuration.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_metadata.json create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_network_management_client.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_patch.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_vendor.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_version.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/__init__.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_configuration.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_network_management_client.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_patch.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_vendor.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/__init__.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_operations.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_patch.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/__init__.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_models_py3.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_network_management_client_enums.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_patch.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/__init__.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_operations.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_patch.py create mode 100644 sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/py.typed create mode 100644 sdk/network/azure-mgmt-network/generated_samples/bastion_host_get_with_zones.py create mode 100644 sdk/network/azure-mgmt-network/generated_samples/bastion_host_put_with_zones.py create mode 100644 sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py create mode 100644 sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py create mode 100644 sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_account_quotas_operations.py create mode 100644 sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_account_quotas_operations.py create mode 100644 sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_get.py create mode 100644 sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_list_by_account.py create mode 100644 sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_check_name_availability.py create mode 100644 sdk/quantum/azure-mgmt-quantum/generated_samples/list_keys.py create mode 100644 sdk/quantum/azure-mgmt-quantum/generated_samples/regenerate_key.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py rename sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/{_virtual_machines_operations.py => _virtual_machine_instances_operations.py} (68%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_guest_agents_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py rename sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/{_virtual_machines_operations.py => _virtual_machine_instances_operations.py} (63%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_guest_agents_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine_instance.py delete mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_instance.py rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{restart_virtual_machine.py => create_vm_instance_guest_agent.py} (77%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine_instance.py rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{delete_checkpoint_virtual_machine.py => delete_virtual_machine_instance.py} (77%) rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{get_virtual_machine.py => delete_vm_instance_guest_agent.py} (77%) rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{create_checkpoint_virtual_machine.py => get_virtual_machine_instance.py} (77%) rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{delete_virtual_machine.py => get_vm_instance_guest_agent.py} (77%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_hybrid_identity_metadata.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{list_virtual_machines_by_resource_group.py => list_virtual_machine_instances.py} (77%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine_instance.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine_instance.py rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{stop_virtual_machine.py => start_virtual_machine_instance.py} (77%) rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{start_virtual_machine.py => stop_virtual_machine_instance.py} (77%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_instance.py rename sdk/scvmm/azure-mgmt-scvmm/generated_samples/{list_virtual_machines_by_subscription.py => vm_instance_guest_agent_list_by_vm.py} (77%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_billing_statistics_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_package_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_packages_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_template_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_templates_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connector_definitions_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_triggered_analytics_rule_runs_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_comments_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_relations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunts_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_package_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_packages_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_template_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_templates_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_triggered_analytics_rule_run_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignment_jobs_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignments_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_configurations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_groups_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_members_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_billing_statistics_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_package_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_packages_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_template_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_templates_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connector_definitions_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_triggered_analytics_rule_runs_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_comments_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_relations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunts_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_package_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_packages_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_template_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_templates_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_triggered_analytics_rule_run_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignment_jobs_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignments_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_configurations_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_groups_operations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_members_operations.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => actions}/create_action_of_alert_rule.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => actions}/delete_action_of_alert_rule.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => actions}/get_action_of_alert_rule_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => actions}/get_all_actions_by_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rule_templates}/get_alert_rule_template_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rule_templates}/get_alert_rule_templates.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/create_fusion_alert_rule.py (99%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/create_fusion_alert_rule_with_fusion_scenario_exclusion.py (99%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/create_microsoft_security_incident_creation_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/create_nrt_alert_rule.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/create_scheduled_alert_rule.py (98%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/delete_alert_rule.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/get_all_alert_rules.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/get_fusion_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/get_microsoft_security_incident_creation_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/get_nrt_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => alert_rules}/get_scheduled_alert_rule.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => automation_rules}/automation_rules_create_or_update.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => automation_rules}/automation_rules_delete.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => automation_rules}/automation_rules_get.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => automation_rules}/automation_rules_list.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_all_billing_statistics.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{delete_source_control.py => billing_statistics/get_billing_statistic.py} (84%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks}/create_bookmark.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks}/delete_bookmark.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks/expand}/post_expand_bookmark.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks}/get_bookmark_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks}/get_bookmarks.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks/relations}/create_bookmark_relation.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks/relations}/delete_bookmark_relation.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks/relations}/get_all_bookmark_relations.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => bookmarks/relations}/get_bookmark_relation_by_name.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_package_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_packages.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_package_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_packages.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/install_package.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/uninstall_package.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/delete_template.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_template_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_templates.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_template_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_templates.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/install_template.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/create_customizable_data_connector_definition.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/delete_data_connector_definition_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_customizable_data_connectoe_definition_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_data_connector_definitions.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_authorization.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_license.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_security_center.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_dynamics365.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_io_t.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_mdatp.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_cloud_app_security.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_purview_information_protection.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_intelligence.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_protection.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office365_project.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_atp.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_irm.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_power_bi.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence_taxii.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/connect_api_polling.py (93%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/connect_api_polling_v2_logs.py (94%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_api_polling.py (99%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_dynamics365_data_connetor.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_generic_ui.py (99%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_google_cloud_platform.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_purview_information_protection_data_connetor.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_intelligence_data_connector.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_protection_data_connetor.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_office365_project_data_connetor.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_office_data_connetor.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_office_power_bi_data_connector.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_threat_intelligence_data_connector.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/create_threat_intelligence_taxii_data_connector.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/delete_api_polling.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/delete_generic_ui.py (92%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_google_cloud_platform.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_purview_information_protection_data_connetor.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_threat_intelligence_data_connector.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/delete_office365_project_data_connetor.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/delete_office_data_connetor.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/delete_office_power_bi_data_connetor.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/disconnect_api_polling.py (91%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_amazon_web_services_cloud_trail_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_amazon_web_services_s3_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_api_polling.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_azure_active_directory_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_azure_advanced_threat_protection_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_azure_security_center_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_data_connectors.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_dynamics365_data_connector_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_generic_ui.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_google_cloud_platform_by_id.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_io_tby_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_microsoft_cloud_app_security_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_microsoft_defender_advanced_threat_protection_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_microsoft_insider_risk_management_by_id.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_purview_information_protection_data_connetor_by_id.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_microsoft_threat_intelligence_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_microsoft_threat_protection_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_office365_advanced_threat_protection_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_office365_project_data_connetor_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_office_data_connetor_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_office_power_bi_data_connetor_by_id.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_by_id.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => data_connectors}/get_threat_intelligence_taxii_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => enrichment}/get_geodata_by_ip.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => enrichment}/get_whois_by_domain_name.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities/expand}/post_expand_entity.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_account_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_azure_resource_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_cloud_application_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_dns_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_entities.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_file_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_file_hash_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_host_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_io_tdevice_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_ip_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_mail_cluster_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_mail_message_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_mailbox_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_malware_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_process_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_queries.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_registry_key_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_registry_value_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_security_alert_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_security_group_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_submission_mail_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities}/get_url_entity_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities/insights}/post_get_insights.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities/relations}/get_all_entity_relations.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities/relations}/get_entity_relation_by_name.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entities/timeline}/post_timeline_entity.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_queries}/create_entity_query_activity.py (98%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_queries}/delete_entity_query.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_queries}/get_activity_entity_query_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_queries}/get_entity_queries.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_queries}/get_expansion_entity_query_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_query_templates}/get_activity_entity_query_template_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => entity_query_templates}/get_entity_query_templates.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => file_imports}/create_file_import.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => file_imports}/delete_file_import.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => file_imports}/get_file_import_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => file_imports}/get_file_imports.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_comment.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_relation.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_comment.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_relation.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comment_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comments.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relation_by_id.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunts.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_alerts}/incidents_list_alerts.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_bookmarks}/incidents_list_bookmarks.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_comments}/incident_comments_create_or_update.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_comments}/incident_comments_delete.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_comments}/incident_comments_get.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_comments}/incident_comments_list.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_entities}/incidents_list_entities.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_tasks}/incident_tasks_create_or_update.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_tasks}/incident_tasks_delete.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_tasks}/incident_tasks_get.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_tasks}/incident_tasks_list.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/incident_team}/incidents_create_team.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents}/incidents_create_or_update.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents}/incidents_delete.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents}/incidents_get.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents}/incidents_list.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/relations}/create_incident_relation.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/relations}/delete_incident_relation.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/relations}/get_all_incident_relations.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => incidents/relations}/get_incident_relation_by_name.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/entities_run_playbook.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => manual_trigger}/incidents_run_playbook.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/delete_metadata.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/get_all_metadata.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/get_all_metadata_odata.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/get_metadata.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/patch_metadata.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/put_metadata.py (98%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => metadata}/put_metadata_minimal.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => office_consents}/delete_office_consents.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => office_consents}/get_office_consents.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => office_consents}/get_office_consents_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => onboarding_states}/create_sentinel_onboarding_state.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => onboarding_states}/delete_sentinel_onboarding_state.py (91%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => onboarding_states}/get_all_sentinel_onboarding_states.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => onboarding_states}/get_sentinel_onboarding_state.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => operations}/list_operations.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => recommendations}/get_recommendation.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => recommendations}/get_recommendations.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => recommendations}/patch_recommendation.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => repositories}/get_repositories.py (77%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/create_anomaly_security_ml_analytics_setting.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => security_ml_analytics_settings}/delete_security_ml_analytics_setting.py (91%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => security_ml_analytics_settings}/get_all_security_ml_analytics_settings.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => security_ml_analytics_settings}/get_anomaly_security_ml_analytics_setting.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => settings}/delete_eyes_on_setting.py (91%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => settings}/get_all_settings.py (95%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => settings}/get_eyes_on_setting.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => settings}/update_eyes_on_setting.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => sourcecontrols}/create_source_control.py (87%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/delete_source_control.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => sourcecontrols}/get_source_control_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => sourcecontrols}/get_source_controls.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/append_tags_threat_intelligence.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => threatintelligence}/collect_threat_intelligence_metrics.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/create_threat_intelligence.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => threatintelligence}/delete_threat_intelligence.py (91%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => threatintelligence}/get_threat_intelligence.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => threatintelligence}/get_threat_intelligence_by_id.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/query_threat_intelligence.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/replace_tags_threat_intelligence.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/update_threat_intelligence.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/trigger_rule_run_post.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_run_get.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_runs_get.py rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/create_watchlist.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/create_watchlist_and_watchlist_items.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/create_watchlist_item.py (97%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/delete_watchlist.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/delete_watchlist_item.py (92%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/get_watchlist_by_alias.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/get_watchlist_item_by_id.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/get_watchlist_items.py (96%) rename sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/{ => watchlists}/get_watchlists.py (96%) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_job.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_or_update_workspace_manager_assignment.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_job.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_workspace_manager_assignment.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_jobs.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_workspace_manager_assignments.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_job.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_workspace_manager_assignment.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/create_or_update_workspace_manager_configuration.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/delete_workspace_manager_configuration.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_all_workspace_manager_configurations.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_workspace_manager_configuration.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/create_or_update_workspace_manager_group.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/delete_workspace_manager_group.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_all_workspace_manager_groups.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_workspace_manager_group.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/create_or_update_workspace_manager_member.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/delete_workspace_manager_member.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_all_workspace_manager_members.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_workspace_manager_member.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/CHANGELOG.md create mode 100644 sdk/storageactions/azure-mgmt-storageactions/LICENSE create mode 100644 sdk/storageactions/azure-mgmt-storageactions/MANIFEST.in create mode 100644 sdk/storageactions/azure-mgmt-storageactions/README.md create mode 100644 sdk/storageactions/azure-mgmt-storageactions/_meta.json create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_patch.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_vendor.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_version.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_patch.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_patch.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_patch.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/__init__.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_patch.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/py.typed create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py create mode 100644 sdk/storageactions/azure-mgmt-storageactions/sdk_packaging.toml create mode 100644 sdk/storageactions/azure-mgmt-storageactions/setup.py create mode 100644 sdk/storageactions/ci.yml create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/CHANGELOG.md create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/LICENSE create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/MANIFEST.in create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/README.md create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/_meta.json create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_configuration.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_patch.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_serialization.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_vendor.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_version.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_workloads_client.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_configuration.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_patch.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_vendor.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_workloads_client.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_patch.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_central_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_database_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_workloads_client_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_models_py3.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_patch.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_workloads_client_enums.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/__init__.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_patch.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_application_server_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_central_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_database_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_virtual_instances_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_workloads_client_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/py.typed create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/operations_list.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/sdk_packaging.toml create mode 100644 sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/setup.py diff --git a/sdk/apicenter/azure-mgmt-apicenter/_meta.json b/sdk/apicenter/azure-mgmt-apicenter/_meta.json index 19fbd47d2eb4..24e84eb2ae0f 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/_meta.json +++ b/sdk/apicenter/azure-mgmt-apicenter/_meta.json @@ -1,11 +1,11 @@ { - "commit": "1d2b8c05b55be5dd98ce94c835d7e96ee1ea7f5d", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/apicenter/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/apicenter/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/apicenter/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_api_center_mgmt_client.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_api_center_mgmt_client.py index 5a987dcf0d00..354c2d460efb 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_api_center_mgmt_client.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_api_center_mgmt_client.py @@ -15,29 +15,55 @@ from . import models as _models from ._configuration import ApiCenterMgmtClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import Operations, ServicesOperations +from .operations import ( + ApiDefinitionsOperations, + ApiVersionsOperations, + ApisOperations, + DeploymentsOperations, + EnvironmentsOperations, + MetadataSchemasOperations, + Operations, + ServicesOperations, + WorkspacesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ApiCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword +class ApiCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure API Center Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.apicenter.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.apicenter.operations.ServicesOperations + :ivar metadata_schemas: MetadataSchemasOperations operations + :vartype metadata_schemas: azure.mgmt.apicenter.operations.MetadataSchemasOperations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.apicenter.operations.WorkspacesOperations + :ivar apis: ApisOperations operations + :vartype apis: azure.mgmt.apicenter.operations.ApisOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.apicenter.operations.DeploymentsOperations + :ivar api_versions: ApiVersionsOperations operations + :vartype api_versions: azure.mgmt.apicenter.operations.ApiVersionsOperations + :ivar api_definitions: ApiDefinitionsOperations operations + :vartype api_definitions: azure.mgmt.apicenter.operations.ApiDefinitionsOperations + :ivar environments: EnvironmentsOperations operations + :vartype environments: azure.mgmt.apicenter.operations.EnvironmentsOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-07-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". 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. """ def __init__( @@ -58,6 +84,15 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.metadata_schemas = MetadataSchemasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.apis = ApisOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_versions = ApiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_definitions = ApiDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.environments = EnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_configuration.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_configuration.py index ea786433c1bf..5dfce4565800 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_configuration.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/_configuration.py @@ -27,16 +27,16 @@ class ApiCenterMgmtClientConfiguration(Configuration): # pylint: disable=too-ma :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". 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(ApiCenterMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_api_center_mgmt_client.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_api_center_mgmt_client.py index 972c5ca379e7..38bf6a886caf 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_api_center_mgmt_client.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_api_center_mgmt_client.py @@ -15,29 +15,55 @@ from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ApiCenterMgmtClientConfiguration -from .operations import Operations, ServicesOperations +from .operations import ( + ApiDefinitionsOperations, + ApiVersionsOperations, + ApisOperations, + DeploymentsOperations, + EnvironmentsOperations, + MetadataSchemasOperations, + Operations, + ServicesOperations, + WorkspacesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ApiCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword +class ApiCenterMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Azure API Center Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.apicenter.aio.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.apicenter.aio.operations.ServicesOperations + :ivar metadata_schemas: MetadataSchemasOperations operations + :vartype metadata_schemas: azure.mgmt.apicenter.aio.operations.MetadataSchemasOperations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.apicenter.aio.operations.WorkspacesOperations + :ivar apis: ApisOperations operations + :vartype apis: azure.mgmt.apicenter.aio.operations.ApisOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.apicenter.aio.operations.DeploymentsOperations + :ivar api_versions: ApiVersionsOperations operations + :vartype api_versions: azure.mgmt.apicenter.aio.operations.ApiVersionsOperations + :ivar api_definitions: ApiDefinitionsOperations operations + :vartype api_definitions: azure.mgmt.apicenter.aio.operations.ApiDefinitionsOperations + :ivar environments: EnvironmentsOperations operations + :vartype environments: azure.mgmt.apicenter.aio.operations.EnvironmentsOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-07-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". 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. """ def __init__( @@ -58,6 +84,15 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.metadata_schemas = MetadataSchemasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.apis = ApisOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_versions = ApiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_definitions = ApiDefinitionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.environments = EnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_configuration.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_configuration.py index 2364a0881236..c82219976e82 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_configuration.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/_configuration.py @@ -27,16 +27,16 @@ class ApiCenterMgmtClientConfiguration(Configuration): # pylint: disable=too-ma :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". 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(ApiCenterMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/__init__.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/__init__.py index bf7a87b59370..3ed67317ce8e 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/__init__.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/__init__.py @@ -8,6 +8,13 @@ from ._operations import Operations from ._services_operations import ServicesOperations +from ._metadata_schemas_operations import MetadataSchemasOperations +from ._workspaces_operations import WorkspacesOperations +from ._apis_operations import ApisOperations +from ._deployments_operations import DeploymentsOperations +from ._api_versions_operations import ApiVersionsOperations +from ._api_definitions_operations import ApiDefinitionsOperations +from ._environments_operations import EnvironmentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -16,6 +23,13 @@ __all__ = [ "Operations", "ServicesOperations", + "MetadataSchemasOperations", + "WorkspacesOperations", + "ApisOperations", + "DeploymentsOperations", + "ApiVersionsOperations", + "ApiDefinitionsOperations", + "EnvironmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_definitions_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_definitions_operations.py new file mode 100644 index 000000000000..e2a46d7bd4e4 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_definitions_operations.py @@ -0,0 +1,1044 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_definitions_operations import ( + build_create_or_update_request, + build_delete_request, + build_export_specification_request, + build_get_request, + build_head_request, + build_import_specification_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`api_definitions` 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, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ApiDefinition"]: + """Returns a collection of API definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiDefinition or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.ApiDefinition] + :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.ApiDefinitionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApiDefinitionListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> _models.ApiDefinition: + """Returns details of the API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :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.ApiDefinition] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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 = 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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: _models.ApiDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.ApiDefinition + :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: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: Union[_models.ApiDefinition, IO], + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Is either a ApiDefinition type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.ApiDefinition or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ApiDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ApiDefinition") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> None: + """Deletes specified API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @distributed_trace_async + async def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API definition exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + async def _export_specification_initial( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> Optional[_models.ApiSpecExportResult]: + 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[Optional[_models.ApiSpecExportResult]] = kwargs.pop("cls", None) + + request = build_export_specification_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._export_specification_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ApiSpecExportResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_specification_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification" + } + + @distributed_trace_async + async def begin_export_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiSpecExportResult]: + """Exports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_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 ApiSpecExportResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apicenter.models.ApiSpecExportResult] + :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.ApiSpecExportResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_specification_initial( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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): + deserialized = self._deserialize("ApiSpecExportResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_specification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification" + } + + async def _import_specification_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: Union[_models.ApiSpecImportRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ApiSpecImportRequest") + + request = build_import_specification_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._import_specification_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _import_specification_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification" + } + + @overload + async def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: _models.ApiSpecImportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.apicenter.models.ApiSpecImportRequest + :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: + """ + + @overload + async def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: Union[_models.ApiSpecImportRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Is either a ApiSpecImportRequest type or a IO + type. Required. + :type body: ~azure.mgmt.apicenter.models.ApiSpecImportRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._import_specification_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_import_specification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_versions_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_versions_operations.py new file mode 100644 index 000000000000..d1a6c2cffcd5 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_api_versions_operations.py @@ -0,0 +1,586 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`api_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, + service_name: str, + workspace_name: str, + api_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ApiVersion"]: + """Returns a collection of API versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiVersion or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.ApiVersion] + :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.ApiVersionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApiVersionListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> _models.ApiVersion: + """Returns details of the API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :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.ApiVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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 = 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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: _models.ApiVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.ApiVersion + :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: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: Union[_models.ApiVersion, IO], + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Is either a ApiVersion type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.ApiVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ApiVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ApiVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> None: + """Deletes specified API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @distributed_trace_async + async def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API version exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_apis_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_apis_operations.py new file mode 100644 index 000000000000..20aca8cf51c4 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_apis_operations.py @@ -0,0 +1,544 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apis_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`apis` 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, + service_name: str, + workspace_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Api"]: + """Returns a collection of APIs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Api or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.Api] + :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.ApiListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApiListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> _models.Api: + """Returns details of the API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :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.Api] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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 = 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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: _models.Api, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Api + :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: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: Union[_models.Api, IO], + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Is either a Api type or a IO type. Required. + :type resource: ~azure.mgmt.apicenter.models.Api or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Api] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Api") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> None: + """Deletes specified API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @distributed_trace_async + async def head( + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> bool: + """Checks if specified API exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_deployments_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..8a50b425b349 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_deployments_operations.py @@ -0,0 +1,586 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deployments_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`deployments` 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, + service_name: str, + workspace_name: str, + api_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Deployment"]: + """Returns a collection of API deployments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Deployment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.Deployment] + :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.DeploymentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> _models.Deployment: + """Returns details of the API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :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.Deployment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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) + + _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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Deployment + :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: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: Union[_models.Deployment, IO], + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is either a Deployment type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.Deployment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Deployment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Deployment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + """Deletes API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @distributed_trace_async + async def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API deployment exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_environments_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_environments_operations.py new file mode 100644 index 000000000000..b9ef45347fc3 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_environments_operations.py @@ -0,0 +1,545 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._environments_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`environments` 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, + service_name: str, + workspace_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Environment"]: + """Returns a collection of environments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Environment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.Environment] + :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.EnvironmentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> _models.Environment: + """Returns details of the environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :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.Environment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_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) + + _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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: _models.Environment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Environment + :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: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: Union[_models.Environment, IO], + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Is either a Environment type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.Environment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Environment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Environment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> None: + """Deletes the environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_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, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @distributed_trace_async + async def head( + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> bool: + """Checks if specified environment exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_metadata_schemas_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_metadata_schemas_operations.py new file mode 100644 index 000000000000..cc24fd4e1a73 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_metadata_schemas_operations.py @@ -0,0 +1,516 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._metadata_schemas_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MetadataSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`metadata_schemas` 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, service_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.MetadataSchema"]: + """Returns a collection of metadata schemas. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetadataSchema or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apicenter.models.MetadataSchema] + :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.MetadataSchemaListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MetadataSchemaListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any + ) -> _models.MetadataSchema: + """Returns details of the metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :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.MetadataSchema] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_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 = 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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: _models.MetadataSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.MetadataSchema + :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: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: Union[_models.MetadataSchema, IO], + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Is either a MetadataSchema type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.MetadataSchema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.MetadataSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "MetadataSchema") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any + ) -> None: + """Deletes specified metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_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, + service_name=service_name, + metadata_schema_name=metadata_schema_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @distributed_trace_async + async def head(self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any) -> bool: + """Checks if specified metadata schema exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_services_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_services_operations.py index d6696e49ddc3..e23efa05ce4f 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_services_operations.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_services_operations.py @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,17 +21,20 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._services_operations import ( build_create_or_update_request, build_delete_request, + build_export_metadata_schema_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, @@ -74,7 +77,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Service" _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.ServiceCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +119,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceCollection", pipeline_response) + deserialized = self._deserialize("ServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -144,7 +147,7 @@ async def get_next(next_link=None): @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Service"]: - """Lists services within a resource group. + """Returns a collection of services within the resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -158,7 +161,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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.ServiceCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -201,7 +204,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceCollection", pipeline_response) + deserialized = self._deserialize("ServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -231,12 +234,12 @@ async def get_next(next_link=None): @distributed_trace_async async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.Service: - """Get service. + """Returns details of the service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) @@ -297,19 +300,19 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - resource: Optional[_models.Service] = None, + resource: _models.Service, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Default value is None. + :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.apicenter.models.Service :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -325,19 +328,19 @@ async def create_or_update( self, resource_group_name: str, service_name: str, - resource: Optional[IO] = None, + resource: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Default value is None. + :param resource: Resource create parameters. Required. :type resource: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -350,21 +353,16 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Optional[Union[_models.Service, IO]] = None, - **kwargs: Any + self, resource_group_name: str, service_name: str, resource: Union[_models.Service, IO], **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Is either a Service type or a IO type. Default value is - None. + :param resource: Resource create parameters. Is either a Service type or a IO type. Required. :type resource: ~azure.mgmt.apicenter.models.Service or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -395,10 +393,7 @@ async def create_or_update( if isinstance(resource, (IOBase, bytes)): _content = resource else: - if resource is not None: - _json = self._serialize.body(resource, "Service") - else: - _json = None + _json = self._serialize.body(resource, "Service") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -447,20 +442,20 @@ async def update( self, resource_group_name: str, service_name: str, - parameters: Optional[_models.ServiceUpdate] = None, + properties: _models.ServiceUpdate, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Default value is None. - :type parameters: ~azure.mgmt.apicenter.models.ServiceUpdate + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.apicenter.models.ServiceUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -475,20 +470,20 @@ async def update( self, resource_group_name: str, service_name: str, - parameters: Optional[IO] = None, + properties: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Default value is None. - :type parameters: IO + :param properties: The resource properties to be updated. Required. + :type properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -500,22 +495,18 @@ async def update( @distributed_trace_async async def update( - self, - resource_group_name: str, - service_name: str, - parameters: Optional[Union[_models.ServiceUpdate, IO]] = None, - **kwargs: Any + self, resource_group_name: str, service_name: str, properties: Union[_models.ServiceUpdate, IO], **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Is either a ServiceUpdate type or a IO - type. Default value is None. - :type parameters: ~azure.mgmt.apicenter.models.ServiceUpdate or IO + :param properties: The resource properties to be updated. Is either a ServiceUpdate type or a + IO type. Required. + :type properties: ~azure.mgmt.apicenter.models.ServiceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -542,13 +533,10 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - if parameters is not None: - _json = self._serialize.body(parameters, "ServiceUpdate") - else: - _json = None + _json = self._serialize.body(properties, "ServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -592,12 +580,12 @@ async def update( async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, **kwargs: Any ) -> None: - """Delete service. + """Deletes specified service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_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) @@ -648,3 +636,237 @@ async def delete( # pylint: disable=inconsistent-return-statements delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}" } + + async def _export_metadata_schema_initial( + self, + resource_group_name: str, + service_name: str, + body: Union[_models.MetadataSchemaExportRequest, IO], + **kwargs: Any + ) -> Optional[_models.MetadataSchemaExportResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.MetadataSchemaExportResult]] = 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, "MetadataSchemaExportRequest") + + request = build_export_metadata_schema_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_metadata_schema_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MetadataSchemaExportResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_metadata_schema_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema" + } + + @overload + async def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: _models.MetadataSchemaExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.apicenter.models.MetadataSchemaExportRequest + :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 MetadataSchemaExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MetadataSchemaExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: Union[_models.MetadataSchemaExportRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Is either a MetadataSchemaExportRequest type or + a IO type. Required. + :type body: ~azure.mgmt.apicenter.models.MetadataSchemaExportRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MetadataSchemaExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :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.MetadataSchemaExportResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_metadata_schema_initial( + resource_group_name=resource_group_name, + service_name=service_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MetadataSchemaExportResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_metadata_schema.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_workspaces_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_workspaces_operations.py new file mode 100644 index 000000000000..ee3bfe4b8b18 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/aio/operations/_workspaces_operations.py @@ -0,0 +1,515 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspaces_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_head_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.aio.ApiCenterMgmtClient`'s + :attr:`workspaces` 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, service_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Workspace"]: + """Returns a collection of workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: 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.apicenter.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_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any + ) -> _models.Workspace: + """Returns details of the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the 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.apicenter.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, + service_name=service_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 = 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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: _models.Workspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.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 + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Workspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Workspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: Union[_models.Workspace, IO], + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Is either a Workspace type or a IO type. Required. + :type resource: ~azure.mgmt.apicenter.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 + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.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 = case_insensitive_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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Workspace") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any + ) -> None: + """Deletes specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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, + service_name=service_name, + workspace_name=workspace_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @distributed_trace_async + async def head(self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any) -> bool: + """Checks if specified workspace exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/__init__.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/__init__.py index b66dfd23d290..d6a0e69eeaed 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/__init__.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/__init__.py @@ -6,50 +6,144 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import Api +from ._models_py3 import ApiDefinition +from ._models_py3 import ApiDefinitionListResult +from ._models_py3 import ApiDefinitionProperties +from ._models_py3 import ApiDefinitionPropertiesSpecification +from ._models_py3 import ApiListResult +from ._models_py3 import ApiProperties +from ._models_py3 import ApiSpecExportResult +from ._models_py3 import ApiSpecImportRequest +from ._models_py3 import ApiSpecImportRequestSpecification +from ._models_py3 import ApiVersion +from ._models_py3 import ApiVersionListResult +from ._models_py3 import ApiVersionProperties +from ._models_py3 import Contact +from ._models_py3 import Deployment +from ._models_py3 import DeploymentListResult +from ._models_py3 import DeploymentProperties +from ._models_py3 import DeploymentServer +from ._models_py3 import Environment +from ._models_py3 import EnvironmentListResult +from ._models_py3 import EnvironmentProperties +from ._models_py3 import EnvironmentServer from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse +from ._models_py3 import ExternalDocumentation +from ._models_py3 import License from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MetadataAssignment +from ._models_py3 import MetadataSchema +from ._models_py3 import MetadataSchemaExportRequest +from ._models_py3 import MetadataSchemaExportResult +from ._models_py3 import MetadataSchemaListResult +from ._models_py3 import MetadataSchemaProperties +from ._models_py3 import Onboarding from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import Service -from ._models_py3 import ServiceCollection +from ._models_py3 import ServiceListResult +from ._models_py3 import ServiceProperties from ._models_py3 import ServiceUpdate from ._models_py3 import SystemData +from ._models_py3 import TermsOfService from ._models_py3 import TrackedResource from ._models_py3 import UserAssignedIdentity +from ._models_py3 import Workspace +from ._models_py3 import WorkspaceListResult +from ._models_py3 import WorkspaceProperties from ._api_center_mgmt_client_enums import ActionType +from ._api_center_mgmt_client_enums import ApiKind +from ._api_center_mgmt_client_enums import ApiSpecExportResultFormat +from ._api_center_mgmt_client_enums import ApiSpecImportSourceFormat from ._api_center_mgmt_client_enums import CreatedByType +from ._api_center_mgmt_client_enums import DeploymentState +from ._api_center_mgmt_client_enums import EnvironmentKind +from ._api_center_mgmt_client_enums import EnvironmentServerType +from ._api_center_mgmt_client_enums import LifecycleStage from ._api_center_mgmt_client_enums import ManagedServiceIdentityType +from ._api_center_mgmt_client_enums import MetadataAssignmentEntity +from ._api_center_mgmt_client_enums import MetadataSchemaExportFormat from ._api_center_mgmt_client_enums import Origin from ._api_center_mgmt_client_enums import ProvisioningState +from ._api_center_mgmt_client_enums import Versions from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Api", + "ApiDefinition", + "ApiDefinitionListResult", + "ApiDefinitionProperties", + "ApiDefinitionPropertiesSpecification", + "ApiListResult", + "ApiProperties", + "ApiSpecExportResult", + "ApiSpecImportRequest", + "ApiSpecImportRequestSpecification", + "ApiVersion", + "ApiVersionListResult", + "ApiVersionProperties", + "Contact", + "Deployment", + "DeploymentListResult", + "DeploymentProperties", + "DeploymentServer", + "Environment", + "EnvironmentListResult", + "EnvironmentProperties", + "EnvironmentServer", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "ExternalDocumentation", + "License", "ManagedServiceIdentity", + "MetadataAssignment", + "MetadataSchema", + "MetadataSchemaExportRequest", + "MetadataSchemaExportResult", + "MetadataSchemaListResult", + "MetadataSchemaProperties", + "Onboarding", "Operation", "OperationDisplay", "OperationListResult", + "ProxyResource", "Resource", "Service", - "ServiceCollection", + "ServiceListResult", + "ServiceProperties", "ServiceUpdate", "SystemData", + "TermsOfService", "TrackedResource", "UserAssignedIdentity", + "Workspace", + "WorkspaceListResult", + "WorkspaceProperties", "ActionType", + "ApiKind", + "ApiSpecExportResultFormat", + "ApiSpecImportSourceFormat", "CreatedByType", + "DeploymentState", + "EnvironmentKind", + "EnvironmentServerType", + "LifecycleStage", "ManagedServiceIdentityType", + "MetadataAssignmentEntity", + "MetadataSchemaExportFormat", "Origin", "ProvisioningState", + "Versions", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_api_center_mgmt_client_enums.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_api_center_mgmt_client_enums.py index ea95477efa39..44b950725510 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_api_center_mgmt_client_enums.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_api_center_mgmt_client_enums.py @@ -16,6 +16,42 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class ApiKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of the API.""" + + REST = "rest" + """A Representational State Transfer Api""" + GRAPHQL = "graphql" + """A Graph query language Api""" + GRPC = "grpc" + """A gRPC Api""" + SOAP = "soap" + """A SOAP Api""" + WEBHOOK = "webhook" + """Web Hook""" + WEBSOCKET = "websocket" + """Web Socket""" + + +class ApiSpecExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Result format for exported Api spec.""" + + INLINE = "inline" + """The inlined content of a specification document.""" + LINK = "link" + """The link to the result of the export operation. The URL is valid for 5 minutes.""" + + +class ApiSpecImportSourceFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Source format for imported Api spec.""" + + INLINE = "inline" + """The inlined content of a specification document.""" + LINK = "link" + """The link to a specification document hosted on a publicly accessible internet + #: address.""" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -25,6 +61,66 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DeploymentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Deployment.""" + + ACTIVE = "active" + """Active State""" + INACTIVE = "inactive" + """Inactive State""" + + +class EnvironmentKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of environment.""" + + DEVELOPMENT = "development" + """Development environment""" + TESTING = "testing" + """Testing environment""" + STAGING = "staging" + """Staging environment""" + PRODUCTION = "production" + """Production environment""" + + +class EnvironmentServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of environment server.""" + + AZURE_API_MANAGEMENT = "Azure API Management" + """Api Management Server""" + AZURE_COMPUTE_SERVICE = "Azure compute service" + """Compute server""" + APIGEE_API_MANAGEMENT = "Apigee API Management" + """Apigee server""" + AWS_API_GATEWAY = "AWS API Gateway" + """AWS Api Gateway server""" + KONG_API_GATEWAY = "Kong API Gateway" + """Kong API Gateway server""" + KUBERNETES = "Kubernetes" + """Kubernetes server""" + MULE_SOFT_API_MANAGEMENT = "MuleSoft API Management" + """Mulesoft Api Management server""" + + +class LifecycleStage(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The stage of the Api development lifecycle.""" + + DESIGN = "design" + """design stage""" + DEVELOPMENT = "development" + """development stage""" + TESTING = "testing" + """testing stage""" + PREVIEW = "preview" + """In preview""" + PRODUCTION = "production" + """In production""" + DEPRECATED = "deprecated" + """deprecated stage""" + RETIRED = "retired" + """Retired stage""" + + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -36,6 +132,26 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class MetadataAssignmentEntity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Assignment entity for Metadata.""" + + API = "api" + """Assigned to API""" + ENVIRONMENT = "environment" + """Assigned to Environment""" + DEPLOYMENT = "deployment" + """Assigned to Deployment""" + + +class MetadataSchemaExportFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The format for schema export.""" + + INLINE = "inline" + """The inlined content of a schema document.""" + LINK = "link" + """The link to a schema document. The URL is valid for 5 minutes.""" + + 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". @@ -47,8 +163,18 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the service.""" + """The provisioning state of the resource.""" SUCCEEDED = "Succeeded" + """Resource has been created.""" FAILED = "Failed" + """Resource creation failed.""" CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class Versions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The available API versions.""" + + V2024_03_01 = "2024-03-01" + """The initial service version""" diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_models_py3.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_models_py3.py index 1a852cf36f47..c239993d1ae6 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_models_py3.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/models/_models_py3.py @@ -8,13 +8,1008 @@ # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class Api(ProxyResource): + """API entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.ApiProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApiProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApiProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.ApiProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApiDefinition(ProxyResource): + """API definition entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.ApiDefinitionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApiDefinitionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApiDefinitionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.ApiDefinitionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApiDefinitionListResult(_serialization.Model): + """The response of a ApiDefinition list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The ApiDefinition items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.ApiDefinition] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApiDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ApiDefinitionProperties(_serialization.Model): + """API definition properties entity. + + 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 title: API definition title. Required. + :vartype title: str + :ivar description: API definition description. + :vartype description: str + :ivar specification: API specification details. + :vartype specification: ~azure.mgmt.apicenter.models.ApiDefinitionPropertiesSpecification + """ + + _validation = { + "title": {"required": True, "max_length": 50, "min_length": 1}, + "specification": {"readonly": True}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "specification": {"key": "specification", "type": "ApiDefinitionPropertiesSpecification"}, + } + + def __init__(self, *, title: str, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword title: API definition title. Required. + :paramtype title: str + :keyword description: API definition description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.specification = None + + +class ApiDefinitionPropertiesSpecification(_serialization.Model): + """API specification details. + + :ivar name: Specification name. + :vartype name: str + :ivar version: Specification version. + :vartype version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Specification name. + :paramtype name: str + :keyword version: Specification version. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.version = version + + +class ApiListResult(_serialization.Model): + """The response of a Api list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Api items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.Api] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Api]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ApiProperties(_serialization.Model): + """API 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 title: API title. Required. + :vartype title: str + :ivar kind: Kind of API. For example, REST or GraphQL. Required. Known values are: "rest", + "graphql", "grpc", "soap", "webhook", and "websocket". + :vartype kind: str or ~azure.mgmt.apicenter.models.ApiKind + :ivar description: Description of the API. + :vartype description: str + :ivar summary: Short description of the API. + :vartype summary: str + :ivar lifecycle_stage: Current lifecycle stage of the API. Known values are: "design", + "development", "testing", "preview", "production", "deprecated", and "retired". + :vartype lifecycle_stage: str or ~azure.mgmt.apicenter.models.LifecycleStage + :ivar terms_of_service: Terms of service for the API. + :vartype terms_of_service: ~azure.mgmt.apicenter.models.TermsOfService + :ivar external_documentation: The set of external documentation. + :vartype external_documentation: list[~azure.mgmt.apicenter.models.ExternalDocumentation] + :ivar contacts: The set of contacts. + :vartype contacts: list[~azure.mgmt.apicenter.models.Contact] + :ivar license: The license information for the API. + :vartype license: ~azure.mgmt.apicenter.models.License + :ivar custom_properties: The custom metadata defined for API catalog entities. + :vartype custom_properties: JSON + """ + + _validation = { + "title": {"required": True, "max_length": 50, "min_length": 1}, + "kind": {"required": True}, + "description": {"max_length": 1000}, + "summary": {"max_length": 200}, + "lifecycle_stage": {"readonly": True}, + "external_documentation": {"max_items": 20, "min_items": 0}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "lifecycle_stage": {"key": "lifecycleStage", "type": "str"}, + "terms_of_service": {"key": "termsOfService", "type": "TermsOfService"}, + "external_documentation": {"key": "externalDocumentation", "type": "[ExternalDocumentation]"}, + "contacts": {"key": "contacts", "type": "[Contact]"}, + "license": {"key": "license", "type": "License"}, + "custom_properties": {"key": "customProperties", "type": "object"}, + } + + def __init__( + self, + *, + title: str, + kind: Union[str, "_models.ApiKind"], + description: Optional[str] = None, + summary: Optional[str] = None, + terms_of_service: Optional["_models.TermsOfService"] = None, + external_documentation: Optional[List["_models.ExternalDocumentation"]] = None, + contacts: Optional[List["_models.Contact"]] = None, + license: Optional["_models.License"] = None, + custom_properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: API title. Required. + :paramtype title: str + :keyword kind: Kind of API. For example, REST or GraphQL. Required. Known values are: "rest", + "graphql", "grpc", "soap", "webhook", and "websocket". + :paramtype kind: str or ~azure.mgmt.apicenter.models.ApiKind + :keyword description: Description of the API. + :paramtype description: str + :keyword summary: Short description of the API. + :paramtype summary: str + :keyword terms_of_service: Terms of service for the API. + :paramtype terms_of_service: ~azure.mgmt.apicenter.models.TermsOfService + :keyword external_documentation: The set of external documentation. + :paramtype external_documentation: list[~azure.mgmt.apicenter.models.ExternalDocumentation] + :keyword contacts: The set of contacts. + :paramtype contacts: list[~azure.mgmt.apicenter.models.Contact] + :keyword license: The license information for the API. + :paramtype license: ~azure.mgmt.apicenter.models.License + :keyword custom_properties: The custom metadata defined for API catalog entities. + :paramtype custom_properties: JSON + """ + super().__init__(**kwargs) + self.title = title + self.kind = kind + self.description = description + self.summary = summary + self.lifecycle_stage = None + self.terms_of_service = terms_of_service + self.external_documentation = external_documentation + self.contacts = contacts + self.license = license + self.custom_properties = custom_properties + + +class ApiSpecExportResult(_serialization.Model): + """The API specification export result. + + :ivar format: The format of exported result. Known values are: "inline" and "link". + :vartype format: str or ~azure.mgmt.apicenter.models.ApiSpecExportResultFormat + :ivar value: The result of the export operation. + :vartype value: str + """ + + _attribute_map = { + "format": {"key": "format", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + format: Optional[Union[str, "_models.ApiSpecExportResultFormat"]] = None, + value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword format: The format of exported result. Known values are: "inline" and "link". + :paramtype format: str or ~azure.mgmt.apicenter.models.ApiSpecExportResultFormat + :keyword value: The result of the export operation. + :paramtype value: str + """ + super().__init__(**kwargs) + self.format = format + self.value = value + + +class ApiSpecImportRequest(_serialization.Model): + """The API specification source entity properties. + + :ivar value: Value of the API specification source. + :vartype value: str + :ivar format: Format of the API specification source. Known values are: "inline" and "link". + :vartype format: str or ~azure.mgmt.apicenter.models.ApiSpecImportSourceFormat + :ivar specification: API specification details. + :vartype specification: ~azure.mgmt.apicenter.models.ApiSpecImportRequestSpecification + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "format": {"key": "format", "type": "str"}, + "specification": {"key": "specification", "type": "ApiSpecImportRequestSpecification"}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + format: Optional[Union[str, "_models.ApiSpecImportSourceFormat"]] = None, + specification: Optional["_models.ApiSpecImportRequestSpecification"] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Value of the API specification source. + :paramtype value: str + :keyword format: Format of the API specification source. Known values are: "inline" and "link". + :paramtype format: str or ~azure.mgmt.apicenter.models.ApiSpecImportSourceFormat + :keyword specification: API specification details. + :paramtype specification: ~azure.mgmt.apicenter.models.ApiSpecImportRequestSpecification + """ + super().__init__(**kwargs) + self.value = value + self.format = format + self.specification = specification + + +class ApiSpecImportRequestSpecification(_serialization.Model): + """API specification details. + + :ivar name: Specification name. + :vartype name: str + :ivar version: Specification version. + :vartype version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Specification name. + :paramtype name: str + :keyword version: Specification version. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.version = version + + +class ApiVersion(ProxyResource): + """API version entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.ApiVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApiVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApiVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.ApiVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApiVersionListResult(_serialization.Model): + """The response of a ApiVersion list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The ApiVersion items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.ApiVersion] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApiVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ApiVersionProperties(_serialization.Model): + """API version properties entity. + + All required parameters must be populated in order to send to Azure. + + :ivar title: API version title. Required. + :vartype title: str + :ivar lifecycle_stage: Current lifecycle stage of the API. Required. Known values are: + "design", "development", "testing", "preview", "production", "deprecated", and "retired". + :vartype lifecycle_stage: str or ~azure.mgmt.apicenter.models.LifecycleStage + """ + + _validation = { + "title": {"required": True, "max_length": 50, "min_length": 1}, + "lifecycle_stage": {"required": True}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "lifecycle_stage": {"key": "lifecycleStage", "type": "str"}, + } + + def __init__(self, *, title: str, lifecycle_stage: Union[str, "_models.LifecycleStage"], **kwargs: Any) -> None: + """ + :keyword title: API version title. Required. + :paramtype title: str + :keyword lifecycle_stage: Current lifecycle stage of the API. Required. Known values are: + "design", "development", "testing", "preview", "production", "deprecated", and "retired". + :paramtype lifecycle_stage: str or ~azure.mgmt.apicenter.models.LifecycleStage + """ + super().__init__(**kwargs) + self.title = title + self.lifecycle_stage = lifecycle_stage + + +class Contact(_serialization.Model): + """Contact information. + + :ivar name: Name of the contact. + :vartype name: str + :ivar url: URL for the contact. + :vartype url: str + :ivar email: Email address of the contact. + :vartype email: str + """ + + _validation = { + "name": {"max_length": 100}, + "url": {"max_length": 200}, + "email": {"max_length": 100}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "email": {"key": "email", "type": "str"}, + } + + def __init__( + self, *, name: Optional[str] = None, url: Optional[str] = None, email: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the contact. + :paramtype name: str + :keyword url: URL for the contact. + :paramtype url: str + :keyword email: Email address of the contact. + :paramtype email: str + """ + super().__init__(**kwargs) + self.name = name + self.url = url + self.email = email + + +class Deployment(ProxyResource): + """API deployment entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.DeploymentProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "DeploymentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.DeploymentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DeploymentListResult(_serialization.Model): + """The response of a Deployment list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Deployment items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.Deployment] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Deployment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class DeploymentProperties(_serialization.Model): + """API deployment entity properties. + + :ivar title: API deployment title. + :vartype title: str + :ivar description: Description of the deployment. + :vartype description: str + :ivar environment_id: API center-scoped environment resource ID. + :vartype environment_id: str + :ivar definition_id: API center-scoped definition resource ID. + :vartype definition_id: str + :ivar state: State of API deployment. Known values are: "active" and "inactive". + :vartype state: str or ~azure.mgmt.apicenter.models.DeploymentState + :ivar server: The deployment server. + :vartype server: ~azure.mgmt.apicenter.models.DeploymentServer + :ivar custom_properties: The custom metadata defined for API catalog entities. + :vartype custom_properties: JSON + """ + + _validation = { + "title": {"max_length": 50, "min_length": 1}, + "description": {"max_length": 500}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "definition_id": {"key": "definitionId", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "server": {"key": "server", "type": "DeploymentServer"}, + "custom_properties": {"key": "customProperties", "type": "object"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + environment_id: Optional[str] = None, + definition_id: Optional[str] = None, + state: Optional[Union[str, "_models.DeploymentState"]] = None, + server: Optional["_models.DeploymentServer"] = None, + custom_properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: API deployment title. + :paramtype title: str + :keyword description: Description of the deployment. + :paramtype description: str + :keyword environment_id: API center-scoped environment resource ID. + :paramtype environment_id: str + :keyword definition_id: API center-scoped definition resource ID. + :paramtype definition_id: str + :keyword state: State of API deployment. Known values are: "active" and "inactive". + :paramtype state: str or ~azure.mgmt.apicenter.models.DeploymentState + :keyword server: The deployment server. + :paramtype server: ~azure.mgmt.apicenter.models.DeploymentServer + :keyword custom_properties: The custom metadata defined for API catalog entities. + :paramtype custom_properties: JSON + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.environment_id = environment_id + self.definition_id = definition_id + self.state = state + self.server = server + self.custom_properties = custom_properties + + +class DeploymentServer(_serialization.Model): + """Server. + + :ivar runtime_uri: Base runtime URLs for this deployment. + :vartype runtime_uri: list[str] + """ + + _attribute_map = { + "runtime_uri": {"key": "runtimeUri", "type": "[str]"}, + } + + def __init__(self, *, runtime_uri: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword runtime_uri: Base runtime URLs for this deployment. + :paramtype runtime_uri: list[str] + """ + super().__init__(**kwargs) + self.runtime_uri = runtime_uri + + +class Environment(ProxyResource): + """Environment entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.EnvironmentProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "EnvironmentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EnvironmentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.EnvironmentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EnvironmentListResult(_serialization.Model): + """The response of a Environment list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Environment items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.Environment] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Environment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class EnvironmentProperties(_serialization.Model): + """Environment properties entity. + + All required parameters must be populated in order to send to Azure. + + :ivar title: Environment title. Required. + :vartype title: str + :ivar description: The environment description. + :vartype description: str + :ivar kind: Environment kind. Required. Known values are: "development", "testing", "staging", + and "production". + :vartype kind: str or ~azure.mgmt.apicenter.models.EnvironmentKind + :ivar server: Server information of the environment. + :vartype server: ~azure.mgmt.apicenter.models.EnvironmentServer + :ivar onboarding: Environment onboarding information. + :vartype onboarding: ~azure.mgmt.apicenter.models.Onboarding + :ivar custom_properties: The custom metadata defined for API catalog entities. + :vartype custom_properties: JSON + """ + + _validation = { + "title": {"required": True, "max_length": 50, "min_length": 1}, + "kind": {"required": True}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "server": {"key": "server", "type": "EnvironmentServer"}, + "onboarding": {"key": "onboarding", "type": "Onboarding"}, + "custom_properties": {"key": "customProperties", "type": "object"}, + } + + def __init__( + self, + *, + title: str, + kind: Union[str, "_models.EnvironmentKind"], + description: Optional[str] = None, + server: Optional["_models.EnvironmentServer"] = None, + onboarding: Optional["_models.Onboarding"] = None, + custom_properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: Environment title. Required. + :paramtype title: str + :keyword description: The environment description. + :paramtype description: str + :keyword kind: Environment kind. Required. Known values are: "development", "testing", + "staging", and "production". + :paramtype kind: str or ~azure.mgmt.apicenter.models.EnvironmentKind + :keyword server: Server information of the environment. + :paramtype server: ~azure.mgmt.apicenter.models.EnvironmentServer + :keyword onboarding: Environment onboarding information. + :paramtype onboarding: ~azure.mgmt.apicenter.models.Onboarding + :keyword custom_properties: The custom metadata defined for API catalog entities. + :paramtype custom_properties: JSON + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.kind = kind + self.server = server + self.onboarding = onboarding + self.custom_properties = custom_properties + + +class EnvironmentServer(_serialization.Model): + """Server information of the environment. + + :ivar type: Type of the server that represents the environment. Known values are: "Azure API + Management", "Azure compute service", "Apigee API Management", "AWS API Gateway", "Kong API + Gateway", "Kubernetes", and "MuleSoft API Management". + :vartype type: str or ~azure.mgmt.apicenter.models.EnvironmentServerType + :ivar management_portal_uri: The location of the management portal. + :vartype management_portal_uri: list[str] + """ + + _validation = { + "management_portal_uri": {"max_items": 1, "min_items": 0}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "management_portal_uri": {"key": "managementPortalUri", "type": "[str]"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.EnvironmentServerType"]] = None, + management_portal_uri: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of the server that represents the environment. Known values are: "Azure API + Management", "Azure compute service", "Apigee API Management", "AWS API Gateway", "Kong API + Gateway", "Kubernetes", and "MuleSoft API Management". + :paramtype type: str or ~azure.mgmt.apicenter.models.EnvironmentServerType + :keyword management_portal_uri: The location of the management portal. + :paramtype management_portal_uri: list[str] + """ + super().__init__(**kwargs) + self.type = type + self.management_portal_uri = management_portal_uri class ErrorAdditionalInfo(_serialization.Model): @@ -71,105 +1066,428 @@ class ErrorDetail(_serialization.Model): } _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]"}, + "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.apicenter.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.apicenter.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExternalDocumentation(_serialization.Model): + """Additional, external documentation for the API. + + All required parameters must be populated in order to send to Azure. + + :ivar title: Title of the documentation. + :vartype title: str + :ivar description: Description of the documentation. + :vartype description: str + :ivar url: URL pointing to the documentation. Required. + :vartype url: str + """ + + _validation = { + "title": {"max_length": 50}, + "description": {"max_length": 500}, + "url": {"required": True, "max_length": 200}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "url": {"key": "url", "type": "str"}, + } + + def __init__( + self, *, url: str, title: Optional[str] = None, description: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword title: Title of the documentation. + :paramtype title: str + :keyword description: Description of the documentation. + :paramtype description: str + :keyword url: URL pointing to the documentation. Required. + :paramtype url: str + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.url = url + + +class License(_serialization.Model): + """The license information for the API. + + :ivar name: Name of the license. + :vartype name: str + :ivar url: URL pointing to the license details. The URL field is mutually exclusive of the + identifier field. + :vartype url: str + :ivar identifier: SPDX license information for the API. The identifier field is mutually + exclusive of the URL field. + :vartype identifier: str + """ + + _validation = { + "name": {"max_length": 100}, + "url": {"max_length": 200}, + "identifier": {"max_length": 50}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "identifier": {"key": "identifier", "type": "str"}, + } + + def __init__( + self, *, name: Optional[str] = None, url: Optional[str] = None, identifier: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the license. + :paramtype name: str + :keyword url: URL pointing to the license details. The URL field is mutually exclusive of the + identifier field. + :paramtype url: str + :keyword identifier: SPDX license information for the API. The identifier field is mutually + exclusive of the URL field. + :paramtype identifier: str + """ + super().__init__(**kwargs) + self.name = name + self.url = url + self.identifier = identifier + + +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 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". + :vartype type: str or ~azure.mgmt.apicenter.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.apicenter.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.apicenter.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.apicenter.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MetadataAssignment(_serialization.Model): + """Assignment metadata. + + :ivar entity: The entities this metadata schema component gets applied to. Known values are: + "api", "environment", and "deployment". + :vartype entity: str or ~azure.mgmt.apicenter.models.MetadataAssignmentEntity + :ivar required: Required assignment. + :vartype required: bool + :ivar deprecated: Deprecated assignment. + :vartype deprecated: bool + """ + + _attribute_map = { + "entity": {"key": "entity", "type": "str"}, + "required": {"key": "required", "type": "bool"}, + "deprecated": {"key": "deprecated", "type": "bool"}, + } + + def __init__( + self, + *, + entity: Optional[Union[str, "_models.MetadataAssignmentEntity"]] = None, + required: Optional[bool] = None, + deprecated: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword entity: The entities this metadata schema component gets applied to. Known values are: + "api", "environment", and "deployment". + :paramtype entity: str or ~azure.mgmt.apicenter.models.MetadataAssignmentEntity + :keyword required: Required assignment. + :paramtype required: bool + :keyword deprecated: Deprecated assignment. + :paramtype deprecated: bool + """ + super().__init__(**kwargs) + self.entity = entity + self.required = required + self.deprecated = deprecated + + +class MetadataSchema(ProxyResource): + """Metadata schema entity. Used to define metadata for the entities in API catalog. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.MetadataSchemaProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "MetadataSchemaProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MetadataSchemaProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.MetadataSchemaProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MetadataSchemaExportRequest(_serialization.Model): + """The metadata schema export request. + + :ivar assigned_to: An entity the metadata schema is requested for. Known values are: "api", + "environment", and "deployment". + :vartype assigned_to: str or ~azure.mgmt.apicenter.models.MetadataAssignmentEntity + """ + + _attribute_map = { + "assigned_to": {"key": "assignedTo", "type": "str"}, + } + + def __init__( + self, *, assigned_to: Optional[Union[str, "_models.MetadataAssignmentEntity"]] = None, **kwargs: Any + ) -> None: + """ + :keyword assigned_to: An entity the metadata schema is requested for. Known values are: "api", + "environment", and "deployment". + :paramtype assigned_to: str or ~azure.mgmt.apicenter.models.MetadataAssignmentEntity + """ + super().__init__(**kwargs) + self.assigned_to = assigned_to + + +class MetadataSchemaExportResult(_serialization.Model): + """The metadata schema export result. + + :ivar format: The export format for the schema. Known values are: "inline" and "link". + :vartype format: str or ~azure.mgmt.apicenter.models.MetadataSchemaExportFormat + :ivar value: The result of the export operation. + :vartype value: str + """ + + _attribute_map = { + "format": {"key": "format", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + format: Optional[Union[str, "_models.MetadataSchemaExportFormat"]] = None, + value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword format: The export format for the schema. Known values are: "inline" and "link". + :paramtype format: str or ~azure.mgmt.apicenter.models.MetadataSchemaExportFormat + :keyword value: The result of the export operation. + :paramtype value: str + """ + super().__init__(**kwargs) + self.format = format + self.value = value + + +class MetadataSchemaListResult(_serialization.Model): + """The response of a MetadataSchema list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The MetadataSchema items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.MetadataSchema] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MetadataSchema]"}, + "next_link": {"key": "nextLink", "type": "str"}, } 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 + self.value = None + self.next_link = 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.). +class MetadataSchemaProperties(_serialization.Model): + """Metadata schema properties. - :ivar error: The error object. - :vartype error: ~azure.mgmt.apicenter.models.ErrorDetail + All required parameters must be populated in order to send to Azure. + + :ivar schema: The schema defining the type. Required. + :vartype schema: str + :ivar assigned_to: The assignees. + :vartype assigned_to: list[~azure.mgmt.apicenter.models.MetadataAssignment] """ + _validation = { + "schema": {"required": True}, + } + _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, + "schema": {"key": "schema", "type": "str"}, + "assigned_to": {"key": "assignedTo", "type": "[MetadataAssignment]"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + def __init__( + self, *, schema: str, assigned_to: Optional[List["_models.MetadataAssignment"]] = None, **kwargs: Any + ) -> None: """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.apicenter.models.ErrorDetail + :keyword schema: The schema defining the type. Required. + :paramtype schema: str + :keyword assigned_to: The assignees. + :paramtype assigned_to: list[~azure.mgmt.apicenter.models.MetadataAssignment] """ super().__init__(**kwargs) - self.error = error - + self.schema = schema + self.assigned_to = assigned_to -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 Azure. +class Onboarding(_serialization.Model): + """Onboarding information. - :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.apicenter.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.apicenter.models.UserAssignedIdentity] + :ivar instructions: Onboarding guide. + :vartype instructions: str + :ivar developer_portal_uri: The location of the development portal. + :vartype developer_portal_uri: list[str] """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "developer_portal_uri": {"max_items": 1, "min_items": 0}, } _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}"}, + "instructions": {"key": "instructions", "type": "str"}, + "developer_portal_uri": {"key": "developerPortalUri", "type": "[str]"}, } def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any + self, *, instructions: Optional[str] = None, developer_portal_uri: Optional[List[str]] = 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.apicenter.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.apicenter.models.UserAssignedIdentity] + :keyword instructions: Onboarding guide. + :paramtype instructions: str + :keyword developer_portal_uri: The location of the development portal. + :paramtype developer_portal_uri: list[str] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.instructions = instructions + self.developer_portal_uri = developer_portal_uri class Operation(_serialization.Model): @@ -293,47 +1611,6 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/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.apicenter.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -410,11 +1687,10 @@ class Service(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar identity: The identity of the service. + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.ServiceProperties + :ivar identity: The managed service identities assigned to this resource. :vartype identity: ~azure.mgmt.apicenter.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.apicenter.models.ProvisioningState """ _validation = { @@ -423,7 +1699,6 @@ class Service(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -433,8 +1708,8 @@ class Service(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ServiceProperties"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -442,6 +1717,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ServiceProperties"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, **kwargs: Any ) -> None: @@ -450,17 +1726,21 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword identity: The identity of the service. + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.ServiceProperties + :keyword identity: The managed service identities assigned to this resource. :paramtype identity: ~azure.mgmt.apicenter.models.ManagedServiceIdentity """ super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties self.identity = identity - self.provisioning_state = None -class ServiceCollection(_serialization.Model): +class ServiceListResult(_serialization.Model): """The response of a Service list operation. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar value: The Service items on this page. Required. @@ -470,7 +1750,8 @@ class ServiceCollection(_serialization.Model): """ _validation = { - "value": {"required": True}, + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -478,24 +1759,19 @@ class ServiceCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Service"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Service items on this page. Required. - :paramtype value: list[~azure.mgmt.apicenter.models.Service] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.value = None + self.next_link = None -class ServiceUpdate(_serialization.Model): - """The service properties to be updated. +class ServiceProperties(_serialization.Model): + """The properties of the service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + :ivar provisioning_state: Provisioning state of the service. Known values are: "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.apicenter.models.ProvisioningState """ @@ -505,7 +1781,7 @@ class ServiceUpdate(_serialization.Model): } _attribute_map = { - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: @@ -514,6 +1790,38 @@ def __init__(self, **kwargs: Any) -> None: self.provisioning_state = None +class ServiceUpdate(_serialization.Model): + """The type used for update operations of the Service. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.apicenter.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.apicenter.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -578,6 +1886,32 @@ def __init__( self.last_modified_at = last_modified_at +class TermsOfService(_serialization.Model): + """Terms of service for the API. + + All required parameters must be populated in order to send to Azure. + + :ivar url: URL pointing to the terms of service. Required. + :vartype url: str + """ + + _validation = { + "url": {"required": True, "max_length": 200}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + } + + def __init__(self, *, url: str, **kwargs: Any) -> None: + """ + :keyword url: URL pointing to the terms of service. Required. + :paramtype url: str + """ + super().__init__(**kwargs) + self.url = url + + class UserAssignedIdentity(_serialization.Model): """User assigned identity properties. @@ -604,3 +1938,109 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.principal_id = None self.client_id = None + + +class Workspace(ProxyResource): + """Workspace entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.apicenter.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.apicenter.models.WorkspaceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "WorkspaceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.WorkspaceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.apicenter.models.WorkspaceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class WorkspaceListResult(_serialization.Model): + """The response of a Workspace list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Workspace items on this page. Required. + :vartype value: list[~azure.mgmt.apicenter.models.Workspace] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True, "readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Workspace]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class WorkspaceProperties(_serialization.Model): + """Workspace properties. + + All required parameters must be populated in order to send to Azure. + + :ivar title: Workspace title. Required. + :vartype title: str + :ivar description: Workspace description. + :vartype description: str + """ + + _validation = { + "title": {"required": True, "max_length": 50, "min_length": 1}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, title: str, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword title: Workspace title. Required. + :paramtype title: str + :keyword description: Workspace description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.title = title + self.description = description diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/__init__.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/__init__.py index bf7a87b59370..3ed67317ce8e 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/__init__.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/__init__.py @@ -8,6 +8,13 @@ from ._operations import Operations from ._services_operations import ServicesOperations +from ._metadata_schemas_operations import MetadataSchemasOperations +from ._workspaces_operations import WorkspacesOperations +from ._apis_operations import ApisOperations +from ._deployments_operations import DeploymentsOperations +from ._api_versions_operations import ApiVersionsOperations +from ._api_definitions_operations import ApiDefinitionsOperations +from ._environments_operations import EnvironmentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -16,6 +23,13 @@ __all__ = [ "Operations", "ServicesOperations", + "MetadataSchemasOperations", + "WorkspacesOperations", + "ApisOperations", + "DeploymentsOperations", + "ApiVersionsOperations", + "ApiDefinitionsOperations", + "EnvironmentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_definitions_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_definitions_operations.py new file mode 100644 index 000000000000..518e2b2ed4d6 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_definitions_operations.py @@ -0,0 +1,1422 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + subscription_id: str, + *, + filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_specification_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_import_specification_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "definitionName": _SERIALIZER.url( + "definition_name", definition_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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 ApiDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`api_definitions` 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, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ApiDefinition"]: + """Returns a collection of API definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiDefinition or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.ApiDefinition] + :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.ApiDefinitionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiDefinitionListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> _models.ApiDefinition: + """Returns details of the API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :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.ApiDefinition] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: _models.ApiDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.ApiDefinition + :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: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + resource: Union[_models.ApiDefinition, IO], + **kwargs: Any + ) -> _models.ApiDefinition: + """Creates new or updates existing API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param resource: Resource create parameters. Is either a ApiDefinition type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.ApiDefinition or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiDefinition or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ApiDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ApiDefinition") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> None: + """Deletes specified API definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + @distributed_trace + def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API definition exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}" + } + + def _export_specification_initial( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> Optional[_models.ApiSpecExportResult]: + 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[Optional[_models.ApiSpecExportResult]] = kwargs.pop("cls", None) + + request = build_export_specification_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._export_specification_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ApiSpecExportResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_specification_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification" + } + + @distributed_trace + def begin_export_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + **kwargs: Any + ) -> LROPoller[_models.ApiSpecExportResult]: + """Exports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_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 ApiSpecExportResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apicenter.models.ApiSpecExportResult] + :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.ApiSpecExportResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_specification_initial( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_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): + deserialized = self._deserialize("ApiSpecExportResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_specification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification" + } + + def _import_specification_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: Union[_models.ApiSpecImportRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ApiSpecImportRequest") + + request = build_import_specification_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._import_specification_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _import_specification_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification" + } + + @overload + def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: _models.ApiSpecImportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.apicenter.models.ApiSpecImportRequest + :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: + """ + + @overload + def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_import_specification( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + definition_name: str, + body: Union[_models.ApiSpecImportRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Imports the API specification. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param definition_name: The name of the API definition. Required. + :type definition_name: str + :param body: The content of the action request. Is either a ApiSpecImportRequest type or a IO + type. Required. + :type body: ~azure.mgmt.apicenter.models.ApiSpecImportRequest 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 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._import_specification_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + definition_name=definition_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_import_specification.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_versions_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_versions_operations.py new file mode 100644 index 000000000000..b19477c75762 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_api_versions_operations.py @@ -0,0 +1,835 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + service_name: str, + workspace_name: str, + api_name: str, + subscription_id: str, + *, + filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, + service_name: str, + workspace_name: str, + api_name: str, + version_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, + service_name: str, + workspace_name: str, + api_name: str, + version_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "versionName": _SERIALIZER.url( + "version_name", version_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`api_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, + service_name: str, + workspace_name: str, + api_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ApiVersion"]: + """Returns a collection of API versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.ApiVersion] + :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.ApiVersionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiVersionListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> _models.ApiVersion: + """Returns details of the API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :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.ApiVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: _models.ApiVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.ApiVersion + :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: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + resource: Union[_models.ApiVersion, IO], + **kwargs: Any + ) -> _models.ApiVersion: + """Creates new or updates existing API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :param resource: Resource create parameters. Is either a ApiVersion type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.ApiVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiVersion or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.ApiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ApiVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ApiVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("ApiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> None: + """Deletes specified API version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } + + @distributed_trace + def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + version_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API version exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param version_name: The name of the API version. Required. + :type version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_apis_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_apis_operations.py new file mode 100644 index 000000000000..0c0cd53a41dc --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_apis_operations.py @@ -0,0 +1,753 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + service_name: str, + workspace_name: str, + subscription_id: str, + *, + filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, service_name: str, workspace_name: str, api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, service_name: str, workspace_name: str, api_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, service_name: str, workspace_name: str, api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, service_name: str, workspace_name: str, api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`apis` 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, + service_name: str, + workspace_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Api"]: + """Returns a collection of APIs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Api or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.Api] + :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.ApiListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> _models.Api: + """Returns details of the API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :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.Api] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: _models.Api, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Api + :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: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + resource: Union[_models.Api, IO], + **kwargs: Any + ) -> _models.Api: + """Creates new or updates existing API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param resource: Resource create parameters. Is either a Api type or a IO type. Required. + :type resource: ~azure.mgmt.apicenter.models.Api or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Api or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Api + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Api] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Api") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Api", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> None: + """Deletes specified API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } + + @distributed_trace + def head( + self, resource_group_name: str, service_name: str, workspace_name: str, api_name: str, **kwargs: Any + ) -> bool: + """Checks if specified API exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_deployments_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_deployments_operations.py new file mode 100644 index 000000000000..79276266eda8 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_deployments_operations.py @@ -0,0 +1,835 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + service_name: str, + workspace_name: str, + api_name: str, + subscription_id: str, + *, + filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, + service_name: str, + workspace_name: str, + api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, + service_name: str, + workspace_name: str, + api_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + api_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "apiName": _SERIALIZER.url( + "api_name", api_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`deployments` 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, + service_name: str, + workspace_name: str, + api_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Deployment"]: + """Returns a collection of API deployments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Deployment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.Deployment] + :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.DeploymentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> _models.Deployment: + """Returns details of the API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :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.Deployment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_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) + + _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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Deployment + :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: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + resource: Union[_models.Deployment, IO], + **kwargs: Any + ) -> _models.Deployment: + """Creates new or updates existing API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is either a Deployment type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.Deployment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Deployment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Deployment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Deployment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + """Deletes API deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_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, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } + + @distributed_trace + def head( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + api_name: str, + deployment_name: str, + **kwargs: Any + ) -> bool: + """Checks if specified API deployment exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param api_name: The name of the API. Required. + :type api_name: str + :param deployment_name: The name of the API deployment. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + api_name=api_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_environments_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_environments_operations.py new file mode 100644 index 000000000000..5da4c08a0234 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_environments_operations.py @@ -0,0 +1,774 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + service_name: str, + workspace_name: str, + subscription_id: str, + *, + filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, + service_name: str, + workspace_name: str, + environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, + service_name: str, + workspace_name: str, + environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class EnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`environments` 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, + service_name: str, + workspace_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Environment"]: + """Returns a collection of environments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Environment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.Environment] + :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.EnvironmentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> _models.Environment: + """Returns details of the environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :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.Environment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_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) + + _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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: _models.Environment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.Environment + :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: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + environment_name: str, + resource: Union[_models.Environment, IO], + **kwargs: Any + ) -> _models.Environment: + """Creates new or updates existing environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :param resource: Resource create parameters. Is either a Environment type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.Environment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Environment or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Environment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Environment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Environment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Environment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> None: + """Deletes the environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_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, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } + + @distributed_trace + def head( + self, resource_group_name: str, service_name: str, workspace_name: str, environment_name: str, **kwargs: Any + ) -> bool: + """Checks if specified environment exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param environment_name: The name of the environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_metadata_schemas_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_metadata_schemas_operations.py new file mode 100644 index 000000000000..e4bd07d350c6 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_metadata_schemas_operations.py @@ -0,0 +1,724 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, service_name: str, subscription_id: str, *, filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, service_name: str, metadata_schema_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "metadataSchemaName": _SERIALIZER.url( + "metadata_schema_name", + metadata_schema_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[a-zA-Z0-9-]{3,90}$", + ), + } + + _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, service_name: str, metadata_schema_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-03-01")) + 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.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "metadataSchemaName": _SERIALIZER.url( + "metadata_schema_name", + metadata_schema_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[a-zA-Z0-9-]{3,90}$", + ), + } + + _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_delete_request( + resource_group_name: str, service_name: str, metadata_schema_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "metadataSchemaName": _SERIALIZER.url( + "metadata_schema_name", + metadata_schema_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[a-zA-Z0-9-]{3,90}$", + ), + } + + _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_head_request( + resource_group_name: str, service_name: str, metadata_schema_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "metadataSchemaName": _SERIALIZER.url( + "metadata_schema_name", + metadata_schema_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[a-zA-Z0-9-]{3,90}$", + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class MetadataSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`metadata_schemas` 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, service_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.MetadataSchema"]: + """Returns a collection of metadata schemas. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MetadataSchema or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apicenter.models.MetadataSchema] + :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.MetadataSchemaListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MetadataSchemaListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any + ) -> _models.MetadataSchema: + """Returns details of the metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :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.MetadataSchema] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: _models.MetadataSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.models.MetadataSchema + :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: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + metadata_schema_name: str, + resource: Union[_models.MetadataSchema, IO], + **kwargs: Any + ) -> _models.MetadataSchema: + """Creates new or updates existing metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :param resource: Resource create parameters. Is either a MetadataSchema type or a IO type. + Required. + :type resource: ~azure.mgmt.apicenter.models.MetadataSchema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSchema or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.MetadataSchema + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.MetadataSchema] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "MetadataSchema") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("MetadataSchema", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any + ) -> None: + """Deletes specified metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_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, + service_name=service_name, + metadata_schema_name=metadata_schema_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.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } + + @distributed_trace + def head(self, resource_group_name: str, service_name: str, metadata_schema_name: str, **kwargs: Any) -> bool: + """Checks if specified metadata schema exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param metadata_schema_name: The name of the metadata schema. Required. + :type metadata_schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + metadata_schema_name=metadata_schema_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_operations.py index bc9692752138..33f31cda0158 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_operations.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_operations.py @@ -40,7 +40,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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_services_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_services_operations.py index d1b42fa70e92..d1946abc21cc 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_services_operations.py +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_services_operations.py @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,10 +21,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer @@ -41,13 +43,13 @@ 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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -65,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -95,7 +97,7 @@ def build_get_request(resource_group_name: str, service_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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,11 +106,13 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-zA-Z0-9\-]{1,64}$"), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -128,7 +132,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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,11 +142,13 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-zA-Z0-9\-]{1,64}$"), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -164,7 +170,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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,11 +180,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-zA-Z0-9\-]{1,64}$"), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -200,7 +208,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-07-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,11 +217,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-zA-Z0-9\-]{1,64}$"), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -227,6 +237,44 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_export_metadata_schema_request( + resource_group_name: str, service_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-03-01")) + 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.ApiCenter/services/{serviceName}/exportMetadataSchema", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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 ServicesOperations: """ .. warning:: @@ -259,7 +307,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Service"]: _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.ServiceCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -301,7 +349,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceCollection", pipeline_response) + deserialized = self._deserialize("ServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -329,7 +377,7 @@ def get_next(next_link=None): @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Service"]: - """Lists services within a resource group. + """Returns a collection of services within the resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -343,7 +391,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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.ServiceCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +434,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceCollection", pipeline_response) + deserialized = self._deserialize("ServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -416,12 +464,12 @@ def get_next(next_link=None): @distributed_trace def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.Service: - """Get service. + """Returns details of the service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) @@ -482,19 +530,19 @@ def create_or_update( self, resource_group_name: str, service_name: str, - resource: Optional[_models.Service] = None, + resource: _models.Service, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Default value is None. + :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.apicenter.models.Service :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -510,19 +558,19 @@ def create_or_update( self, resource_group_name: str, service_name: str, - resource: Optional[IO] = None, + resource: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Default value is None. + :param resource: Resource create parameters. Required. :type resource: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -535,21 +583,16 @@ def create_or_update( @distributed_trace def create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: Optional[Union[_models.Service, IO]] = None, - **kwargs: Any + self, resource_group_name: str, service_name: str, resource: Union[_models.Service, IO], **kwargs: Any ) -> _models.Service: - """Create or update service. + """Creates new or updates existing API. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param resource: The service entity. Is either a Service type or a IO type. Default value is - None. + :param resource: Resource create parameters. Is either a Service type or a IO type. Required. :type resource: ~azure.mgmt.apicenter.models.Service or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -580,10 +623,7 @@ def create_or_update( if isinstance(resource, (IOBase, bytes)): _content = resource else: - if resource is not None: - _json = self._serialize.body(resource, "Service") - else: - _json = None + _json = self._serialize.body(resource, "Service") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -632,20 +672,20 @@ def update( self, resource_group_name: str, service_name: str, - parameters: Optional[_models.ServiceUpdate] = None, + properties: _models.ServiceUpdate, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Default value is None. - :type parameters: ~azure.mgmt.apicenter.models.ServiceUpdate + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.apicenter.models.ServiceUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -660,20 +700,20 @@ def update( self, resource_group_name: str, service_name: str, - parameters: Optional[IO] = None, + properties: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Default value is None. - :type parameters: IO + :param properties: The resource properties to be updated. Required. + :type properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -685,22 +725,18 @@ def update( @distributed_trace def update( - self, - resource_group_name: str, - service_name: str, - parameters: Optional[Union[_models.ServiceUpdate, IO]] = None, - **kwargs: Any + self, resource_group_name: str, service_name: str, properties: Union[_models.ServiceUpdate, IO], **kwargs: Any ) -> _models.Service: - """Update service. + """Updates existing service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_name: str - :param parameters: The service properties to be updated. Is either a ServiceUpdate type or a IO - type. Default value is None. - :type parameters: ~azure.mgmt.apicenter.models.ServiceUpdate or IO + :param properties: The resource properties to be updated. Is either a ServiceUpdate type or a + IO type. Required. + :type properties: ~azure.mgmt.apicenter.models.ServiceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -727,13 +763,10 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - if parameters is not None: - _json = self._serialize.body(parameters, "ServiceUpdate") - else: - _json = None + _json = self._serialize.body(properties, "ServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -777,12 +810,12 @@ def update( def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, **kwargs: Any ) -> None: - """Delete service. + """Deletes specified service. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param service_name: Service name. Required. + :param service_name: The name of Azure API Center service. Required. :type service_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) @@ -833,3 +866,234 @@ def delete( # pylint: disable=inconsistent-return-statements delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}" } + + def _export_metadata_schema_initial( + self, + resource_group_name: str, + service_name: str, + body: Union[_models.MetadataSchemaExportRequest, IO], + **kwargs: Any + ) -> Optional[_models.MetadataSchemaExportResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.MetadataSchemaExportResult]] = 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, "MetadataSchemaExportRequest") + + request = build_export_metadata_schema_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_metadata_schema_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MetadataSchemaExportResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_metadata_schema_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema" + } + + @overload + def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: _models.MetadataSchemaExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.apicenter.models.MetadataSchemaExportRequest + :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 MetadataSchemaExportResult or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MetadataSchemaExportResult or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_metadata_schema( + self, + resource_group_name: str, + service_name: str, + body: Union[_models.MetadataSchemaExportRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.MetadataSchemaExportResult]: + """Exports the effective metadata schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param body: The content of the action request. Is either a MetadataSchemaExportRequest type or + a IO type. Required. + :type body: ~azure.mgmt.apicenter.models.MetadataSchemaExportRequest 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 MetadataSchemaExportResult or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apicenter.models.MetadataSchemaExportResult] + :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.MetadataSchemaExportResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_metadata_schema_initial( + resource_group_name=resource_group_name, + service_name=service_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MetadataSchemaExportResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_metadata_schema.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_workspaces_operations.py b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_workspaces_operations.py new file mode 100644 index 000000000000..60fbab68802e --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/azure/mgmt/apicenter/operations/_workspaces_operations.py @@ -0,0 +1,701 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, service_name: str, subscription_id: str, *, filter: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "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, service_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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, service_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-03-01")) + 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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_delete_request( + resource_group_name: str, service_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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_head_request( + resource_group_name: str, service_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serviceName": _SERIALIZER.url( + "service_name", service_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=90, min_length=1, pattern=r"^[a-zA-Z0-9-]{3,90}$" + ), + } + + _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="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.apicenter.ApiCenterMgmtClient`'s + :attr:`workspaces` 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, service_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Workspace"]: + """Returns a collection of workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param filter: OData filter parameter. Default value is None. + :type filter: 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.apicenter.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_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces" + } + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: + """Returns details of the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the 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.apicenter.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, + service_name=service_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) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: _models.Workspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.apicenter.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 + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Workspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.models.Workspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + service_name: str, + workspace_name: str, + resource: Union[_models.Workspace, IO], + **kwargs: Any + ) -> _models.Workspace: + """Creates new or updates existing workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param resource: Resource create parameters. Is either a Workspace type or a IO type. Required. + :type resource: ~azure.mgmt.apicenter.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 + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.apicenter.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 = case_insensitive_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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Workspace") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("Workspace", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any + ) -> None: + """Deletes specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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, + service_name=service_name, + workspace_name=workspace_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.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } + + @distributed_trace + def head(self, resource_group_name: str, service_name: str, workspace_name: str, **kwargs: Any) -> bool: + """Checks if specified workspace exists. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param service_name: The name of Azure API Center service. Required. + :type service_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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_head_request( + resource_group_name=resource_group_name, + service_name=service_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.head.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) + + if cls: + return cls(pipeline_response, None, {}) + return 200 <= response.status_code <= 299 + + head.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}" + } diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_delete.py new file mode 100644 index 000000000000..bd37055fc631 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_definitions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.api_definitions.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + definition_name="openapi", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_export_specification.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_export_specification.py new file mode 100644 index 000000000000..8b63b7e8d4b1 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_export_specification.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_definitions_export_specification.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_definitions.begin_export_specification( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + definition_name="openapi", + ).result() + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_ExportSpecification.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_get.py new file mode 100644 index 000000000000..6a29726668c1 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_definitions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_definitions.get( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + definition_name="openapi", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_head.py new file mode 100644 index 000000000000..08e6e6d297c7 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_definitions_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_definitions.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + definition_name="openapi", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_list.py new file mode 100644 index 000000000000..efdc9975f8e4 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_definitions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_definitions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_definitions.list( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_delete.py new file mode 100644 index 000000000000..670eaec36747 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_versions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.api_versions.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_get.py new file mode 100644 index 000000000000..a97c36ea624a --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_versions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_versions.get( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_head.py new file mode 100644 index 000000000000..20569f455df7 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_versions_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_versions.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + version_name="2023-01-01", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_list.py new file mode 100644 index 000000000000..f93e0588180d --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/api_versions_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python api_versions_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.api_versions.list( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_delete.py new file mode 100644 index 000000000000..5f18d1ba57cc --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python apis_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.apis.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_get.py new file mode 100644 index 000000000000..e0693fdbbbf9 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python apis_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.apis.get( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_head.py new file mode 100644 index 000000000000..51973f10beda --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python apis_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.apis.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_list.py new file mode 100644 index 000000000000..8bdd4595201f --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/apis_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python apis_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.apis.list( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_delete.py new file mode 100644 index 000000000000..9665982ff689 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python deployments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.deployments.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + deployment_name="production", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_get.py new file mode 100644 index 000000000000..ac4df8381f61 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python deployments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.get( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + deployment_name="production", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_head.py new file mode 100644 index 000000000000..ca4dbab01281 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python deployments_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + deployment_name="production", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_list.py new file mode 100644 index 000000000000..09b0d503c977 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/deployments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python deployments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.list( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + api_name="echo-api", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_delete.py new file mode 100644 index 000000000000..c4c4aad52cbd --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python environments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.environments.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + environment_name="public", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_get.py new file mode 100644 index 000000000000..bf0ad84ed804 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python environments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.environments.get( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + environment_name="public", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_head.py new file mode 100644 index 000000000000..e642a87fc3dd --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python environments_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.environments.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + environment_name="public", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_list.py new file mode 100644 index 000000000000..6a751a088689 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/environments_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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python environments_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.environments.list( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_delete.py new file mode 100644 index 000000000000..1fc38eda6930 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python metadata_schemas_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.metadata_schemas.delete( + resource_group_name="contoso-resources", + service_name="contoso", + metadata_schema_name="author", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_get.py new file mode 100644 index 000000000000..7b91c9084784 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_get.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python metadata_schemas_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.metadata_schemas.get( + resource_group_name="contoso-resources", + service_name="contoso", + metadata_schema_name="lastName", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_head.py new file mode 100644 index 000000000000..60c9187567dd --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python metadata_schemas_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.metadata_schemas.head( + resource_group_name="contoso-resources", + service_name="contoso", + metadata_schema_name="author", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_list.py new file mode 100644 index 000000000000..3b091996a683 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/metadata_schemas_list.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python metadata_schemas_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.metadata_schemas.list( + resource_group_name="contoso-resources", + service_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_List.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/operations_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/operations_list.py index 469f571e85d6..1b27945972fd 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/operations_list.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_create_or_update.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_create_or_update.py index e339cbf56914..ff3637ca60a0 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_create_or_update.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_create_or_update.py @@ -32,10 +32,21 @@ def main(): response = client.services.create_or_update( resource_group_name="contoso-resources", service_name="contoso", + resource={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {} + }, + }, + "location": "East US", + "properties": {}, + "tags": {}, + }, ) print(response) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_delete.py index 9f75fd6c7b3c..e3f903bdc87f 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_delete.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Delete.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_get.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_get.py index 627cd7be91d5..eb47d0c57644 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_get.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Get.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_resource_group.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_resource_group.py index cd60fac064d3..b68b288c93d3 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_resource_group.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_subscription.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_subscription.py index 9f175d1cc573..31a3f4d8dd88 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_subscription.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_delete.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_delete.py new file mode 100644 index 000000000000..c07ec3b81240 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python workspaces_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.workspaces.delete( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + ) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_update.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_get.py similarity index 89% rename from sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_update.py rename to sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_get.py index d0577769ed27..e5f6a2075085 100644 --- a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/services_update.py +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-apicenter # USAGE - python services_update.py + python workspaces_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, @@ -29,13 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.services.update( + response = client.workspaces.get( resource_group_name="contoso-resources", service_name="contoso", + workspace_name="default", ) print(response) -# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_head.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_head.py new file mode 100644 index 000000000000..0a7ba0e99bab --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_head.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python workspaces_head.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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.workspaces.head( + resource_group_name="contoso-resources", + service_name="contoso", + workspace_name="default", + ) + print(response) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Head.json +if __name__ == "__main__": + main() diff --git a/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_list.py b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_list.py new file mode 100644 index 000000000000..024e594f6884 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/generated_samples/workspaces_list.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.apicenter import ApiCenterMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-apicenter +# USAGE + python workspaces_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 = ApiCenterMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.workspaces.list( + resource_group_name="contoso-resources", + service_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appplatform/azure-mgmt-appplatform/_meta.json b/sdk/appplatform/azure-mgmt-appplatform/_meta.json index 71c40214fb5a..e0d66da2987c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/_meta.json +++ b/sdk/appplatform/azure-mgmt-appplatform/_meta.json @@ -1,12 +1,12 @@ { - "commit": "ee05b0049a20adc0e010bbbf17c50a0fdbf72a47", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/appplatform/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/appplatform/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/appplatform/resource-manager/readme.md", "package-2023-12": "2023-12-14 09:48:21 +0800 0fac19a4056fab82c3955a9d8eeba33e79158e49 Microsoft.AppPlatform/stable/2023-12-01/appplatform.json", "package-preview-2023-11": "2023-10-25 09:34:29 +0800 eac41e7f43d1fdfeff98eced43a90d7b1dd746e2 Microsoft.AppPlatform/preview/2023-11-01-preview/appplatform.json", @@ -25,5 +25,6 @@ "package-preview-2021-09": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-09-01-preview/appplatform.json", "package-preview-2021-06": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2021-06-01-preview/appplatform.json", "package-preview-2020-11": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/preview/2020-11-01-preview/appplatform.json", - "package-2020-07": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2020-07-01/appplatform.json" + "package-2020-07": "2023-08-10 13:49:06 +0800 bf037469010a451ea22c3174cf58b20228f6f580 Microsoft.AppPlatform/stable/2020-07-01/appplatform.json", + "package-preview-2024-01": "2024-02-02 00:41:36 +0800 6a5d5f04711def0ab35a0a42a91b3285657d401a Microsoft.AppPlatform/preview/2024-01-01-preview/appplatform.json" } \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py index c3bc56d8c8fe..e546a23c6c36 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py @@ -58,7 +58,6 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'eureka_servers': '2023-11-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -107,6 +106,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-09-01-preview: :mod:`v2023_09_01_preview.models` * 2023-11-01-preview: :mod:`v2023_11_01_preview.models` * 2023-12-01: :mod:`v2023_12_01.models` + * 2024-01-01-preview: :mod:`v2024_01_01_preview.models` """ if api_version == '2020-07-01': from .v2020_07_01 import models @@ -162,6 +162,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-12-01': from .v2023_12_01 import models return models + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -181,6 +184,7 @@ def api_portal_custom_domains(self): * 2023-09-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2023-11-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2023-12-01: :class:`ApiPortalCustomDomainsOperations` + * 2024-01-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': @@ -209,6 +213,8 @@ def api_portal_custom_domains(self): from .v2023_11_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ApiPortalCustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) self._config.api_version = api_version @@ -231,6 +237,7 @@ def api_portals(self): * 2023-09-01-preview: :class:`ApiPortalsOperations` * 2023-11-01-preview: :class:`ApiPortalsOperations` * 2023-12-01: :class:`ApiPortalsOperations` + * 2024-01-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': @@ -259,6 +266,8 @@ def api_portals(self): from .v2023_11_01_preview.operations import ApiPortalsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ApiPortalsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) self._config.api_version = api_version @@ -273,6 +282,7 @@ def apms(self): * 2023-09-01-preview: :class:`ApmsOperations` * 2023-11-01-preview: :class:`ApmsOperations` * 2023-12-01: :class:`ApmsOperations` + * 2024-01-01-preview: :class:`ApmsOperations` """ api_version = self._get_api_version('apms') if api_version == '2023-05-01-preview': @@ -285,6 +295,8 @@ def apms(self): from .v2023_11_01_preview.operations import ApmsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ApmsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ApmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apms'".format(api_version)) self._config.api_version = api_version @@ -302,6 +314,7 @@ def application_accelerators(self): * 2023-09-01-preview: :class:`ApplicationAcceleratorsOperations` * 2023-11-01-preview: :class:`ApplicationAcceleratorsOperations` * 2023-12-01: :class:`ApplicationAcceleratorsOperations` + * 2024-01-01-preview: :class:`ApplicationAcceleratorsOperations` """ api_version = self._get_api_version('application_accelerators') if api_version == '2022-11-01-preview': @@ -320,6 +333,8 @@ def application_accelerators(self): from .v2023_11_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ApplicationAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ApplicationAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application_accelerators'".format(api_version)) self._config.api_version = api_version @@ -337,6 +352,7 @@ def application_live_views(self): * 2023-09-01-preview: :class:`ApplicationLiveViewsOperations` * 2023-11-01-preview: :class:`ApplicationLiveViewsOperations` * 2023-12-01: :class:`ApplicationLiveViewsOperations` + * 2024-01-01-preview: :class:`ApplicationLiveViewsOperations` """ api_version = self._get_api_version('application_live_views') if api_version == '2022-11-01-preview': @@ -355,6 +371,8 @@ def application_live_views(self): from .v2023_11_01_preview.operations import ApplicationLiveViewsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ApplicationLiveViewsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ApplicationLiveViewsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application_live_views'".format(api_version)) self._config.api_version = api_version @@ -382,6 +400,7 @@ def apps(self): * 2023-09-01-preview: :class:`AppsOperations` * 2023-11-01-preview: :class:`AppsOperations` * 2023-12-01: :class:`AppsOperations` + * 2024-01-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2020-07-01': @@ -420,6 +439,8 @@ def apps(self): from .v2023_11_01_preview.operations import AppsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import AppsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) self._config.api_version = api_version @@ -447,6 +468,7 @@ def bindings(self): * 2023-09-01-preview: :class:`BindingsOperations` * 2023-11-01-preview: :class:`BindingsOperations` * 2023-12-01: :class:`BindingsOperations` + * 2024-01-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2020-07-01': @@ -485,6 +507,8 @@ def bindings(self): from .v2023_11_01_preview.operations import BindingsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import BindingsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) self._config.api_version = api_version @@ -508,6 +532,7 @@ def build_service(self): * 2023-09-01-preview: :class:`BuildServiceOperations` * 2023-11-01-preview: :class:`BuildServiceOperations` * 2023-12-01: :class:`BuildServiceOperations` + * 2024-01-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': @@ -538,6 +563,8 @@ def build_service(self): from .v2023_11_01_preview.operations import BuildServiceOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import BuildServiceOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) self._config.api_version = api_version @@ -561,6 +588,7 @@ def build_service_agent_pool(self): * 2023-09-01-preview: :class:`BuildServiceAgentPoolOperations` * 2023-11-01-preview: :class:`BuildServiceAgentPoolOperations` * 2023-12-01: :class:`BuildServiceAgentPoolOperations` + * 2024-01-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': @@ -591,6 +619,8 @@ def build_service_agent_pool(self): from .v2023_11_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) self._config.api_version = api_version @@ -614,6 +644,7 @@ def build_service_builder(self): * 2023-09-01-preview: :class:`BuildServiceBuilderOperations` * 2023-11-01-preview: :class:`BuildServiceBuilderOperations` * 2023-12-01: :class:`BuildServiceBuilderOperations` + * 2024-01-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': @@ -644,6 +675,8 @@ def build_service_builder(self): from .v2023_11_01_preview.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) self._config.api_version = api_version @@ -667,6 +700,7 @@ def buildpack_binding(self): * 2023-09-01-preview: :class:`BuildpackBindingOperations` * 2023-11-01-preview: :class:`BuildpackBindingOperations` * 2023-12-01: :class:`BuildpackBindingOperations` + * 2024-01-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': @@ -697,6 +731,8 @@ def buildpack_binding(self): from .v2023_11_01_preview.operations import BuildpackBindingOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) self._config.api_version = api_version @@ -724,6 +760,7 @@ def certificates(self): * 2023-09-01-preview: :class:`CertificatesOperations` * 2023-11-01-preview: :class:`CertificatesOperations` * 2023-12-01: :class:`CertificatesOperations` + * 2024-01-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2020-07-01': @@ -762,6 +799,8 @@ def certificates(self): from .v2023_11_01_preview.operations import CertificatesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import CertificatesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) self._config.api_version = api_version @@ -789,6 +828,7 @@ def config_servers(self): * 2023-09-01-preview: :class:`ConfigServersOperations` * 2023-11-01-preview: :class:`ConfigServersOperations` * 2023-12-01: :class:`ConfigServersOperations` + * 2024-01-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -827,6 +867,8 @@ def config_servers(self): from .v2023_11_01_preview.operations import ConfigServersOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ConfigServersOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) self._config.api_version = api_version @@ -850,6 +892,7 @@ def configuration_services(self): * 2023-09-01-preview: :class:`ConfigurationServicesOperations` * 2023-11-01-preview: :class:`ConfigurationServicesOperations` * 2023-12-01: :class:`ConfigurationServicesOperations` + * 2024-01-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': @@ -880,6 +923,8 @@ def configuration_services(self): from .v2023_11_01_preview.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) self._config.api_version = api_version @@ -895,6 +940,7 @@ def container_registries(self): * 2023-09-01-preview: :class:`ContainerRegistriesOperations` * 2023-11-01-preview: :class:`ContainerRegistriesOperations` * 2023-12-01: :class:`ContainerRegistriesOperations` + * 2024-01-01-preview: :class:`ContainerRegistriesOperations` """ api_version = self._get_api_version('container_registries') if api_version == '2023-03-01-preview': @@ -909,6 +955,8 @@ def container_registries(self): from .v2023_11_01_preview.operations import ContainerRegistriesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ContainerRegistriesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ContainerRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'container_registries'".format(api_version)) self._config.api_version = api_version @@ -936,6 +984,7 @@ def custom_domains(self): * 2023-09-01-preview: :class:`CustomDomainsOperations` * 2023-11-01-preview: :class:`CustomDomainsOperations` * 2023-12-01: :class:`CustomDomainsOperations` + * 2024-01-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2020-07-01': @@ -974,6 +1023,8 @@ def custom_domains(self): from .v2023_11_01_preview.operations import CustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import CustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) self._config.api_version = api_version @@ -991,6 +1042,7 @@ def customized_accelerators(self): * 2023-09-01-preview: :class:`CustomizedAcceleratorsOperations` * 2023-11-01-preview: :class:`CustomizedAcceleratorsOperations` * 2023-12-01: :class:`CustomizedAcceleratorsOperations` + * 2024-01-01-preview: :class:`CustomizedAcceleratorsOperations` """ api_version = self._get_api_version('customized_accelerators') if api_version == '2022-11-01-preview': @@ -1009,6 +1061,8 @@ def customized_accelerators(self): from .v2023_11_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import CustomizedAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import CustomizedAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'customized_accelerators'".format(api_version)) self._config.api_version = api_version @@ -1036,6 +1090,7 @@ def deployments(self): * 2023-09-01-preview: :class:`DeploymentsOperations` * 2023-11-01-preview: :class:`DeploymentsOperations` * 2023-12-01: :class:`DeploymentsOperations` + * 2024-01-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2020-07-01': @@ -1074,6 +1129,8 @@ def deployments(self): from .v2023_11_01_preview.operations import DeploymentsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) self._config.api_version = api_version @@ -1091,6 +1148,7 @@ def dev_tool_portals(self): * 2023-09-01-preview: :class:`DevToolPortalsOperations` * 2023-11-01-preview: :class:`DevToolPortalsOperations` * 2023-12-01: :class:`DevToolPortalsOperations` + * 2024-01-01-preview: :class:`DevToolPortalsOperations` """ api_version = self._get_api_version('dev_tool_portals') if api_version == '2022-11-01-preview': @@ -1109,6 +1167,8 @@ def dev_tool_portals(self): from .v2023_11_01_preview.operations import DevToolPortalsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import DevToolPortalsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import DevToolPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dev_tool_portals'".format(api_version)) self._config.api_version = api_version @@ -1122,6 +1182,7 @@ def eureka_servers(self): * 2023-07-01-preview: :class:`EurekaServersOperations` * 2023-09-01-preview: :class:`EurekaServersOperations` * 2023-11-01-preview: :class:`EurekaServersOperations` + * 2024-01-01-preview: :class:`EurekaServersOperations` """ api_version = self._get_api_version('eureka_servers') if api_version == '2023-05-01-preview': @@ -1132,6 +1193,8 @@ def eureka_servers(self): from .v2023_09_01_preview.operations import EurekaServersOperations as OperationClass elif api_version == '2023-11-01-preview': from .v2023_11_01_preview.operations import EurekaServersOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import EurekaServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'eureka_servers'".format(api_version)) self._config.api_version = api_version @@ -1154,6 +1217,7 @@ def gateway_custom_domains(self): * 2023-09-01-preview: :class:`GatewayCustomDomainsOperations` * 2023-11-01-preview: :class:`GatewayCustomDomainsOperations` * 2023-12-01: :class:`GatewayCustomDomainsOperations` + * 2024-01-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': @@ -1182,6 +1246,8 @@ def gateway_custom_domains(self): from .v2023_11_01_preview.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import GatewayCustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) self._config.api_version = api_version @@ -1204,6 +1270,7 @@ def gateway_route_configs(self): * 2023-09-01-preview: :class:`GatewayRouteConfigsOperations` * 2023-11-01-preview: :class:`GatewayRouteConfigsOperations` * 2023-12-01: :class:`GatewayRouteConfigsOperations` + * 2024-01-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': @@ -1232,6 +1299,8 @@ def gateway_route_configs(self): from .v2023_11_01_preview.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import GatewayRouteConfigsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) self._config.api_version = api_version @@ -1254,6 +1323,7 @@ def gateways(self): * 2023-09-01-preview: :class:`GatewaysOperations` * 2023-11-01-preview: :class:`GatewaysOperations` * 2023-12-01: :class:`GatewaysOperations` + * 2024-01-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': @@ -1282,6 +1352,8 @@ def gateways(self): from .v2023_11_01_preview.operations import GatewaysOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import GatewaysOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) self._config.api_version = api_version @@ -1309,6 +1381,7 @@ def monitoring_settings(self): * 2023-09-01-preview: :class:`MonitoringSettingsOperations` * 2023-11-01-preview: :class:`MonitoringSettingsOperations` * 2023-12-01: :class:`MonitoringSettingsOperations` + * 2024-01-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -1347,6 +1420,8 @@ def monitoring_settings(self): from .v2023_11_01_preview.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) self._config.api_version = api_version @@ -1374,6 +1449,7 @@ def operations(self): * 2023-09-01-preview: :class:`Operations` * 2023-11-01-preview: :class:`Operations` * 2023-12-01: :class:`Operations` + * 2024-01-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2020-07-01': @@ -1412,6 +1488,8 @@ def operations(self): from .v2023_11_01_preview.operations import Operations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import Operations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -1429,6 +1507,7 @@ def predefined_accelerators(self): * 2023-09-01-preview: :class:`PredefinedAcceleratorsOperations` * 2023-11-01-preview: :class:`PredefinedAcceleratorsOperations` * 2023-12-01: :class:`PredefinedAcceleratorsOperations` + * 2024-01-01-preview: :class:`PredefinedAcceleratorsOperations` """ api_version = self._get_api_version('predefined_accelerators') if api_version == '2022-11-01-preview': @@ -1447,6 +1526,8 @@ def predefined_accelerators(self): from .v2023_11_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import PredefinedAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import PredefinedAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'predefined_accelerators'".format(api_version)) self._config.api_version = api_version @@ -1474,6 +1555,7 @@ def runtime_versions(self): * 2023-09-01-preview: :class:`RuntimeVersionsOperations` * 2023-11-01-preview: :class:`RuntimeVersionsOperations` * 2023-12-01: :class:`RuntimeVersionsOperations` + * 2024-01-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2020-07-01': @@ -1512,6 +1594,8 @@ def runtime_versions(self): from .v2023_11_01_preview.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) self._config.api_version = api_version @@ -1535,6 +1619,7 @@ def service_registries(self): * 2023-09-01-preview: :class:`ServiceRegistriesOperations` * 2023-11-01-preview: :class:`ServiceRegistriesOperations` * 2023-12-01: :class:`ServiceRegistriesOperations` + * 2024-01-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': @@ -1565,6 +1650,8 @@ def service_registries(self): from .v2023_11_01_preview.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) self._config.api_version = api_version @@ -1592,6 +1679,7 @@ def services(self): * 2023-09-01-preview: :class:`ServicesOperations` * 2023-11-01-preview: :class:`ServicesOperations` * 2023-12-01: :class:`ServicesOperations` + * 2024-01-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2020-07-01': @@ -1630,6 +1718,8 @@ def services(self): from .v2023_11_01_preview.operations import ServicesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import ServicesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) self._config.api_version = api_version @@ -1657,6 +1747,7 @@ def skus(self): * 2023-09-01-preview: :class:`SkusOperations` * 2023-11-01-preview: :class:`SkusOperations` * 2023-12-01: :class:`SkusOperations` + * 2024-01-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -1695,6 +1786,8 @@ def skus(self): from .v2023_11_01_preview.operations import SkusOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import SkusOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) self._config.api_version = api_version @@ -1718,6 +1811,7 @@ def storages(self): * 2023-09-01-preview: :class:`StoragesOperations` * 2023-11-01-preview: :class:`StoragesOperations` * 2023-12-01: :class:`StoragesOperations` + * 2024-01-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -1748,6 +1842,8 @@ def storages(self): from .v2023_11_01_preview.operations import StoragesOperations as OperationClass elif api_version == '2023-12-01': from .v2023_12_01.operations import StoragesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from .v2024_01_01_preview.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py index 631c55ff4557..ca4cae2bc9aa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py @@ -58,7 +58,6 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'eureka_servers': '2023-11-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -107,6 +106,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-09-01-preview: :mod:`v2023_09_01_preview.models` * 2023-11-01-preview: :mod:`v2023_11_01_preview.models` * 2023-12-01: :mod:`v2023_12_01.models` + * 2024-01-01-preview: :mod:`v2024_01_01_preview.models` """ if api_version == '2020-07-01': from ..v2020_07_01 import models @@ -162,6 +162,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-12-01': from ..v2023_12_01 import models return models + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -181,6 +184,7 @@ def api_portal_custom_domains(self): * 2023-09-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2023-11-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2023-12-01: :class:`ApiPortalCustomDomainsOperations` + * 2024-01-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': @@ -209,6 +213,8 @@ def api_portal_custom_domains(self): from ..v2023_11_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ApiPortalCustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) self._config.api_version = api_version @@ -231,6 +237,7 @@ def api_portals(self): * 2023-09-01-preview: :class:`ApiPortalsOperations` * 2023-11-01-preview: :class:`ApiPortalsOperations` * 2023-12-01: :class:`ApiPortalsOperations` + * 2024-01-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': @@ -259,6 +266,8 @@ def api_portals(self): from ..v2023_11_01_preview.aio.operations import ApiPortalsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ApiPortalsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) self._config.api_version = api_version @@ -273,6 +282,7 @@ def apms(self): * 2023-09-01-preview: :class:`ApmsOperations` * 2023-11-01-preview: :class:`ApmsOperations` * 2023-12-01: :class:`ApmsOperations` + * 2024-01-01-preview: :class:`ApmsOperations` """ api_version = self._get_api_version('apms') if api_version == '2023-05-01-preview': @@ -285,6 +295,8 @@ def apms(self): from ..v2023_11_01_preview.aio.operations import ApmsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ApmsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ApmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apms'".format(api_version)) self._config.api_version = api_version @@ -302,6 +314,7 @@ def application_accelerators(self): * 2023-09-01-preview: :class:`ApplicationAcceleratorsOperations` * 2023-11-01-preview: :class:`ApplicationAcceleratorsOperations` * 2023-12-01: :class:`ApplicationAcceleratorsOperations` + * 2024-01-01-preview: :class:`ApplicationAcceleratorsOperations` """ api_version = self._get_api_version('application_accelerators') if api_version == '2022-11-01-preview': @@ -320,6 +333,8 @@ def application_accelerators(self): from ..v2023_11_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ApplicationAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ApplicationAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application_accelerators'".format(api_version)) self._config.api_version = api_version @@ -337,6 +352,7 @@ def application_live_views(self): * 2023-09-01-preview: :class:`ApplicationLiveViewsOperations` * 2023-11-01-preview: :class:`ApplicationLiveViewsOperations` * 2023-12-01: :class:`ApplicationLiveViewsOperations` + * 2024-01-01-preview: :class:`ApplicationLiveViewsOperations` """ api_version = self._get_api_version('application_live_views') if api_version == '2022-11-01-preview': @@ -355,6 +371,8 @@ def application_live_views(self): from ..v2023_11_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ApplicationLiveViewsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ApplicationLiveViewsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application_live_views'".format(api_version)) self._config.api_version = api_version @@ -382,6 +400,7 @@ def apps(self): * 2023-09-01-preview: :class:`AppsOperations` * 2023-11-01-preview: :class:`AppsOperations` * 2023-12-01: :class:`AppsOperations` + * 2024-01-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2020-07-01': @@ -420,6 +439,8 @@ def apps(self): from ..v2023_11_01_preview.aio.operations import AppsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import AppsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) self._config.api_version = api_version @@ -447,6 +468,7 @@ def bindings(self): * 2023-09-01-preview: :class:`BindingsOperations` * 2023-11-01-preview: :class:`BindingsOperations` * 2023-12-01: :class:`BindingsOperations` + * 2024-01-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2020-07-01': @@ -485,6 +507,8 @@ def bindings(self): from ..v2023_11_01_preview.aio.operations import BindingsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import BindingsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) self._config.api_version = api_version @@ -508,6 +532,7 @@ def build_service(self): * 2023-09-01-preview: :class:`BuildServiceOperations` * 2023-11-01-preview: :class:`BuildServiceOperations` * 2023-12-01: :class:`BuildServiceOperations` + * 2024-01-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': @@ -538,6 +563,8 @@ def build_service(self): from ..v2023_11_01_preview.aio.operations import BuildServiceOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import BuildServiceOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) self._config.api_version = api_version @@ -561,6 +588,7 @@ def build_service_agent_pool(self): * 2023-09-01-preview: :class:`BuildServiceAgentPoolOperations` * 2023-11-01-preview: :class:`BuildServiceAgentPoolOperations` * 2023-12-01: :class:`BuildServiceAgentPoolOperations` + * 2024-01-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': @@ -591,6 +619,8 @@ def build_service_agent_pool(self): from ..v2023_11_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) self._config.api_version = api_version @@ -614,6 +644,7 @@ def build_service_builder(self): * 2023-09-01-preview: :class:`BuildServiceBuilderOperations` * 2023-11-01-preview: :class:`BuildServiceBuilderOperations` * 2023-12-01: :class:`BuildServiceBuilderOperations` + * 2024-01-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': @@ -644,6 +675,8 @@ def build_service_builder(self): from ..v2023_11_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) self._config.api_version = api_version @@ -667,6 +700,7 @@ def buildpack_binding(self): * 2023-09-01-preview: :class:`BuildpackBindingOperations` * 2023-11-01-preview: :class:`BuildpackBindingOperations` * 2023-12-01: :class:`BuildpackBindingOperations` + * 2024-01-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': @@ -697,6 +731,8 @@ def buildpack_binding(self): from ..v2023_11_01_preview.aio.operations import BuildpackBindingOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) self._config.api_version = api_version @@ -724,6 +760,7 @@ def certificates(self): * 2023-09-01-preview: :class:`CertificatesOperations` * 2023-11-01-preview: :class:`CertificatesOperations` * 2023-12-01: :class:`CertificatesOperations` + * 2024-01-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2020-07-01': @@ -762,6 +799,8 @@ def certificates(self): from ..v2023_11_01_preview.aio.operations import CertificatesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) self._config.api_version = api_version @@ -789,6 +828,7 @@ def config_servers(self): * 2023-09-01-preview: :class:`ConfigServersOperations` * 2023-11-01-preview: :class:`ConfigServersOperations` * 2023-12-01: :class:`ConfigServersOperations` + * 2024-01-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -827,6 +867,8 @@ def config_servers(self): from ..v2023_11_01_preview.aio.operations import ConfigServersOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ConfigServersOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) self._config.api_version = api_version @@ -850,6 +892,7 @@ def configuration_services(self): * 2023-09-01-preview: :class:`ConfigurationServicesOperations` * 2023-11-01-preview: :class:`ConfigurationServicesOperations` * 2023-12-01: :class:`ConfigurationServicesOperations` + * 2024-01-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': @@ -880,6 +923,8 @@ def configuration_services(self): from ..v2023_11_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) self._config.api_version = api_version @@ -895,6 +940,7 @@ def container_registries(self): * 2023-09-01-preview: :class:`ContainerRegistriesOperations` * 2023-11-01-preview: :class:`ContainerRegistriesOperations` * 2023-12-01: :class:`ContainerRegistriesOperations` + * 2024-01-01-preview: :class:`ContainerRegistriesOperations` """ api_version = self._get_api_version('container_registries') if api_version == '2023-03-01-preview': @@ -909,6 +955,8 @@ def container_registries(self): from ..v2023_11_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ContainerRegistriesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ContainerRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'container_registries'".format(api_version)) self._config.api_version = api_version @@ -936,6 +984,7 @@ def custom_domains(self): * 2023-09-01-preview: :class:`CustomDomainsOperations` * 2023-11-01-preview: :class:`CustomDomainsOperations` * 2023-12-01: :class:`CustomDomainsOperations` + * 2024-01-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2020-07-01': @@ -974,6 +1023,8 @@ def custom_domains(self): from ..v2023_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) self._config.api_version = api_version @@ -991,6 +1042,7 @@ def customized_accelerators(self): * 2023-09-01-preview: :class:`CustomizedAcceleratorsOperations` * 2023-11-01-preview: :class:`CustomizedAcceleratorsOperations` * 2023-12-01: :class:`CustomizedAcceleratorsOperations` + * 2024-01-01-preview: :class:`CustomizedAcceleratorsOperations` """ api_version = self._get_api_version('customized_accelerators') if api_version == '2022-11-01-preview': @@ -1009,6 +1061,8 @@ def customized_accelerators(self): from ..v2023_11_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import CustomizedAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import CustomizedAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'customized_accelerators'".format(api_version)) self._config.api_version = api_version @@ -1036,6 +1090,7 @@ def deployments(self): * 2023-09-01-preview: :class:`DeploymentsOperations` * 2023-11-01-preview: :class:`DeploymentsOperations` * 2023-12-01: :class:`DeploymentsOperations` + * 2024-01-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2020-07-01': @@ -1074,6 +1129,8 @@ def deployments(self): from ..v2023_11_01_preview.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) self._config.api_version = api_version @@ -1091,6 +1148,7 @@ def dev_tool_portals(self): * 2023-09-01-preview: :class:`DevToolPortalsOperations` * 2023-11-01-preview: :class:`DevToolPortalsOperations` * 2023-12-01: :class:`DevToolPortalsOperations` + * 2024-01-01-preview: :class:`DevToolPortalsOperations` """ api_version = self._get_api_version('dev_tool_portals') if api_version == '2022-11-01-preview': @@ -1109,6 +1167,8 @@ def dev_tool_portals(self): from ..v2023_11_01_preview.aio.operations import DevToolPortalsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import DevToolPortalsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import DevToolPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dev_tool_portals'".format(api_version)) self._config.api_version = api_version @@ -1122,6 +1182,7 @@ def eureka_servers(self): * 2023-07-01-preview: :class:`EurekaServersOperations` * 2023-09-01-preview: :class:`EurekaServersOperations` * 2023-11-01-preview: :class:`EurekaServersOperations` + * 2024-01-01-preview: :class:`EurekaServersOperations` """ api_version = self._get_api_version('eureka_servers') if api_version == '2023-05-01-preview': @@ -1132,6 +1193,8 @@ def eureka_servers(self): from ..v2023_09_01_preview.aio.operations import EurekaServersOperations as OperationClass elif api_version == '2023-11-01-preview': from ..v2023_11_01_preview.aio.operations import EurekaServersOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import EurekaServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'eureka_servers'".format(api_version)) self._config.api_version = api_version @@ -1154,6 +1217,7 @@ def gateway_custom_domains(self): * 2023-09-01-preview: :class:`GatewayCustomDomainsOperations` * 2023-11-01-preview: :class:`GatewayCustomDomainsOperations` * 2023-12-01: :class:`GatewayCustomDomainsOperations` + * 2024-01-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': @@ -1182,6 +1246,8 @@ def gateway_custom_domains(self): from ..v2023_11_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import GatewayCustomDomainsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) self._config.api_version = api_version @@ -1204,6 +1270,7 @@ def gateway_route_configs(self): * 2023-09-01-preview: :class:`GatewayRouteConfigsOperations` * 2023-11-01-preview: :class:`GatewayRouteConfigsOperations` * 2023-12-01: :class:`GatewayRouteConfigsOperations` + * 2024-01-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': @@ -1232,6 +1299,8 @@ def gateway_route_configs(self): from ..v2023_11_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import GatewayRouteConfigsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) self._config.api_version = api_version @@ -1254,6 +1323,7 @@ def gateways(self): * 2023-09-01-preview: :class:`GatewaysOperations` * 2023-11-01-preview: :class:`GatewaysOperations` * 2023-12-01: :class:`GatewaysOperations` + * 2024-01-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': @@ -1282,6 +1352,8 @@ def gateways(self): from ..v2023_11_01_preview.aio.operations import GatewaysOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import GatewaysOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) self._config.api_version = api_version @@ -1309,6 +1381,7 @@ def monitoring_settings(self): * 2023-09-01-preview: :class:`MonitoringSettingsOperations` * 2023-11-01-preview: :class:`MonitoringSettingsOperations` * 2023-12-01: :class:`MonitoringSettingsOperations` + * 2024-01-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -1347,6 +1420,8 @@ def monitoring_settings(self): from ..v2023_11_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) self._config.api_version = api_version @@ -1374,6 +1449,7 @@ def operations(self): * 2023-09-01-preview: :class:`Operations` * 2023-11-01-preview: :class:`Operations` * 2023-12-01: :class:`Operations` + * 2024-01-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2020-07-01': @@ -1412,6 +1488,8 @@ def operations(self): from ..v2023_11_01_preview.aio.operations import Operations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import Operations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -1429,6 +1507,7 @@ def predefined_accelerators(self): * 2023-09-01-preview: :class:`PredefinedAcceleratorsOperations` * 2023-11-01-preview: :class:`PredefinedAcceleratorsOperations` * 2023-12-01: :class:`PredefinedAcceleratorsOperations` + * 2024-01-01-preview: :class:`PredefinedAcceleratorsOperations` """ api_version = self._get_api_version('predefined_accelerators') if api_version == '2022-11-01-preview': @@ -1447,6 +1526,8 @@ def predefined_accelerators(self): from ..v2023_11_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import PredefinedAcceleratorsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import PredefinedAcceleratorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'predefined_accelerators'".format(api_version)) self._config.api_version = api_version @@ -1474,6 +1555,7 @@ def runtime_versions(self): * 2023-09-01-preview: :class:`RuntimeVersionsOperations` * 2023-11-01-preview: :class:`RuntimeVersionsOperations` * 2023-12-01: :class:`RuntimeVersionsOperations` + * 2024-01-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2020-07-01': @@ -1512,6 +1594,8 @@ def runtime_versions(self): from ..v2023_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) self._config.api_version = api_version @@ -1535,6 +1619,7 @@ def service_registries(self): * 2023-09-01-preview: :class:`ServiceRegistriesOperations` * 2023-11-01-preview: :class:`ServiceRegistriesOperations` * 2023-12-01: :class:`ServiceRegistriesOperations` + * 2024-01-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': @@ -1565,6 +1650,8 @@ def service_registries(self): from ..v2023_11_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) self._config.api_version = api_version @@ -1592,6 +1679,7 @@ def services(self): * 2023-09-01-preview: :class:`ServicesOperations` * 2023-11-01-preview: :class:`ServicesOperations` * 2023-12-01: :class:`ServicesOperations` + * 2024-01-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2020-07-01': @@ -1630,6 +1718,8 @@ def services(self): from ..v2023_11_01_preview.aio.operations import ServicesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import ServicesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) self._config.api_version = api_version @@ -1657,6 +1747,7 @@ def skus(self): * 2023-09-01-preview: :class:`SkusOperations` * 2023-11-01-preview: :class:`SkusOperations` * 2023-12-01: :class:`SkusOperations` + * 2024-01-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -1695,6 +1786,8 @@ def skus(self): from ..v2023_11_01_preview.aio.operations import SkusOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import SkusOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) self._config.api_version = api_version @@ -1718,6 +1811,7 @@ def storages(self): * 2023-09-01-preview: :class:`StoragesOperations` * 2023-11-01-preview: :class:`StoragesOperations` * 2023-12-01: :class:`StoragesOperations` + * 2024-01-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -1748,6 +1842,8 @@ def storages(self): from ..v2023_11_01_preview.aio.operations import StoragesOperations as OperationClass elif api_version == '2023-12-01': from ..v2023_12_01.aio.operations import StoragesOperations as OperationClass + elif api_version == '2024-01-01-preview': + from ..v2024_01_01_preview.aio.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py index e4707566b87a..3e2bc3234959 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/models.py @@ -4,5 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2023_11_01_preview.models import * from .v2023_12_01.models import * diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py new file mode 100644 index 000000000000..d0d782a6deec --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._app_platform_management_client import AppPlatformManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AppPlatformManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py new file mode 100644 index 000000000000..6ace1ffdb168 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_app_platform_management_client.py @@ -0,0 +1,293 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ( + ApiPortalCustomDomainsOperations, + ApiPortalsOperations, + ApmsOperations, + ApplicationAcceleratorsOperations, + ApplicationLiveViewsOperations, + AppsOperations, + BindingsOperations, + BuildServiceAgentPoolOperations, + BuildServiceBuilderOperations, + BuildServiceOperations, + BuildpackBindingOperations, + CertificatesOperations, + ConfigServersOperations, + ConfigurationServicesOperations, + ContainerRegistriesOperations, + CustomDomainsOperations, + CustomizedAcceleratorsOperations, + DeploymentsOperations, + DevToolPortalsOperations, + EurekaServersOperations, + GatewayCustomDomainsOperations, + GatewayRouteConfigsOperations, + GatewaysOperations, + MonitoringSettingsOperations, + Operations, + PredefinedAcceleratorsOperations, + RuntimeVersionsOperations, + ServiceRegistriesOperations, + ServicesOperations, + SkusOperations, + StoragesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2024_01_01_preview.operations.ServicesOperations + :ivar apms: ApmsOperations operations + :vartype apms: azure.mgmt.appplatform.v2024_01_01_preview.operations.ApmsOperations + :ivar eureka_servers: EurekaServersOperations operations + :vartype eureka_servers: + azure.mgmt.appplatform.v2024_01_01_preview.operations.EurekaServersOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ServiceRegistriesOperations + :ivar application_live_views: ApplicationLiveViewsOperations operations + :vartype application_live_views: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ApplicationLiveViewsOperations + :ivar dev_tool_portals: DevToolPortalsOperations operations + :vartype dev_tool_portals: + azure.mgmt.appplatform.v2024_01_01_preview.operations.DevToolPortalsOperations + :ivar container_registries: ContainerRegistriesOperations operations + :vartype container_registries: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ContainerRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2024_01_01_preview.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2024_01_01_preview.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2024_01_01_preview.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2024_01_01_preview.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2024_01_01_preview.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2024_01_01_preview.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2024_01_01_preview.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2024_01_01_preview.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2024_01_01_preview.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2024_01_01_preview.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ApiPortalCustomDomainsOperations + :ivar application_accelerators: ApplicationAcceleratorsOperations operations + :vartype application_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.operations.ApplicationAcceleratorsOperations + :ivar customized_accelerators: CustomizedAcceleratorsOperations operations + :vartype customized_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.operations.CustomizedAcceleratorsOperations + :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations + :vartype predefined_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.operations.PredefinedAcceleratorsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. 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 "2024-01-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.eureka_servers = EurekaServersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.configuration_services = ConfigurationServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.service_registries = ServiceRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.application_live_views = ApplicationLiveViewsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.dev_tool_portals = DevToolPortalsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.container_registries = ContainerRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service = BuildServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.buildpack_binding = BuildpackBindingOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service_builder = BuildServiceBuilderOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service_agent_pool = BuildServiceAgentPoolOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.gateways = GatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.gateway_route_configs = GatewayRouteConfigsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.gateway_custom_domains = GatewayCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.api_portals = ApiPortalsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.application_accelerators = ApplicationAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.customized_accelerators = CustomizedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.predefined_accelerators = PredefinedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "AppPlatformManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py new file mode 100644 index 000000000000..8e89cc48826a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-01-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(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json new file mode 100644 index 000000000000..e5e14774dd5d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_metadata.json @@ -0,0 +1,140 @@ +{ + "chosen_version": "2024-01-01-preview", + "total_api_version_list": ["2024-01-01-preview"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Apps.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "services": "ServicesOperations", + "apms": "ApmsOperations", + "eureka_servers": "EurekaServersOperations", + "config_servers": "ConfigServersOperations", + "configuration_services": "ConfigurationServicesOperations", + "service_registries": "ServiceRegistriesOperations", + "application_live_views": "ApplicationLiveViewsOperations", + "dev_tool_portals": "DevToolPortalsOperations", + "container_registries": "ContainerRegistriesOperations", + "build_service": "BuildServiceOperations", + "buildpack_binding": "BuildpackBindingOperations", + "build_service_builder": "BuildServiceBuilderOperations", + "build_service_agent_pool": "BuildServiceAgentPoolOperations", + "monitoring_settings": "MonitoringSettingsOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "storages": "StoragesOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations", + "gateways": "GatewaysOperations", + "gateway_route_configs": "GatewayRouteConfigsOperations", + "gateway_custom_domains": "GatewayCustomDomainsOperations", + "api_portals": "ApiPortalsOperations", + "api_portal_custom_domains": "ApiPortalCustomDomainsOperations", + "application_accelerators": "ApplicationAcceleratorsOperations", + "customized_accelerators": "CustomizedAcceleratorsOperations", + "predefined_accelerators": "PredefinedAcceleratorsOperations" + } +} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py new file mode 100644 index 000000000000..92453d8691d9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "6.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py new file mode 100644 index 000000000000..99174a0dabfc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._app_platform_management_client import AppPlatformManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AppPlatformManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 000000000000..90704ab36a9a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,293 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ( + ApiPortalCustomDomainsOperations, + ApiPortalsOperations, + ApmsOperations, + ApplicationAcceleratorsOperations, + ApplicationLiveViewsOperations, + AppsOperations, + BindingsOperations, + BuildServiceAgentPoolOperations, + BuildServiceBuilderOperations, + BuildServiceOperations, + BuildpackBindingOperations, + CertificatesOperations, + ConfigServersOperations, + ConfigurationServicesOperations, + ContainerRegistriesOperations, + CustomDomainsOperations, + CustomizedAcceleratorsOperations, + DeploymentsOperations, + DevToolPortalsOperations, + EurekaServersOperations, + GatewayCustomDomainsOperations, + GatewayRouteConfigsOperations, + GatewaysOperations, + MonitoringSettingsOperations, + Operations, + PredefinedAcceleratorsOperations, + RuntimeVersionsOperations, + ServiceRegistriesOperations, + ServicesOperations, + SkusOperations, + StoragesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ServicesOperations + :ivar apms: ApmsOperations operations + :vartype apms: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApmsOperations + :ivar eureka_servers: EurekaServersOperations operations + :vartype eureka_servers: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.EurekaServersOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ServiceRegistriesOperations + :ivar application_live_views: ApplicationLiveViewsOperations operations + :vartype application_live_views: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApplicationLiveViewsOperations + :ivar dev_tool_portals: DevToolPortalsOperations operations + :vartype dev_tool_portals: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.DevToolPortalsOperations + :ivar container_registries: ContainerRegistriesOperations operations + :vartype container_registries: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ContainerRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations + :ivar application_accelerators: ApplicationAcceleratorsOperations operations + :vartype application_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.ApplicationAcceleratorsOperations + :ivar customized_accelerators: CustomizedAcceleratorsOperations operations + :vartype customized_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.CustomizedAcceleratorsOperations + :ivar predefined_accelerators: PredefinedAcceleratorsOperations operations + :vartype predefined_accelerators: + azure.mgmt.appplatform.v2024_01_01_preview.aio.operations.PredefinedAcceleratorsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. 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 "2024-01-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.apms = ApmsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.eureka_servers = EurekaServersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.configuration_services = ConfigurationServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.service_registries = ServiceRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.application_live_views = ApplicationLiveViewsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.dev_tool_portals = DevToolPortalsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.container_registries = ContainerRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service = BuildServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.buildpack_binding = BuildpackBindingOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service_builder = BuildServiceBuilderOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.build_service_agent_pool = BuildServiceAgentPoolOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview") + self.gateways = GatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.gateway_route_configs = GatewayRouteConfigsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.gateway_custom_domains = GatewayCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.api_portals = ApiPortalsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.application_accelerators = ApplicationAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.customized_accelerators = CustomizedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + self.predefined_accelerators = PredefinedAcceleratorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-01-01-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..30b2ffbd30e3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-01-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(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-appplatform/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..66e2c3f17e29 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/__init__.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._services_operations import ServicesOperations +from ._apms_operations import ApmsOperations +from ._eureka_servers_operations import EurekaServersOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._application_live_views_operations import ApplicationLiveViewsOperations +from ._dev_tool_portals_operations import DevToolPortalsOperations +from ._container_registries_operations import ContainerRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._storages_operations import StoragesOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations +from ._application_accelerators_operations import ApplicationAcceleratorsOperations +from ._customized_accelerators_operations import CustomizedAcceleratorsOperations +from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ServicesOperations", + "ApmsOperations", + "EurekaServersOperations", + "ConfigServersOperations", + "ConfigurationServicesOperations", + "ServiceRegistriesOperations", + "ApplicationLiveViewsOperations", + "DevToolPortalsOperations", + "ContainerRegistriesOperations", + "BuildServiceOperations", + "BuildpackBindingOperations", + "BuildServiceBuilderOperations", + "BuildServiceAgentPoolOperations", + "MonitoringSettingsOperations", + "AppsOperations", + "BindingsOperations", + "StoragesOperations", + "CertificatesOperations", + "CustomDomainsOperations", + "DeploymentsOperations", + "Operations", + "RuntimeVersionsOperations", + "SkusOperations", + "GatewaysOperations", + "GatewayRouteConfigsOperations", + "GatewayCustomDomainsOperations", + "ApiPortalsOperations", + "ApiPortalCustomDomainsOperations", + "ApplicationAcceleratorsOperations", + "CustomizedAcceleratorsOperations", + "PredefinedAcceleratorsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..cd62b1d8f810 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,618 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_portal_custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiPortalCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`api_portal_custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> _models.ApiPortalCustomDomainResource: + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: Union[_models.ApiPortalCustomDomainResource, IO], + **kwargs: Any + ) -> _models.ApiPortalCustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): + _content = api_portal_custom_domain_resource + else: + _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: _models.ApiPortalCustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource + :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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: Union[_models.ApiPortalCustomDomainResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Is either a ApiPortalCustomDomainResource type or a IO type. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = 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, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalCustomDomainResource"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + 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("ApiPortalCustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py new file mode 100644 index 000000000000..38097b2f41ff --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_api_portals_operations.py @@ -0,0 +1,749 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_portals_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_domain_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApiPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`api_portals` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> _models.ApiPortalResource: + """Get the API portal and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO], + **kwargs: Any + ) -> _models.ApiPortalResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_resource, (IOBase, bytes)): + _content = api_portal_resource + else: + _json = self._serialize.body(api_portal_resource, "ApiPortalResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: _models.ApiPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + :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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Is either a + ApiPortalResource type or a IO type. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = 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, + service_name=service_name, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_portal_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + api_portal_name=api_portal_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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ApiPortalResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals" + } + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py new file mode 100644 index 000000000000..292ce9c11ac0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apms_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apms_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_list_secret_keys_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`apms` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ApmResource"]: + """Get collection of APMs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApmResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ApmResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmResource: + """Get the APM by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApmResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApmResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO], + **kwargs: Any + ) -> _models.ApmResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm_resource, (IOBase, bytes)): + _content = apm_resource + else: + _json = self._serialize.body(apm_resource, "ApmResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApmResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApmResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: _models.ApmResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource + :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 ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Is either a ApmResource + type or a IO type. Required. + :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = 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, + service_name=service_name, + apm_name=apm_name, + apm_resource=apm_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApmResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + apm_name=apm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @distributed_trace_async + async def list_secret_keys( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmSecretKeys: + """List keys of APM sensitive properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApmSecretKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmSecretKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) + + request = build_list_secret_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_secret_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApmSecretKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secret_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py new file mode 100644 index 000000000000..f402ca991080 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_accelerators_operations.py @@ -0,0 +1,600 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._application_accelerators_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApplicationAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`application_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationAcceleratorResource"]: + """Handle requests to list all application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ApplicationAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + """Get the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO], + **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_accelerator_resource, (IOBase, bytes)): + _content = application_accelerator_resource + else: + _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: _models.ApplicationAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource + :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 ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Is either a ApplicationAcceleratorResource type or a IO type. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationAcceleratorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = 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, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + application_accelerator_resource=application_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, application_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + application_accelerator_name=application_accelerator_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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py new file mode 100644 index 000000000000..af826a9aa842 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_application_live_views_operations.py @@ -0,0 +1,598 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._application_live_views_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApplicationLiveViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`application_live_views` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationLiveViewResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationLiveViewResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ApplicationLiveViewResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + """Get the Application Live and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationLiveViewResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO], + **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_live_view_resource, (IOBase, bytes)): + _content = application_live_view_resource + else: + _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: _models.ApplicationLiveViewResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource + :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 ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Is either a + ApplicationLiveViewResource type or a IO type. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationLiveViewResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = 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, + service_name=service_name, + application_live_view_name=application_live_view_name, + application_live_view_resource=application_live_view_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, application_live_view_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + application_live_view_name=application_live_view_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.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 000000000000..e8a3ea28a23c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,1319 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_resource_upload_url_request, + build_list_request, + build_set_active_deployments_request, + build_update_request, + build_validate_domain_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`apps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> _models.AppResource: + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + sync_status=sync_status, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Is either a AppResource + type or a IO type. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + app_name=app_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.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Is either a AppResource type or a IO + type. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("AppResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps" + } + + @distributed_trace_async + async def get_resource_upload_url( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> _models.ResourceUploadDefinition: + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resource_upload_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl" + } + + async def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(active_deployment_collection, (IOBase, bytes)): + _content = active_deployment_collection + else: + _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") + + request = build_set_active_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_active_deployments_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_active_deployments_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments" + } + + @overload + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: _models.ActiveDeploymentCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Is either a + ActiveDeploymentCollection type or a IO type. Required. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_active_deployments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments" + } + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 000000000000..9fc502c4c9f5 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,875 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`bindings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> _models.BindingResource: + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> _models.BindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BindingResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Is either a + BindingResource type or a IO type. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = 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, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, binding_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + app_name=app_name, + binding_name=binding_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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> _models.BindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Is either a BindingResource type + or a IO type. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = 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, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BindingResource"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + 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("BindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..133620898832 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,490 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_agent_pool_operations import ( + build_get_request, + build_list_request, + build_update_put_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceAgentPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`build_service_agent_pool` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceAgentPoolResource"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + 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("BuildServiceAgentPoolResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, build_service_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.BuildServiceAgentPoolResource: + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO], + **kwargs: Any + ) -> _models.BuildServiceAgentPoolResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool_resource, (IOBase, bytes)): + _content = agent_pool_resource + else: + _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: _models.BuildServiceAgentPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource + :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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Is either a + BuildServiceAgentPoolResource type or a IO type. Required. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..cab08c3a360e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_builder_operations.py @@ -0,0 +1,687 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_builder_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_deployments_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceBuilderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`build_service_builder` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.BuilderResource: + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_resource, (IOBase, bytes)): + _content = builder_resource + else: + _json = self._serialize.body(builder_resource, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource + :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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Is either a + BuilderResource type or a IO type. Required. + :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, build_service_name: str, builder_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + 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("BuilderResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders" + } + + @distributed_trace_async + async def list_deployments( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.DeploymentList: + """List deployments that are using the builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentList or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentList + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) + + request = build_list_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deployments.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeploymentList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_deployments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py new file mode 100644 index 000000000000..2690280c2cad --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_build_service_operations.py @@ -0,0 +1,1564 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_operations import ( + build_create_or_update_build_request, + build_create_or_update_request, + build_delete_build_request, + build_get_build_request, + build_get_build_result_log_request, + build_get_build_result_request, + build_get_build_service_request, + build_get_resource_upload_url_request, + build_get_supported_buildpack_request, + build_get_supported_stack_request, + build_list_build_results_request, + build_list_build_services_request, + build_list_builds_request, + build_list_supported_buildpacks_request, + build_list_supported_stacks_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`build_service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_build_services( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildService"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceCollection] = 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_build_services_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_build_services.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("BuildServiceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_build_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices" + } + + @distributed_trace_async + async def get_build_service( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.BuildService: + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + request = build_get_build_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_service.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO], + **kwargs: Any + ) -> _models.BuildService: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_service, (IOBase, bytes)): + _content = build_service + else: + _json = self._serialize.body(build_service, "BuildService") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildService", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildService", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: _models.BuildService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService + :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 BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Is either a BuildService type or a + IO type. Required. + :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = 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, + service_name=service_name, + build_service_name=build_service_name, + build_service=build_service, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildService", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + @distributed_trace + def list_builds( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Build"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Build or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildCollection] = 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_builds_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_builds.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("BuildCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_builds.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds" + } + + @distributed_trace_async + async def get_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> _models.Build: + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + request = build_get_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Build", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @overload + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: _models.Build, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :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: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: Union[_models.Build, IO], + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Is either a Build type or a IO + type. Required. + :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build, (IOBase, bytes)): + _content = build + else: + _json = self._serialize.body(build, "Build") + + request = build_create_or_update_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_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_build.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Build", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Build", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + async def _delete_build_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, build_service_name: str, build_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_build_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_build_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @distributed_trace_async + async def begin_delete_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """delete a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_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._api_version or "2024-01-01-preview") + ) + 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_build_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @distributed_trace + def list_build_results( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResult"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResultCollection] = 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_build_results_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_build_results.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("BuildResultCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_build_results.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results" + } + + @distributed_trace_async + async def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> _models.BuildResult: + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) + + request = build_get_build_result_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_result.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}" + } + + @distributed_trace_async + async def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> _models.BuildResultLog: + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultLog + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) + + request = build_get_build_result_log_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_result_log.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResultLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl" + } + + @distributed_trace_async + async def get_resource_upload_url( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.ResourceUploadDefinition: + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resource_upload_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl" + } + + @distributed_trace_async + async def list_supported_buildpacks( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.SupportedBuildpacksCollection: + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpacksCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) + + request = build_list_supported_buildpacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_buildpacks.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedBuildpacksCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks" + } + + @distributed_trace_async + async def get_supported_buildpack( + self, resource_group_name: str, service_name: str, build_service_name: str, buildpack_name: str, **kwargs: Any + ) -> _models.SupportedBuildpackResource: + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. Required. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) + + request = build_get_supported_buildpack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_supported_buildpack.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedBuildpackResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}" + } + + @distributed_trace_async + async def list_supported_stacks( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.SupportedStacksCollection: + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStacksCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) + + request = build_list_supported_stacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_stacks.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedStacksCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks" + } + + @distributed_trace_async + async def get_supported_stack( + self, resource_group_name: str, service_name: str, build_service_name: str, stack_name: str, **kwargs: Any + ) -> _models.SupportedStackResource: + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param stack_name: The name of the stack resource. Required. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) + + request = build_get_supported_stack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_supported_stack.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedStackResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..dcfd32b3a73a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_buildpack_binding_operations.py @@ -0,0 +1,754 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._buildpack_binding_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_for_cluster_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildpackBindingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`buildpack_binding` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_for_cluster( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResource"]: + """Get collection of buildpack bindings under all builders. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResourceCollection] = 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_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_for_cluster.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("BuildpackBindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_for_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> _models.BuildpackBindingResource: + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: Union[_models.BuildpackBindingResource, IO], + **kwargs: Any + ) -> _models.BuildpackBindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(buildpack_binding, (IOBase, bytes)): + _content = buildpack_binding + else: + _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: _models.BuildpackBindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource + :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 BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: Union[_models.BuildpackBindingResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. Is + either a BuildpackBindingResource type or a IO type. Required. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResource"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + 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("BuildpackBindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..b88a0521ad6c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,596 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._certificates_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`certificates` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateResource: + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO], + **kwargs: Any + ) -> _models.CertificateResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_resource, (IOBase, bytes)): + _content = certificate_resource + else: + _json = self._serialize.body(certificate_resource, "CertificateResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: _models.CertificateResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource + :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 CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Is either a + CertificateResource type or a IO type. Required. + :type certificate_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = 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, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CertificateResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, certificate_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + certificate_name=certificate_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.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CertificateResource"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("CertificateResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 000000000000..12fa37ea7ac9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_config_servers_operations.py @@ -0,0 +1,828 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._config_servers_operations import ( + build_get_request, + build_update_patch_request, + build_update_put_request, + build_validate_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`config_servers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ConfigServerResource: + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> _models.ConfigServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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 ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO type. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> _models.ConfigServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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 ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO type. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO], + **kwargs: Any + ) -> _models.ConfigServerSettingsValidateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_settings, (IOBase, bytes)): + _content = config_server_settings + else: + _json = self._serialize.body(config_server_settings, "ConfigServerSettings") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate" + } + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: _models.ConfigServerSettings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings + :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 ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Is either a + ConfigServerSettings type or a IO type. Required. + :type config_server_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..721906d88dad --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_configuration_services_operations.py @@ -0,0 +1,1098 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._configuration_services_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, + build_validate_resource_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConfigurationServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`configuration_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> _models.ConfigurationServiceResource: + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> _models.ConfigurationServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Is either a + ConfigurationServiceResource type or a IO type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = 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, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, configuration_service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + configuration_service_name=configuration_service_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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationServiceResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ConfigurationServiceResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices" + } + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO], + **kwargs: Any + ) -> _models.ConfigurationServiceSettingsValidateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(settings, (IOBase, bytes)): + _content = settings + else: + _json = self._serialize.body(settings, "ConfigurationServiceSettings") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate" + } + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: _models.ConfigurationServiceSettings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Is either a + ConfigurationServiceSettings type or a IO type. Required. + :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate" + } + + async def _validate_resource_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> Optional[_models.ConfigurationServiceSettingsValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConfigurationServiceSettingsValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + request = build_validate_resource_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_resource_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_resource_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource" + } + + @overload + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Is either a ConfigurationServiceResource type or a IO type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = 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._validate_resource_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py new file mode 100644 index 000000000000..ac14e6c90192 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_container_registries_operations.py @@ -0,0 +1,853 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_registries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`container_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerRegistryResource"]: + """List container registries resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ContainerRegistryResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> _models.ContainerRegistryResource: + """Get the container registries resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO], + **kwargs: Any + ) -> _models.ContainerRegistryResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_resource, (IOBase, bytes)): + _content = container_registry_resource + else: + _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: _models.ContainerRegistryResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource + :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 ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Is either a + ContainerRegistryResource type or a IO type. Required. + :type container_registry_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = 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, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_resource=container_registry_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + container_registry_name=container_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO], + **kwargs: Any + ) -> Optional[_models.ContainerRegistryValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ContainerRegistryValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_properties, (IOBase, bytes)): + _content = container_registry_properties + else: + _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate" + } + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: _models.ContainerRegistryProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties + :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 ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Is either a + ContainerRegistryProperties type or a IO type. Required. + :type container_registry_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerRegistryValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_properties=container_registry_properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..bc95c0828943 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,876 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> _models.CustomDomainResource: + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> _models.CustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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 CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO type. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = 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, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + app_name=app_name, + domain_name=domain_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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> _models.CustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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 CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO type. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = 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, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResource"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + 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("CustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py new file mode 100644 index 000000000000..c9431f0b56ea --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_customized_accelerators_operations.py @@ -0,0 +1,898 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._customized_accelerators_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_validate_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CustomizedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`customized_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomizedAcceleratorResource"]: + """Handle requests to list all customized accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomizedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + 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("CustomizedAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + """Get the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomizedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO], + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(customized_accelerator_resource, (IOBase, bytes)): + _content = customized_accelerator_resource + else: + _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: _models.CustomizedAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource + :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 CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Is either a CustomizedAcceleratorResource type or a IO type. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = 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, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + customized_accelerator_resource=customized_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO], + **kwargs: Any + ) -> Optional[_models.CustomizedAcceleratorValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate" + } + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: _models.CustomizedAcceleratorProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties + :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 CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Is either a + CustomizedAcceleratorProperties type or a IO type. Required. + :type properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomizedAcceleratorValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..e4dec448043e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,2650 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deployments_operations import ( + build_create_or_update_request, + build_delete_request, + build_disable_remote_debugging_request, + build_enable_remote_debugging_request, + build_generate_heap_dump_request, + build_generate_thread_dump_request, + build_get_log_file_url_request, + build_get_remote_debugging_config_request, + build_get_request, + build_list_for_cluster_request, + build_list_request, + build_restart_request, + build_start_jfr_request, + build_start_request, + build_stop_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`deployments` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentResource: + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> _models.DeploymentResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Is either a + DeploymentResource type or a IO type. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = 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, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> _models.DeploymentResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource + type or a IO type. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = 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, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResource"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments" + } + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResource"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResourceCollection] = 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_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + template_url=self.list_for_cluster.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("DeploymentResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_for_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments" + } + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start" + } + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop" + } + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart" + } + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart" + } + + async def _enable_remote_debugging_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO]] = None, + **kwargs: Any + ) -> _models.RemoteDebugging: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remote_debugging_payload, (IOBase, bytes)): + _content = remote_debugging_payload + else: + if remote_debugging_payload is not None: + _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") + else: + _json = None + + request = build_enable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._enable_remote_debugging_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _enable_remote_debugging_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging" + } + + @overload + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload + :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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Is either a + RemoteDebuggingPayload type or a IO type. Default value is None. + :type remote_debugging_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = 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._enable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + remote_debugging_payload=remote_debugging_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_remote_debugging.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging" + } + + async def _disable_remote_debugging_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + request = build_disable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_remote_debugging_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _disable_remote_debugging_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging" + } + + @distributed_trace_async + async def begin_disable_remote_debugging( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RemoteDebugging]: + """Disable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = 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._disable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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): + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_remote_debugging.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging" + } + + @distributed_trace_async + async def get_remote_debugging_config( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + """Get remote debugging config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RemoteDebugging or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + request = build_get_remote_debugging_config_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_remote_debugging_config.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_remote_debugging_config.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig" + } + + @distributed_trace_async + async def get_log_file_url( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Optional[_models.LogFileUrlResponse]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse or None or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.LogFileUrlResponse or 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) + + request = build_get_log_file_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_file_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("LogFileUrlResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl" + } + + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_generate_heap_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_heap_dump_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump" + } + + @overload + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 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: + """ + + @distributed_trace_async + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2024-01-01-preview") + ) + 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._generate_heap_dump_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + 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_generate_heap_dump.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump" + } + + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_generate_thread_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_thread_dump_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump" + } + + @overload + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 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: + """ + + @distributed_trace_async + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2024-01-01-preview") + ) + 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._generate_thread_dump_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + 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_generate_thread_dump.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump" + } + + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_start_jfr_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_jfr_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR" + } + + @overload + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 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: + """ + + @distributed_trace_async + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2024-01-01-preview") + ) + 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._start_jfr_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + 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_start_jfr.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py new file mode 100644 index 000000000000..07eb317c7c19 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_dev_tool_portals_operations.py @@ -0,0 +1,598 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dev_tool_portals_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DevToolPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`dev_tool_portals` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DevToolPortalResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("DevToolPortalResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> _models.DevToolPortalResource: + """Get the Application Live and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DevToolPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO], + **kwargs: Any + ) -> _models.DevToolPortalResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dev_tool_portal_resource, (IOBase, bytes)): + _content = dev_tool_portal_resource + else: + _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: _models.DevToolPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource + :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 DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a + DevToolPortalResource type or a IO type. Required. + :type dev_tool_portal_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DevToolPortalResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = 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, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + dev_tool_portal_resource=dev_tool_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, dev_tool_portal_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py new file mode 100644 index 000000000000..5fd1e1953c5b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_eureka_servers_operations.py @@ -0,0 +1,669 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._eureka_servers_operations import ( + build_get_request, + build_list_request, + build_update_patch_request, + build_update_put_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EurekaServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`eureka_servers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.EurekaServerResourceCollection: + """List the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EurekaServerResourceCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResourceCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EurekaServerResourceCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: + """Get the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EurekaServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> _models.EurekaServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(eureka_server_resource, (IOBase, bytes)): + _content = eureka_server_resource + else: + _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: _models.EurekaServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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 EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Is either a + EurekaServerResource type or a IO type. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + eureka_server_resource=eureka_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> _models.EurekaServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(eureka_server_resource, (IOBase, bytes)): + _content = eureka_server_resource + else: + _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: _models.EurekaServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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 EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Is either a + EurekaServerResource type or a IO type. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EurekaServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + eureka_server_resource=eureka_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..a497f3afe214 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,618 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateway_custom_domains_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewayCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`gateway_custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> _models.GatewayCustomDomainResource: + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: Union[_models.GatewayCustomDomainResource, IO], + **kwargs: Any + ) -> _models.GatewayCustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): + _content = gateway_custom_domain_resource + else: + _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: _models.GatewayCustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource + :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 GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: Union[_models.GatewayCustomDomainResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Is either a GatewayCustomDomainResource type or a IO type. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayCustomDomainResource"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + 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("GatewayCustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..ebfe57cdfae7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -0,0 +1,621 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateway_route_configs_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewayRouteConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`gateway_route_configs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> _models.GatewayRouteConfigResource: + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: Union[_models.GatewayRouteConfigResource, IO], + **kwargs: Any + ) -> _models.GatewayRouteConfigResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_route_config_resource, (IOBase, bytes)): + _content = gateway_route_config_resource + else: + _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: _models.GatewayRouteConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource + :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 GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: Union[_models.GatewayRouteConfigResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Is either a GatewayRouteConfigResource type or a IO type. Required. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayRouteConfigResource"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + 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("GatewayRouteConfigResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py new file mode 100644 index 000000000000..fe68085fd0b7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_gateways_operations.py @@ -0,0 +1,1197 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateways_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_env_secrets_request, + build_list_request, + build_restart_request, + build_update_capacity_request, + build_validate_domain_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> _models.GatewayResource: + """Get the Spring Cloud Gateway and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO], + **kwargs: Any + ) -> _models.GatewayResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_resource, (IOBase, bytes)): + _content = gateway_resource + else: + _json = self._serialize.body(gateway_resource, "GatewayResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: _models.GatewayResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Is either a + GatewayResource type or a IO type. Required. + :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + async def _update_capacity_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: Union[_models.SkuObject, IO], + **kwargs: Any + ) -> Optional[_models.GatewayResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GatewayResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_capacity_resource, (IOBase, bytes)): + _content = gateway_capacity_resource + else: + _json = self._serialize.body(gateway_capacity_resource, "SkuObject") + + request = build_update_capacity_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_capacity_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_capacity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @overload + async def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: _models.SkuObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Required. + :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Required. + :type gateway_capacity_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: Union[_models.SkuObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a + SkuObject type or a IO type. Required. + :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = 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_capacity_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + gateway_capacity_resource=gateway_capacity_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_capacity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + gateway_name=gateway_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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @distributed_trace_async + async def list_env_secrets( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Dict[str, str]: + """List sensitive environment variables of Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to str or the result of cls(response) + :rtype: dict[str, str] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) + + request = build_list_env_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_env_secrets.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("{str}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_env_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets" + } + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart" + } + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_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._api_version or "2024-01-01-preview") + ) + 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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GatewayResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("GatewayResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways" + } + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..5ed632680010 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,593 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._monitoring_settings_operations import ( + build_get_request, + build_update_patch_request, + build_update_put_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MonitoringSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`monitoring_settings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.MonitoringSettingResource: + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> _models.MonitoringSettingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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 MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO type. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> _models.MonitoringSettingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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 MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO type. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..f98b6bcac837 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationDetail or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.AppPlatform/operations"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py new file mode 100644 index 000000000000..377cee060869 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_predefined_accelerators_operations.py @@ -0,0 +1,515 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._predefined_accelerators_operations import ( + build_disable_request, + build_enable_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PredefinedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`predefined_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PredefinedAcceleratorResource"]: + """Handle requests to list all predefined accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PredefinedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + 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("PredefinedAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> _models.PredefinedAcceleratorResource: + """Get the predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PredefinedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PredefinedAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}" + } + + async def _disable_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable" + } + + @distributed_trace_async + async def begin_disable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + 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._disable_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_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_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable" + } + + async def _enable_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable" + } + + @distributed_trace_async + async def begin_enable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + 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._enable_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_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_enable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..b1e5f335c8fe --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,106 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._runtime_versions_operations import build_list_runtime_versions_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RuntimeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`runtime_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AvailableRuntimeVersions + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailableRuntimeVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {"url": "/providers/Microsoft.AppPlatform/runtimeVersions"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py new file mode 100644 index 000000000000..8bf9017a3102 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_service_registries_operations.py @@ -0,0 +1,480 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_registries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`service_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> _models.ServiceRegistryResource: + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> _models.ServiceRegistryResource: + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceRegistryResource]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_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 ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = 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, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **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.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServiceRegistryResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("ServiceRegistryResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py new file mode 100644 index 000000000000..b7c1cd79e45c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,2380 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._services_operations import ( + build_check_name_availability_request, + build_create_or_update_request, + build_delete_request, + build_disable_apm_globally_request, + build_disable_test_endpoint_request, + build_enable_apm_globally_request, + build_enable_test_endpoint_request, + build_flush_vnet_dns_setting_request, + build_get_request, + build_list_by_subscription_request, + build_list_globally_enabled_apms_request, + build_list_request, + build_list_supported_apm_types_request, + build_list_supported_server_versions_request, + build_list_test_keys_request, + build_regenerate_test_key_request, + build_start_request, + build_stop_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ServiceResource: + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> _models.ServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Is either a ServiceResource + type or a IO type. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_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.AppPlatform/Spring/{serviceName}" + } + + async def _update_initial( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> _models.ServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Is either a ServiceResource type or a IO + type. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @distributed_trace_async + async def list_test_keys(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.TestKeys: + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + request = build_list_test_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_test_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys" + } + + @overload + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload + :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: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO], + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Is either a + RegenerateTestKeyRequestPayload type or a IO type. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_test_key_request, (IOBase, bytes)): + _content = regenerate_test_key_request + else: + _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") + + request = build_regenerate_test_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_test_key.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey" + } + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.disable_test_endpoint.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint" + } + + @distributed_trace_async + async def enable_test_endpoint( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.TestKeys: + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + request = build_enable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.enable_test_endpoint.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + } + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop" + } + + @distributed_trace_async + async def begin_stop(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Stop a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_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_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop" + } + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + } + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start" + } + + @distributed_trace_async + async def begin_start(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Start a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_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_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start" + } + + async def _flush_vnet_dns_setting_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_flush_vnet_dns_setting_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._flush_vnet_dns_setting_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _flush_vnet_dns_setting_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings" + } + + @distributed_trace_async + async def begin_flush_vnet_dns_setting( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Flush Virtual Network DNS settings for a VNET injected Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + 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._flush_vnet_dns_setting_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_flush_vnet_dns_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings" + } + + @distributed_trace + def list_supported_apm_types( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SupportedApmType"]: + """List supported APM types for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SupportedApmType or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedApmTypes] = 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_supported_apm_types_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_apm_types.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("SupportedApmTypes", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_supported_apm_types.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes" + } + + @distributed_trace_async + async def list_globally_enabled_apms( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.GloballyEnabledApms: + """List globally enabled APMs for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GloballyEnabledApms or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GloballyEnabledApms + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) + + request = build_list_globally_enabled_apms_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_globally_enabled_apms.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GloballyEnabledApms", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_globally_enabled_apms.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms" + } + + async def _enable_apm_globally_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + request = build_enable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._enable_apm_globally_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_apm_globally_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally" + } + + @overload + async def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference + :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: + """ + + @overload + async def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Is either a ApmReference type or a IO + type. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2024-01-01-preview") + ) + 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._enable_apm_globally_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_apm_globally.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally" + } + + async def _disable_apm_globally_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + request = build_disable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disable_apm_globally_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_apm_globally_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally" + } + + @overload + async def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference + :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: + """ + + @overload + async def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_disable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Is either a ApmReference type or a IO + type. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2024-01-01-preview") + ) + 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._disable_apm_globally_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_apm_globally.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally" + } + + @overload + async def check_name_availability( + self, + location: str, + availability_parameters: _models.NameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters + :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: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, location: str, availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, location: str, availability_parameters: Union[_models.NameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO type. Required. + :type availability_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(availability_parameters, (IOBase, bytes)): + _content = availability_parameters + else: + _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") + + request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailability", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResourceList] = 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, + 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("ServiceResourceList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ServiceResource"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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 ServiceResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + } + + @distributed_trace + def list_supported_server_versions( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SupportedServerVersion"]: + """Lists all of the available server versions supported by Microsoft.AppPlatform provider. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SupportedServerVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedServerVersions] = 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_supported_server_versions_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_server_versions.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("SupportedServerVersions", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_supported_server_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..5ba58529e0ed --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_skus_operations.py @@ -0,0 +1,137 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`skus` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSku or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + 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("ResourceSkuCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py new file mode 100644 index 000000000000..666ee260adf6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/aio/operations/_storages_operations.py @@ -0,0 +1,595 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storages_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.aio.AppPlatformManagementClient`'s + :attr:`storages` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> _models.StorageResource: + """Get the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StorageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO], + **kwargs: Any + ) -> _models.StorageResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_resource, (IOBase, bytes)): + _content = storage_resource + else: + _json = self._serialize.body(storage_resource, "StorageResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StorageResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StorageResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("StorageResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: _models.StorageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource + :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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Is either a + StorageResource type or a IO type. Required. + :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = 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, + service_name=service_name, + storage_name=storage_name, + storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, storage_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_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._api_version or "2024-01-01-preview") + ) + 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, + service_name=service_name, + storage_name=storage_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.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.StorageResource"]: + """List all the storages of one Azure Spring Apps resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + 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("StorageResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py new file mode 100644 index 000000000000..4540a6d22c63 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/__init__.py @@ -0,0 +1,647 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AcceleratorAuthSetting +from ._models_py3 import AcceleratorBasicAuthSetting +from ._models_py3 import AcceleratorGitRepository +from ._models_py3 import AcceleratorPublicSetting +from ._models_py3 import AcceleratorSshSetting +from ._models_py3 import ActiveDeploymentCollection +from ._models_py3 import ApiPortalCustomDomainProperties +from ._models_py3 import ApiPortalCustomDomainResource +from ._models_py3 import ApiPortalCustomDomainResourceCollection +from ._models_py3 import ApiPortalInstance +from ._models_py3 import ApiPortalProperties +from ._models_py3 import ApiPortalResource +from ._models_py3 import ApiPortalResourceCollection +from ._models_py3 import ApiPortalResourceRequests +from ._models_py3 import ApmProperties +from ._models_py3 import ApmReference +from ._models_py3 import ApmResource +from ._models_py3 import ApmResourceCollection +from ._models_py3 import ApmSecretKeys +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import AppVNetAddons +from ._models_py3 import ApplicationAcceleratorComponent +from ._models_py3 import ApplicationAcceleratorInstance +from ._models_py3 import ApplicationAcceleratorProperties +from ._models_py3 import ApplicationAcceleratorResource +from ._models_py3 import ApplicationAcceleratorResourceCollection +from ._models_py3 import ApplicationAcceleratorResourceRequests +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import ApplicationLiveViewComponent +from ._models_py3 import ApplicationLiveViewInstance +from ._models_py3 import ApplicationLiveViewProperties +from ._models_py3 import ApplicationLiveViewResource +from ._models_py3 import ApplicationLiveViewResourceCollection +from ._models_py3 import ApplicationLiveViewResourceRequests +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import AzureFileVolume +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import Build +from ._models_py3 import BuildCollection +from ._models_py3 import BuildProperties +from ._models_py3 import BuildResourceRequests +from ._models_py3 import BuildResult +from ._models_py3 import BuildResultCollection +from ._models_py3 import BuildResultLog +from ._models_py3 import BuildResultProperties +from ._models_py3 import BuildResultUserSourceInfo +from ._models_py3 import BuildService +from ._models_py3 import BuildServiceAgentPoolProperties +from ._models_py3 import BuildServiceAgentPoolResource +from ._models_py3 import BuildServiceAgentPoolResourceCollection +from ._models_py3 import BuildServiceAgentPoolSizeProperties +from ._models_py3 import BuildServiceCollection +from ._models_py3 import BuildServiceProperties +from ._models_py3 import BuildServicePropertiesResourceRequests +from ._models_py3 import BuildStageProperties +from ._models_py3 import BuilderProperties +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceCollection +from ._models_py3 import BuildpackBindingLaunchProperties +from ._models_py3 import BuildpackBindingProperties +from ._models_py3 import BuildpackBindingResource +from ._models_py3 import BuildpackBindingResourceCollection +from ._models_py3 import BuildpackProperties +from ._models_py3 import BuildpacksGroupProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateReference +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import ConfigurationServiceGitProperty +from ._models_py3 import ConfigurationServiceGitPropertyValidateResult +from ._models_py3 import ConfigurationServiceGitRepository +from ._models_py3 import ConfigurationServiceInstance +from ._models_py3 import ConfigurationServiceProperties +from ._models_py3 import ConfigurationServiceResource +from ._models_py3 import ConfigurationServiceResourceCollection +from ._models_py3 import ConfigurationServiceResourceRequests +from ._models_py3 import ConfigurationServiceSettings +from ._models_py3 import ConfigurationServiceSettingsValidateResult +from ._models_py3 import ContainerProbeSettings +from ._models_py3 import ContainerRegistryBasicCredentials +from ._models_py3 import ContainerRegistryCredentials +from ._models_py3 import ContainerRegistryProperties +from ._models_py3 import ContainerRegistryResource +from ._models_py3 import ContainerRegistryResourceCollection +from ._models_py3 import ContainerRegistryValidateResult +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomContainer +from ._models_py3 import CustomContainerUserSourceInfo +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import CustomPersistentDiskProperties +from ._models_py3 import CustomPersistentDiskResource +from ._models_py3 import CustomScaleRule +from ._models_py3 import CustomizedAcceleratorProperties +from ._models_py3 import CustomizedAcceleratorResource +from ._models_py3 import CustomizedAcceleratorResourceCollection +from ._models_py3 import CustomizedAcceleratorValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentList +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import DevToolPortalComponent +from ._models_py3 import DevToolPortalFeatureDetail +from ._models_py3 import DevToolPortalFeatureSettings +from ._models_py3 import DevToolPortalInstance +from ._models_py3 import DevToolPortalProperties +from ._models_py3 import DevToolPortalResource +from ._models_py3 import DevToolPortalResourceCollection +from ._models_py3 import DevToolPortalResourceRequests +from ._models_py3 import DevToolPortalSsoProperties +from ._models_py3 import DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import EurekaServerProperties +from ._models_py3 import EurekaServerResource +from ._models_py3 import EurekaServerResourceCollection +from ._models_py3 import ExecAction +from ._models_py3 import GatewayApiMetadataProperties +from ._models_py3 import GatewayApiRoute +from ._models_py3 import GatewayCorsProperties +from ._models_py3 import GatewayCustomDomainProperties +from ._models_py3 import GatewayCustomDomainResource +from ._models_py3 import GatewayCustomDomainResourceCollection +from ._models_py3 import GatewayInstance +from ._models_py3 import GatewayLocalResponseCachePerInstanceProperties +from ._models_py3 import GatewayLocalResponseCachePerRouteProperties +from ._models_py3 import GatewayOperatorProperties +from ._models_py3 import GatewayOperatorResourceRequests +from ._models_py3 import GatewayProperties +from ._models_py3 import GatewayPropertiesClientAuth +from ._models_py3 import GatewayPropertiesEnvironmentVariables +from ._models_py3 import GatewayResource +from ._models_py3 import GatewayResourceCollection +from ._models_py3 import GatewayResourceRequests +from ._models_py3 import GatewayResponseCacheProperties +from ._models_py3 import GatewayRouteConfigOpenApiProperties +from ._models_py3 import GatewayRouteConfigProperties +from ._models_py3 import GatewayRouteConfigResource +from ._models_py3 import GatewayRouteConfigResourceCollection +from ._models_py3 import GitPatternRepository +from ._models_py3 import GloballyEnabledApms +from ._models_py3 import HTTPGetAction +from ._models_py3 import HttpScaleRule +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import IngressConfig +from ._models_py3 import IngressSettings +from ._models_py3 import IngressSettingsClientAuth +from ._models_py3 import JarUploadedUserSourceInfo +from ._models_py3 import KeyVaultCertificateProperties +from ._models_py3 import LoadedCertificate +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import MaintenanceScheduleConfiguration +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MarketplaceResource +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetCoreZipUploadedUserSourceInfo +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import PredefinedAcceleratorProperties +from ._models_py3 import PredefinedAcceleratorResource +from ._models_py3 import PredefinedAcceleratorResourceCollection +from ._models_py3 import Probe +from ._models_py3 import ProbeAction +from ._models_py3 import ProxyResource +from ._models_py3 import QueueScaleRule +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RemoteDebugging +from ._models_py3 import RemoteDebuggingPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import Scale +from ._models_py3 import ScaleRule +from ._models_py3 import ScaleRuleAuth +from ._models_py3 import Secret +from ._models_py3 import ServiceRegistryInstance +from ._models_py3 import ServiceRegistryProperties +from ._models_py3 import ServiceRegistryResource +from ._models_py3 import ServiceRegistryResourceCollection +from ._models_py3 import ServiceRegistryResourceRequests +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import ServiceVNetAddons +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuObject +from ._models_py3 import SourceUploadedUserSourceInfo +from ._models_py3 import SsoProperties +from ._models_py3 import StackProperties +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProperties +from ._models_py3 import StorageResource +from ._models_py3 import StorageResourceCollection +from ._models_py3 import SupportedApmType +from ._models_py3 import SupportedApmTypes +from ._models_py3 import SupportedBuildpackResource +from ._models_py3 import SupportedBuildpackResourceProperties +from ._models_py3 import SupportedBuildpacksCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SupportedServerVersion +from ._models_py3 import SupportedServerVersions +from ._models_py3 import SupportedStackResource +from ._models_py3 import SupportedStackResourceProperties +from ._models_py3 import SupportedStacksCollection +from ._models_py3 import SystemData +from ._models_py3 import TCPSocketAction +from ._models_py3 import TcpScaleRule +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import TriggeredBuildResult +from ._models_py3 import UploadedUserSourceInfo +from ._models_py3 import UserAssignedManagedIdentity +from ._models_py3 import UserSourceInfo +from ._models_py3 import ValidationMessages +from ._models_py3 import WarUploadedUserSourceInfo +from ._models_py3 import WeeklyMaintenanceScheduleConfiguration + +from ._app_platform_management_client_enums import ActionType +from ._app_platform_management_client_enums import ApiPortalApiTryOutEnabledState +from ._app_platform_management_client_enums import ApiPortalProvisioningState +from ._app_platform_management_client_enums import ApmProvisioningState +from ._app_platform_management_client_enums import ApmType +from ._app_platform_management_client_enums import AppResourceProvisioningState +from ._app_platform_management_client_enums import ApplicationAcceleratorProvisioningState +from ._app_platform_management_client_enums import ApplicationLiveViewProvisioningState +from ._app_platform_management_client_enums import BackendProtocol +from ._app_platform_management_client_enums import BindingType +from ._app_platform_management_client_enums import BuildProvisioningState +from ._app_platform_management_client_enums import BuildResultProvisioningState +from ._app_platform_management_client_enums import BuildServiceProvisioningState +from ._app_platform_management_client_enums import BuilderProvisioningState +from ._app_platform_management_client_enums import BuildpackBindingProvisioningState +from ._app_platform_management_client_enums import CertificateResourceProvisioningState +from ._app_platform_management_client_enums import ConfigServerEnabledState +from ._app_platform_management_client_enums import ConfigServerState +from ._app_platform_management_client_enums import ConfigurationServiceGeneration +from ._app_platform_management_client_enums import ConfigurationServiceProvisioningState +from ._app_platform_management_client_enums import ContainerRegistryProvisioningState +from ._app_platform_management_client_enums import CreatedByType +from ._app_platform_management_client_enums import CustomDomainResourceProvisioningState +from ._app_platform_management_client_enums import CustomizedAcceleratorProvisioningState +from ._app_platform_management_client_enums import CustomizedAcceleratorType +from ._app_platform_management_client_enums import CustomizedAcceleratorValidateResultState +from ._app_platform_management_client_enums import DeploymentResourceProvisioningState +from ._app_platform_management_client_enums import DeploymentResourceStatus +from ._app_platform_management_client_enums import DevToolPortalFeatureState +from ._app_platform_management_client_enums import DevToolPortalProvisioningState +from ._app_platform_management_client_enums import EurekaServerEnabledState +from ._app_platform_management_client_enums import EurekaServerState +from ._app_platform_management_client_enums import Frequency +from ._app_platform_management_client_enums import GatewayCertificateVerification +from ._app_platform_management_client_enums import GatewayProvisioningState +from ._app_platform_management_client_enums import GatewayRouteConfigProtocol +from ._app_platform_management_client_enums import GitImplementation +from ._app_platform_management_client_enums import HTTPSchemeType +from ._app_platform_management_client_enums import KPackBuildStageProvisioningState +from ._app_platform_management_client_enums import KeyVaultCertificateAutoSync +from ._app_platform_management_client_enums import LastModifiedByType +from ._app_platform_management_client_enums import ManagedIdentityType +from ._app_platform_management_client_enums import MonitoringSettingState +from ._app_platform_management_client_enums import PowerState +from ._app_platform_management_client_enums import PredefinedAcceleratorProvisioningState +from ._app_platform_management_client_enums import PredefinedAcceleratorState +from ._app_platform_management_client_enums import ProbeActionType +from ._app_platform_management_client_enums import ProvisioningState +from ._app_platform_management_client_enums import ResourceSkuRestrictionsReasonCode +from ._app_platform_management_client_enums import ResourceSkuRestrictionsType +from ._app_platform_management_client_enums import ServiceRegistryProvisioningState +from ._app_platform_management_client_enums import SessionAffinity +from ._app_platform_management_client_enums import SkuScaleType +from ._app_platform_management_client_enums import StorageType +from ._app_platform_management_client_enums import SupportedRuntimePlatform +from ._app_platform_management_client_enums import SupportedRuntimeValue +from ._app_platform_management_client_enums import TestEndpointAuthState +from ._app_platform_management_client_enums import TestKeyType +from ._app_platform_management_client_enums import TrafficDirection +from ._app_platform_management_client_enums import TriggeredBuildResultProvisioningState +from ._app_platform_management_client_enums import Type +from ._app_platform_management_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__ = [ + "AcceleratorAuthSetting", + "AcceleratorBasicAuthSetting", + "AcceleratorGitRepository", + "AcceleratorPublicSetting", + "AcceleratorSshSetting", + "ActiveDeploymentCollection", + "ApiPortalCustomDomainProperties", + "ApiPortalCustomDomainResource", + "ApiPortalCustomDomainResourceCollection", + "ApiPortalInstance", + "ApiPortalProperties", + "ApiPortalResource", + "ApiPortalResourceCollection", + "ApiPortalResourceRequests", + "ApmProperties", + "ApmReference", + "ApmResource", + "ApmResourceCollection", + "ApmSecretKeys", + "AppResource", + "AppResourceCollection", + "AppResourceProperties", + "AppVNetAddons", + "ApplicationAcceleratorComponent", + "ApplicationAcceleratorInstance", + "ApplicationAcceleratorProperties", + "ApplicationAcceleratorResource", + "ApplicationAcceleratorResourceCollection", + "ApplicationAcceleratorResourceRequests", + "ApplicationInsightsAgentVersions", + "ApplicationLiveViewComponent", + "ApplicationLiveViewInstance", + "ApplicationLiveViewProperties", + "ApplicationLiveViewResource", + "ApplicationLiveViewResourceCollection", + "ApplicationLiveViewResourceRequests", + "AvailableOperations", + "AvailableRuntimeVersions", + "AzureFileVolume", + "BindingResource", + "BindingResourceCollection", + "BindingResourceProperties", + "Build", + "BuildCollection", + "BuildProperties", + "BuildResourceRequests", + "BuildResult", + "BuildResultCollection", + "BuildResultLog", + "BuildResultProperties", + "BuildResultUserSourceInfo", + "BuildService", + "BuildServiceAgentPoolProperties", + "BuildServiceAgentPoolResource", + "BuildServiceAgentPoolResourceCollection", + "BuildServiceAgentPoolSizeProperties", + "BuildServiceCollection", + "BuildServiceProperties", + "BuildServicePropertiesResourceRequests", + "BuildStageProperties", + "BuilderProperties", + "BuilderResource", + "BuilderResourceCollection", + "BuildpackBindingLaunchProperties", + "BuildpackBindingProperties", + "BuildpackBindingResource", + "BuildpackBindingResourceCollection", + "BuildpackProperties", + "BuildpacksGroupProperties", + "CertificateProperties", + "CertificateReference", + "CertificateResource", + "CertificateResourceCollection", + "CloudErrorBody", + "ClusterResourceProperties", + "ConfigServerGitProperty", + "ConfigServerProperties", + "ConfigServerResource", + "ConfigServerSettings", + "ConfigServerSettingsErrorRecord", + "ConfigServerSettingsValidateResult", + "ConfigurationServiceGitProperty", + "ConfigurationServiceGitPropertyValidateResult", + "ConfigurationServiceGitRepository", + "ConfigurationServiceInstance", + "ConfigurationServiceProperties", + "ConfigurationServiceResource", + "ConfigurationServiceResourceCollection", + "ConfigurationServiceResourceRequests", + "ConfigurationServiceSettings", + "ConfigurationServiceSettingsValidateResult", + "ContainerProbeSettings", + "ContainerRegistryBasicCredentials", + "ContainerRegistryCredentials", + "ContainerRegistryProperties", + "ContainerRegistryResource", + "ContainerRegistryResourceCollection", + "ContainerRegistryValidateResult", + "ContentCertificateProperties", + "CustomContainer", + "CustomContainerUserSourceInfo", + "CustomDomainProperties", + "CustomDomainResource", + "CustomDomainResourceCollection", + "CustomDomainValidatePayload", + "CustomDomainValidateResult", + "CustomPersistentDiskProperties", + "CustomPersistentDiskResource", + "CustomScaleRule", + "CustomizedAcceleratorProperties", + "CustomizedAcceleratorResource", + "CustomizedAcceleratorResourceCollection", + "CustomizedAcceleratorValidateResult", + "DeploymentInstance", + "DeploymentList", + "DeploymentResource", + "DeploymentResourceCollection", + "DeploymentResourceProperties", + "DeploymentSettings", + "DevToolPortalComponent", + "DevToolPortalFeatureDetail", + "DevToolPortalFeatureSettings", + "DevToolPortalInstance", + "DevToolPortalProperties", + "DevToolPortalResource", + "DevToolPortalResourceCollection", + "DevToolPortalResourceRequests", + "DevToolPortalSsoProperties", + "DiagnosticParameters", + "Error", + "EurekaServerProperties", + "EurekaServerResource", + "EurekaServerResourceCollection", + "ExecAction", + "GatewayApiMetadataProperties", + "GatewayApiRoute", + "GatewayCorsProperties", + "GatewayCustomDomainProperties", + "GatewayCustomDomainResource", + "GatewayCustomDomainResourceCollection", + "GatewayInstance", + "GatewayLocalResponseCachePerInstanceProperties", + "GatewayLocalResponseCachePerRouteProperties", + "GatewayOperatorProperties", + "GatewayOperatorResourceRequests", + "GatewayProperties", + "GatewayPropertiesClientAuth", + "GatewayPropertiesEnvironmentVariables", + "GatewayResource", + "GatewayResourceCollection", + "GatewayResourceRequests", + "GatewayResponseCacheProperties", + "GatewayRouteConfigOpenApiProperties", + "GatewayRouteConfigProperties", + "GatewayRouteConfigResource", + "GatewayRouteConfigResourceCollection", + "GitPatternRepository", + "GloballyEnabledApms", + "HTTPGetAction", + "HttpScaleRule", + "ImageRegistryCredential", + "IngressConfig", + "IngressSettings", + "IngressSettingsClientAuth", + "JarUploadedUserSourceInfo", + "KeyVaultCertificateProperties", + "LoadedCertificate", + "LogFileUrlResponse", + "LogSpecification", + "MaintenanceScheduleConfiguration", + "ManagedIdentityProperties", + "MarketplaceResource", + "MetricDimension", + "MetricSpecification", + "MonitoringSettingProperties", + "MonitoringSettingResource", + "NameAvailability", + "NameAvailabilityParameters", + "NetCoreZipUploadedUserSourceInfo", + "NetworkProfile", + "NetworkProfileOutboundIPs", + "OperationDetail", + "OperationDisplay", + "OperationProperties", + "PersistentDisk", + "PredefinedAcceleratorProperties", + "PredefinedAcceleratorResource", + "PredefinedAcceleratorResourceCollection", + "Probe", + "ProbeAction", + "ProxyResource", + "QueueScaleRule", + "RegenerateTestKeyRequestPayload", + "RemoteDebugging", + "RemoteDebuggingPayload", + "RequiredTraffic", + "Resource", + "ResourceRequests", + "ResourceSku", + "ResourceSkuCapabilities", + "ResourceSkuCollection", + "ResourceSkuLocationInfo", + "ResourceSkuRestrictionInfo", + "ResourceSkuRestrictions", + "ResourceSkuZoneDetails", + "ResourceUploadDefinition", + "Scale", + "ScaleRule", + "ScaleRuleAuth", + "Secret", + "ServiceRegistryInstance", + "ServiceRegistryProperties", + "ServiceRegistryResource", + "ServiceRegistryResourceCollection", + "ServiceRegistryResourceRequests", + "ServiceResource", + "ServiceResourceList", + "ServiceSpecification", + "ServiceVNetAddons", + "Sku", + "SkuCapacity", + "SkuObject", + "SourceUploadedUserSourceInfo", + "SsoProperties", + "StackProperties", + "StorageAccount", + "StorageProperties", + "StorageResource", + "StorageResourceCollection", + "SupportedApmType", + "SupportedApmTypes", + "SupportedBuildpackResource", + "SupportedBuildpackResourceProperties", + "SupportedBuildpacksCollection", + "SupportedRuntimeVersion", + "SupportedServerVersion", + "SupportedServerVersions", + "SupportedStackResource", + "SupportedStackResourceProperties", + "SupportedStacksCollection", + "SystemData", + "TCPSocketAction", + "TcpScaleRule", + "TemporaryDisk", + "TestKeys", + "TrackedResource", + "TriggeredBuildResult", + "UploadedUserSourceInfo", + "UserAssignedManagedIdentity", + "UserSourceInfo", + "ValidationMessages", + "WarUploadedUserSourceInfo", + "WeeklyMaintenanceScheduleConfiguration", + "ActionType", + "ApiPortalApiTryOutEnabledState", + "ApiPortalProvisioningState", + "ApmProvisioningState", + "ApmType", + "AppResourceProvisioningState", + "ApplicationAcceleratorProvisioningState", + "ApplicationLiveViewProvisioningState", + "BackendProtocol", + "BindingType", + "BuildProvisioningState", + "BuildResultProvisioningState", + "BuildServiceProvisioningState", + "BuilderProvisioningState", + "BuildpackBindingProvisioningState", + "CertificateResourceProvisioningState", + "ConfigServerEnabledState", + "ConfigServerState", + "ConfigurationServiceGeneration", + "ConfigurationServiceProvisioningState", + "ContainerRegistryProvisioningState", + "CreatedByType", + "CustomDomainResourceProvisioningState", + "CustomizedAcceleratorProvisioningState", + "CustomizedAcceleratorType", + "CustomizedAcceleratorValidateResultState", + "DeploymentResourceProvisioningState", + "DeploymentResourceStatus", + "DevToolPortalFeatureState", + "DevToolPortalProvisioningState", + "EurekaServerEnabledState", + "EurekaServerState", + "Frequency", + "GatewayCertificateVerification", + "GatewayProvisioningState", + "GatewayRouteConfigProtocol", + "GitImplementation", + "HTTPSchemeType", + "KPackBuildStageProvisioningState", + "KeyVaultCertificateAutoSync", + "LastModifiedByType", + "ManagedIdentityType", + "MonitoringSettingState", + "PowerState", + "PredefinedAcceleratorProvisioningState", + "PredefinedAcceleratorState", + "ProbeActionType", + "ProvisioningState", + "ResourceSkuRestrictionsReasonCode", + "ResourceSkuRestrictionsType", + "ServiceRegistryProvisioningState", + "SessionAffinity", + "SkuScaleType", + "StorageType", + "SupportedRuntimePlatform", + "SupportedRuntimeValue", + "TestEndpointAuthState", + "TestKeyType", + "TrafficDirection", + "TriggeredBuildResultProvisioningState", + "Type", + "WeekDay", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py new file mode 100644 index 000000000000..59607833f09d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_app_platform_management_client_enums.py @@ -0,0 +1,577 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 ApiPortalApiTryOutEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether the API try-out feature is enabled or disabled. When enabled, users can try + out the API by sending requests and viewing responses in API portal. When disabled, users + cannot try out the API. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ApiPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the API portal.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class ApmProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the APM.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class ApmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of application performance monitoring.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + APP_DYNAMICS = "AppDynamics" + DYNATRACE = "Dynatrace" + NEW_RELIC = "NewRelic" + ELASTIC_APM = "ElasticAPM" + + +class ApplicationAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the application accelerator.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class ApplicationLiveViewProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Application Live View.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class AppResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the App.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """How ingress should communicate with this app backend service.""" + + GRPC = "GRPC" + DEFAULT = "Default" + + +class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Buildpack Binding Type.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + APACHE_SKY_WALKING = "ApacheSkyWalking" + APP_DYNAMICS = "AppDynamics" + DYNATRACE = "Dynatrace" + NEW_RELIC = "NewRelic" + ELASTIC_APM = "ElasticAPM" + CA_CERTIFICATES = "CACertificates" + + +class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Builder provision status.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class BuildpackBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Buildpack Binding.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the KPack build result.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class BuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the KPack build result.""" + + QUEUING = "Queuing" + BUILDING = "Building" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class BuildServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the KPack build service.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class CertificateResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Certificate.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class ConfigServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enabled state of the config server. This is only used in Consumption tier.""" + + ENABLED = "Enabled" + """Enable the config server.""" + DISABLED = "Disabled" + """Disable the config server.""" + + +class ConfigServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the config server.""" + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + +class ConfigurationServiceGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The generation of the Application Configuration Service.""" + + GEN1 = "Gen1" + GEN2 = "Gen2" + + +class ConfigurationServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Application Configuration Service.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class ContainerRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Container Registry.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class CustomDomainResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Domain.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class CustomizedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the customized accelerator.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class CustomizedAcceleratorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the customized accelerator.""" + + ACCELERATOR = "Accelerator" + FRAGMENT = "Fragment" + + +class CustomizedAcceleratorValidateResultState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the customized accelerator validation result.""" + + VALID = "Valid" + """Customized accelerator properties are valid.""" + INVALID = "Invalid" + """Customized accelerator properties are invalid.""" + + +class DeploymentResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Deployment.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class DeploymentResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the Deployment.""" + + STOPPED = "Stopped" + RUNNING = "Running" + + +class DevToolPortalFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the plugin.""" + + ENABLED = "Enabled" + """Enable the plugin in Dev Tool Portal.""" + DISABLED = "Disabled" + """Disable the plugin in Dev Tool Portal.""" + + +class DevToolPortalProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Dev Tool Portal.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class EurekaServerEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enabled state of the eureka server. This is only used in Consumption tier.""" + + ENABLED = "Enabled" + """Enable the eureka server.""" + DISABLED = "Disabled" + """Disable the eureka server.""" + + +class EurekaServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the eureka server.""" + + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + CANCELED = "Canceled" + + +class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The frequency to run the maintenance job.""" + + WEEKLY = "Weekly" + + +class GatewayCertificateVerification(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether to enable certificate verification or not.""" + + ENABLED = "Enabled" + """Enable certificate verification in Spring Cloud Gateway.""" + DISABLED = "Disabled" + """Disable certificate verification in Spring Cloud Gateway.""" + + +class GatewayProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Spring Cloud Gateway.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class GatewayRouteConfigProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol of routed Azure Spring Apps applications.""" + + HTTP = "HTTP" + HTTPS = "HTTPS" + + +class GitImplementation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Git libraries used to support various repository providers.""" + + GO_GIT = "go-git" + LIBGIT2 = "libgit2" + + +class HTTPSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. + """ + + HTTP = "HTTP" + HTTPS = "HTTPS" + + +class KeyVaultCertificateAutoSync(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether to automatically synchronize certificate from key vault or not.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class KPackBuildStageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of this build stage resource.""" + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that last modified the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the managed identity.""" + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class MonitoringSettingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Monitoring Setting.""" + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + +class PowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Power state of the Service.""" + + RUNNING = "Running" + STOPPED = "Stopped" + + +class PredefinedAcceleratorProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the predefined accelerator.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + + +class PredefinedAcceleratorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the predefined accelerator.""" + + ENABLED = "Enabled" + """Enable the predefined accelerator.""" + DISABLED = "Disabled" + """Disable the predefined accelerator.""" + + +class ProbeActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the action to take to perform the health check.""" + + HTTP_GET_ACTION = "HTTPGetAction" + TCP_SOCKET_ACTION = "TCPSocketAction" + EXEC_ACTION = "ExecAction" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Service.""" + + CREATING = "Creating" + UPDATING = "Updating" + STARTING = "Starting" + STOPPING = "Stopping" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + + +class ResourceSkuRestrictionsReasonCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + + +class ResourceSkuRestrictionsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone'.""" + + LOCATION = "Location" + ZONE = "Zone" + + +class ServiceRegistryProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Service Registry.""" + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + +class SessionAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the affinity, set this to Cookie to enable session affinity.""" + + COOKIE = "Cookie" + NONE = "None" + + +class SkuScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the type of the scale.""" + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + + +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the storage.""" + + STORAGE_ACCOUNT = "StorageAccount" + + +class SupportedRuntimePlatform(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The platform of this runtime version (possible values: "Java" or ".NET").""" + + JAVA = "Java" + _NET_CORE = ".NET Core" + + +class SupportedRuntimeValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The raw value which could be passed to deployment CRUD operations.""" + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + JAVA17 = "Java_17" + JAVA21 = "Java_21" + NET_CORE31 = "NetCore_31" + + +class TestEndpointAuthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of test endpoint auth.""" + + ENABLED = "Enabled" + """Enable test endpoint auth.""" + DISABLED = "Disabled" + """Disable test endpoint auth""" + + +class TestKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the test key.""" + + PRIMARY = "Primary" + SECONDARY = "Secondary" + + +class TrafficDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The direction of required traffic.""" + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + +class TriggeredBuildResultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of this build result.""" + + QUEUING = "Queuing" + BUILDING = "Building" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the underlying resource to mount as a persistent disk.""" + + AZURE_FILE_VOLUME = "AzureFileVolume" + + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The day to run the maintenance job.""" + + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..b765eb542ddd --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_models_py3.py @@ -0,0 +1,10915 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AcceleratorAuthSetting(_serialization.Model): + """Auth setting payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AcceleratorBasicAuthSetting, AcceleratorPublicSetting, AcceleratorSshSetting + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + } + + _subtype_map = { + "auth_type": { + "BasicAuth": "AcceleratorBasicAuthSetting", + "Public": "AcceleratorPublicSetting", + "SSH": "AcceleratorSshSetting", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + + +class AcceleratorBasicAuthSetting(AcceleratorAuthSetting): + """Auth setting for basic auth. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + :ivar username: Username of git repository basic auth. Required. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + """ + + _validation = { + "auth_type": {"required": True}, + "username": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__( + self, *, username: str, ca_cert_resource_id: Optional[str] = None, password: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + :keyword username: Username of git repository basic auth. Required. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + """ + super().__init__(**kwargs) + self.auth_type: str = "BasicAuth" + self.ca_cert_resource_id = ca_cert_resource_id + self.username = username + self.password = password + + +class AcceleratorGitRepository(_serialization.Model): + """AcceleratorGitRepository. + + All required parameters must be populated in order to send to Azure. + + :ivar url: Git repository URL for the accelerator. Required. + :vartype url: str + :ivar interval_in_seconds: Interval for checking for updates to Git or image repository. + :vartype interval_in_seconds: int + :ivar branch: Git repository branch to be used. + :vartype branch: str + :ivar commit: Git repository commit to be used. + :vartype commit: str + :ivar git_tag: Git repository tag to be used. + :vartype git_tag: str + :ivar auth_setting: Properties of the auth setting payload. Required. + :vartype auth_setting: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorAuthSetting + :ivar sub_path: Folder path inside the git repository to consider as the root of the + accelerator or fragment. + :vartype sub_path: str + """ + + _validation = { + "url": {"required": True}, + "auth_setting": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "branch": {"key": "branch", "type": "str"}, + "commit": {"key": "commit", "type": "str"}, + "git_tag": {"key": "gitTag", "type": "str"}, + "auth_setting": {"key": "authSetting", "type": "AcceleratorAuthSetting"}, + "sub_path": {"key": "subPath", "type": "str"}, + } + + def __init__( + self, + *, + url: str, + auth_setting: "_models.AcceleratorAuthSetting", + interval_in_seconds: Optional[int] = None, + branch: Optional[str] = None, + commit: Optional[str] = None, + git_tag: Optional[str] = None, + sub_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: Git repository URL for the accelerator. Required. + :paramtype url: str + :keyword interval_in_seconds: Interval for checking for updates to Git or image repository. + :paramtype interval_in_seconds: int + :keyword branch: Git repository branch to be used. + :paramtype branch: str + :keyword commit: Git repository commit to be used. + :paramtype commit: str + :keyword git_tag: Git repository tag to be used. + :paramtype git_tag: str + :keyword auth_setting: Properties of the auth setting payload. Required. + :paramtype auth_setting: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorAuthSetting + :keyword sub_path: Folder path inside the git repository to consider as the root of the + accelerator or fragment. + :paramtype sub_path: str + """ + super().__init__(**kwargs) + self.url = url + self.interval_in_seconds = interval_in_seconds + self.branch = branch + self.commit = commit + self.git_tag = git_tag + self.auth_setting = auth_setting + self.sub_path = sub_path + + +class AcceleratorPublicSetting(AcceleratorAuthSetting): + """Auth setting for public url. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + } + + def __init__(self, *, ca_cert_resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + """ + super().__init__(**kwargs) + self.auth_type: str = "Public" + self.ca_cert_resource_id = ca_cert_resource_id + + +class AcceleratorSshSetting(AcceleratorAuthSetting): + """Auth setting for SSH auth. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: The type of the auth setting. Required. + :vartype auth_type: str + :ivar host_key: Public SSH Key of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SSH Key algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private SSH Key algorithm of git repository. + :vartype private_key: str + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "host_key": {"key": "hostKey", "type": "str"}, + "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + } + + def __init__( + self, + *, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_key: Public SSH Key of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SSH Key algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private SSH Key algorithm of git repository. + :paramtype private_key: str + """ + super().__init__(**kwargs) + self.auth_type: str = "SSH" + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + + +class ActiveDeploymentCollection(_serialization.Model): + """Object that includes an array of Deployment resource name and set them as active. + + :ivar active_deployment_names: Collection of Deployment name. + :vartype active_deployment_names: list[str] + """ + + _attribute_map = { + "active_deployment_names": {"key": "activeDeploymentNames", "type": "[str]"}, + } + + def __init__(self, *, active_deployment_names: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ + super().__init__(**kwargs) + self.active_deployment_names = active_deployment_names + + +class ApiPortalCustomDomainProperties(_serialization.Model): + """The properties of custom domain for API portal. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + "thumbprint": {"key": "thumbprint", "type": "str"}, + } + + def __init__(self, *, thumbprint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super().__init__(**kwargs) + self.thumbprint = thumbprint + + +class Resource(_serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than + required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class ApiPortalCustomDomainResource(ProxyResource): + """Custom domain of the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: The properties of custom domain for API portal. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApiPortalCustomDomainProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ApiPortalCustomDomainProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The properties of custom domain for API portal. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApiPortalCustomDomainResourceCollection(_serialization.Model): + """Object that includes an array of API portal custom domain resources and a possible link for + next set. + + :ivar value: Collection of API portal custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApiPortalCustomDomainResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApiPortalCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of API portal custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalInstance(_serialization.Model): + """Collection of instances belong to the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the API portal instance. + :vartype name: str + :ivar status: Status of the API portal instance. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApiPortalProperties(_serialization.Model): + """API portal properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the API portal. Known values are: "Creating", "Updating", + "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalProvisioningState + :ivar public: Indicates whether the API portal exposes endpoint. + :vartype public: bool + :ivar url: URL of the API portal, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :vartype gateway_ids: list[str] + :ivar source_urls: Collection of OpenAPI source URL locations. + :vartype source_urls: list[str] + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SsoProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResourceRequests + :ivar instances: Collection of instances belong to API portal. + :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalInstance] + :ivar api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or + disabled. When enabled, users can try out the API by sending requests and viewing responses in + API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and + "Disabled". + :vartype api_try_out_enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalApiTryOutEnabledState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "url": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "public": {"key": "public", "type": "bool"}, + "url": {"key": "url", "type": "str"}, + "https_only": {"key": "httpsOnly", "type": "bool"}, + "gateway_ids": {"key": "gatewayIds", "type": "[str]"}, + "source_urls": {"key": "sourceUrls", "type": "[str]"}, + "sso_properties": {"key": "ssoProperties", "type": "SsoProperties"}, + "resource_requests": {"key": "resourceRequests", "type": "ApiPortalResourceRequests"}, + "instances": {"key": "instances", "type": "[ApiPortalInstance]"}, + "api_try_out_enabled_state": {"key": "apiTryOutEnabledState", "type": "str"}, + } + + def __init__( + self, + *, + public: bool = False, + https_only: bool = False, + gateway_ids: Optional[List[str]] = None, + source_urls: Optional[List[str]] = None, + sso_properties: Optional["_models.SsoProperties"] = None, + api_try_out_enabled_state: Union[str, "_models.ApiPortalApiTryOutEnabledState"] = "Enabled", + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the API portal exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :paramtype gateway_ids: list[str] + :keyword source_urls: Collection of OpenAPI source URL locations. + :paramtype source_urls: list[str] + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SsoProperties + :keyword api_try_out_enabled_state: Indicates whether the API try-out feature is enabled or + disabled. When enabled, users can try out the API by sending requests and viewing responses in + API portal. When disabled, users cannot try out the API. Known values are: "Enabled" and + "Disabled". + :paramtype api_try_out_enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalApiTryOutEnabledState + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.gateway_ids = gateway_ids + self.source_urls = source_urls + self.sso_properties = sso_properties + self.resource_requests = None + self.instances = None + self.api_try_out_enabled_state = api_try_out_enabled_state + + +class ApiPortalResource(ProxyResource): + """API portal 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: API portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalProperties + :ivar sku: Sku of the API portal resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApiPortalProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ApiPortalProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: API portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalProperties + :keyword sku: Sku of the API portal resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApiPortalResourceCollection(_serialization.Model): + """Object that includes an array of API portal resources and a possible link for next set. + + :ivar value: Collection of API portal resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApiPortalResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApiPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of API portal resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalResourceRequests(_serialization.Model): + """Resource requests of the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each API portal instance. + :vartype cpu: str + :ivar memory: Memory allocated to each API portal instance. + :vartype memory: str + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + + +class ApmProperties(_serialization.Model): + """Properties of an APM. + + 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 type: APM Type. Required. + :vartype type: str + :ivar provisioning_state: State of the APM. Known values are: "Creating", "Updating", + "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProvisioningState + :ivar properties: Non-sensitive properties for the APM. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for the APM. + :vartype secrets: dict[str, str] + """ + + _validation = { + "type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "secrets": {"key": "secrets", "type": "{str}"}, + } + + def __init__( + self, + *, + type: str, + properties: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: APM Type. Required. + :paramtype type: str + :keyword properties: Non-sensitive properties for the APM. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for the APM. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.type = type + self.provisioning_state = None + self.properties = properties + self.secrets = secrets + + +class ApmReference(_serialization.Model): + """A reference to the APM. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Resource Id of the APM. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of the APM. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ApmResource(ProxyResource): + """APM Resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of an APM. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApmProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApmProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of an APM. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApmResourceCollection(_serialization.Model): + """Object that includes an array of APM resources and a possible link for next set. + + :ivar value: Collection of APM resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApmResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ApmResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of APM resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApmSecretKeys(_serialization.Model): + """Keys of APM sensitive properties. + + :ivar value: Collection of the keys for the APM sensitive properties. + :vartype value: list[str] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword value: Collection of the keys for the APM sensitive properties. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + +class ApplicationAcceleratorComponent(_serialization.Model): + """ApplicationAcceleratorComponent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: + :vartype name: str + :ivar resource_requests: + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResourceRequests + :ivar instances: + :vartype instances: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorInstance] + """ + + _validation = { + "name": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "ApplicationAcceleratorResourceRequests"}, + "instances": {"key": "instances", "type": "[ApplicationAcceleratorInstance]"}, + } + + def __init__( + self, *, resource_requests: Optional["_models.ApplicationAcceleratorResourceRequests"] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_requests: + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResourceRequests + """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = resource_requests + self.instances = None + + +class ApplicationAcceleratorInstance(_serialization.Model): + """ApplicationAcceleratorInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Accelerator instance. + :vartype name: str + :ivar status: Status of the Application Accelerator instance. It can be Pending, Running, + Succeeded, Failed, Unknown. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApplicationAcceleratorProperties(_serialization.Model): + """Application accelerator properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the application accelerator. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProvisioningState + :ivar components: Collection of components belong to application accelerator. + :vartype components: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorComponent] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[ApplicationAcceleratorComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + + +class ApplicationAcceleratorResource(ProxyResource): + """Application accelerator 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Application accelerator properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProperties + :ivar sku: Sku of the application accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApplicationAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ApplicationAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Application accelerator properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorProperties + :keyword sku: Sku of the application accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApplicationAcceleratorResourceCollection(_serialization.Model): + """Object that includes an array of application accelerator resources and a possible link for next + set. + + :ivar value: Collection of application accelerator resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of application accelerator resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationAcceleratorResourceRequests(_serialization.Model): + """ApplicationAcceleratorResourceRequests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each application accelerator component. 1 core can be represented + by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory allocated to each application accelerator component. 1 GB can be + represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Instance count of the application accelerator component. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ApplicationInsightsAgentVersions(_serialization.Model): + """Application Insights agent versions properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar java: Indicates the version of application insight java agent. + :vartype java: str + """ + + _validation = { + "java": {"readonly": True}, + } + + _attribute_map = { + "java": {"key": "java", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.java = None + + +class ApplicationLiveViewComponent(_serialization.Model): + """Application Live View properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the component. + :vartype name: any + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResourceRequests + :ivar instances: Collection of instances belong to Application Live View. + :vartype instances: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewInstance] + """ + + _validation = { + "name": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "object"}, + "resource_requests": {"key": "resourceRequests", "type": "ApplicationLiveViewResourceRequests"}, + "instances": {"key": "instances", "type": "[ApplicationLiveViewInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = None + self.instances = None + + +class ApplicationLiveViewInstance(_serialization.Model): + """Collection of instances belong to the Application Live View. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Live View instance. + :vartype name: str + :ivar status: Status of the Application Live View instance. It can be Pending, Running, + Succeeded, Failed, Unknown. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ApplicationLiveViewProperties(_serialization.Model): + """Application Live View properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Live View. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProvisioningState + :ivar components: Component details of Application Live View. + :vartype components: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewComponent] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[ApplicationLiveViewComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + + +class ApplicationLiveViewResource(ProxyResource): + """Application Live View 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Application Live View properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ApplicationLiveViewProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApplicationLiveViewProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Application Live View properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApplicationLiveViewResourceCollection(_serialization.Model): + """Object that includes an array of Application Live View resources and a possible link for next + set. + + :ivar value: Collection of Application Live View resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationLiveViewResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationLiveViewResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Application Live View resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationLiveViewResourceRequests(_serialization.Model): + """The resource quantity for required CPU and Memory of Application Live View component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu quantity allocated to each Application Live View component instance. 1 core can + be represented by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory quantity allocated to each Application Live View component instance. 1 GB + can be represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Desired instance count of Application Live View component instance. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class AppResource(ProxyResource): + """App resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "AppResourceProperties"}, + "identity": {"key": "identity", "type": "ManagedIdentityProperties"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + properties: Optional["_models.AppResourceProperties"] = None, + identity: Optional["_models.ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super().__init__(**kwargs) + self.properties = properties + self.identity = identity + self.location = location + + +class AppResourceCollection(_serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AppResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AppResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """App resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool + :ivar url: URL of the App. + :vartype url: str + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, JSON] + :ivar provisioning_state: Provisioning state of the App. Known values are: "Succeeded", + "Failed", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResourceProvisioningState + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskResource] + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LoadedCertificate] + :ivar vnet_addons: Additional App settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppVNetAddons + :ivar ingress_settings: App ingress settings payload. + :vartype ingress_settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettings + :ivar secrets: Collection of auth secrets. + :vartype secrets: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Secret] + :ivar workload_profile_name: The workload profile used for this app. Supported for Consumption + + Dedicated plan. + :vartype workload_profile_name: str + :ivar test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and + "Disabled". + :vartype test_endpoint_auth_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestEndpointAuthState + """ + + _validation = { + "url": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "public": {"key": "public", "type": "bool"}, + "url": {"key": "url", "type": "str"}, + "addon_configs": {"key": "addonConfigs", "type": "{object}"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "https_only": {"key": "httpsOnly", "type": "bool"}, + "temporary_disk": {"key": "temporaryDisk", "type": "TemporaryDisk"}, + "persistent_disk": {"key": "persistentDisk", "type": "PersistentDisk"}, + "custom_persistent_disks": {"key": "customPersistentDisks", "type": "[CustomPersistentDiskResource]"}, + "enable_end_to_end_tls": {"key": "enableEndToEndTLS", "type": "bool"}, + "loaded_certificates": {"key": "loadedCertificates", "type": "[LoadedCertificate]"}, + "vnet_addons": {"key": "vnetAddons", "type": "AppVNetAddons"}, + "ingress_settings": {"key": "ingressSettings", "type": "IngressSettings"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, + "test_endpoint_auth_state": {"key": "testEndpointAuthState", "type": "str"}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + addon_configs: Optional[Dict[str, JSON]] = None, + https_only: bool = False, + temporary_disk: Optional["_models.TemporaryDisk"] = None, + persistent_disk: Optional["_models.PersistentDisk"] = None, + custom_persistent_disks: Optional[List["_models.CustomPersistentDiskResource"]] = None, + enable_end_to_end_tls: bool = False, + loaded_certificates: Optional[List["_models.LoadedCertificate"]] = None, + vnet_addons: Optional["_models.AppVNetAddons"] = None, + ingress_settings: Optional["_models.IngressSettings"] = None, + secrets: Optional[List["_models.Secret"]] = None, + workload_profile_name: Optional[str] = None, + test_endpoint_auth_state: Union[str, "_models.TestEndpointAuthState"] = "Enabled", + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, JSON] + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LoadedCertificate] + :keyword vnet_addons: Additional App settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppVNetAddons + :keyword ingress_settings: App ingress settings payload. + :paramtype ingress_settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettings + :keyword secrets: Collection of auth secrets. + :paramtype secrets: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Secret] + :keyword workload_profile_name: The workload profile used for this app. Supported for + Consumption + Dedicated plan. + :paramtype workload_profile_name: str + :keyword test_endpoint_auth_state: State of test endpoint auth. Known values are: "Enabled" and + "Disabled". + :paramtype test_endpoint_auth_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestEndpointAuthState + """ + super().__init__(**kwargs) + self.public = public + self.url = None + self.addon_configs = addon_configs + self.provisioning_state = None + self.fqdn = None + self.https_only = https_only + self.temporary_disk = temporary_disk + self.persistent_disk = persistent_disk + self.custom_persistent_disks = custom_persistent_disks + self.enable_end_to_end_tls = enable_end_to_end_tls + self.loaded_certificates = loaded_certificates + self.vnet_addons = vnet_addons + self.ingress_settings = ingress_settings + self.secrets = secrets + self.workload_profile_name = workload_profile_name + self.test_endpoint_auth_state = test_endpoint_auth_state + + +class AppVNetAddons(_serialization.Model): + """Additional App settings in vnet injection instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :vartype public_endpoint: bool + :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed + from internet. + :vartype public_endpoint_url: str + """ + + _validation = { + "public_endpoint_url": {"readonly": True}, + } + + _attribute_map = { + "public_endpoint": {"key": "publicEndpoint", "type": "bool"}, + "public_endpoint_url": {"key": "publicEndpointUrl", "type": "str"}, + } + + def __init__(self, *, public_endpoint: bool = False, **kwargs: Any) -> None: + """ + :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :paramtype public_endpoint: bool + """ + super().__init__(**kwargs) + self.public_endpoint = public_endpoint + self.public_endpoint_url = None + + +class AvailableOperations(_serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[OperationDetail]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(_serialization.Model): + """AvailableRuntimeVersions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of all supported runtime versions. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimeVersion] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedRuntimeVersion]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class CustomPersistentDiskProperties(_serialization.Model): + """Custom persistent disk resource payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileVolume + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the underlying resource to mount as a persistent disk. Required. + "AzureFileVolume" + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Type + :ivar mount_path: The mount path of the persistent disk. Required. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every + individual app instance. + :vartype enable_sub_path: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + """ + + _validation = { + "type": {"required": True}, + "mount_path": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "mount_path": {"key": "mountPath", "type": "str"}, + "read_only": {"key": "readOnly", "type": "bool"}, + "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, + "mount_options": {"key": "mountOptions", "type": "[str]"}, + } + + _subtype_map = {"type": {"AzureFileVolume": "AzureFileVolume"}} + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + enable_sub_path: bool = False, + mount_options: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword mount_path: The mount path of the persistent disk. Required. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for + every individual app instance. + :paramtype enable_sub_path: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.mount_path = mount_path + self.read_only = read_only + self.enable_sub_path = enable_sub_path + self.mount_options = mount_options + + +class AzureFileVolume(CustomPersistentDiskProperties): + """The properties of the Azure File volume. Azure File shares are mounted as volumes. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the underlying resource to mount as a persistent disk. Required. + "AzureFileVolume" + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Type + :ivar mount_path: The mount path of the persistent disk. Required. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar enable_sub_path: If set to true, it will create and mount a dedicated directory for every + individual app instance. + :vartype enable_sub_path: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: The share name of the Azure File share. + :vartype share_name: str + """ + + _validation = { + "type": {"required": True}, + "mount_path": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "mount_path": {"key": "mountPath", "type": "str"}, + "read_only": {"key": "readOnly", "type": "bool"}, + "enable_sub_path": {"key": "enableSubPath", "type": "bool"}, + "mount_options": {"key": "mountOptions", "type": "[str]"}, + "share_name": {"key": "shareName", "type": "str"}, + } + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + enable_sub_path: bool = False, + mount_options: Optional[List[str]] = None, + share_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mount_path: The mount path of the persistent disk. Required. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword enable_sub_path: If set to true, it will create and mount a dedicated directory for + every individual app instance. + :paramtype enable_sub_path: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: The share name of the Azure File share. + :paramtype share_name: str + """ + super().__init__( + mount_path=mount_path, + read_only=read_only, + enable_sub_path=enable_sub_path, + mount_options=mount_options, + **kwargs + ) + self.type: str = "AzureFileVolume" + self.share_name = share_name + + +class BindingResource(ProxyResource): + """Binding resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BindingResourceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BindingResourceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BindingResourceCollection(_serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BindingResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BindingResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(_serialization.Model): + """Binding resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_name: The name of the bound resource. + :vartype resource_name: str + :ivar resource_type: The standard Azure resource type of the bound resource. + :vartype resource_type: str + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, str] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. + :vartype generated_properties: str + :ivar created_at: Creation time of the Binding resource. + :vartype created_at: str + :ivar updated_at: Update time of the Binding resource. + :vartype updated_at: str + """ + + _validation = { + "resource_name": {"readonly": True}, + "resource_type": {"readonly": True}, + "generated_properties": {"readonly": True}, + "created_at": {"readonly": True}, + "updated_at": {"readonly": True}, + } + + _attribute_map = { + "resource_name": {"key": "resourceName", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "key": {"key": "key", "type": "str"}, + "binding_parameters": {"key": "bindingParameters", "type": "{str}"}, + "generated_properties": {"key": "generatedProperties", "type": "str"}, + "created_at": {"key": "createdAt", "type": "str"}, + "updated_at": {"key": "updatedAt", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, str] + """ + super().__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.resource_id = resource_id + self.key = key + self.binding_parameters = binding_parameters + self.generated_properties = None + self.created_at = None + self.updated_at = None + + +class Build(ProxyResource): + """Build resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuildProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BuildProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildCollection(_serialization.Model): + """Object that includes an array of Build resources and a possible link for next set. + + :ivar value: Collection of Build resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Build]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuilderProperties(_serialization.Model): + """KPack Builder properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Builder provision status. Known values are: "Creating", "Updating", + "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderProvisioningState + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpacksGroupProperties] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "stack": {"key": "stack", "type": "StackProperties"}, + "buildpack_groups": {"key": "buildpackGroups", "type": "[BuildpacksGroupProperties]"}, + } + + def __init__( + self, + *, + stack: Optional["_models.StackProperties"] = None, + buildpack_groups: Optional[List["_models.BuildpacksGroupProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpacksGroupProperties] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.stack = stack + self.buildpack_groups = buildpack_groups + + +class BuilderResource(ProxyResource): + """KPack Builder 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuilderProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BuilderProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuilderResourceCollection(_serialization.Model): + """Object that includes an array of Builder resources and a possible link for next set. + + :ivar value: Collection of Builder resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BuilderResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BuilderResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackBindingLaunchProperties(_serialization.Model): + """Buildpack Binding Launch Properties. + + :ivar properties: Non-sensitive properties for launchProperties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for launchProperties. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "{str}"}, + "secrets": {"key": "secrets", "type": "{str}"}, + } + + def __init__( + self, *, properties: Optional[Dict[str, str]] = None, secrets: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class BuildpackBindingProperties(_serialization.Model): + """Properties of a buildpack binding. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". + :vartype binding_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingType + :ivar provisioning_state: State of the Buildpack Binding. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingProvisioningState + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingLaunchProperties + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "binding_type": {"key": "bindingType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "launch_properties": {"key": "launchProperties", "type": "BuildpackBindingLaunchProperties"}, + } + + def __init__( + self, + *, + binding_type: Optional[Union[str, "_models.BindingType"]] = None, + launch_properties: Optional["_models.BuildpackBindingLaunchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword binding_type: Buildpack Binding Type. Known values are: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM", and "CACertificates". + :paramtype binding_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingLaunchProperties + """ + super().__init__(**kwargs) + self.binding_type = binding_type + self.provisioning_state = None + self.launch_properties = launch_properties + + +class BuildpackBindingResource(ProxyResource): + """Buildpack Binding Resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of a buildpack binding. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuildpackBindingProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BuildpackBindingProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildpackBindingResourceCollection(_serialization.Model): + """Object that includes an array of BuildpackBinding resources and a possible link for next set. + + :ivar value: Collection of BuildpackBinding resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BuildpackBindingResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BuildpackBindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackProperties(_serialization.Model): + """Buildpack properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id of the buildpack. + :vartype id: str + :ivar version: Version of the buildpack. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + self.version = None + + +class BuildpacksGroupProperties(_serialization.Model): + """Buildpack group properties of the Builder. + + :ivar name: Buildpack group name. + :vartype name: str + :ivar buildpacks: Buildpacks in the buildpack group. + :vartype buildpacks: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackProperties] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "buildpacks": {"key": "buildpacks", "type": "[BuildpackProperties]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + buildpacks: Optional[List["_models.BuildpackProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackProperties] + """ + super().__init__(**kwargs) + self.name = name + self.buildpacks = buildpacks + + +class BuildProperties(_serialization.Model): + """Build resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar relative_path: The relative path of source code. + :vartype relative_path: str + :ivar builder: The resource id of builder to build the source code. + :vartype builder: str + :ivar agent_pool: The resource id of agent pool. + :vartype agent_pool: str + :ivar provisioning_state: Provisioning state of the KPack build result. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildProvisioningState + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] + :ivar apms: The APMs for this build. + :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :ivar certificates: The CA Certificates for this build. + :vartype certificates: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateReference] + :ivar triggered_build_result: The build result triggered by this build. + :vartype triggered_build_result: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.TriggeredBuildResult + :ivar resource_requests: The customized build resource for this build. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResourceRequests + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "triggered_build_result": {"readonly": True}, + } + + _attribute_map = { + "relative_path": {"key": "relativePath", "type": "str"}, + "builder": {"key": "builder", "type": "str"}, + "agent_pool": {"key": "agentPool", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "env": {"key": "env", "type": "{str}"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "certificates": {"key": "certificates", "type": "[CertificateReference]"}, + "triggered_build_result": {"key": "triggeredBuildResult", "type": "TriggeredBuildResult"}, + "resource_requests": {"key": "resourceRequests", "type": "BuildResourceRequests"}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + builder: Optional[str] = None, + agent_pool: Optional[str] = None, + env: Optional[Dict[str, str]] = None, + apms: Optional[List["_models.ApmReference"]] = None, + certificates: Optional[List["_models.CertificateReference"]] = None, + resource_requests: Optional["_models.BuildResourceRequests"] = None, + **kwargs: Any + ) -> None: + """ + :keyword relative_path: The relative path of source code. + :paramtype relative_path: str + :keyword builder: The resource id of builder to build the source code. + :paramtype builder: str + :keyword agent_pool: The resource id of agent pool. + :paramtype agent_pool: str + :keyword env: The environment variables for this build. + :paramtype env: dict[str, str] + :keyword apms: The APMs for this build. + :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :keyword certificates: The CA Certificates for this build. + :paramtype certificates: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateReference] + :keyword resource_requests: The customized build resource for this build. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResourceRequests + """ + super().__init__(**kwargs) + self.relative_path = relative_path + self.builder = builder + self.agent_pool = agent_pool + self.provisioning_state = None + self.env = env + self.apms = apms + self.certificates = certificates + self.triggered_build_result = None + self.resource_requests = resource_requests + + +class BuildResourceRequests(_serialization.Model): + """Resource request payload of Build Resource. + + :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :vartype cpu: str + :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi + or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: + """ + :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :paramtype cpu: str + :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by + 1Gi or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class BuildResult(ProxyResource): + """Build result resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuildResultProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BuildResultProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildResultCollection(_serialization.Model): + """Object that includes an array of Build result resources and a possible link for next set. + + :ivar value: Collection of Build result resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BuildResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BuildResult"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildResultLog(_serialization.Model): + """Build result log resource properties payload. + + :ivar blob_url: The public download URL of this build result log. + :vartype blob_url: str + """ + + _attribute_map = { + "blob_url": {"key": "blobUrl", "type": "str"}, + } + + def __init__(self, *, blob_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ + super().__init__(**kwargs) + self.blob_url = blob_url + + +class BuildResultProperties(_serialization.Model): + """Build result resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build result. + :vartype name: str + :ivar provisioning_state: Provisioning state of the KPack build result. Known values are: + "Queuing", "Building", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultProvisioningState + :ivar error: Error when build is failed. + :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :ivar build_pod_name: The build pod name which can be used to get the build log streaming. + :vartype build_pod_name: str + :ivar build_stages: All of the build stage (init-container and container) resources in build + pod. + :vartype build_stages: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildStageProperties] + :ivar image: The container registry image of this build result. + :vartype image: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "build_stages": {"readonly": True}, + "image": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "build_pod_name": {"key": "buildPodName", "type": "str"}, + "build_stages": {"key": "buildStages", "type": "[BuildStageProperties]"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + error: Optional["_models.Error"] = None, + build_pod_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword error: Error when build is failed. + :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ + super().__init__(**kwargs) + self.name = name + self.provisioning_state = None + self.error = error + self.build_pod_name = build_pod_name + self.build_stages = None + self.image = None + + +class UserSourceInfo(_serialization.Model): + """Source information for a deployment. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BuildResultUserSourceInfo, CustomContainerUserSourceInfo, UploadedUserSourceInfo + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + _subtype_map = { + "type": { + "BuildResult": "BuildResultUserSourceInfo", + "Container": "CustomContainerUserSourceInfo", + "UploadedUserSourceInfo": "UploadedUserSourceInfo", + } + } + + def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.version = version + + +class BuildResultUserSourceInfo(UserSourceInfo): + """Reference to a build result. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring + instance. + :vartype build_result_id: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "build_result_id": {"key": "buildResultId", "type": "str"}, + } + + def __init__(self, *, version: Optional[str] = None, build_result_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword build_result_id: Resource id of an existing succeeded build result under the same + Spring instance. + :paramtype build_result_id: str + """ + super().__init__(version=version, **kwargs) + self.type: str = "BuildResult" + self.build_result_id = build_result_id + + +class BuildService(ProxyResource): + """Build service resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuildServiceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BuildServiceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the build resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolProperties(_serialization.Model): + """Build service agent pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the build service agent pool. + :vartype provisioning_state: str + :ivar pool_size: build service agent pool size properties. + :vartype pool_size: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "pool_size": {"key": "poolSize", "type": "BuildServiceAgentPoolSizeProperties"}, + } + + def __init__( + self, *, pool_size: Optional["_models.BuildServiceAgentPoolSizeProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.pool_size = pool_size + + +class BuildServiceAgentPoolResource(ProxyResource): + """The build service agent pool 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: build service agent pool properties. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "BuildServiceAgentPoolProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.BuildServiceAgentPoolProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: build service agent pool properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolResourceCollection(_serialization.Model): + """Object that includes an array of build service agent pool resources and a possible link for + next set. + + :ivar value: Collection of build service agent pool resource. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BuildServiceAgentPoolResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BuildServiceAgentPoolResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceAgentPoolSizeProperties(_serialization.Model): + """Build service agent pool size properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of build service agent pool size. + :vartype name: str + :ivar cpu: The cpu property of build service agent pool size. + :vartype cpu: str + :ivar memory: The memory property of build service agent pool size. + :vartype memory: str + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.cpu = None + self.memory = None + + +class BuildServiceCollection(_serialization.Model): + """Object that includes an array of Build service resources and a possible link for next set. + + :ivar value: Collection of Build service resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BuildService]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BuildService"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceProperties(_serialization.Model): + """Build service resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar container_registry: The resource id of the container registry used in this build service. + :vartype container_registry: str + :ivar k_pack_version: The installed KPack version in this build service. + :vartype k_pack_version: str + :ivar provisioning_state: Provisioning state of the KPack build service. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceProvisioningState + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServicePropertiesResourceRequests + """ + + _validation = { + "k_pack_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "container_registry": {"key": "containerRegistry", "type": "str"}, + "k_pack_version": {"key": "kPackVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "BuildServicePropertiesResourceRequests"}, + } + + def __init__( + self, + *, + container_registry: Optional[str] = None, + resource_requests: Optional["_models.BuildServicePropertiesResourceRequests"] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_registry: The resource id of the container registry used in this build + service. + :paramtype container_registry: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServicePropertiesResourceRequests + """ + super().__init__(**kwargs) + self.container_registry = container_registry + self.k_pack_version = None + self.provisioning_state = None + self.resource_requests = resource_requests + + +class BuildServicePropertiesResourceRequests(_serialization.Model): + """The runtime resource configuration of this build service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: vCPU allocated to the entire build service node pool. + :vartype cpu: str + :ivar memory: Memory allocated to the entire build service node pool. + :vartype memory: str + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + + +class BuildStageProperties(_serialization.Model): + """The build stage (init-container and container) resources in build pod. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build stage resource. + :vartype name: str + :ivar status: The provisioning state of this build stage resource. Known values are: + "NotStarted", "Running", "Succeeded", and "Failed". + :vartype status: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.KPackBuildStageProvisioningState + :ivar exit_code: The exit code of this build init container. + :vartype exit_code: str + :ivar reason: The reason of this build init container. + :vartype reason: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + "exit_code": {"readonly": True}, + "reason": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "exit_code": {"key": "exitCode", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + self.exit_code = None + self.reason = None + + +class CertificateProperties(_serialization.Model): + """Certificate resource payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContentCertificateProperties, KeyVaultCertificateProperties + + 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 type: The type of the certificate source. Required. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState + """ + + _validation = { + "type": {"required": True}, + "thumbprint": {"readonly": True}, + "issuer": {"readonly": True}, + "issued_date": {"readonly": True}, + "expiration_date": {"readonly": True}, + "activate_date": {"readonly": True}, + "subject_name": {"readonly": True}, + "dns_names": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "issued_date": {"key": "issuedDate", "type": "str"}, + "expiration_date": {"key": "expirationDate", "type": "str"}, + "activate_date": {"key": "activateDate", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "dns_names": {"key": "dnsNames", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + _subtype_map = { + "type": { + "ContentCertificate": "ContentCertificateProperties", + "KeyVaultCertificate": "KeyVaultCertificateProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.thumbprint = None + self.issuer = None + self.issued_date = None + self.expiration_date = None + self.activate_date = None + self.subject_name = None + self.dns_names = None + self.provisioning_state = None + + +class CertificateReference(_serialization.Model): + """A reference to the certificate. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Resource Id of the certificate. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of the certificate. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class CertificateResource(ProxyResource): + """Certificate resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "CertificateProperties"}, + } + + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(_serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. + + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CertificateResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudErrorBody(_serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the Service. Known values are: "Creating", + "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", + "Moved", and "MoveFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfile + :ivar vnet_addons: Additional Service settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceVNetAddons + :ivar maintenance_schedule_configuration: Additional Service settings for planned maintenance. + :vartype maintenance_schedule_configuration: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MaintenanceScheduleConfiguration + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity Id which uniquely identifies a created resource. + :vartype service_id: str + :ivar managed_environment_id: The resource Id of the Managed Environment that the Spring Apps + instance builds on. + :vartype managed_environment_id: str + :ivar infra_resource_group: The name of the resource group that contains the infrastructure + resources. + :vartype infra_resource_group: str + :ivar power_state: Power state of the Service. Known values are: "Running" and "Stopped". + :vartype power_state: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.PowerState + :ivar zone_redundant: + :vartype zone_redundant: bool + :ivar fqdn: Fully qualified dns name of the service instance. + :vartype fqdn: str + :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. + :vartype marketplace_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MarketplaceResource + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "version": {"readonly": True}, + "service_id": {"readonly": True}, + "power_state": {"readonly": True}, + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + "vnet_addons": {"key": "vnetAddons", "type": "ServiceVNetAddons"}, + "maintenance_schedule_configuration": { + "key": "maintenanceScheduleConfiguration", + "type": "MaintenanceScheduleConfiguration", + }, + "version": {"key": "version", "type": "int"}, + "service_id": {"key": "serviceId", "type": "str"}, + "managed_environment_id": {"key": "managedEnvironmentId", "type": "str"}, + "infra_resource_group": {"key": "infraResourceGroup", "type": "str"}, + "power_state": {"key": "powerState", "type": "str"}, + "zone_redundant": {"key": "zoneRedundant", "type": "bool"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "marketplace_resource": {"key": "marketplaceResource", "type": "MarketplaceResource"}, + } + + def __init__( + self, + *, + network_profile: Optional["_models.NetworkProfile"] = None, + vnet_addons: Optional["_models.ServiceVNetAddons"] = None, + maintenance_schedule_configuration: Optional["_models.MaintenanceScheduleConfiguration"] = None, + managed_environment_id: Optional[str] = None, + infra_resource_group: Optional[str] = None, + zone_redundant: bool = False, + marketplace_resource: Optional["_models.MarketplaceResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfile + :keyword vnet_addons: Additional Service settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceVNetAddons + :keyword maintenance_schedule_configuration: Additional Service settings for planned + maintenance. + :paramtype maintenance_schedule_configuration: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MaintenanceScheduleConfiguration + :keyword managed_environment_id: The resource Id of the Managed Environment that the Spring + Apps instance builds on. + :paramtype managed_environment_id: str + :keyword infra_resource_group: The name of the resource group that contains the infrastructure + resources. + :paramtype infra_resource_group: str + :keyword zone_redundant: + :paramtype zone_redundant: bool + :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. + :paramtype marketplace_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MarketplaceResource + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.vnet_addons = vnet_addons + self.maintenance_schedule_configuration = maintenance_schedule_configuration + self.version = None + self.service_id = None + self.managed_environment_id = managed_environment_id + self.infra_resource_group = infra_resource_group + self.power_state = None + self.zone_redundant = zone_redundant + self.fqdn = None + self.marketplace_resource = marketplace_resource + + +class ConfigServerGitProperty(_serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to Azure. + + :ivar repositories: Repositories of git. + :vartype repositories: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GitPatternRepository] + :ivar uri: URI of the repository. Required. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + "uri": {"required": True}, + } + + _attribute_map = { + "repositories": {"key": "repositories", "type": "[GitPatternRepository]"}, + "uri": {"key": "uri", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "search_paths": {"key": "searchPaths", "type": "[str]"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "host_key": {"key": "hostKey", "type": "str"}, + "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + "strict_host_key_checking": {"key": "strictHostKeyChecking", "type": "bool"}, + } + + def __init__( + self, + *, + uri: str, + repositories: Optional[List["_models.GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GitPatternRepository] + :keyword uri: URI of the repository. Required. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super().__init__(**kwargs) + self.repositories = repositories + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ConfigServerProperties(_serialization.Model): + """Config server git properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the config server. Known values are: "NotAvailable", + "Deleted", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :ivar enabled_state: Enabled state of the config server. This is only used in Consumption tier. + Known values are: "Enabled" and "Disabled". + :vartype enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerEnabledState + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "enabled_state": {"key": "enabledState", "type": "str"}, + "config_server": {"key": "configServer", "type": "ConfigServerSettings"}, + } + + def __init__( + self, + *, + error: Optional["_models.Error"] = None, + enabled_state: Optional[Union[str, "_models.ConfigServerEnabledState"]] = None, + config_server: Optional["_models.ConfigServerSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :keyword enabled_state: Enabled state of the config server. This is only used in Consumption + tier. Known values are: "Enabled" and "Disabled". + :paramtype enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerEnabledState + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.enabled_state = enabled_state + self.config_server = config_server + + +class ConfigServerResource(ProxyResource): + """Config Server 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ConfigServerProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ConfigServerProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConfigServerSettings(_serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerGitProperty + """ + + _attribute_map = { + "git_property": {"key": "gitProperty", "type": "ConfigServerGitProperty"}, + } + + def __init__(self, *, git_property: Optional["_models.ConfigServerGitProperty"] = None, **kwargs: Any) -> None: + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerGitProperty + """ + super().__init__(**kwargs) + self.git_property = git_property + + +class ConfigServerSettingsErrorRecord(_serialization.Model): + """Error record of the config server settings. + + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "messages": {"key": "messages", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.uri = uri + self.messages = messages + + +class ConfigServerSettingsValidateResult(_serialization.Model): + """Validation result for config server settings. + + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsErrorRecord] + """ + + _attribute_map = { + "is_valid": {"key": "isValid", "type": "bool"}, + "details": {"key": "details", "type": "[ConfigServerSettingsErrorRecord]"}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["_models.ConfigServerSettingsErrorRecord"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsErrorRecord] + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ConfigurationServiceGitProperty(_serialization.Model): + """Property of git environment. + + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitRepository] + """ + + _attribute_map = { + "repositories": {"key": "repositories", "type": "[ConfigurationServiceGitRepository]"}, + } + + def __init__( + self, *, repositories: Optional[List["_models.ConfigurationServiceGitRepository"]] = None, **kwargs: Any + ) -> None: + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitRepository] + """ + super().__init__(**kwargs) + self.repositories = repositories + + +class ConfigurationServiceGitPropertyValidateResult(_serialization.Model): + """Validation result for configuration service settings. + + :ivar is_valid: Indicate if the configuration service settings are valid. + :vartype is_valid: bool + :ivar git_repos_validation_result: The detail validation results. + :vartype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ValidationMessages] + """ + + _attribute_map = { + "is_valid": {"key": "isValid", "type": "bool"}, + "git_repos_validation_result": {"key": "gitReposValidationResult", "type": "[ValidationMessages]"}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + git_repos_validation_result: Optional[List["_models.ValidationMessages"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_valid: Indicate if the configuration service settings are valid. + :paramtype is_valid: bool + :keyword git_repos_validation_result: The detail validation results. + :paramtype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ValidationMessages] + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.git_repos_validation_result = git_repos_validation_result + + +class ConfigurationServiceGitRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Git repository property payload for Application Configuration Service. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the repository. Required. + :vartype name: str + :ivar patterns: Collection of patterns of the repository. Required. + :vartype patterns: list[str] + :ivar uri: URI of the repository. Required. + :vartype uri: str + :ivar label: Label of the repository. Required. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + :ivar git_implementation: Git libraries used to support various repository providers. Known + values are: "go-git" and "libgit2". + :vartype git_implementation: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GitImplementation + :ivar ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :vartype ca_cert_resource_id: str + """ + + _validation = { + "name": {"required": True}, + "patterns": {"required": True}, + "uri": {"required": True}, + "label": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "patterns": {"key": "patterns", "type": "[str]"}, + "uri": {"key": "uri", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "search_paths": {"key": "searchPaths", "type": "[str]"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "host_key": {"key": "hostKey", "type": "str"}, + "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + "strict_host_key_checking": {"key": "strictHostKeyChecking", "type": "bool"}, + "git_implementation": {"key": "gitImplementation", "type": "str"}, + "ca_cert_resource_id": {"key": "caCertResourceId", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + patterns: List[str], + uri: str, + label: str, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + git_implementation: Optional[Union[str, "_models.GitImplementation"]] = None, + ca_cert_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the repository. Required. + :paramtype name: str + :keyword patterns: Collection of patterns of the repository. Required. + :paramtype patterns: list[str] + :keyword uri: URI of the repository. Required. + :paramtype uri: str + :keyword label: Label of the repository. Required. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + :keyword git_implementation: Git libraries used to support various repository providers. Known + values are: "go-git" and "libgit2". + :paramtype git_implementation: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GitImplementation + :keyword ca_cert_resource_id: Resource Id of CA certificate for https URL of Git repository. + :paramtype ca_cert_resource_id: str + """ + super().__init__(**kwargs) + self.name = name + self.patterns = patterns + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + self.git_implementation = git_implementation + self.ca_cert_resource_id = ca_cert_resource_id + + +class ConfigurationServiceInstance(_serialization.Model): + """Collection of instances belong to the Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Configuration Service instance. + :vartype name: str + :ivar status: Status of the Application Configuration Service instance. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ConfigurationServiceProperties(_serialization.Model): + """Application Configuration Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Configuration Service. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceProvisioningState + :ivar generation: The generation of the Application Configuration Service. Known values are: + "Gen1" and "Gen2". + :vartype generation: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGeneration + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResourceRequests + :ivar instances: Collection of instances belong to Application Configuration Service. + :vartype instances: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceInstance] + :ivar settings: The settings of Application Configuration Service. + :vartype settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "ConfigurationServiceResourceRequests"}, + "instances": {"key": "instances", "type": "[ConfigurationServiceInstance]"}, + "settings": {"key": "settings", "type": "ConfigurationServiceSettings"}, + } + + def __init__( + self, + *, + generation: Union[str, "_models.ConfigurationServiceGeneration"] = "Gen1", + settings: Optional["_models.ConfigurationServiceSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword generation: The generation of the Application Configuration Service. Known values are: + "Gen1" and "Gen2". + :paramtype generation: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGeneration + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.generation = generation + self.resource_requests = None + self.instances = None + self.settings = settings + + +class ConfigurationServiceResource(ProxyResource): + """Application Configuration Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Application Configuration Service properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ConfigurationServiceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ConfigurationServiceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConfigurationServiceResourceCollection(_serialization.Model): + """Object that includes an array of configuration service resources and a possible link for next + set. + + :ivar value: Collection of configuration service resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ConfigurationServiceResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ConfigurationServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of configuration service resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConfigurationServiceResourceRequests(_serialization.Model): + """Resource request payload of Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Application Configuration Service instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Application Configuration Service instance. + :vartype memory: str + :ivar instance_count: Instance count of the Application Configuration Service. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ConfigurationServiceSettings(_serialization.Model): + """The settings of Application Configuration Service. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitProperty + :ivar refresh_interval_in_seconds: How often (in seconds) to check repository updates. Minimum + value is 0. + :vartype refresh_interval_in_seconds: int + """ + + _attribute_map = { + "git_property": {"key": "gitProperty", "type": "ConfigurationServiceGitProperty"}, + "refresh_interval_in_seconds": {"key": "refreshIntervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + git_property: Optional["_models.ConfigurationServiceGitProperty"] = None, + refresh_interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitProperty + :keyword refresh_interval_in_seconds: How often (in seconds) to check repository updates. + Minimum value is 0. + :paramtype refresh_interval_in_seconds: int + """ + super().__init__(**kwargs) + self.git_property = git_property + self.refresh_interval_in_seconds = refresh_interval_in_seconds + + +class ConfigurationServiceSettingsValidateResult(_serialization.Model): + """Validation result for configuration service settings. + + :ivar git_property_validation_result: Validation result for configuration service settings. + :vartype git_property_validation_result: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + + _attribute_map = { + "git_property_validation_result": { + "key": "gitPropertyValidationResult", + "type": "ConfigurationServiceGitPropertyValidateResult", + }, + } + + def __init__( + self, + *, + git_property_validation_result: Optional["_models.ConfigurationServiceGitPropertyValidateResult"] = None, + **kwargs: Any + ) -> None: + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + super().__init__(**kwargs) + self.git_property_validation_result = git_property_validation_result + + +class ContainerProbeSettings(_serialization.Model): + """Container liveness and readiness probe settings. + + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool + """ + + _attribute_map = { + "disable_probe": {"key": "disableProbe", "type": "bool"}, + } + + def __init__(self, *, disable_probe: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ + super().__init__(**kwargs) + self.disable_probe = disable_probe + + +class ContainerRegistryCredentials(_serialization.Model): + """The credential for the container registry resource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContainerRegistryBasicCredentials + + All required parameters must be populated in order to send to Azure. + + :ivar type: The credential type of the container registry credentials. Required. + :vartype type: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + _subtype_map = {"type": {"BasicAuth": "ContainerRegistryBasicCredentials"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + + +class ContainerRegistryBasicCredentials(ContainerRegistryCredentials): + """The basic authentication properties for the container registry resource. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The credential type of the container registry credentials. Required. + :vartype type: str + :ivar server: The login server of the Container Registry. Required. + :vartype server: str + :ivar username: The username of the Container Registry. Required. + :vartype username: str + :ivar password: The password of the Container Registry. Required. + :vartype password: str + """ + + _validation = { + "type": {"required": True}, + "server": {"required": True}, + "username": {"required": True}, + "password": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__(self, *, server: str, username: str, password: str, **kwargs: Any) -> None: + """ + :keyword server: The login server of the Container Registry. Required. + :paramtype server: str + :keyword username: The username of the Container Registry. Required. + :paramtype username: str + :keyword password: The password of the Container Registry. Required. + :paramtype password: str + """ + super().__init__(**kwargs) + self.type: str = "BasicAuth" + self.server = server + self.username = username + self.password = password + + +class ContainerRegistryProperties(_serialization.Model): + """Container registry resource payload. + + 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 credentials: The credentials of the container registry resource. Required. + :vartype credentials: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryCredentials + :ivar provisioning_state: State of the Container Registry. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProvisioningState + """ + + _validation = { + "credentials": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "credentials": {"key": "credentials", "type": "ContainerRegistryCredentials"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, credentials: "_models.ContainerRegistryCredentials", **kwargs: Any) -> None: + """ + :keyword credentials: The credentials of the container registry resource. Required. + :paramtype credentials: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryCredentials + """ + super().__init__(**kwargs) + self.credentials = credentials + self.provisioning_state = None + + +class ContainerRegistryResource(ProxyResource): + """Container registry resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the container registry resource payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ContainerRegistryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ContainerRegistryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the container registry resource payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ContainerRegistryResourceCollection(_serialization.Model): + """Collection compose of container registry resources list and a possible link for next page. + + :ivar value: The container registry resources list. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerRegistryResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ContainerRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The container registry resources list. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerRegistryValidateResult(_serialization.Model): + """Validation result for container registry properties. + + :ivar is_valid: Indicate if the container registry properties are valid. + :vartype is_valid: bool + :ivar message: Detailed validation messages. + :vartype message: str + """ + + _attribute_map = { + "is_valid": {"key": "isValid", "type": "bool"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword is_valid: Indicate if the container registry properties are valid. + :paramtype is_valid: bool + :keyword message: Detailed validation messages. + :paramtype message: str + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class ContentCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + 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 type: The type of the certificate source. Required. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState + :ivar content: The content of uploaded certificate. + :vartype content: str + """ + + _validation = { + "type": {"required": True}, + "thumbprint": {"readonly": True}, + "issuer": {"readonly": True}, + "issued_date": {"readonly": True}, + "expiration_date": {"readonly": True}, + "activate_date": {"readonly": True}, + "subject_name": {"readonly": True}, + "dns_names": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "issued_date": {"key": "issuedDate", "type": "str"}, + "expiration_date": {"key": "expirationDate", "type": "str"}, + "activate_date": {"key": "activateDate", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "dns_names": {"key": "dnsNames", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "content": {"key": "content", "type": "str"}, + } + + def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ + super().__init__(**kwargs) + self.type: str = "ContentCertificate" + self.content = content + + +class CustomContainer(_serialization.Model): + """Custom container payload. + + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ImageRegistryCredential + :ivar language_framework: Language framework of the container image uploaded. Supported values: + "springboot", "", null. + :vartype language_framework: str + """ + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "container_image": {"key": "containerImage", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "image_registry_credential": {"key": "imageRegistryCredential", "type": "ImageRegistryCredential"}, + "language_framework": {"key": "languageFramework", "type": "str"}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + container_image: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + image_registry_credential: Optional["_models.ImageRegistryCredential"] = None, + language_framework: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ImageRegistryCredential + :keyword language_framework: Language framework of the container image uploaded. Supported + values: "springboot", "", null. + :paramtype language_framework: str + """ + super().__init__(**kwargs) + self.server = server + self.container_image = container_image + self.command = command + self.args = args + self.image_registry_credential = image_registry_credential + self.language_framework = language_framework + + +class CustomContainerUserSourceInfo(UserSourceInfo): + """Custom container user source info. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomContainer + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "custom_container": {"key": "customContainer", "type": "CustomContainer"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + custom_container: Optional["_models.CustomContainer"] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomContainer + """ + super().__init__(version=version, **kwargs) + self.type: str = "Container" + self.custom_container = custom_container + + +class CustomDomainProperties(_serialization.Model): + """Custom domain of app resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + :ivar app_name: The app name of domain. + :vartype app_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str + :ivar provisioning_state: Provisioning state of the Domain. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResourceProvisioningState + """ + + _validation = { + "app_name": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "thumbprint": {"key": "thumbprint", "type": "str"}, + "app_name": {"key": "appName", "type": "str"}, + "cert_name": {"key": "certName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, thumbprint: Optional[str] = None, cert_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super().__init__(**kwargs) + self.thumbprint = thumbprint + self.app_name = None + self.cert_name = cert_name + self.provisioning_state = None + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "CustomDomainProperties"}, + } + + def __init__(self, *, properties: Optional["_models.CustomDomainProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(_serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CustomDomainResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(_serialization.Model): + """Custom domain validate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name to be validated. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, **kwargs: Any) -> None: + """ + :keyword name: Name to be validated. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class CustomDomainValidateResult(_serialization.Model): + """Validation result for custom domain. + + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str + """ + + _attribute_map = { + "is_valid": {"key": "isValid", "type": "bool"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, is_valid: Optional[bool] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ + super().__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class CustomizedAcceleratorProperties(_serialization.Model): + """Customized accelerator properties payload. + + 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 provisioning_state: State of the customized accelerator. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProvisioningState + :ivar accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" and + "Fragment". + :vartype accelerator_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorType + :ivar display_name: + :vartype display_name: str + :ivar description: + :vartype description: str + :ivar icon_url: + :vartype icon_url: str + :ivar accelerator_tags: + :vartype accelerator_tags: list[str] + :ivar imports: Imports references all imports that this accelerator/fragment depends upon. + :vartype imports: list[str] + :ivar git_repository: Required. + :vartype git_repository: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorGitRepository + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "imports": {"readonly": True}, + "git_repository": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "accelerator_type": {"key": "acceleratorType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "icon_url": {"key": "iconUrl", "type": "str"}, + "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, + "imports": {"key": "imports", "type": "[str]"}, + "git_repository": {"key": "gitRepository", "type": "AcceleratorGitRepository"}, + } + + def __init__( + self, + *, + git_repository: "_models.AcceleratorGitRepository", + accelerator_type: Optional[Union[str, "_models.CustomizedAcceleratorType"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + icon_url: Optional[str] = None, + accelerator_tags: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword accelerator_type: Type of the customized accelerator. Known values are: "Accelerator" + and "Fragment". + :paramtype accelerator_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorType + :keyword display_name: + :paramtype display_name: str + :keyword description: + :paramtype description: str + :keyword icon_url: + :paramtype icon_url: str + :keyword accelerator_tags: + :paramtype accelerator_tags: list[str] + :keyword git_repository: Required. + :paramtype git_repository: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.AcceleratorGitRepository + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.accelerator_type = accelerator_type + self.display_name = display_name + self.description = description + self.icon_url = icon_url + self.accelerator_tags = accelerator_tags + self.imports = None + self.git_repository = git_repository + + +class CustomizedAcceleratorResource(ProxyResource): + """Customized accelerator 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Customized accelerator properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties + :ivar sku: Sku of the customized accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "CustomizedAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.CustomizedAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Customized accelerator properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties + :keyword sku: Sku of the customized accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class CustomizedAcceleratorResourceCollection(_serialization.Model): + """CustomizedAcceleratorResourceCollection. + + :ivar value: + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CustomizedAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.CustomizedAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomizedAcceleratorValidateResult(_serialization.Model): + """Validation result for customized accelerator properties. + + :ivar state: State of the customized accelerator validation result. Known values are: "Valid" + and "Invalid". + :vartype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResultState + :ivar error_message: The detail validation results. + :vartype error_message: str + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.CustomizedAcceleratorValidateResultState"] = "Valid", + error_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: State of the customized accelerator validation result. Known values are: + "Valid" and "Invalid". + :paramtype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResultState + :keyword error_message: The detail validation results. + :paramtype error_message: str + """ + super().__init__(**kwargs) + self.state = state + self.error_message = error_message + + +class CustomPersistentDiskResource(_serialization.Model): + """Custom persistent disk resource payload. + + All required parameters must be populated in order to send to Azure. + + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :vartype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskProperties + :ivar storage_id: The resource id of Azure Spring Apps Storage resource. Required. + :vartype storage_id: str + """ + + _validation = { + "storage_id": {"required": True}, + } + + _attribute_map = { + "custom_persistent_disk_properties": { + "key": "customPersistentDiskProperties", + "type": "CustomPersistentDiskProperties", + }, + "storage_id": {"key": "storageId", "type": "str"}, + } + + def __init__( + self, + *, + storage_id: str, + custom_persistent_disk_properties: Optional["_models.CustomPersistentDiskProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: The resource id of Azure Spring Apps Storage resource. Required. + :paramtype storage_id: str + """ + super().__init__(**kwargs) + self.custom_persistent_disk_properties = custom_persistent_disk_properties + self.storage_id = storage_id + + +class CustomScaleRule(_serialization.Model): + """Azure Spring Apps App Instance Custom scaling rule. + + :ivar type: Type of the custom scale rule + eg: azure-servicebus, redis etc. + :vartype type: str + :ivar metadata: Metadata properties to describe custom scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of the custom scale rule + eg: azure-servicebus, redis etc. + :paramtype type: str + :keyword metadata: Metadata properties to describe custom scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + super().__init__(**kwargs) + self.type = type + self.metadata = metadata + self.auth = auth + + +class DeploymentInstance(_serialization.Model): + """Deployment instance payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the deployment instance. + :vartype name: str + :ivar status: Status of the deployment instance. + :vartype status: str + :ivar reason: Failed reason of the deployment instance. + :vartype reason: str + :ivar discovery_status: Discovery status of the deployment instance. + :vartype discovery_status: str + :ivar start_time: Start time of the deployment instance. + :vartype start_time: str + :ivar zone: Availability zone information of the deployment instance. + :vartype zone: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + "reason": {"readonly": True}, + "discovery_status": {"readonly": True}, + "start_time": {"readonly": True}, + "zone": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + "discovery_status": {"key": "discoveryStatus", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "zone": {"key": "zone", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + self.zone = None + + +class DeploymentList(_serialization.Model): + """A list of deployments resource ids. + + :ivar deployments: A list of deployment resource ids. + :vartype deployments: list[str] + """ + + _attribute_map = { + "deployments": {"key": "deployments", "type": "[str]"}, + } + + def __init__(self, *, deployments: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword deployments: A list of deployment resource ids. + :paramtype deployments: list[str] + """ + super().__init__(**kwargs) + self.deployments = deployments + + +class DeploymentResource(ProxyResource): + """Deployment resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the Deployment resource. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "DeploymentResourceProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.DeploymentResourceProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class DeploymentResourceCollection(_serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[DeploymentResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(_serialization.Model): + """Deployment resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Known values are: "Creating", + "Updating", "Succeeded", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceProvisioningState + :ivar status: Status of the Deployment. Known values are: "Stopped" and "Running". + :vartype status: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. + :vartype active: bool + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentInstance] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "source": {"key": "source", "type": "UserSourceInfo"}, + "deployment_settings": {"key": "deploymentSettings", "type": "DeploymentSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "active": {"key": "active", "type": "bool"}, + "instances": {"key": "instances", "type": "[DeploymentInstance]"}, + } + + def __init__( + self, + *, + source: Optional["_models.UserSourceInfo"] = None, + deployment_settings: Optional["_models.DeploymentSettings"] = None, + active: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ + super().__init__(**kwargs) + self.source = source + self.deployment_settings = deployment_settings + self.provisioning_state = None + self.status = None + self.active = active + self.instances = None + + +class DeploymentSettings(_serialization.Model): + """Deployment settings payload. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :vartype resource_requests: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar apms: Collection of ApmReferences. + :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, JSON] + :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted + if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype liveness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be + removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype readiness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. + If specified, no other probes are executed until this completes successfully. If this probe + fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to + provide different probe parameters at the beginning of a App Instance's lifecycle, when it + might take a long time to load data or warm a cache, than during steady-state operation. This + cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype startup_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to + terminate gracefully. May be decreased in delete request. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If + this value is nil, the default grace period will be used instead. The grace period is the + duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :vartype termination_grace_period_seconds: int + :ivar scale: Scaling properties for the Azure Spring Apps App Instance. + :vartype scale: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Scale + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerProbeSettings + """ + + _attribute_map = { + "resource_requests": {"key": "resourceRequests", "type": "ResourceRequests"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "addon_configs": {"key": "addonConfigs", "type": "{object}"}, + "liveness_probe": {"key": "livenessProbe", "type": "Probe"}, + "readiness_probe": {"key": "readinessProbe", "type": "Probe"}, + "startup_probe": {"key": "startupProbe", "type": "Probe"}, + "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, + "scale": {"key": "scale", "type": "Scale"}, + "container_probe_settings": {"key": "containerProbeSettings", "type": "ContainerProbeSettings"}, + } + + def __init__( + self, + *, + resource_requests: Optional["_models.ResourceRequests"] = None, + environment_variables: Optional[Dict[str, str]] = None, + apms: Optional[List["_models.ApmReference"]] = None, + addon_configs: Optional[Dict[str, JSON]] = None, + liveness_probe: Optional["_models.Probe"] = None, + readiness_probe: Optional["_models.Probe"] = None, + startup_probe: Optional["_models.Probe"] = None, + termination_grace_period_seconds: int = 90, + scale: Optional["_models.Scale"] = None, + container_probe_settings: Optional["_models.ContainerProbeSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword apms: Collection of ApmReferences. + :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, JSON] + :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be + restarted if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype liveness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will + be removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype readiness_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :keyword startup_probe: StartupProbe indicates that the App Instance has successfully + initialized. If specified, no other probes are executed until this completes successfully. If + this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be + used to provide different probe parameters at the beginning of a App Instance's lifecycle, when + it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype startup_probe: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Probe + :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs + to terminate gracefully. May be decreased in delete request. Value must be non-negative + integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut + down). If this value is nil, the default grace period will be used instead. The grace period is + the duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :paramtype termination_grace_period_seconds: int + :keyword scale: Scaling properties for the Azure Spring Apps App Instance. + :paramtype scale: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Scale + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerProbeSettings + """ + super().__init__(**kwargs) + self.resource_requests = resource_requests + self.environment_variables = environment_variables + self.apms = apms + self.addon_configs = addon_configs + self.liveness_probe = liveness_probe + self.readiness_probe = readiness_probe + self.startup_probe = startup_probe + self.termination_grace_period_seconds = termination_grace_period_seconds + self.scale = scale + self.container_probe_settings = container_probe_settings + + +class DevToolPortalComponent(_serialization.Model): + """DevToolPortalComponent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: + :vartype name: str + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResourceRequests + :ivar instances: Collection of instances belong to Dev Tool Portal. + :vartype instances: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalInstance] + """ + + _validation = { + "name": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "DevToolPortalResourceRequests"}, + "instances": {"key": "instances", "type": "[DevToolPortalInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.resource_requests = None + self.instances = None + + +class DevToolPortalFeatureDetail(_serialization.Model): + """Detail settings for Dev Tool Portal feature. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar state: State of the plugin. Known values are: "Enabled" and "Disabled". + :vartype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureState + :ivar route: Route path to visit the plugin. + :vartype route: str + """ + + _validation = { + "route": {"readonly": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "route": {"key": "route", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DevToolPortalFeatureState"] = "Enabled", **kwargs: Any) -> None: + """ + :keyword state: State of the plugin. Known values are: "Enabled" and "Disabled". + :paramtype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureState + """ + super().__init__(**kwargs) + self.state = state + self.route = None + + +class DevToolPortalFeatureSettings(_serialization.Model): + """Settings for Dev Tool Portal. + + :ivar application_accelerator: Detail of Accelerator plugin. + :vartype application_accelerator: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail + :ivar application_live_view: Detail of App Live View plugin. + :vartype application_live_view: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail + """ + + _attribute_map = { + "application_accelerator": {"key": "applicationAccelerator", "type": "DevToolPortalFeatureDetail"}, + "application_live_view": {"key": "applicationLiveView", "type": "DevToolPortalFeatureDetail"}, + } + + def __init__( + self, + *, + application_accelerator: Optional["_models.DevToolPortalFeatureDetail"] = None, + application_live_view: Optional["_models.DevToolPortalFeatureDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_accelerator: Detail of Accelerator plugin. + :paramtype application_accelerator: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail + :keyword application_live_view: Detail of App Live View plugin. + :paramtype application_live_view: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureDetail + """ + super().__init__(**kwargs) + self.application_accelerator = application_accelerator + self.application_live_view = application_live_view + + +class DevToolPortalInstance(_serialization.Model): + """Collection of instances belong to the Dev Tool Portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Dev Tool Portal instance. + :vartype name: str + :ivar status: Status of the Dev Tool Portal instance. It can be Pending, Running, Succeeded, + Failed, Unknown. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class DevToolPortalProperties(_serialization.Model): + """Dev Tool Portal properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Dev Tool Portal. Known values are: "Creating", + "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProvisioningState + :ivar components: Collection of components belong to Dev Tool Portal. + :vartype components: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalComponent] + :ivar public: Indicates whether the resource exposes public endpoint. + :vartype public: bool + :ivar url: URL of the resource, exposed when 'public' is true. + :vartype url: str + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalSsoProperties + :ivar features: Settings for Dev Tool Portal. + :vartype features: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureSettings + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "components": {"readonly": True}, + "url": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "components": {"key": "components", "type": "[DevToolPortalComponent]"}, + "public": {"key": "public", "type": "bool"}, + "url": {"key": "url", "type": "str"}, + "sso_properties": {"key": "ssoProperties", "type": "DevToolPortalSsoProperties"}, + "features": {"key": "features", "type": "DevToolPortalFeatureSettings"}, + } + + def __init__( + self, + *, + public: bool = False, + sso_properties: Optional["_models.DevToolPortalSsoProperties"] = None, + features: Optional["_models.DevToolPortalFeatureSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the resource exposes public endpoint. + :paramtype public: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalSsoProperties + :keyword features: Settings for Dev Tool Portal. + :paramtype features: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalFeatureSettings + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.components = None + self.public = public + self.url = None + self.sso_properties = sso_properties + self.features = features + + +class DevToolPortalResource(ProxyResource): + """Dev Tool Portal 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Dev Tool Portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "DevToolPortalProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DevToolPortalProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Dev Tool Portal properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DevToolPortalResourceCollection(_serialization.Model): + """Object that includes an array of Dev Tool Portal resources and a possible link for next set. + + :ivar value: Collection of Dev Tool Portal resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[DevToolPortalResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.DevToolPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Dev Tool Portal resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DevToolPortalResourceRequests(_serialization.Model): + """The resource quantity for required CPU and Memory of Dev Tool Portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu quantity allocated to each Dev Tool Portal instance. 1 core can be represented + by 1 or 1000m. + :vartype cpu: str + :ivar memory: Memory quantity allocated to each Dev Tool Portal instance. 1 GB can be + represented by 1Gi or 1024Mi. + :vartype memory: str + :ivar instance_count: Desired instance count of Dev Tool Portal. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class DevToolPortalSsoProperties(_serialization.Model): + """Single sign-on related configuration. + + :ivar scopes: It defines the specific actions applications can be allowed to do on a user's + behalf. + :vartype scopes: list[str] + :ivar client_id: The public identifier for the application. + :vartype client_id: str + :ivar client_secret: The secret known only to the application and the authorization server. + :vartype client_secret: str + :ivar metadata_url: The URI of a JSON file with generic OIDC provider configuration. + :vartype metadata_url: str + """ + + _attribute_map = { + "scopes": {"key": "scopes", "type": "[str]"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "metadata_url": {"key": "metadataUrl", "type": "str"}, + } + + def __init__( + self, + *, + scopes: Optional[List[str]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + metadata_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword scopes: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scopes: list[str] + :keyword client_id: The public identifier for the application. + :paramtype client_id: str + :keyword client_secret: The secret known only to the application and the authorization server. + :paramtype client_secret: str + :keyword metadata_url: The URI of a JSON file with generic OIDC provider configuration. + :paramtype metadata_url: str + """ + super().__init__(**kwargs) + self.scopes = scopes + self.client_id = client_id + self.client_secret = client_secret + self.metadata_url = metadata_url + + +class DiagnosticParameters(_serialization.Model): + """Diagnostic parameters of diagnostic operations. + + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str + """ + + _attribute_map = { + "app_instance": {"key": "appInstance", "type": "str"}, + "file_path": {"key": "filePath", "type": "str"}, + "duration": {"key": "duration", "type": "str"}, + } + + def __init__( + self, + *, + app_instance: Optional[str] = None, + file_path: Optional[str] = None, + duration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ + super().__init__(**kwargs) + self.app_instance = app_instance + self.file_path = file_path + self.duration = duration + + +class Error(_serialization.Model): + """The error code compose of code and message. + + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class EurekaServerProperties(_serialization.Model): + """Eureka server properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the eureka server. Known values are: "Failed", "Succeeded", + "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerState + :ivar enabled_state: Enabled state of the eureka server. This is only used in Consumption tier. + Known values are: "Enabled" and "Disabled". + :vartype enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerEnabledState + :ivar error: Error when applying eureka server settings. + :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "enabled_state": {"key": "enabledState", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + } + + def __init__( + self, + *, + enabled_state: Optional[Union[str, "_models.EurekaServerEnabledState"]] = None, + error: Optional["_models.Error"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled_state: Enabled state of the eureka server. This is only used in Consumption + tier. Known values are: "Enabled" and "Disabled". + :paramtype enabled_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerEnabledState + :keyword error: Error when applying eureka server settings. + :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.enabled_state = enabled_state + self.error = error + + +class EurekaServerResource(ProxyResource): + """Eureka server 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the eureka server resource. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "EurekaServerProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EurekaServerProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the eureka server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EurekaServerResourceCollection(_serialization.Model): + """Object that includes an array of Eureka server resources and a possible link for next set. + + :ivar value: Collection of Eureka server resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EurekaServerResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.EurekaServerResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Eureka server resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProbeAction(_serialization.Model): + """The action of the probe. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExecAction, HTTPGetAction, TCPSocketAction + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + _subtype_map = { + "type": {"ExecAction": "ExecAction", "HTTPGetAction": "HTTPGetAction", "TCPSocketAction": "TCPSocketAction"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + + +class ExecAction(ProbeAction): + """ExecAction describes a "run in container" action. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType + :ivar command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :vartype command: list[str] + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + } + + def __init__(self, *, command: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :paramtype command: list[str] + """ + super().__init__(**kwargs) + self.type: str = "ExecAction" + self.command = command + + +class GatewayApiMetadataProperties(_serialization.Model): + """API metadata property for Spring Cloud Gateway. + + :ivar title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :vartype title: str + :ivar description: Detailed description of the APIs available on the Gateway instance (default: + ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :vartype description: str + :ivar documentation: Location of additional documentation for the APIs available on the Gateway + instance. + :vartype documentation: str + :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). + :vartype version: str + :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. + :vartype server_url: str + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "documentation": {"key": "documentation", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "server_url": {"key": "serverUrl", "type": "str"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + documentation: Optional[str] = None, + version: Optional[str] = None, + server_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :paramtype title: str + :keyword description: Detailed description of the APIs available on the Gateway instance + (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :paramtype description: str + :keyword documentation: Location of additional documentation for the APIs available on the + Gateway instance. + :paramtype documentation: str + :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ + ). + :paramtype version: str + :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway + instance. + :paramtype server_url: str + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.documentation = documentation + self.version = version + self.server_url = server_url + + +class GatewayApiRoute(_serialization.Model): + """API route config of the Spring Cloud Gateway. + + :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. + :vartype title: str + :ivar description: A description, will be applied to methods in the generated OpenAPI + documentation. + :vartype description: str + :ivar uri: Full uri, will override ``appName``. + :vartype uri: str + :ivar sso_enabled: Enable sso validation. + :vartype sso_enabled: bool + :ivar token_relay: Pass currently-authenticated user's identity token to application service, + default is 'false'. + :vartype token_relay: bool + :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate + may be evaluated against request headers and parameter values. All of the predicates associated + with a route must evaluate to true for the route to be matched to the request. + :vartype predicates: list[str] + :ivar filters: To modify the request before sending it to the target endpoint, or the received + response. + :vartype filters: list[str] + :ivar order: Route processing order. + :vartype order: int + :ivar tags: Classification tags, will be applied to methods in the generated OpenAPI + documentation. + :vartype tags: list[str] + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, + "token_relay": {"key": "tokenRelay", "type": "bool"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + "order": {"key": "order", "type": "int"}, + "tags": {"key": "tags", "type": "[str]"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + uri: Optional[str] = None, + sso_enabled: Optional[bool] = None, + token_relay: Optional[bool] = None, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. + :paramtype title: str + :keyword description: A description, will be applied to methods in the generated OpenAPI + documentation. + :paramtype description: str + :keyword uri: Full uri, will override ``appName``. + :paramtype uri: str + :keyword sso_enabled: Enable sso validation. + :paramtype sso_enabled: bool + :keyword token_relay: Pass currently-authenticated user's identity token to application + service, default is 'false'. + :paramtype token_relay: bool + :keyword predicates: A number of conditions to evaluate a route for each request. Each + predicate may be evaluated against request headers and parameter values. All of the predicates + associated with a route must evaluate to true for the route to be matched to the request. + :paramtype predicates: list[str] + :keyword filters: To modify the request before sending it to the target endpoint, or the + received response. + :paramtype filters: list[str] + :keyword order: Route processing order. + :paramtype order: int + :keyword tags: Classification tags, will be applied to methods in the generated OpenAPI + documentation. + :paramtype tags: list[str] + """ + super().__init__(**kwargs) + self.title = title + self.description = description + self.uri = uri + self.sso_enabled = sso_enabled + self.token_relay = token_relay + self.predicates = predicates + self.filters = filters + self.order = order + self.tags = tags + + +class GatewayCorsProperties(_serialization.Model): + """Cross-Origin Resource Sharing property. + + :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :vartype allowed_origins: list[str] + :ivar allowed_origin_patterns: Allowed origin patterns to make cross-site requests. + :vartype allowed_origin_patterns: list[str] + :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :vartype allowed_methods: list[str] + :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows + actual requests to send any header. + :vartype allowed_headers: list[str] + :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :vartype max_age: int + :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid + values: ``true``\ , ``false``. + :vartype allow_credentials: bool + :ivar exposed_headers: HTTP response headers to expose for cross-site requests. + :vartype exposed_headers: list[str] + """ + + _attribute_map = { + "allowed_origins": {"key": "allowedOrigins", "type": "[str]"}, + "allowed_origin_patterns": {"key": "allowedOriginPatterns", "type": "[str]"}, + "allowed_methods": {"key": "allowedMethods", "type": "[str]"}, + "allowed_headers": {"key": "allowedHeaders", "type": "[str]"}, + "max_age": {"key": "maxAge", "type": "int"}, + "allow_credentials": {"key": "allowCredentials", "type": "bool"}, + "exposed_headers": {"key": "exposedHeaders", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + allowed_origin_patterns: Optional[List[str]] = None, + allowed_methods: Optional[List[str]] = None, + allowed_headers: Optional[List[str]] = None, + max_age: Optional[int] = None, + allow_credentials: Optional[bool] = None, + exposed_headers: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_origin_patterns: Allowed origin patterns to make cross-site requests. + :paramtype allowed_origin_patterns: list[str] + :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :paramtype allowed_methods: list[str] + :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` + allows actual requests to send any header. + :paramtype allowed_headers: list[str] + :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :paramtype max_age: int + :keyword allow_credentials: Whether user credentials are supported on cross-site requests. + Valid values: ``true``\ , ``false``. + :paramtype allow_credentials: bool + :keyword exposed_headers: HTTP response headers to expose for cross-site requests. + :paramtype exposed_headers: list[str] + """ + super().__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_origin_patterns = allowed_origin_patterns + self.allowed_methods = allowed_methods + self.allowed_headers = allowed_headers + self.max_age = max_age + self.allow_credentials = allow_credentials + self.exposed_headers = exposed_headers + + +class GatewayCustomDomainProperties(_serialization.Model): + """The properties of custom domain for Spring Cloud Gateway. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + "thumbprint": {"key": "thumbprint", "type": "str"}, + } + + def __init__(self, *, thumbprint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super().__init__(**kwargs) + self.thumbprint = thumbprint + + +class GatewayCustomDomainResource(ProxyResource): + """Custom domain of the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: The properties of custom domain for Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "GatewayCustomDomainProperties"}, + } + + def __init__(self, *, properties: Optional["_models.GatewayCustomDomainProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of custom domain for Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GatewayCustomDomainResourceCollection(_serialization.Model): + """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible + link for next set. + + :ivar value: Collection of Spring Cloud Gateway custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[GatewayCustomDomainResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.GatewayCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Spring Cloud Gateway custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayInstance(_serialization.Model): + """Collection of instances belong to the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Spring Cloud Gateway instance. + :vartype name: str + :ivar status: Status of the Spring Cloud Gateway instance. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class GatewayResponseCacheProperties(_serialization.Model): + """Spring Cloud Gateway response cache properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + GatewayLocalResponseCachePerInstanceProperties, GatewayLocalResponseCachePerRouteProperties + + All required parameters must be populated in order to send to Azure. + + :ivar response_cache_type: The type of the response cache. Required. + :vartype response_cache_type: str + """ + + _validation = { + "response_cache_type": {"required": True}, + } + + _attribute_map = { + "response_cache_type": {"key": "responseCacheType", "type": "str"}, + } + + _subtype_map = { + "response_cache_type": { + "LocalCachePerInstance": "GatewayLocalResponseCachePerInstanceProperties", + "LocalCachePerRoute": "GatewayLocalResponseCachePerRouteProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.response_cache_type: Optional[str] = None + + +class GatewayLocalResponseCachePerInstanceProperties(GatewayResponseCacheProperties): + """Spring Cloud Gateway local response cache per instance properties. + + All required parameters must be populated in order to send to Azure. + + :ivar response_cache_type: The type of the response cache. Required. + :vartype response_cache_type: str + :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to + evict some entries. + :vartype size: str + :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). + :vartype time_to_live: str + """ + + _validation = { + "response_cache_type": {"required": True}, + } + + _attribute_map = { + "response_cache_type": {"key": "responseCacheType", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "time_to_live": {"key": "timeToLive", "type": "str"}, + } + + def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to + evict some entries. + :paramtype size: str + :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). + :paramtype time_to_live: str + """ + super().__init__(**kwargs) + self.response_cache_type: str = "LocalCachePerInstance" + self.size = size + self.time_to_live = time_to_live + + +class GatewayLocalResponseCachePerRouteProperties(GatewayResponseCacheProperties): + """Spring Cloud Gateway local response cache per route properties. + + All required parameters must be populated in order to send to Azure. + + :ivar response_cache_type: The type of the response cache. Required. + :vartype response_cache_type: str + :ivar size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to + evict some entries. + :vartype size: str + :ivar time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). + :vartype time_to_live: str + """ + + _validation = { + "response_cache_type": {"required": True}, + } + + _attribute_map = { + "response_cache_type": {"key": "responseCacheType", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "time_to_live": {"key": "timeToLive", "type": "str"}, + } + + def __init__(self, *, size: Optional[str] = None, time_to_live: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword size: Maximum size of cache (10MB, 900KB, 1GB...) to determine if the cache needs to + evict some entries. + :paramtype size: str + :keyword time_to_live: Time before a cached entry is expired (300s, 5m, 1h...). + :paramtype time_to_live: str + """ + super().__init__(**kwargs) + self.response_cache_type: str = "LocalCachePerRoute" + self.size = size + self.time_to_live = time_to_live + + +class GatewayOperatorProperties(_serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayOperatorResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. + :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayInstance] + """ + + _validation = { + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "resource_requests": {"key": "resourceRequests", "type": "GatewayOperatorResourceRequests"}, + "instances": {"key": "instances", "type": "[GatewayInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.resource_requests = None + self.instances = None + + +class GatewayOperatorResourceRequests(_serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway Operator instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway Operator instance. + :vartype memory: str + :ivar instance_count: Instance count of the Spring Cloud Gateway Operator. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class GatewayProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Spring Cloud Gateway properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProvisioningState + :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :vartype public: bool + :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SsoProperties + :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. + :vartype api_metadata_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiMetadataProperties + :ivar cors_properties: Cross-Origin Resource Sharing property. + :vartype cors_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCorsProperties + :ivar client_auth: Client-Certification Authentication. + :vartype client_auth: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesClientAuth + :ivar apm_types: Collection of APM type used in Spring Cloud Gateway. + :vartype apm_types: list[str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmType] + :ivar apms: Collection of ApmReferences in service level. + :vartype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :ivar environment_variables: Environment variables of Spring Cloud Gateway. + :vartype environment_variables: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesEnvironmentVariables + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResourceRequests + :ivar addon_configs: Collection of addons for Spring Cloud Gateway. + :vartype addon_configs: dict[str, JSON] + :ivar instances: Collection of instances belong to Spring Cloud Gateway. + :vartype instances: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayInstance] + :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. + :vartype operator_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayOperatorProperties + :ivar response_cache_properties: The properties to configure different types of response cache + for Spring Cloud Gateway. + :vartype response_cache_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResponseCacheProperties + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "url": {"readonly": True}, + "apm_types": {"unique": True}, + "instances": {"readonly": True}, + "operator_properties": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "public": {"key": "public", "type": "bool"}, + "url": {"key": "url", "type": "str"}, + "https_only": {"key": "httpsOnly", "type": "bool"}, + "sso_properties": {"key": "ssoProperties", "type": "SsoProperties"}, + "api_metadata_properties": {"key": "apiMetadataProperties", "type": "GatewayApiMetadataProperties"}, + "cors_properties": {"key": "corsProperties", "type": "GatewayCorsProperties"}, + "client_auth": {"key": "clientAuth", "type": "GatewayPropertiesClientAuth"}, + "apm_types": {"key": "apmTypes", "type": "[str]"}, + "apms": {"key": "apms", "type": "[ApmReference]"}, + "environment_variables": {"key": "environmentVariables", "type": "GatewayPropertiesEnvironmentVariables"}, + "resource_requests": {"key": "resourceRequests", "type": "GatewayResourceRequests"}, + "addon_configs": {"key": "addonConfigs", "type": "{object}"}, + "instances": {"key": "instances", "type": "[GatewayInstance]"}, + "operator_properties": {"key": "operatorProperties", "type": "GatewayOperatorProperties"}, + "response_cache_properties": {"key": "responseCacheProperties", "type": "GatewayResponseCacheProperties"}, + } + + def __init__( + self, + *, + public: bool = False, + https_only: bool = False, + sso_properties: Optional["_models.SsoProperties"] = None, + api_metadata_properties: Optional["_models.GatewayApiMetadataProperties"] = None, + cors_properties: Optional["_models.GatewayCorsProperties"] = None, + client_auth: Optional["_models.GatewayPropertiesClientAuth"] = None, + apm_types: Optional[List[Union[str, "_models.ApmType"]]] = None, + apms: Optional[List["_models.ApmReference"]] = None, + environment_variables: Optional["_models.GatewayPropertiesEnvironmentVariables"] = None, + resource_requests: Optional["_models.GatewayResourceRequests"] = None, + addon_configs: Optional[Dict[str, JSON]] = None, + response_cache_properties: Optional["_models.GatewayResponseCacheProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SsoProperties + :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. + :paramtype api_metadata_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiMetadataProperties + :keyword cors_properties: Cross-Origin Resource Sharing property. + :paramtype cors_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCorsProperties + :keyword client_auth: Client-Certification Authentication. + :paramtype client_auth: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesClientAuth + :keyword apm_types: Collection of APM type used in Spring Cloud Gateway. + :paramtype apm_types: list[str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmType] + :keyword apms: Collection of ApmReferences in service level. + :paramtype apms: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference] + :keyword environment_variables: Environment variables of Spring Cloud Gateway. + :paramtype environment_variables: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayPropertiesEnvironmentVariables + :keyword resource_requests: The requested resource quantity for required CPU and Memory. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResourceRequests + :keyword addon_configs: Collection of addons for Spring Cloud Gateway. + :paramtype addon_configs: dict[str, JSON] + :keyword response_cache_properties: The properties to configure different types of response + cache for Spring Cloud Gateway. + :paramtype response_cache_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResponseCacheProperties + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.sso_properties = sso_properties + self.api_metadata_properties = api_metadata_properties + self.cors_properties = cors_properties + self.client_auth = client_auth + self.apm_types = apm_types + self.apms = apms + self.environment_variables = environment_variables + self.resource_requests = resource_requests + self.addon_configs = addon_configs + self.instances = None + self.operator_properties = None + self.response_cache_properties = response_cache_properties + + +class GatewayPropertiesClientAuth(_serialization.Model): + """Client-Certification Authentication. + + :ivar certificates: Collection of certificate resource Ids in Azure Spring Apps. + :vartype certificates: list[str] + :ivar certificate_verification: Whether to enable certificate verification or not. Known values + are: "Enabled" and "Disabled". + :vartype certificate_verification: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCertificateVerification + """ + + _validation = { + "certificates": {"unique": True}, + } + + _attribute_map = { + "certificates": {"key": "certificates", "type": "[str]"}, + "certificate_verification": {"key": "certificateVerification", "type": "str"}, + } + + def __init__( + self, + *, + certificates: Optional[List[str]] = None, + certificate_verification: Union[str, "_models.GatewayCertificateVerification"] = "Disabled", + **kwargs: Any + ) -> None: + """ + :keyword certificates: Collection of certificate resource Ids in Azure Spring Apps. + :paramtype certificates: list[str] + :keyword certificate_verification: Whether to enable certificate verification or not. Known + values are: "Enabled" and "Disabled". + :paramtype certificate_verification: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCertificateVerification + """ + super().__init__(**kwargs) + self.certificates = certificates + self.certificate_verification = certificate_verification + + +class GatewayPropertiesEnvironmentVariables(_serialization.Model): + """Environment variables of Spring Cloud Gateway. + + :ivar properties: Non-sensitive properties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "{str}"}, + "secrets": {"key": "secrets", "type": "{str}"}, + } + + def __init__( + self, *, properties: Optional[Dict[str, str]] = None, secrets: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Non-sensitive properties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class GatewayResource(ProxyResource): + """Spring Cloud Gateway 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Spring Cloud Gateway properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProperties + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "GatewayProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.GatewayProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Spring Cloud Gateway properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProperties + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class GatewayResourceCollection(_serialization.Model): + """Object that includes an array of gateway resources and a possible link for next set. + + :ivar value: Collection of gateway resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[GatewayResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.GatewayResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of gateway resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayResourceRequests(_serialization.Model): + """Resource request payload of Spring Cloud Gateway. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway instance. + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, cpu: str = "1", memory: str = "2Gi", **kwargs: Any) -> None: + """ + :keyword cpu: Cpu allocated to each Spring Cloud Gateway instance. + :paramtype cpu: str + :keyword memory: Memory allocated to each Spring Cloud Gateway instance. + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class GatewayRouteConfigOpenApiProperties(_serialization.Model): + """OpenAPI properties of Spring Cloud Gateway route config. + + :ivar uri: The URI of OpenAPI specification. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword uri: The URI of OpenAPI specification. + :paramtype uri: str + """ + super().__init__(**kwargs) + self.uri = uri + + +class GatewayRouteConfigProperties(_serialization.Model): + """API route config of the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway route config. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayProvisioningState + :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :vartype app_resource_id: str + :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. + :vartype open_api: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigOpenApiProperties + :ivar protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" and + "HTTPS". + :vartype protocol: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProtocol + :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ + , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :vartype routes: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiRoute] + :ivar sso_enabled: Enable Single Sign-On in app level. + :vartype sso_enabled: bool + :ivar predicates: A number of conditions to evaluate a route for each request in app level. + Each predicate may be evaluated against request headers and parameter values. All of the + predicates associated with a route must evaluate to true for the route to be matched to the + request. + :vartype predicates: list[str] + :ivar filters: To modify the request before sending it to the target endpoint, or the received + response in app level. + :vartype filters: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "app_resource_id": {"key": "appResourceId", "type": "str"}, + "open_api": {"key": "openApi", "type": "GatewayRouteConfigOpenApiProperties"}, + "protocol": {"key": "protocol", "type": "str"}, + "routes": {"key": "routes", "type": "[GatewayApiRoute]"}, + "sso_enabled": {"key": "ssoEnabled", "type": "bool"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + } + + def __init__( + self, + *, + app_resource_id: Optional[str] = None, + open_api: Optional["_models.GatewayRouteConfigOpenApiProperties"] = None, + protocol: Union[str, "_models.GatewayRouteConfigProtocol"] = "HTTP", + routes: Optional[List["_models.GatewayApiRoute"]] = None, + sso_enabled: Optional[bool] = None, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :paramtype app_resource_id: str + :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. + :paramtype open_api: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigOpenApiProperties + :keyword protocol: Protocol of routed Azure Spring Apps applications. Known values are: "HTTP" + and "HTTPS". + :paramtype protocol: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProtocol + :keyword routes: Array of API routes, each route contains properties such as ``title``\ , + ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :paramtype routes: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayApiRoute] + :keyword sso_enabled: Enable Single Sign-On in app level. + :paramtype sso_enabled: bool + :keyword predicates: A number of conditions to evaluate a route for each request in app level. + Each predicate may be evaluated against request headers and parameter values. All of the + predicates associated with a route must evaluate to true for the route to be matched to the + request. + :paramtype predicates: list[str] + :keyword filters: To modify the request before sending it to the target endpoint, or the + received response in app level. + :paramtype filters: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.app_resource_id = app_resource_id + self.open_api = open_api + self.protocol = protocol + self.routes = routes + self.sso_enabled = sso_enabled + self.predicates = predicates + self.filters = filters + + +class GatewayRouteConfigResource(ProxyResource): + """Spring Cloud Gateway route config 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: API route config of the Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "GatewayRouteConfigProperties"}, + } + + def __init__(self, *, properties: Optional["_models.GatewayRouteConfigProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: API route config of the Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GatewayRouteConfigResourceCollection(_serialization.Model): + """Object that includes an array of Spring Cloud Gateway route config resources and a possible + link for next set. + + :ivar value: Collection of Spring Cloud Gateway route config resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[GatewayRouteConfigResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.GatewayRouteConfigResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Spring Cloud Gateway route config resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GitPatternRepository(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Git repository property payload for config server. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the repository. Required. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: URI of the repository. Required. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + "name": {"required": True}, + "uri": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "pattern": {"key": "pattern", "type": "[str]"}, + "uri": {"key": "uri", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "search_paths": {"key": "searchPaths", "type": "[str]"}, + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "host_key": {"key": "hostKey", "type": "str"}, + "host_key_algorithm": {"key": "hostKeyAlgorithm", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + "strict_host_key_checking": {"key": "strictHostKeyChecking", "type": "bool"}, + } + + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the repository. Required. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: URI of the repository. Required. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super().__init__(**kwargs) + self.name = name + self.pattern = pattern + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class GloballyEnabledApms(_serialization.Model): + """Globally enabled APMs payload. + + :ivar value: Collection of the globally enabled APMs. + :vartype value: list[str] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword value: Collection of the globally enabled APMs. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + +class HTTPGetAction(ProbeAction): + """HTTPGetAction describes an action based on HTTP Get requests. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType + :ivar path: Path to access on the HTTP server. + :vartype path: str + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and + "HTTPS". + :vartype scheme: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.HTTPSchemeType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "scheme": {"key": "scheme", "type": "str"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + scheme: Optional[Union[str, "_models.HTTPSchemeType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: Path to access on the HTTP server. + :paramtype path: str + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Known values are: "HTTP" and + "HTTPS". + :paramtype scheme: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.HTTPSchemeType + """ + super().__init__(**kwargs) + self.type: str = "HTTPGetAction" + self.path = path + self.scheme = scheme + + +class HttpScaleRule(_serialization.Model): + """Azure Spring Apps App Instance Http scaling rule. + + :ivar metadata: Metadata properties to describe http scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + + _attribute_map = { + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword metadata: Metadata properties to describe http scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + super().__init__(**kwargs) + self.metadata = metadata + self.auth = auth + + +class ImageRegistryCredential(_serialization.Model): + """Credential of the image registry. + + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str + """ + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ + super().__init__(**kwargs) + self.username = username + self.password = password + + +class IngressConfig(_serialization.Model): + """Ingress configuration payload for Azure Spring Apps resource. + + :ivar read_timeout_in_seconds: Ingress read time out in seconds. + :vartype read_timeout_in_seconds: int + """ + + _attribute_map = { + "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, read_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword read_timeout_in_seconds: Ingress read time out in seconds. + :paramtype read_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.read_timeout_in_seconds = read_timeout_in_seconds + + +class IngressSettings(_serialization.Model): + """App ingress settings payload. + + :ivar read_timeout_in_seconds: Ingress read time out in seconds. + :vartype read_timeout_in_seconds: int + :ivar send_timeout_in_seconds: Ingress send time out in seconds. + :vartype send_timeout_in_seconds: int + :ivar session_affinity: Type of the affinity, set this to Cookie to enable session affinity. + Known values are: "Cookie" and "None". + :vartype session_affinity: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SessionAffinity + :ivar session_cookie_max_age: Time in seconds until the cookie expires. + :vartype session_cookie_max_age: int + :ivar backend_protocol: How ingress should communicate with this app backend service. Known + values are: "GRPC" and "Default". + :vartype backend_protocol: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BackendProtocol + :ivar client_auth: Client-Certification Authentication. + :vartype client_auth: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettingsClientAuth + """ + + _attribute_map = { + "read_timeout_in_seconds": {"key": "readTimeoutInSeconds", "type": "int"}, + "send_timeout_in_seconds": {"key": "sendTimeoutInSeconds", "type": "int"}, + "session_affinity": {"key": "sessionAffinity", "type": "str"}, + "session_cookie_max_age": {"key": "sessionCookieMaxAge", "type": "int"}, + "backend_protocol": {"key": "backendProtocol", "type": "str"}, + "client_auth": {"key": "clientAuth", "type": "IngressSettingsClientAuth"}, + } + + def __init__( + self, + *, + read_timeout_in_seconds: Optional[int] = None, + send_timeout_in_seconds: Optional[int] = None, + session_affinity: Optional[Union[str, "_models.SessionAffinity"]] = None, + session_cookie_max_age: Optional[int] = None, + backend_protocol: Optional[Union[str, "_models.BackendProtocol"]] = None, + client_auth: Optional["_models.IngressSettingsClientAuth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword read_timeout_in_seconds: Ingress read time out in seconds. + :paramtype read_timeout_in_seconds: int + :keyword send_timeout_in_seconds: Ingress send time out in seconds. + :paramtype send_timeout_in_seconds: int + :keyword session_affinity: Type of the affinity, set this to Cookie to enable session affinity. + Known values are: "Cookie" and "None". + :paramtype session_affinity: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SessionAffinity + :keyword session_cookie_max_age: Time in seconds until the cookie expires. + :paramtype session_cookie_max_age: int + :keyword backend_protocol: How ingress should communicate with this app backend service. Known + values are: "GRPC" and "Default". + :paramtype backend_protocol: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BackendProtocol + :keyword client_auth: Client-Certification Authentication. + :paramtype client_auth: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressSettingsClientAuth + """ + super().__init__(**kwargs) + self.read_timeout_in_seconds = read_timeout_in_seconds + self.send_timeout_in_seconds = send_timeout_in_seconds + self.session_affinity = session_affinity + self.session_cookie_max_age = session_cookie_max_age + self.backend_protocol = backend_protocol + self.client_auth = client_auth + + +class IngressSettingsClientAuth(_serialization.Model): + """Client-Certification Authentication. + + :ivar certificates: Collection of certificate resource id. + :vartype certificates: list[str] + """ + + _attribute_map = { + "certificates": {"key": "certificates", "type": "[str]"}, + } + + def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword certificates: Collection of certificate resource id. + :paramtype certificates: list[str] + """ + super().__init__(**kwargs) + self.certificates = certificates + + +class UploadedUserSourceInfo(UserSourceInfo): + """Source with uploaded location. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo, + WarUploadedUserSourceInfo + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + } + + _subtype_map = { + "type": { + "Jar": "JarUploadedUserSourceInfo", + "NetCoreZip": "NetCoreZipUploadedUserSourceInfo", + "Source": "SourceUploadedUserSourceInfo", + "War": "WarUploadedUserSourceInfo", + } + } + + def __init__(self, *, version: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + """ + super().__init__(version=version, **kwargs) + self.type: str = "UploadedUserSourceInfo" + self.relative_path = relative_path + + +class JarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the Jar file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "jvm_options": {"key": "jvmOptions", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the Jar file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + """ + super().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "Jar" + self.runtime_version = runtime_version + self.jvm_options = jvm_options + + +class KeyVaultCertificateProperties(CertificateProperties): # pylint: disable=too-many-instance-attributes + """Properties of certificate imported from key vault. + + 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 type: The type of the certificate source. Required. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResourceProvisioningState + :ivar vault_uri: The vault uri of user key vault. Required. + :vartype vault_uri: str + :ivar key_vault_cert_name: The certificate name of key vault. Required. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :vartype exclude_private_key: bool + :ivar auto_sync: Indicates whether to automatically synchronize certificate from key vault or + not. Known values are: "Disabled" and "Enabled". + :vartype auto_sync: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.KeyVaultCertificateAutoSync + """ + + _validation = { + "type": {"required": True}, + "thumbprint": {"readonly": True}, + "issuer": {"readonly": True}, + "issued_date": {"readonly": True}, + "expiration_date": {"readonly": True}, + "activate_date": {"readonly": True}, + "subject_name": {"readonly": True}, + "dns_names": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "vault_uri": {"required": True}, + "key_vault_cert_name": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "issued_date": {"key": "issuedDate", "type": "str"}, + "expiration_date": {"key": "expirationDate", "type": "str"}, + "activate_date": {"key": "activateDate", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "dns_names": {"key": "dnsNames", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "vault_uri": {"key": "vaultUri", "type": "str"}, + "key_vault_cert_name": {"key": "keyVaultCertName", "type": "str"}, + "cert_version": {"key": "certVersion", "type": "str"}, + "exclude_private_key": {"key": "excludePrivateKey", "type": "bool"}, + "auto_sync": {"key": "autoSync", "type": "str"}, + } + + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + exclude_private_key: bool = False, + auto_sync: Union[str, "_models.KeyVaultCertificateAutoSync"] = "Disabled", + **kwargs: Any + ) -> None: + """ + :keyword vault_uri: The vault uri of user key vault. Required. + :paramtype vault_uri: str + :keyword key_vault_cert_name: The certificate name of key vault. Required. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + :keyword auto_sync: Indicates whether to automatically synchronize certificate from key vault + or not. Known values are: "Disabled" and "Enabled". + :paramtype auto_sync: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.KeyVaultCertificateAutoSync + """ + super().__init__(**kwargs) + self.type: str = "KeyVaultCertificate" + self.vault_uri = vault_uri + self.key_vault_cert_name = key_vault_cert_name + self.cert_version = cert_version + self.exclude_private_key = exclude_private_key + self.auto_sync = auto_sync + + +class LoadedCertificate(_serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Resource Id of loaded certificate. Required. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :vartype load_trust_store: bool + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "load_trust_store": {"key": "loadTrustStore", "type": "bool"}, + } + + def __init__(self, *, resource_id: str, load_trust_store: bool = False, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id of loaded certificate. Required. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.load_trust_store = load_trust_store + + +class LogFileUrlResponse(_serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to Azure. + + :ivar url: URL of the log file. Required. + :vartype url: str + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + } + + def __init__(self, *, url: str, **kwargs: Any) -> None: + """ + :keyword url: URL of the log file. Required. + :paramtype url: str + """ + super().__init__(**kwargs) + self.url = url + + +class LogSpecification(_serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class MaintenanceScheduleConfiguration(_serialization.Model): + """Configuration for the planned maintenance. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + WeeklyMaintenanceScheduleConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar frequency: The frequency to run the maintenance job. Required. "Weekly" + :vartype frequency: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Frequency + """ + + _validation = { + "frequency": {"required": True}, + } + + _attribute_map = { + "frequency": {"key": "frequency", "type": "str"}, + } + + _subtype_map = {"frequency": {"Weekly": "WeeklyMaintenanceScheduleConfiguration"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.frequency: Optional[str] = None + + +class ManagedIdentityProperties(_serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Known values are: "None", "SystemAssigned", + "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id of system-assigned managed identity. + :vartype principal_id: str + :ivar tenant_id: Tenant Id of system-assigned managed identity. + :vartype tenant_id: str + :ivar user_assigned_identities: Properties of user-assigned managed identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserAssignedManagedIdentity] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of the managed identity. Known values are: "None", "SystemAssigned", + "UserAssigned", and "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id of system-assigned managed identity. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id of system-assigned managed identity. + :paramtype tenant_id: str + :keyword user_assigned_identities: Properties of user-assigned managed identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.v2024_01_01_preview.models.UserAssignedManagedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.user_assigned_identities = user_assigned_identities + + +class MarketplaceResource(_serialization.Model): + """Purchasing 3rd Party product for one Azure Spring Apps instance. + + :ivar plan: The plan id of the 3rd Party Artifact that is being procured. + :vartype plan: str + :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. + :vartype product: str + """ + + _attribute_map = { + "plan": {"key": "plan", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + } + + def __init__( + self, + *, + plan: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword plan: The plan id of the 3rd Party Artifact that is being procured. + :paramtype plan: str + :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. + :paramtype product: str + """ + super().__init__(**kwargs) + self.plan = plan + self.publisher = publisher + self.product = product + + +class MetricDimension(_serialization.Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :vartype to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "to_be_exported_for_shoebox": {"key": "toBeExportedForShoebox", "type": "bool"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "display_description": {"key": "displayDescription", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "aggregation_type": {"key": "aggregationType", "type": "str"}, + "supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"}, + "supported_time_grain_types": {"key": "supportedTimeGrainTypes", "type": "[str]"}, + "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, + "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, + "source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["_models.MetricDimension"]] = None, + source_mdm_namespace: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.category = category + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace + + +class MonitoringSettingProperties(_serialization.Model): + """Monitoring Setting properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Monitoring Setting. Known values are: "NotAvailable", + "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationInsightsAgentVersions + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "app_insights_sampling_rate": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + "trace_enabled": {"key": "traceEnabled", "type": "bool"}, + "app_insights_instrumentation_key": {"key": "appInsightsInstrumentationKey", "type": "str"}, + "app_insights_sampling_rate": {"key": "appInsightsSamplingRate", "type": "float"}, + "app_insights_agent_versions": {"key": "appInsightsAgentVersions", "type": "ApplicationInsightsAgentVersions"}, + } + + def __init__( + self, + *, + error: Optional["_models.Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + app_insights_sampling_rate: Optional[float] = None, + app_insights_agent_versions: Optional["_models.ApplicationInsightsAgentVersions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationInsightsAgentVersions + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.trace_enabled = trace_enabled + self.app_insights_instrumentation_key = app_insights_instrumentation_key + self.app_insights_sampling_rate = app_insights_sampling_rate + self.app_insights_agent_versions = app_insights_agent_versions + + +class MonitoringSettingResource(ProxyResource): + """Monitoring Setting 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "MonitoringSettingProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MonitoringSettingProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class NameAvailability(_serialization.Model): + """Name availability result payload. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str + """ + + _attribute_map = { + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ + super().__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(_serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the resource to check name availability. Required. + :vartype type: str + :ivar name: Name to be checked. Required. + :vartype name: str + """ + + _validation = { + "type": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, type: str, name: str, **kwargs: Any) -> None: + """ + :keyword type: Type of the resource to check name availability. Required. + :paramtype type: str + :keyword name: Name to be checked. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.type = type + self.name = name + + +class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar runtime_version: Runtime version of the .Net file. + :vartype runtime_version: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + "net_core_main_entry_path": {"key": "netCoreMainEntryPath", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword runtime_version: Runtime version of the .Net file. + :paramtype runtime_version: str + """ + super().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "NetCoreZip" + self.net_core_main_entry_path = net_core_main_entry_path + self.runtime_version = runtime_version + + +class NetworkProfile(_serialization.Model): + """Service network profile payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Apps Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure + Spring Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Apps service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources for + customer apps in Azure Spring Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. + :vartype outbound_i_ps: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. + :vartype required_traffics: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.RequiredTraffic] + :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :vartype ingress_config: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressConfig + :ivar outbound_type: The egress traffic type of Azure Spring Apps VNet instances. + :vartype outbound_type: str + """ + + _validation = { + "outbound_i_ps": {"readonly": True}, + "required_traffics": {"readonly": True}, + } + + _attribute_map = { + "service_runtime_subnet_id": {"key": "serviceRuntimeSubnetId", "type": "str"}, + "app_subnet_id": {"key": "appSubnetId", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "service_runtime_network_resource_group": {"key": "serviceRuntimeNetworkResourceGroup", "type": "str"}, + "app_network_resource_group": {"key": "appNetworkResourceGroup", "type": "str"}, + "outbound_i_ps": {"key": "outboundIPs", "type": "NetworkProfileOutboundIPs"}, + "required_traffics": {"key": "requiredTraffics", "type": "[RequiredTraffic]"}, + "ingress_config": {"key": "ingressConfig", "type": "IngressConfig"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + } + + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + ingress_config: Optional["_models.IngressConfig"] = None, + outbound_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Apps Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in + Azure Spring Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Apps service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources + for customer apps in Azure Spring Apps. + :paramtype app_network_resource_group: str + :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :paramtype ingress_config: ~azure.mgmt.appplatform.v2024_01_01_preview.models.IngressConfig + :keyword outbound_type: The egress traffic type of Azure Spring Apps VNet instances. + :paramtype outbound_type: str + """ + super().__init__(**kwargs) + self.service_runtime_subnet_id = service_runtime_subnet_id + self.app_subnet_id = app_subnet_id + self.service_cidr = service_cidr + self.service_runtime_network_resource_group = service_runtime_network_resource_group + self.app_network_resource_group = app_network_resource_group + self.outbound_i_ps = None + self.required_traffics = None + self.ingress_config = ingress_config + self.outbound_type = outbound_type + + +class NetworkProfileOutboundIPs(_serialization.Model): + """Desired outbound IP resources for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] + """ + + _validation = { + "public_i_ps": {"readonly": True}, + } + + _attribute_map = { + "public_i_ps": {"key": "publicIPs", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(_serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDisplay + :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.appplatform.v2024_01_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationProperties + """ + + _validation = { + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "action_type": {"key": "actionType", "type": "str"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "OperationProperties"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["_models.OperationProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationProperties + """ + super().__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.action_type = None + self.origin = origin + self.properties = properties + + +class OperationDisplay(_serialization.Model): + """Operation display payload. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly 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: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationProperties(_serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, + } + + def __init__( + self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any + ) -> None: + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceSpecification + """ + super().__init__(**kwargs) + self.service_specification = service_specification + + +class PersistentDisk(_serialization.Model): + """Persistent disk payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int + :ivar used_in_gb: Size of the used persistent disk in GB. + :vartype used_in_gb: int + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str + """ + + _validation = { + "size_in_gb": {"maximum": 50, "minimum": 0}, + "used_in_gb": {"readonly": True, "maximum": 50, "minimum": 0}, + } + + _attribute_map = { + "size_in_gb": {"key": "sizeInGB", "type": "int"}, + "used_in_gb": {"key": "usedInGB", "type": "int"}, + "mount_path": {"key": "mountPath", "type": "str"}, + } + + def __init__(self, *, size_in_gb: Optional[int] = None, mount_path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ + super().__init__(**kwargs) + self.size_in_gb = size_in_gb + self.used_in_gb = None + self.mount_path = mount_path + + +class PredefinedAcceleratorProperties(_serialization.Model): + """Predefined accelerator properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the predefined accelerator. Known values are: + "Creating", "Updating", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProvisioningState + :ivar display_name: + :vartype display_name: str + :ivar description: + :vartype description: str + :ivar icon_url: + :vartype icon_url: str + :ivar accelerator_tags: + :vartype accelerator_tags: list[str] + :ivar state: State of the predefined accelerator. Known values are: "Enabled" and "Disabled". + :vartype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "display_name": {"readonly": True}, + "description": {"readonly": True}, + "icon_url": {"readonly": True}, + "accelerator_tags": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "icon_url": {"key": "iconUrl", "type": "str"}, + "accelerator_tags": {"key": "acceleratorTags", "type": "[str]"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.PredefinedAcceleratorState"] = "Enabled", **kwargs: Any) -> None: + """ + :keyword state: State of the predefined accelerator. Known values are: "Enabled" and + "Disabled". + :paramtype state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorState + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.display_name = None + self.description = None + self.icon_url = None + self.accelerator_tags = None + self.state = state + + +class PredefinedAcceleratorResource(ProxyResource): + """Predefined accelerator 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Predefined accelerator properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProperties + :ivar sku: Sku of the predefined accelerator resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "PredefinedAcceleratorProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + properties: Optional["_models.PredefinedAcceleratorProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Predefined accelerator properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorProperties + :keyword sku: Sku of the predefined accelerator resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class PredefinedAcceleratorResourceCollection(_serialization.Model): + """PredefinedAcceleratorResourceCollection. + + :ivar value: + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PredefinedAcceleratorResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PredefinedAcceleratorResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Probe(_serialization.Model): + """Probe describes a health check to be performed against an App Instance to determine whether it + is alive or ready to receive traffic. + + All required parameters must be populated in order to send to Azure. + + :ivar probe_action: The action of the probe. + :vartype probe_action: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeAction + :ivar disable_probe: Indicate whether the probe is disabled. Required. + :vartype disable_probe: bool + :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes + are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype initial_delay_seconds: int + :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :vartype period_seconds: int + :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. + :vartype timeout_seconds: int + :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :vartype failure_threshold: int + :ivar success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :vartype success_threshold: int + """ + + _validation = { + "disable_probe": {"required": True}, + } + + _attribute_map = { + "probe_action": {"key": "probeAction", "type": "ProbeAction"}, + "disable_probe": {"key": "disableProbe", "type": "bool"}, + "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, + "period_seconds": {"key": "periodSeconds", "type": "int"}, + "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, + "failure_threshold": {"key": "failureThreshold", "type": "int"}, + "success_threshold": {"key": "successThreshold", "type": "int"}, + } + + def __init__( + self, + *, + disable_probe: bool = False, + probe_action: Optional["_models.ProbeAction"] = None, + initial_delay_seconds: Optional[int] = None, + period_seconds: Optional[int] = None, + timeout_seconds: Optional[int] = None, + failure_threshold: Optional[int] = None, + success_threshold: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword probe_action: The action of the probe. + :paramtype probe_action: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeAction + :keyword disable_probe: Indicate whether the probe is disabled. Required. + :paramtype disable_probe: bool + :keyword initial_delay_seconds: Number of seconds after the App Instance has started before + probes are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype initial_delay_seconds: int + :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :paramtype period_seconds: int + :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is + 1. + :paramtype timeout_seconds: int + :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :paramtype failure_threshold: int + :keyword success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :paramtype success_threshold: int + """ + super().__init__(**kwargs) + self.probe_action = probe_action + self.disable_probe = disable_probe + self.initial_delay_seconds = initial_delay_seconds + self.period_seconds = period_seconds + self.timeout_seconds = timeout_seconds + self.failure_threshold = failure_threshold + self.success_threshold = success_threshold + + +class QueueScaleRule(_serialization.Model): + """Azure Spring Apps App Instance Azure Queue based scaling rule. + + :ivar queue_name: Queue name. + :vartype queue_name: str + :ivar queue_length: Queue length. + :vartype queue_length: int + :ivar auth: Authentication secrets for the queue scale rule. + :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + + _attribute_map = { + "queue_name": {"key": "queueName", "type": "str"}, + "queue_length": {"key": "queueLength", "type": "int"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + } + + def __init__( + self, + *, + queue_name: Optional[str] = None, + queue_length: Optional[int] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword queue_name: Queue name. + :paramtype queue_name: str + :keyword queue_length: Queue length. + :paramtype queue_length: int + :keyword auth: Authentication secrets for the queue scale rule. + :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + super().__init__(**kwargs) + self.queue_name = queue_name + self.queue_length = queue_length + self.auth = auth + + +class RegenerateTestKeyRequestPayload(_serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeyType + """ + + _validation = { + "key_type": {"required": True}, + } + + _attribute_map = { + "key_type": {"key": "keyType", "type": "str"}, + } + + def __init__(self, *, key_type: Union[str, "_models.TestKeyType"], **kwargs: Any) -> None: + """ + :keyword key_type: Type of the test key. Required. Known values are: "Primary" and "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeyType + """ + super().__init__(**kwargs) + self.key_type = key_type + + +class RemoteDebugging(_serialization.Model): + """Remote debugging config. + + :ivar port: Application debugging port. + :vartype port: int + :ivar enabled: Indicate if remote debugging is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, port: Optional[int] = None, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword port: Application debugging port. + :paramtype port: int + :keyword enabled: Indicate if remote debugging is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.port = port + self.enabled = enabled + + +class RemoteDebuggingPayload(_serialization.Model): + """Remote debugging payload. + + :ivar port: Application debugging port. + :vartype port: int + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port: Application debugging port. + :paramtype port: int + """ + super().__init__(**kwargs) + self.port = port + + +class RequiredTraffic(_serialization.Model): + """Required inbound or outbound traffic for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar protocol: The protocol of required traffic. + :vartype protocol: str + :ivar port: The port of required traffic. + :vartype port: int + :ivar ips: The ip list of required traffic. + :vartype ips: list[str] + :ivar fqdns: The FQDN list of required traffic. + :vartype fqdns: list[str] + :ivar direction: The direction of required traffic. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.TrafficDirection + """ + + _validation = { + "protocol": {"readonly": True}, + "port": {"readonly": True}, + "ips": {"readonly": True}, + "fqdns": {"readonly": True}, + "direction": {"readonly": True}, + } + + _attribute_map = { + "protocol": {"key": "protocol", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "ips": {"key": "ips", "type": "[str]"}, + "fqdns": {"key": "fqdns", "type": "[str]"}, + "direction": {"key": "direction", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(_serialization.Model): + """Deployment resource request payload. + + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, cpu: Optional[str] = None, memory: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class ResourceSku(_serialization.Model): + """Describes an available Azure Spring Apps SKU. + + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :vartype location_info: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :vartype restrictions: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictions] + """ + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "SkuCapacity"}, + "locations": {"key": "locations", "type": "[str]"}, + "location_info": {"key": "locationInfo", "type": "[ResourceSkuLocationInfo]"}, + "restrictions": {"key": "restrictions", "type": "[ResourceSkuRestrictions]"}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["_models.SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictions] + """ + super().__init__(**kwargs) + self.resource_type = resource_type + self.name = name + self.tier = tier + self.capacity = capacity + self.locations = locations + self.location_info = location_info + self.restrictions = restrictions + + +class ResourceSkuCapabilities(_serialization.Model): + """ResourceSkuCapabilities. + + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class ResourceSkuCollection(_serialization.Model): + """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceSku]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ResourceSku"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(_serialization.Model): + """Locations and availability zones where the SKU is available. + + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuZoneDetails] + """ + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "zone_details": {"key": "zoneDetails", "type": "[ResourceSkuZoneDetails]"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuZoneDetails] + """ + super().__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + + +class ResourceSkuRestrictionInfo(_serialization.Model): + """Information about the restriction where the SKU cannot be used. + + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + _attribute_map = { + "locations": {"key": "locations", "type": "[str]"}, + "zones": {"key": "zones", "type": "[str]"}, + } + + def __init__( + self, *, locations: Optional[List[str]] = None, zones: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ + super().__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class ResourceSkuRestrictions(_serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Known + values are: "Location" and "Zone". + :vartype type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :vartype restriction_info: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". + :vartype reason_code: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "values": {"key": "values", "type": "[str]"}, + "restriction_info": {"key": "restrictionInfo", "type": "ResourceSkuRestrictionInfo"}, + "reason_code": {"key": "reasonCode", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Known values are: "Location" and "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Known values are: "QuotaId" and "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + super().__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class ResourceSkuZoneDetails(_serialization.Model): + """Details of capabilities available to a SKU in specific zones. + + :ivar name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :vartype capabilities: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuCapabilities] + """ + + _attribute_map = { + "name": {"key": "name", "type": "[str]"}, + "capabilities": {"key": "capabilities", "type": "[ResourceSkuCapabilities]"}, + } + + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSkuCapabilities] + """ + super().__init__(**kwargs) + self.name = name + self.capabilities = capabilities + + +class ResourceUploadDefinition(_serialization.Model): + """Resource upload definition payload. + + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str + """ + + _attribute_map = { + "relative_path": {"key": "relativePath", "type": "str"}, + "upload_url": {"key": "uploadUrl", "type": "str"}, + } + + def __init__(self, *, relative_path: Optional[str] = None, upload_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super().__init__(**kwargs) + self.relative_path = relative_path + self.upload_url = upload_url + + +class Scale(_serialization.Model): + """Azure Spring Apps scaling configurations. + + :ivar min_replicas: Optional. Minimum number of container replicas. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. + :vartype max_replicas: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRule] + """ + + _attribute_map = { + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, + "rules": {"key": "rules", "type": "[ScaleRule]"}, + } + + def __init__( + self, + *, + min_replicas: Optional[int] = None, + max_replicas: int = 10, + rules: Optional[List["_models.ScaleRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword min_replicas: Optional. Minimum number of container replicas. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not + set. + :paramtype max_replicas: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRule] + """ + super().__init__(**kwargs) + self.min_replicas = min_replicas + self.max_replicas = max_replicas + self.rules = rules + + +class ScaleRule(_serialization.Model): + """Azure Spring Apps App Instance scaling rule. + + :ivar name: Scale Rule Name. + :vartype name: str + :ivar azure_queue: Azure Queue based scaling. + :vartype azure_queue: ~azure.mgmt.appplatform.v2024_01_01_preview.models.QueueScaleRule + :ivar custom: Custom scale rule. + :vartype custom: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomScaleRule + :ivar http: HTTP requests based scaling. + :vartype http: ~azure.mgmt.appplatform.v2024_01_01_preview.models.HttpScaleRule + :ivar tcp: Tcp requests based scaling. + :vartype tcp: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TcpScaleRule + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, + "custom": {"key": "custom", "type": "CustomScaleRule"}, + "http": {"key": "http", "type": "HttpScaleRule"}, + "tcp": {"key": "tcp", "type": "TcpScaleRule"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + azure_queue: Optional["_models.QueueScaleRule"] = None, + custom: Optional["_models.CustomScaleRule"] = None, + http: Optional["_models.HttpScaleRule"] = None, + tcp: Optional["_models.TcpScaleRule"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword azure_queue: Azure Queue based scaling. + :paramtype azure_queue: ~azure.mgmt.appplatform.v2024_01_01_preview.models.QueueScaleRule + :keyword custom: Custom scale rule. + :paramtype custom: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomScaleRule + :keyword http: HTTP requests based scaling. + :paramtype http: ~azure.mgmt.appplatform.v2024_01_01_preview.models.HttpScaleRule + :keyword tcp: Tcp requests based scaling. + :paramtype tcp: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TcpScaleRule + """ + super().__init__(**kwargs) + self.name = name + self.azure_queue = azure_queue + self.custom = custom + self.http = http + self.tcp = tcp + + +class ScaleRuleAuth(_serialization.Model): + """Auth Secrets for Azure Spring Apps App Instance Scale Rule. + + :ivar secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the auth + params. + :vartype secret_ref: str + :ivar trigger_parameter: Trigger Parameter that uses the secret. + :vartype trigger_parameter: str + """ + + _attribute_map = { + "secret_ref": {"key": "secretRef", "type": "str"}, + "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + } + + def __init__( + self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword secret_ref: Name of the Azure Spring Apps App Instance secret from which to pull the + auth params. + :paramtype secret_ref: str + :keyword trigger_parameter: Trigger Parameter that uses the secret. + :paramtype trigger_parameter: str + """ + super().__init__(**kwargs) + self.secret_ref = secret_ref + self.trigger_parameter = trigger_parameter + + +class Secret(_serialization.Model): + """Secret definition. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class ServiceRegistryInstance(_serialization.Model): + """Collection of instances belong to the Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Service Registry instance. + :vartype name: str + :ivar status: Status of the Service Registry instance. + :vartype status: str + """ + + _validation = { + "name": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.status = None + + +class ServiceRegistryProperties(_serialization.Model): + """Service Registry properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Service Registry. Known values are: "Creating", + "Updating", "Succeeded", "Failed", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResourceRequests + :ivar instances: Collection of instances belong to Service Registry. + :vartype instances: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryInstance] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_requests": {"readonly": True}, + "instances": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "resource_requests": {"key": "resourceRequests", "type": "ServiceRegistryResourceRequests"}, + "instances": {"key": "instances", "type": "[ServiceRegistryInstance]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + + +class ServiceRegistryResource(ProxyResource): + """Service Registry 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Service Registry properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ServiceRegistryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ServiceRegistryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ServiceRegistryResourceCollection(_serialization.Model): + """Object that includes an array of Service Registry resources and a possible link for next set. + + :ivar value: Collection of Service Registry resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceRegistryResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ServiceRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceRegistryResourceRequests(_serialization.Model): + """Resource request payload of Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Service Registry instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Service Registry instance. + :vartype memory: str + :ivar instance_count: Instance count of the Service Registry. + :vartype instance_count: int + """ + + _validation = { + "cpu": {"readonly": True}, + "memory": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: Tags of the service which is a list of key value pairs that describe the resource. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: Tags of the service which is a list of key value pairs that describe the + resource. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + + +class ServiceResource(TrackedResource): + """Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: Tags of the service which is a list of key value pairs that describe the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "ClusterResourceProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ClusterResourceProperties"] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: Tags of the service which is a list of key value pairs that describe the + resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.sku = sku + + +class ServiceResourceList(_serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ServiceResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(_serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.MetricSpecification] + """ + super().__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class ServiceVNetAddons(_serialization.Model): + """Additional Service settings in vnet injection instance. + + :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance + could be accessed from internet. + :vartype log_stream_public_endpoint: bool + :ivar data_plane_public_endpoint: Indicates whether the data plane components(log stream, app + connect, remote debugging) in vnet injection instance could be accessed from internet. + :vartype data_plane_public_endpoint: bool + """ + + _attribute_map = { + "log_stream_public_endpoint": {"key": "logStreamPublicEndpoint", "type": "bool"}, + "data_plane_public_endpoint": {"key": "dataPlanePublicEndpoint", "type": "bool"}, + } + + def __init__( + self, *, log_stream_public_endpoint: bool = False, data_plane_public_endpoint: bool = False, **kwargs: Any + ) -> None: + """ + :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection + instance could be accessed from internet. + :paramtype log_stream_public_endpoint: bool + :keyword data_plane_public_endpoint: Indicates whether the data plane components(log stream, + app connect, remote debugging) in vnet injection instance could be accessed from internet. + :paramtype data_plane_public_endpoint: bool + """ + super().__init__(**kwargs) + self.log_stream_public_endpoint = log_stream_public_endpoint + self.data_plane_public_endpoint = data_plane_public_endpoint + + +class Sku(_serialization.Model): + """Sku of Azure Spring Apps. + + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, *, name: str = "S0", tier: str = "Standard", capacity: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SkuCapacity(_serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to Azure. + + :ivar minimum: Gets or sets the minimum. Required. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Known values are: "None", "Manual", and + "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuScaleType + """ + + _validation = { + "minimum": {"required": True}, + } + + _attribute_map = { + "minimum": {"key": "minimum", "type": "int"}, + "maximum": {"key": "maximum", "type": "int"}, + "default": {"key": "default", "type": "int"}, + "scale_type": {"key": "scaleType", "type": "str"}, + } + + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword minimum: Gets or sets the minimum. Required. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Known values are: "None", "Manual", + and "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuScaleType + """ + super().__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SkuObject(_serialization.Model): + """Resource Sku object used for scaling out and scaling in. + + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: + """ + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Sku + """ + super().__init__(**kwargs) + self.sku = sku + + +class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Java source code binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :vartype artifact_selector: str + :ivar runtime_version: Runtime version of the source file. + :vartype runtime_version: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + "artifact_selector": {"key": "artifactSelector", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + artifact_selector: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword runtime_version: Runtime version of the source file. + :paramtype runtime_version: str + """ + super().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "Source" + self.artifact_selector = artifact_selector + self.runtime_version = runtime_version + + +class SsoProperties(_serialization.Model): + """Single sign-on related configuration. + + :ivar scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :vartype scope: list[str] + :ivar client_id: The public identifier for the application. + :vartype client_id: str + :ivar client_secret: The secret known only to the application and the authorization server. + :vartype client_secret: str + :ivar issuer_uri: The URI of Issuer Identifier. + :vartype issuer_uri: str + """ + + _attribute_map = { + "scope": {"key": "scope", "type": "[str]"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "issuer_uri": {"key": "issuerUri", "type": "str"}, + } + + def __init__( + self, + *, + scope: Optional[List[str]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + issuer_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scope: list[str] + :keyword client_id: The public identifier for the application. + :paramtype client_id: str + :keyword client_secret: The secret known only to the application and the authorization server. + :paramtype client_secret: str + :keyword issuer_uri: The URI of Issuer Identifier. + :paramtype issuer_uri: str + """ + super().__init__(**kwargs) + self.scope = scope + self.client_id = client_id + self.client_secret = client_secret + self.issuer_uri = issuer_uri + + +class StackProperties(_serialization.Model): + """KPack ClusterStack properties payload. + + :ivar id: Id of the ClusterStack. + :vartype id: str + :ivar version: Version of the ClusterStack. + :vartype version: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ + super().__init__(**kwargs) + self.id = id + self.version = version + + +class StorageProperties(_serialization.Model): + """Storage resource payload. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + StorageAccount + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: The type of the storage. Required. "StorageAccount" + :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageType + """ + + _validation = { + "storage_type": {"required": True}, + } + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + } + + _subtype_map = {"storage_type": {"StorageAccount": "StorageAccount"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_type: Optional[str] = None + + +class StorageAccount(StorageProperties): + """storage resource of type Azure Storage Account. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: The type of the storage. Required. "StorageAccount" + :vartype storage_type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageType + :ivar account_name: The account name of the Azure Storage Account. Required. + :vartype account_name: str + :ivar account_key: The account key of the Azure Storage Account. Required. + :vartype account_key: str + """ + + _validation = { + "storage_type": {"required": True}, + "account_name": {"required": True}, + "account_key": {"required": True}, + } + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "account_key": {"key": "accountKey", "type": "str"}, + } + + def __init__(self, *, account_name: str, account_key: str, **kwargs: Any) -> None: + """ + :keyword account_name: The account name of the Azure Storage Account. Required. + :paramtype account_name: str + :keyword account_key: The account key of the Azure Storage Account. Required. + :paramtype account_key: str + """ + super().__init__(**kwargs) + self.storage_type: str = "StorageAccount" + self.account_name = account_name + self.account_key = account_key + + +class StorageResource(ProxyResource): + """Storage resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "StorageProperties"}, + } + + def __init__(self, *, properties: Optional["_models.StorageProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class StorageResourceCollection(_serialization.Model): + """Collection compose of storage resources list and a possible link for next page. + + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[StorageResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.StorageResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedApmType(_serialization.Model): + """Supported APM type. + + :ivar name: The name of the supported APM type. + :vartype name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the supported APM type. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class SupportedApmTypes(_serialization.Model): + """Supported APM types payload. + + :ivar value: Collection of the supported APM type. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedApmType]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedApmType"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of the supported APM type. + :paramtype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedBuildpackResource(ProxyResource): + """Supported buildpack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Supported buildpack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "SupportedBuildpackResourceProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SupportedBuildpackResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SupportedBuildpackResourceProperties(_serialization.Model): + """Supported buildpack resource properties. + + :ivar buildpack_id: The id of supported buildpack. + :vartype buildpack_id: str + :ivar version: The version of supported buildpack. + :vartype version: str + """ + + _attribute_map = { + "buildpack_id": {"key": "buildpackId", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, buildpack_id: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + :keyword version: The version of supported buildpack. + :paramtype version: str + """ + super().__init__(**kwargs) + self.buildpack_id = buildpack_id + self.version = version + + +class SupportedBuildpacksCollection(_serialization.Model): + """Object that includes an array of supported buildpacks resources and a possible link for next + set. + + :ivar value: Collection of supported buildpacks resources. + :vartype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedBuildpackResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedBuildpackResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedRuntimeVersion(_serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Known values + are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Known + values are: "Java" and ".NET Core". + :vartype platform: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[Union[str, "_models.SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "_models.SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Known values + are: "Java_8", "Java_11", "Java_17", "Java_21", and "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Known values are: "Java" and ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super().__init__(**kwargs) + self.value = value + self.platform = platform + self.version = version + + +class SupportedServerVersion(_serialization.Model): + """Supported server version. + + :ivar value: The raw server version value which could be passed to deployment CRUD operations. + :vartype value: str + :ivar server: The server name. + :vartype server: str + :ivar version: The Server version. + :vartype version: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, *, value: Optional[str] = None, server: Optional[str] = None, version: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The raw server version value which could be passed to deployment CRUD + operations. + :paramtype value: str + :keyword server: The server name. + :paramtype server: str + :keyword version: The Server version. + :paramtype version: str + """ + super().__init__(**kwargs) + self.value = value + self.server = server + self.version = version + + +class SupportedServerVersions(_serialization.Model): + """Supported server versions. + + :ivar value: Collection of the supported server versions. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedServerVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedServerVersion"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of the supported server versions. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedStackResource(ProxyResource): + """Supported stack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SystemData + :ivar properties: Supported stack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "SupportedStackResourceProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SupportedStackResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SupportedStackResourceProperties(_serialization.Model): + """Supported stack resource properties. + + :ivar stack_id: The id of supported stack. + :vartype stack_id: str + :ivar version: The version of supported stack. + :vartype version: str + """ + + _attribute_map = { + "stack_id": {"key": "stackId", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, stack_id: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ + super().__init__(**kwargs) + self.stack_id = stack_id + self.version = version + + +class SupportedStacksCollection(_serialization.Model): + """Object that includes an array of supported stacks resources and a possible link for next set. + + :ivar value: Collection of supported stacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SupportedStackResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SupportedStackResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.LastModifiedByType + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TcpScaleRule(_serialization.Model): + """Azure Spring Apps App Instance Tcp scaling rule. + + :ivar metadata: Metadata properties to describe tcp scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the tcp scale rule. + :vartype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + + _attribute_map = { + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword metadata: Metadata properties to describe tcp scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the tcp scale rule. + :paramtype auth: list[~azure.mgmt.appplatform.v2024_01_01_preview.models.ScaleRuleAuth] + """ + super().__init__(**kwargs) + self.metadata = metadata + self.auth = auth + + +class TCPSocketAction(ProbeAction): + """TCPSocketAction describes an action based on opening a socket. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of the action to take to perform the health check. Required. Known values + are: "HTTPGetAction", "TCPSocketAction", and "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.ProbeActionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: str = "TCPSocketAction" + + +class TemporaryDisk(_serialization.Model): + """Temporary disk payload. + + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str + """ + + _validation = { + "size_in_gb": {"maximum": 5, "minimum": 0}, + } + + _attribute_map = { + "size_in_gb": {"key": "sizeInGB", "type": "int"}, + "mount_path": {"key": "mountPath", "type": "str"}, + } + + def __init__(self, *, size_in_gb: Optional[int] = None, mount_path: str = "/tmp", **kwargs: Any) -> None: + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ + super().__init__(**kwargs) + self.size_in_gb = size_in_gb + self.mount_path = mount_path + + +class TestKeys(_serialization.Model): + """Test keys payload. + + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, + "primary_test_endpoint": {"key": "primaryTestEndpoint", "type": "str"}, + "secondary_test_endpoint": {"key": "secondaryTestEndpoint", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_test_endpoint = primary_test_endpoint + self.secondary_test_endpoint = secondary_test_endpoint + self.enabled = enabled + + +class TriggeredBuildResult(_serialization.Model): + """The build result triggered by a build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The unique build id of this build result. + :vartype id: str + :ivar provisioning_state: The provisioning state of this build result. Known values are: + "Queuing", "Building", "Succeeded", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2024_01_01_preview.models.TriggeredBuildResultProvisioningState + :ivar image: The container image of this build result. + :vartype image: str + :ivar last_transition_time: The last transition time of this build result. + :vartype last_transition_time: ~datetime.datetime + :ivar last_transition_reason: The last transition reason of this build result. + :vartype last_transition_reason: str + :ivar last_transition_status: The last transition status of this build result. + :vartype last_transition_status: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "image": {"key": "image", "type": "str"}, + "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, + "last_transition_reason": {"key": "lastTransitionReason", "type": "str"}, + "last_transition_status": {"key": "lastTransitionStatus", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + image: Optional[str] = None, + last_transition_time: Optional[datetime.datetime] = None, + last_transition_reason: Optional[str] = None, + last_transition_status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + :keyword image: The container image of this build result. + :paramtype image: str + :keyword last_transition_time: The last transition time of this build result. + :paramtype last_transition_time: ~datetime.datetime + :keyword last_transition_reason: The last transition reason of this build result. + :paramtype last_transition_reason: str + :keyword last_transition_status: The last transition status of this build result. + :paramtype last_transition_status: str + """ + super().__init__(**kwargs) + self.id = id + self.provisioning_state = None + self.image = image + self.last_transition_time = last_transition_time + self.last_transition_reason = last_transition_reason + self.last_transition_status = last_transition_status + + +class UserAssignedManagedIdentity(_serialization.Model): + """The details of the user-assigned managed identity assigned to an App. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user-assigned managed identity. + :vartype principal_id: str + :ivar client_id: Client Id of user-assigned managed identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ValidationMessages(_serialization.Model): + """Validate messages of the configuration service git repositories. + + :ivar name: The name of the configuration service git repository. + :vartype name: str + :ivar messages: Detailed validation messages. + :vartype messages: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "messages": {"key": "messages", "type": "[str]"}, + } + + def __init__(self, *, name: Optional[str] = None, messages: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.messages = messages + + +class WarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded War binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of the source uploaded. Required. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the war file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar server_version: Server version, currently only Apache Tomcat is supported. + :vartype server_version: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "jvm_options": {"key": "jvmOptions", "type": "str"}, + "server_version": {"key": "serverVersion", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + server_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the war file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword server_version: Server version, currently only Apache Tomcat is supported. + :paramtype server_version: str + """ + super().__init__(version=version, relative_path=relative_path, **kwargs) + self.type: str = "War" + self.runtime_version = runtime_version + self.jvm_options = jvm_options + self.server_version = server_version + + +class WeeklyMaintenanceScheduleConfiguration(MaintenanceScheduleConfiguration): + """Weekly planned maintenance. + + 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 frequency: The frequency to run the maintenance job. Required. "Weekly" + :vartype frequency: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.Frequency + :ivar hour: The hour to run the maintenance job. Required. + :vartype hour: int + :ivar duration: The duration time to run the maintenance job, specified in ISO8601 format, e.g. + PT8H. + :vartype duration: str + :ivar day: The day to run the maintenance job. Required. Known values are: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :vartype day: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.WeekDay + """ + + _validation = { + "frequency": {"required": True}, + "hour": {"required": True, "maximum": 23, "minimum": 0}, + "duration": {"readonly": True}, + "day": {"required": True}, + } + + _attribute_map = { + "frequency": {"key": "frequency", "type": "str"}, + "hour": {"key": "hour", "type": "int"}, + "duration": {"key": "duration", "type": "str"}, + "day": {"key": "day", "type": "str"}, + } + + def __init__(self, *, hour: int, day: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: + """ + :keyword hour: The hour to run the maintenance job. Required. + :paramtype hour: int + :keyword day: The day to run the maintenance job. Required. Known values are: "Monday", + "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :paramtype day: str or ~azure.mgmt.appplatform.v2024_01_01_preview.models.WeekDay + """ + super().__init__(**kwargs) + self.frequency: str = "Weekly" + self.hour = hour + self.duration = None + self.day = day diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..66e2c3f17e29 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/__init__.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._services_operations import ServicesOperations +from ._apms_operations import ApmsOperations +from ._eureka_servers_operations import EurekaServersOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._application_live_views_operations import ApplicationLiveViewsOperations +from ._dev_tool_portals_operations import DevToolPortalsOperations +from ._container_registries_operations import ContainerRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._storages_operations import StoragesOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations +from ._application_accelerators_operations import ApplicationAcceleratorsOperations +from ._customized_accelerators_operations import CustomizedAcceleratorsOperations +from ._predefined_accelerators_operations import PredefinedAcceleratorsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ServicesOperations", + "ApmsOperations", + "EurekaServersOperations", + "ConfigServersOperations", + "ConfigurationServicesOperations", + "ServiceRegistriesOperations", + "ApplicationLiveViewsOperations", + "DevToolPortalsOperations", + "ContainerRegistriesOperations", + "BuildServiceOperations", + "BuildpackBindingOperations", + "BuildServiceBuilderOperations", + "BuildServiceAgentPoolOperations", + "MonitoringSettingsOperations", + "AppsOperations", + "BindingsOperations", + "StoragesOperations", + "CertificatesOperations", + "CustomDomainsOperations", + "DeploymentsOperations", + "Operations", + "RuntimeVersionsOperations", + "SkusOperations", + "GatewaysOperations", + "GatewayRouteConfigsOperations", + "GatewayCustomDomainsOperations", + "ApiPortalsOperations", + "ApiPortalCustomDomainsOperations", + "ApplicationAcceleratorsOperations", + "CustomizedAcceleratorsOperations", + "PredefinedAcceleratorsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..2aa621f7f2ef --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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, + service_name: str, + api_portal_name: str, + domain_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-01-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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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_list_request( + resource_group_name: str, service_name: str, api_portal_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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) + + +class ApiPortalCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`api_portal_custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> _models.ApiPortalCustomDomainResource: + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: Union[_models.ApiPortalCustomDomainResource, IO], + **kwargs: Any + ) -> _models.ApiPortalCustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_custom_domain_resource, (IOBase, bytes)): + _content = api_portal_custom_domain_resource + else: + _json = self._serialize.body(api_portal_custom_domain_resource, "ApiPortalCustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: _models.ApiPortalCustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource + :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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Required. + :type api_portal_custom_domain_resource: 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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: Union[_models.ApiPortalCustomDomainResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ApiPortalCustomDomainResource]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. Is either a ApiPortalCustomDomainResource type or a IO type. Required. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource 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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalCustomDomainResource] = 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, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, api_portal_name: str, domain_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> Iterable["_models.ApiPortalCustomDomainResource"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py new file mode 100644 index 000000000000..722e96d06d82 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_api_portals_operations.py @@ -0,0 +1,906 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, api_portal_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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, service_name: str, api_portal_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-01-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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, api_portal_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_validate_domain_request( + resource_group_name: str, service_name: str, api_portal_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-01-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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApiPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`api_portals` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> _models.ApiPortalResource: + """Get the API portal and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO], + **kwargs: Any + ) -> _models.ApiPortalResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(api_portal_resource, (IOBase, bytes)): + _content = api_portal_resource + else: + _json = self._serialize.body(api_portal_resource, "ApiPortalResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: _models.ApiPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + :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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Required. + :type api_portal_resource: 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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: Union[_models.ApiPortalResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ApiPortalResource]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. Is either a + ApiPortalResource type or a IO type. Required. + :type api_portal_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource + 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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiPortalResource] = 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, + service_name=service_name, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApiPortalResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, api_portal_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, api_portal_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}" + } + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApiPortalResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApiPortalResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApiPortalResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals" + } + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param api_portal_name: The name of API portal. Required. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py new file mode 100644 index 000000000000..2f3be8623dd0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apms_operations.py @@ -0,0 +1,819 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, service_name: str, apm_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_or_update_request( + resource_group_name: str, service_name: str, apm_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-01-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.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, apm_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_secret_keys_request( + resource_group_name: str, service_name: str, apm_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "apmName": _SERIALIZER.url("apm_name", apm_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`apms` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.ApmResource"]: + """Get collection of APMs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApmResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApmResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms" + } + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any) -> _models.ApmResource: + """Get the APM by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApmResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApmResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO], + **kwargs: Any + ) -> _models.ApmResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(apm_resource, (IOBase, bytes)): + _content = apm_resource + else: + _json = self._serialize.body(apm_resource, "ApmResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApmResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApmResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: _models.ApmResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource + :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 ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Required. + :type apm_resource: 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 ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + apm_name: str, + apm_resource: Union[_models.ApmResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ApmResource]: + """Create or update an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :param apm_resource: Parameters for the create or update operation. Is either a ApmResource + type or a IO type. Required. + :type apm_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource 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 ApmResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApmResource] = 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, + service_name=service_name, + apm_name=apm_name, + apm_resource=apm_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApmResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete an APM. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}" + } + + @distributed_trace + def list_secret_keys( + self, resource_group_name: str, service_name: str, apm_name: str, **kwargs: Any + ) -> _models.ApmSecretKeys: + """List keys of APM sensitive properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm_name: The name of the APM. Required. + :type apm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApmSecretKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmSecretKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApmSecretKeys] = kwargs.pop("cls", None) + + request = build_list_secret_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + apm_name=apm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_secret_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 + ) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApmSecretKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secret_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apms/{apmName}/listSecretKeys" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py new file mode 100644 index 000000000000..2a77853248e5 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_accelerators_operations.py @@ -0,0 +1,731 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, service_name: str, application_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_or_update_request( + resource_group_name: str, service_name: str, application_accelerator_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-01-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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, application_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApplicationAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`application_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationAcceleratorResource"]: + """Handle requests to list all application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + """Get the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO], + **kwargs: Any + ) -> _models.ApplicationAcceleratorResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_accelerator_resource, (IOBase, bytes)): + _content = application_accelerator_resource + else: + _json = self._serialize.body(application_accelerator_resource, "ApplicationAcceleratorResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: _models.ApplicationAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource + :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 ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Required. + :type application_accelerator_resource: 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 ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + application_accelerator_resource: Union[_models.ApplicationAcceleratorResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ApplicationAcceleratorResource]: + """Create or update the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param application_accelerator_resource: The application accelerator for the create or update + operation. Is either a ApplicationAcceleratorResource type or a IO type. Required. + :type application_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource 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 ApplicationAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationAcceleratorResource] = 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, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + application_accelerator_resource=application_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationAcceleratorResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, application_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the application accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py new file mode 100644 index 000000000000..b9c3238e062b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_application_live_views_operations.py @@ -0,0 +1,729 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, service_name: str, application_live_view_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-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_or_update_request( + resource_group_name: str, service_name: str, application_live_view_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-01-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.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, application_live_view_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationLiveViewName": _SERIALIZER.url( + "application_live_view_name", application_live_view_name, "str", pattern=r"^[a-z][a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApplicationLiveViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`application_live_views` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationLiveViewResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationLiveViewResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationLiveViewResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + """Get the Application Live and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationLiveViewResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO], + **kwargs: Any + ) -> _models.ApplicationLiveViewResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(application_live_view_resource, (IOBase, bytes)): + _content = application_live_view_resource + else: + _json = self._serialize.body(application_live_view_resource, "ApplicationLiveViewResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: _models.ApplicationLiveViewResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource + :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 ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Required. + :type application_live_view_resource: 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 ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_live_view_name: str, + application_live_view_resource: Union[_models.ApplicationLiveViewResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ApplicationLiveViewResource]: + """Create the default Application Live View or update the existing Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :param application_live_view_resource: Parameters for the update operation. Is either a + ApplicationLiveViewResource type or a IO type. Required. + :type application_live_view_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource 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 ApplicationLiveViewResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ApplicationLiveViewResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationLiveViewResource] = 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, + service_name=service_name, + application_live_view_name=application_live_view_name, + application_live_view_resource=application_live_view_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationLiveViewResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, application_live_view_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, application_live_view_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Live View. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_live_view_name: The name of Application Live View. Required. + :type application_live_view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_live_view_name=application_live_view_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationLiveViews/{applicationLiveViewName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py new file mode 100644 index 000000000000..2566ef8cd32a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_apps_operations.py @@ -0,0 +1,1585 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + app_name: str, + subscription_id: str, + *, + sync_status: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sync_status is not None: + _params["syncStatus"] = _SERIALIZER.query("sync_status", sync_status, "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, service_name: str, app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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_update_request( + resource_group_name: str, service_name: str, app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_resource_upload_url_request( + resource_group_name: str, service_name: str, app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_set_active_deployments_request( + resource_group_name: str, service_name: str, app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_domain_request( + resource_group_name: str, service_name: str, app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`apps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> _models.AppResource: + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + sync_status=sync_status, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Required. + :type app_resource: 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the create or update operation. Is either a AppResource + type or a IO type. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_resource, (IOBase, bytes)): + _content = app_resource + else: + _json = self._serialize.body(app_resource, "AppResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: _models.AppResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Required. + :type app_resource: 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: Union[_models.AppResource, IO], + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param app_resource: Parameters for the update operation. Is either a AppResource type or a IO + type. Required. + :type app_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}" + } + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.AppResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AppResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps" + } + + @distributed_trace + def get_resource_upload_url( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> _models.ResourceUploadDefinition: + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resource_upload_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl" + } + + def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO], + **kwargs: Any + ) -> _models.AppResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(active_deployment_collection, (IOBase, bytes)): + _content = active_deployment_collection + else: + _json = self._serialize.body(active_deployment_collection, "ActiveDeploymentCollection") + + request = build_set_active_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_active_deployments_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_active_deployments_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments" + } + + @overload + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: _models.ActiveDeploymentCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection + :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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Required. + :type active_deployment_collection: 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: Union[_models.ActiveDeploymentCollection, IO], + **kwargs: Any + ) -> LROPoller[_models.AppResource]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. Is either a + ActiveDeploymentCollection type or a IO type. Required. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ActiveDeploymentCollection 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 AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.AppResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResource] = 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._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AppResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_active_deployments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments" + } + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py new file mode 100644 index 000000000000..f4a2f1c46afa --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_bindings_operations.py @@ -0,0 +1,1041 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, app_name: str, binding_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_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, service_name: str, app_name: str, binding_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_name: str, binding_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_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_update_request( + resource_group_name: str, service_name: str, app_name: str, binding_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "bindingName": _SERIALIZER.url("binding_name", binding_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_list_request( + resource_group_name: str, service_name: str, app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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) + + +class BindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`bindings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> _models.BindingResource: + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> _models.BindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BindingResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Required. + :type binding_resource: 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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. Is either a + BindingResource type or a IO type. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource 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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = 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, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, binding_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, binding_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> _models.BindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(binding_resource, (IOBase, bytes)): + _content = binding_resource + else: + _json = self._serialize.body(binding_resource, "BindingResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: _models.BindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource + :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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Required. + :type binding_resource: 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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: Union[_models.BindingResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BindingResource]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param binding_name: The name of the Binding resource. Required. + :type binding_name: str + :param binding_resource: Parameters for the update operation. Is either a BindingResource type + or a IO type. Required. + :type binding_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource 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 BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BindingResource] = 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, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> Iterable["_models.BindingResource"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BindingResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..ea650468e2d0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,599 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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_get_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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_put_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_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-01-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildServiceAgentPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`build_service_agent_pool` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResource"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceAgentPoolResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, build_service_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.BuildServiceAgentPoolResource: + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO], + **kwargs: Any + ) -> _models.BuildServiceAgentPoolResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool_resource, (IOBase, bytes)): + _content = agent_pool_resource + else: + _json = self._serialize.body(agent_pool_resource, "BuildServiceAgentPoolResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: _models.BuildServiceAgentPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource + :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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Required. + :type agent_pool_resource: 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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: Union[_models.BuildServiceAgentPoolResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuildServiceAgentPoolResource]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. Required. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. Is either a + BuildServiceAgentPoolResource type or a IO type. Required. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource 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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildServiceAgentPoolResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildServiceAgentPoolResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..64aeda8ea40b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_builder_operations.py @@ -0,0 +1,870 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_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, + service_name: str, + build_service_name: str, + builder_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-01-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_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_list_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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_list_deployments_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildServiceBuilderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`build_service_builder` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.BuilderResource: + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_resource, (IOBase, bytes)): + _content = builder_resource + else: + _json = self._serialize.body(builder_resource, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource + :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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Required. + :type builder_resource: 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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. Is either a + BuilderResource type or a IO type. Required. + :type builder_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource 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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, build_service_name: str, builder_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.BuilderResource"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuilderResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuilderResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders" + } + + @distributed_trace + def list_deployments( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> _models.DeploymentList: + """List deployments that are using the builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentList or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentList + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentList] = kwargs.pop("cls", None) + + request = build_list_deployments_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deployments.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeploymentList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_deployments.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/listUsingDeployments" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py new file mode 100644 index 000000000000..e72cae439240 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_build_service_operations.py @@ -0,0 +1,2086 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_build_services_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_build_service_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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, service_name: str, build_service_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-01-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_builds_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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_get_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_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_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_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-01-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_build_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_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_list_build_results_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_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_get_build_result_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_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_get_build_result_log_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildName": _SERIALIZER.url("build_name", build_name, "str"), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_resource_upload_url_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_buildpacks_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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_get_supported_buildpack_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_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_list_supported_stacks_request( + resource_group_name: str, service_name: str, build_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_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_get_supported_stack_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "stackName": _SERIALIZER.url("stack_name", stack_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) + + +class BuildServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`build_service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_build_services( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildService"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildService or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildServiceCollection] = 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_build_services_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_build_services.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_build_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices" + } + + @distributed_trace + def get_build_service( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.BuildService: + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + request = build_get_build_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_service.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO], + **kwargs: Any + ) -> _models.BuildService: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_service, (IOBase, bytes)): + _content = build_service + else: + _json = self._serialize.body(build_service, "BuildService") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildService", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildService", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: _models.BuildService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService + :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 BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Required. + :type build_service: 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 BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_service: Union[_models.BuildService, IO], + **kwargs: Any + ) -> LROPoller[_models.BuildService]: + """Create a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_service: Parameters for the create operation. Is either a BuildService type or a + IO type. Required. + :type build_service: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService 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 BuildService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildService] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildService] = 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, + service_name=service_name, + build_service_name=build_service_name, + build_service=build_service, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildService", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}" + } + + @distributed_trace + def list_builds( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> Iterable["_models.Build"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Build or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.Build] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildCollection] = 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_builds_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_builds.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_builds.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds" + } + + @distributed_trace + def get_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> _models.Build: + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + request = build_get_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Build", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @overload + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: _models.Build, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :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: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Required. + :type build: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: Union[_models.Build, IO], + **kwargs: Any + ) -> _models.Build: + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build: Parameters for the create or update operation. Is either a Build type or a IO + type. Required. + :type build: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.Build + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Build] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build, (IOBase, bytes)): + _content = build + else: + _json = self._serialize.body(build, "Build") + + request = build_create_or_update_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_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_build.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Build", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Build", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + def _delete_build_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, build_service_name: str, build_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_build_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_build_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_build_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @distributed_trace + def begin_delete_build( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """delete a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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_build_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_build.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}" + } + + @distributed_trace + def list_build_results( + self, resource_group_name: str, service_name: str, build_service_name: str, build_name: str, **kwargs: Any + ) -> Iterable["_models.BuildResult"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResultCollection] = 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_build_results_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_build_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildResultCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_build_results.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results" + } + + @distributed_trace + def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> _models.BuildResult: + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResult + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResult] = kwargs.pop("cls", None) + + request = build_get_build_result_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_result.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}" + } + + @distributed_trace + def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> _models.BuildResultLog: + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param build_name: The name of the build resource. Required. + :type build_name: str + :param build_result_name: The name of the build result resource. Required. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildResultLog + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildResultLog] = kwargs.pop("cls", None) + + request = build_get_build_result_log_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_build_result_log.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResultLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl" + } + + @distributed_trace + def get_resource_upload_url( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.ResourceUploadDefinition: + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceUploadDefinition + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceUploadDefinition] = kwargs.pop("cls", None) + + request = build_get_resource_upload_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_resource_upload_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceUploadDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl" + } + + @distributed_trace + def list_supported_buildpacks( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.SupportedBuildpacksCollection: + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpacksCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedBuildpacksCollection] = kwargs.pop("cls", None) + + request = build_list_supported_buildpacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_buildpacks.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedBuildpacksCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks" + } + + @distributed_trace + def get_supported_buildpack( + self, resource_group_name: str, service_name: str, build_service_name: str, buildpack_name: str, **kwargs: Any + ) -> _models.SupportedBuildpackResource: + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. Required. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedBuildpackResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedBuildpackResource] = kwargs.pop("cls", None) + + request = build_get_supported_buildpack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_supported_buildpack.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedBuildpackResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}" + } + + @distributed_trace + def list_supported_stacks( + self, resource_group_name: str, service_name: str, build_service_name: str, **kwargs: Any + ) -> _models.SupportedStacksCollection: + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStacksCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedStacksCollection] = kwargs.pop("cls", None) + + request = build_list_supported_stacks_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_stacks.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedStacksCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks" + } + + @distributed_trace + def get_supported_stack( + self, resource_group_name: str, service_name: str, build_service_name: str, stack_name: str, **kwargs: Any + ) -> _models.SupportedStackResource: + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param stack_name: The name of the stack resource. Required. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedStackResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedStackResource] = kwargs.pop("cls", None) + + request = build_get_supported_stack_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_supported_stack.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportedStackResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..2fc145a2cd7f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_buildpack_binding_operations.py @@ -0,0 +1,942 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_for_cluster_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_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, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_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-01-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_name, "str"), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_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_list_request( + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, "str"), + "builderName": _SERIALIZER.url("builder_name", builder_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) + + +class BuildpackBindingOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`buildpack_binding` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_for_cluster( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResource"]: + """Get collection of buildpack bindings under all builders. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResourceCollection] = 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_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_for_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_for_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildpackBindings" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> _models.BuildpackBindingResource: + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: Union[_models.BuildpackBindingResource, IO], + **kwargs: Any + ) -> _models.BuildpackBindingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(buildpack_binding, (IOBase, bytes)): + _content = buildpack_binding + else: + _json = self._serialize.body(buildpack_binding, "BuildpackBindingResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: _models.BuildpackBindingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource + :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 BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + Required. + :type buildpack_binding: 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 BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: Union[_models.BuildpackBindingResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuildpackBindingResource]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. Is + either a BuildpackBindingResource type or a IO type. Required. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource 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 BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildpackBindingResource] = 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, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. Required. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, build_service_name: str, builder_name: str, **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResource"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param build_service_name: The name of the build service resource. Required. + :type build_service_name: str + :param builder_name: The name of the builder resource. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.BuildpackBindingResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.BuildpackBindingResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py new file mode 100644 index 000000000000..18587cbd83f8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_certificates_operations.py @@ -0,0 +1,721 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, certificate_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_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, service_name: str, certificate_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-01-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.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, certificate_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "certificateName": _SERIALIZER.url("certificate_name", certificate_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_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`certificates` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> _models.CertificateResource: + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO], + **kwargs: Any + ) -> _models.CertificateResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_resource, (IOBase, bytes)): + _content = certificate_resource + else: + _json = self._serialize.body(certificate_resource, "CertificateResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CertificateResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: _models.CertificateResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource + :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 CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Required. + :type certificate_resource: 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 CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: Union[_models.CertificateResource, IO], + **kwargs: Any + ) -> LROPoller[_models.CertificateResource]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. Is either a + CertificateResource type or a IO type. Required. + :type certificate_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource 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 CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CertificateResource] = 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, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CertificateResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, certificate_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, certificate_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param certificate_name: The name of the certificate resource. Required. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.CertificateResource"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CertificateResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CertificateResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py new file mode 100644 index 000000000000..7dc36f837a24 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_config_servers_operations.py @@ -0,0 +1,957 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_update_put_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_patch_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/configServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/configServers/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class ConfigServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`config_servers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ConfigServerResource: + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> _models.ConfigServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: 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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO type. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource 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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> _models.ConfigServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_resource, (IOBase, bytes)): + _content = config_server_resource + else: + _json = self._serialize.body(config_server_resource, "ConfigServerResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: _models.ConfigServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource + :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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Required. + :type config_server_resource: 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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: Union[_models.ConfigServerResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigServerResource]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_resource: Parameters for the update operation. Is either a + ConfigServerResource type or a IO type. Required. + :type config_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource 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 ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default" + } + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO], + **kwargs: Any + ) -> _models.ConfigServerSettingsValidateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(config_server_settings, (IOBase, bytes)): + _content = config_server_settings + else: + _json = self._serialize.body(config_server_settings, "ConfigServerSettings") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate" + } + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: _models.ConfigServerSettings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings + :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 ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Required. + :type config_server_settings: 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 ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: Union[_models.ConfigServerSettings, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigServerSettingsValidateResult]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param config_server_settings: Config server settings to be validated. Is either a + ConfigServerSettings type or a IO type. Required. + :type config_server_settings: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettings 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 ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigServerSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigServerSettingsValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigServerSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..54f6a05b02f8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_configuration_services_operations.py @@ -0,0 +1,1301 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, configuration_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-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_or_update_request( + resource_group_name: str, service_name: str, configuration_service_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-01-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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, configuration_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_validate_request( + resource_group_name: str, service_name: str, configuration_service_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-01-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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-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_validate_resource_request( + resource_group_name: str, service_name: str, configuration_service_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-01-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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "configurationServiceName": _SERIALIZER.url( + "configuration_service_name", configuration_service_name, "str", pattern=r"^[a-z][a-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) + + +class ConfigurationServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`configuration_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> _models.ConfigurationServiceResource: + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> _models.ConfigurationServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Required. + :type configuration_service_resource: 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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceResource]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. Is either a + ConfigurationServiceResource type or a IO type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource 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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceResource] = 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, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, configuration_service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, configuration_service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ConfigurationServiceResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices" + } + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO], + **kwargs: Any + ) -> _models.ConfigurationServiceSettingsValidateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(settings, (IOBase, bytes)): + _content = settings + else: + _json = self._serialize.body(settings, "ConfigurationServiceSettings") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate" + } + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: _models.ConfigurationServiceSettings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Required. + :type settings: 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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: Union[_models.ConfigurationServiceSettings, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. Is either a + ConfigurationServiceSettings type or a IO type. Required. + :type settings: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettings + 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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate" + } + + def _validate_resource_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> Optional[_models.ConfigurationServiceSettingsValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConfigurationServiceSettingsValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(configuration_service_resource, (IOBase, bytes)): + _content = configuration_service_resource + else: + _json = self._serialize.body(configuration_service_resource, "ConfigurationServiceResource") + + request = build_validate_resource_request( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_resource_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_resource_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource" + } + + @overload + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: _models.ConfigurationServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Required. + :type configuration_service_resource: 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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_resource( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: Union[_models.ConfigurationServiceResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationServiceSettingsValidateResult]: + """Check if the Application Configuration Service resource is valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. Required. + :type configuration_service_name: str + :param configuration_service_resource: Application Configuration Service resource to be + validated. Is either a ConfigurationServiceResource type or a IO type. Required. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceResource 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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationServiceSettingsValidateResult] = 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._validate_resource_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceSettingsValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validateResource" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py new file mode 100644 index 000000000000..361b26b49dc9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_container_registries_operations.py @@ -0,0 +1,1020 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_or_update_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-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.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, service_name: str, container_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-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.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "containerRegistryName": _SERIALIZER.url( + "container_registry_name", container_registry_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class ContainerRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`container_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerRegistryResource"]: + """List container registries resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ContainerRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> _models.ContainerRegistryResource: + """Get the container registries resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO], + **kwargs: Any + ) -> _models.ContainerRegistryResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_resource, (IOBase, bytes)): + _content = container_registry_resource + else: + _json = self._serialize.body(container_registry_resource, "ContainerRegistryResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: _models.ContainerRegistryResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource + :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 ContainerRegistryResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Required. + :type container_registry_resource: 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 ContainerRegistryResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_resource: Union[_models.ContainerRegistryResource, IO], + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryResource]: + """Create or update container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_resource: Parameters for the create or update operation. Is either a + ContainerRegistryResource type or a IO type. Required. + :type container_registry_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource 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 ContainerRegistryResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryResource] = 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, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_resource=container_registry_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, container_registry_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a container registry resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}" + } + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO], + **kwargs: Any + ) -> Optional[_models.ContainerRegistryValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ContainerRegistryValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(container_registry_properties, (IOBase, bytes)): + _content = container_registry_properties + else: + _json = self._serialize.body(container_registry_properties, "ContainerRegistryProperties") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate" + } + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: _models.ContainerRegistryProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties + :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 ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Required. + :type container_registry_properties: 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 ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + container_registry_name: str, + container_registry_properties: Union[_models.ContainerRegistryProperties, IO], + **kwargs: Any + ) -> LROPoller[_models.ContainerRegistryValidateResult]: + """Check if the container registry properties are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param container_registry_name: The name of the container registry. Required. + :type container_registry_name: str + :param container_registry_properties: Parameters for the validate operation. Is either a + ContainerRegistryProperties type or a IO type. Required. + :type container_registry_properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryProperties 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 ContainerRegistryValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ContainerRegistryValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContainerRegistryValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + container_registry_name=container_registry_name, + container_registry_properties=container_registry_properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerRegistryValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/containerRegistries/{containerRegistryName}/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..fc04ce6bd41f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_custom_domains_operations.py @@ -0,0 +1,1042 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, app_name: str, domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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, service_name: str, app_name: str, domain_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, app_name: str, domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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_update_request( + resource_group_name: str, service_name: str, app_name: str, domain_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "domainName": _SERIALIZER.url("domain_name", domain_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_list_request( + resource_group_name: str, service_name: str, app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_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) + + +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> _models.CustomDomainResource: + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> _models.CustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: 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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO type. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + 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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = 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, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, domain_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> _models.CustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(domain_resource, (IOBase, bytes)): + _content = domain_resource + else: + _json = self._serialize.body(domain_resource, "CustomDomainResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: _models.CustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + :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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Required. + :type domain_resource: 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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: Union[_models.CustomDomainResource, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomDomainResource]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param domain_name: The name of the custom domain resource. Required. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. Is either a + CustomDomainResource type or a IO type. Required. + :type domain_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource + 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 CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainResource] = 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, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, app_name: str, **kwargs: Any + ) -> Iterable["_models.CustomDomainResource"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py new file mode 100644 index 000000000000..25ed1742c599 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_customized_accelerators_operations.py @@ -0,0 +1,1102 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_name: str, application_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_or_update_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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-01-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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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-01-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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "customizedAcceleratorName": _SERIALIZER.url( + "customized_accelerator_name", customized_accelerator_name, "str", pattern=r"^[a-z0-9]([-a-z0-9]*[a-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) + + +class CustomizedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`customized_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> Iterable["_models.CustomizedAcceleratorResource"]: + """Handle requests to list all customized accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomizedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomizedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + """Get the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomizedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO], + **kwargs: Any + ) -> _models.CustomizedAcceleratorResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(customized_accelerator_resource, (IOBase, bytes)): + _content = customized_accelerator_resource + else: + _json = self._serialize.body(customized_accelerator_resource, "CustomizedAcceleratorResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: _models.CustomizedAcceleratorResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource + :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 CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Required. + :type customized_accelerator_resource: 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 CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + customized_accelerator_resource: Union[_models.CustomizedAcceleratorResource, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorResource]: + """Create or update the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param customized_accelerator_resource: The customized accelerator for the create or update + operation. Is either a CustomizedAcceleratorResource type or a IO type. Required. + :type customized_accelerator_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource 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 CustomizedAcceleratorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorResource] = 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, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + customized_accelerator_resource=customized_accelerator_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the customized accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}" + } + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO], + **kwargs: Any + ) -> Optional[_models.CustomizedAcceleratorValidateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CustomizedAcceleratorValidateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CustomizedAcceleratorProperties") + + request = build_validate_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._validate_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _validate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate" + } + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: _models.CustomizedAcceleratorProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties + :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 CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Required. + :type properties: 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 CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + customized_accelerator_name: str, + properties: Union[_models.CustomizedAcceleratorProperties, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomizedAcceleratorValidateResult]: + """Check the customized accelerator are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param customized_accelerator_name: The name of the customized accelerator. Required. + :type customized_accelerator_name: str + :param properties: Customized accelerator properties to be validated. Is either a + CustomizedAcceleratorProperties type or a IO type. Required. + :type properties: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorProperties 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 CustomizedAcceleratorValidateResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomizedAcceleratorValidateResult] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomizedAcceleratorValidateResult] = 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._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + customized_accelerator_name=customized_accelerator_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomizedAcceleratorValidateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/customizedAccelerators/{customizedAcceleratorName}/validate" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py new file mode 100644 index 000000000000..e8d2914e6b6c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_deployments_operations.py @@ -0,0 +1,3269 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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_update_request( + resource_group_name: str, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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_list_request( + resource_group_name: str, + service_name: str, + app_name: str, + subscription_id: str, + *, + version: Optional[List[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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if version is not None: + _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] + 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_list_for_cluster_request( + resource_group_name: str, + service_name: str, + subscription_id: str, + *, + version: Optional[List[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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if version is not None: + _params["version"] = [_SERIALIZER.query("version", q, "str") if q is not None else "" for q in version] + 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_start_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_remote_debugging_request( + resource_group_name: str, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_remote_debugging_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_remote_debugging_config_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_log_file_url_request( + resource_group_name: str, + service_name: str, + app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_heap_dump_request( + resource_group_name: str, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_thread_dump_request( + resource_group_name: str, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_jfr_request( + resource_group_name: str, + service_name: str, + app_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-01-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`deployments` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentResource: + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> _models.DeploymentResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Required. + :type deployment_resource: 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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. Is either a + DeploymentResource type or a IO type. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource 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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = 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, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> _models.DeploymentResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment_resource, (IOBase, bytes)): + _content = deployment_resource + else: + _json = self._serialize.body(deployment_resource, "DeploymentResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("DeploymentResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: _models.DeploymentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource + :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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Required. + :type deployment_resource: 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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: Union[_models.DeploymentResource, IO], + **kwargs: Any + ) -> LROPoller[_models.DeploymentResource]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. Is either a DeploymentResource + type or a IO type. Required. + :type deployment_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource 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 DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentResource] = 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, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResource"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments" + } + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResource"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DeploymentResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DeploymentResourceCollection] = 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_for_cluster_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + version=version, + expand=expand, + api_version=api_version, + template_url=self.list_for_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_for_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start" + } + + @distributed_trace + def begin_start( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop" + } + + @distributed_trace + def begin_stop( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop" + } + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, app_name: str, deployment_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart" + } + + @distributed_trace + def begin_restart( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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: + """ + _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._api_version or "2024-01-01-preview") + ) + 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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart" + } + + def _enable_remote_debugging_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO]] = None, + **kwargs: Any + ) -> _models.RemoteDebugging: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(remote_debugging_payload, (IOBase, bytes)): + _content = remote_debugging_payload + else: + if remote_debugging_payload is not None: + _json = self._serialize.body(remote_debugging_payload, "RemoteDebuggingPayload") + else: + _json = None + + request = build_enable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._enable_remote_debugging_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _enable_remote_debugging_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging" + } + + @overload + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[_models.RemoteDebuggingPayload] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload + :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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Default value is None. + :type remote_debugging_payload: 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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_remote_debugging( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + remote_debugging_payload: Optional[Union[_models.RemoteDebuggingPayload, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Enable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param remote_debugging_payload: Parameters for enable remote debugging. Is either a + RemoteDebuggingPayload type or a IO type. Default value is None. + :type remote_debugging_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebuggingPayload 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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteDebugging] = 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._enable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + remote_debugging_payload=remote_debugging_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_remote_debugging.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/enableRemoteDebugging" + } + + def _disable_remote_debugging_initial( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + request = build_disable_remote_debugging_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_remote_debugging_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _disable_remote_debugging_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging" + } + + @distributed_trace + def begin_disable_remote_debugging( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[_models.RemoteDebugging]: + """Disable remote debugging. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. 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 RemoteDebugging or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = 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._disable_remote_debugging_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_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): + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_remote_debugging.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/disableRemoteDebugging" + } + + @distributed_trace + def get_remote_debugging_config( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> _models.RemoteDebugging: + """Get remote debugging config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RemoteDebugging or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.RemoteDebugging + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.RemoteDebugging] = kwargs.pop("cls", None) + + request = build_get_remote_debugging_config_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_remote_debugging_config.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RemoteDebugging", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_remote_debugging_config.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getRemoteDebuggingConfig" + } + + @distributed_trace + def get_log_file_url( + self, resource_group_name: str, service_name: str, app_name: str, deployment_name: str, **kwargs: Any + ) -> Optional[_models.LogFileUrlResponse]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse or None or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.LogFileUrlResponse or 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[Optional[_models.LogFileUrlResponse]] = kwargs.pop("cls", None) + + request = build_get_log_file_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_file_url.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("LogFileUrlResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl" + } + + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_generate_heap_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_heap_dump_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump" + } + + @overload + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters 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 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._api_version or "2024-01-01-preview") + ) + 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._generate_heap_dump_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_heap_dump.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump" + } + + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_generate_thread_dump_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_thread_dump_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump" + } + + @overload + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters 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 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._api_version or "2024-01-01-preview") + ) + 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._generate_thread_dump_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_thread_dump.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump" + } + + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(diagnostic_parameters, (IOBase, bytes)): + _content = diagnostic_parameters + else: + _json = self._serialize.body(diagnostic_parameters, "DiagnosticParameters") + + request = build_start_jfr_request( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_jfr_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR" + } + + @overload + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: _models.DiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters + :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: + """ + + @overload + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Required. + :type diagnostic_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: Union[_models.DiagnosticParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param app_name: The name of the App resource. Required. + :type app_name: str + :param deployment_name: The name of the Deployment resource. Required. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. Is either a + DiagnosticParameters type or a IO type. Required. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DiagnosticParameters 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 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._api_version or "2024-01-01-preview") + ) + 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._start_jfr_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_jfr.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py new file mode 100644 index 000000000000..de9453eba209 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_dev_tool_portals_operations.py @@ -0,0 +1,729 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, service_name: str, dev_tool_portal_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-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_or_update_request( + resource_group_name: str, service_name: str, dev_tool_portal_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-01-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.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, dev_tool_portal_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "devToolPortalName": _SERIALIZER.url( + "dev_tool_portal_name", dev_tool_portal_name, "str", pattern=r"^[a-z][a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DevToolPortalsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`dev_tool_portals` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.DevToolPortalResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DevToolPortalResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DevToolPortalResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/devToolPortals" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> _models.DevToolPortalResource: + """Get the Application Live and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DevToolPortalResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO], + **kwargs: Any + ) -> _models.DevToolPortalResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dev_tool_portal_resource, (IOBase, bytes)): + _content = dev_tool_portal_resource + else: + _json = self._serialize.body(dev_tool_portal_resource, "DevToolPortalResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: _models.DevToolPortalResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource + :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 DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Required. + :type dev_tool_portal_resource: 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 DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + dev_tool_portal_name: str, + dev_tool_portal_resource: Union[_models.DevToolPortalResource, IO], + **kwargs: Any + ) -> LROPoller[_models.DevToolPortalResource]: + """Create the default Dev Tool Portal or update the existing Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :param dev_tool_portal_resource: Parameters for the create or update operation. Is either a + DevToolPortalResource type or a IO type. Required. + :type dev_tool_portal_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource 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 DevToolPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.DevToolPortalResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DevToolPortalResource] = 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, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + dev_tool_portal_resource=dev_tool_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DevToolPortalResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, dev_tool_portal_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, dev_tool_portal_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Dev Tool Portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param dev_tool_portal_name: The name of Dev Tool Portal. Required. + :type dev_tool_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + dev_tool_portal_name=dev_tool_portal_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/DevToolPortals/{devToolPortalName}" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py new file mode 100644 index 000000000000..d19a19e0be37 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_eureka_servers_operations.py @@ -0,0 +1,792 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_update_put_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/eurekaServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_patch_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/eurekaServers/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class EurekaServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`eureka_servers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.EurekaServerResourceCollection: + """List the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EurekaServerResourceCollection or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResourceCollection + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.EurekaServerResourceCollection] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EurekaServerResourceCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers" + } + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.EurekaServerResource: + """Get the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EurekaServerResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> _models.EurekaServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(eureka_server_resource, (IOBase, bytes)): + _content = eureka_server_resource + else: + _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: _models.EurekaServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: 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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Is either a + EurekaServerResource type or a IO type. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource 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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + eureka_server_resource=eureka_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> _models.EurekaServerResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(eureka_server_resource, (IOBase, bytes)): + _content = eureka_server_resource + else: + _json = self._serialize.body(eureka_server_resource, "EurekaServerResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: _models.EurekaServerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource + :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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Required. + :type eureka_server_resource: 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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + eureka_server_resource: Union[_models.EurekaServerResource, IO], + **kwargs: Any + ) -> LROPoller[_models.EurekaServerResource]: + """Update the eureka server settings. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param eureka_server_resource: Parameters for the update operation. Is either a + EurekaServerResource type or a IO type. Required. + :type eureka_server_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource 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 EurekaServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.EurekaServerResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EurekaServerResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + eureka_server_resource=eureka_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EurekaServerResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/eurekaServers/default" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..897bb3b54400 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_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, + service_name: str, + gateway_name: str, + domain_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-01-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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "domainName": _SERIALIZER.url("domain_name", domain_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_list_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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) + + +class GatewayCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`gateway_custom_domains` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> _models.GatewayCustomDomainResource: + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: Union[_models.GatewayCustomDomainResource, IO], + **kwargs: Any + ) -> _models.GatewayCustomDomainResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_custom_domain_resource, (IOBase, bytes)): + _content = gateway_custom_domain_resource + else: + _json = self._serialize.body(gateway_custom_domain_resource, "GatewayCustomDomainResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: _models.GatewayCustomDomainResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource + :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 GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Required. + :type gateway_custom_domain_resource: 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 GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: Union[_models.GatewayCustomDomainResource, IO], + **kwargs: Any + ) -> LROPoller[_models.GatewayCustomDomainResource]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. Is either a GatewayCustomDomainResource type or a IO type. Required. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource 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 GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayCustomDomainResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_name: str, domain_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, domain_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.GatewayCustomDomainResource"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayCustomDomainResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayCustomDomainResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..8fc5c9a8e41a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateway_route_configs_operations.py @@ -0,0 +1,767 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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, + service_name: str, + gateway_name: str, + route_config_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-01-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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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_list_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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) + + +class GatewayRouteConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`gateway_route_configs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> _models.GatewayRouteConfigResource: + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: Union[_models.GatewayRouteConfigResource, IO], + **kwargs: Any + ) -> _models.GatewayRouteConfigResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_route_config_resource, (IOBase, bytes)): + _content = gateway_route_config_resource + else: + _json = self._serialize.body(gateway_route_config_resource, "GatewayRouteConfigResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: _models.GatewayRouteConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource + :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 GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Required. + :type gateway_route_config_resource: 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 GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: Union[_models.GatewayRouteConfigResource, IO], + **kwargs: Any + ) -> LROPoller[_models.GatewayRouteConfigResource]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. Is either a GatewayRouteConfigResource type or a IO type. Required. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource 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 GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayRouteConfigResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, route_config_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. Required. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.GatewayRouteConfigResource"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayRouteConfigResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayRouteConfigResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py new file mode 100644 index 000000000000..d0fbe00da5d7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_gateways_operations.py @@ -0,0 +1,1450 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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_or_update_request( + resource_group_name: str, service_name: str, gateway_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-01-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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_capacity_request( + resource_group_name: str, service_name: str, gateway_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-01-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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_env_secrets_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, service_name: str, gateway_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_validate_domain_request( + resource_group_name: str, service_name: str, gateway_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-01-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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", pattern=r"^[a-z][a-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) + + +class GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> _models.GatewayResource: + """Get the Spring Cloud Gateway and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO], + **kwargs: Any + ) -> _models.GatewayResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_resource, (IOBase, bytes)): + _content = gateway_resource + else: + _json = self._serialize.body(gateway_resource, "GatewayResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: _models.GatewayResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Required. + :type gateway_resource: 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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: Union[_models.GatewayResource, IO], + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. Is either a + GatewayResource type or a IO type. Required. + :type gateway_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource 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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = 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, + service_name=service_name, + gateway_name=gateway_name, + gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + def _update_capacity_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: Union[_models.SkuObject, IO], + **kwargs: Any + ) -> Optional[_models.GatewayResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GatewayResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(gateway_capacity_resource, (IOBase, bytes)): + _content = gateway_capacity_resource + else: + _json = self._serialize.body(gateway_capacity_resource, "SkuObject") + + request = build_update_capacity_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_capacity_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("GatewayResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_capacity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @overload + def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: _models.SkuObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Required. + :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Required. + :type gateway_capacity_resource: 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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_capacity( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_capacity_resource: Union[_models.SkuObject, IO], + **kwargs: Any + ) -> LROPoller[_models.GatewayResource]: + """Operation to update an exiting Spring Cloud Gateway capacity. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param gateway_capacity_resource: The gateway capacity for the update operation. Is either a + SkuObject type or a IO type. Required. + :type gateway_capacity_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.SkuObject + 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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GatewayResource] = 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_capacity_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + gateway_capacity_resource=gateway_capacity_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GatewayResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_capacity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}" + } + + @distributed_trace + def list_env_secrets( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> Dict[str, str]: + """List sensitive environment variables of Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: dict mapping str to str or the result of cls(response) + :rtype: dict[str, str] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) + + request = build_list_env_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_env_secrets.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("{str}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_env_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/listEnvSecrets" + } + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, gateway_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart" + } + + @distributed_trace + def begin_restart( + self, resource_group_name: str, service_name: str, gateway_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Restart the Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/restart" + } + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.GatewayResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.GatewayResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GatewayResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways" + } + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: _models.CustomDomainValidatePayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload + :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: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Required. + :type validate_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: Union[_models.CustomDomainValidatePayload, IO], + **kwargs: Any + ) -> _models.CustomDomainValidateResult: + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. Required. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. Is either a + CustomDomainValidatePayload type or a IO type. Required. + :type validate_payload: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidatePayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.CustomDomainValidateResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomainValidateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_payload, (IOBase, bytes)): + _content = validate_payload + else: + _json = self._serialize.body(validate_payload, "CustomDomainValidatePayload") + + request = build_validate_domain_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_domain.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomDomainValidateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..6a33e8dca516 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_monitoring_settings_operations.py @@ -0,0 +1,687 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_update_put_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_patch_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/monitoringSettings/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class MonitoringSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`monitoring_settings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.MonitoringSettingResource: + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> _models.MonitoringSettingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + request = build_update_put_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_put_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: 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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO type. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource 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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = 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_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> _models.MonitoringSettingResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(monitoring_setting_resource, (IOBase, bytes)): + _content = monitoring_setting_resource + else: + _json = self._serialize.body(monitoring_setting_resource, "MonitoringSettingResource") + + request = build_update_patch_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_patch_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_patch_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: _models.MonitoringSettingResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource + :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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Required. + :type monitoring_setting_resource: 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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: Union[_models.MonitoringSettingResource, IO], + **kwargs: Any + ) -> LROPoller[_models.MonitoringSettingResource]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. Is either a + MonitoringSettingResource type or a IO type. Required. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource 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 MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.MonitoringSettingResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringSettingResource] = 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_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoringSettingResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py new file mode 100644 index 000000000000..58f545cefa5a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_operations.py @@ -0,0 +1,158 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(**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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationDetail or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.OperationDetail] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.AppPlatform/operations"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py new file mode 100644 index 000000000000..e725ce333cb4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_predefined_accelerators_operations.py @@ -0,0 +1,672 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, service_name: str, application_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_get_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_disable_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_request( + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "applicationAcceleratorName": _SERIALIZER.url( + "application_accelerator_name", application_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$" + ), + "predefinedAcceleratorName": _SERIALIZER.url( + "predefined_accelerator_name", predefined_accelerator_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PredefinedAcceleratorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`predefined_accelerators` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, application_accelerator_name: str, **kwargs: Any + ) -> Iterable["_models.PredefinedAcceleratorResource"]: + """Handle requests to list all predefined accelerators. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PredefinedAcceleratorResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.PredefinedAcceleratorResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PredefinedAcceleratorResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> _models.PredefinedAcceleratorResource: + """Get the predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PredefinedAcceleratorResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.PredefinedAcceleratorResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.PredefinedAcceleratorResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PredefinedAcceleratorResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}" + } + + def _disable_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable" + } + + @distributed_trace + def begin_disable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._disable_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/disable" + } + + def _enable_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_enable_request( + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable" + } + + @distributed_trace + def begin_enable( + self, + resource_group_name: str, + service_name: str, + application_accelerator_name: str, + predefined_accelerator_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Enable predefined accelerator. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param application_accelerator_name: The name of the application accelerator. Required. + :type application_accelerator_name: str + :param predefined_accelerator_name: The name of the predefined accelerator. Required. + :type predefined_accelerator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._enable_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + application_accelerator_name=application_accelerator_name, + predefined_accelerator_name=predefined_accelerator_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/applicationAccelerators/{applicationAcceleratorName}/predefinedAccelerators/{predefinedAcceleratorName}/enable" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..fce38998ecd3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_runtime_versions_operations.py @@ -0,0 +1,128 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_runtime_versions_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", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # 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 RuntimeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`runtime_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_runtime_versions(self, **kwargs: Any) -> _models.AvailableRuntimeVersions: + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.AvailableRuntimeVersions + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.AvailableRuntimeVersions] = kwargs.pop("cls", None) + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailableRuntimeVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {"url": "/providers/Microsoft.AppPlatform/runtimeVersions"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py new file mode 100644 index 000000000000..35a0e0e52181 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_service_registries_operations.py @@ -0,0 +1,602 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, service_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class ServiceRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`service_registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> _models.ServiceRegistryResource: + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> _models.ServiceRegistryResource: + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = kwargs.pop("cls", None) + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> LROPoller[_models.ServiceRegistryResource]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_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 ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResource] = 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, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, service_registry_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param service_registry_name: The name of Service Registry. Required. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResource"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceRegistryResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceRegistryResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py new file mode 100644 index 000000000000..16694f8a0b16 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_services_operations.py @@ -0,0 +1,2948 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_or_update_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_test_keys_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_regenerate_test_key_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/regenerateTestKey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_disable_test_endpoint_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_test_endpoint_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_flush_vnet_dns_setting_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_apm_types_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_list_globally_enabled_apms_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_apm_globally_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/enableApmGlobally", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_disable_apm_globally_request( + resource_group_name: str, service_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-01-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.AppPlatform/Spring/{serviceName}/disableApmGlobally", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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_check_name_availability_request(location: 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-01-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}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_list_by_subscription_request(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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_request(resource_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_supported_server_versions_request( + resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class ServicesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.ServiceResource: + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> _models.ServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Required. + :type resource: 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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the create or update operation. Is either a ServiceResource + type or a IO type. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource 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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + def _update_initial( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> _models.ServiceResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServiceResource") + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource + :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Required. + :type resource: 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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, service_name: str, resource: Union[_models.ServiceResource, IO], **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param resource: Parameters for the update operation. Is either a ServiceResource type or a IO + type. Required. + :type resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource 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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}" + } + + @distributed_trace + def list_test_keys(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.TestKeys: + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + request = build_list_test_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_test_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 + ) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys" + } + + @overload + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: _models.RegenerateTestKeyRequestPayload, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload + :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: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Required. + :type regenerate_test_key_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: Union[_models.RegenerateTestKeyRequestPayload, IO], + **kwargs: Any + ) -> _models.TestKeys: + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. Is either a + RegenerateTestKeyRequestPayload type or a IO type. Required. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.RegenerateTestKeyRequestPayload or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(regenerate_test_key_request, (IOBase, bytes)): + _content = regenerate_test_key_request + else: + _json = self._serialize.body(regenerate_test_key_request, "RegenerateTestKeyRequestPayload") + + request = build_regenerate_test_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_test_key.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey" + } + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_disable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.disable_test_endpoint.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint" + } + + @distributed_trace + def enable_test_endpoint(self, resource_group_name: str, service_name: str, **kwargs: Any) -> _models.TestKeys: + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.TestKeys + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.TestKeys] = kwargs.pop("cls", None) + + request = build_enable_test_endpoint_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.enable_test_endpoint.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TestKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + } + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop" + } + + @distributed_trace + def begin_stop(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: + """Stop a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 304: ResourceNotModifiedError, + 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, error_format=ARMErrorFormat), + } + 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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start" + } + + @distributed_trace + def begin_start(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: + """Start a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start" + } + + def _flush_vnet_dns_setting_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_flush_vnet_dns_setting_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._flush_vnet_dns_setting_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _flush_vnet_dns_setting_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings" + } + + @distributed_trace + def begin_flush_vnet_dns_setting( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Flush Virtual Network DNS settings for a VNET injected Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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._flush_vnet_dns_setting_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_flush_vnet_dns_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/flushVirtualNetworkDnsSettings" + } + + @distributed_trace + def list_supported_apm_types( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.SupportedApmType"]: + """List supported APM types for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SupportedApmType or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedApmType] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedApmTypes] = 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_supported_apm_types_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_apm_types.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedApmTypes", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_supported_apm_types.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedApmTypes" + } + + @distributed_trace + def list_globally_enabled_apms( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> _models.GloballyEnabledApms: + """List globally enabled APMs for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GloballyEnabledApms or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.GloballyEnabledApms + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.GloballyEnabledApms] = kwargs.pop("cls", None) + + request = build_list_globally_enabled_apms_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_globally_enabled_apms.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GloballyEnabledApms", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_globally_enabled_apms.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listGloballyEnabledApms" + } + + def _enable_apm_globally_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + request = build_enable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._enable_apm_globally_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _enable_apm_globally_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally" + } + + @overload + def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference + :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: + """ + + @overload + def begin_enable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Required. + :type apm: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> LROPoller[None]: + """Enable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the enable operation. Is either a ApmReference type or a IO + type. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference 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 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._api_version or "2024-01-01-preview") + ) + 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._enable_apm_globally_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable_apm_globally.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableApmGlobally" + } + + def _disable_apm_globally_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + 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(apm, (IOBase, bytes)): + _content = apm + else: + _json = self._serialize.body(apm, "ApmReference") + + request = build_disable_apm_globally_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disable_apm_globally_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _disable_apm_globally_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally" + } + + @overload + def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: _models.ApmReference, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference + :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: + """ + + @overload + def begin_disable_apm_globally( + self, + resource_group_name: str, + service_name: str, + apm: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Required. + :type apm: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_disable_apm_globally( + self, resource_group_name: str, service_name: str, apm: Union[_models.ApmReference, IO], **kwargs: Any + ) -> LROPoller[None]: + """Disable an APM globally. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param apm: The target APM for the disable operation. Is either a ApmReference type or a IO + type. Required. + :type apm: ~azure.mgmt.appplatform.v2024_01_01_preview.models.ApmReference 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 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._api_version or "2024-01-01-preview") + ) + 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._disable_apm_globally_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + apm=apm, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable_apm_globally.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableApmGlobally" + } + + @overload + def check_name_availability( + self, + location: str, + availability_parameters: _models.NameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters + :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: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, location: str, availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Required. + :type availability_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, location: str, availability_parameters: Union[_models.NameAvailabilityParameters, IO], **kwargs: Any + ) -> _models.NameAvailability: + """Checks that the resource name is valid and is not already in use. + + :param location: the region. Required. + :type location: str + :param availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO type. Required. + :type availability_parameters: + ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailabilityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.NameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(availability_parameters, (IOBase, bytes)): + _content = availability_parameters + else: + _json = self._serialize.body(availability_parameters, "NameAvailabilityParameters") + + request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailability", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ServiceResource"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResourceList] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ServiceResource"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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 ServiceResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ServiceResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ServiceResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring" + } + + @distributed_trace + def list_supported_server_versions( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.SupportedServerVersion"]: + """Lists all of the available server versions supported by Microsoft.AppPlatform provider. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SupportedServerVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.SupportedServerVersion] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.SupportedServerVersions] = 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_supported_server_versions_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_supported_server_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SupportedServerVersions", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_supported_server_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/supportedServerVersions" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py new file mode 100644 index 000000000000..4912e9f5bb49 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_skus_operations.py @@ -0,0 +1,164 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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) + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`skus` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSku or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.ResourceSku] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.ResourceSkuCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceSkuCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py new file mode 100644 index 000000000000..21f609917024 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/operations/_storages_operations.py @@ -0,0 +1,718 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, service_name: str, storage_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_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, service_name: str, storage_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-01-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.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, service_name: str, storage_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-z0-9]$"), + "storageName": _SERIALIZER.url("storage_name", storage_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_list_request(resource_group_name: str, service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str", pattern=r"^[a-z][a-z0-9-]*[a-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) + + +class StoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appplatform.v2024_01_01_preview.AppPlatformManagementClient`'s + :attr:`storages` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> _models.StorageResource: + """Get the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StorageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO], + **kwargs: Any + ) -> _models.StorageResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_resource, (IOBase, bytes)): + _content = storage_resource + else: + _json = self._serialize.body(storage_resource, "StorageResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StorageResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StorageResource", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("StorageResource", pipeline_response) + + 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.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: _models.StorageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource + :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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Required. + :type storage_resource: 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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: Union[_models.StorageResource, IO], + **kwargs: Any + ) -> LROPoller[_models.StorageResource]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. Is either a + StorageResource type or a IO type. Required. + :type storage_resource: ~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource 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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :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._api_version or "2024-01-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageResource] = 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, + service_name=service_name, + storage_name=storage_name, + storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, storage_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._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_name: str, storage_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :param storage_name: The name of the storage resource. Required. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-01-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" + } + + @distributed_trace + def list(self, resource_group_name: str, service_name: str, **kwargs: Any) -> Iterable["_models.StorageResource"]: + """List all the storages of one Azure Spring Apps resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param service_name: The name of the Service resource. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2024_01_01_preview.models.StorageResource] + :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._api_version or "2024-01-01-preview") + ) + cls: ClsType[_models.StorageResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageResourceCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages" + } diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2024_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/astro/azure-mgmt-astro/CHANGELOG.md b/sdk/astro/azure-mgmt-astro/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/astro/azure-mgmt-astro/LICENSE b/sdk/astro/azure-mgmt-astro/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/astro/azure-mgmt-astro/MANIFEST.in b/sdk/astro/azure-mgmt-astro/MANIFEST.in new file mode 100644 index 000000000000..acb655679519 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/astro/py.typed diff --git a/sdk/astro/azure-mgmt-astro/README.md b/sdk/astro/azure-mgmt-astro/README.md new file mode 100644 index 000000000000..2cd32ad7640a --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-astro +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.astro import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/astro/azure-mgmt-astro/_meta.json b/sdk/astro/azure-mgmt-astro/_meta.json new file mode 100644 index 000000000000..82a4c7b40cd0 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/liftrastronomer/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/liftrastronomer/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/astro/azure-mgmt-astro/azure/__init__.py b/sdk/astro/azure-mgmt-astro/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/__init__.py new file mode 100644 index 000000000000..d0cdb43548f9 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._astro_mgmt_client import AstroMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AstroMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_astro_mgmt_client.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_astro_mgmt_client.py new file mode 100644 index 000000000000..565803581b16 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_astro_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import AstroMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import Operations, OrganizationsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AstroMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """AstroMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.astro.operations.Operations + :ivar organizations: OrganizationsOperations operations + :vartype organizations: azure.mgmt.astro.operations.OrganizationsOperations + :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-08-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AstroMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "AstroMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_configuration.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_configuration.py new file mode 100644 index 000000000000..f8fc317a5096 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AstroMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AstroMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-08-01". 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(AstroMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-08-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-astro/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_patch.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_serialization.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_vendor.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_version.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/__init__.py new file mode 100644 index 000000000000..f0d01d1c2c40 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._astro_mgmt_client import AstroMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AstroMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_astro_mgmt_client.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_astro_mgmt_client.py new file mode 100644 index 000000000000..ae9b15582768 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_astro_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AstroMgmtClientConfiguration +from .operations import Operations, OrganizationsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AstroMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """AstroMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.astro.aio.operations.Operations + :ivar organizations: OrganizationsOperations operations + :vartype organizations: azure.mgmt.astro.aio.operations.OrganizationsOperations + :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-08-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AstroMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AstroMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_configuration.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_configuration.py new file mode 100644 index 000000000000..10f86d3b6693 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AstroMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AstroMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-08-01". 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(AstroMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-08-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-astro/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_patch.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/__init__.py new file mode 100644 index 000000000000..db75e01d4052 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._organizations_operations import OrganizationsOperations + +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", + "OrganizationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_operations.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_operations.py new file mode 100644 index 000000000000..0f6dbb9d4dad --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.astro.aio.AstroMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.astro.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Astronomer.Astro/operations"} diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_organizations_operations.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_organizations_operations.py new file mode 100644 index 000000000000..6a81e38bb2a9 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_organizations_operations.py @@ -0,0 +1,885 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._organizations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.astro.aio.AstroMgmtClient`'s + :attr:`organizations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.OrganizationResource"]: + """List OrganizationResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResourceListResult] = 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, + 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("OrganizationResourceListResult", 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_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Astronomer.Astro/organizations"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OrganizationResource"]: + """List OrganizationResource resources by resource group. + + :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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResourceListResult] = 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, + 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("OrganizationResourceListResult", 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/Astronomer.Astro/organizations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, organization_name: str, **kwargs: Any + ) -> _models.OrganizationResource: + """Get a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource or the result of cls(response) + :rtype: ~azure.mgmt.astro.models.OrganizationResource + :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.OrganizationResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + organization_name=organization_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 = 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("OrganizationResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + organization_name: str, + resource: Union[_models.OrganizationResource, IO], + **kwargs: Any + ) -> _models.OrganizationResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OrganizationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "OrganizationResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + organization_name=organization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OrganizationResource", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("OrganizationResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: _models.OrganizationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.astro.models.OrganizationResource + :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 OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: Union[_models.OrganizationResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Is either a OrganizationResource type or a IO + type. Required. + :type resource: ~azure.mgmt.astro.models.OrganizationResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResource] = 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, + organization_name=organization_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OrganizationResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + async def _update_initial( + self, + resource_group_name: str, + organization_name: str, + properties: Union[_models.OrganizationResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.OrganizationResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OrganizationResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "OrganizationResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + organization_name=organization_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("OrganizationResource", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: _models.OrganizationResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.astro.models.OrganizationResourceUpdate + :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 OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: Union[_models.OrganizationResourceUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Is either a + OrganizationResourceUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.astro.models.OrganizationResourceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResource] = 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, + organization_name=organization_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OrganizationResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, organization_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, + organization_name=organization_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, organization_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_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, + organization_name=organization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_patch.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/__init__.py new file mode 100644 index 000000000000..1b0d393b5823 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/__init__.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import LiftrBaseDataOrganizationProperties +from ._models_py3 import LiftrBaseDataPartnerOrganizationProperties +from ._models_py3 import LiftrBaseDataPartnerOrganizationPropertiesUpdate +from ._models_py3 import LiftrBaseMarketplaceDetails +from ._models_py3 import LiftrBaseOfferDetails +from ._models_py3 import LiftrBaseSingleSignOnProperties +from ._models_py3 import LiftrBaseUserDetails +from ._models_py3 import LiftrBaseUserDetailsUpdate +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OrganizationResource +from ._models_py3 import OrganizationResourceListResult +from ._models_py3 import OrganizationResourceUpdate +from ._models_py3 import OrganizationResourceUpdateProperties +from ._models_py3 import Resource +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity + +from ._astro_mgmt_client_enums import ActionType +from ._astro_mgmt_client_enums import CreatedByType +from ._astro_mgmt_client_enums import ManagedServiceIdentityType +from ._astro_mgmt_client_enums import MarketplaceSubscriptionStatus +from ._astro_mgmt_client_enums import Origin +from ._astro_mgmt_client_enums import ResourceProvisioningState +from ._astro_mgmt_client_enums import SingleSignOnStates +from ._astro_mgmt_client_enums import Versions +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "LiftrBaseDataOrganizationProperties", + "LiftrBaseDataPartnerOrganizationProperties", + "LiftrBaseDataPartnerOrganizationPropertiesUpdate", + "LiftrBaseMarketplaceDetails", + "LiftrBaseOfferDetails", + "LiftrBaseSingleSignOnProperties", + "LiftrBaseUserDetails", + "LiftrBaseUserDetailsUpdate", + "ManagedServiceIdentity", + "Operation", + "OperationDisplay", + "OperationListResult", + "OrganizationResource", + "OrganizationResourceListResult", + "OrganizationResourceUpdate", + "OrganizationResourceUpdateProperties", + "Resource", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "ActionType", + "CreatedByType", + "ManagedServiceIdentityType", + "MarketplaceSubscriptionStatus", + "Origin", + "ResourceProvisioningState", + "SingleSignOnStates", + "Versions", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_astro_mgmt_client_enums.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_astro_mgmt_client_enums.py new file mode 100644 index 000000000000..0be2e6dcdbcf --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_astro_mgmt_client_enums.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. +# -------------------------------------------------------------------------- + +from enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + + +class MarketplaceSubscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Marketplace subscription status of a resource.""" + + PENDING_FULFILLMENT_START = "PendingFulfillmentStart" + """Purchased but not yet activated""" + SUBSCRIBED = "Subscribed" + """Marketplace subscription is activated""" + SUSPENDED = "Suspended" + """This state indicates that a customer's payment for the Marketplace service was not received""" + UNSUBSCRIBED = "Unsubscribed" + """Customer has cancelled the subscription""" + + +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 ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource type.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class SingleSignOnStates(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Various states of the SSO resource.""" + + INITIAL = "Initial" + """Initial state of the SSO resource""" + ENABLE = "Enable" + """State of the SSO resource when it is enabled""" + DISABLE = "Disable" + """State of the SSO resource when it is disabled""" + + +class Versions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported API versions for the Astronomer.Astro resource provider.""" + + V1_PREVIEW = "2023-08-01" + """Dependent on Azure.ResourceManager.Versions.v1_0_Preview_1, LiftrBase.Versions.v1_preview, + #: LiftrBase.Data.Versions.v1_preview""" diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_models_py3.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_models_py3.py new file mode 100644 index 000000000000..1cb3f9e9f83f --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_models_py3.py @@ -0,0 +1,1140 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +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.astro.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.astro.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.astro.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.astro.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class LiftrBaseDataOrganizationProperties(_serialization.Model): + """Properties specific to Data Organization 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 marketplace: Marketplace details of the resource. Required. + :vartype marketplace: ~azure.mgmt.astro.models.LiftrBaseMarketplaceDetails + :ivar user: Details of the user. Required. + :vartype user: ~azure.mgmt.astro.models.LiftrBaseUserDetails + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.astro.models.ResourceProvisioningState + :ivar partner_organization_properties: Organization properties. + :vartype partner_organization_properties: + ~azure.mgmt.astro.models.LiftrBaseDataPartnerOrganizationProperties + """ + + _validation = { + "marketplace": {"required": True}, + "user": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "marketplace": {"key": "marketplace", "type": "LiftrBaseMarketplaceDetails"}, + "user": {"key": "user", "type": "LiftrBaseUserDetails"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "partner_organization_properties": { + "key": "partnerOrganizationProperties", + "type": "LiftrBaseDataPartnerOrganizationProperties", + }, + } + + def __init__( + self, + *, + marketplace: "_models.LiftrBaseMarketplaceDetails", + user: "_models.LiftrBaseUserDetails", + partner_organization_properties: Optional["_models.LiftrBaseDataPartnerOrganizationProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword marketplace: Marketplace details of the resource. Required. + :paramtype marketplace: ~azure.mgmt.astro.models.LiftrBaseMarketplaceDetails + :keyword user: Details of the user. Required. + :paramtype user: ~azure.mgmt.astro.models.LiftrBaseUserDetails + :keyword partner_organization_properties: Organization properties. + :paramtype partner_organization_properties: + ~azure.mgmt.astro.models.LiftrBaseDataPartnerOrganizationProperties + """ + super().__init__(**kwargs) + self.marketplace = marketplace + self.user = user + self.provisioning_state = None + self.partner_organization_properties = partner_organization_properties + + +class LiftrBaseDataPartnerOrganizationProperties(_serialization.Model): + """Properties specific to Partner's organization. + + All required parameters must be populated in order to send to Azure. + + :ivar organization_id: Organization Id in partner's system. + :vartype organization_id: str + :ivar workspace_id: Workspace Id in partner's system. + :vartype workspace_id: str + :ivar organization_name: Organization name in partner's system. Required. + :vartype organization_name: str + :ivar workspace_name: Workspace name in partner's system. + :vartype workspace_name: str + :ivar single_sign_on_properties: Single Sign On properties for the organization. + :vartype single_sign_on_properties: ~azure.mgmt.astro.models.LiftrBaseSingleSignOnProperties + """ + + _validation = { + "organization_name": { + "required": True, + "max_length": 50, + "min_length": 1, + "pattern": r"^[a-zA-Z0-9][a-zA-Z0-9_\-.: ]*$", + }, + "workspace_name": {"max_length": 50, "min_length": 1, "pattern": r"^[a-zA-Z0-9][a-zA-Z0-9_\-.: ]*$"}, + } + + _attribute_map = { + "organization_id": {"key": "organizationId", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "organization_name": {"key": "organizationName", "type": "str"}, + "workspace_name": {"key": "workspaceName", "type": "str"}, + "single_sign_on_properties": {"key": "singleSignOnProperties", "type": "LiftrBaseSingleSignOnProperties"}, + } + + def __init__( + self, + *, + organization_name: str, + organization_id: Optional[str] = None, + workspace_id: Optional[str] = None, + workspace_name: Optional[str] = None, + single_sign_on_properties: Optional["_models.LiftrBaseSingleSignOnProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword organization_id: Organization Id in partner's system. + :paramtype organization_id: str + :keyword workspace_id: Workspace Id in partner's system. + :paramtype workspace_id: str + :keyword organization_name: Organization name in partner's system. Required. + :paramtype organization_name: str + :keyword workspace_name: Workspace name in partner's system. + :paramtype workspace_name: str + :keyword single_sign_on_properties: Single Sign On properties for the organization. + :paramtype single_sign_on_properties: ~azure.mgmt.astro.models.LiftrBaseSingleSignOnProperties + """ + super().__init__(**kwargs) + self.organization_id = organization_id + self.workspace_id = workspace_id + self.organization_name = organization_name + self.workspace_name = workspace_name + self.single_sign_on_properties = single_sign_on_properties + + +class LiftrBaseDataPartnerOrganizationPropertiesUpdate(_serialization.Model): + """Properties specific to Partner's organization. + + :ivar organization_id: Organization Id in partner's system. + :vartype organization_id: str + :ivar workspace_id: Workspace Id in partner's system. + :vartype workspace_id: str + :ivar organization_name: Organization name in partner's system. + :vartype organization_name: str + :ivar workspace_name: Workspace name in partner's system. + :vartype workspace_name: str + :ivar single_sign_on_properties: Single Sign On properties for the organization. + :vartype single_sign_on_properties: ~azure.mgmt.astro.models.LiftrBaseSingleSignOnProperties + """ + + _validation = { + "organization_name": {"max_length": 50, "min_length": 1, "pattern": r"^[a-zA-Z0-9][a-zA-Z0-9_\-.: ]*$"}, + "workspace_name": {"max_length": 50, "min_length": 1, "pattern": r"^[a-zA-Z0-9][a-zA-Z0-9_\-.: ]*$"}, + } + + _attribute_map = { + "organization_id": {"key": "organizationId", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "organization_name": {"key": "organizationName", "type": "str"}, + "workspace_name": {"key": "workspaceName", "type": "str"}, + "single_sign_on_properties": {"key": "singleSignOnProperties", "type": "LiftrBaseSingleSignOnProperties"}, + } + + def __init__( + self, + *, + organization_id: Optional[str] = None, + workspace_id: Optional[str] = None, + organization_name: Optional[str] = None, + workspace_name: Optional[str] = None, + single_sign_on_properties: Optional["_models.LiftrBaseSingleSignOnProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword organization_id: Organization Id in partner's system. + :paramtype organization_id: str + :keyword workspace_id: Workspace Id in partner's system. + :paramtype workspace_id: str + :keyword organization_name: Organization name in partner's system. + :paramtype organization_name: str + :keyword workspace_name: Workspace name in partner's system. + :paramtype workspace_name: str + :keyword single_sign_on_properties: Single Sign On properties for the organization. + :paramtype single_sign_on_properties: ~azure.mgmt.astro.models.LiftrBaseSingleSignOnProperties + """ + super().__init__(**kwargs) + self.organization_id = organization_id + self.workspace_id = workspace_id + self.organization_name = organization_name + self.workspace_name = workspace_name + self.single_sign_on_properties = single_sign_on_properties + + +class LiftrBaseMarketplaceDetails(_serialization.Model): + """Marketplace details for an organization. + + All required parameters must be populated in order to send to Azure. + + :ivar subscription_id: Azure subscription id for the the marketplace offer is purchased from. + Required. + :vartype subscription_id: str + :ivar subscription_status: Marketplace subscription status. Known values are: + "PendingFulfillmentStart", "Subscribed", "Suspended", and "Unsubscribed". + :vartype subscription_status: str or ~azure.mgmt.astro.models.MarketplaceSubscriptionStatus + :ivar offer_details: Offer details for the marketplace that is selected by the user. Required. + :vartype offer_details: ~azure.mgmt.astro.models.LiftrBaseOfferDetails + """ + + _validation = { + "subscription_id": {"required": True}, + "offer_details": {"required": True}, + } + + _attribute_map = { + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "subscription_status": {"key": "subscriptionStatus", "type": "str"}, + "offer_details": {"key": "offerDetails", "type": "LiftrBaseOfferDetails"}, + } + + def __init__( + self, + *, + subscription_id: str, + offer_details: "_models.LiftrBaseOfferDetails", + subscription_status: Optional[Union[str, "_models.MarketplaceSubscriptionStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subscription_id: Azure subscription id for the the marketplace offer is purchased + from. Required. + :paramtype subscription_id: str + :keyword subscription_status: Marketplace subscription status. Known values are: + "PendingFulfillmentStart", "Subscribed", "Suspended", and "Unsubscribed". + :paramtype subscription_status: str or ~azure.mgmt.astro.models.MarketplaceSubscriptionStatus + :keyword offer_details: Offer details for the marketplace that is selected by the user. + Required. + :paramtype offer_details: ~azure.mgmt.astro.models.LiftrBaseOfferDetails + """ + super().__init__(**kwargs) + self.subscription_id = subscription_id + self.subscription_status = subscription_status + self.offer_details = offer_details + + +class LiftrBaseOfferDetails(_serialization.Model): + """Offer details for the marketplace that is selected by the user. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher_id: Publisher Id for the marketplace offer. Required. + :vartype publisher_id: str + :ivar offer_id: Offer Id for the marketplace offer. Required. + :vartype offer_id: str + :ivar plan_id: Plan Id for the marketplace offer. Required. + :vartype plan_id: str + :ivar plan_name: Plan Name for the marketplace offer. + :vartype plan_name: str + :ivar term_unit: Plan Display Name for the marketplace offer. + :vartype term_unit: str + :ivar term_id: Plan Display Name for the marketplace offer. + :vartype term_id: str + """ + + _validation = { + "publisher_id": {"required": True}, + "offer_id": {"required": True}, + "plan_id": {"required": True}, + } + + _attribute_map = { + "publisher_id": {"key": "publisherId", "type": "str"}, + "offer_id": {"key": "offerId", "type": "str"}, + "plan_id": {"key": "planId", "type": "str"}, + "plan_name": {"key": "planName", "type": "str"}, + "term_unit": {"key": "termUnit", "type": "str"}, + "term_id": {"key": "termId", "type": "str"}, + } + + def __init__( + self, + *, + publisher_id: str, + offer_id: str, + plan_id: str, + plan_name: Optional[str] = None, + term_unit: Optional[str] = None, + term_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_id: Publisher Id for the marketplace offer. Required. + :paramtype publisher_id: str + :keyword offer_id: Offer Id for the marketplace offer. Required. + :paramtype offer_id: str + :keyword plan_id: Plan Id for the marketplace offer. Required. + :paramtype plan_id: str + :keyword plan_name: Plan Name for the marketplace offer. + :paramtype plan_name: str + :keyword term_unit: Plan Display Name for the marketplace offer. + :paramtype term_unit: str + :keyword term_id: Plan Display Name for the marketplace offer. + :paramtype term_id: str + """ + super().__init__(**kwargs) + self.publisher_id = publisher_id + self.offer_id = offer_id + self.plan_id = plan_id + self.plan_name = plan_name + self.term_unit = term_unit + self.term_id = term_id + + +class LiftrBaseSingleSignOnProperties(_serialization.Model): + """Properties specific to Single Sign On Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar single_sign_on_state: State of the Single Sign On for the organization. Known values are: + "Initial", "Enable", and "Disable". + :vartype single_sign_on_state: str or ~azure.mgmt.astro.models.SingleSignOnStates + :ivar enterprise_app_id: AAD enterprise application Id used to setup SSO. + :vartype enterprise_app_id: str + :ivar single_sign_on_url: URL for SSO to be used by the partner to redirect the user to their + system. + :vartype single_sign_on_url: str + :ivar aad_domains: List of AAD domains fetched from Microsoft Graph for user. + :vartype aad_domains: list[str] + :ivar provisioning_state: Provisioning State of the resource. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.astro.models.ResourceProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "single_sign_on_state": {"key": "singleSignOnState", "type": "str"}, + "enterprise_app_id": {"key": "enterpriseAppId", "type": "str"}, + "single_sign_on_url": {"key": "singleSignOnUrl", "type": "str"}, + "aad_domains": {"key": "aadDomains", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + single_sign_on_state: Optional[Union[str, "_models.SingleSignOnStates"]] = None, + enterprise_app_id: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + aad_domains: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword single_sign_on_state: State of the Single Sign On for the organization. Known values + are: "Initial", "Enable", and "Disable". + :paramtype single_sign_on_state: str or ~azure.mgmt.astro.models.SingleSignOnStates + :keyword enterprise_app_id: AAD enterprise application Id used to setup SSO. + :paramtype enterprise_app_id: str + :keyword single_sign_on_url: URL for SSO to be used by the partner to redirect the user to + their system. + :paramtype single_sign_on_url: str + :keyword aad_domains: List of AAD domains fetched from Microsoft Graph for user. + :paramtype aad_domains: list[str] + """ + super().__init__(**kwargs) + self.single_sign_on_state = single_sign_on_state + self.enterprise_app_id = enterprise_app_id + self.single_sign_on_url = single_sign_on_url + self.aad_domains = aad_domains + self.provisioning_state = None + + +class LiftrBaseUserDetails(_serialization.Model): + """User details for an organization. + + All required parameters must be populated in order to send to Azure. + + :ivar first_name: First name of the user. Required. + :vartype first_name: str + :ivar last_name: Last name of the user. Required. + :vartype last_name: str + :ivar email_address: Email address of the user. Required. + :vartype email_address: str + :ivar upn: User's principal name. + :vartype upn: str + :ivar phone_number: User's phone number. + :vartype phone_number: str + """ + + _validation = { + "first_name": {"required": True}, + "last_name": {"required": True}, + "email_address": {"required": True, "pattern": r"^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"}, + } + + _attribute_map = { + "first_name": {"key": "firstName", "type": "str"}, + "last_name": {"key": "lastName", "type": "str"}, + "email_address": {"key": "emailAddress", "type": "str"}, + "upn": {"key": "upn", "type": "str"}, + "phone_number": {"key": "phoneNumber", "type": "str"}, + } + + def __init__( + self, + *, + first_name: str, + last_name: str, + email_address: str, + upn: Optional[str] = None, + phone_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword first_name: First name of the user. Required. + :paramtype first_name: str + :keyword last_name: Last name of the user. Required. + :paramtype last_name: str + :keyword email_address: Email address of the user. Required. + :paramtype email_address: str + :keyword upn: User's principal name. + :paramtype upn: str + :keyword phone_number: User's phone number. + :paramtype phone_number: str + """ + super().__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + self.upn = upn + self.phone_number = phone_number + + +class LiftrBaseUserDetailsUpdate(_serialization.Model): + """User details for an organization. + + :ivar first_name: First name of the user. + :vartype first_name: str + :ivar last_name: Last name of the user. + :vartype last_name: str + :ivar email_address: Email address of the user. + :vartype email_address: str + :ivar upn: User's principal name. + :vartype upn: str + :ivar phone_number: User's phone number. + :vartype phone_number: str + """ + + _validation = { + "email_address": {"pattern": r"^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"}, + } + + _attribute_map = { + "first_name": {"key": "firstName", "type": "str"}, + "last_name": {"key": "lastName", "type": "str"}, + "email_address": {"key": "emailAddress", "type": "str"}, + "upn": {"key": "upn", "type": "str"}, + "phone_number": {"key": "phoneNumber", "type": "str"}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + upn: Optional[str] = None, + phone_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword first_name: First name of the user. + :paramtype first_name: str + :keyword last_name: Last name of the user. + :paramtype last_name: str + :keyword email_address: Email address of the user. + :paramtype email_address: str + :keyword upn: User's principal name. + :paramtype upn: str + :keyword phone_number: User's phone number. + :paramtype phone_number: str + """ + super().__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + self.upn = upn + self.phone_number = phone_number + + +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 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". + :vartype type: str or ~azure.mgmt.astro.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.astro.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.astro.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.astro.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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 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.astro.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.astro.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.astro.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.astro.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.astro.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.astro.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.astro.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class OrganizationResource(TrackedResource): + """Organization Resource by Astronomer. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.astro.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 properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.astro.models.LiftrBaseDataOrganizationProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.astro.models.ManagedServiceIdentity + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "LiftrBaseDataOrganizationProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.LiftrBaseDataOrganizationProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.astro.models.LiftrBaseDataOrganizationProperties + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.astro.models.ManagedServiceIdentity + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.identity = identity + + +class OrganizationResourceListResult(_serialization.Model): + """The response of a OrganizationResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The OrganizationResource items on this page. Required. + :vartype value: list[~azure.mgmt.astro.models.OrganizationResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OrganizationResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.OrganizationResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The OrganizationResource items on this page. Required. + :paramtype value: list[~azure.mgmt.astro.models.OrganizationResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OrganizationResourceUpdate(_serialization.Model): + """The type used for update operations of the OrganizationResource. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.astro.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the OrganizationResource. + :vartype properties: ~azure.mgmt.astro.models.OrganizationResourceUpdateProperties + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "OrganizationResourceUpdateProperties"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.OrganizationResourceUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.astro.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the OrganizationResource. + :paramtype properties: ~azure.mgmt.astro.models.OrganizationResourceUpdateProperties + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + self.properties = properties + + +class OrganizationResourceUpdateProperties(_serialization.Model): + """The updatable properties of the OrganizationResource. + + :ivar user: Details of the user. + :vartype user: ~azure.mgmt.astro.models.LiftrBaseUserDetailsUpdate + :ivar partner_organization_properties: Organization properties. + :vartype partner_organization_properties: + ~azure.mgmt.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate + """ + + _attribute_map = { + "user": {"key": "user", "type": "LiftrBaseUserDetailsUpdate"}, + "partner_organization_properties": { + "key": "partnerOrganizationProperties", + "type": "LiftrBaseDataPartnerOrganizationPropertiesUpdate", + }, + } + + def __init__( + self, + *, + user: Optional["_models.LiftrBaseUserDetailsUpdate"] = None, + partner_organization_properties: Optional["_models.LiftrBaseDataPartnerOrganizationPropertiesUpdate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword user: Details of the user. + :paramtype user: ~azure.mgmt.astro.models.LiftrBaseUserDetailsUpdate + :keyword partner_organization_properties: Organization properties. + :paramtype partner_organization_properties: + ~azure.mgmt.astro.models.LiftrBaseDataPartnerOrganizationPropertiesUpdate + """ + super().__init__(**kwargs) + self.user = user + self.partner_organization_properties = partner_organization_properties + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.astro.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.astro.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.astro.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.astro.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_patch.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/__init__.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/__init__.py new file mode 100644 index 000000000000..db75e01d4052 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._organizations_operations import OrganizationsOperations + +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", + "OrganizationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_operations.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_operations.py new file mode 100644 index 000000000000..65f70e51c254 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Astronomer.Astro/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.astro.AstroMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.astro.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Astronomer.Astro/operations"} diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_organizations_operations.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_organizations_operations.py new file mode 100644 index 000000000000..505051c3ad0f --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_organizations_operations.py @@ -0,0 +1,1095 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Astronomer.Astro/organizations") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_by_resource_group_request(resource_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", "2023-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_get_request( + resource_group_name: str, organization_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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}", + ) # 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 + ), + "organizationName": _SERIALIZER.url( + "organization_name", + organization_name, + "str", + max_length=50, + min_length=1, + 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_or_update_request( + resource_group_name: str, organization_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-08-01")) + 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/Astronomer.Astro/organizations/{organizationName}", + ) # 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 + ), + "organizationName": _SERIALIZER.url( + "organization_name", + organization_name, + "str", + max_length=50, + min_length=1, + 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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, organization_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-08-01")) + 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/Astronomer.Astro/organizations/{organizationName}", + ) # 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 + ), + "organizationName": _SERIALIZER.url( + "organization_name", + organization_name, + "str", + max_length=50, + min_length=1, + 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, organization_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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}", + ) # 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 + ), + "organizationName": _SERIALIZER.url( + "organization_name", + organization_name, + "str", + max_length=50, + min_length=1, + 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.astro.AstroMgmtClient`'s + :attr:`organizations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.OrganizationResource"]: + """List OrganizationResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResourceListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OrganizationResourceListResult", 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) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Astronomer.Astro/organizations"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.OrganizationResource"]: + """List OrganizationResource resources by resource group. + + :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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResourceListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("OrganizationResourceListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations" + } + + @distributed_trace + def get(self, resource_group_name: str, organization_name: str, **kwargs: Any) -> _models.OrganizationResource: + """Get a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource or the result of cls(response) + :rtype: ~azure.mgmt.astro.models.OrganizationResource + :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.OrganizationResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + organization_name=organization_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("OrganizationResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + organization_name: str, + resource: Union[_models.OrganizationResource, IO], + **kwargs: Any + ) -> _models.OrganizationResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OrganizationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "OrganizationResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + organization_name=organization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OrganizationResource", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("OrganizationResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: _models.OrganizationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.astro.models.OrganizationResource + :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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + organization_name: str, + resource: Union[_models.OrganizationResource, IO], + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Create a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param resource: Resource create parameters. Is either a OrganizationResource type or a IO + type. Required. + :type resource: ~azure.mgmt.astro.models.OrganizationResource 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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResource] = 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, + organization_name=organization_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OrganizationResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + def _update_initial( + self, + resource_group_name: str, + organization_name: str, + properties: Union[_models.OrganizationResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.OrganizationResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OrganizationResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "OrganizationResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + organization_name=organization_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OrganizationResource", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: _models.OrganizationResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.astro.models.OrganizationResourceUpdate + :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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + organization_name: str, + properties: Union[_models.OrganizationResourceUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.OrganizationResource]: + """Update a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :param properties: The resource properties to be updated. Is either a + OrganizationResourceUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.astro.models.OrganizationResourceUpdate 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 OrganizationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.astro.models.OrganizationResource] + :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.OrganizationResource] = 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, + organization_name=organization_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OrganizationResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, organization_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, + organization_name=organization_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, organization_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a OrganizationResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param organization_name: Name of the Organizations resource. Required. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + organization_name=organization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" + } diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_patch.py b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/py.typed b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/azure/mgmt/astro/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/operations_list_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/operations_list_maximum_set_gen.py new file mode 100644 index 000000000000..43701c62471e --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/operations_list_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python operations_list_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Operations_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_create_or_update_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..cd426bb4c137 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_create_or_update_maximum_set_gen.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_create_or_update_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + response = client.organizations.begin_create_or_update( + resource_group_name="rgastronomer", + organization_name="U.1-:7", + resource={ + "identity": {"type": "None", "userAssignedIdentities": {}}, + "location": "mhqthlsatwvqkl", + "properties": { + "marketplace": { + "offerDetails": { + "offerId": "krzkefmpxztqyusidzgpchfaswuyce", + "planId": "kndxzygsanuiqzwbfbbvoipv", + "planName": "pwqjwlq", + "publisherId": "gfsqxygpnerxmvols", + "termId": "pwds", + "termUnit": "xyygyzcazkuelz", + }, + "subscriptionId": "ntthclydlpqmasr", + "subscriptionStatus": "PendingFulfillmentStart", + }, + "partnerOrganizationProperties": { + "organizationId": "lskgzdmziusgrsucv", + "organizationName": "3-", + "singleSignOnProperties": { + "aadDomains": ["kfbleh"], + "enterpriseAppId": "mklfypyujwumgwdzae", + "provisioningState": "Succeeded", + "singleSignOnState": "Initial", + "singleSignOnUrl": "ymmtzkyghvinvhgnqlzwrr", + }, + "workspaceId": "vcrupxwpaba", + "workspaceName": "9.:06", + }, + "provisioningState": "Succeeded", + "user": { + "emailAddress": ".K_@e7N-g1.xjqnbPs", + "firstName": "nfh", + "lastName": "lazfbstcccykibvcrxpmglqam", + "phoneNumber": "inxkscllh", + "upn": "xtutvycpxjrtoftx", + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_delete_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..579807be580a --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_delete_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_delete_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + client.organizations.begin_delete( + resource_group_name="rgastronomer", + organization_name="q:", + ).result() + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_get_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_get_maximum_set_gen.py new file mode 100644 index 000000000000..edbe5b43b1e4 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_get_maximum_set_gen.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_get_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + response = client.organizations.get( + resource_group_name="rgastronomer", + organization_name="S PS", + ) + print(response) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_resource_group_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..ea5e89589972 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_list_by_resource_group_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + response = client.organizations.list_by_resource_group( + resource_group_name="rgastronomer", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_subscription_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..f9b194728391 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_list_by_subscription_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + response = client.organizations.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/generated_samples/organizations_update_maximum_set_gen.py b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_update_maximum_set_gen.py new file mode 100644 index 000000000000..5ead3796668b --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/generated_samples/organizations_update_maximum_set_gen.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.astro import AstroMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-astro +# USAGE + python organizations_update_maximum_set_gen.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 = AstroMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="43454B17-172A-40FE-80FA-549EA23D12B3", + ) + + response = client.organizations.begin_update( + resource_group_name="rgastronomer", + organization_name="6.", + properties={ + "identity": {"type": "None", "userAssignedIdentities": {}}, + "properties": { + "partnerOrganizationProperties": { + "organizationId": "lrtmbkvyvvoszhjevohkmyjhfyty", + "organizationName": "U2P_", + "singleSignOnProperties": { + "aadDomains": ["kfbleh"], + "enterpriseAppId": "mklfypyujwumgwdzae", + "provisioningState": "Succeeded", + "singleSignOnState": "Initial", + "singleSignOnUrl": "ymmtzkyghvinvhgnqlzwrr", + }, + "workspaceId": "xsepuskdhejaadusyxq", + "workspaceName": "L.-y_--:", + }, + "user": { + "emailAddress": ".K_@e7N-g1.xjqnbPs", + "firstName": "qeuofehzypzljgcuysugefbgxde", + "lastName": "g", + "phoneNumber": "aqpyxznvqpgkzohevynofrjdfgoo", + "upn": "uwtprzdfpsqmktx", + }, + }, + "tags": {"key1474": "bqqyipxnbbxryhznyaosmtpo"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/astro/azure-mgmt-astro/sdk_packaging.toml b/sdk/astro/azure-mgmt-astro/sdk_packaging.toml new file mode 100644 index 000000000000..50395d0369e1 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-astro" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/astro/azure-mgmt-astro/setup.py b/sdk/astro/azure-mgmt-astro/setup.py new file mode 100644 index 000000000000..3ae4d8eee8fe --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-astro" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/astro/ci.yml b/sdk/astro/ci.yml new file mode 100644 index 000000000000..e2b6d4cc4a0e --- /dev/null +++ b/sdk/astro/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/astro/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/astro/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: astro + TestProxy: true + Artifacts: + - name: azure-mgmt-astro + safeName: azuremgmtastro diff --git a/sdk/automation/azure-mgmt-automation/_meta.json b/sdk/automation/azure-mgmt-automation/_meta.json index 7bf91d868f55..8659ea9d92dc 100644 --- a/sdk/automation/azure-mgmt-automation/_meta.json +++ b/sdk/automation/azure-mgmt-automation/_meta.json @@ -1,11 +1,11 @@ { - "commit": "23b62d4e4dab07dccda851cfe50f6c6afb705a3b", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/automation/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/automation/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py index 04362ae49337..1e03f87a1766 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_automation_client.py @@ -43,6 +43,7 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PowerShell72ModuleOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, Python2PackageOperations, @@ -149,6 +150,8 @@ class AutomationClient( :vartype object_data_types: azure.mgmt.automation.operations.ObjectDataTypesOperations :ivar fields: FieldsOperations operations :vartype fields: azure.mgmt.automation.operations.FieldsOperations + :ivar power_shell72_module: PowerShell72ModuleOperations operations + :vartype power_shell72_module: azure.mgmt.automation.operations.PowerShell72ModuleOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.automation.operations.Operations :ivar python2_package: Python2PackageOperations operations @@ -201,7 +204,7 @@ def __init__( **kwargs: Any ) -> None: self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -269,6 +272,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) + self.power_shell72_module = PowerShell72ModuleOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.python3_package = Python3PackageOperations(self._client, self._config, self._serialize, self._deserialize) @@ -321,5 +327,5 @@ def __enter__(self) -> "AutomationClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ 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)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,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 str(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) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,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): @@ -875,9 +906,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) @@ -922,7 +958,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: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py index 2bd6526d54d6..f452f3670eb3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_vendor.py @@ -27,17 +27,6 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - class AutomationClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py index 73aef742777f..e5754a47ce68 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py index 4a916016e428..651fb2626516 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/_automation_client.py @@ -43,6 +43,7 @@ NodeReportsOperations, ObjectDataTypesOperations, Operations, + PowerShell72ModuleOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, Python2PackageOperations, @@ -149,6 +150,9 @@ class AutomationClient( :vartype object_data_types: azure.mgmt.automation.aio.operations.ObjectDataTypesOperations :ivar fields: FieldsOperations operations :vartype fields: azure.mgmt.automation.aio.operations.FieldsOperations + :ivar power_shell72_module: PowerShell72ModuleOperations operations + :vartype power_shell72_module: + azure.mgmt.automation.aio.operations.PowerShell72ModuleOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.automation.aio.operations.Operations :ivar python2_package: Python2PackageOperations operations @@ -201,7 +205,7 @@ def __init__( **kwargs: Any ) -> None: self._config = AutomationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -269,6 +273,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.fields = FieldsOperations(self._client, self._config, self._serialize, self._deserialize) + self.power_shell72_module = PowerShell72ModuleOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.python2_package = Python2PackageOperations(self._client, self._config, self._serialize, self._deserialize) self.python3_package = Python3PackageOperations(self._client, self._config, self._serialize, self._deserialize) @@ -321,5 +328,5 @@ async def __aenter__(self) -> "AutomationClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py index ceadd5d1de73..98093c1e0571 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/__init__.py @@ -38,6 +38,7 @@ from ._module_operations import ModuleOperations from ._object_data_types_operations import ObjectDataTypesOperations from ._fields_operations import FieldsOperations +from ._power_shell72_module_operations import PowerShell72ModuleOperations from ._operations import Operations from ._automation_client_operations import AutomationClientOperationsMixin from ._python2_package_operations import Python2PackageOperations @@ -91,6 +92,7 @@ "ModuleOperations", "ObjectDataTypesOperations", "FieldsOperations", + "PowerShell72ModuleOperations", "Operations", "AutomationClientOperationsMixin", "Python2PackageOperations", diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py index 48d5318457f7..59315afc6a1a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_activity_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,10 +30,6 @@ from ...operations._activity_operations import build_get_request, build_list_by_module_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +64,9 @@ async def get( ) -> _models.Activity: """Retrieve the activity in the module identified by module name and activity name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +91,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +108,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,6 +137,9 @@ def list_by_module( ) -> AsyncIterable["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -152,7 +154,7 @@ def list_by_module( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) error_map = { @@ -196,8 +198,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py index 3615ea66bc8f..817e99ae4efc 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +29,6 @@ from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +58,9 @@ async def get( ) -> _models.AgentRegistration: """Retrieve the automation agent registration information. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,9 +81,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +96,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +131,9 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -160,6 +161,9 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -185,12 +189,15 @@ async def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a model - type or a IO type. Required. + :param parameters: The name of the agent registration key to be regenerated. Is either a + AgentRegistrationRegenerateKeyParameter type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -211,16 +218,14 @@ async def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") @@ -240,8 +245,9 @@ async def regenerate_key( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py index d6ddc08bfb00..3ebbbdb3eac1 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_account_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +73,9 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -104,6 +103,9 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -129,12 +131,15 @@ async def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the update automation account. Is either a + AutomationAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -155,14 +160,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") @@ -182,8 +187,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,6 +222,9 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -243,6 +252,9 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -268,12 +280,15 @@ async def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param parameters: Parameters supplied to the create or update automation account. Is either a - model type or a IO type. Required. + AutomationAccountCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,14 +309,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") @@ -321,8 +336,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,6 +369,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -373,7 +392,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -388,8 +407,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,6 +432,9 @@ async def get( ) -> _models.AutomationAccount: """Get information about an Automation Account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -432,7 +455,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -447,8 +470,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,6 +499,9 @@ def list_by_resource_group( ) -> AsyncIterable["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -486,7 +513,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -528,8 +555,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,7 +589,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutomationAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -602,8 +630,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py index ef0c01c9f234..33261a936f51 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_automation_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +29,6 @@ from ...operations._automation_client_operations import build_convert_graph_runbook_content_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -106,8 +102,8 @@ async def convert_graph_runbook_content( :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Input data describing the graphical runbook. Is either a model type or a IO - type. Required. + :param parameters: Input data describing the graphical runbook. Is either a + GraphicalRunbookContent type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -128,14 +124,14 @@ async def convert_graph_runbook_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GraphicalRunbookContent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GraphicalRunbookContent") @@ -155,8 +151,9 @@ async def convert_graph_runbook_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py index 5379dc31ca25..2cb7b30ee558 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_certificate_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Certificate: """Retrieve the certificate identified by certificate name. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +244,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +277,9 @@ async def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +288,7 @@ async def create_or_update( Required. :type certificate_name: str :param parameters: The parameters supplied to the create or update certificate operation. Is - either a model type or a IO type. Required. + either a CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +309,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -324,8 +337,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +377,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +410,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +441,9 @@ async def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +451,7 @@ async def update( :param certificate_name: The parameters supplied to the update certificate operation. Required. :type certificate_name: str :param parameters: The parameters supplied to the update certificate operation. Is either a - model type or a IO type. Required. + CertificateUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +472,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateUpdateParameters") @@ -477,8 +500,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +529,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Certificate"]: """Retrieve a list of certificates. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +544,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) error_map = { @@ -560,8 +587,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py index 2a8289659e0f..9d48e24770fa 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Connection: """Retrieve the connection identified by connection name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +244,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +277,9 @@ async def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +288,7 @@ async def create_or_update( Required. :type connection_name: str :param parameters: The parameters supplied to the create or update connection operation. Is - either a model type or a IO type. Required. + either a ConnectionCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +309,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") @@ -324,8 +337,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +377,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +410,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +441,9 @@ async def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +451,7 @@ async def update( :param connection_name: The parameters supplied to the update a connection operation. Required. :type connection_name: str :param parameters: The parameters supplied to the update a connection operation. Is either a - model type or a IO type. Required. + ConnectionUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +472,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionUpdateParameters") @@ -477,8 +500,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +529,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Connection"]: """Retrieve a list of connections. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +544,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -560,8 +587,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py index e51ac98d5238..0634558d2277 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_connection_type_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +36,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +90,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -107,8 +106,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,6 +131,9 @@ async def get( ) -> _models.ConnectionType: """Retrieve the connection type identified by connection type name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -153,7 +156,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) request = build_get_request( @@ -169,8 +172,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,6 +208,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -236,6 +243,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -266,6 +276,9 @@ async def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -274,7 +287,7 @@ async def create_or_update( operation. Required. :type connection_type_name: str :param parameters: The parameters supplied to the create or update connection type operation. - Is either a model type or a IO type. Required. + Is either a ConnectionTypeCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -295,14 +308,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") @@ -323,8 +336,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,6 +365,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.ConnectionType"]: """Retrieve a list of connection types. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +380,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -406,8 +423,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py index 75800d5637d1..65f26ecd237f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_credential_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Credential: """Retrieve the credential identified by credential name. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,6 +244,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -267,6 +277,9 @@ async def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -275,7 +288,7 @@ async def create_or_update( Required. :type credential_name: str :param parameters: The parameters supplied to the create or update credential operation. Is - either a model type or a IO type. Required. + either a CredentialCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -296,14 +309,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") @@ -324,8 +337,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,6 +377,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,6 +410,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -421,6 +441,9 @@ async def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -428,7 +451,7 @@ async def update( :param credential_name: The parameters supplied to the Update credential operation. Required. :type credential_name: str :param parameters: The parameters supplied to the Update credential operation. Is either a - model type or a IO type. Required. + CredentialUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,14 +472,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialUpdateParameters") @@ -477,8 +500,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,6 +529,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Credential"]: """Retrieve a list of credentials. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -517,7 +544,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) error_map = { @@ -560,8 +587,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py index 1035080d3af2..c0ddf73062a3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_deleted_automation_accounts_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._deleted_automation_accounts_operations import build_list_by_subscription_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +71,7 @@ async def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomation _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) request = build_list_by_subscription_request( @@ -89,8 +84,9 @@ async def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomation 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py index 46bf8b413117..57be4f534901 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,16 +80,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscCompilationJobCreateParameters") @@ -114,8 +108,9 @@ async def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,6 +144,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,6 +185,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -223,6 +224,9 @@ async def begin_create( ) -> AsyncLROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -230,7 +234,7 @@ async def begin_create( :param compilation_job_name: The DSC configuration Id. Required. :type compilation_job_name: str :param parameters: The parameters supplied to the create compilation job operation. Is either a - model type or a IO type. Required. + DscCompilationJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -251,9 +255,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -305,6 +307,9 @@ async def get( ) -> _models.DscCompilationJob: """Retrieve the Dsc configuration compilation job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dsccompilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -327,9 +332,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) request = build_get_request( @@ -345,8 +348,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,6 +377,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/compilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,9 +395,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) error_map = { @@ -434,8 +439,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,6 +464,9 @@ async def get_stream( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -482,9 +491,7 @@ async def get_stream( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_stream_request( @@ -501,8 +508,9 @@ async def get_stream( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py index cf2858b8ec2c..796255b03c74 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +57,9 @@ async def list_by_job( ) -> _models.JobStreamListResult: """Retrieve all the job streams for the compilation Job. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -84,9 +82,7 @@ async def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) request = build_list_by_job_request( @@ -102,8 +98,9 @@ async def list_by_job( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py index 8235b0d6417f..01c9f93b81fc 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py @@ -6,7 +6,6 @@ # 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, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +132,9 @@ async def get( ) -> _models.DscConfiguration: """Retrieve the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -171,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,6 +209,9 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -236,6 +242,9 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -264,14 +273,17 @@ async def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationCreateOrUpdateParameters type or a str type. Required. :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -292,7 +304,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -320,8 +332,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,6 +372,9 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -389,6 +405,9 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -417,14 +436,17 @@ async def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Default value is None. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationUpdateParameters type or a str type. Default value is None. :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -445,7 +467,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -479,8 +501,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,6 +530,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the configuration script identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -529,7 +555,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -545,8 +571,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -579,6 +606,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscConfiguration"]: """Retrieve a list of configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -599,7 +629,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -646,8 +676,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py index 9f8e09ce19bf..2a1933d587de 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,6 +67,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +92,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +108,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +133,9 @@ async def get( ) -> _models.DscNodeConfiguration: """Retrieve the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +158,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -171,8 +174,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,14 +216,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscNodeConfigurationCreateOrUpdateParameters") @@ -240,8 +244,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -274,9 +279,12 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,9 +320,12 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -348,17 +359,20 @@ async def begin_create_or_update( node_configuration_name: str, parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[None]: + ) -> AsyncLROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param node_configuration_name: The Dsc node configuration name. Required. :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a IO type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscNodeConfigurationCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -380,7 +394,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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) @@ -439,6 +453,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -461,7 +478,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -508,8 +525,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py index 90db769927b8..9bd508c665e2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_dsc_node_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +36,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,9 +90,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -109,8 +106,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,6 +131,9 @@ async def get( ) -> _models.DscNode: """Retrieve the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,9 +156,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) request = build_get_request( @@ -173,8 +172,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -208,6 +208,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -238,6 +241,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -266,6 +272,9 @@ async def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -273,7 +282,7 @@ async def update( :param node_id: Parameters supplied to the update dsc node. Required. :type node_id: str :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - model type or a IO type. Required. + DscNodeUpdateParameters type or a IO type. Required. :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,16 +303,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dsc_node_update_parameters, (IO, bytes)): + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): _content = dsc_node_update_parameters else: _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") @@ -324,8 +331,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,6 +367,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.DscNode"]: """Retrieve a list of dsc nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -379,9 +390,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) error_map = { @@ -428,8 +437,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py index bf24b786c68e..8135948c548f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_fields_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._fields_operations import build_list_by_type_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ def list_by_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/typefieldoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -79,7 +77,7 @@ def list_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -124,8 +122,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py index f806c6b894b2..a8efb4daf0ae 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +70,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -96,7 +95,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -112,8 +111,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,6 +140,9 @@ async def get( ) -> _models.HybridRunbookWorkerGroup: """Retrieve a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -162,7 +165,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -178,8 +181,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,6 +217,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -245,6 +252,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -276,6 +286,9 @@ async def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -283,7 +296,8 @@ async def create( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for - hybrid runbook worker group. Is either a model type or a IO type. Required. + hybrid runbook worker group. Is either a HybridRunbookWorkerGroupCreateOrUpdateParameters type + or a IO type. Required. :type hybrid_runbook_worker_group_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -305,14 +319,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_creation_parameters else: _json = self._serialize.body( @@ -335,8 +349,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +389,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -406,6 +424,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +458,9 @@ async def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -444,7 +468,7 @@ async def update( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_updation_parameters: The hybrid runbook worker group. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO type. Required. :type hybrid_runbook_worker_group_updation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -466,14 +490,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_updation_parameters else: _json = self._serialize.body( @@ -496,8 +520,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,6 +549,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -540,7 +568,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) error_map = { @@ -584,8 +612,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py index 250602e6afec..edd481c474a0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +71,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -99,7 +98,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -116,8 +115,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,6 +145,9 @@ async def get( ) -> _models.HybridRunbookWorker: """Retrieve a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -169,7 +172,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) request = build_get_request( @@ -186,8 +189,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,6 +226,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -257,6 +264,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -289,6 +299,9 @@ async def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -298,7 +311,7 @@ async def create( :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid - runbook worker. Is either a model type or a IO type. Required. + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Required. :type hybrid_runbook_worker_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -320,14 +333,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_creation_parameters else: _json = self._serialize.body( @@ -351,8 +364,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -391,6 +405,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -426,6 +443,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,6 +478,9 @@ async def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -467,7 +490,7 @@ async def move( # pylint: disable=inconsistent-return-statements :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerMoveParameters type or a IO type. Required. :type hybrid_runbook_worker_move_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -489,14 +512,14 @@ async def move( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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(hybrid_runbook_worker_move_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_move_parameters else: _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") @@ -518,8 +541,9 @@ async def move( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,6 +571,9 @@ def list_by_hybrid_runbook_worker_group( ) -> AsyncIterable["_models.HybridRunbookWorker"]: """Retrieve a list of hybrid runbook workers. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -564,7 +591,7 @@ def list_by_hybrid_runbook_worker_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) error_map = { @@ -609,8 +636,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py index 294a6b54fe5f..33268a81933a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,10 +40,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,6 +74,9 @@ async def get_output( ) -> str: """Retrieve the job output identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -102,7 +101,7 @@ async def get_output( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_output_request( @@ -119,8 +118,9 @@ async def get_output( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,6 +151,9 @@ async def get_runbook_content( ) -> str: """Retrieve the runbook content of the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -175,7 +178,7 @@ async def get_runbook_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_runbook_content_request( @@ -192,8 +195,9 @@ async def get_runbook_content( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,6 +228,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -248,7 +255,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -265,8 +272,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,6 +302,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -318,7 +329,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -335,8 +346,9 @@ async def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,6 +376,9 @@ async def get( ) -> _models.Job: """Retrieve the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,7 +403,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +420,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,6 +457,9 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,6 +493,9 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -505,14 +527,17 @@ async def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param job_name: The job name. Required. :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a model type - or a IO type. Required. + :param parameters: The parameters supplied to the create job operation. Is either a + JobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -535,14 +560,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobCreateParameters") @@ -564,8 +589,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,6 +623,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.JobCollectionItem"]: """Retrieve a list of jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -614,7 +643,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) error_map = { @@ -659,8 +688,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,6 +718,9 @@ async def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -712,7 +745,7 @@ async def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -729,8 +762,9 @@ async def resume( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py index 1b87fe2cc35c..dde8b48698d6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_schedule_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +36,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +90,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -107,8 +106,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,6 +131,9 @@ async def get( ) -> _models.JobSchedule: """Retrieve the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -153,7 +156,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -169,8 +172,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,6 +208,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -234,6 +241,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +272,9 @@ async def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -269,7 +282,7 @@ async def create( :param job_schedule_id: The job schedule name. Required. :type job_schedule_id: str :param parameters: The parameters supplied to the create job schedule operation. Is either a - model type or a IO type. Required. + JobScheduleCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -290,14 +303,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobScheduleCreateParameters") @@ -318,8 +331,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,6 +360,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.JobSchedule"]: """Retrieve a list of job schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -360,7 +377,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -404,8 +421,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py index b815bac87793..0caeebc0c4f5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_job_stream_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,10 +30,6 @@ from ...operations._job_stream_operations import build_get_request, build_list_by_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ async def get( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -96,7 +94,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -114,8 +112,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,6 +147,9 @@ def list_by_job( ) -> AsyncIterable["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -166,7 +168,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -212,8 +214,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py index 8f4a8d9484f8..a3a7819fe1e7 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_keys_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._keys_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +77,7 @@ async def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) request = build_list_by_automation_account_request( @@ -97,8 +92,9 @@ async def list_by_automation_account( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py index c383a374464f..3b723e7fe0ab 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._linked_workspace_operations import build_get_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +57,9 @@ async def get( ) -> _models.LinkedWorkspace: """Retrieve the linked workspace for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/linkedworkspaceoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,7 +80,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) request = build_get_request( @@ -97,8 +95,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py index f6de70a18d40..34d769e78be7 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_module_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the module by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Module: """Retrieve the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +242,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +273,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The create or update parameters for module. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +304,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") @@ -319,8 +332,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +372,9 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +405,9 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +436,17 @@ async def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The update parameters for module. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +467,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleUpdateParameters") @@ -472,8 +495,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +524,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +539,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -555,8 +582,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py index 9c3773f1b89b..bcc54110347d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_count_information_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._node_count_information_operations import build_get_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,6 +61,9 @@ async def get( ) -> _models.NodeCounts: """Retrieve counts for Dsc Nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/nodecounts + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -89,9 +87,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) request = build_get_request( @@ -107,8 +103,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py index f69a5d6d25f4..8651b9434401 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_node_reports_operations.py @@ -39,10 +39,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,6 +74,9 @@ def list_by_node( ) -> AsyncIterable["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -94,9 +93,7 @@ def list_by_node( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,6 +163,9 @@ async def get( ) -> _models.DscNodeReport: """Retrieve the Dsc node report data by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -189,9 +190,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) request = build_get_request( @@ -208,8 +207,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,6 +236,9 @@ async def get_content( ) -> JSON: """Retrieve the Dsc node reports by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -260,9 +263,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_get_content_request( @@ -279,8 +280,9 @@ async def get_content( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py index 2a5725fd5a63..e6959bf763bb 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_object_data_types_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,10 +32,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,6 +61,9 @@ def list_fields_by_module_and_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -82,7 +80,7 @@ def list_fields_by_module_and_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -127,8 +125,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,6 +150,9 @@ def list_fields_by_type( ) -> AsyncIterable["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -165,7 +167,7 @@ def list_fields_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -209,8 +211,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py index 3599d8fec14d..e50c544f08e3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._operations import build_list_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -109,8 +104,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_power_shell72_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_power_shell72_module_operations.py new file mode 100644 index 000000000000..8c6633dfd797 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_power_shell72_module_operations.py @@ -0,0 +1,611 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._power_shell72_module_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_automation_account_request, + build_update_request, +) +from .._vendor import AutomationClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PowerShell72ModuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.aio.AutomationClient`'s + :attr:`power_shell72_module` 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_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> None: + """Delete the module by name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_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", "2023-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :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", "2023-11-01")) + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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 = 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("Module", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: _models.ModuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters + :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: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Module] = 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, "ModuleCreateOrUpdateParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Module", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Module", pipeline_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.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: _models.ModuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters + :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: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleUpdateParameters, IO], + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Module] = 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, "ModuleUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + 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) + + _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("Module", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Module"]: + """Retrieve a list of PowerShell72 modules. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Module or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.Module] + :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", "2023-11-01")) + cls: ClsType[_models.ModuleListResult] = 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_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_automation_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ModuleListResult", 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_automation_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py index 5325585a9f77..8de9d11136b3 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -130,8 +124,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,9 +174,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +190,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,16 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -267,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,7 +379,7 @@ async def begin_create_or_update( :type automation_account_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -408,9 +401,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -474,9 +465,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -492,8 +481,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,9 +531,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) 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) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py index b31120697d9a..77a506dc644d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._private_link_resources_operations import build_automation_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,9 +71,7 @@ def automation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -121,8 +114,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py index 7422ff40e17e..24501535053e 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python2_package_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 2 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Module: """Retrieve the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +242,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +273,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +304,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -319,8 +332,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +372,9 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +405,9 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +436,17 @@ async def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +467,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -472,8 +495,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +524,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of python 2 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +539,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -555,8 +582,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py index eb2d17821588..7dca1b5afc6c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_python3_package_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +66,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 3 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +91,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -108,8 +107,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def get( ) -> _models.Module: """Retrieve the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -170,8 +173,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,6 +209,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -235,6 +242,9 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,14 +273,17 @@ async def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -291,14 +304,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -319,8 +332,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +372,9 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -388,6 +405,9 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -416,14 +436,17 @@ async def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,14 +467,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -472,8 +495,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -500,6 +524,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Module"]: """Retrieve a list of python 3 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +539,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -555,8 +582,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py index f2bab4dec2f3..b064210785a9 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py @@ -6,7 +6,6 @@ # 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, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -36,10 +35,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +64,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the content of runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -91,7 +89,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -107,8 +105,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +146,7 @@ async def _replace_content_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[AsyncIterator[bytes]]] = kwargs.pop("cls", None) @@ -168,8 +167,9 @@ async def _replace_content_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,6 +207,9 @@ async def begin_replace_content( ) -> AsyncLROPoller[AsyncIterator[bytes]]: """Replaces the runbook draft content. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -231,7 +234,7 @@ async def begin_replace_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -286,6 +289,9 @@ async def get( ) -> _models.RunbookDraft: """Retrieve the runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -308,7 +314,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +330,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,6 +359,9 @@ async def undo_edit( ) -> _models.RunbookDraftUndoEditResult: """Undo draft edit to last known published state identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -374,7 +384,7 @@ async def undo_edit( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) request = build_undo_edit_request( @@ -390,8 +400,9 @@ async def undo_edit( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py index 055eb0da6ab7..4c51d1e43f0c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_runbook_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,10 +41,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +78,7 @@ async def _publish_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_publish_request( @@ -98,8 +94,9 @@ async def _publish_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -125,6 +122,9 @@ async def begin_publish( ) -> AsyncLROPoller[None]: """Publish runbook draft. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -146,7 +146,7 @@ async def begin_publish( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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) @@ -193,6 +193,9 @@ async def get_content( ) -> AsyncIterator[bytes]: """Retrieve the content of runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -215,7 +218,7 @@ async def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -231,8 +234,9 @@ async def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,6 +262,9 @@ async def get( ) -> _models.Runbook: """Retrieve the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -280,7 +287,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) request = build_get_request( @@ -296,8 +303,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,6 +339,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -362,6 +373,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -391,6 +405,9 @@ async def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -398,7 +415,8 @@ async def create_or_update( :param runbook_name: The runbook name. Required. :type runbook_name: str :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a model type or a IO type. Required. + a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -419,14 +437,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") @@ -447,8 +465,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,6 +505,9 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,6 +538,9 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -544,14 +569,17 @@ async def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -572,14 +600,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookUpdateParameters") @@ -600,8 +628,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -628,6 +657,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the runbook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -650,7 +682,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -666,8 +698,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,6 +723,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Runbook"]: """Retrieve a list of runbooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -702,7 +738,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) error_map = { @@ -745,8 +781,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py index 7a3e4d38c12e..02acdb60924d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_schedule_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +73,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +107,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +139,9 @@ async def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +149,7 @@ async def create_or_update( :param schedule_name: The schedule name. Required. :type schedule_name: str :param parameters: The parameters supplied to the create or update schedule operation. Is - either a model type or a IO type. Required. + either a ScheduleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +170,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") @@ -193,8 +198,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,6 +239,9 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -263,6 +272,9 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -291,14 +303,17 @@ async def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param schedule_name: The schedule name. Required. :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update schedule operation. Is either a + ScheduleUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -319,14 +334,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleUpdateParameters") @@ -347,8 +362,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +391,9 @@ async def get( ) -> _models.Schedule: """Retrieve the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -397,7 +416,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( @@ -413,8 +432,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,6 +461,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -463,7 +486,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -479,8 +502,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,6 +527,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Schedule"]: """Retrieve a list of schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -515,7 +542,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -558,8 +585,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py index 5f715eec7678..e470121d2b2d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -32,10 +31,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ async def get_by_id( ) -> _models.SoftwareUpdateConfigurationMachineRun: """Get a single software update configuration machine run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -95,7 +93,7 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -112,8 +110,9 @@ async def get_by_id( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,6 +146,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: """Return list of software update configuration machine runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -178,7 +180,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -197,8 +199,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py index 2e5dfb1846ab..1482c11435cd 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from ...operations._software_update_configuration_runs_operations import build_get_by_id_request, build_list_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +62,9 @@ async def get_by_id( ) -> _models.SoftwareUpdateConfigurationRun: """Get a single software update configuration Run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -92,7 +90,7 @@ async def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -109,8 +107,9 @@ async def get_by_id( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,6 +143,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationRunListResult: """Return list of software update configuration runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -175,7 +177,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -194,8 +196,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py index 38d44d4fb817..eb02ace44071 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -34,10 +34,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +71,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -109,6 +108,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -141,6 +143,9 @@ async def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -148,7 +153,8 @@ async def create( :param software_update_configuration_name: The name of the software update configuration to be created. Required. :type software_update_configuration_name: str - :param parameters: Request body. Is either a model type or a IO type. Required. + :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO type. + Required. :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -171,14 +177,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") @@ -200,8 +206,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,6 +244,9 @@ async def get_by_name( ) -> _models.SoftwareUpdateConfiguration: """Get a single software update configuration by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +272,7 @@ async def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) request = build_get_by_name_request( @@ -279,8 +289,9 @@ async def get_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,6 +323,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """delete a specific software update configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -337,7 +351,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -354,8 +368,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -383,6 +398,9 @@ async def list( ) -> _models.SoftwareUpdateConfigurationListResult: """Get all software update configurations for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,7 +425,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -424,8 +442,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py index 4b0b4776ffe5..75028fa53d1f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +73,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +107,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +139,9 @@ async def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +149,7 @@ async def create_or_update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the create or update source control operation. Is - either a model type or a IO type. Required. + either a SourceControlCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +170,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") @@ -193,8 +198,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,6 +238,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +271,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -290,6 +302,9 @@ async def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,7 +312,7 @@ async def update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the update source control operation. Is either a - model type or a IO type. Required. + SourceControlUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,14 +333,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlUpdateParameters") @@ -346,8 +361,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +390,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,7 +415,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -412,8 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,6 +456,9 @@ async def get( ) -> _models.SourceControl: """Retrieve the source control identified by source control name. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,7 +481,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -474,8 +497,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,6 +526,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.SourceControl"]: """Retrieve a list of source controls. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,7 +543,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) error_map = { @@ -560,8 +587,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py index 51cee98812a5..f4c365ca109a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,10 +35,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -110,6 +109,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -142,6 +144,9 @@ async def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -151,7 +156,7 @@ async def create( :param source_control_sync_job_id: The source control sync job id. Required. :type source_control_sync_job_id: str :param parameters: The parameters supplied to the create source control sync job operation. Is - either a model type or a IO type. Required. + either a SourceControlSyncJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -172,14 +177,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") @@ -201,8 +206,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,6 +240,9 @@ async def get( ) -> _models.SourceControlSyncJobById: """Retrieve the source control sync job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -258,7 +267,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) request = build_get_request( @@ -275,8 +284,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,6 +318,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -326,7 +339,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) error_map = { @@ -371,8 +384,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py index 42a2a6839152..653661261b49 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,10 +30,6 @@ from ...operations._source_control_sync_job_streams_operations import build_get_request, build_list_by_sync_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ def list_by_sync_job( ) -> AsyncIterable["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -90,7 +88,7 @@ def list_by_sync_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) error_map = { @@ -136,8 +134,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,6 +165,9 @@ async def get( ) -> _models.SourceControlSyncJobStreamById: """Retrieve a sync job stream identified by stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -192,7 +194,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +212,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py index 5ef85ee1ce1f..a585c52cb448 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_statistics_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._statistics_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Statistics"]: """Retrieve the statistics for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/statisticsoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -77,7 +75,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) error_map = { @@ -121,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py index fabe9d8f9a29..042ab3b0bc0c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +35,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +71,9 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -105,6 +104,9 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -133,14 +135,17 @@ async def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The parameters supplied to the create test job operation. Required. :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the create test job operation. Is either a + TestJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -161,14 +166,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestJobCreateParameters") @@ -189,8 +194,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,6 +223,9 @@ async def get( ) -> _models.TestJob: """Retrieve the test job for the specified runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -239,7 +248,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) request = build_get_request( @@ -255,8 +264,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -283,6 +293,9 @@ async def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -305,7 +318,7 @@ async def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -321,8 +334,9 @@ async def resume( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,6 +359,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -367,7 +384,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -383,8 +400,9 @@ async def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -407,6 +425,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -429,7 +450,7 @@ async def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -445,8 +466,9 @@ async def suspend( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py index 51075a4a0d03..6c0e0ccd0a81 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_test_job_streams_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,10 +30,6 @@ from ...operations._test_job_streams_operations import build_get_request, build_list_by_test_job_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +64,9 @@ async def get( ) -> _models.JobStream: """Retrieve a test job stream of the test job identified by runbook name and stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -93,7 +91,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +108,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,6 +142,9 @@ def list_by_test_job( ) -> AsyncIterable["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -159,7 +161,7 @@ def list_by_test_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -204,8 +206,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py index 52a873ca2ef7..e19c64a5dc8d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_usages_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._usages_operations import build_list_by_automation_account_request from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Usage"]: """Retrieve the usage for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/usageoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -75,7 +73,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) error_map = { @@ -118,8 +116,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py index bb54df1bd302..f2babba00ef5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_variable_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +37,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,6 +73,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -108,6 +107,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,6 +139,9 @@ async def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -144,7 +149,7 @@ async def create_or_update( :param variable_name: The variable name. Required. :type variable_name: str :param parameters: The parameters supplied to the create or update variable operation. Is - either a model type or a IO type. Required. + either a VariableCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,14 +170,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") @@ -193,8 +198,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,6 +238,9 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,6 +271,9 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -290,14 +302,17 @@ async def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param variable_name: The variable name. Required. :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update variable operation. Is either a + VariableUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,14 +333,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableUpdateParameters") @@ -346,8 +361,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,6 +390,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,7 +415,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -412,8 +431,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,6 +456,9 @@ async def get( ) -> _models.Variable: """Retrieve the variable identified by variable name. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -458,7 +481,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) request = build_get_request( @@ -474,8 +497,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,6 +526,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Variable"]: """Retrieve a list of variables. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -514,7 +541,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) error_map = { @@ -557,8 +584,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py index 4dea29785374..58b8b8607ea4 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_watcher_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,10 +39,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,6 +75,9 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -109,6 +108,9 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -137,14 +139,17 @@ async def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for watcher. Is either a Watcher type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.Watcher or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -165,16 +170,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Watcher") @@ -195,8 +198,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,6 +231,9 @@ async def get( ) -> _models.Watcher: """Retrieve the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -249,9 +256,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) request = build_get_request( @@ -267,8 +272,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +308,9 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -332,6 +341,9 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -360,14 +372,17 @@ async def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -388,16 +403,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WatcherUpdateParameters") @@ -418,8 +431,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,6 +460,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the watcher by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -468,9 +485,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -486,8 +501,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -510,6 +526,9 @@ async def start( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -532,9 +551,7 @@ async def start( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -550,8 +567,9 @@ async def start( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,6 +592,9 @@ async def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -596,9 +617,7 @@ async def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -614,8 +633,9 @@ async def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,6 +658,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Watcher"]: """Retrieve a list of watchers. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -652,9 +675,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -698,8 +719,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py index ef4c7b057bff..f38126946b60 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/aio/operations/_webhook_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,10 +38,6 @@ ) from .._vendor import AutomationClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +65,9 @@ def __init__(self, *args, **kwargs) -> None: async def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: """Generates a Uri for use in creating a webhook. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -89,7 +88,7 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_generate_uri_request( @@ -104,8 +103,9 @@ async def generate_uri(self, resource_group_name: str, automation_account_name: 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,6 +132,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the webhook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -154,7 +157,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -170,8 +173,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,6 +198,9 @@ async def get( ) -> _models.Webhook: """Retrieve the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -216,7 +223,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) request = build_get_request( @@ -232,8 +239,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,6 +275,9 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,6 +308,9 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -325,14 +339,17 @@ async def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for webhook. Is either a + WebhookCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -353,14 +370,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") @@ -381,8 +398,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,6 +438,9 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -450,6 +471,9 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -478,14 +502,17 @@ async def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -506,14 +533,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookUpdateParameters") @@ -534,8 +561,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -562,6 +590,9 @@ def list_by_automation_account( ) -> AsyncIterable["_models.Webhook"]: """Retrieve a list of webhooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -576,7 +607,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) error_map = { @@ -620,8 +651,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py index f1305838c80d..ff37c40a8fdd 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_automation_client_enums.py @@ -141,6 +141,7 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_UNAVAILABLE = "ServiceUnavailable" GATEWAY_TIMEOUT = "GatewayTimeout" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" + CONTINUE_ENUM = "Continue" class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -192,7 +193,7 @@ class LinuxUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ModuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the provisioning state of the module.""" + """Gets the provisioning state of the module.""" CREATED = "Created" CREATING = "Creating" @@ -208,7 +209,7 @@ class ModuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete" SUCCEEDED = "Succeeded" FAILED = "Failed" - CANCELLED = "Cancelled" + CANCELED = "Canceled" UPDATING = "Updating" @@ -255,6 +256,7 @@ class RunbookTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): GRAPH_POWER_SHELL = "GraphPowerShell" PYTHON2 = "Python2" PYTHON3 = "Python3" + POWER_SHELL72 = "PowerShell72" class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -279,8 +281,8 @@ class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): HOUR = "Hour" WEEK = "Week" MONTH = "Month" - #: The minimum allowed interval for Minute schedules is 15 minutes. MINUTE = "Minute" + """The minimum allowed interval for Minute schedules is 15 minutes.""" class SkuNameEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py index eab718b16728..2de34df88bf0 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/models/_models_py3.py @@ -76,8 +76,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -119,7 +119,9 @@ class ActivityListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Activity"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of activities. :paramtype value: list[~azure.mgmt.automation.models.Activity] @@ -145,7 +147,7 @@ class ActivityOutputType(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the activity output type. :paramtype name: str @@ -218,8 +220,8 @@ def __init__( value_from_remaining_arguments: Optional[bool] = None, description: Optional[str] = None, validation_set: Optional[List["_models.ActivityParameterValidationSet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the activity parameter. :paramtype name: str @@ -281,8 +283,12 @@ class ActivityParameterSet(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, parameters: Optional[List["_models.ActivityParameter"]] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + parameters: Optional[List["_models.ActivityParameter"]] = None, + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the activity parameter set. :paramtype name: str @@ -305,7 +311,7 @@ class ActivityParameterValidationSet(_serialization.Model): "member_value": {"key": "memberValue", "type": "str"}, } - def __init__(self, *, member_value: Optional[str] = None, **kwargs): + def __init__(self, *, member_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword member_value: Gets or sets the name of the activity parameter validation set member. :paramtype member_value: str @@ -338,8 +344,8 @@ def __init__( week_days: Optional[List[str]] = None, month_days: Optional[List[int]] = None, monthly_occurrences: Optional[List["_models.AdvancedScheduleMonthlyOccurrence"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword week_days: Days of the week that the job should execute on. :paramtype week_days: list[str] @@ -373,8 +379,12 @@ class AdvancedScheduleMonthlyOccurrence(_serialization.Model): } def __init__( - self, *, occurrence: Optional[int] = None, day: Optional[Union[str, "_models.ScheduleDay"]] = None, **kwargs - ): + self, + *, + occurrence: Optional[int] = None, + day: Optional[Union[str, "_models.ScheduleDay"]] = None, + **kwargs: Any + ) -> None: """ :keyword occurrence: Occurrence of the week within the month. Must be between 1 and 5. :paramtype occurrence: int @@ -415,8 +425,8 @@ def __init__( endpoint: Optional[str] = None, keys: Optional["_models.AgentRegistrationKeys"] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword dsc_meta_configuration: Gets or sets the dsc meta configuration. :paramtype dsc_meta_configuration: str @@ -448,7 +458,7 @@ class AgentRegistrationKeys(_serialization.Model): "secondary": {"key": "secondary", "type": "str"}, } - def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs): + def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] = None, **kwargs: Any) -> None: """ :keyword primary: Gets or sets the primary key. :paramtype primary: str @@ -478,7 +488,7 @@ class AgentRegistrationRegenerateKeyParameter(_serialization.Model): "key_name": {"key": "keyName", "type": "str"}, } - def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], **kwargs): + def __init__(self, *, key_name: Union[str, "_models.AgentRegistrationKeyName"], **kwargs: Any) -> None: """ :keyword key_name: Gets or sets the agent registration key name - primary or secondary. Required. Known values are: "primary" and "secondary". @@ -513,7 +523,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -552,7 +562,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -663,8 +673,8 @@ def __init__( public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, automation_hybrid_service_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -757,8 +767,8 @@ def __init__( encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -805,8 +815,12 @@ class AutomationAccountListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AutomationAccount"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.AutomationAccount"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets list of accounts. :paramtype value: list[~azure.mgmt.automation.models.AutomationAccount] @@ -862,8 +876,8 @@ def __init__( encryption: Optional["_models.EncryptionProperties"] = None, public_network_access: Optional[bool] = None, disable_local_auth: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -918,8 +932,8 @@ def __init__( scope: Optional[List[str]] = None, locations: Optional[List[str]] = None, tag_settings: Optional["_models.TagSettingsProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: List of Subscription or Resource Group ARM Ids. :paramtype scope: list[str] @@ -959,7 +973,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -1012,7 +1026,7 @@ class Certificate(ProxyResource): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: Gets or sets the description. :paramtype description: str @@ -1064,8 +1078,8 @@ def __init__( description: Optional[str] = None, thumbprint: Optional[str] = None, is_exportable: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the certificate. Required. :paramtype name: str @@ -1101,8 +1115,8 @@ class CertificateListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of certificates. :paramtype value: list[~azure.mgmt.automation.models.Certificate] @@ -1128,7 +1142,7 @@ class CertificateUpdateParameters(_serialization.Model): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the certificate. :paramtype name: str @@ -1188,8 +1202,8 @@ def __init__( *, connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword connection_type: Gets or sets the connectionType of the connection. :paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty @@ -1238,8 +1252,8 @@ def __init__( connection_type: "_models.ConnectionTypeAssociationProperty", description: Optional[str] = None, field_definition_values: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection. Required. :paramtype name: str @@ -1273,8 +1287,8 @@ class ConnectionListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of connection. :paramtype value: list[~azure.mgmt.automation.models.Connection] @@ -1334,8 +1348,8 @@ def __init__( is_global: Optional[bool] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global. :paramtype is_global: bool @@ -1366,7 +1380,7 @@ class ConnectionTypeAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the connection type. :paramtype name: str @@ -1405,8 +1419,8 @@ def __init__( name: str, field_definitions: Dict[str, "_models.FieldDefinition"], is_global: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection type. Required. :paramtype name: str @@ -1437,8 +1451,8 @@ class ConnectionTypeListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.ConnectionType"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of connection types. :paramtype value: list[~azure.mgmt.automation.models.ConnectionType] @@ -1473,8 +1487,8 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, field_definition_values: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the connection. :paramtype name: str @@ -1510,7 +1524,7 @@ class ContentHash(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, algorithm: str, value: str, **kwargs): + def __init__(self, *, algorithm: str, value: str, **kwargs: Any) -> None: """ :keyword algorithm: Gets or sets the content hash algorithm used to hash the content. Required. :paramtype algorithm: str @@ -1525,11 +1539,11 @@ def __init__(self, *, algorithm: str, value: str, **kwargs): class ContentLink(_serialization.Model): """Definition of the content link. - :ivar uri: Gets or sets the uri of the runbook content. + :ivar uri: Sets the uri of the content. :vartype uri: str - :ivar content_hash: Gets or sets the hash. + :ivar content_hash: Sets the hash. :vartype content_hash: ~azure.mgmt.automation.models.ContentHash - :ivar version: Gets or sets the version of the content. + :ivar version: Sets the version of the content. :vartype version: str """ @@ -1545,14 +1559,14 @@ def __init__( uri: Optional[str] = None, content_hash: Optional["_models.ContentHash"] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword uri: Gets or sets the uri of the runbook content. + :keyword uri: Sets the uri of the content. :paramtype uri: str - :keyword content_hash: Gets or sets the hash. + :keyword content_hash: Sets the hash. :paramtype content_hash: ~azure.mgmt.automation.models.ContentHash - :keyword version: Gets or sets the version of the content. + :keyword version: Sets the version of the content. :paramtype version: str """ super().__init__(**kwargs) @@ -1589,8 +1603,8 @@ def __init__( type: Optional[Union[str, "_models.ContentSourceType"]] = None, value: Optional[str] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword hash: Gets or sets the hash. :paramtype hash: ~azure.mgmt.automation.models.ContentHash @@ -1650,7 +1664,7 @@ class Credential(ProxyResource): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: Gets or sets the description. :paramtype description: str @@ -1690,7 +1704,9 @@ class CredentialCreateOrUpdateParameters(_serialization.Model): "description": {"key": "properties.description", "type": "str"}, } - def __init__(self, *, name: str, user_name: str, password: str, description: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, user_name: str, password: str, description: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the credential. Required. :paramtype name: str @@ -1723,8 +1739,8 @@ class CredentialListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Credential"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of credentials. :paramtype value: list[~azure.mgmt.automation.models.Credential] @@ -1763,8 +1779,8 @@ def __init__( user_name: Optional[str] = None, password: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the credential. :paramtype name: str @@ -1830,8 +1846,8 @@ def __init__( automation_account_resource_id: Optional[str] = None, automation_account_id: Optional[str] = None, location_properties_location: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The resource id. :paramtype id: str @@ -1870,7 +1886,7 @@ class DeletedAutomationAccountListResult(_serialization.Model): "value": {"key": "value", "type": "[DeletedAutomationAccount]"}, } - def __init__(self, *, value: Optional[List["_models.DeletedAutomationAccount"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DeletedAutomationAccount"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets the list of deleted automation accounts. :paramtype value: list[~azure.mgmt.automation.models.DeletedAutomationAccount] @@ -1893,7 +1909,7 @@ class Dimension(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the dimension. :paramtype name: str @@ -1993,8 +2009,8 @@ def __init__( status: Optional[Union[str, "_models.JobStatus"]] = None, status_details: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration: Gets or sets the configuration. :paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty @@ -2072,8 +2088,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, parameters: Optional[Dict[str, str]] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2113,8 +2129,12 @@ class DscCompilationJobListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DscCompilationJob"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DscCompilationJob"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of Dsc Compilation jobs. :paramtype value: list[~azure.mgmt.automation.models.DscCompilationJob] @@ -2208,8 +2228,8 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, node_configuration_count: Optional[int] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2265,7 +2285,7 @@ class DscConfigurationAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the Dsc configuration. :paramtype name: str @@ -2323,8 +2343,8 @@ def __init__( log_progress: Optional[bool] = None, parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2377,8 +2397,8 @@ def __init__( value: Optional[List["_models.DscConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of configurations. :paramtype value: list[~azure.mgmt.automation.models.DscConfiguration] @@ -2421,8 +2441,8 @@ def __init__( is_mandatory: Optional[bool] = None, position: Optional[int] = None, default_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the type of the parameter. :paramtype type: str @@ -2480,8 +2500,8 @@ def __init__( source: Optional["_models.ContentSource"] = None, parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets name of the resource. :paramtype name: str @@ -2551,8 +2571,8 @@ def __init__( certificate_id: Optional[str] = None, refresh_frequency_mins: Optional[int] = None, allow_module_overwrite: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. @@ -2658,8 +2678,8 @@ def __init__( total_count: Optional[int] = None, extension_handler: Optional[List["_models.DscNodeExtensionHandlerAssociationProperty"]] = None, name_properties_node_configuration_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword last_seen: Gets or sets the last seen time of the node. :paramtype last_seen: ~datetime.datetime @@ -2750,8 +2770,8 @@ def __init__( source: Optional[str] = None, node_count: Optional[int] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword last_modified_time: Gets or sets the last modified time. :paramtype last_modified_time: ~datetime.datetime @@ -2808,8 +2828,8 @@ def __init__( source: Optional["_models.ContentSource"] = None, configuration: Optional["_models.DscConfigurationAssociationProperty"] = None, increment_node_configuration_build: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the node configuration. :paramtype name: str @@ -2854,8 +2874,8 @@ def __init__( value: Optional[List["_models.DscNodeConfiguration"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of Dsc node configurations. :paramtype value: list[~azure.mgmt.automation.models.DscNodeConfiguration] @@ -2884,7 +2904,7 @@ class DscNodeExtensionHandlerAssociationProperty(_serialization.Model): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the extension handler. :paramtype name: str @@ -2919,8 +2939,8 @@ def __init__( value: Optional[List["_models.DscNode"]] = None, next_link: Optional[str] = None, total_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of dsc nodes. :paramtype value: list[~azure.mgmt.automation.models.DscNode] @@ -3023,8 +3043,8 @@ def __init__( i_pv6_addresses: Optional[List[str]] = None, number_of_resources: Optional[int] = None, raw_errors: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword end_time: Gets or sets the end time of the node report. :paramtype end_time: ~datetime.datetime @@ -3103,8 +3123,8 @@ class DscNodeReportListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DscNodeReport"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of dsc node reports. :paramtype value: list[~azure.mgmt.automation.models.DscNodeReport] @@ -3135,8 +3155,8 @@ def __init__( *, node_id: Optional[str] = None, properties: Optional["_models.DscNodeUpdateParametersProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword node_id: Gets or sets the id of the dsc node. :paramtype node_id: str @@ -3159,7 +3179,7 @@ class DscNodeUpdateParametersProperties(_serialization.Model): "name": {"key": "nodeConfiguration.name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the dsc node configuration. :paramtype name: str @@ -3203,8 +3223,8 @@ def __init__( error_message: Optional[str] = None, locale: Optional[str] = None, error_details: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword error_source: Gets or sets the source of the error. :paramtype error_source: str @@ -3280,8 +3300,8 @@ def __init__( status: Optional[str] = None, duration_in_seconds: Optional[float] = None, start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: Gets or sets the ID of the resource. :paramtype resource_id: str @@ -3329,7 +3349,7 @@ class DscReportResourceNavigation(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_id: Gets or sets the ID of the resource to navigate to. :paramtype resource_id: str @@ -3362,8 +3382,8 @@ def __init__( key_vault_properties: Optional["_models.KeyVaultProperties"] = None, key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None, identity: Optional["_models.EncryptionPropertiesIdentity"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_vault_properties: Key vault properties. :paramtype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties @@ -3392,7 +3412,7 @@ class EncryptionPropertiesIdentity(_serialization.Model): "user_assigned_identity": {"key": "userAssignedIdentity", "type": "object"}, } - def __init__(self, *, user_assigned_identity: Optional[JSON] = None, **kwargs): + def __init__(self, *, user_assigned_identity: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword user_assigned_identity: The user identity used for CMK. It will be an ARM resource id in the form: @@ -3417,7 +3437,7 @@ class ErrorResponse(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword code: Error code. :paramtype code: str @@ -3452,7 +3472,9 @@ class FieldDefinition(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: str, is_encrypted: Optional[bool] = None, is_optional: Optional[bool] = None, **kwargs): + def __init__( + self, *, type: str, is_encrypted: Optional[bool] = None, is_optional: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword is_encrypted: Gets or sets the isEncrypted flag of the connection field definition. :paramtype is_encrypted: bool @@ -3486,8 +3508,8 @@ def __init__( *, raw_content: Optional["_models.RawGraphicalRunbookContent"] = None, graph_runbook_json: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword raw_content: Raw graphical Runbook content. :paramtype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent @@ -3555,8 +3577,8 @@ def __init__( vm_resource_id: Optional[str] = None, worker_type: Optional[Union[str, "_models.WorkerType"]] = None, worker_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword ip: Gets or sets the assigned machine IP address. :paramtype ip: str @@ -3595,7 +3617,7 @@ class HybridRunbookWorkerCreateParameters(_serialization.Model): "vm_resource_id": {"key": "properties.vmResourceId", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, vm_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, vm_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -3647,8 +3669,8 @@ def __init__( *, group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_type: Type of the HybridWorkerGroup. Known values are: "User" and "System". :paramtype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum @@ -3680,8 +3702,8 @@ def __init__( *, name: Optional[str] = None, credential: Optional["_models.RunAsCredentialAssociationProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -3712,8 +3734,8 @@ def __init__( *, value: Optional[List["_models.HybridRunbookWorkerGroup"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of hybrid runbook worker groups. :paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup] @@ -3736,7 +3758,7 @@ class HybridRunbookWorkerMoveParameters(_serialization.Model): "hybrid_runbook_worker_group_name": {"key": "hybridRunbookWorkerGroupName", "type": "str"}, } - def __init__(self, *, hybrid_runbook_worker_group_name: Optional[str] = None, **kwargs): + def __init__(self, *, hybrid_runbook_worker_group_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group. :paramtype hybrid_runbook_worker_group_name: str @@ -3760,8 +3782,12 @@ class HybridRunbookWorkersListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.HybridRunbookWorker"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.HybridRunbookWorker"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of hybrid runbook workers. :paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorker] @@ -3809,8 +3835,8 @@ def __init__( *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentitiesProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". @@ -3916,8 +3942,8 @@ def __init__( last_status_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, str]] = None, provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword runbook: Gets or sets the runbook. :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty @@ -4031,7 +4057,7 @@ class JobCollectionItem(ProxyResource): # pylint: disable=too-many-instance-att "run_on": {"key": "properties.runOn", "type": "str"}, } - def __init__(self, *, run_on: Optional[str] = None, **kwargs): + def __init__(self, *, run_on: Optional[str] = None, **kwargs: Any) -> None: """ :keyword run_on: Specifies the runOn group name where the job was executed. :paramtype run_on: str @@ -4072,8 +4098,8 @@ def __init__( runbook: Optional["_models.RunbookAssociationProperty"] = None, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword runbook: Gets or sets the runbook. :paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty @@ -4109,7 +4135,7 @@ class JobListResultV2(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobCollectionItem"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.JobCollectionItem"]] = None, **kwargs: Any) -> None: """ :keyword value: List of jobs. :paramtype value: list[~azure.mgmt.automation.models.JobCollectionItem] @@ -4136,7 +4162,7 @@ class JobNavigation(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -4190,8 +4216,8 @@ def __init__( runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword job_schedule_id: Gets or sets the id of job schedule. :paramtype job_schedule_id: str @@ -4249,8 +4275,8 @@ def __init__( runbook: "_models.RunbookAssociationProperty", run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword schedule: Gets or sets the schedule. Required. :paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty @@ -4283,8 +4309,8 @@ class JobScheduleListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.JobSchedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of job schedules. :paramtype value: list[~azure.mgmt.automation.models.JobSchedule] @@ -4336,8 +4362,8 @@ def __init__( stream_text: Optional[str] = None, summary: Optional[str] = None, value: Optional[Dict[str, JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -4379,7 +4405,9 @@ class JobStreamListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.JobStream"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: A list of job streams. :paramtype value: list[~azure.mgmt.automation.models.JobStream] @@ -4416,7 +4444,7 @@ class Key(_serialization.Model): "value": {"key": "Value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.key_name = None @@ -4435,7 +4463,7 @@ class KeyListResult(_serialization.Model): "keys": {"key": "keys", "type": "[Key]"}, } - def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs): + def __init__(self, *, keys: Optional[List["_models.Key"]] = None, **kwargs: Any) -> None: """ :keyword keys: Lists the automation keys. :paramtype keys: list[~azure.mgmt.automation.models.Key] @@ -4467,8 +4495,8 @@ def __init__( keyvault_uri: Optional[str] = None, key_name: Optional[str] = None, key_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword keyvault_uri: The URI of the key vault key used to encrypt data. :paramtype keyvault_uri: str @@ -4500,7 +4528,7 @@ class LinkedWorkspace(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -4535,8 +4563,8 @@ def __init__( excluded_package_name_masks: Optional[List[str]] = None, included_package_name_masks: Optional[List[str]] = None, reboot_setting: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword included_package_classifications: Update classifications included in the software update configuration. Known values are: "Unclassified", "Critical", "Security", and "Other". @@ -4579,8 +4607,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the specification. :paramtype name: str @@ -4630,8 +4658,8 @@ def __init__( unit: Optional[str] = None, aggregation_type: Optional[str] = None, dimensions: Optional[List["_models.Dimension"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the metric. :paramtype name: str @@ -4670,33 +4698,33 @@ class Module(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The Azure Region where the resource lives. :vartype location: str - :ivar etag: Gets or sets the etag of the resource. + :ivar etag: Gets the etag of the resource. :vartype etag: str - :ivar is_global: Gets or sets the isGlobal flag of the module. + :ivar is_global: Gets the isGlobal flag of the module. :vartype is_global: bool - :ivar version: Gets or sets the version of the module. + :ivar version: Gets the version of the module. :vartype version: str - :ivar size_in_bytes: Gets or sets the size in bytes of the module. + :ivar size_in_bytes: Gets the size in bytes of the module. :vartype size_in_bytes: int - :ivar activity_count: Gets or sets the activity count of the module. + :ivar activity_count: Gets the activity count of the module. :vartype activity_count: int - :ivar provisioning_state: Gets or sets the provisioning state of the module. Known values are: + :ivar provisioning_state: Gets the provisioning state of the module. Known values are: "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", - "Succeeded", "Failed", "Cancelled", and "Updating". + "Succeeded", "Failed", "Canceled", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState :ivar content_link: Gets or sets the contentLink of the module. :vartype content_link: ~azure.mgmt.automation.models.ContentLink - :ivar error: Gets or sets the error info of the module. + :ivar error: Gets the error info of the module. :vartype error: ~azure.mgmt.automation.models.ModuleErrorInfo - :ivar creation_time: Gets or sets the creation time. + :ivar creation_time: Gets the creation time. :vartype creation_time: ~datetime.datetime - :ivar last_modified_time: Gets or sets the last modified time. + :ivar last_modified_time: Gets the last modified time. :vartype last_modified_time: ~datetime.datetime :ivar description: Gets or sets the description. :vartype description: str - :ivar is_composite: Gets or sets type of module, if its composite or not. + :ivar is_composite: Gets type of module, if its composite or not. :vartype is_composite: bool """ @@ -4743,40 +4771,40 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, is_composite: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The Azure Region where the resource lives. :paramtype location: str - :keyword etag: Gets or sets the etag of the resource. + :keyword etag: Gets the etag of the resource. :paramtype etag: str - :keyword is_global: Gets or sets the isGlobal flag of the module. + :keyword is_global: Gets the isGlobal flag of the module. :paramtype is_global: bool - :keyword version: Gets or sets the version of the module. + :keyword version: Gets the version of the module. :paramtype version: str - :keyword size_in_bytes: Gets or sets the size in bytes of the module. + :keyword size_in_bytes: Gets the size in bytes of the module. :paramtype size_in_bytes: int - :keyword activity_count: Gets or sets the activity count of the module. + :keyword activity_count: Gets the activity count of the module. :paramtype activity_count: int - :keyword provisioning_state: Gets or sets the provisioning state of the module. Known values - are: "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", + :keyword provisioning_state: Gets the provisioning state of the module. Known values are: + "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook", "ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported", "ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete", - "Succeeded", "Failed", "Cancelled", and "Updating". + "Succeeded", "Failed", "Canceled", and "Updating". :paramtype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState :keyword content_link: Gets or sets the contentLink of the module. :paramtype content_link: ~azure.mgmt.automation.models.ContentLink - :keyword error: Gets or sets the error info of the module. + :keyword error: Gets the error info of the module. :paramtype error: ~azure.mgmt.automation.models.ModuleErrorInfo - :keyword creation_time: Gets or sets the creation time. + :keyword creation_time: Gets the creation time. :paramtype creation_time: ~datetime.datetime - :keyword last_modified_time: Gets or sets the last modified time. + :keyword last_modified_time: Gets the last modified time. :paramtype last_modified_time: ~datetime.datetime :keyword description: Gets or sets the description. :paramtype description: str - :keyword is_composite: Gets or sets type of module, if its composite or not. + :keyword is_composite: Gets type of module, if its composite or not. :paramtype is_composite: bool """ super().__init__(tags=tags, location=location, **kwargs) @@ -4799,13 +4827,13 @@ class ModuleCreateOrUpdateParameters(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Gets or sets name of the resource. + :ivar name: Sets name of the resource. :vartype name: str - :ivar location: Gets or sets the location of the resource. + :ivar location: Sets the location of the resource. :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. + :ivar tags: Sets the tags attached to the resource. :vartype tags: dict[str, str] - :ivar content_link: Gets or sets the module content link. Required. + :ivar content_link: Sets the hash. Required. :vartype content_link: ~azure.mgmt.automation.models.ContentLink """ @@ -4827,16 +4855,16 @@ def __init__( name: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Gets or sets name of the resource. + :keyword name: Sets name of the resource. :paramtype name: str - :keyword location: Gets or sets the location of the resource. + :keyword location: Sets the location of the resource. :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. + :keyword tags: Sets the tags attached to the resource. :paramtype tags: dict[str, str] - :keyword content_link: Gets or sets the module content link. Required. + :keyword content_link: Sets the hash. Required. :paramtype content_link: ~azure.mgmt.automation.models.ContentLink """ super().__init__(**kwargs) @@ -4849,9 +4877,9 @@ def __init__( class ModuleErrorInfo(_serialization.Model): """Definition of the module error info type. - :ivar code: Gets or sets the error code. + :ivar code: Gets the error code. :vartype code: str - :ivar message: Gets or sets the error message. + :ivar message: Gets the error message. :vartype message: str """ @@ -4860,11 +4888,11 @@ class ModuleErrorInfo(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword code: Gets or sets the error code. + :keyword code: Gets the error code. :paramtype code: str - :keyword message: Gets or sets the error message. + :keyword message: Gets the error message. :paramtype message: str """ super().__init__(**kwargs) @@ -4875,9 +4903,9 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, class ModuleListResult(_serialization.Model): """The response model for the list module operation. - :ivar value: Gets or sets a list of modules. + :ivar value: Gets a list of modules. :vartype value: list[~azure.mgmt.automation.models.Module] - :ivar next_link: Gets or sets the next link. + :ivar next_link: Gets the next link. :vartype next_link: str """ @@ -4886,11 +4914,13 @@ class ModuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Module"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Gets or sets a list of modules. + :keyword value: Gets a list of modules. :paramtype value: list[~azure.mgmt.automation.models.Module] - :keyword next_link: Gets or sets the next link. + :keyword next_link: Gets the next link. :paramtype next_link: str """ super().__init__(**kwargs) @@ -4901,16 +4931,23 @@ def __init__(self, *, value: Optional[List["_models.Module"]] = None, next_link: class ModuleUpdateParameters(_serialization.Model): """The parameters supplied to the update module operation. - :ivar name: Gets or sets name of the resource. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Sets name of the resource. :vartype name: str - :ivar location: Gets or sets the location of the resource. + :ivar location: Sets the location of the resource. :vartype location: str - :ivar tags: Gets or sets the tags attached to the resource. + :ivar tags: Sets the tags attached to the resource. :vartype tags: dict[str, str] - :ivar content_link: Gets or sets the module content link. + :ivar content_link: Sets the module content link. :vartype content_link: ~azure.mgmt.automation.models.ContentLink """ + _validation = { + "name": {"readonly": True}, + "location": {"readonly": True}, + } + _attribute_map = { "name": {"key": "name", "type": "str"}, "location": {"key": "location", "type": "str"}, @@ -4921,25 +4958,19 @@ class ModuleUpdateParameters(_serialization.Model): def __init__( self, *, - name: Optional[str] = None, - location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, content_link: Optional["_models.ContentLink"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword name: Gets or sets name of the resource. - :paramtype name: str - :keyword location: Gets or sets the location of the resource. - :paramtype location: str - :keyword tags: Gets or sets the tags attached to the resource. + :keyword tags: Sets the tags attached to the resource. :paramtype tags: dict[str, str] - :keyword content_link: Gets or sets the module content link. + :keyword content_link: Sets the module content link. :paramtype content_link: ~azure.mgmt.automation.models.ContentLink """ super().__init__(**kwargs) - self.name = name - self.location = location + self.name = None + self.location = None self.tags = tags self.content_link = content_link @@ -4959,8 +4990,8 @@ class NodeCount(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.NodeCountProperties"] = None, **kwargs - ): + self, *, name: Optional[str] = None, properties: Optional["_models.NodeCountProperties"] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets the name of a count type. :paramtype name: str @@ -4983,7 +5014,7 @@ class NodeCountProperties(_serialization.Model): "count": {"key": "count", "type": "int"}, } - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword count: Gets the count for the name. :paramtype count: int @@ -5007,8 +5038,8 @@ class NodeCounts(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs - ): + self, *, value: Optional[List["_models.NodeCount"]] = None, total_count: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets an array of counts. :paramtype value: list[~azure.mgmt.automation.models.NodeCount] @@ -5034,7 +5065,9 @@ class NonAzureQueryProperties(_serialization.Model): "workspace_id": {"key": "workspaceId", "type": "str"}, } - def __init__(self, *, function_alias: Optional[str] = None, workspace_id: Optional[str] = None, **kwargs): + def __init__( + self, *, function_alias: Optional[str] = None, workspace_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword function_alias: Log Analytics Saved Search name. :paramtype function_alias: str @@ -5077,8 +5110,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, service_specification: Optional["_models.OperationPropertiesFormatServiceSpecification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -5124,8 +5157,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.Automation. :paramtype provider: str @@ -5154,7 +5187,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Automation operations supported by the Automation resource provider. :paramtype value: list[~azure.mgmt.automation.models.Operation] @@ -5182,8 +5215,8 @@ def __init__( *, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, log_specifications: Optional[List["_models.LogSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_specifications: Operation service specification. :paramtype metric_specifications: list[~azure.mgmt.automation.models.MetricSpecification] @@ -5240,8 +5273,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, group_ids: Optional[List[str]] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: Private endpoint which the connection belongs to. :paramtype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty @@ -5269,7 +5302,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection] @@ -5289,7 +5322,7 @@ class PrivateEndpointProperty(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource id of the private endpoint. :paramtype id: str @@ -5331,7 +5364,7 @@ class PrivateLinkResource(ProxyResource): "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None @@ -5349,7 +5382,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.automation.models.PrivateLinkResource] @@ -5382,7 +5415,7 @@ class PrivateLinkServiceConnectionStateProperty(_serialization.Model): "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__(self, *, status: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword status: The private link service connection status. :paramtype status: str @@ -5415,7 +5448,9 @@ class PythonPackageCreateParameters(_serialization.Model): "content_link": {"key": "properties.contentLink", "type": "ContentLink"}, } - def __init__(self, *, content_link: "_models.ContentLink", tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, *, content_link: "_models.ContentLink", tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: """ :keyword tags: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] @@ -5438,7 +5473,7 @@ class PythonPackageUpdateParameters(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Gets or sets the tags attached to the resource. :paramtype tags: dict[str, str] @@ -5471,8 +5506,8 @@ def __init__( schema_version: Optional[str] = None, runbook_definition: Optional[str] = None, runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword schema_version: Schema version of the serializer. :paramtype schema_version: str @@ -5499,7 +5534,7 @@ class RunAsCredentialAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the credential. :paramtype name: str @@ -5527,7 +5562,7 @@ class Runbook(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype etag: str :ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2", - and "Python3". + "Python3", and "PowerShell72". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar publish_content_link: Gets or sets the published runbook content link. :vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink @@ -5612,8 +5647,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -5623,7 +5658,7 @@ def __init__( :paramtype etag: str :keyword runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "PowerShell72". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword publish_content_link: Gets or sets the published runbook content link. :paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink @@ -5686,7 +5721,7 @@ class RunbookAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the runbook. :paramtype name: str @@ -5712,7 +5747,7 @@ class RunbookCreateOrUpdateDraftParameters(_serialization.Model): "runbook_content": {"key": "runbookContent", "type": "str"}, } - def __init__(self, *, runbook_content: str, **kwargs): + def __init__(self, *, runbook_content: str, **kwargs: Any) -> None: """ :keyword runbook_content: Content of the Runbook. Required. :paramtype runbook_content: str @@ -5732,7 +5767,7 @@ class RunbookCreateOrUpdateDraftProperties(_serialization.Model): :vartype log_progress: bool :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "PowerShell72". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar draft: Gets or sets the draft runbook properties. Required. :vartype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5765,8 +5800,8 @@ def __init__( log_progress: Optional[bool] = None, description: Optional[str] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_verbose: Gets or sets verbose log option. :paramtype log_verbose: bool @@ -5774,7 +5809,7 @@ def __init__( :paramtype log_progress: bool :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". + "GraphPowerShell", "Python2", "Python3", and "PowerShell72". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword draft: Gets or sets the draft runbook properties. Required. :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5809,7 +5844,7 @@ class RunbookCreateOrUpdateParameters(_serialization.Model): :vartype log_progress: bool :ivar runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", - "Python2", and "Python3". + "Python2", "Python3", and "PowerShell72". :vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :ivar draft: Gets or sets the draft runbook properties. :vartype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5851,8 +5886,8 @@ def __init__( publish_content_link: Optional["_models.ContentLink"] = None, description: Optional[str] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -5866,7 +5901,7 @@ def __init__( :paramtype log_progress: bool :keyword runbook_type: Gets or sets the type of the runbook. Required. Known values are: "Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", - "GraphPowerShell", "Python2", and "Python3". + "GraphPowerShell", "Python2", "Python3", and "PowerShell72". :paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum :keyword draft: Gets or sets the draft runbook properties. :paramtype draft: ~azure.mgmt.automation.models.RunbookDraft @@ -5925,8 +5960,8 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None, output_types: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword in_edit: Gets or sets whether runbook is in edit mode. :paramtype in_edit: bool @@ -5962,7 +5997,7 @@ class RunbookDraftUndoEditResult(_serialization.Model): "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". + "HttpVersionNotSupported", and "Continue". :vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :ivar request_id: :vartype request_id: str @@ -5978,8 +6013,8 @@ def __init__( *, status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, request_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", @@ -5990,7 +6025,7 @@ def __init__( "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - and "HttpVersionNotSupported". + "HttpVersionNotSupported", and "Continue". :paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode :keyword request_id: :paramtype request_id: str @@ -6014,7 +6049,9 @@ class RunbookListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Runbook"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of runbooks. :paramtype value: list[~azure.mgmt.automation.models.Runbook] @@ -6054,8 +6091,8 @@ def __init__( is_mandatory: Optional[bool] = None, position: Optional[int] = None, default_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the type of the parameter. :paramtype type: str @@ -6113,8 +6150,8 @@ def __init__( log_verbose: Optional[bool] = None, log_progress: Optional[bool] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -6226,8 +6263,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time: Gets or sets the start time of the schedule. :paramtype start_time: ~datetime.datetime @@ -6285,7 +6322,7 @@ class ScheduleAssociationProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the Schedule. :paramtype name: str @@ -6346,8 +6383,8 @@ def __init__( interval: Optional[Any] = None, time_zone: Optional[str] = None, advanced_schedule: Optional["_models.AdvancedSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the Schedule. Required. :paramtype name: str @@ -6392,7 +6429,9 @@ class ScheduleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of schedules. :paramtype value: list[~azure.mgmt.automation.models.Schedule] @@ -6427,8 +6466,8 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, is_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the Schedule. :paramtype name: str @@ -6473,8 +6512,8 @@ def __init__( name: Union[str, "_models.SkuNameEnum"], family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the SKU name of the account. Required. Known values are: "Free" and "Basic". @@ -6560,8 +6599,8 @@ def __init__( schedule_info: "_models.SUCScheduleProperties", error: Optional["_models.ErrorResponse"] = None, tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword update_configuration: update specific properties for the Software update configuration. Required. @@ -6648,8 +6687,8 @@ def __init__( frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None, start_time: Optional[datetime.datetime] = None, next_run: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword update_configuration: Update specific properties of the software update configuration. :paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration @@ -6687,7 +6726,9 @@ class SoftwareUpdateConfigurationListResult(_serialization.Model): "value": {"key": "value", "type": "[SoftwareUpdateConfigurationCollectionItem]"}, } - def __init__(self, *, value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None, **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configurations. :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem] @@ -6788,8 +6829,8 @@ def __init__( software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, job: Optional["_models.JobNavigation"] = None, error: Optional["_models.ErrorResponse"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword software_update_configuration: software update configuration triggered this run. :paramtype software_update_configuration: @@ -6839,8 +6880,8 @@ def __init__( *, value: Optional[List["_models.SoftwareUpdateConfigurationMachineRun"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configuration machine runs. @@ -6933,8 +6974,8 @@ def __init__( *, software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None, tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword software_update_configuration: software update configuration triggered this run. :paramtype software_update_configuration: @@ -6979,8 +7020,8 @@ def __init__( *, value: Optional[List["_models.SoftwareUpdateConfigurationRun"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: outer object returned when listing all software update configuration runs. :paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun] @@ -7010,8 +7051,8 @@ class SoftwareUpdateConfigurationRunTaskProperties(_serialization.Model): } def __init__( - self, *, status: Optional[str] = None, source: Optional[str] = None, job_id: Optional[str] = None, **kwargs - ): + self, *, status: Optional[str] = None, source: Optional[str] = None, job_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword status: The status of the task. :paramtype status: str @@ -7045,8 +7086,8 @@ def __init__( *, pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pre_task: Pre task properties. :paramtype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties @@ -7078,8 +7119,8 @@ def __init__( *, pre_task: Optional["_models.TaskProperties"] = None, post_task: Optional["_models.TaskProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pre_task: Pre task properties. :paramtype pre_task: ~azure.mgmt.automation.models.TaskProperties @@ -7157,8 +7198,8 @@ def __init__( description: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword repo_url: The repo url of the source control. :paramtype repo_url: str @@ -7245,8 +7286,8 @@ def __init__( source_type: Optional[Union[str, "_models.SourceType"]] = None, security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword repo_url: The repo url of the source control. :paramtype repo_url: str @@ -7293,8 +7334,8 @@ class SourceControlListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.SourceControl"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of source controls. :paramtype value: list[~azure.mgmt.automation.models.SourceControl] @@ -7335,8 +7376,8 @@ def __init__( access_token: Optional[str] = None, refresh_token: Optional[str] = None, token_type: Optional[Union[str, "_models.TokenType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword access_token: The access token. :paramtype access_token: str @@ -7405,8 +7446,8 @@ def __init__( source_control_sync_job_id: Optional[str] = None, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, sync_type: Optional[Union[str, "_models.SyncType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_id: The source control sync job id. :paramtype source_control_sync_job_id: str @@ -7477,8 +7518,8 @@ def __init__( provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, sync_type: Optional[Union[str, "_models.SyncType"]] = None, exception: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the job. :paramtype id: str @@ -7521,7 +7562,7 @@ class SourceControlSyncJobCreateParameters(_serialization.Model): "commit_id": {"key": "properties.commitId", "type": "str"}, } - def __init__(self, *, commit_id: str, **kwargs): + def __init__(self, *, commit_id: str, **kwargs: Any) -> None: """ :keyword commit_id: The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. Required. @@ -7546,8 +7587,12 @@ class SourceControlSyncJobListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.SourceControlSyncJob"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.SourceControlSyncJob"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of source control sync jobs. :paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJob] @@ -7595,8 +7640,8 @@ def __init__( source_control_sync_job_stream_id: Optional[str] = None, summary: Optional[str] = None, stream_type: Optional[Union[str, "_models.StreamType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_stream_id: The sync job stream id. :paramtype source_control_sync_job_stream_id: str @@ -7657,8 +7702,8 @@ def __init__( stream_type: Optional[Union[str, "_models.StreamType"]] = None, stream_text: Optional[str] = None, value: Optional[Dict[str, JSON]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_control_sync_job_stream_id: The sync job stream id. :paramtype source_control_sync_job_stream_id: str @@ -7701,7 +7746,7 @@ class SourceControlSyncJobStreamsListBySyncJob(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SourceControlSyncJobStream"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SourceControlSyncJobStream"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of source control sync job streams. :paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream] @@ -7746,8 +7791,8 @@ def __init__( publish_runbook: Optional[bool] = None, security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword branch: The repo branch of the source control. :paramtype branch: str @@ -7804,7 +7849,7 @@ class Statistics(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.counter_property = None @@ -7825,7 +7870,7 @@ class StatisticsListResult(_serialization.Model): "value": {"key": "value", "type": "[Statistics]"}, } - def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Statistics"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets a list of statistics. :paramtype value: list[~azure.mgmt.automation.models.Statistics] @@ -7907,8 +7952,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time: Gets or sets the start time of the schedule. :paramtype start_time: ~datetime.datetime @@ -7992,8 +8037,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -8039,8 +8084,8 @@ def __init__( *, tags: Optional[Dict[str, List[str]]] = None, filter_operator: Optional[Union[str, "_models.TagOperators"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Dictionary of tags with its list of values. :paramtype tags: dict[str, list[str]] @@ -8072,8 +8117,8 @@ def __init__( *, azure_queries: Optional[List["_models.AzureQueryProperties"]] = None, non_azure_queries: Optional[List["_models.NonAzureQueryProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_queries: List of Azure queries in the software update configuration. :paramtype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties] @@ -8099,7 +8144,9 @@ class TaskProperties(_serialization.Model): "source": {"key": "source", "type": "str"}, } - def __init__(self, *, parameters: Optional[Dict[str, str]] = None, source: Optional[str] = None, **kwargs): + def __init__( + self, *, parameters: Optional[Dict[str, str]] = None, source: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword parameters: Gets or sets the parameters of the task. :paramtype parameters: dict[str, str] @@ -8167,8 +8214,8 @@ def __init__( last_status_modified_time: Optional[datetime.datetime] = None, parameters: Optional[Dict[str, str]] = None, log_activity_trace: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword creation_time: Gets or sets the creation time of the test job. :paramtype creation_time: ~datetime.datetime @@ -8223,7 +8270,9 @@ class TestJobCreateParameters(_serialization.Model): "run_on": {"key": "runOn", "type": "str"}, } - def __init__(self, *, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, **kwargs): + def __init__( + self, *, parameters: Optional[Dict[str, str]] = None, run_on: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword parameters: Gets or sets the parameters of the test job. :paramtype parameters: dict[str, str] @@ -8250,7 +8299,7 @@ class TypeField(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Gets or sets the name of the field. :paramtype name: str @@ -8273,7 +8322,7 @@ class TypeFieldListResult(_serialization.Model): "value": {"key": "value", "type": "[TypeField]"}, } - def __init__(self, *, value: Optional[List["_models.TypeField"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TypeField"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets a list of fields. :paramtype value: list[~azure.mgmt.automation.models.TypeField] @@ -8331,8 +8380,8 @@ def __init__( azure_virtual_machines: Optional[List[str]] = None, non_azure_computer_names: Optional[List[str]] = None, targets: Optional["_models.TargetProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword operating_system: operating system of target machines. Required. Known values are: "Windows" and "Linux". @@ -8381,7 +8430,7 @@ class UpdateConfigurationNavigation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -8422,8 +8471,8 @@ def __init__( current_value: Optional[float] = None, limit: Optional[int] = None, throttle_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the id of the resource. :paramtype id: str @@ -8461,7 +8510,7 @@ class UsageCounterName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets the usage counter name. :paramtype value: str @@ -8484,7 +8533,7 @@ class UsageListResult(_serialization.Model): "value": {"key": "value", "type": "[Usage]"}, } - def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Usage"]] = None, **kwargs: Any) -> None: """ :keyword value: Gets or sets usage. :paramtype value: list[~azure.mgmt.automation.models.Usage] @@ -8514,7 +8563,7 @@ class UserAssignedIdentitiesProperties(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -8569,8 +8618,8 @@ def __init__( creation_time: Optional[datetime.datetime] = None, last_modified_time: Optional[datetime.datetime] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Gets or sets the value of the variable. :paramtype value: str @@ -8624,8 +8673,8 @@ def __init__( value: Optional[str] = None, description: Optional[str] = None, is_encrypted: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the variable. Required. :paramtype name: str @@ -8657,7 +8706,9 @@ class VariableListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Variable"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of variables. :paramtype value: list[~azure.mgmt.automation.models.Variable] @@ -8687,8 +8738,13 @@ class VariableUpdateParameters(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, value: Optional[str] = None, description: Optional[str] = None, **kwargs - ): + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the variable. :paramtype name: str @@ -8781,8 +8837,8 @@ def __init__( script_parameters: Optional[Dict[str, str]] = None, script_run_on: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Gets or sets the etag of the resource. :paramtype etag: str @@ -8833,7 +8889,9 @@ class WatcherListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Watcher"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of watchers. :paramtype value: list[~azure.mgmt.automation.models.Watcher] @@ -8860,7 +8918,9 @@ class WatcherUpdateParameters(_serialization.Model): "execution_frequency_in_seconds": {"key": "properties.executionFrequencyInSeconds", "type": "int"}, } - def __init__(self, *, name: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, execution_frequency_in_seconds: Optional[int] = None, **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the resource. :paramtype name: str @@ -8946,8 +9006,8 @@ def __init__( last_modified_time: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Gets or sets the value of the enabled flag of the webhook. :paramtype is_enabled: bool @@ -9032,8 +9092,8 @@ def __init__( parameters: Optional[Dict[str, str]] = None, runbook: Optional["_models.RunbookAssociationProperty"] = None, run_on: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the webhook. Required. :paramtype name: str @@ -9074,7 +9134,9 @@ class WebhookListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Gets or sets a list of webhooks. :paramtype value: list[~azure.mgmt.automation.models.Webhook] @@ -9117,8 +9179,8 @@ def __init__( run_on: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the webhook. :paramtype name: str @@ -9170,8 +9232,8 @@ def __init__( excluded_kb_numbers: Optional[List[str]] = None, included_kb_numbers: Optional[List[str]] = None, reboot_setting: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword included_update_classifications: Update classification included in the software update configuration. A comma separated string with required values. Known values are: "Unclassified", diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index ceadd5d1de73..98093c1e0571 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -38,6 +38,7 @@ from ._module_operations import ModuleOperations from ._object_data_types_operations import ObjectDataTypesOperations from ._fields_operations import FieldsOperations +from ._power_shell72_module_operations import PowerShell72ModuleOperations from ._operations import Operations from ._automation_client_operations import AutomationClientOperationsMixin from ._python2_package_operations import Python2PackageOperations @@ -91,6 +92,7 @@ "ModuleOperations", "ObjectDataTypesOperations", "FieldsOperations", + "PowerShell72ModuleOperations", "Operations", "AutomationClientOperationsMixin", "Python2PackageOperations", diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py index 7838406aef1b..5f275e95a450 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_activity_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +64,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -86,7 +81,7 @@ def build_list_by_module_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +98,7 @@ def build_list_by_module_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -144,6 +139,9 @@ def get( ) -> _models.Activity: """Retrieve the activity in the module identified by module name and activity name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -168,7 +166,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Activity] = kwargs.pop("cls", None) request = build_get_request( @@ -185,8 +183,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,6 +212,9 @@ def list_by_module( ) -> Iterable["_models.Activity"]: """Retrieve a list of activities in the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/activityoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -227,7 +229,7 @@ def list_by_module( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ActivityListResult] = kwargs.pop("cls", None) error_map = { @@ -271,8 +273,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py index d87013f69d5a..9f9944c66916 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_agent_registration_information_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +57,7 @@ def build_get_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -80,9 +74,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +91,7 @@ def build_regenerate_key_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -135,6 +127,9 @@ def __init__(self, *args, **kwargs): def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.AgentRegistration: """Retrieve the automation agent registration information. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,9 +150,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) request = build_get_request( @@ -172,8 +165,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,6 +200,9 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -233,6 +230,9 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -258,12 +258,15 @@ def regenerate_key( ) -> _models.AgentRegistration: """Regenerate a primary or secondary agent registration key. + .. seealso:: + - http://aka.ms/azureautomationsdk/agentregistrationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: The name of the agent registration key to be regenerated. Is either a model - type or a IO type. Required. + :param parameters: The name of the agent registration key to be regenerated. Is either a + AgentRegistrationRegenerateKeyParameter type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -284,16 +287,14 @@ def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentRegistration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AgentRegistrationRegenerateKeyParameter") @@ -313,8 +314,9 @@ def regenerate_key( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py index 3820d0877719..d429abf55c9d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_account_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -63,7 +59,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -82,7 +78,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +95,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -118,7 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +130,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +163,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -182,7 +178,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +193,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -212,7 +208,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +219,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 +261,9 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -292,6 +291,9 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -317,12 +319,15 @@ def update( ) -> _models.AutomationAccount: """Update an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Parameters supplied to the update automation account. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the update automation account. Is either a + AutomationAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -343,14 +348,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountUpdateParameters") @@ -370,8 +375,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -404,6 +410,9 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -431,6 +440,9 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -456,12 +468,15 @@ def create_or_update( ) -> _models.AutomationAccount: """Create or update automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param parameters: Parameters supplied to the create or update automation account. Is either a - model type or a IO type. Required. + AutomationAccountCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -482,14 +497,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AutomationAccountCreateOrUpdateParameters") @@ -509,8 +524,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,6 +557,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete an automation account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -561,7 +580,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -576,8 +595,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -598,6 +618,9 @@ def delete( # pylint: disable=inconsistent-return-statements def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.AutomationAccount: """Get information about an Automation Account. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -618,7 +641,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -633,8 +656,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -659,6 +683,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: """Retrieve a list of accounts within a given resource group. + .. seealso:: + - http://aka.ms/azureautomationsdk/automationaccountoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -669,7 +696,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -711,8 +738,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -743,7 +771,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutomationAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.AutomationAccountListResult] = kwargs.pop("cls", None) error_map = { @@ -784,8 +812,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py index cdfd540f5d97..50b14f7e2138 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_automation_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_convert_graph_runbook_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62,7 +58,7 @@ def build_convert_graph_runbook_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -144,8 +140,8 @@ def convert_graph_runbook_content( :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str - :param parameters: Input data describing the graphical runbook. Is either a model type or a IO - type. Required. + :param parameters: Input data describing the graphical runbook. Is either a + GraphicalRunbookContent type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -166,14 +162,14 @@ def convert_graph_runbook_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GraphicalRunbookContent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GraphicalRunbookContent") @@ -193,8 +189,9 @@ def convert_graph_runbook_content( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py index 163a32be6348..d5291936227a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_certificate_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Certificate: """Retrieve the certificate identified by certificate name. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +414,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +447,9 @@ def create_or_update( ) -> _models.Certificate: """Create a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +458,7 @@ def create_or_update( Required. :type certificate_name: str :param parameters: The parameters supplied to the create or update certificate operation. Is - either a model type or a IO type. Required. + either a CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +479,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -494,8 +507,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +547,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +580,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +611,9 @@ def update( ) -> _models.Certificate: """Update a certificate. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +621,7 @@ def update( :param certificate_name: The parameters supplied to the update certificate operation. Required. :type certificate_name: str :param parameters: The parameters supplied to the update certificate operation. Is either a - model type or a IO type. Required. + CertificateUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +642,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateUpdateParameters") @@ -647,8 +670,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +699,9 @@ def list_by_automation_account( ) -> Iterable["_models.Certificate"]: """Retrieve a list of certificates. + .. seealso:: + - http://aka.ms/azureautomationsdk/certificateoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +714,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.CertificateListResult] = kwargs.pop("cls", None) error_map = { @@ -730,8 +757,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py index 408ac1066f5d..96debc92d7de 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Connection: """Retrieve the connection identified by connection name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +414,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +447,9 @@ def create_or_update( ) -> _models.Connection: """Create or update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +458,7 @@ def create_or_update( Required. :type connection_name: str :param parameters: The parameters supplied to the create or update connection operation. Is - either a model type or a IO type. Required. + either a ConnectionCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +479,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionCreateOrUpdateParameters") @@ -494,8 +507,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +547,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +580,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +611,9 @@ def update( ) -> _models.Connection: """Update a connection. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +621,7 @@ def update( :param connection_name: The parameters supplied to the update a connection operation. Required. :type connection_name: str :param parameters: The parameters supplied to the update a connection operation. Is either a - model type or a IO type. Required. + ConnectionUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +642,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Connection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionUpdateParameters") @@ -647,8 +670,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +699,9 @@ def list_by_automation_account( ) -> Iterable["_models.Connection"]: """Retrieve a list of connections. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectionoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +714,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -730,8 +757,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py index e0e5c3a1146e..f44ff385cafc 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_connection_type_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +46,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +63,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -88,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +101,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -126,7 +122,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +140,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -163,7 +159,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +175,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -215,6 +211,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -237,7 +236,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -253,8 +252,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,6 +277,9 @@ def get( ) -> _models.ConnectionType: """Retrieve the connection type identified by connection type name. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -299,7 +302,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) request = build_get_request( @@ -315,8 +318,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,6 +354,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,6 +389,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -412,6 +422,9 @@ def create_or_update( ) -> _models.ConnectionType: """Create a connection type. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -420,7 +433,7 @@ def create_or_update( operation. Required. :type connection_type_name: str :param parameters: The parameters supplied to the create or update connection type operation. - Is either a model type or a IO type. Required. + Is either a ConnectionTypeCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -441,14 +454,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionType] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionTypeCreateOrUpdateParameters") @@ -469,8 +482,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,6 +511,9 @@ def list_by_automation_account( ) -> Iterable["_models.ConnectionType"]: """Retrieve a list of connection types. + .. seealso:: + - http://aka.ms/azureautomationsdk/connectiontypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -509,7 +526,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ConnectionTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -552,8 +569,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py index 375027ade7c8..8e7bea6cd575 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_credential_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Credential: """Retrieve the credential identified by credential name. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -407,6 +414,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,6 +447,9 @@ def create_or_update( ) -> _models.Credential: """Create a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -445,7 +458,7 @@ def create_or_update( Required. :type credential_name: str :param parameters: The parameters supplied to the create or update credential operation. Is - either a model type or a IO type. Required. + either a CredentialCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,14 +479,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialCreateOrUpdateParameters") @@ -494,8 +507,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,6 +547,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -563,6 +580,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -591,6 +611,9 @@ def update( ) -> _models.Credential: """Update a credential. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +621,7 @@ def update( :param credential_name: The parameters supplied to the Update credential operation. Required. :type credential_name: str :param parameters: The parameters supplied to the Update credential operation. Is either a - model type or a IO type. Required. + CredentialUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -619,14 +642,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Credential] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CredentialUpdateParameters") @@ -647,8 +670,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,6 +699,9 @@ def list_by_automation_account( ) -> Iterable["_models.Credential"]: """Retrieve a list of credentials. + .. seealso:: + - http://aka.ms/azureautomationsdk/credentialoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,7 +714,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.CredentialListResult] = kwargs.pop("cls", None) error_map = { @@ -730,8 +757,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py index d6ac5231db4d..7638a99a240a 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_deleted_automation_accounts_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,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: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -104,7 +99,7 @@ def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccoun _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-01-31"] = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-31")) cls: ClsType[_models.DeletedAutomationAccountListResult] = kwargs.pop("cls", None) request = build_list_by_subscription_request( @@ -117,8 +112,9 @@ def list_by_subscription(self, **kwargs: Any) -> _models.DeletedAutomationAccoun 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py index b8d498a822ea..ea8bc54b2c9c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,12 +29,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72,7 +66,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -95,9 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +106,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -136,9 +128,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +144,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -178,9 +168,7 @@ def build_get_stream_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +186,7 @@ def build_get_stream_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -247,16 +235,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscCompilationJobCreateParameters") @@ -277,8 +263,9 @@ def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,6 +299,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -350,6 +340,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -386,6 +379,9 @@ def begin_create( ) -> LROPoller[_models.DscCompilationJob]: """Creates the Dsc compilation job of the configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscconfigurationcompilejoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -393,7 +389,7 @@ def begin_create( :param compilation_job_name: The DSC configuration Id. Required. :type compilation_job_name: str :param parameters: The parameters supplied to the create compilation job operation. Is either a - model type or a IO type. Required. + DscCompilationJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -414,9 +410,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -468,6 +462,9 @@ def get( ) -> _models.DscCompilationJob: """Retrieve the Dsc configuration compilation job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dsccompilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -490,9 +487,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscCompilationJob] = kwargs.pop("cls", None) request = build_get_request( @@ -508,8 +503,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -536,6 +532,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscCompilationJob"]: """Retrieve a list of dsc compilation jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/compilationjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -550,9 +549,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscCompilationJobListResult] = kwargs.pop("cls", None) error_map = { @@ -596,8 +593,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,6 +618,9 @@ def get_stream( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -644,9 +645,7 @@ def get_stream( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_stream_request( @@ -663,8 +662,9 @@ def get_stream( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py index 7e4fd8be18a1..49db8b718248 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_compilation_job_stream_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_by_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +57,7 @@ def build_list_by_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -100,6 +93,9 @@ def list_by_job( ) -> _models.JobStreamListResult: """Retrieve all the job streams for the compilation Job. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -122,9 +118,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) request = build_list_by_job_request( @@ -140,8 +134,9 @@ def list_by_job( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py index c32539930fd6..f49aa802bb55 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_configuration_operations.py @@ -6,7 +6,6 @@ # 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, Iterator, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +92,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +109,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +127,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +146,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +164,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +183,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -205,7 +200,7 @@ def build_get_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -230,7 +225,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +241,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -290,6 +285,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,7 +310,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -328,8 +326,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,6 +351,9 @@ def get( ) -> _models.DscConfiguration: """Retrieve the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -374,7 +376,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -390,8 +392,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,6 +428,9 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -455,6 +461,9 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -483,14 +492,17 @@ def create_or_update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationCreateOrUpdateParameters type or a str type. Required. :type parameters: ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -511,7 +523,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -539,8 +551,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,6 +591,9 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -608,6 +624,9 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -636,14 +655,17 @@ def update( ) -> _models.DscConfiguration: """Create the configuration identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param configuration_name: The create or update parameters for configuration. Required. :type configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a string type. Default value is None. + :param parameters: The create or update parameters for configuration. Is either a + DscConfigurationUpdateParameters type or a str type. Default value is None. :type parameters: ~azure.mgmt.automation.models.DscConfigurationUpdateParameters or str :keyword content_type: Body Parameter content-type. Known values are: 'application/json', 'text/plain; charset=utf-8'. Default value is None. @@ -664,7 +686,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscConfiguration] = kwargs.pop("cls", None) @@ -698,8 +720,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,6 +749,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the configuration script identified by configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -748,7 +774,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -764,8 +790,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,6 +825,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscConfiguration"]: """Retrieve a list of configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/configurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -818,7 +848,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -865,8 +895,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py index 9d05b99c479b..6197f3da2c0b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_configuration_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,12 +29,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +48,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +65,7 @@ def build_delete_request( "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_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") @@ -90,7 +86,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_request( "nodeConfigurationName": _SERIALIZER.url("node_configuration_name", node_configuration_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") @@ -128,7 +124,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +142,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -173,7 +169,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +185,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -233,6 +229,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -255,7 +254,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -271,8 +270,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,6 +295,9 @@ def get( ) -> _models.DscNodeConfiguration: """Retrieve the Dsc node configurations by node configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -317,7 +320,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscNodeConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -333,8 +336,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,14 +378,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DscNodeConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DscNodeConfigurationCreateOrUpdateParameters") @@ -402,8 +406,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,9 +441,12 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,9 +482,12 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -510,17 +521,20 @@ def begin_create_or_update( node_configuration_name: str, parameters: Union[_models.DscNodeConfigurationCreateOrUpdateParameters, IO], **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.DscNodeConfiguration]: """Create the node configuration identified by node configuration name. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param node_configuration_name: The Dsc node configuration name. Required. :type node_configuration_name: str - :param parameters: The create or update parameters for configuration. Is either a model type or - a IO type. Required. + :param parameters: The create or update parameters for configuration. Is either a + DscNodeConfigurationCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -542,7 +556,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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) @@ -601,6 +615,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscNodeConfiguration"]: """Retrieve a list of dsc node configurations. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeconfigurations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -622,7 +639,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.DscNodeConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -669,8 +686,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py index b3a9240a65ac..bd9aff0d6fe9 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_dsc_node_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,7 +128,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -165,9 +155,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +171,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -227,6 +215,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -249,9 +240,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -267,8 +256,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,6 +281,9 @@ def get( ) -> _models.DscNode: """Retrieve the dsc node identified by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -313,9 +306,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) request = build_get_request( @@ -331,8 +322,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,6 +358,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -396,6 +391,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -424,6 +422,9 @@ def update( ) -> _models.DscNode: """Update the dsc node. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -431,7 +432,7 @@ def update( :param node_id: Parameters supplied to the update dsc node. Required. :type node_id: str :param dsc_node_update_parameters: Parameters supplied to the update dsc node. Is either a - model type or a IO type. Required. + DscNodeUpdateParameters type or a IO type. Required. :type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,16 +453,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscNode] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dsc_node_update_parameters, (IO, bytes)): + if isinstance(dsc_node_update_parameters, (IOBase, bytes)): _content = dsc_node_update_parameters else: _json = self._serialize.body(dsc_node_update_parameters, "DscNodeUpdateParameters") @@ -482,8 +481,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,6 +517,9 @@ def list_by_automation_account( ) -> Iterable["_models.DscNode"]: """Retrieve a list of dsc nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -537,9 +540,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeListResult] = kwargs.pop("cls", None) error_map = { @@ -586,8 +587,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py index 97511e77ab4f..858643a284db 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_fields_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_list_by_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +64,7 @@ def build_list_by_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -105,6 +100,9 @@ def list_by_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/typefieldoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -121,7 +119,7 @@ def list_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -166,8 +164,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py index 50ecad63e97e..4016fb7722f9 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_worker_group_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +46,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +65,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -90,7 +86,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +105,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -130,7 +126,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +146,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -173,7 +169,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -193,7 +189,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -217,7 +213,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +229,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -275,6 +271,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -297,7 +296,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -313,8 +312,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,6 +341,9 @@ def get( ) -> _models.HybridRunbookWorkerGroup: """Retrieve a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +366,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -379,8 +382,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,6 +418,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -446,6 +453,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -477,6 +487,9 @@ def create( ) -> _models.HybridRunbookWorkerGroup: """Create a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -484,7 +497,8 @@ def create( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for - hybrid runbook worker group. Is either a model type or a IO type. Required. + hybrid runbook worker group. Is either a HybridRunbookWorkerGroupCreateOrUpdateParameters type + or a IO type. Required. :type hybrid_runbook_worker_group_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -506,14 +520,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_creation_parameters else: _json = self._serialize.body( @@ -536,8 +550,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,6 +590,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -607,6 +625,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -638,6 +659,9 @@ def update( ) -> _models.HybridRunbookWorkerGroup: """Update a hybrid runbook worker group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -645,7 +669,7 @@ def update( :param hybrid_runbook_worker_group_name: The hybrid runbook worker group name. Required. :type hybrid_runbook_worker_group_name: str :param hybrid_runbook_worker_group_updation_parameters: The hybrid runbook worker group. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerGroupCreateOrUpdateParameters type or a IO type. Required. :type hybrid_runbook_worker_group_updation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -667,14 +691,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorkerGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_group_updation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_group_updation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_group_updation_parameters else: _json = self._serialize.body( @@ -697,8 +721,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,6 +750,9 @@ def list_by_automation_account( ) -> Iterable["_models.HybridRunbookWorkerGroup"]: """Retrieve a list of hybrid runbook worker groups. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkergroupoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -740,7 +768,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkerGroupsListResult] = kwargs.pop("cls", None) error_map = { @@ -784,8 +812,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py index a5f04677e394..f3f0cd67ab6f 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_hybrid_runbook_workers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +67,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -93,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +109,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -135,7 +131,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +152,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -180,7 +176,7 @@ def build_move_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +197,7 @@ def build_move_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -226,7 +222,7 @@ def build_list_by_hybrid_runbook_worker_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,7 +241,7 @@ def build_list_by_hybrid_runbook_worker_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -288,6 +284,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -312,7 +311,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -329,8 +328,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,6 +358,9 @@ def get( ) -> _models.HybridRunbookWorker: """Retrieve a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,7 +385,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) request = build_get_request( @@ -399,8 +402,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,6 +439,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -470,6 +477,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -502,6 +512,9 @@ def create( ) -> _models.HybridRunbookWorker: """Create a hybrid runbook worker. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -511,7 +524,7 @@ def create( :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid - runbook worker. Is either a model type or a IO type. Required. + runbook worker. Is either a HybridRunbookWorkerCreateParameters type or a IO type. Required. :type hybrid_runbook_worker_creation_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -533,14 +546,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridRunbookWorker] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(hybrid_runbook_worker_creation_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_creation_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_creation_parameters else: _json = self._serialize.body( @@ -564,8 +577,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,6 +618,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -639,6 +656,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -671,6 +691,9 @@ def move( # pylint: disable=inconsistent-return-statements ) -> None: """Move a hybrid worker to a different group. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -680,7 +703,7 @@ def move( # pylint: disable=inconsistent-return-statements :param hybrid_runbook_worker_id: The hybrid runbook worker id. Required. :type hybrid_runbook_worker_id: str :param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters. Is - either a model type or a IO type. Required. + either a HybridRunbookWorkerMoveParameters type or a IO type. Required. :type hybrid_runbook_worker_move_parameters: ~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -702,14 +725,14 @@ def move( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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(hybrid_runbook_worker_move_parameters, (IO, bytes)): + if isinstance(hybrid_runbook_worker_move_parameters, (IOBase, bytes)): _content = hybrid_runbook_worker_move_parameters else: _json = self._serialize.body(hybrid_runbook_worker_move_parameters, "HybridRunbookWorkerMoveParameters") @@ -731,8 +754,9 @@ def move( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -760,6 +784,9 @@ def list_by_hybrid_runbook_worker_group( ) -> Iterable["_models.HybridRunbookWorker"]: """Retrieve a list of hybrid runbook workers. + .. seealso:: + - http://aka.ms/azureautomationsdk/hybridrunbookworkeroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -776,7 +803,7 @@ def list_by_hybrid_runbook_worker_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.HybridRunbookWorkersListResult] = kwargs.pop("cls", None) error_map = { @@ -821,8 +848,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py index 1f32175053c2..bdf9d7e94eeb 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +48,7 @@ def build_get_output_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "text/plain") # Construct URL @@ -69,7 +65,7 @@ def build_get_output_request( "jobName": _SERIALIZER.url("job_name", job_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") @@ -94,7 +90,7 @@ def build_get_runbook_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -111,7 +107,7 @@ def build_get_runbook_content_request( "jobName": _SERIALIZER.url("job_name", job_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") @@ -136,7 +132,7 @@ def build_suspend_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +149,7 @@ def build_suspend_request( "jobName": _SERIALIZER.url("job_name", job_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") @@ -178,7 +174,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +191,7 @@ def build_stop_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -220,7 +216,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +233,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_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") @@ -262,7 +258,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -280,7 +276,7 @@ def build_create_request( "jobName": _SERIALIZER.url("job_name", job_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") @@ -307,7 +303,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +319,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -350,7 +346,7 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -367,7 +363,7 @@ def build_resume_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -410,6 +406,9 @@ def get_output( ) -> str: """Retrieve the job output identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -434,7 +433,7 @@ def get_output( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_output_request( @@ -451,8 +450,9 @@ def get_output( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,6 +483,9 @@ def get_runbook_content( ) -> str: """Retrieve the runbook content of the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -507,7 +510,7 @@ def get_runbook_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_get_runbook_content_request( @@ -524,8 +527,9 @@ def get_runbook_content( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,6 +560,9 @@ def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -580,7 +587,7 @@ def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -597,8 +604,9 @@ def suspend( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -626,6 +634,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -650,7 +661,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -667,8 +678,9 @@ def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,6 +708,9 @@ def get( ) -> _models.Job: """Retrieve the job identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -720,7 +735,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -737,8 +752,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,6 +789,9 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -806,6 +825,9 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -837,14 +859,17 @@ def create( ) -> _models.Job: """Create a job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param job_name: The job name. Required. :type job_name: str - :param parameters: The parameters supplied to the create job operation. Is either a model type - or a IO type. Required. + :param parameters: The parameters supplied to the create job operation. Is either a + JobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobCreateParameters or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -867,14 +892,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobCreateParameters") @@ -896,8 +921,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,6 +955,9 @@ def list_by_automation_account( ) -> Iterable["_models.JobCollectionItem"]: """Retrieve a list of jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -945,7 +974,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobListResultV2] = kwargs.pop("cls", None) error_map = { @@ -990,8 +1019,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,6 +1049,9 @@ def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the job identified by jobName. + .. seealso:: + - http://aka.ms/azureautomationsdk/joboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -1043,7 +1076,7 @@ def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -1060,8 +1093,9 @@ def resume( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py index b5dce81f200f..674dccc8c282 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_schedule_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -156,7 +152,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +168,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -210,6 +206,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -232,7 +231,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -248,8 +247,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,6 +272,9 @@ def get( ) -> _models.JobSchedule: """Retrieve the job schedule identified by job schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -294,7 +297,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -310,8 +313,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,6 +349,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -375,6 +382,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -403,6 +413,9 @@ def create( ) -> _models.JobSchedule: """Create a job schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -410,7 +423,7 @@ def create( :param job_schedule_id: The job schedule name. Required. :type job_schedule_id: str :param parameters: The parameters supplied to the create job schedule operation. Is either a - model type or a IO type. Required. + JobScheduleCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -431,14 +444,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "JobScheduleCreateParameters") @@ -459,8 +472,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,6 +501,9 @@ def list_by_automation_account( ) -> Iterable["_models.JobSchedule"]: """Retrieve a list of job schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobscheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -501,7 +518,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -545,8 +562,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py index 0052d87dde4d..85346906e4f5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_job_stream_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +66,7 @@ def build_get_request( "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_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") @@ -97,7 +92,7 @@ def build_list_by_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ def build_list_by_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -160,6 +155,9 @@ def get( ) -> _models.JobStream: """Retrieve the job stream identified by job stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -186,7 +184,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -204,8 +202,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,6 +237,9 @@ def list_by_job( ) -> Iterable["_models.JobStream"]: """Retrieve a list of jobs streams identified by job name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -256,7 +258,7 @@ def list_by_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -302,8 +304,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py index 65d3c2d4f59d..c45be22effea 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_keys_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -117,7 +112,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) request = build_list_by_automation_account_request( @@ -132,8 +127,9 @@ def list_by_automation_account( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py index 3e65082d6b94..7c3f475220d2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_linked_workspace_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -95,6 +90,9 @@ def __init__(self, *args, **kwargs): def get(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> _models.LinkedWorkspace: """Retrieve the linked workspace for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/linkedworkspaceoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -115,7 +113,7 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.LinkedWorkspace] = kwargs.pop("cls", None) request = build_get_request( @@ -130,8 +128,9 @@ def get(self, resource_group_name: str, automation_account_name: str, **kwargs: 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py index 2631b4144265..a95bf12453a5 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_module_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the module by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Module: """Retrieve the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +412,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +443,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The create or update parameters for module. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +474,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleCreateOrUpdateParameters") @@ -489,8 +502,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +542,9 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +575,9 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +606,17 @@ def update( ) -> _models.Module: """Update the module identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param module_name: The name of module. Required. :type module_name: str - :param parameters: The update parameters for module. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +637,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ModuleUpdateParameters") @@ -642,8 +665,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +694,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +709,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -725,8 +752,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py index efe79673ab61..59e5fc2c4b5b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_count_information_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +61,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -108,6 +101,9 @@ def get( ) -> _models.NodeCounts: """Retrieve counts for Dsc Nodes. + .. seealso:: + - http://aka.ms/azureautomationsdk/nodecounts + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -131,9 +127,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.NodeCounts] = kwargs.pop("cls", None) request = build_get_request( @@ -149,8 +143,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py index fa13f6eca28c..905175ced0d2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_node_reports_operations.py @@ -27,16 +27,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,9 +53,7 @@ def build_list_by_node_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +70,7 @@ def build_list_by_node_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -100,9 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +112,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -142,9 +134,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +152,7 @@ def build_get_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -203,6 +193,9 @@ def list_by_node( ) -> Iterable["_models.DscNodeReport"]: """Retrieve the Dsc node report list by node id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -219,9 +212,7 @@ def list_by_node( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeReportListResult] = kwargs.pop("cls", None) error_map = { @@ -266,8 +257,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,6 +282,9 @@ def get( ) -> _models.DscNodeReport: """Retrieve the Dsc node report data by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,9 +309,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.DscNodeReport] = kwargs.pop("cls", None) request = build_get_request( @@ -333,8 +326,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,6 +355,9 @@ def get_content( ) -> JSON: """Retrieve the Dsc node reports by node id and report id. + .. seealso:: + - http://aka.ms/azureautomationsdk/dscnodereportoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -385,9 +382,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_get_content_request( @@ -404,8 +399,9 @@ def get_content( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py index a0bd570f9776..31b9d34df520 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_object_data_types_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_list_fields_by_module_and_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +64,7 @@ def build_list_fields_by_module_and_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -86,7 +81,7 @@ def build_list_fields_by_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +98,7 @@ def build_list_fields_by_type_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -139,6 +134,9 @@ def list_fields_by_module_and_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type identified by module name. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -155,7 +153,7 @@ def list_fields_by_module_and_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -200,8 +198,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,6 +223,9 @@ def list_fields_by_type( ) -> Iterable["_models.TypeField"]: """Retrieve a list of fields of a given type across all accessible modules. + .. seealso:: + - http://aka.ms/azureautomationsdk/objectdatatypeoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -238,7 +240,7 @@ def list_fields_by_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TypeFieldListResult] = kwargs.pop("cls", None) error_map = { @@ -282,8 +284,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py index 840ce5a7ac2d..5519c0c46145 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -130,8 +125,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_power_shell72_module_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_power_shell72_module_operations.py new file mode 100644 index 000000000000..046822a08c06 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_power_shell72_module_operations.py @@ -0,0 +1,791 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import AutomationClientMixinABC, _convert_request + +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, automation_account_name: str, module_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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "moduleName": _SERIALIZER.url("module_name", module_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-._0-9]*$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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, automation_account_name: str, module_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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "moduleName": _SERIALIZER.url("module_name", module_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-._0-9]*$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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, automation_account_name: str, module_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-11-01")) + 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.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "moduleName": _SERIALIZER.url("module_name", module_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-._0-9]*$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_update_request( + resource_group_name: str, automation_account_name: str, module_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-11-01")) + 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.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "moduleName": _SERIALIZER.url("module_name", module_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-._0-9]*$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_automation_account_request( + resource_group_name: str, automation_account_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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "automationAccountName": _SERIALIZER.url( + "automation_account_name", automation_account_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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) + + +class PowerShell72ModuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.automation.AutomationClient`'s + :attr:`power_shell72_module` 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 delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> None: + """Delete the module by name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_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", "2023-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, automation_account_name: str, module_name: str, **kwargs: Any + ) -> _models.Module: + """Retrieve the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :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", "2023-11-01")) + cls: ClsType[_models.Module] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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("Module", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: _models.ModuleCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters + :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: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleCreateOrUpdateParameters, IO], + **kwargs: Any + ) -> _models.Module: + """Create or Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The create or update parameters for module. Is either a + ModuleCreateOrUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Module] = 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, "ModuleCreateOrUpdateParameters") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Module", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Module", pipeline_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.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: _models.ModuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters + :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: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + automation_account_name: str, + module_name: str, + parameters: Union[_models.ModuleUpdateParameters, IO], + **kwargs: Any + ) -> _models.Module: + """Update the module identified by module name. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :param module_name: The name of module. Required. + :type module_name: str + :param parameters: The update parameters for module. Is either a ModuleUpdateParameters type or + a IO type. Required. + :type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Module or the result of cls(response) + :rtype: ~azure.mgmt.automation.models.Module + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Module] = 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, "ModuleUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + module_name=module_name, + 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) + + _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("Module", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules/{moduleName}" + } + + @distributed_trace + def list_by_automation_account( + self, resource_group_name: str, automation_account_name: str, **kwargs: Any + ) -> Iterable["_models.Module"]: + """Retrieve a list of PowerShell72 modules. + + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. Required. + :type automation_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Module or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.automation.models.Module] + :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", "2023-11-01")) + cls: ClsType[_models.ModuleListResult] = 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_automation_account_request( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_automation_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ModuleListResult", 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) + + list_by_automation_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/powerShell72Modules" + } diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py index a74811f185c9..116173ab202d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,12 +29,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,9 +44,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_automation_account_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -87,9 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +100,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") @@ -129,9 +121,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: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -151,7 +141,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") @@ -174,9 +164,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +183,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") @@ -244,9 +232,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -289,8 +275,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,9 +325,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -356,8 +341,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,16 +382,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -426,8 +410,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,7 +528,7 @@ def begin_create_or_update( :type automation_account_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -564,9 +549,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -630,9 +613,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -648,8 +629,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -697,9 +679,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) 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) diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py index 3c4845e592ff..fd2e59ab0c45 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +41,7 @@ def build_automation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +57,7 @@ def build_automation_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -112,9 +105,7 @@ def automation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -157,8 +148,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py index 9637fdcdee3b..1bbf91a150de 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python2_package_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 2 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Module: """Retrieve the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +412,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +443,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +474,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -489,8 +502,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +542,9 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +575,9 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +606,17 @@ def update( ) -> _models.Module: """Update the python 2 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +637,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -642,8 +665,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +694,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of python 2 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +709,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -725,8 +752,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py index 8a972064ff1b..22f496ba9280 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_python3_package_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -114,7 +110,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +128,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -151,7 +147,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +165,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -240,6 +236,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the python 3 package by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -262,7 +261,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -278,8 +277,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,6 +302,9 @@ def get( ) -> _models.Module: """Retrieve the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -324,7 +327,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Module] = kwargs.pop("cls", None) request = build_get_request( @@ -340,8 +343,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,6 +379,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -405,6 +412,9 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,14 +443,17 @@ def create_or_update( ) -> _models.Module: """Create or Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The create or update parameters for python package. Is either a model type - or a IO type. Required. + :param parameters: The create or update parameters for python package. Is either a + PythonPackageCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -461,14 +474,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageCreateParameters") @@ -489,8 +502,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,6 +542,9 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -558,6 +575,9 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -586,14 +606,17 @@ def update( ) -> _models.Module: """Update the python 3 package identified by package name. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param package_name: The name of python package. Required. :type package_name: str - :param parameters: The update parameters for python package. Is either a model type or a IO - type. Required. + :param parameters: The update parameters for python package. Is either a + PythonPackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -614,14 +637,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Module] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PythonPackageUpdateParameters") @@ -642,8 +665,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,6 +694,9 @@ def list_by_automation_account( ) -> Iterable["_models.Module"]: """Retrieve a list of python 3 packages. + .. seealso:: + - http://aka.ms/azureautomationsdk/moduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -682,7 +709,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ModuleListResult] = kwargs.pop("cls", None) error_map = { @@ -725,8 +752,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py index 0168fc1dfd72..022939dcf690 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_draft_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -61,10 +56,10 @@ def build_get_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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,7 +82,7 @@ def build_replace_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -102,10 +97,10 @@ def build_replace_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +119,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,10 +133,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +153,7 @@ def build_undo_edit_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,10 +167,10 @@ def build_undo_edit_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -211,6 +206,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the content of runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -233,7 +231,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -249,8 +247,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,7 +288,7 @@ def _replace_content_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[Iterator[bytes]]] = kwargs.pop("cls", None) @@ -310,8 +309,9 @@ def _replace_content_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,6 +349,9 @@ def begin_replace_content( ) -> LROPoller[Iterator[bytes]]: """Replaces the runbook draft content. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -373,7 +376,7 @@ def begin_replace_content( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -427,6 +430,9 @@ def get( ) -> _models.RunbookDraft: """Retrieve the runbook draft identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -449,7 +455,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookDraft] = kwargs.pop("cls", None) request = build_get_request( @@ -465,8 +471,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,6 +500,9 @@ def undo_edit( ) -> _models.RunbookDraftUndoEditResult: """Undo draft edit to last known published state identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -515,7 +525,7 @@ def undo_edit( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookDraftUndoEditResult] = kwargs.pop("cls", None) request = build_undo_edit_request( @@ -531,8 +541,9 @@ def undo_edit( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py index 3b9098bee619..2ff4939edd08 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_runbook_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,12 +29,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +44,7 @@ def build_publish_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,10 +58,10 @@ def build_publish_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +78,7 @@ def build_get_content_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "text/powershell") # Construct URL @@ -96,10 +92,10 @@ def build_get_content_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +112,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,10 +126,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -150,7 +146,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,10 +161,10 @@ def build_create_or_update_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -187,7 +183,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,10 +198,10 @@ def build_update_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -224,7 +220,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,10 +234,10 @@ def build_delete_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -258,7 +254,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +270,7 @@ def build_list_by_automation_account_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -318,7 +314,7 @@ def _publish_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_publish_request( @@ -334,8 +330,9 @@ def _publish_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,6 +358,9 @@ def begin_publish( ) -> LROPoller[None]: """Publish runbook draft. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookdraftoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -382,7 +382,7 @@ def begin_publish( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) 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) @@ -429,6 +429,9 @@ def get_content( ) -> Iterator[bytes]: """Retrieve the content of runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -451,7 +454,7 @@ def get_content( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) request = build_get_content_request( @@ -467,8 +470,9 @@ def get_content( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,6 +498,9 @@ def get( ) -> _models.Runbook: """Retrieve the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -516,7 +523,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) request = build_get_request( @@ -532,8 +539,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,6 +575,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,6 +609,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -627,6 +641,9 @@ def create_or_update( ) -> _models.Runbook: """Create the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -634,7 +651,8 @@ def create_or_update( :param runbook_name: The runbook name. Required. :type runbook_name: str :param parameters: The create or update parameters for runbook. Provide either content link for - a published runbook or draft, not both. Is either a model type or a IO type. Required. + a published runbook or draft, not both. Is either a RunbookCreateOrUpdateParameters type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -655,14 +673,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookCreateOrUpdateParameters") @@ -683,8 +701,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -722,6 +741,9 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -752,6 +774,9 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -780,14 +805,17 @@ def update( ) -> _models.Runbook: """Update the runbook identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The runbook name. Required. :type runbook_name: str - :param parameters: The update parameters for runbook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for runbook. Is either a RunbookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -808,14 +836,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Runbook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RunbookUpdateParameters") @@ -836,8 +864,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,6 +893,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the runbook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -886,7 +918,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -902,8 +934,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,6 +959,9 @@ def list_by_automation_account( ) -> Iterable["_models.Runbook"]: """Retrieve a list of runbooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/runbookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -938,7 +974,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.RunbookListResult] = kwargs.pop("cls", None) error_map = { @@ -981,8 +1017,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py index 7788fca6ce08..74640d78c558 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_schedule_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +60,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +79,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -101,7 +97,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -120,7 +116,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +133,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -154,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +167,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -247,6 +243,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,6 +277,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -307,6 +309,9 @@ def create_or_update( ) -> Optional[_models.Schedule]: """Create a schedule. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,7 +319,7 @@ def create_or_update( :param schedule_name: The schedule name. Required. :type schedule_name: str :param parameters: The parameters supplied to the create or update schedule operation. Is - either a model type or a IO type. Required. + either a ScheduleCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -335,14 +340,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Schedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleCreateOrUpdateParameters") @@ -363,8 +368,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,6 +409,9 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -433,6 +442,9 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -461,14 +473,17 @@ def update( ) -> _models.Schedule: """Update the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param schedule_name: The schedule name. Required. :type schedule_name: str - :param parameters: The parameters supplied to the update schedule operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update schedule operation. Is either a + ScheduleUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -489,14 +504,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ScheduleUpdateParameters") @@ -517,8 +532,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,6 +561,9 @@ def get( ) -> _models.Schedule: """Retrieve the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -567,7 +586,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( @@ -583,8 +602,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,6 +631,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the schedule identified by schedule name. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -633,7 +656,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -649,8 +672,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -673,6 +697,9 @@ def list_by_automation_account( ) -> Iterable["_models.Schedule"]: """Retrieve a list of schedules. + .. seealso:: + - http://aka.ms/azureautomationsdk/scheduleoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -685,7 +712,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.ScheduleListResult] = kwargs.pop("cls", None) error_map = { @@ -728,8 +755,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py index 3ad108e767be..9bb7fbf4917b 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_machine_runs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +65,7 @@ def build_get_by_id_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 +92,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +108,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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,6 +157,9 @@ def get_by_id( ) -> _models.SoftwareUpdateConfigurationMachineRun: """Get a single software update configuration machine run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,7 +185,7 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -204,8 +202,9 @@ def get_by_id( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,6 +238,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationMachineRunListResult: """Return list of software update configuration machine runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -270,7 +272,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -289,8 +291,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py index af550b9c2421..ee5e3bc1fa95 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configuration_runs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +65,7 @@ def build_get_by_id_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 +92,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +108,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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,6 +157,9 @@ def get_by_id( ) -> _models.SoftwareUpdateConfigurationRun: """Get a single software update configuration Run by Id. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationrunoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -187,7 +185,7 @@ def get_by_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationRun] = kwargs.pop("cls", None) request = build_get_by_id_request( @@ -204,8 +202,9 @@ def get_by_id( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,6 +238,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationRunListResult: """Return list of software update configuration runs. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -270,7 +272,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SoftwareUpdateConfigurationRunListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -289,8 +291,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py index 2fc4294217af..f8cecccc7a00 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_software_update_configurations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71,7 +67,7 @@ def build_create_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") @@ -98,7 +94,7 @@ def build_get_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +113,7 @@ def build_get_by_name_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") @@ -142,7 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +157,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") @@ -186,7 +182,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +198,7 @@ def build_list_request( "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_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") @@ -250,6 +246,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -284,6 +283,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -316,6 +318,9 @@ def create( ) -> _models.SoftwareUpdateConfiguration: """Create a new software update configuration with the name given in the URI. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -323,7 +328,8 @@ def create( :param software_update_configuration_name: The name of the software update configuration to be created. Required. :type software_update_configuration_name: str - :param parameters: Request body. Is either a model type or a IO type. Required. + :param parameters: Request body. Is either a SoftwareUpdateConfiguration type or a IO type. + Required. :type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration or IO :param client_request_id: Identifies this specific client request. Default value is None. :type client_request_id: str @@ -346,14 +352,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SoftwareUpdateConfiguration") @@ -375,8 +381,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,6 +419,9 @@ def get_by_name( ) -> _models.SoftwareUpdateConfiguration: """Get a single software update configuration by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -437,7 +447,7 @@ def get_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[_models.SoftwareUpdateConfiguration] = kwargs.pop("cls", None) request = build_get_by_name_request( @@ -454,8 +464,9 @@ def get_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,6 +498,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """delete a specific software update configuration. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -512,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -529,8 +543,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,6 +573,9 @@ def list( ) -> _models.SoftwareUpdateConfigurationListResult: """Get all software update configurations for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/softwareupdateconfigurationoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -582,7 +600,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-06-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) cls: ClsType[_models.SoftwareUpdateConfigurationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -599,8 +617,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py index 8c58d2fc5e71..8c81f59f572c 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +46,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +64,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -91,7 +87,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +105,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 +128,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +145,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -170,7 +166,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +183,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -209,7 +205,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +221,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -270,6 +266,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -301,6 +300,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -330,6 +332,9 @@ def create_or_update( ) -> _models.SourceControl: """Create a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -337,7 +342,7 @@ def create_or_update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the create or update source control operation. Is - either a model type or a IO type. Required. + either a SourceControlCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -358,14 +363,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlCreateOrUpdateParameters") @@ -386,8 +391,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,6 +431,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -455,6 +464,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -483,6 +495,9 @@ def update( ) -> _models.SourceControl: """Update a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -490,7 +505,7 @@ def update( :param source_control_name: The source control name. Required. :type source_control_name: str :param parameters: The parameters supplied to the update source control operation. Is either a - model type or a IO type. Required. + SourceControlUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -511,14 +526,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlUpdateParameters") @@ -539,8 +554,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,6 +583,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -589,7 +608,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -605,8 +624,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,6 +649,9 @@ def get( ) -> _models.SourceControl: """Retrieve the source control identified by source control name. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -651,7 +674,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -667,8 +690,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,6 +719,9 @@ def list_by_automation_account( ) -> Iterable["_models.SourceControl"]: """Retrieve a list of source controls. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontroloperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -709,7 +736,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlListResult] = kwargs.pop("cls", None) error_map = { @@ -753,8 +780,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py index 0c41e15aa9d1..16f44c24d6a8 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +47,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -70,7 +66,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -94,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +108,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -135,7 +131,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +148,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -198,6 +194,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -232,6 +231,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -264,6 +266,9 @@ def create( ) -> _models.SourceControlSyncJob: """Creates the sync job for a source control. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -273,7 +278,7 @@ def create( :param source_control_sync_job_id: The source control sync job id. Required. :type source_control_sync_job_id: str :param parameters: The parameters supplied to the create source control sync job operation. Is - either a model type or a IO type. Required. + either a SourceControlSyncJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,14 +299,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SourceControlSyncJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SourceControlSyncJobCreateParameters") @@ -323,8 +328,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,6 +362,9 @@ def get( ) -> _models.SourceControlSyncJobById: """Retrieve the source control sync job identified by job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -380,7 +389,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobById] = kwargs.pop("cls", None) request = build_get_request( @@ -397,8 +406,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,6 +440,9 @@ def list_by_automation_account( ) -> Iterable["_models.SourceControlSyncJob"]: """Retrieve a list of source control sync jobs. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -447,7 +460,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobListResult] = kwargs.pop("cls", None) error_map = { @@ -492,8 +505,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py index 314e759b1941..e2635f88153d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_source_control_sync_job_streams_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_list_by_sync_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +66,7 @@ def build_list_by_sync_job_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -96,7 +91,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +110,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -157,6 +152,9 @@ def list_by_sync_job( ) -> Iterable["_models.SourceControlSyncJobStream"]: """Retrieve a list of sync job streams identified by sync job id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -176,7 +174,7 @@ def list_by_sync_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob] = kwargs.pop("cls", None) error_map = { @@ -222,8 +220,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,6 +251,9 @@ def get( ) -> _models.SourceControlSyncJobStreamById: """Retrieve a sync job stream identified by stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,7 +280,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.SourceControlSyncJobStreamById] = kwargs.pop("cls", None) request = build_get_request( @@ -296,8 +298,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py index c55349c27844..6098e273731d 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_statistics_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +62,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -105,6 +100,9 @@ def list_by_automation_account( ) -> Iterable["_models.Statistics"]: """Retrieve the statistics for the account. + .. seealso:: + - http://aka.ms/azureautomationsdk/statisticsoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -119,7 +117,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.StatisticsListResult] = kwargs.pop("cls", None) error_map = { @@ -163,8 +161,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py index f9f05316a2c7..06f9b06905f6 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -60,10 +56,10 @@ def build_create_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,10 +92,10 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +112,7 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,10 +126,10 @@ def build_resume_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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") @@ -150,7 +146,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,10 +160,10 @@ def build_stop_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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 +180,7 @@ def build_suspend_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,10 +194,10 @@ def build_suspend_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _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,6 +240,9 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -274,6 +273,9 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -302,14 +304,17 @@ def create( ) -> _models.TestJob: """Create a test job of the runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param runbook_name: The parameters supplied to the create test job operation. Required. :type runbook_name: str - :param parameters: The parameters supplied to the create test job operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the create test job operation. Is either a + TestJobCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.TestJobCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -330,14 +335,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestJobCreateParameters") @@ -358,8 +363,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,6 +392,9 @@ def get( ) -> _models.TestJob: """Retrieve the test job for the specified runbook. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -408,7 +417,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.TestJob] = kwargs.pop("cls", None) request = build_get_request( @@ -424,8 +433,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,6 +462,9 @@ def resume( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -474,7 +487,7 @@ def resume( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_request( @@ -490,8 +503,9 @@ def resume( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,6 +528,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Stop the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -536,7 +553,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -552,8 +569,9 @@ def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -576,6 +594,9 @@ def suspend( # pylint: disable=inconsistent-return-statements ) -> None: """Suspend the test job. + .. seealso:: + - http://aka.ms/azureautomationsdk/testjoboperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -598,7 +619,7 @@ def suspend( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_request( @@ -614,8 +635,9 @@ def suspend( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py index e20b0d12c927..916ef4e8d339 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_test_job_streams_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,11 +60,11 @@ def build_get_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), "jobStreamId": _SERIALIZER.url("job_stream_id", job_stream_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") @@ -92,7 +87,7 @@ def build_list_by_test_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,10 +101,10 @@ def build_list_by_test_job_request( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._]+$" ), "automationAccountName": _SERIALIZER.url("automation_account_name", automation_account_name, "str"), - "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z]*-*[a-zA-Z0-9]*$"), + "runbookName": _SERIALIZER.url("runbook_name", runbook_name, "str", pattern=r"^[a-zA-Z][a-zA-Z-_0-9]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -152,6 +147,9 @@ def get( ) -> _models.JobStream: """Retrieve a test job stream of the test job identified by runbook name and stream id. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -176,7 +174,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStream] = kwargs.pop("cls", None) request = build_get_request( @@ -193,8 +191,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,6 +225,9 @@ def list_by_test_job( ) -> Iterable["_models.JobStream"]: """Retrieve a list of test job streams identified by runbook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/jobstreamoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -242,7 +244,7 @@ def list_by_test_job( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.JobStreamListResult] = kwargs.pop("cls", None) error_map = { @@ -287,8 +289,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py index 46d2b4c00a69..d2efe7e6eb60 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_usages_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar from azure.core.exceptions import ( @@ -27,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +57,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -98,6 +93,9 @@ def list_by_automation_account( ) -> Iterable["_models.Usage"]: """Retrieve the usage for the account id. + .. seealso:: + - http://aka.ms/azureautomationsdk/usageoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -110,7 +108,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) error_map = { @@ -153,8 +151,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py index 33b9118074cf..c90c2af3f733 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_variable_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,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: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +60,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +79,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -101,7 +97,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -120,7 +116,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +133,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -154,7 +150,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +167,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -188,7 +184,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +200,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -247,6 +243,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -278,6 +277,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -307,6 +309,9 @@ def create_or_update( ) -> _models.Variable: """Create a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -314,7 +319,7 @@ def create_or_update( :param variable_name: The variable name. Required. :type variable_name: str :param parameters: The parameters supplied to the create or update variable operation. Is - either a model type or a IO type. Required. + either a VariableCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -335,14 +340,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableCreateOrUpdateParameters") @@ -363,8 +368,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -402,6 +408,9 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -432,6 +441,9 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -460,14 +472,17 @@ def update( ) -> _models.Variable: """Update a variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param variable_name: The variable name. Required. :type variable_name: str - :param parameters: The parameters supplied to the update variable operation. Is either a model - type or a IO type. Required. + :param parameters: The parameters supplied to the update variable operation. Is either a + VariableUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,14 +503,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "VariableUpdateParameters") @@ -516,8 +531,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,6 +560,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the variable. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -566,7 +585,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -582,8 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,6 +626,9 @@ def get( ) -> _models.Variable: """Retrieve the variable identified by variable name. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -628,7 +651,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.Variable] = kwargs.pop("cls", None) request = build_get_request( @@ -644,8 +667,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,6 +696,9 @@ def list_by_automation_account( ) -> Iterable["_models.Variable"]: """Retrieve a list of variables. + .. seealso:: + - http://aka.ms/azureautomationsdk/variableoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -684,7 +711,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-08-08"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) cls: ClsType[_models.VariableListResult] = kwargs.pop("cls", None) error_map = { @@ -727,8 +754,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py index 66097fe791af..7e653b3013c2 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_watcher_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,9 +42,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: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +96,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -121,9 +113,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +131,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -160,9 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +167,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -196,9 +184,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +201,7 @@ def build_start_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -232,9 +218,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +235,7 @@ def build_stop_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -273,9 +257,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +273,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -336,6 +318,9 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -366,6 +351,9 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -394,14 +382,17 @@ def create_or_update( ) -> _models.Watcher: """Create the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The create or update parameters for watcher. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for watcher. Is either a Watcher type or a + IO type. Required. :type parameters: ~azure.mgmt.automation.models.Watcher or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -422,16 +413,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Watcher") @@ -452,8 +441,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,6 +474,9 @@ def get( ) -> _models.Watcher: """Retrieve the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -506,9 +499,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) request = build_get_request( @@ -524,8 +515,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,6 +551,9 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -589,6 +584,9 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -617,14 +615,17 @@ def update( ) -> _models.Watcher: """Update the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param watcher_name: The watcher name. Required. :type watcher_name: str - :param parameters: The update parameters for watcher. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for watcher. Is either a WatcherUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -645,16 +646,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Watcher] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WatcherUpdateParameters") @@ -675,8 +674,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,6 +703,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the watcher by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -725,9 +728,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -743,8 +744,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,6 +769,9 @@ def start( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -789,9 +794,7 @@ def start( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( @@ -807,8 +810,9 @@ def start( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -831,6 +835,9 @@ def stop( # pylint: disable=inconsistent-return-statements ) -> None: """Resume the watcher identified by watcher name. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -853,9 +860,7 @@ def stop( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( @@ -871,8 +876,9 @@ def stop( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -895,6 +901,9 @@ def list_by_automation_account( ) -> Iterable["_models.Watcher"]: """Retrieve a list of watchers. + .. seealso:: + - http://aka.ms/azureautomationsdk/watcheroperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -909,9 +918,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-01-13-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-01-13-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-13-preview")) cls: ClsType[_models.WatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -955,8 +962,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py index d738fc7d1b05..5acc20bff618 100644 --- a/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py +++ b/sdk/automation/azure-mgmt-automation/azure/mgmt/automation/operations/_webhook_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AutomationClientMixinABC, _convert_request, _format_url_section +from .._vendor import AutomationClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +42,7 @@ def build_generate_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +58,7 @@ def build_generate_uri_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -113,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +126,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -147,7 +143,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: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +161,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -184,7 +180,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +198,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -226,7 +222,7 @@ def build_list_by_automation_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +238,7 @@ def build_list_by_automation_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -278,6 +274,9 @@ def __init__(self, *args, **kwargs): def generate_uri(self, resource_group_name: str, automation_account_name: str, **kwargs: Any) -> str: """Generates a Uri for use in creating a webhook. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -298,7 +297,7 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_generate_uri_request( @@ -313,8 +312,9 @@ def generate_uri(self, resource_group_name: str, automation_account_name: str, * 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,6 +341,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete the webhook by name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -363,7 +366,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -379,8 +382,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,6 +407,9 @@ def get( ) -> _models.Webhook: """Retrieve the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -425,7 +432,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) request = build_get_request( @@ -441,8 +448,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,6 +484,9 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -506,6 +517,9 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -534,14 +548,17 @@ def create_or_update( ) -> _models.Webhook: """Create the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The create or update parameters for webhook. Is either a model type or a IO - type. Required. + :param parameters: The create or update parameters for webhook. Is either a + WebhookCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -562,14 +579,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookCreateOrUpdateParameters") @@ -590,8 +607,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,6 +647,9 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -659,6 +680,9 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -687,14 +711,17 @@ def update( ) -> _models.Webhook: """Update the webhook identified by webhook name. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. :type automation_account_name: str :param webhook_name: The webhook name. Required. :type webhook_name: str - :param parameters: The update parameters for webhook. Is either a model type or a IO type. - Required. + :param parameters: The update parameters for webhook. Is either a WebhookUpdateParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -715,14 +742,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "WebhookUpdateParameters") @@ -743,8 +770,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,6 +799,9 @@ def list_by_automation_account( ) -> Iterable["_models.Webhook"]: """Retrieve a list of webhooks. + .. seealso:: + - http://aka.ms/azureautomationsdk/webhookoperations + :param resource_group_name: Name of an Azure Resource group. Required. :type resource_group_name: str :param automation_account_name: The name of the automation account. Required. @@ -785,7 +816,7 @@ def list_by_automation_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2015-10-31"] = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-10-31")) cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) error_map = { @@ -829,8 +860,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py index a4d2d569874f..1444e0d800f0 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_job_schedule.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py index d097bf32b265..648941df460c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_automation_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py index cca079c0d201..87bcb180bb2d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_certificate.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py index 03a424b2e7db..54cb54c2ebb3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py index 184d6e8603ad..4a573be98eb6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_connection_type.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py index 2fa852a415c4..7fe41fb1b2a2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_credential.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateCredential.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateCredential.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py index 73adef8439d4..e534be9e60b2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_configuration.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py index 5b8c55268bcb..d1550b397903 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_dsc_node_configuration.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py index 591f109ce076..4abff6aaf46e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_module.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_power_shell72_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_power_shell72_module.py new file mode 100644 index 000000000000..36f3bc57a465 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_power_shell72_module.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python create_or_update_power_shell72_module.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="a6ddc3c0-ed18-45d9-9cae-d91644c46eb1", + ) + + response = client.power_shell72_module.create_or_update( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + module_name="OmsCompositeResources", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87B", + }, + "uri": "https://teststorage.blob.core.windows.net/dsccomposite/OmsCompositeResources.zip", + "version": "1.0.0.0", + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdatePowerShell72Module.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py index 7a9980c27184..d0d76fed2d42 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python2_package.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdatePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdatePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py index 05ebdbeca55d..32ef14254f96 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_python3_package.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdatePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdatePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py index 3b8805b3d1b3..beb0dff6cf8a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_runbook.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py index 19499d40910d..8d4acda2e04d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_schedule.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py index 78e18fc4d9d0..d3f4a3c95e61 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_variable.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createOrUpdateVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createOrUpdateVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py index fc334f9f9b23..e9414fdeaa12 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_runbook_as_draft.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createRunbookAsDraft.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createRunbookAsDraft.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py index e1c7d4e9df5b..09ce03e34d16 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/create_test_job.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/createTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/createTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py index e20284362dff..0bfc70509728 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_automation_account.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.automation_account.delete( + client.automation_account.delete( resource_group_name="rg", automation_account_name="myAutomationAccount9", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py index 61fd5294d6ec..cf90d07fb81e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_certificate.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.certificate.delete( + client.certificate.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", certificate_name="testCert", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py index a3a0ad565068..ae1713c920c2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.connection.delete( + client.connection.delete( resource_group_name="rg", automation_account_name="myAutomationAccount28", connection_name="myConnection", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py index f929c0d808aa..610e4d42cdad 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_connection_type.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.connection_type.delete( + client.connection_type.delete( resource_group_name="rg", automation_account_name="myAutomationAccount22", connection_type_name="myCT", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py index 798b2233ab98..f11ee668222b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_credential_existing.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.credential.delete( + client.credential.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", credential_name="myCredential", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteCredentialExisting.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteCredentialExisting.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py index 4f6167ad95e6..fa36766d46fa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_configuration.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.dsc_configuration.delete( + client.dsc_configuration.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", configuration_name="TemplateBasic", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py index 6ba11c5dd893..758358286b96 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node.py @@ -29,12 +29,11 @@ def main(): subscription_id="subid", ) - response = client.dsc_node.delete( + client.dsc_node.delete( resource_group_name="rg", automation_account_name="myAutomationAccount9", node_id="e1243a76-a9bd-432f-bde3-ad8f317ee786", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/deleteDscNode.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py index 986c71cb656b..fbe3dd6b1ea4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_dsc_node_configuration.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.dsc_node_configuration.delete( + client.dsc_node_configuration.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", node_configuration_name="configName.nodeConfigName", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py index d57ea4f58b6c..438127dffd4e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker.py @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.hybrid_runbook_workers.delete( + client.hybrid_runbook_workers.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", hybrid_runbook_worker_group_name="myGroup", hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py index d2756c5337d4..df9e981459b9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_hybrid_runbook_worker_group.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.hybrid_runbook_worker_group.delete( + client.hybrid_runbook_worker_group.delete( resource_group_name="rg", automation_account_name="myAutomationAccount20", hybrid_runbook_worker_group_name="myGroup", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py index 8a4366dc6e0d..a0434714fc39 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_job_schedule.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.job_schedule.delete( + client.job_schedule.delete( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", job_schedule_id="0fa462ba-3aa2-4138-83ca-9ebc3bc55cdc", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py index 3758f7cbd3b2..e3f5c973c489 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_module.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.module.delete( + client.module.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", module_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_power_shell72_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_power_shell72_module.py new file mode 100644 index 000000000000..220d23594845 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_power_shell72_module.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python delete_power_shell72_module.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="a6ddc3c0-ed18-45d9-9cae-d91644c46eb1", + ) + + client.power_shell72_module.delete( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + module_name="OmsCompositeResources", + ) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deletePowerShell72Module.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py index ba772b1f15c1..ff13045d1d24 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python2_package.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.python2_package.delete( + client.python2_package.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", package_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deletePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deletePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py index 49b6c157e7ce..8b22dbb3e84f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_python3_package.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.python3_package.delete( + client.python3_package.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", package_name="OmsCompositeResources", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deletePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deletePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py index bd4aeccefb63..e70f1293456f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_runbook.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.runbook.delete( + client.runbook.delete( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py index e4bbe77ff19a..82a31ed123ac 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_schedule.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.schedule.delete( + client.schedule.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", schedule_name="mySchedule", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py index 373381e793b3..1394036a94e8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_variable.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.variable.delete( + client.variable.delete( resource_group_name="rg", automation_account_name="sampleAccount9", variable_name="sampleVariable", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deleteVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deleteVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py index 0c14c65c24c2..3849782d4466 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_watcher.py @@ -29,12 +29,11 @@ def main(): subscription_id="subid", ) - response = client.watcher.delete( + client.watcher.delete( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/deleteWatcher.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py index 5998a5bd524d..29a72bc49103 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/delete_webhook.py @@ -29,12 +29,11 @@ def main(): subscription_id="subid", ) - response = client.webhook.delete( + client.webhook.delete( resource_group_name="rg", automation_account_name="myAutomationAccount33", webhook_name="TestWebhook", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2015-10-31/examples/deleteWebhook.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py index d83ec664e049..eb03cb1eab3c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/deserialize_graph_runbook_content.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/deserializeGraphRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/deserializeGraphRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py index 9389529266ad..9d1ce77bf823 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_activity_in_amodule.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getActivityInAModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getActivityInAModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py index b14fe70e2f5f..ab1ff3a6b9f8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllConnectionTypes_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getAllConnectionTypes_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py index 9967b3c5b03a..b7aa55b6932c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_connection_types_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllConnectionTypes_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getAllConnectionTypes_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py index c45e1be72dac..5f3989d169ca 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_all_dsc_configurations.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAllDscConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getAllDscConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py index 6b9e268ad6a3..0edbc6e7144b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_automation_account.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py index 59c87b0d969e..f846e8f7bcce 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_certificate.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py index 9b0cecd3799f..291cc5784c6d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py index ef0bc7206051..e0a02ce4dd65 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_connection_type.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getConnectionType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getConnectionType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py index a3ea4858bc15..348676beb8d6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_credential.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getCredential.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getCredential.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py index dd59173f3450..ffd54d2df923 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py index 3ebfcdc0e0b5..65a2091fa86f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_configuration_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscConfigurationContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getDscConfigurationContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py index 16614b7e7da9..ad4ff90abb4b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_dsc_node_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getDscNodeConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getDscNodeConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py index ec122cfc5619..d774eae179fe 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py index 49284fc381f8..aa9ce53f6050 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_hybrid_runbook_worker_group.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py index 6658c782f8d4..c1a75eb67010 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_job_schedule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getJobSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getJobSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py index bfa741d8eae9..d27906106dcd 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_linked_workspace.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getLinkedWorkspace.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getLinkedWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py index d6ea2e7fa7c7..30deb455edf4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_module.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py index 47346472da18..5a1f00772bb6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_paged_dsc_configurations_with_no_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPagedDscConfigurationsWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getPagedDscConfigurationsWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py index 5ab5913776cd..999add4a43eb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_pagedl_dsc_configurations_with_name_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPagedlDscConfigurationsWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getPagedlDscConfigurationsWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_power_shell72_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_power_shell72_module.py new file mode 100644 index 000000000000..9e92928b02d6 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_power_shell72_module.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python get_power_shell72_module.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="a6ddc3c0-ed18-45d9-9cae-d91644c46eb1", + ) + + response = client.power_shell72_module.get( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + module_name="OmsCompositeResources", + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getPowerShell72Module.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py index 684fdc7d4b62..b8899a8b09b1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_python2_package.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getPython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py index ba09a760e5f5..00b410aa44e1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_python3_package.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getPython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getPython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py index 6e699bb34e43..98c63f60c4de 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py index a90309a5ab22..542ff6ab70fa 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py index aab64bc644a7..7c2255a04197 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookDraft.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getRunbookDraft.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py index 0b9a52aad808..7149d0226008 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_runbook_draft_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getRunbookDraftContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getRunbookDraftContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py index 9b5f8c045edb..f7c566557df3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_schedule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py index 41a7706999b7..ec33404bb324 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_statistics_of_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getStatisticsOfAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getStatisticsOfAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py index d604bce10343..c96858cd2be6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py index 2ac192c8a19b..365787cb6c8e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_test_job_stream.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getTestJobStream.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getTestJobStream.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py index a083999ca85d..0bf155225f63 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_usages_of_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getUsagesOfAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getUsagesOfAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py index ad8209775320..3f5643d6e817 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/get_variable.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/getVariable.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/getVariable.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py index 2d38fea8ffe7..4514528c2d6d 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/create_job.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/createJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/createJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py index d2b92f137f87..8a5328ef6149 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/getJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py index 42e27376f357..aa7c94dcb8d5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_output.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_output.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobOutput.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/getJobOutput.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py index e9c2654c74f6..a8c963a9ff0e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/getJobRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py index f45ea43108fe..a41ac173b6c4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_job_stream.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/get_job_stream.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/getJobStream.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/getJobStream.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py index 459c3da81dae..10b792cbe253 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_job_streams_by_job.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/listJobStreamsByJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/listJobStreamsByJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py index d789ee010ee9..55e2f2c83ec4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_jobs_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/list_jobs_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/listJobsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/listJobsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py index 9f6449d75dcf..73b5c407af64 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/resume_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/resume_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.resume( + client.job.resume( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/resumeJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/resumeJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py index b918877a09be..48dd37403811 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/stop_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.stop( + client.job.stop( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/stopJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/stopJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py similarity index 92% rename from sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py index 8d989be033b9..95b93af1d397 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/job/suspend_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.job.suspend( + client.job.suspend( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", job_name="foo", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/job/suspendJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/job/suspendJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py index 8872546354af..f66c4de25e5b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_activities_by_module.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listActivitiesByModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listActivitiesByModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py index e81e9a773167..9027b40ee3eb 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_all_job_schedules_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAllJobSchedulesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listAllJobSchedulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py index d022dd606657..3140cca507c9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_account_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountKeys.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listAutomationAccountKeys.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py index a2cf160943a9..ee254e4b6c2c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountsByResourceGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listAutomationAccountsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py index 329c56d5574a..c437b09a5357 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_automation_accounts_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listAutomationAccountsBySubscription.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listAutomationAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py index 28b8a613718b..56462b9ffc2b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_certificates_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCertificatesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listCertificatesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py index 34c9575d04a3..32d72dafc369 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listConnectionsByAutomationAccount_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listConnectionsByAutomationAccount_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py index 9d8e1e180083..264db43fa1f2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_connections_by_automation_account_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listConnectionsByAutomationAccount_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listConnectionsByAutomationAccount_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py index f150c3673d51..352b448c2053 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCredentialsByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listCredentialsByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py index 566095cbdb7e..d6d4bc76fd41 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_credentials_by_automation_account_next100_using_next_link.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listCredentialsByAutomationAccount_next100_using_nextLink.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listCredentialsByAutomationAccount_next100_using_nextLink.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py index a6f3b787db2f..2493e6458c17 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_dsc_node_configurations.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listDscNodeConfigurations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listDscNodeConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py index 4bf336a82996..9fb31a061167 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_module_and_type.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listFieldsByModuleAndType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listFieldsByModuleAndType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py index 75f28c225d50..38c6da42c3b9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_fields_by_type.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listFieldsByType.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listFieldsByType.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py index 771cdcde2d4a..b6efb548c20f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listHybridRunbookWorker.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listHybridRunbookWorker.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py index 44a1342f3965..b9d61f81e904 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_hybrid_runbook_worker_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listHybridRunbookWorkerGroup.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listHybridRunbookWorkerGroup.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py index 5f8e7099d1cc..8a7f87de562a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_modules_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listModulesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listModulesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py index 3a69b16cabe5..c02afdf2ab4e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_name_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPagedDscNodeConfigurationsWithNameFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listPagedDscNodeConfigurationsWithNameFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py index f82ff1046dbb..62cf312c02c8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_paged_dsc_node_configurations_with_no_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPagedDscNodeConfigurationsWithNoFilter.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listPagedDscNodeConfigurationsWithNoFilter.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_power_shell72_modules_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_power_shell72_modules_by_automation_account.py new file mode 100644 index 000000000000..c0c890c4f1d3 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_power_shell72_modules_by_automation_account.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python list_power_shell72_modules_by_automation_account.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="a6ddc3c0-ed18-45d9-9cae-d91644c46eb1", + ) + + response = client.power_shell72_module.list_by_automation_account( + resource_group_name="rg", + automation_account_name="myAutomationAccount33", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listPowerShell72ModulesByAutomationAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py index 45ce29531a20..a583c144c4f3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_python2_packages_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPython2PackagesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listPython2PackagesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py index 544c0f4b875f..193644790cd2 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_python3_packages_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listPython3PackagesByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listPython3PackagesByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py index d3caf91dba22..cd0a138a2520 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_rest_api_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listRestAPIOperations.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listRestAPIOperations.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py index a2cd89a2b95c..252b3e34b3b7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_runbooks_by_automation_account.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listRunbooksByAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listRunbooksByAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py index 1730bf20bf6e..e44e99f77159 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listSchedulesByAutomationAccount_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listSchedulesByAutomationAccount_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py index 2fb56d713471..214a52f6dc4c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_schedules_by_automation_account_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listSchedulesByAutomationAccount_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listSchedulesByAutomationAccount_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py index 0be9152ac743..36f315377bcc 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_test_job_streams_by_job.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listTestJobStreamsByJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listTestJobStreamsByJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py index 27441076e4cc..82d57c04c29a 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_first100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listVariables_First100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listVariables_First100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py index 8e2c68a5a40e..9c7a1373b59f 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/list_variables_next100.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/listVariables_Next100.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/listVariables_Next100.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.py new file mode 100644 index 000000000000..d43422d91383 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/move_hybrid_runbook_worker.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python move_hybrid_runbook_worker.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.hybrid_runbook_workers.move( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_move_parameters={"hybridRunbookWorkerGroupName": "TestHybridGroup2"}, + ) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/moveHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py index 90667792d25a..e8d8c53b414e 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/private_endpoint_connection_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.private_endpoint_connections.begin_delete( + client.private_endpoint_connections.begin_delete( resource_group_name="rg1", automation_account_name="ddb1", private_endpoint_connection_name="privateEndpointConnectionName", ).result() - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/PrivateEndpointConnectionDelete.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py index 8b27533bda34..32a0e7f08d87 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/publish_runbook.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.runbook.begin_publish( + client.runbook.begin_publish( resource_group_name="rg", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ).result() - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/publishRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/publishRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.py new file mode 100644 index 000000000000..76362a530657 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_workers.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_id="c010ad12-ef14-4a2a-aa9e-ef22c4745ddd", + hybrid_runbook_worker_creation_parameters={ + "properties": { + "vmResourceId": "/subscriptions/vmsubid/resourceGroups/vmrg/providers/Microsoft.Compute/virtualMachines/vmname" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/putHybridRunbookWorker.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.py new file mode 100644 index 000000000000..3d23c8d54349 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/put_hybrid_runbook_worker_group.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python put_hybrid_runbook_worker_group.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_worker_group.create( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_group_creation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialName"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/putHybridRunbookWorkerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py index 7d5faf92e036..6b1ef50c8107 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/replace_runbook_draft_content.py @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/replaceRunbookDraftContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/replaceRunbookDraftContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py index 793545c2a9b7..5b4a552c09c9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/resume_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.resume( + client.test_job.resume( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/resumeTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/resumeTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py b/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py index 3155d622419f..4a4892a1fc7b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/serialize_graph_runbook_content.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/serializeGraphRunbookContent.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/serializeGraphRunbookContent.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py similarity index 100% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/create_software_update_configuration.py diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py index 6e2eb24b74ed..4a51b8faf785 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_software_update_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/delete_software_update_configuration.py @@ -29,12 +29,11 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.software_update_configurations.delete( + client.software_update_configurations.delete( resource_group_name="mygroup", automation_account_name="myaccount", software_update_configuration_name="mypatch", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/examples/softwareUpdateConfiguration/deleteSoftwareUpdateConfiguration.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py similarity index 100% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_by_name.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/get_software_update_configuration_by_name.py diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py similarity index 100% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations.py diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py similarity index 100% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configurations_by_vm.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration/list_software_update_configurations_by_vm.py diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py index 58bd29fd58e4..242b5578f178 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_machine_run_by_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/get_software_update_configuration_machine_run_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationMachineRun/getSoftwareUpdateConfigurationMachineRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py index 00be7b54d8fc..6568d8b3781c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py index df87e8fd3d19..7b9e378d2df4 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_machine_runs_by_run.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_machine_run/list_software_update_configuration_machine_runs_by_run.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationMachineRun/listSoftwareUpdateConfigurationMachineRunsByRun.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py index f22cd0c67707..04f1c39e40ae 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_software_update_configuration_run_by_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/get_software_update_configuration_run_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationRun/getSoftwareUpdateConfigurationRunById.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py index d9a6b2e14679..9db82f15273c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_failed_software_update_configuration_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_failed_software_update_configuration_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationRun/listFailedSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py index 69244ac61daf..172d76bd12ec 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/list_software_update_configuration_runs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/software_update_configuration_run/list_software_update_configuration_runs.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/softwareUpdateConfigurationRun/listSoftwareUpdateConfigurationRuns.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py similarity index 88% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py index 714e153313c0..60af283b96a7 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_or_update_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/create_or_update_source_control.py @@ -41,10 +41,7 @@ def main(): "folderPath": "/folderOne/folderTwo", "publishRunbook": True, "repoUrl": "https://sampleUser.visualstudio.com/myProject/_git/myRepository", - "securityToken": { - "accessToken": "3a326f7a0dcd343ea58fee21f2fd5fb4c1234567", - "tokenType": "PersonalAccessToken", - }, + "securityToken": {"accessToken": "******", "tokenType": "PersonalAccessToken"}, "sourceType": "VsoGit", } }, @@ -52,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/createOrUpdateSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControl/createOrUpdateSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py similarity index 91% rename from sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py index 7d549e83d0ee..6ccb321a4a14 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/delete_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/delete_source_control.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.source_control.delete( + client.source_control.delete( resource_group_name="rg", automation_account_name="sampleAccount9", source_control_name="sampleSourceControl", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/deleteSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControl/deleteSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py index bebb7fc90935..8881afbabced 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_controls.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_all_source_controls.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/getAllSourceControls.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControl/getAllSourceControls.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py similarity index 95% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py index fc9f1d72f52e..023768ca11d5 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/get_source_control.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/getSourceControl.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControl/getSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py similarity index 87% rename from sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py index 52f7e6b0d4e0..37196e2848e1 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_source_control_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control/update_source_control_patch.py @@ -40,16 +40,13 @@ def main(): "description": "my description", "folderPath": "/folderOne/folderTwo", "publishRunbook": True, - "securityToken": { - "accessToken": "3a326f7a0dcd343ea58fee21f2fd5fb4c1234567", - "tokenType": "PersonalAccessToken", - }, + "securityToken": {"accessToken": "******", "tokenType": "PersonalAccessToken"}, } }, ) print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControl/updateSourceControl_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControl/updateSourceControl_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py index 7e7e27f90f2c..12a1e3cbedea 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/create_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/create_source_control_sync_job.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/createSourceControlSyncJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControlSyncJob/createSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py index 05eb87813631..121b8d1e9ee6 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_all_source_control_sync_jobs.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_all_source_control_sync_jobs.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControlSyncJob/getAllSourceControlSyncJobs.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py index ede5f897ec7d..54792606a218 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job/get_source_control_sync_job.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJob/getSourceControlSyncJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControlSyncJob/getSourceControlSyncJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py index 6f515733f06d..f9a25d0bf9f3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreams.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py similarity index 96% rename from sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py rename to sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py index 2a00b6994279..322cbbbc30b8 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/get_source_control_sync_job_streams_by_stream_id.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/source_control_sync_job_streams/get_source_control_sync_job_streams_by_stream_id.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/sourceControlSyncJobStreams/getSourceControlSyncJobStreamsByStreamId.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py index 7662d25930d7..670dd75ba369 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/start_watcher.py @@ -29,12 +29,11 @@ def main(): subscription_id="subid", ) - response = client.watcher.start( + client.watcher.start( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/startWatcher.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py index e70cbf68bc08..152ecf66c042 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.stop( + client.test_job.stop( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/stopTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/stopTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py index f71ada541e02..324365e5fb42 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/stop_watcher.py @@ -29,12 +29,11 @@ def main(): subscription_id="subid", ) - response = client.watcher.stop( + client.watcher.stop( resource_group_name="rg", automation_account_name="MyTestAutomationAccount", watcher_name="MyTestWatcher", ) - print(response) # x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/preview/2020-01-13-preview/examples/stopWatcher.json diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py b/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py index e01ba8626e41..943a54c8773b 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/suspend_test_job.py @@ -29,14 +29,13 @@ def main(): subscription_id="51766542-3ed7-4a72-a187-0c8ab644ddab", ) - response = client.test_job.suspend( + client.test_job.suspend( resource_group_name="mygroup", automation_account_name="ContoseAutomationAccount", runbook_name="Get-AzureVMTutorial", ) - print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/suspendTestJob.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/suspendTestJob.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py b/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py index 47373562cc35..a57c5ed86507 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/undo_draft_edit_to_last_known_published_state.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/undoDraftEditToLastKnownPublishedState.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/undoDraftEditToLastKnownPublishedState.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py index d7b16ce92a58..1c8a27212f62 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_automation_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateAutomationAccount.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateAutomationAccount.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py index 99ab885a839a..42a38bfe2712 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_certificate.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateCertificate.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateCertificate.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py index 8d80714883df..9ec001613f78 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_connection.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateConnection.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateConnection.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py index b625492a573a..e4270948b8b9 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_credential_patch.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateCredential_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateCredential_patch.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py index e094bac82453..920acfd6975c 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_dsc_configuration.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateDscConfiguration.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateDscConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.py new file mode 100644 index 000000000000..c18ca76e4dff --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_hybrid_runbook_worker_group.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python update_hybrid_runbook_worker_group.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.hybrid_runbook_worker_group.update( + resource_group_name="rg", + automation_account_name="testaccount", + hybrid_runbook_worker_group_name="TestHybridGroup", + hybrid_runbook_worker_group_updation_parameters={ + "properties": {"credential": {"name": "myRunAsCredentialUpdatedName"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateHybridRunbookWorkerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py index ccb620b512db..bbaeb8044b60 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_module.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateModule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateModule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_power_shell72_module.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_power_shell72_module.py new file mode 100644 index 000000000000..d89f3e46e6d4 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_power_shell72_module.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.automation import AutomationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-automation +# USAGE + python update_power_shell72_module.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 = AutomationClient( + credential=DefaultAzureCredential(), + subscription_id="a6ddc3c0-ed18-45d9-9cae-d91644c46eb1", + ) + + response = client.power_shell72_module.update( + resource_group_name="rg", + automation_account_name="MyAutomationAccount", + module_name="MyModule", + parameters={ + "properties": { + "contentLink": { + "contentHash": { + "algorithm": "sha265", + "value": "07E108A962B81DD9C9BAA89BB47C0F6EE52B29E83758B07795E408D258B2B87A", + }, + "uri": "https://teststorage.blob.core.windows.net/mycontainer/MyModule.zip", + "version": "1.0.0.0", + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updatePowerShell72Module.json +if __name__ == "__main__": + main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py index 64b2e32508bb..39de4a88a137 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_python2_package.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updatePython2Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updatePython2Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py index 862d22b3f059..6d7c40c32c71 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_python3_package.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updatePython3Package.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updatePython3Package.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py index 418a89a0de11..ec12436ba350 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_runbook.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateRunbook.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateRunbook.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py index 1f105f8835d7..4384a69f5362 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_schedule.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateSchedule.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateSchedule.json if __name__ == "__main__": main() diff --git a/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py b/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py index 36c587ab42b9..1e6e64d67ff3 100644 --- a/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py +++ b/sdk/automation/azure-mgmt-automation/generated_samples/update_variable_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-08-08/examples/updateVariable_patch.json +# x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2023-11-01/examples/updateVariable_patch.json if __name__ == "__main__": main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/CHANGELOG.md b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/LICENSE b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/MANIFEST.in b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/MANIFEST.in new file mode 100644 index 000000000000..59b7e65e7be3 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/azuredatatransfer/py.typed diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/README.md b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/README.md new file mode 100644 index 000000000000..97bc81f8d119 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-azuredatatransfer +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/_meta.json b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/_meta.json new file mode 100644 index 000000000000..7b46c61f2a0d --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/azuredatatransfer/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/azuredatatransfer/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/__init__.py new file mode 100644 index 000000000000..3e8909f4d182 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._azuredatatransferrp import Azuredatatransferrp +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Azuredatatransferrp", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_azuredatatransferrp.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_azuredatatransferrp.py new file mode 100644 index 000000000000..06d27a451613 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_azuredatatransferrp.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import AzuredatatransferrpConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AzureDataTransferOperations, + ConnectionsOperations, + FlowsOperations, + ListPendingConnectionsOperations, + ListPendingFlowsOperations, + ListSchemasOperations, + Operations, + PipelinesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class Azuredatatransferrp: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Azure Data Transfer service resource provider. + + :ivar azure_data_transfer: AzureDataTransferOperations operations + :vartype azure_data_transfer: + azure.mgmt.azuredatatransfer.operations.AzureDataTransferOperations + :ivar flows: FlowsOperations operations + :vartype flows: azure.mgmt.azuredatatransfer.operations.FlowsOperations + :ivar connections: ConnectionsOperations operations + :vartype connections: azure.mgmt.azuredatatransfer.operations.ConnectionsOperations + :ivar list_pending_connections: ListPendingConnectionsOperations operations + :vartype list_pending_connections: + azure.mgmt.azuredatatransfer.operations.ListPendingConnectionsOperations + :ivar list_pending_flows: ListPendingFlowsOperations operations + :vartype list_pending_flows: azure.mgmt.azuredatatransfer.operations.ListPendingFlowsOperations + :ivar pipelines: PipelinesOperations operations + :vartype pipelines: azure.mgmt.azuredatatransfer.operations.PipelinesOperations + :ivar list_schemas: ListSchemasOperations operations + :vartype list_schemas: azure.mgmt.azuredatatransfer.operations.ListSchemasOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.azuredatatransfer.operations.Operations + :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. The value must be an UUID. 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-10-11-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzuredatatransferrpConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.azure_data_transfer = AzureDataTransferOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flows = FlowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_pending_connections = ListPendingConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.list_pending_flows = ListPendingFlowsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.pipelines = PipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_schemas = ListSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "Azuredatatransferrp": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_configuration.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_configuration.py new file mode 100644 index 000000000000..384f3eed22cf --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AzuredatatransferrpConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for Azuredatatransferrp. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-10-11-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(AzuredatatransferrpConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-10-11-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-azuredatatransfer/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_patch.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_serialization.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_vendor.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_version.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/__init__.py new file mode 100644 index 000000000000..a8582bd13954 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._azuredatatransferrp import Azuredatatransferrp + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Azuredatatransferrp", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_azuredatatransferrp.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_azuredatatransferrp.py new file mode 100644 index 000000000000..2ee3b064ef1f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_azuredatatransferrp.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AzuredatatransferrpConfiguration +from .operations import ( + AzureDataTransferOperations, + ConnectionsOperations, + FlowsOperations, + ListPendingConnectionsOperations, + ListPendingFlowsOperations, + ListSchemasOperations, + Operations, + PipelinesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class Azuredatatransferrp: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Azure Data Transfer service resource provider. + + :ivar azure_data_transfer: AzureDataTransferOperations operations + :vartype azure_data_transfer: + azure.mgmt.azuredatatransfer.aio.operations.AzureDataTransferOperations + :ivar flows: FlowsOperations operations + :vartype flows: azure.mgmt.azuredatatransfer.aio.operations.FlowsOperations + :ivar connections: ConnectionsOperations operations + :vartype connections: azure.mgmt.azuredatatransfer.aio.operations.ConnectionsOperations + :ivar list_pending_connections: ListPendingConnectionsOperations operations + :vartype list_pending_connections: + azure.mgmt.azuredatatransfer.aio.operations.ListPendingConnectionsOperations + :ivar list_pending_flows: ListPendingFlowsOperations operations + :vartype list_pending_flows: + azure.mgmt.azuredatatransfer.aio.operations.ListPendingFlowsOperations + :ivar pipelines: PipelinesOperations operations + :vartype pipelines: azure.mgmt.azuredatatransfer.aio.operations.PipelinesOperations + :ivar list_schemas: ListSchemasOperations operations + :vartype list_schemas: azure.mgmt.azuredatatransfer.aio.operations.ListSchemasOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.azuredatatransfer.aio.operations.Operations + :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. The value must be an UUID. 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-10-11-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzuredatatransferrpConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.azure_data_transfer = AzureDataTransferOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flows = FlowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_pending_connections = ListPendingConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.list_pending_flows = ListPendingFlowsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.pipelines = PipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.list_schemas = ListSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "Azuredatatransferrp": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_configuration.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_configuration.py new file mode 100644 index 000000000000..780c41920e0f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzuredatatransferrpConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for Azuredatatransferrp. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-10-11-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(AzuredatatransferrpConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-10-11-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-azuredatatransfer/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_patch.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/__init__.py new file mode 100644 index 000000000000..e71291ad1eef --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/__init__.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. +# -------------------------------------------------------------------------- + +from ._azure_data_transfer_operations import AzureDataTransferOperations +from ._flows_operations import FlowsOperations +from ._connections_operations import ConnectionsOperations +from ._list_pending_connections_operations import ListPendingConnectionsOperations +from ._list_pending_flows_operations import ListPendingFlowsOperations +from ._pipelines_operations import PipelinesOperations +from ._list_schemas_operations import ListSchemasOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureDataTransferOperations", + "FlowsOperations", + "ConnectionsOperations", + "ListPendingConnectionsOperations", + "ListPendingFlowsOperations", + "PipelinesOperations", + "ListSchemasOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_azure_data_transfer_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_azure_data_transfer_operations.py new file mode 100644 index 000000000000..f21c84f5887f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_azure_data_transfer_operations.py @@ -0,0 +1,266 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._azure_data_transfer_operations import ( + build_list_approved_schemas_request, + build_validate_schema_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AzureDataTransferOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`azure_data_transfer` 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 validate_schema( + self, schema: _models.Schema, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema + :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: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_schema( + self, schema: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Required. + :type schema: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_schema(self, schema: Union[_models.Schema, IO], **kwargs: Any) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Is either a Schema type or a IO type. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ValidateSchemaResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(schema, (IOBase, bytes)): + _content = schema + else: + _json = self._serialize.body(schema, "Schema") + + request = build_validate_schema_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_schema.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("ValidateSchemaResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_schema.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/validateSchema"} + + @overload + async def list_approved_schemas( + self, pipeline: _models.ListApprovedSchemasRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasRequest + :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: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_approved_schemas( + self, pipeline: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Required. + :type pipeline: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_approved_schemas( + self, pipeline: Union[_models.ListApprovedSchemasRequest, IO], **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Is either a ListApprovedSchemasRequest + type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SchemasListResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "ListApprovedSchemasRequest") + + request = build_list_approved_schemas_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_approved_schemas.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("SchemasListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_approved_schemas.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/listApprovedSchemas"} diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_connections_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_connections_operations.py new file mode 100644 index 000000000000..6abc29080ac0 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_connections_operations.py @@ -0,0 +1,1089 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_link_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`connections` 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_async + async def get(self, resource_group_name: str, connection_name: str, **kwargs: Any) -> _models.Connection: + """Gets connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Connection or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Connection + :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.Connection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_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) + + _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("Connection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, connection_name: str, connection: Union[_models.Connection, IO], **kwargs: Any + ) -> _models.Connection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "Connection") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Connection", pipeline_response) + + 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.AzureDataTransfer/connections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + connection: _models.Connection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.Connection + :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 Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, connection_name: str, connection: Union[_models.Connection, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a Connection type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.Connection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, connection_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, + connection_name=connection_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, connection_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_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, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + connection_name: str, + connection: Union[_models.ConnectionsPatch, IO], + **kwargs: Any + ) -> _models.Connection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ConnectionsPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Connection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: _models.ConnectionsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ConnectionsPatch + :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 Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: Union[_models.ConnectionsPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a ConnectionsPatch type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ConnectionsPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + async def _link_initial( + self, resource_group_name: str, connection_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_link_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/link" + } + + @overload + async def begin_link( + self, + resource_group_name: str, + connection_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_link( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_link( + self, resource_group_name: str, connection_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._link_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/link" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Connection"]: + """Gets connections in a resource group. + + :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 Connection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.Connection] + :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.ConnectionsListResult] = 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, + 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("ConnectionsListResult", 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.AzureDataTransfer/connections" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connection"]: + """Gets connections in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Connection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.Connection] + :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.ConnectionsListResult] = 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, + 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("ConnectionsListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/connections" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_flows_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_flows_operations.py new file mode 100644 index 000000000000..f91250c058ce --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_flows_operations.py @@ -0,0 +1,1326 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._flows_operations import ( + build_create_or_update_request, + build_delete_request, + build_disable_request, + build_enable_request, + build_get_request, + build_link_request, + build_list_by_connection_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FlowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`flows` 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_async + async def get(self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any) -> _models.Flow: + """Gets flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Flow or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Flow + :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.Flow] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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 = 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("Flow", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.Flow, IO], + **kwargs: Any + ) -> _models.Flow: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "Flow") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Flow", pipeline_response) + + 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.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.Flow, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.Flow + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.Flow, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a Flow type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.Flow or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, connection_name: str, flow_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, + connection_name=connection_name, + flow_name=flow_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_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, + connection_name=connection_name, + flow_name=flow_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + async def _update_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.FlowsPatch, IO], + **kwargs: Any + ) -> _models.Flow: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "FlowsPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Flow", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.FlowsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.FlowsPatch + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.FlowsPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a FlowsPatch type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.FlowsPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + async def _enable_initial( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> Optional[_models.Flow]: + 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[Optional[_models.Flow]] = kwargs.pop("cls", None) + + request = build_enable_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _enable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/enable" + } + + @distributed_trace_async + async def begin_enable( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Enables the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._enable_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/enable" + } + + async def _disable_initial( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> Optional[_models.Flow]: + 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[Optional[_models.Flow]] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/disable" + } + + @distributed_trace_async + async def begin_disable( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Disables the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._disable_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/disable" + } + + async def _link_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.ResourceBody, IO], + **kwargs: Any + ) -> Optional[_models.Flow]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "ResourceBody") + + request = build_link_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/link" + } + + @overload + async def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.ResourceBody, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a ResourceBody type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.ResourceBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Flow or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._link_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/link" + } + + @distributed_trace + def list_by_connection( + self, resource_group_name: str, connection_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Flow"]: + """Gets flows in a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Flow or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.Flow] + :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.FlowsListResult] = 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_connection_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_connection.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("FlowsListResult", 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_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_connections_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_connections_operations.py new file mode 100644 index 000000000000..1ebd4baf2fde --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_connections_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._list_pending_connections_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ListPendingConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`list_pending_connections` 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, connection_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PendingConnection"]: + """Lists all pending connections for a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PendingConnection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.PendingConnection] + :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.PendingConnectionsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + 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("PendingConnectionsListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingConnections" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_flows_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_flows_operations.py new file mode 100644 index 000000000000..04ae3531341c --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_pending_flows_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._list_pending_flows_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ListPendingFlowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`list_pending_flows` 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, connection_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PendingFlow"]: + """Lists all pending flows for a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PendingFlow or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.PendingFlow] + :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.PendingFlowsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + 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("PendingFlowsListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingFlows" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_schemas_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_schemas_operations.py new file mode 100644 index 000000000000..57ad7edb54b4 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_list_schemas_operations.py @@ -0,0 +1,190 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._list_schemas_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ListSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`list_schemas` 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 list( + self, + resource_group_name: str, + pipeline_name: str, + schema: _models.Schema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema + :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: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list( + self, + resource_group_name: str, + pipeline_name: str, + schema: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Required. + :type schema: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list( + self, resource_group_name: str, pipeline_name: str, schema: Union[_models.Schema, IO], **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Is either a Schema type or a IO type. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SchemasListResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(schema, (IOBase, bytes)): + _content = schema + else: + _json = self._serialize.body(schema, "Schema") + + request = build_list_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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("SchemasListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/listSchemas" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_operations.py new file mode 100644 index 000000000000..1b96009c6819 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all of the available Microsoft.AzureDataTransfer 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 Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/operations"} diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_patch.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_pipelines_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_pipelines_operations.py new file mode 100644 index 000000000000..08ccf4c50386 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/aio/operations/_pipelines_operations.py @@ -0,0 +1,1301 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._pipelines_operations import ( + build_approve_connection_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_reject_connection_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PipelinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.aio.Azuredatatransferrp`'s + :attr:`pipelines` 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_async + async def get(self, resource_group_name: str, pipeline_name: str, **kwargs: Any) -> _models.Pipeline: + """Gets pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pipeline or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Pipeline + :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.Pipeline] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_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 = 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("Pipeline", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.Pipeline, IO], **kwargs: Any + ) -> _models.Pipeline: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pipeline] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "Pipeline") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Pipeline", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Pipeline", pipeline_response) + + 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.AzureDataTransfer/pipelines/{pipelineName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: _models.Pipeline, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.Pipeline + :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 Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.Pipeline, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Is either a Pipeline type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.Pipeline or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.Pipeline] = 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, + pipeline_name=pipeline_name, + pipeline=pipeline, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pipeline", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pipeline_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, + pipeline_name=pipeline_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, pipeline_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_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, + pipeline_name=pipeline_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + async def _update_initial( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.PipelinesPatch, IO], **kwargs: Any + ) -> _models.Pipeline: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pipeline] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "PipelinesPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Pipeline", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Pipeline", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: _models.PipelinesPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.PipelinesPatch + :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 Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.PipelinesPatch, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Is either a PipelinesPatch type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.PipelinesPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pipeline or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.Pipeline] = 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, + pipeline_name=pipeline_name, + pipeline=pipeline, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pipeline", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + async def _approve_connection_initial( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_approve_connection_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._approve_connection_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _approve_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/approveConnection" + } + + @overload + async def begin_approve_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_approve_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_approve_connection( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._approve_connection_initial( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_approve_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/approveConnection" + } + + async def _reject_connection_initial( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_reject_connection_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reject_connection_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _reject_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/rejectConnection" + } + + @overload + async def begin_reject_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reject_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reject_connection( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Connection or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._reject_connection_initial( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reject_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/rejectConnection" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Pipeline"]: + """Gets pipelines in a resource group. + + :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 Pipeline or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.PipelinesListResult] = 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, + 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("PipelinesListResult", 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.AzureDataTransfer/pipelines" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Pipeline"]: + """Gets pipelines in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pipeline or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.PipelinesListResult] = 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, + 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("PipelinesListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/pipelines" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/__init__.py new file mode 100644 index 000000000000..c40106134d53 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/__init__.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. +# -------------------------------------------------------------------------- + +from ._models_py3 import Connection +from ._models_py3 import ConnectionProperties +from ._models_py3 import ConnectionsListResult +from ._models_py3 import ConnectionsPatch +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Flow +from ._models_py3 import FlowProperties +from ._models_py3 import FlowsListResult +from ._models_py3 import FlowsPatch +from ._models_py3 import InternalMetadataProperties +from ._models_py3 import ListApprovedSchemasRequest +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusProperties +from ._models_py3 import PendingConnection +from ._models_py3 import PendingConnectionsListResult +from ._models_py3 import PendingFlow +from ._models_py3 import PendingFlowsListResult +from ._models_py3 import Pipeline +from ._models_py3 import PipelineConnection +from ._models_py3 import PipelineConnectionProperties +from ._models_py3 import PipelineProperties +from ._models_py3 import PipelinesListResult +from ._models_py3 import PipelinesPatch +from ._models_py3 import PipelinesPatchProperties +from ._models_py3 import Plan +from ._models_py3 import Resource +from ._models_py3 import ResourceBody +from ._models_py3 import Schema +from ._models_py3 import SchemasListResult +from ._models_py3 import SelectedResource +from ._models_py3 import Subscriber +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import ValidateSchemaResult + +from ._azuredatatransferrp_enums import ActionType +from ._azuredatatransferrp_enums import CreatedByType +from ._azuredatatransferrp_enums import DataType +from ._azuredatatransferrp_enums import Direction +from ._azuredatatransferrp_enums import FlowStatus +from ._azuredatatransferrp_enums import FlowType +from ._azuredatatransferrp_enums import LinkStatus +from ._azuredatatransferrp_enums import LinkStatusFlow +from ._azuredatatransferrp_enums import ListApprovedSchemasDirection +from ._azuredatatransferrp_enums import ManagedServiceIdentityType +from ._azuredatatransferrp_enums import OperationStatusEnum +from ._azuredatatransferrp_enums import Origin +from ._azuredatatransferrp_enums import ProvisioningState +from ._azuredatatransferrp_enums import SchemaStatus +from ._azuredatatransferrp_enums import Status +from ._azuredatatransferrp_enums import ValidateSchemaStatus +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Connection", + "ConnectionProperties", + "ConnectionsListResult", + "ConnectionsPatch", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "Flow", + "FlowProperties", + "FlowsListResult", + "FlowsPatch", + "InternalMetadataProperties", + "ListApprovedSchemasRequest", + "ManagedServiceIdentity", + "Operation", + "OperationDisplay", + "OperationListResult", + "OperationStatusProperties", + "PendingConnection", + "PendingConnectionsListResult", + "PendingFlow", + "PendingFlowsListResult", + "Pipeline", + "PipelineConnection", + "PipelineConnectionProperties", + "PipelineProperties", + "PipelinesListResult", + "PipelinesPatch", + "PipelinesPatchProperties", + "Plan", + "Resource", + "ResourceBody", + "Schema", + "SchemasListResult", + "SelectedResource", + "Subscriber", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "ValidateSchemaResult", + "ActionType", + "CreatedByType", + "DataType", + "Direction", + "FlowStatus", + "FlowType", + "LinkStatus", + "LinkStatusFlow", + "ListApprovedSchemasDirection", + "ManagedServiceIdentityType", + "OperationStatusEnum", + "Origin", + "ProvisioningState", + "SchemaStatus", + "Status", + "ValidateSchemaStatus", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_azuredatatransferrp_enums.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_azuredatatransferrp_enums.py new file mode 100644 index 000000000000..7fe7f64ab6ef --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_azuredatatransferrp_enums.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transfer Storage Blobs or Tables.""" + + BLOB = "Blob" + TABLE = "Table" + + +class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction of data movement.""" + + SEND = "Send" + RECEIVE = "Receive" + + +class FlowStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the current flow.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Flow type for the specified resource.""" + + UNKNOWN = "Unknown" + COMPLEX = "Complex" + DEV_SEC_OPS = "DevSecOps" + MESSAGING = "Messaging" + MISSION = "Mission" + MICROSOFT_INTERNAL = "MicrosoftInternal" + BASIC_FILES = "BasicFiles" + DATA = "Data" + + +class LinkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Link status of the current connection.""" + + LINKED = "Linked" + UNLINKED = "Unlinked" + + +class LinkStatusFlow(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Link status of the current flow.""" + + LINKED = "Linked" + UNLINKED = "Unlinked" + + +class ListApprovedSchemasDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The direction pipeline to filter approved schemas.""" + + SEND = "Send" + RECEIVE = "Receive" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class OperationStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operation status for the last patch request for this connection.""" + + FAILED = "Failed" + SUCCEEDED = "Succeeded" + + +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the flow.""" + + FAILED = "Failed" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + ACCEPTED = "Accepted" + + +class SchemaStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the schema.""" + + NEW = "New" + APPROVED = "Approved" + + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the connection.""" + + IN_REVIEW = "InReview" + APPROVED = "Approved" + REJECTED = "Rejected" + ACCEPTED = "Accepted" + + +class ValidateSchemaStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Validation status of the schema.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_models_py3.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_models_py3.py new file mode 100644 index 000000000000..a215a4457221 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_models_py3.py @@ -0,0 +1,2174 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.azuredatatransfer.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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. E.g. + "/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.azuredatatransfer.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Connection(TrackedResource): + """The connection resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.azuredatatransfer.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 properties: Properties of connection. + :vartype properties: ~azure.mgmt.azuredatatransfer.models.ConnectionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "ConnectionProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ConnectionProperties"] = 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 properties: Properties of connection. + :paramtype properties: ~azure.mgmt.azuredatatransfer.models.ConnectionProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ConnectionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties of connection. + + 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 pipeline: Pipeline to use to transfer data. Required. + :vartype pipeline: str + :ivar direction: Direction of data movement. Known values are: "Send" and "Receive". + :vartype direction: str or ~azure.mgmt.azuredatatransfer.models.Direction + :ivar justification: Justification for the connection request. + :vartype justification: str + :ivar status: Status of the connection. Known values are: "InReview", "Approved", "Rejected", + and "Accepted". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.Status + :ivar status_reason: Reason for status. + :vartype status_reason: str + :ivar link_status: Link status of the current connection. Known values are: "Linked" and + "Unlinked". + :vartype link_status: str or ~azure.mgmt.azuredatatransfer.models.LinkStatus + :ivar linked_connection_id: Resource ID of the linked connection. + :vartype linked_connection_id: str + :ivar flow_types: The flow types being requested for this connection. + :vartype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + :ivar requirement_id: Requirement ID of the connection. + :vartype requirement_id: str + :ivar remote_subscription_id: Subscription ID to link cloud subscriptions together. + :vartype remote_subscription_id: str + :ivar approver: Approver of this connection request. + :vartype approver: str + :ivar pin: PIN to link requests together. + :vartype pin: str + :ivar date_submitted: The timestamp that this connection request was submitted at. + :vartype date_submitted: ~datetime.datetime + :ivar primary_contact: The primary contact for this connection request. + :vartype primary_contact: str + :ivar secondary_contacts: The secondary contacts for this connection request. + :vartype secondary_contacts: list[str] + :ivar provisioning_state: Provisioning state of the connection. Known values are: "Failed", + "Succeeded", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azuredatatransfer.models.ProvisioningState + :ivar policies: The policies for this connection. + :vartype policies: list[str] + :ivar schemas: The schemas for this connection. + :vartype schemas: list[~azure.mgmt.azuredatatransfer.models.Schema] + """ + + _validation = { + "pipeline": {"required": True}, + "status": {"readonly": True}, + "status_reason": {"readonly": True}, + "link_status": {"readonly": True}, + "linked_connection_id": {"readonly": True}, + "approver": {"readonly": True}, + "date_submitted": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "pipeline": {"key": "pipeline", "type": "str"}, + "direction": {"key": "direction", "type": "str"}, + "justification": {"key": "justification", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "status_reason": {"key": "statusReason", "type": "str"}, + "link_status": {"key": "linkStatus", "type": "str"}, + "linked_connection_id": {"key": "linkedConnectionId", "type": "str"}, + "flow_types": {"key": "flowTypes", "type": "[str]"}, + "requirement_id": {"key": "requirementId", "type": "str"}, + "remote_subscription_id": {"key": "remoteSubscriptionId", "type": "str"}, + "approver": {"key": "approver", "type": "str"}, + "pin": {"key": "pin", "type": "str"}, + "date_submitted": {"key": "dateSubmitted", "type": "iso-8601"}, + "primary_contact": {"key": "primaryContact", "type": "str"}, + "secondary_contacts": {"key": "secondaryContacts", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "policies": {"key": "policies", "type": "[str]"}, + "schemas": {"key": "schemas", "type": "[Schema]"}, + } + + def __init__( + self, + *, + pipeline: str, + direction: Optional[Union[str, "_models.Direction"]] = None, + justification: Optional[str] = None, + flow_types: Optional[List[Union[str, "_models.FlowType"]]] = None, + requirement_id: Optional[str] = None, + remote_subscription_id: Optional[str] = None, + pin: Optional[str] = None, + primary_contact: Optional[str] = None, + secondary_contacts: Optional[List[str]] = None, + policies: Optional[List[str]] = None, + schemas: Optional[List["_models.Schema"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword pipeline: Pipeline to use to transfer data. Required. + :paramtype pipeline: str + :keyword direction: Direction of data movement. Known values are: "Send" and "Receive". + :paramtype direction: str or ~azure.mgmt.azuredatatransfer.models.Direction + :keyword justification: Justification for the connection request. + :paramtype justification: str + :keyword flow_types: The flow types being requested for this connection. + :paramtype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + :keyword requirement_id: Requirement ID of the connection. + :paramtype requirement_id: str + :keyword remote_subscription_id: Subscription ID to link cloud subscriptions together. + :paramtype remote_subscription_id: str + :keyword pin: PIN to link requests together. + :paramtype pin: str + :keyword primary_contact: The primary contact for this connection request. + :paramtype primary_contact: str + :keyword secondary_contacts: The secondary contacts for this connection request. + :paramtype secondary_contacts: list[str] + :keyword policies: The policies for this connection. + :paramtype policies: list[str] + :keyword schemas: The schemas for this connection. + :paramtype schemas: list[~azure.mgmt.azuredatatransfer.models.Schema] + """ + super().__init__(**kwargs) + self.pipeline = pipeline + self.direction = direction + self.justification = justification + self.status = None + self.status_reason = None + self.link_status = None + self.linked_connection_id = None + self.flow_types = flow_types + self.requirement_id = requirement_id + self.remote_subscription_id = remote_subscription_id + self.approver = None + self.pin = pin + self.date_submitted = None + self.primary_contact = primary_contact + self.secondary_contacts = secondary_contacts + self.provisioning_state = None + self.policies = policies + self.schemas = schemas + + +class ConnectionsListResult(_serialization.Model): + """The connections list result. + + :ivar value: Connections array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.Connection] + :ivar next_link: Link to next results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Connection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Connection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Connections array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.Connection] + :keyword next_link: Link to next results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConnectionsPatch(_serialization.Model): + """The connections resource patch definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 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.azuredatatransfer.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.azuredatatransfer.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.azuredatatransfer.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.azuredatatransfer.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class Flow(TrackedResource): + """The flow resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.azuredatatransfer.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 properties: Properties of flow. + :vartype properties: ~azure.mgmt.azuredatatransfer.models.FlowProperties + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.azuredatatransfer.models.Plan + :ivar identity: The managed identity of the flow resource, if configured. + :vartype identity: ~azure.mgmt.azuredatatransfer.models.ManagedServiceIdentity + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "FlowProperties"}, + "plan": {"key": "plan", "type": "Plan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.FlowProperties"] = None, + plan: Optional["_models.Plan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = 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 properties: Properties of flow. + :paramtype properties: ~azure.mgmt.azuredatatransfer.models.FlowProperties + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.azuredatatransfer.models.Plan + :keyword identity: The managed identity of the flow resource, if configured. + :paramtype identity: ~azure.mgmt.azuredatatransfer.models.ManagedServiceIdentity + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.plan = plan + self.identity = identity + + +class FlowProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties of flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar connection: The connection associated with this flow. + :vartype connection: ~azure.mgmt.azuredatatransfer.models.SelectedResource + :ivar flow_id: Dataflow GUID associated with this flow. + :vartype flow_id: str + :ivar key_vault_uri: AME, PME, or TORUS only! AKV Chain Containing SAS Token. + :vartype key_vault_uri: str + :ivar link_status: Link status of the current flow. Known values are: "Linked" and "Unlinked". + :vartype link_status: str or ~azure.mgmt.azuredatatransfer.models.LinkStatusFlow + :ivar linked_flow_id: Resource ID of the linked flow. + :vartype linked_flow_id: str + :ivar status: Status of the current flow. Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.FlowStatus + :ivar storage_account_name: Storage Account. + :vartype storage_account_name: str + :ivar storage_account_id: Storage Account ID. + :vartype storage_account_id: str + :ivar storage_container_name: Storage Container Name. + :vartype storage_container_name: str + :ivar service_bus_queue_id: Service Bus Queue ID. + :vartype service_bus_queue_id: str + :ivar flow_type: The flow type for this flow. Known values are: "Unknown", "Complex", + "DevSecOps", "Messaging", "Mission", "MicrosoftInternal", "BasicFiles", and "Data". + :vartype flow_type: str or ~azure.mgmt.azuredatatransfer.models.FlowType + :ivar data_type: Transfer Storage Blobs or Tables. Known values are: "Blob" and "Table". + :vartype data_type: str or ~azure.mgmt.azuredatatransfer.models.DataType + :ivar provisioning_state: Provisioning state of the flow. Known values are: "Failed", + "Succeeded", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azuredatatransfer.models.ProvisioningState + :ivar policies: The policies for this flow. + :vartype policies: list[str] + :ivar schema: The selected schema for this flow. + :vartype schema: ~azure.mgmt.azuredatatransfer.models.Schema + """ + + _validation = { + "flow_id": {"readonly": True}, + "link_status": {"readonly": True}, + "linked_flow_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "connection": {"key": "connection", "type": "SelectedResource"}, + "flow_id": {"key": "flowId", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "link_status": {"key": "linkStatus", "type": "str"}, + "linked_flow_id": {"key": "linkedFlowId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "storage_container_name": {"key": "storageContainerName", "type": "str"}, + "service_bus_queue_id": {"key": "serviceBusQueueId", "type": "str"}, + "flow_type": {"key": "flowType", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "policies": {"key": "policies", "type": "[str]"}, + "schema": {"key": "schema", "type": "Schema"}, + } + + def __init__( + self, + *, + connection: Optional["_models.SelectedResource"] = None, + key_vault_uri: Optional[str] = None, + status: Optional[Union[str, "_models.FlowStatus"]] = None, + storage_account_name: Optional[str] = None, + storage_account_id: Optional[str] = None, + storage_container_name: Optional[str] = None, + service_bus_queue_id: Optional[str] = None, + flow_type: Optional[Union[str, "_models.FlowType"]] = None, + data_type: Optional[Union[str, "_models.DataType"]] = None, + policies: Optional[List[str]] = None, + schema: Optional["_models.Schema"] = None, + **kwargs: Any + ) -> None: + """ + :keyword connection: The connection associated with this flow. + :paramtype connection: ~azure.mgmt.azuredatatransfer.models.SelectedResource + :keyword key_vault_uri: AME, PME, or TORUS only! AKV Chain Containing SAS Token. + :paramtype key_vault_uri: str + :keyword status: Status of the current flow. Known values are: "Enabled" and "Disabled". + :paramtype status: str or ~azure.mgmt.azuredatatransfer.models.FlowStatus + :keyword storage_account_name: Storage Account. + :paramtype storage_account_name: str + :keyword storage_account_id: Storage Account ID. + :paramtype storage_account_id: str + :keyword storage_container_name: Storage Container Name. + :paramtype storage_container_name: str + :keyword service_bus_queue_id: Service Bus Queue ID. + :paramtype service_bus_queue_id: str + :keyword flow_type: The flow type for this flow. Known values are: "Unknown", "Complex", + "DevSecOps", "Messaging", "Mission", "MicrosoftInternal", "BasicFiles", and "Data". + :paramtype flow_type: str or ~azure.mgmt.azuredatatransfer.models.FlowType + :keyword data_type: Transfer Storage Blobs or Tables. Known values are: "Blob" and "Table". + :paramtype data_type: str or ~azure.mgmt.azuredatatransfer.models.DataType + :keyword policies: The policies for this flow. + :paramtype policies: list[str] + :keyword schema: The selected schema for this flow. + :paramtype schema: ~azure.mgmt.azuredatatransfer.models.Schema + """ + super().__init__(**kwargs) + self.connection = connection + self.flow_id = None + self.key_vault_uri = key_vault_uri + self.link_status = None + self.linked_flow_id = None + self.status = status + self.storage_account_name = storage_account_name + self.storage_account_id = storage_account_id + self.storage_container_name = storage_container_name + self.service_bus_queue_id = service_bus_queue_id + self.flow_type = flow_type + self.data_type = data_type + self.provisioning_state = None + self.policies = policies + self.schema = schema + + +class FlowsListResult(_serialization.Model): + """The flows list result. + + :ivar value: Flows array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.Flow] + :ivar next_link: Link to next results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Flow]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Flow"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Flows array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.Flow] + :keyword next_link: Link to next results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class FlowsPatch(_serialization.Model): + """The flows resource patch definition. + + :ivar identity: The managed identity of the flow resource, if configured. + :vartype identity: ~azure.mgmt.azuredatatransfer.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The managed identity of the flow resource, if configured. + :paramtype identity: ~azure.mgmt.azuredatatransfer.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + + +class InternalMetadataProperties(_serialization.Model): + """Internal metadata of the connection inside pipeline. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar operation_status: Operation status associated with the last patch request. + :vartype operation_status: ~azure.mgmt.azuredatatransfer.models.OperationStatusProperties + :ivar status_set_by: User that last set the approved status for this connection. + :vartype status_set_by: str + """ + + _validation = { + "status_set_by": {"readonly": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "operation_status": {"key": "operationStatus", "type": "OperationStatusProperties"}, + "status_set_by": {"key": "statusSetBy", "type": "str"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + operation_status: Optional["_models.OperationStatusProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword operation_status: Operation status associated with the last patch request. + :paramtype operation_status: ~azure.mgmt.azuredatatransfer.models.OperationStatusProperties + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.operation_status = operation_status + self.status_set_by = None + + +class ListApprovedSchemasRequest(_serialization.Model): + """ListApprovedSchemasRequest. + + :ivar pipeline: The name of the pipeline to filter approved schemas. + :vartype pipeline: str + :ivar direction: The direction pipeline to filter approved schemas. Known values are: "Send" + and "Receive". + :vartype direction: str or ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasDirection + """ + + _attribute_map = { + "pipeline": {"key": "pipeline", "type": "str"}, + "direction": {"key": "direction", "type": "str"}, + } + + def __init__( + self, + *, + pipeline: Optional[str] = None, + direction: Optional[Union[str, "_models.ListApprovedSchemasDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword pipeline: The name of the pipeline to filter approved schemas. + :paramtype pipeline: str + :keyword direction: The direction pipeline to filter approved schemas. Known values are: "Send" + and "Receive". + :paramtype direction: str or ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasDirection + """ + super().__init__(**kwargs) + self.pipeline = pipeline + self.direction = direction + + +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 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". + :vartype type: str or ~azure.mgmt.azuredatatransfer.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.azuredatatransfer.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.azuredatatransfer.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.azuredatatransfer.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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 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.azuredatatransfer.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.azuredatatransfer.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.azuredatatransfer.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.azuredatatransfer.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusProperties(_serialization.Model): + """Operation status associated with the last patch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Operation status for the last patch request for this connection. Known values + are: "Failed" and "Succeeded". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.OperationStatusEnum + :ivar id: Operation status ID of the last patch request for this connection. + :vartype id: str + :ivar message: Message for the operation for the last patch request for this connection. + :vartype message: str + """ + + _validation = { + "status": {"readonly": True}, + "id": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.id = None + self.message = None + + +class PendingConnection(ConnectionProperties, TrackedResource): # pylint: disable=too-many-instance-attributes + """Pending connection object. + + 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. E.g. + "/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.azuredatatransfer.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 pipeline: Pipeline to use to transfer data. Required. + :vartype pipeline: str + :ivar direction: Direction of data movement. Known values are: "Send" and "Receive". + :vartype direction: str or ~azure.mgmt.azuredatatransfer.models.Direction + :ivar justification: Justification for the connection request. + :vartype justification: str + :ivar status: Status of the connection. Known values are: "InReview", "Approved", "Rejected", + and "Accepted". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.Status + :ivar status_reason: Reason for status. + :vartype status_reason: str + :ivar link_status: Link status of the current connection. Known values are: "Linked" and + "Unlinked". + :vartype link_status: str or ~azure.mgmt.azuredatatransfer.models.LinkStatus + :ivar linked_connection_id: Resource ID of the linked connection. + :vartype linked_connection_id: str + :ivar flow_types: The flow types being requested for this connection. + :vartype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + :ivar requirement_id: Requirement ID of the connection. + :vartype requirement_id: str + :ivar remote_subscription_id: Subscription ID to link cloud subscriptions together. + :vartype remote_subscription_id: str + :ivar approver: Approver of this connection request. + :vartype approver: str + :ivar pin: PIN to link requests together. + :vartype pin: str + :ivar date_submitted: The timestamp that this connection request was submitted at. + :vartype date_submitted: ~datetime.datetime + :ivar primary_contact: The primary contact for this connection request. + :vartype primary_contact: str + :ivar secondary_contacts: The secondary contacts for this connection request. + :vartype secondary_contacts: list[str] + :ivar provisioning_state: Provisioning state of the connection. Known values are: "Failed", + "Succeeded", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azuredatatransfer.models.ProvisioningState + :ivar policies: The policies for this connection. + :vartype policies: list[str] + :ivar schemas: The schemas for this connection. + :vartype schemas: list[~azure.mgmt.azuredatatransfer.models.Schema] + :ivar subscription_id: Subscription ID of the pending connection. + :vartype subscription_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "pipeline": {"required": True}, + "status": {"readonly": True}, + "status_reason": {"readonly": True}, + "link_status": {"readonly": True}, + "linked_connection_id": {"readonly": True}, + "approver": {"readonly": True}, + "date_submitted": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "subscription_id": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "pipeline": {"key": "pipeline", "type": "str"}, + "direction": {"key": "direction", "type": "str"}, + "justification": {"key": "justification", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "status_reason": {"key": "statusReason", "type": "str"}, + "link_status": {"key": "linkStatus", "type": "str"}, + "linked_connection_id": {"key": "linkedConnectionId", "type": "str"}, + "flow_types": {"key": "flowTypes", "type": "[str]"}, + "requirement_id": {"key": "requirementId", "type": "str"}, + "remote_subscription_id": {"key": "remoteSubscriptionId", "type": "str"}, + "approver": {"key": "approver", "type": "str"}, + "pin": {"key": "pin", "type": "str"}, + "date_submitted": {"key": "dateSubmitted", "type": "iso-8601"}, + "primary_contact": {"key": "primaryContact", "type": "str"}, + "secondary_contacts": {"key": "secondaryContacts", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "policies": {"key": "policies", "type": "[str]"}, + "schemas": {"key": "schemas", "type": "[Schema]"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + pipeline: str, + tags: Optional[Dict[str, str]] = None, + direction: Optional[Union[str, "_models.Direction"]] = None, + justification: Optional[str] = None, + flow_types: Optional[List[Union[str, "_models.FlowType"]]] = None, + requirement_id: Optional[str] = None, + remote_subscription_id: Optional[str] = None, + pin: Optional[str] = None, + primary_contact: Optional[str] = None, + secondary_contacts: Optional[List[str]] = None, + policies: Optional[List[str]] = None, + schemas: Optional[List["_models.Schema"]] = 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 pipeline: Pipeline to use to transfer data. Required. + :paramtype pipeline: str + :keyword direction: Direction of data movement. Known values are: "Send" and "Receive". + :paramtype direction: str or ~azure.mgmt.azuredatatransfer.models.Direction + :keyword justification: Justification for the connection request. + :paramtype justification: str + :keyword flow_types: The flow types being requested for this connection. + :paramtype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + :keyword requirement_id: Requirement ID of the connection. + :paramtype requirement_id: str + :keyword remote_subscription_id: Subscription ID to link cloud subscriptions together. + :paramtype remote_subscription_id: str + :keyword pin: PIN to link requests together. + :paramtype pin: str + :keyword primary_contact: The primary contact for this connection request. + :paramtype primary_contact: str + :keyword secondary_contacts: The secondary contacts for this connection request. + :paramtype secondary_contacts: list[str] + :keyword policies: The policies for this connection. + :paramtype policies: list[str] + :keyword schemas: The schemas for this connection. + :paramtype schemas: list[~azure.mgmt.azuredatatransfer.models.Schema] + """ + super().__init__( + pipeline=pipeline, + direction=direction, + justification=justification, + flow_types=flow_types, + requirement_id=requirement_id, + remote_subscription_id=remote_subscription_id, + pin=pin, + primary_contact=primary_contact, + secondary_contacts=secondary_contacts, + policies=policies, + schemas=schemas, + tags=tags, + location=location, + **kwargs + ) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.tags = tags + self.location = location + self.subscription_id = None + self.pipeline = pipeline + self.direction = direction + self.justification = justification + self.status = None + self.status_reason = None + self.link_status = None + self.linked_connection_id = None + self.flow_types = flow_types + self.requirement_id = requirement_id + self.remote_subscription_id = remote_subscription_id + self.approver = None + self.pin = pin + self.date_submitted = None + self.primary_contact = primary_contact + self.secondary_contacts = secondary_contacts + self.provisioning_state = None + self.policies = policies + self.schemas = schemas + + +class PendingConnectionsListResult(_serialization.Model): + """The connections list result. + + :ivar value: Connections array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.PendingConnection] + :ivar next_link: Link to next results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PendingConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PendingConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Connections array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.PendingConnection] + :keyword next_link: Link to next results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PendingFlow(FlowProperties, TrackedResource): # pylint: disable=too-many-instance-attributes + """Pending flow object. + + 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. E.g. + "/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.azuredatatransfer.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 connection: The connection associated with this flow. + :vartype connection: ~azure.mgmt.azuredatatransfer.models.SelectedResource + :ivar flow_id: Dataflow GUID associated with this flow. + :vartype flow_id: str + :ivar key_vault_uri: AME, PME, or TORUS only! AKV Chain Containing SAS Token. + :vartype key_vault_uri: str + :ivar link_status: Link status of the current flow. Known values are: "Linked" and "Unlinked". + :vartype link_status: str or ~azure.mgmt.azuredatatransfer.models.LinkStatusFlow + :ivar linked_flow_id: Resource ID of the linked flow. + :vartype linked_flow_id: str + :ivar status: Status of the current flow. Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.FlowStatus + :ivar storage_account_name: Storage Account. + :vartype storage_account_name: str + :ivar storage_account_id: Storage Account ID. + :vartype storage_account_id: str + :ivar storage_container_name: Storage Container Name. + :vartype storage_container_name: str + :ivar service_bus_queue_id: Service Bus Queue ID. + :vartype service_bus_queue_id: str + :ivar flow_type: The flow type for this flow. Known values are: "Unknown", "Complex", + "DevSecOps", "Messaging", "Mission", "MicrosoftInternal", "BasicFiles", and "Data". + :vartype flow_type: str or ~azure.mgmt.azuredatatransfer.models.FlowType + :ivar data_type: Transfer Storage Blobs or Tables. Known values are: "Blob" and "Table". + :vartype data_type: str or ~azure.mgmt.azuredatatransfer.models.DataType + :ivar provisioning_state: Provisioning state of the flow. Known values are: "Failed", + "Succeeded", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azuredatatransfer.models.ProvisioningState + :ivar policies: The policies for this flow. + :vartype policies: list[str] + :ivar schema: The selected schema for this flow. + :vartype schema: ~azure.mgmt.azuredatatransfer.models.Schema + :ivar subscription_id: Subscription ID of the pending flow. + :vartype subscription_id: str + :ivar connection_id: Connection ID of the pending flow. + :vartype connection_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "flow_id": {"readonly": True}, + "link_status": {"readonly": True}, + "linked_flow_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "subscription_id": {"readonly": True}, + "connection_id": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "connection": {"key": "connection", "type": "SelectedResource"}, + "flow_id": {"key": "flowId", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "link_status": {"key": "linkStatus", "type": "str"}, + "linked_flow_id": {"key": "linkedFlowId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "storage_container_name": {"key": "storageContainerName", "type": "str"}, + "service_bus_queue_id": {"key": "serviceBusQueueId", "type": "str"}, + "flow_type": {"key": "flowType", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "policies": {"key": "policies", "type": "[str]"}, + "schema": {"key": "schema", "type": "Schema"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "connection_id": {"key": "connectionId", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + connection: Optional["_models.SelectedResource"] = None, + key_vault_uri: Optional[str] = None, + status: Optional[Union[str, "_models.FlowStatus"]] = None, + storage_account_name: Optional[str] = None, + storage_account_id: Optional[str] = None, + storage_container_name: Optional[str] = None, + service_bus_queue_id: Optional[str] = None, + flow_type: Optional[Union[str, "_models.FlowType"]] = None, + data_type: Optional[Union[str, "_models.DataType"]] = None, + policies: Optional[List[str]] = None, + schema: Optional["_models.Schema"] = 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 connection: The connection associated with this flow. + :paramtype connection: ~azure.mgmt.azuredatatransfer.models.SelectedResource + :keyword key_vault_uri: AME, PME, or TORUS only! AKV Chain Containing SAS Token. + :paramtype key_vault_uri: str + :keyword status: Status of the current flow. Known values are: "Enabled" and "Disabled". + :paramtype status: str or ~azure.mgmt.azuredatatransfer.models.FlowStatus + :keyword storage_account_name: Storage Account. + :paramtype storage_account_name: str + :keyword storage_account_id: Storage Account ID. + :paramtype storage_account_id: str + :keyword storage_container_name: Storage Container Name. + :paramtype storage_container_name: str + :keyword service_bus_queue_id: Service Bus Queue ID. + :paramtype service_bus_queue_id: str + :keyword flow_type: The flow type for this flow. Known values are: "Unknown", "Complex", + "DevSecOps", "Messaging", "Mission", "MicrosoftInternal", "BasicFiles", and "Data". + :paramtype flow_type: str or ~azure.mgmt.azuredatatransfer.models.FlowType + :keyword data_type: Transfer Storage Blobs or Tables. Known values are: "Blob" and "Table". + :paramtype data_type: str or ~azure.mgmt.azuredatatransfer.models.DataType + :keyword policies: The policies for this flow. + :paramtype policies: list[str] + :keyword schema: The selected schema for this flow. + :paramtype schema: ~azure.mgmt.azuredatatransfer.models.Schema + """ + super().__init__( + connection=connection, + key_vault_uri=key_vault_uri, + status=status, + storage_account_name=storage_account_name, + storage_account_id=storage_account_id, + storage_container_name=storage_container_name, + service_bus_queue_id=service_bus_queue_id, + flow_type=flow_type, + data_type=data_type, + policies=policies, + schema=schema, + tags=tags, + location=location, + **kwargs + ) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.tags = tags + self.location = location + self.subscription_id = None + self.connection_id = None + self.connection = connection + self.flow_id = None + self.key_vault_uri = key_vault_uri + self.link_status = None + self.linked_flow_id = None + self.status = status + self.storage_account_name = storage_account_name + self.storage_account_id = storage_account_id + self.storage_container_name = storage_container_name + self.service_bus_queue_id = service_bus_queue_id + self.flow_type = flow_type + self.data_type = data_type + self.provisioning_state = None + self.policies = policies + self.schema = schema + + +class PendingFlowsListResult(_serialization.Model): + """The connections list result. + + :ivar value: flows array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.PendingFlow] + :ivar next_link: Link to next results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PendingFlow]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.PendingFlow"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: flows array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.PendingFlow] + :keyword next_link: Link to next results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Pipeline(TrackedResource): + """The pipeline resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.azuredatatransfer.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 properties: Properties of pipeline. + :vartype properties: ~azure.mgmt.azuredatatransfer.models.PipelineProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "PipelineProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PipelineProperties"] = 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 properties: Properties of pipeline. + :paramtype properties: ~azure.mgmt.azuredatatransfer.models.PipelineProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class PipelineConnection(_serialization.Model): + """Connection body inside a pipeline. + + 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 additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar id: Connection id inside pipeline. Required. + :vartype id: str + :ivar name: Connection name inside pipeline. + :vartype name: str + :ivar type: Connection type inside pipeline. + :vartype type: str + :ivar location: Connection location inside pipeline. + :vartype location: str + :ivar etag: Connection etag inside pipeline. + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azuredatatransfer.models.SystemData + :ivar properties: Connection properties inside pipeline. + :vartype properties: ~azure.mgmt.azuredatatransfer.models.PipelineConnectionProperties + """ + + _validation = { + "id": {"required": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PipelineConnectionProperties"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + additional_properties: Optional[Dict[str, Any]] = None, + properties: Optional["_models.PipelineConnectionProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword id: Connection id inside pipeline. Required. + :paramtype id: str + :keyword properties: Connection properties inside pipeline. + :paramtype properties: ~azure.mgmt.azuredatatransfer.models.PipelineConnectionProperties + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.id = id + self.name = None + self.type = None + self.location = None + self.etag = None + self.system_data = None + self.properties = properties + + +class PipelineConnectionProperties(_serialization.Model): + """Connection properties inside pipeline. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar internal_metadata: Internal metadata of the connection inside pipeline. + :vartype internal_metadata: ~azure.mgmt.azuredatatransfer.models.InternalMetadataProperties + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "internal_metadata": {"key": "internalMetadata", "type": "InternalMetadataProperties"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + internal_metadata: Optional["_models.InternalMetadataProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword internal_metadata: Internal metadata of the connection inside pipeline. + :paramtype internal_metadata: ~azure.mgmt.azuredatatransfer.models.InternalMetadataProperties + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.internal_metadata = internal_metadata + + +class PipelineProperties(_serialization.Model): + """Properties of pipeline. + + 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 remote_cloud: Remote cloud of the data to be transferred or received. Required. + :vartype remote_cloud: str + :ivar display_name: Display name of this pipeline. + :vartype display_name: str + :ivar connections: Connections associated with pipeline. + :vartype connections: list[~azure.mgmt.azuredatatransfer.models.PipelineConnection] + :ivar subscribers: Subscribers of this resource. + :vartype subscribers: list[~azure.mgmt.azuredatatransfer.models.Subscriber] + :ivar provisioning_state: Provisioning state of the pipeline. Known values are: "Failed", + "Succeeded", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azuredatatransfer.models.ProvisioningState + :ivar policies: The policies for this pipeline. + :vartype policies: list[str] + :ivar flow_types: The flow types allowed for this pipeline. + :vartype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + """ + + _validation = { + "remote_cloud": {"required": True}, + "connections": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "remote_cloud": {"key": "remoteCloud", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "connections": {"key": "connections", "type": "[PipelineConnection]"}, + "subscribers": {"key": "subscribers", "type": "[Subscriber]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "policies": {"key": "policies", "type": "[str]"}, + "flow_types": {"key": "flowTypes", "type": "[str]"}, + } + + def __init__( + self, + *, + remote_cloud: str, + display_name: Optional[str] = None, + subscribers: Optional[List["_models.Subscriber"]] = None, + policies: Optional[List[str]] = None, + flow_types: Optional[List[Union[str, "_models.FlowType"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword remote_cloud: Remote cloud of the data to be transferred or received. Required. + :paramtype remote_cloud: str + :keyword display_name: Display name of this pipeline. + :paramtype display_name: str + :keyword subscribers: Subscribers of this resource. + :paramtype subscribers: list[~azure.mgmt.azuredatatransfer.models.Subscriber] + :keyword policies: The policies for this pipeline. + :paramtype policies: list[str] + :keyword flow_types: The flow types allowed for this pipeline. + :paramtype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + """ + super().__init__(**kwargs) + self.remote_cloud = remote_cloud + self.display_name = display_name + self.connections = None + self.subscribers = subscribers + self.provisioning_state = None + self.policies = policies + self.flow_types = flow_types + + +class PipelinesListResult(_serialization.Model): + """The pipelines list result. + + :ivar value: Pipelines array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.Pipeline] + :ivar next_link: Link to next results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Pipeline]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Pipeline"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Pipelines array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.Pipeline] + :keyword next_link: Link to next results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PipelinesPatch(_serialization.Model): + """The pipelines resource patch definition. + + :ivar properties: Properties of pipelines patch body. + :vartype properties: ~azure.mgmt.azuredatatransfer.models.PipelinesPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "PipelinesPatchProperties"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + properties: Optional["_models.PipelinesPatchProperties"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of pipelines patch body. + :paramtype properties: ~azure.mgmt.azuredatatransfer.models.PipelinesPatchProperties + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.tags = tags + + +class PipelinesPatchProperties(_serialization.Model): + """Properties of pipelines patch body. + + :ivar connections: Connections associated with pipeline. + :vartype connections: list[~azure.mgmt.azuredatatransfer.models.PipelineConnection] + :ivar flow_types: The flow types allowed for this pipeline. + :vartype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + """ + + _attribute_map = { + "connections": {"key": "connections", "type": "[PipelineConnection]"}, + "flow_types": {"key": "flowTypes", "type": "[str]"}, + } + + def __init__( + self, + *, + connections: Optional[List["_models.PipelineConnection"]] = None, + flow_types: Optional[List[Union[str, "_models.FlowType"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword connections: Connections associated with pipeline. + :paramtype connections: list[~azure.mgmt.azuredatatransfer.models.PipelineConnection] + :keyword flow_types: The flow types allowed for this pipeline. + :paramtype flow_types: list[str or ~azure.mgmt.azuredatatransfer.models.FlowType] + """ + super().__init__(**kwargs) + self.connections = connections + self.flow_types = flow_types + + +class Plan(_serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :vartype name: str + :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + Required. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str + """ + + _validation = { + "name": {"required": True}, + "publisher": {"required": True}, + "product": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :paramtype name: str + :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. Required. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class ResourceBody(_serialization.Model): + """The resource to reference. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID of the resource. Required. + :vartype id: str + :ivar status_reason: Reason for resource operation. + :vartype status_reason: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "status_reason": {"key": "statusReason", "type": "str"}, + } + + def __init__( + self, *, id: str, status_reason: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword id: ID of the resource. Required. + :paramtype id: str + :keyword status_reason: Reason for resource operation. + :paramtype status_reason: str + """ + super().__init__(**kwargs) + self.id = id + self.status_reason = status_reason + + +class Schema(_serialization.Model): + """The schema object. + + :ivar id: ID associated with this schema. + :vartype id: str + :ivar connection_id: Connection ID associated with this schema. + :vartype connection_id: str + :ivar status: Status of the schema. Known values are: "New" and "Approved". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.SchemaStatus + :ivar name: Name of the schema. + :vartype name: str + :ivar content: Content of the schema. + :vartype content: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "connection_id": {"key": "connectionId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "content": {"key": "content", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + connection_id: Optional[str] = None, + status: Optional[Union[str, "_models.SchemaStatus"]] = None, + name: Optional[str] = None, + content: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: ID associated with this schema. + :paramtype id: str + :keyword connection_id: Connection ID associated with this schema. + :paramtype connection_id: str + :keyword status: Status of the schema. Known values are: "New" and "Approved". + :paramtype status: str or ~azure.mgmt.azuredatatransfer.models.SchemaStatus + :keyword name: Name of the schema. + :paramtype name: str + :keyword content: Content of the schema. + :paramtype content: str + """ + super().__init__(**kwargs) + self.id = id + self.connection_id = connection_id + self.status = status + self.name = name + self.content = content + + +class SchemasListResult(_serialization.Model): + """The schemas list result. + + :ivar value: Schemas array. + :vartype value: list[~azure.mgmt.azuredatatransfer.models.Schema] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Schema]"}, + } + + def __init__(self, *, value: Optional[List["_models.Schema"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Schemas array. + :paramtype value: list[~azure.mgmt.azuredatatransfer.models.Schema] + """ + super().__init__(**kwargs) + self.value = value + + +class SelectedResource(_serialization.Model): + """A resource selected from ARM. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the connection. + :vartype name: str + :ivar id: Id of the connection. Required. + :vartype id: str + :ivar location: Location of the connection. + :vartype location: str + :ivar subscription_name: Name of the subscription with the connection. + :vartype subscription_name: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "subscription_name": {"key": "subscriptionName", "type": "str"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + name: Optional[str] = None, + location: Optional[str] = None, + subscription_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the connection. + :paramtype name: str + :keyword id: Id of the connection. Required. + :paramtype id: str + :keyword location: Location of the connection. + :paramtype location: str + :keyword subscription_name: Name of the subscription with the connection. + :paramtype subscription_name: str + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.location = location + self.subscription_name = subscription_name + + +class Subscriber(_serialization.Model): + """Subscriber. + + :ivar email: Email of the subscriber. + :vartype email: str + :ivar notifications: Number specifying what notifications to receive. + :vartype notifications: int + """ + + _attribute_map = { + "email": {"key": "email", "type": "str"}, + "notifications": {"key": "notifications", "type": "int"}, + } + + def __init__(self, *, email: Optional[str] = None, notifications: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword email: Email of the subscriber. + :paramtype email: str + :keyword notifications: Number specifying what notifications to receive. + :paramtype notifications: int + """ + super().__init__(**kwargs) + self.email = email + self.notifications = notifications + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.azuredatatransfer.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.azuredatatransfer.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.azuredatatransfer.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.azuredatatransfer.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ValidateSchemaResult(_serialization.Model): + """Result of the schema validation. + + :ivar status: Validation status of the schema. Known values are: "Succeeded" and "Failed". + :vartype status: str or ~azure.mgmt.azuredatatransfer.models.ValidateSchemaStatus + :ivar message: Message describing the schema validation. + :vartype message: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.ValidateSchemaStatus"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Validation status of the schema. Known values are: "Succeeded" and "Failed". + :paramtype status: str or ~azure.mgmt.azuredatatransfer.models.ValidateSchemaStatus + :keyword message: Message describing the schema validation. + :paramtype message: str + """ + super().__init__(**kwargs) + self.status = status + self.message = message diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_patch.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/__init__.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/__init__.py new file mode 100644 index 000000000000..e71291ad1eef --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/__init__.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. +# -------------------------------------------------------------------------- + +from ._azure_data_transfer_operations import AzureDataTransferOperations +from ._flows_operations import FlowsOperations +from ._connections_operations import ConnectionsOperations +from ._list_pending_connections_operations import ListPendingConnectionsOperations +from ._list_pending_flows_operations import ListPendingFlowsOperations +from ._pipelines_operations import PipelinesOperations +from ._list_schemas_operations import ListSchemasOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureDataTransferOperations", + "FlowsOperations", + "ConnectionsOperations", + "ListPendingConnectionsOperations", + "ListPendingFlowsOperations", + "PipelinesOperations", + "ListSchemasOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_azure_data_transfer_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_azure_data_transfer_operations.py new file mode 100644 index 000000000000..a4f08b9273ff --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_azure_data_transfer_operations.py @@ -0,0 +1,310 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_validate_schema_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-10-11-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", "/providers/Microsoft.AzureDataTransfer/validateSchema") + + # 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_approved_schemas_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-10-11-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", "/providers/Microsoft.AzureDataTransfer/listApprovedSchemas") + + # 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 AzureDataTransferOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`azure_data_transfer` 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 validate_schema( + self, schema: _models.Schema, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema + :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: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_schema( + self, schema: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Required. + :type schema: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_schema(self, schema: Union[_models.Schema, IO], **kwargs: Any) -> _models.ValidateSchemaResult: + """Validates a schema for Azure Data Transfer. + + :param schema: The schema to validate. Is either a Schema type or a IO type. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSchemaResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.ValidateSchemaResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ValidateSchemaResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(schema, (IOBase, bytes)): + _content = schema + else: + _json = self._serialize.body(schema, "Schema") + + request = build_validate_schema_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_schema.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("ValidateSchemaResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_schema.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/validateSchema"} + + @overload + def list_approved_schemas( + self, pipeline: _models.ListApprovedSchemasRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasRequest + :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: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_approved_schemas( + self, pipeline: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Required. + :type pipeline: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_approved_schemas( + self, pipeline: Union[_models.ListApprovedSchemasRequest, IO], **kwargs: Any + ) -> _models.SchemasListResult: + """Lists approved schemas for Azure Data Transfer. + + :param pipeline: The request to list approved schemas. Is either a ListApprovedSchemasRequest + type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.ListApprovedSchemasRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SchemasListResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "ListApprovedSchemasRequest") + + request = build_list_approved_schemas_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_approved_schemas.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("SchemasListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_approved_schemas.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/listApprovedSchemas"} diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_connections_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_connections_operations.py new file mode 100644 index 000000000000..e6add3d4297f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_connections_operations.py @@ -0,0 +1,1311 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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, 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-10-11-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.AzureDataTransfer/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_delete_request( + resource_group_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_update_request( + resource_group_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-10-11-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.AzureDataTransfer/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_link_request( + resource_group_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-10-11-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.AzureDataTransfer/connections/{connectionName}/link", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_by_resource_group_request(resource_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", "2023-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_list_by_subscription_request(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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/connections" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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) + + +class ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`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 get(self, resource_group_name: str, connection_name: str, **kwargs: Any) -> _models.Connection: + """Gets connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Connection or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Connection + :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.Connection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_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) + + _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("Connection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, connection_name: str, connection: Union[_models.Connection, IO], **kwargs: Any + ) -> _models.Connection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "Connection") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Connection", pipeline_response) + + 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.AzureDataTransfer/connections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + connection: _models.Connection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.Connection + :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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, connection_name: str, connection: Union[_models.Connection, IO], **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Creates or updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a Connection type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.Connection 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, connection_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, + connection_name=connection_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, connection_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + def _update_initial( + self, + resource_group_name: str, + connection_name: str, + connection: Union[_models.ConnectionsPatch, IO], + **kwargs: Any + ) -> _models.Connection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ConnectionsPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Connection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: _models.ConnectionsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ConnectionsPatch + :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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + connection_name: str, + connection: Union[_models.ConnectionsPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Updates the connection resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a ConnectionsPatch type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ConnectionsPatch 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}" + } + + def _link_initial( + self, resource_group_name: str, connection_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_link_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/link" + } + + @overload + def begin_link( + self, + resource_group_name: str, + connection_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_link( + self, + resource_group_name: str, + connection_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Required. + :type connection: 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_link( + self, resource_group_name: str, connection_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Links the connection to its pending connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._link_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/link" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Connection"]: + """Gets connections in a resource group. + + :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 Connection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.Connection] + :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.ConnectionsListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionsListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Connection"]: + """Gets connections in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Connection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.Connection] + :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.ConnectionsListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionsListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/connections" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_flows_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_flows_operations.py new file mode 100644 index 000000000000..e5b018e31048 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_flows_operations.py @@ -0,0 +1,1628 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, connection_name: str, flow_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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, connection_name: str, flow_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-10-11-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.AzureDataTransfer/connections/{connectionName}/flows/{flowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_delete_request( + resource_group_name: str, connection_name: str, flow_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_update_request( + resource_group_name: str, connection_name: str, flow_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-10-11-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.AzureDataTransfer/connections/{connectionName}/flows/{flowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_enable_request( + resource_group_name: str, connection_name: str, flow_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/enable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_disable_request( + resource_group_name: str, connection_name: str, flow_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/disable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_link_request( + resource_group_name: str, connection_name: str, flow_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-10-11-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.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/link", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + "flowName": _SERIALIZER.url( + "flow_name", flow_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_by_connection_request( + resource_group_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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 FlowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`flows` 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(self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any) -> _models.Flow: + """Gets flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Flow or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Flow + :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.Flow] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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("Flow", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.Flow, IO], + **kwargs: Any + ) -> _models.Flow: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "Flow") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Flow", pipeline_response) + + 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.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.Flow, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.Flow + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.Flow, IO], + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Creates or updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a Flow type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.Flow 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, connection_name: str, flow_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, + connection_name=connection_name, + flow_name=flow_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + def _update_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.FlowsPatch, IO], + **kwargs: Any + ) -> _models.Flow: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "FlowsPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Flow", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.FlowsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.FlowsPatch + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.FlowsPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Updates the flow resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a FlowsPatch type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.FlowsPatch 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}" + } + + def _enable_initial( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> Optional[_models.Flow]: + 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[Optional[_models.Flow]] = kwargs.pop("cls", None) + + request = build_enable_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._enable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _enable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/enable" + } + + @distributed_trace + def begin_enable( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Enables the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._enable_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_enable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/enable" + } + + def _disable_initial( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> Optional[_models.Flow]: + 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[Optional[_models.Flow]] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/disable" + } + + @distributed_trace + def begin_disable( + self, resource_group_name: str, connection_name: str, flow_name: str, **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Disables the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._disable_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_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): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/disable" + } + + def _link_initial( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.ResourceBody, IO], + **kwargs: Any + ) -> Optional[_models.Flow]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Flow]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flow, (IOBase, bytes)): + _content = flow + else: + _json = self._serialize.body(flow, "ResourceBody") + + request = build_link_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Flow", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/link" + } + + @overload + def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Required. + :type flow: 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_link( + self, + resource_group_name: str, + connection_name: str, + flow_name: str, + flow: Union[_models.ResourceBody, IO], + **kwargs: Any + ) -> LROPoller[_models.Flow]: + """Links the specified flow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :param flow_name: The name for the flow that is to be onboarded. Required. + :type flow_name: str + :param flow: Flow body. Is either a ResourceBody type or a IO type. Required. + :type flow: ~azure.mgmt.azuredatatransfer.models.ResourceBody 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 Flow or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Flow] + :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.Flow] = 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._link_initial( + resource_group_name=resource_group_name, + connection_name=connection_name, + flow_name=flow_name, + flow=flow, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Flow", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows/{flowName}/link" + } + + @distributed_trace + def list_by_connection( + self, resource_group_name: str, connection_name: str, **kwargs: Any + ) -> Iterable["_models.Flow"]: + """Gets flows in a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Flow or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.Flow] + :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.FlowsListResult] = 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_connection_request( + resource_group_name=resource_group_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_connection.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FlowsListResult", 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) + + list_by_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/flows" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_connections_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_connections_operations.py new file mode 100644 index 000000000000..f42df608b098 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_connections_operations.py @@ -0,0 +1,183 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, 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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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 ListPendingConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`list_pending_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, connection_name: str, **kwargs: Any + ) -> Iterable["_models.PendingConnection"]: + """Lists all pending connections for a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PendingConnection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.PendingConnection] + :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.PendingConnectionsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PendingConnectionsListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingConnections" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_flows_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_flows_operations.py new file mode 100644 index 000000000000..0cab6e1dbbc6 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_pending_flows_operations.py @@ -0,0 +1,181 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, 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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingFlows", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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 ListPendingFlowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`list_pending_flows` 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, connection_name: str, **kwargs: Any) -> Iterable["_models.PendingFlow"]: + """Lists all pending flows for a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connection_name: The name for the connection that is to be requested. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PendingFlow or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.PendingFlow] + :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.PendingFlowsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + connection_name=connection_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PendingFlowsListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/connections/{connectionName}/listPendingFlows" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_schemas_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_schemas_operations.py new file mode 100644 index 000000000000..cb604f7cd21b --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_list_schemas_operations.py @@ -0,0 +1,231 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +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, pipeline_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-10-11-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.AzureDataTransfer/pipelines/{pipelineName}/listSchemas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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 ListSchemasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`list_schemas` 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 list( + self, + resource_group_name: str, + pipeline_name: str, + schema: _models.Schema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema + :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: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + pipeline_name: str, + schema: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Required. + :type schema: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, resource_group_name: str, pipeline_name: str, schema: Union[_models.Schema, IO], **kwargs: Any + ) -> _models.SchemasListResult: + """Lists the schemas for the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param schema: Schema(s) to retrieve. Is either a Schema type or a IO type. Required. + :type schema: ~azure.mgmt.azuredatatransfer.models.Schema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemasListResult or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.SchemasListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SchemasListResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(schema, (IOBase, bytes)): + _content = schema + else: + _json = self._serialize.body(schema, "Schema") + + request = build_list_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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("SchemasListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/listSchemas" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_operations.py new file mode 100644 index 000000000000..e809b4a4ba34 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AzureDataTransfer/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all of the available Microsoft.AzureDataTransfer 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 Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.AzureDataTransfer/operations"} diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_patch.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_pipelines_operations.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_pipelines_operations.py new file mode 100644 index 000000000000..8545cb636fc0 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/operations/_pipelines_operations.py @@ -0,0 +1,1555 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, pipeline_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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, pipeline_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-10-11-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.AzureDataTransfer/pipelines/{pipelineName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_delete_request( + resource_group_name: str, pipeline_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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_update_request( + resource_group_name: str, pipeline_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-10-11-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.AzureDataTransfer/pipelines/{pipelineName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_approve_connection_request( + resource_group_name: str, pipeline_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-10-11-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.AzureDataTransfer/pipelines/{pipelineName}/approveConnection", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_reject_connection_request( + resource_group_name: str, pipeline_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-10-11-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.AzureDataTransfer/pipelines/{pipelineName}/rejectConnection", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "pipelineName": _SERIALIZER.url( + "pipeline_name", pipeline_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z0-9-]{3,64}$" + ), + } + + _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_by_resource_group_request(resource_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", "2023-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_list_by_subscription_request(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-10-11-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/pipelines") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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) + + +class PipelinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azuredatatransfer.Azuredatatransferrp`'s + :attr:`pipelines` 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(self, resource_group_name: str, pipeline_name: str, **kwargs: Any) -> _models.Pipeline: + """Gets pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pipeline or the result of cls(response) + :rtype: ~azure.mgmt.azuredatatransfer.models.Pipeline + :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.Pipeline] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_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("Pipeline", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.Pipeline, IO], **kwargs: Any + ) -> _models.Pipeline: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pipeline] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "Pipeline") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Pipeline", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Pipeline", pipeline_response) + + 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.AzureDataTransfer/pipelines/{pipelineName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: _models.Pipeline, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.Pipeline + :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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: 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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.Pipeline, IO], **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Creates or updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Is either a Pipeline type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.Pipeline 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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.Pipeline] = 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, + pipeline_name=pipeline_name, + pipeline=pipeline, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pipeline", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pipeline_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, + pipeline_name=pipeline_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, pipeline_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + def _update_initial( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.PipelinesPatch, IO], **kwargs: Any + ) -> _models.Pipeline: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pipeline] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pipeline, (IOBase, bytes)): + _content = pipeline + else: + _json = self._serialize.body(pipeline, "PipelinesPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pipeline", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Pipeline", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: _models.PipelinesPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.PipelinesPatch + :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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pipeline_name: str, + pipeline: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Required. + :type pipeline: 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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, pipeline_name: str, pipeline: Union[_models.PipelinesPatch, IO], **kwargs: Any + ) -> LROPoller[_models.Pipeline]: + """Updates the pipeline resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param pipeline: Pipeline body. Is either a PipelinesPatch type or a IO type. Required. + :type pipeline: ~azure.mgmt.azuredatatransfer.models.PipelinesPatch 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 Pipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.Pipeline] = 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, + pipeline_name=pipeline_name, + pipeline=pipeline, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pipeline", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}" + } + + def _approve_connection_initial( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_approve_connection_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._approve_connection_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _approve_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/approveConnection" + } + + @overload + def begin_approve_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_approve_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_approve_connection( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Approves the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._approve_connection_initial( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_approve_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/approveConnection" + } + + def _reject_connection_initial( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> Optional[_models.Connection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Connection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + _json = self._serialize.body(connection, "ResourceBody") + + request = build_reject_connection_request( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reject_connection_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Connection", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _reject_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/rejectConnection" + } + + @overload + def begin_reject_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: _models.ResourceBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody + :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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reject_connection( + self, + resource_group_name: str, + pipeline_name: str, + connection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Required. + :type connection: 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reject_connection( + self, resource_group_name: str, pipeline_name: str, connection: Union[_models.ResourceBody, IO], **kwargs: Any + ) -> LROPoller[_models.Connection]: + """Rejects the specified connection in a pipeline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_name: The name for the pipeline that is to be requested. Required. + :type pipeline_name: str + :param connection: Connection body. Is either a ResourceBody type or a IO type. Required. + :type connection: ~azure.mgmt.azuredatatransfer.models.ResourceBody 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 Connection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azuredatatransfer.models.Connection] + :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.Connection] = 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._reject_connection_initial( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + connection=connection, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Connection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reject_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines/{pipelineName}/rejectConnection" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pipeline"]: + """Gets pipelines in a resource group. + + :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 Pipeline or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.PipelinesListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("PipelinesListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureDataTransfer/pipelines" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Pipeline"]: + """Gets pipelines in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pipeline or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azuredatatransfer.models.Pipeline] + :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.PipelinesListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PipelinesListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureDataTransfer/pipelines" + } diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/py.typed b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/azure/mgmt/azuredatatransfer/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/approve_or_reject_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/approve_or_reject_connection.py new file mode 100644 index 000000000000..3a0fddcbb2fd --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/approve_or_reject_connection.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python approve_or_reject_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.pipelines.begin_approve_connection( + resource_group_name="testRG", + pipeline_name="testPipeline", + connection={ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.AzureDataTransfer/connections/testConnection", + "statusReason": "Example reason", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/approveOrRejectConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_connection.py new file mode 100644 index 000000000000..205e1a2bd62b --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_connection.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python create_or_update_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connections.begin_create_or_update( + resource_group_name="testRG", + connection_name="testConnection", + connection={ + "location": "East US", + "properties": {"justification": "justification", "pipeline": "testdc", "requirementId": "id"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/createOrUpdateConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_flow.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_flow.py new file mode 100644 index 000000000000..2e3edf9f5e3f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_flow.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python create_or_update_flow.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.flows.begin_create_or_update( + resource_group_name="testRG", + connection_name="testConnection", + flow_name="testFlow", + flow={ + "location": "East US", + "properties": { + "connection": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.AzureDataTransfer/connections/testConnection" + }, + "flowType": "Blob", + "storageAccountName": "testsa", + "storageContainerName": "testcontainer", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/createOrUpdateFlow.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_pipeline.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_pipeline.py new file mode 100644 index 000000000000..c26a80ef3dc3 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/create_or_update_pipeline.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python create_or_update_pipeline.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.pipelines.begin_create_or_update( + resource_group_name="testRG", + pipeline_name="testPipeline", + pipeline={"location": "East US", "properties": {"remoteCloud": "testdc"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/createOrUpdatePipeline.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_connection.py new file mode 100644 index 000000000000..4ef9f218f64b --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_connection.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python delete_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.connections.begin_delete( + resource_group_name="testRG", + connection_name="testConnection", + ).result() + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/deleteConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_flow.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_flow.py new file mode 100644 index 000000000000..c9b0e8eac1d8 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_flow.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python delete_flow.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.flows.begin_delete( + resource_group_name="testRG", + connection_name="testConnection", + flow_name="testFlow", + ).result() + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/deleteFlow.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_pipeline.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_pipeline.py new file mode 100644 index 000000000000..1872a81f447c --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/delete_pipeline.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python delete_pipeline.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.pipelines.begin_delete( + resource_group_name="testRG", + pipeline_name="testPipeline", + ).result() + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/deletePipeline.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/enable_or_disable_flow.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/enable_or_disable_flow.py new file mode 100644 index 000000000000..b773ef9f45af --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/enable_or_disable_flow.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python enable_or_disable_flow.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.flows.begin_enable( + resource_group_name="testRG", + connection_name="testConnection", + flow_name="testFlow", + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/enableOrDisableFlow.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_connection.py new file mode 100644 index 000000000000..4cc9c03eff52 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_connection.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python get_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connections.get( + resource_group_name="testRG", + connection_name="testConnection", + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/getConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_flow.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_flow.py new file mode 100644 index 000000000000..0604b78d85e9 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_flow.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python get_flow.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.flows.get( + resource_group_name="testRG", + connection_name="testConnection", + flow_name="testFlow", + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/getFlow.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_pipeline.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_pipeline.py new file mode 100644 index 000000000000..9bb40588a247 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/get_pipeline.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python get_pipeline.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.pipelines.get( + resource_group_name="testRG", + pipeline_name="testPipeline", + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/getPipeline.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_connection.py new file mode 100644 index 000000000000..c5ac1d610b8f --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_connection.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python link_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connections.begin_link( + resource_group_name="testRG", + connection_name="testConnection", + connection={ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.AzureDataTransfer/connections/testConnection" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/linkConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_flow.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_flow.py new file mode 100644 index 000000000000..83ad4911fe0b --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/link_flow.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python link_flow.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.flows.begin_link( + resource_group_name="testRG", + connection_name="testConnection", + flow_name="testFlow", + flow={ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.AzureDataTransfer/connections/testConnection/flows/testFlow" + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/linkFlow.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_resource_group.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_resource_group.py new file mode 100644 index 000000000000..df6956665361 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_connections_by_resource_group.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connections.list_by_resource_group( + resource_group_name="testRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listConnectionsByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_subscription.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_subscription.py new file mode 100644 index 000000000000..86f6d0344ead --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_connections_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_connections_by_subscription.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connections.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listConnectionsBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_flows_by_connection.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_flows_by_connection.py new file mode 100644 index 000000000000..363bd867f559 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_flows_by_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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_flows_by_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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.flows.list_by_connection( + resource_group_name="testRG", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listFlowsByConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_skus_list.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_operations.py similarity index 72% rename from sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_skus_list.py rename to sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_operations.py index e7f81c5bb90c..e0612f6ebc18 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_skus_list.py +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_operations.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient +from azure.mgmt.azuredatatransfer import Azuredatatransferrp """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-redisenterprise + pip install azure-mgmt-azuredatatransfer # USAGE - python redis_enterprise_skus_list.py + python list_operations.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, @@ -24,18 +24,16 @@ def main(): - client = RedisEnterpriseManagementClient( + client = Azuredatatransferrp( credential=DefaultAzureCredential(), subscription_id="subid", ) - response = client.skus.list( - location="westus2", - ) + response = client.operations.list() for item in response: print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseSkusList.json +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listOperations.json if __name__ == "__main__": main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_connections.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_connections.py new file mode 100644 index 000000000000..2d3346414ade --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_connections.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_pending_connections.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.list_pending_connections.list( + resource_group_name="testRG", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listPendingConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_flows.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_flows.py new file mode 100644 index 000000000000..be7302abe640 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pending_flows.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_pending_flows.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.list_pending_flows.list( + resource_group_name="testRG", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listPendingFlows.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_resource_group.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_resource_group.py new file mode 100644 index 000000000000..d0cfd23e0d75 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_pipelines_by_resource_group.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.pipelines.list_by_resource_group( + resource_group_name="testRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listPipelinesByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_subscription.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_subscription.py new file mode 100644 index 000000000000..c1a11a55db79 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_pipelines_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_pipelines_by_subscription.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.pipelines.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listPipelinesBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_schemas.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_schemas.py new file mode 100644 index 000000000000..b614789fbad5 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/list_schemas.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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python list_schemas.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.list_schemas.list( + resource_group_name="testRG", + pipeline_name="testPipeline", + schema={ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.AzureDataTransfer/connections/testConnection", + "name": "test.xsd", + }, + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/listSchemas.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_list_approved_schemas.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_list_approved_schemas.py new file mode 100644 index 000000000000..c9192e14d968 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_list_approved_schemas.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python post_list_approved_schemas.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_data_transfer.list_approved_schemas( + pipeline={"direction": "Send", "pipeline": "test"}, + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/postListApprovedSchemas.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_validate_schema.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_validate_schema.py new file mode 100644 index 000000000000..67709bdceb73 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/generated_samples/post_validate_schema.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azuredatatransfer import Azuredatatransferrp + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azuredatatransfer +# USAGE + python post_validate_schema.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 = Azuredatatransferrp( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.azure_data_transfer.validate_schema( + schema={"name": "schema.xml"}, + ) + print(response) + + +# x-ms-original-file: specification/azuredatatransfer/resource-manager/Microsoft.AzureDataTransfer/preview/2023-10-11-preview/examples/postValidateSchema.json +if __name__ == "__main__": + main() diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/sdk_packaging.toml b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/sdk_packaging.toml new file mode 100644 index 000000000000..23832ef4e3c2 --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-azuredatatransfer" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/setup.py b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/setup.py new file mode 100644 index 000000000000..ae6a92f0875d --- /dev/null +++ b/sdk/azuredatatransfer/azure-mgmt-azuredatatransfer/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-azuredatatransfer" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/azuredatatransfer/ci.yml b/sdk/azuredatatransfer/ci.yml new file mode 100644 index 000000000000..1ba8ef043c54 --- /dev/null +++ b/sdk/azuredatatransfer/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azuredatatransfer/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azuredatatransfer/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azuredatatransfer + TestProxy: true + Artifacts: + - name: azure-mgmt-azuredatatransfer + safeName: azuremgmtazuredatatransfer diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/CHANGELOG.md b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/LICENSE b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/MANIFEST.in b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/MANIFEST.in new file mode 100644 index 000000000000..543b9ae8a4ef --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/azurelargeinstance/py.typed diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/README.md b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/README.md new file mode 100644 index 000000000000..b835b9677dc9 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-azurelargeinstance +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/_meta.json b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/_meta.json new file mode 100644 index 000000000000..fdfaa9aa5f68 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/azurelargeinstance/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/azurelargeinstance/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/__init__.py new file mode 100644 index 000000000000..64d4c3b93695 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._large_instance_mgmt_client import LargeInstanceMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "LargeInstanceMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_configuration.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_configuration.py new file mode 100644 index 000000000000..c5e2c55faa7e --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class LargeInstanceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for LargeInstanceMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-07-20-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(LargeInstanceMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-20-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-azurelargeinstance/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_large_instance_mgmt_client.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_large_instance_mgmt_client.py new file mode 100644 index 000000000000..425a4435da85 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_large_instance_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import LargeInstanceMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import AzureLargeInstanceOperations, AzureLargeStorageInstanceOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class LargeInstanceMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """The AzureLargeInstance Management client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.azurelargeinstance.operations.Operations + :ivar azure_large_instance: AzureLargeInstanceOperations operations + :vartype azure_large_instance: + azure.mgmt.azurelargeinstance.operations.AzureLargeInstanceOperations + :ivar azure_large_storage_instance: AzureLargeStorageInstanceOperations operations + :vartype azure_large_storage_instance: + azure.mgmt.azurelargeinstance.operations.AzureLargeStorageInstanceOperations + :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. The value must be an UUID. 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-07-20-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = LargeInstanceMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.azure_large_instance = AzureLargeInstanceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.azure_large_storage_instance = AzureLargeStorageInstanceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "LargeInstanceMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_patch.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_serialization.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_vendor.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_version.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/__init__.py new file mode 100644 index 000000000000..f941516e8c1e --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._large_instance_mgmt_client import LargeInstanceMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "LargeInstanceMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_configuration.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_configuration.py new file mode 100644 index 000000000000..d4f5cc7fa65c --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class LargeInstanceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for LargeInstanceMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-07-20-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(LargeInstanceMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-20-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-azurelargeinstance/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_large_instance_mgmt_client.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_large_instance_mgmt_client.py new file mode 100644 index 000000000000..f4c0ce0c7b27 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_large_instance_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import LargeInstanceMgmtClientConfiguration +from .operations import AzureLargeInstanceOperations, AzureLargeStorageInstanceOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class LargeInstanceMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """The AzureLargeInstance Management client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.azurelargeinstance.aio.operations.Operations + :ivar azure_large_instance: AzureLargeInstanceOperations operations + :vartype azure_large_instance: + azure.mgmt.azurelargeinstance.aio.operations.AzureLargeInstanceOperations + :ivar azure_large_storage_instance: AzureLargeStorageInstanceOperations operations + :vartype azure_large_storage_instance: + azure.mgmt.azurelargeinstance.aio.operations.AzureLargeStorageInstanceOperations + :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. The value must be an UUID. 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-07-20-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = LargeInstanceMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.azure_large_instance = AzureLargeInstanceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.azure_large_storage_instance = AzureLargeStorageInstanceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "LargeInstanceMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_patch.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/__init__.py new file mode 100644 index 000000000000..9b4f2bf7ab5c --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._azure_large_instance_operations import AzureLargeInstanceOperations +from ._azure_large_storage_instance_operations import AzureLargeStorageInstanceOperations + +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", + "AzureLargeInstanceOperations", + "AzureLargeStorageInstanceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_instance_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_instance_operations.py new file mode 100644 index 000000000000..752abca83195 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_instance_operations.py @@ -0,0 +1,957 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._azure_large_instance_operations import ( + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_restart_request, + build_shutdown_request, + build_start_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AzureLargeInstanceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.aio.LargeInstanceMgmtClient`'s + :attr:`azure_large_instance` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AzureLargeInstance"]: + """Gets a list of Azure Large Instances in the specified subscription. The + operations returns various properties of each Azure Large Instance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureLargeInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :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.AzureLargeInstanceListResult] = 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, + 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("AzureLargeInstanceListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AzureLargeInstance"]: + """Gets a list of Azure Large Instances in the specified subscription and resource + group. The operations returns various properties of each Azure Large Instance. + + :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 AzureLargeInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :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.AzureLargeInstanceListResult] = 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, + 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("AzureLargeInstanceListResult", 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.AzureLargeInstance/azureLargeInstances" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> _models.AzureLargeInstance: + """Gets an Azure Large Instance for the specified subscription, resource group, + and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :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.AzureLargeInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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 = 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("AzureLargeInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: _models.AzureLargeInstanceTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceTagsUpdate + :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: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: Union[_models.AzureLargeInstanceTagsUpdate, IO], + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Is either a + AzureLargeInstanceTagsUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceTagsUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureLargeInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AzureLargeInstanceTagsUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + 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) + + _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("AzureLargeInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + } + + async def _restart_initial( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[Union[_models.ForceState, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(force_parameter, (IOBase, bytes)): + _content = force_parameter + else: + if force_parameter is not None: + _json = self._serialize.body(force_parameter, "ForceState") + else: + _json = None + + request = build_restart_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._restart_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" + } + + @overload + async def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[_models.ForceState] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Default value is None. + :type force_parameter: ~azure.mgmt.azurelargeinstance.models.ForceState + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Default value is None. + :type force_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[Union[_models.ForceState, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Is either a ForceState type or a IO type. Default value is None. + :type force_parameter: ~azure.mgmt.azurelargeinstance.models.ForceState or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._restart_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + force_parameter=force_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" + } + + async def _shutdown_initial( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + 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[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_shutdown_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._shutdown_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _shutdown_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" + } + + @distributed_trace_async + async def begin_shutdown( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """The operation to shutdown an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._shutdown_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_shutdown.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" + } + + async def _start_initial( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + 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[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" + } + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """The operation to start an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" + } diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_storage_instance_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_storage_instance_operations.py new file mode 100644 index 000000000000..77a325db9578 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_azure_large_storage_instance_operations.py @@ -0,0 +1,452 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._azure_large_storage_instance_operations import ( + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AzureLargeStorageInstanceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.aio.LargeInstanceMgmtClient`'s + :attr:`azure_large_storage_instance` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AzureLargeStorageInstance"]: + """Gets a list of AzureLargeStorageInstances in the specified subscription. The + operations returns various properties of each Azure LargeStorage instance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureLargeStorageInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :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.AzureLargeStorageInstanceListResult] = 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, + 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("AzureLargeStorageInstanceListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AzureLargeStorageInstance"]: + """Gets a list of AzureLargeStorageInstances in the specified subscription and + resource group. The operations returns various properties of each Azure + LargeStorage instance. + + :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 AzureLargeStorageInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :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.AzureLargeStorageInstanceListResult] = 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, + 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("AzureLargeStorageInstanceListResult", 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.AzureLargeInstance/azureLargeStorageInstances" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, azure_large_storage_instance_name: str, **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Gets an Azure Large Storage instance for the specified subscription, resource + group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :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.AzureLargeStorageInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + azure_large_storage_instance_name=azure_large_storage_instance_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 = 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("AzureLargeStorageInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: _models.AzureLargeStorageInstanceTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceTagsUpdate + :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: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: Union[_models.AzureLargeStorageInstanceTagsUpdate, IO], + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Is either a + AzureLargeStorageInstanceTagsUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceTagsUpdate or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureLargeStorageInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AzureLargeStorageInstanceTagsUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + azure_large_storage_instance_name=azure_large_storage_instance_name, + 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) + + _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("AzureLargeStorageInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + } diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_operations.py new file mode 100644 index 000000000000..85d99d489ad1 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_operations.py @@ -0,0 +1,134 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.aio.LargeInstanceMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurelargeinstance.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.AzureLargeInstance/operations"} diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_patch.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/__init__.py new file mode 100644 index 000000000000..65bab839e49f --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/__init__.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. +# -------------------------------------------------------------------------- + +from ._models_py3 import AzureLargeInstance +from ._models_py3 import AzureLargeInstanceListResult +from ._models_py3 import AzureLargeInstanceProperties +from ._models_py3 import AzureLargeInstanceTagsUpdate +from ._models_py3 import AzureLargeStorageInstance +from ._models_py3 import AzureLargeStorageInstanceListResult +from ._models_py3 import AzureLargeStorageInstanceProperties +from ._models_py3 import AzureLargeStorageInstanceTagsUpdate +from ._models_py3 import Disk +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ForceState +from ._models_py3 import HardwareProfile +from ._models_py3 import IpAddress +from ._models_py3 import NetworkProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusResult +from ._models_py3 import OsProfile +from ._models_py3 import Resource +from ._models_py3 import StorageBillingProperties +from ._models_py3 import StorageProfile +from ._models_py3 import StorageProperties +from ._models_py3 import SystemData +from ._models_py3 import Tags +from ._models_py3 import TrackedResource + +from ._large_instance_mgmt_client_enums import ActionType +from ._large_instance_mgmt_client_enums import AzureLargeInstanceForcePowerState +from ._large_instance_mgmt_client_enums import AzureLargeInstanceHardwareTypeNamesEnum +from ._large_instance_mgmt_client_enums import AzureLargeInstancePowerStateEnum +from ._large_instance_mgmt_client_enums import AzureLargeInstanceProvisioningStatesEnum +from ._large_instance_mgmt_client_enums import AzureLargeInstanceSizeNamesEnum +from ._large_instance_mgmt_client_enums import CreatedByType +from ._large_instance_mgmt_client_enums import Origin +from ._large_instance_mgmt_client_enums import ProvisioningState +from ._large_instance_mgmt_client_enums import Versions +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureLargeInstance", + "AzureLargeInstanceListResult", + "AzureLargeInstanceProperties", + "AzureLargeInstanceTagsUpdate", + "AzureLargeStorageInstance", + "AzureLargeStorageInstanceListResult", + "AzureLargeStorageInstanceProperties", + "AzureLargeStorageInstanceTagsUpdate", + "Disk", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ForceState", + "HardwareProfile", + "IpAddress", + "NetworkProfile", + "Operation", + "OperationDisplay", + "OperationListResult", + "OperationStatusResult", + "OsProfile", + "Resource", + "StorageBillingProperties", + "StorageProfile", + "StorageProperties", + "SystemData", + "Tags", + "TrackedResource", + "ActionType", + "AzureLargeInstanceForcePowerState", + "AzureLargeInstanceHardwareTypeNamesEnum", + "AzureLargeInstancePowerStateEnum", + "AzureLargeInstanceProvisioningStatesEnum", + "AzureLargeInstanceSizeNamesEnum", + "CreatedByType", + "Origin", + "ProvisioningState", + "Versions", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_large_instance_mgmt_client_enums.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_large_instance_mgmt_client_enums.py new file mode 100644 index 000000000000..a648ae950cb8 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_large_instance_mgmt_client_enums.py @@ -0,0 +1,256 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 AzureLargeInstanceForcePowerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of two possible values to determine if the ALI instance restart operation should + forcefully terminate and halt any existing processes that may be running on the server or not. + """ + + ACTIVE = "active" + """Active means that the restart operation will terminate and halt existing processes that may be + #: running on the server""" + INACTIVE = "inactive" + """Inactive means that the restart operation will not terminate and halt existing processes that + #: may be running on the server""" + + +class AzureLargeInstanceHardwareTypeNamesEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of the hardware options (vendor and/or their product name) for an Azure Large Instance.""" + + CISCO_UCS = "Cisco_UCS" + """Hardware type of UCS from vendor Cisco""" + HPE = "HPE" + """Hardware type of HPE from vendor Hewlett Packard Enterprise""" + SDFLEX = "SDFLEX" + """Hardware type of SDFLEX""" + + +class AzureLargeInstancePowerStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Power states that an Azure Large Instance can be in.""" + + STARTING = "starting" + """Starting means that the Azure Large Instance resource is turning on.""" + STARTED = "started" + """Started means that the Azure Large Instance resource has been powered on.""" + STOPPING = "stopping" + """Stopping means that the Azure Large Instance resource is shutting down.""" + STOPPED = "stopped" + """Stopped means that the Azure Large Instance resource has shut down.""" + RESTARTING = "restarting" + """Restarting means that the Azure Large Instance resource is restarting.""" + UNKNOWN = "unknown" + """Unknown means that the state of the Azure Large Instance is unknown.""" + + +class AzureLargeInstanceProvisioningStatesEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning states that an Azure Large Instance can be in.""" + + ACCEPTED = "Accepted" + """Accepted means Azure Large Instance resource provisioning has been accepted.""" + CREATING = "Creating" + """Creating means Azure Large Instance resource is being created.""" + UPDATING = "Updating" + """Updating means an existing Azure Large Instance resource is being updated""" + FAILED = "Failed" + """Failed means Azure Large Instance resource is in failed state""" + SUCCEEDED = "Succeeded" + """Succeeded means Azure Large Instance resource creation succeeded during last create/update""" + DELETING = "Deleting" + """Deleting means Azure Large Instance resource is in the process of being deleted""" + MIGRATING = "Migrating" + """Migrating means Azure Large Instance resource is being migrated from one subscription or + #: resource group to another""" + CANCELED = "Canceled" + """Cancelled Azure Large Instance resource operation has been cancelled""" + + +class AzureLargeInstanceSizeNamesEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of available model types (each of which have their own storage / memory sizes) for an + Azure Large Instance type. See + https://docs.microsoft.com/azure/sap/large-instances/hana-available-skus. + """ + + S72_M = "S72m" + """Type I class SKU that can't be purchased anymore""" + S144_M = "S144m" + """Type I class SKU that can't be purchased anymore""" + S72 = "S72" + """Type I class SKU that can't be purchased anymore""" + S144 = "S144" + """Type I class SKU that can't be purchased anymore""" + S192 = "S192" + """Type I class SKU that can't be purchased anymore""" + S192_M = "S192m" + """Type I class SKU that can't be purchased anymore""" + S192_XM = "S192xm" + """Type I class SKU that can't be purchased anymore""" + S96 = "S96" + """2 sockets, 96 CPU threads, 48 CPU cores, 768 GB total memory, 768 GB DRAM, 3.0 TB storage, + #: Cisco_UCS hardware type""" + S112 = "S112" + """No longer offered or used.""" + S224 = "S224" + """4 sockets, 224 CPU threads, 112 CPU cores, 3 TB total memory, 3 TB DRAM, 6.3 TB storage, + #: Cisco_UCS hardware type""" + S224_M = "S224m" + """4 sockets, 224 CPU threads, 112 CPU cores, 6 TB total memory, 6 TB DRAM, 10.5 TB storage, + #: Cisco_UCS hardware type""" + S224_OM = "S224om" + """4 sockets, 224 CPU threads, 112 CPU cores, 6 TB total memory, 3 TB DRAM, 3 TB memory optane, + #: 10.5 TB storage, Cisco_UCS hardware type""" + S224_OO = "S224oo" + """4 sockets, 224 CPU threads, 112 CPU cores, 4.5 TB total memory, 1.5 TB DRAM, 3 TB memory + #: optane, 8.4 TB storage, Cisco_UCS hardware type""" + S224_OOM = "S224oom" + """4 sockets, 224 CPU threads, 112 CPU cores, 9 TB total memory, 3 TB DRAM, 6 TB memory optane, + #: 14.8 TB storage, Cisco_UCS hardware type""" + S224_OOO = "S224ooo" + """4 sockets, 224 CPU threads, 112 CPU cores, 7.5TB total memory, 1.5 TB DRAM, 6 TB memory optane, + #: 12.7 TB storage, Cisco_UCS hardware type""" + S224_SE = "S224se" + """4 sockets, 448 CPU threads, 6 TB total memory, SDFLEX hardware type""" + S384 = "S384" + """8 sockets, 384 CPU threads, 192 CPU cores, 4 TB total memory, 4 TB DRAM, 16 TB storage, + #: HPEMc990x hardware type""" + S384_M = "S384m" + """8 sockets, 384 CPU threads, 192 CPU cores, 6 TB total memory, 6 TB DRAM, 18 TB storage, + #: HPEMc990x hardware type""" + S384_XM = "S384xm" + """8 sockets, 384 CPU threads, 192 CPU cores, 8 TB total memory, 8 TB DRAM, 22 TB storage, + #: HPEMc990x hardware type""" + S384_XXM = "S384xxm" + """8 sockets, 384 CPU threads, 12 TB total memory, HPEMc990x hardware type""" + S448 = "S448" + """8 sockets, 448 CPU threads, 224 CPU cores, 6 TB total memory, 6 TB DRAM, 10.5 TB storage, + #: SDFLEX hardware type""" + S448_M = "S448m" + """8 sockets, 448 CPU threads, 224 CPU cores, 12 TB total memory, 12 TB DRAM, 18.9 TB storage, + #: SDFLEX hardware type""" + S448_OM = "S448om" + """8 sockets, 448 CPU threads, 224 CPU cores, 12 TB total memory, 6 TB DRAM, 6 TB memory optane, + #: 18.9 TB storage, SDFLEX hardware type""" + S448_OO = "S448oo" + """8 sockets, 448 CPU threads, 224 CPU cores, 9 TB total memory, 3 TB DRAM, 6 TB memory optane, + #: 14.8 TB storage, SDFLEX hardware type""" + S448_OOM = "S448oom" + """8 sockets, 448 CPU threads, 224 CPU cores, 18 TB total memory, 6 TB DRAM, 12 memory optane, + #: 27.4 TB storage, SDFLEX hardware type""" + S448_OOO = "S448ooo" + """8 sockets, 448 CPU threads, 224 CPU cores, 15 TB total memory, 3 TB DRAM, 12 memory optane, + #: 23.2 TB storage, SDFLEX hardware type""" + S448_SE = "S448se" + """8 sockets, 448 CPU threads, 12 TB total memory, SDFLEX hardware type""" + S576_M = "S576m" + """12 sockets, 576 CPU threads, 288 CPU cores, 12 TB total memory, 12 TB DRAM, 28 TB storage, + #: HPEMc990x hardware type""" + S576_XM = "S576xm" + """12 sockets, 576 CPU threads, 288 CPU cores, 18 TB total memory, HPEMc990x hardware type""" + S672 = "S672" + """12 sockets, 672 CPU threads, 336 CPU cores, 9 TB total memory, 9 TB DRAM, 14.7 TB storage, + #: SDFLEX hardware type""" + S672_M = "S672m" + """12 sockets, 672 CPU threads, 336 CPU cores, 18 TB total memory, 18 TB DRAM, 27.4 TB storage, + #: SDFLEX hardware type""" + S672_OM = "S672om" + """12 sockets, 672 CPU threads, 336 CPU cores, 18 TB total memory, 9 TB DRAM, 9 TB memory optane, + #: 27.4 TB storage, SDFLEX hardware type""" + S672_OO = "S672oo" + """12 sockets, 672 CPU threads, 336 CPU cores, 13.5 TB total memory, 4.5 TB DRAM, 9 TB memory + #: optane, 21.1 TB storage, SDFLEX hardware type""" + S672_OOM = "S672oom" + """12 sockets, 672 CPU threads, 336 CPU cores, 27 TB total memory, 9 TB DRAM, 18 TB memory optane, + #: 40 TB storage, SDFLEX hardware type""" + S672_OOO = "S672ooo" + """12 sockets, 672 CPU threads, 336 CPU cores, 22.5 TB total memory, 4.5 TB DRAM, 18 TB memory + #: optane, 33.7 TB storage, SDFLEX hardware type""" + S768 = "S768" + """No longer offered or used.""" + S768_M = "S768m" + """16 sockets, 768 CPU threads, 384 CPU cores, 16 TB total memory, 16 TB DRAM, 36 TB storage, + #: HPEMc990x hardware type""" + S768_XM = "S768xm" + """16 sockets, 768 CPU threads, 384 CPU cores, 24 TB total memory, 24 TB DRAM, 56 TB storage, + #: HPEMc990x hardware type""" + S896 = "S896" + """16 sockets, 896 CPU threads, 448 CPU cores, 12 TB total memory, 12 TB DRAM, 18.9 TB storage, + #: SDFLEX hardware type""" + S896_M = "S896m" + """16 sockets, 896 CPU threads, 448 CPU cores, 24 TB total memory, 24 TB DRAM, 35.8 TB storage, + #: SDFLEX hardware type""" + S896_OM = "S896om" + """16 sockets, 896 CPU threads, 448 CPU cores, 24 TB total memory, 12 TB DRAM, 12 TB memory + #: optane, 35.8 TB storage, SDFLEX hardware type""" + S896_OO = "S896oo" + """16 sockets, 896 CPU threads, 448 CPU cores, 18 TB total memory, 6 TB DRAM, 12 TB memory + #: optane, 27.4 TB storage, SDFLEX hardware type""" + S896_OOM = "S896oom" + """16 sockets, 896 CPU threads, 448 CPU cores, 36 TB total memory, 12 TB DRAM, 24 TB memory + #: optane, 52.7 TB storage, SDFLEX hardware type""" + S896_OOO = "S896ooo" + """16 sockets, 896 CPU threads, 448 CPU cores, 30 TB total memory, 6 TB DRAM, 24 TB memory optane, + #: 44.3 TB storage, SDFLEX hardware type""" + S960_M = "S960m" + """20 sockets, 960 CPU threads, 480 CPU cores, 20 TB total memory, 20 TB DRAM, 46 TB storage, + #: HPEMc990x hardware type""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """An enum of possible operation states for an AzureLargeStorageInstances.""" + + ACCEPTED = "Accepted" + """Accepted means ARM resource has been accepted.""" + CREATING = "Creating" + """Creating means ARM resource is being created.""" + UPDATING = "Updating" + """Updating means an existing ARM resource is being updated""" + FAILED = "Failed" + """Failed means resource is in failed state""" + SUCCEEDED = "Succeeded" + """Succeeded means resource creation succeeded during last create/update""" + DELETING = "Deleting" + """Deleting means resource is in the process of being deleted""" + CANCELED = "Canceled" + """Cancelled means resource operation has been cancelled""" + MIGRATING = "Migrating" + """Migrating means resource is being migrated from one subscription or resource group to another""" + + +class Versions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Azure Large Instance api versions.""" + + V2023_07_20_PREVIEW = "2023-07-20-preview" + """Azure Large Instance api version 2023-07-20-preview.""" diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_models_py3.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_models_py3.py new file mode 100644 index 000000000000..0c8889d84d50 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_models_py3.py @@ -0,0 +1,1196 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.azurelargeinstance.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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. E.g. + "/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.azurelargeinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AzureLargeInstance(TrackedResource): + """Azure Large Instance info on Azure (ARM properties and AzureLargeInstance + 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 id: Fully qualified resource ID for the resource. E.g. + "/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.azurelargeinstance.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 properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "AzureLargeInstanceProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AzureLargeInstanceProperties"] = 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 properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AzureLargeInstanceListResult(_serialization.Model): + """The response of a AzureLargeInstance list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The AzureLargeInstance items on this page. Required. + :vartype value: list[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AzureLargeInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AzureLargeInstance"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AzureLargeInstance items on this page. Required. + :paramtype value: list[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureLargeInstanceProperties(_serialization.Model): + """Describes the properties of an Azure Large Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hardware_profile: Specifies the hardware settings for the Azure Large Instance. + :vartype hardware_profile: ~azure.mgmt.azurelargeinstance.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the Azure Large Instance disks. + :vartype storage_profile: ~azure.mgmt.azurelargeinstance.models.StorageProfile + :ivar os_profile: Specifies the operating system settings for the Azure Large Instance. + :vartype os_profile: ~azure.mgmt.azurelargeinstance.models.OsProfile + :ivar network_profile: Specifies the network settings for the Azure Large Instance. + :vartype network_profile: ~azure.mgmt.azurelargeinstance.models.NetworkProfile + :ivar azure_large_instance_id: Specifies the Azure Large Instance unique ID. + :vartype azure_large_instance_id: str + :ivar power_state: Resource power state. Known values are: "starting", "started", "stopping", + "stopped", "restarting", and "unknown". + :vartype power_state: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstancePowerStateEnum + :ivar proximity_placement_group: Resource proximity placement group. + :vartype proximity_placement_group: str + :ivar hw_revision: Hardware revision of an Azure Large Instance. + :vartype hw_revision: str + :ivar partner_node_id: ARM ID of another AzureLargeInstance that will share a network with this + AzureLargeInstance. + :vartype partner_node_id: str + :ivar provisioning_state: State of provisioning of the AzureLargeInstance. Known values are: + "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating", and + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceProvisioningStatesEnum + """ + + _validation = { + "azure_large_instance_id": {"readonly": True}, + "power_state": {"readonly": True}, + "proximity_placement_group": {"readonly": True}, + "hw_revision": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfile"}, + "storage_profile": {"key": "storageProfile", "type": "StorageProfile"}, + "os_profile": {"key": "osProfile", "type": "OsProfile"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + "azure_large_instance_id": {"key": "azureLargeInstanceId", "type": "str"}, + "power_state": {"key": "powerState", "type": "str"}, + "proximity_placement_group": {"key": "proximityPlacementGroup", "type": "str"}, + "hw_revision": {"key": "hwRevision", "type": "str"}, + "partner_node_id": {"key": "partnerNodeId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + hardware_profile: Optional["_models.HardwareProfile"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + os_profile: Optional["_models.OsProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + partner_node_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword hardware_profile: Specifies the hardware settings for the Azure Large Instance. + :paramtype hardware_profile: ~azure.mgmt.azurelargeinstance.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the Azure Large Instance disks. + :paramtype storage_profile: ~azure.mgmt.azurelargeinstance.models.StorageProfile + :keyword os_profile: Specifies the operating system settings for the Azure Large Instance. + :paramtype os_profile: ~azure.mgmt.azurelargeinstance.models.OsProfile + :keyword network_profile: Specifies the network settings for the Azure Large Instance. + :paramtype network_profile: ~azure.mgmt.azurelargeinstance.models.NetworkProfile + :keyword partner_node_id: ARM ID of another AzureLargeInstance that will share a network with + this + AzureLargeInstance. + :paramtype partner_node_id: str + """ + super().__init__(**kwargs) + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.os_profile = os_profile + self.network_profile = network_profile + self.azure_large_instance_id = None + self.power_state = None + self.proximity_placement_group = None + self.hw_revision = None + self.partner_node_id = partner_node_id + self.provisioning_state = None + + +class AzureLargeInstanceTagsUpdate(_serialization.Model): + """The type used for updating tags in AzureLargeInstance resources. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 AzureLargeStorageInstance(TrackedResource): + """AzureLargeStorageInstance info on Azure (ARM properties and + AzureLargeStorageInstance 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 id: Fully qualified resource ID for the resource. E.g. + "/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.azurelargeinstance.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 properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "AzureLargeStorageInstanceProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AzureLargeStorageInstanceProperties"] = 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 properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AzureLargeStorageInstanceListResult(_serialization.Model): + """The response of a AzureLargeStorageInstance list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The AzureLargeStorageInstance items on this page. Required. + :vartype value: list[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AzureLargeStorageInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AzureLargeStorageInstance"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AzureLargeStorageInstance items on this page. Required. + :paramtype value: list[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureLargeStorageInstanceProperties(_serialization.Model): + """Describes the properties of an AzureLargeStorageInstance. + + :ivar azure_large_storage_instance_unique_identifier: Specifies the AzureLargeStorageInstance + unique ID. + :vartype azure_large_storage_instance_unique_identifier: str + :ivar storage_properties: Specifies the storage properties for the AzureLargeStorage instance. + :vartype storage_properties: ~azure.mgmt.azurelargeinstance.models.StorageProperties + """ + + _attribute_map = { + "azure_large_storage_instance_unique_identifier": { + "key": "azureLargeStorageInstanceUniqueIdentifier", + "type": "str", + }, + "storage_properties": {"key": "storageProperties", "type": "StorageProperties"}, + } + + def __init__( + self, + *, + azure_large_storage_instance_unique_identifier: Optional[str] = None, + storage_properties: Optional["_models.StorageProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_large_storage_instance_unique_identifier: Specifies the + AzureLargeStorageInstance unique ID. + :paramtype azure_large_storage_instance_unique_identifier: str + :keyword storage_properties: Specifies the storage properties for the AzureLargeStorage + instance. + :paramtype storage_properties: ~azure.mgmt.azurelargeinstance.models.StorageProperties + """ + super().__init__(**kwargs) + self.azure_large_storage_instance_unique_identifier = azure_large_storage_instance_unique_identifier + self.storage_properties = storage_properties + + +class AzureLargeStorageInstanceTagsUpdate(_serialization.Model): + """The type used for updating tags in AzureLargeStorageInstance resources. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 Disk(_serialization.Model): + """Specifies the disk information fo the Azure Large Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The disk name. + :vartype name: str + :ivar disk_size_gb: Specifies the size of an empty data disk in gigabytes. + :vartype disk_size_gb: int + :ivar lun: Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data + disk attached to a VM. + :vartype lun: int + """ + + _validation = { + "lun": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, + "lun": {"key": "lun", "type": "int"}, + } + + def __init__(self, *, name: Optional[str] = None, disk_size_gb: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword name: The disk name. + :paramtype name: str + :keyword disk_size_gb: Specifies the size of an empty data disk in gigabytes. + :paramtype disk_size_gb: int + """ + super().__init__(**kwargs) + self.name = name + self.disk_size_gb = disk_size_gb + self.lun = None + + +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.azurelargeinstance.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.azurelargeinstance.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.azurelargeinstance.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.azurelargeinstance.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ForceState(_serialization.Model): + """The active state empowers the server with the ability to forcefully terminate + and halt any existing processes that may be running on the server. + + :ivar force_state: Whether to force restart by shutting all processes. Known values are: + "active" and "inactive". + :vartype force_state: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceForcePowerState + """ + + _attribute_map = { + "force_state": {"key": "forceState", "type": "str"}, + } + + def __init__( + self, *, force_state: Optional[Union[str, "_models.AzureLargeInstanceForcePowerState"]] = None, **kwargs: Any + ) -> None: + """ + :keyword force_state: Whether to force restart by shutting all processes. Known values are: + "active" and "inactive". + :paramtype force_state: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceForcePowerState + """ + super().__init__(**kwargs) + self.force_state = force_state + + +class HardwareProfile(_serialization.Model): + """Specifies the hardware settings for the Azure Large Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hardware_type: Name of the hardware type (vendor and/or their product name). Known values + are: "Cisco_UCS", "HPE", and "SDFLEX". + :vartype hardware_type: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceHardwareTypeNamesEnum + :ivar azure_large_instance_size: Specifies the Azure Large Instance SKU. Known values are: + "S72m", "S144m", "S72", "S144", "S192", "S192m", "S192xm", "S96", "S112", "S224", "S224m", + "S224om", "S224oo", "S224oom", "S224ooo", "S224se", "S384", "S384m", "S384xm", "S384xxm", + "S448", "S448m", "S448om", "S448oo", "S448oom", "S448ooo", "S448se", "S576m", "S576xm", "S672", + "S672m", "S672om", "S672oo", "S672oom", "S672ooo", "S768", "S768m", "S768xm", "S896", "S896m", + "S896om", "S896oo", "S896oom", "S896ooo", and "S960m". + :vartype azure_large_instance_size: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceSizeNamesEnum + """ + + _validation = { + "hardware_type": {"readonly": True}, + "azure_large_instance_size": {"readonly": True}, + } + + _attribute_map = { + "hardware_type": {"key": "hardwareType", "type": "str"}, + "azure_large_instance_size": {"key": "azureLargeInstanceSize", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.hardware_type = None + self.azure_large_instance_size = None + + +class IpAddress(_serialization.Model): + """Specifies the IP address of the network interface. + + :ivar ip_address: Specifies the IP address of the network interface. + :vartype ip_address: str + """ + + _attribute_map = { + "ip_address": {"key": "ipAddress", "type": "str"}, + } + + def __init__(self, *, ip_address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ip_address: Specifies the IP address of the network interface. + :paramtype ip_address: str + """ + super().__init__(**kwargs) + self.ip_address = ip_address + + +class NetworkProfile(_serialization.Model): + """Specifies the network settings for the Azure Large Instance disks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the network interfaces for the Azure Large Instance. + :vartype network_interfaces: list[~azure.mgmt.azurelargeinstance.models.IpAddress] + :ivar circuit_id: Specifies the circuit id for connecting to express route. + :vartype circuit_id: str + """ + + _validation = { + "circuit_id": {"readonly": True}, + } + + _attribute_map = { + "network_interfaces": {"key": "networkInterfaces", "type": "[IpAddress]"}, + "circuit_id": {"key": "circuitId", "type": "str"}, + } + + def __init__(self, *, network_interfaces: Optional[List["_models.IpAddress"]] = None, **kwargs: Any) -> None: + """ + :keyword network_interfaces: Specifies the network interfaces for the Azure Large Instance. + :paramtype network_interfaces: list[~azure.mgmt.azurelargeinstance.models.IpAddress] + """ + super().__init__(**kwargs) + self.network_interfaces = network_interfaces + self.circuit_id = None + + +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 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.azurelargeinstance.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.azurelargeinstance.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.azurelargeinstance.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.azurelargeinstance.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.azurelargeinstance.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. + + 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 ID for the async operation. + :vartype id: str + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.azurelargeinstance.models.ErrorDetail + """ + + _validation = { + "resource_id": {"readonly": True}, + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[OperationStatusResult]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: list[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.azurelargeinstance.models.ErrorDetail + """ + super().__init__(**kwargs) + self.id = id + self.resource_id = None + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class OsProfile(_serialization.Model): + """Specifies the operating system settings for the Azure Large Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar computer_name: Specifies the host OS name of the Azure Large Instance. + :vartype computer_name: str + :ivar os_type: This property allows you to specify the type of the OS. + :vartype os_type: str + :ivar version: Specifies version of operating system. + :vartype version: str + :ivar ssh_public_key: Specifies the SSH public key used to access the operating system. + :vartype ssh_public_key: str + """ + + _validation = { + "os_type": {"readonly": True}, + "version": {"readonly": True}, + } + + _attribute_map = { + "computer_name": {"key": "computerName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "ssh_public_key": {"key": "sshPublicKey", "type": "str"}, + } + + def __init__( + self, *, computer_name: Optional[str] = None, ssh_public_key: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword computer_name: Specifies the host OS name of the Azure Large Instance. + :paramtype computer_name: str + :keyword ssh_public_key: Specifies the SSH public key used to access the operating system. + :paramtype ssh_public_key: str + """ + super().__init__(**kwargs) + self.computer_name = computer_name + self.os_type = None + self.version = None + self.ssh_public_key = ssh_public_key + + +class StorageBillingProperties(_serialization.Model): + """Describes the billing related details of the AzureLargeStorageInstance. + + :ivar billing_mode: the billing mode for the storage instance. + :vartype billing_mode: str + :ivar sku: the SKU type that is provisioned. + :vartype sku: str + """ + + _attribute_map = { + "billing_mode": {"key": "billingMode", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + } + + def __init__(self, *, billing_mode: Optional[str] = None, sku: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword billing_mode: the billing mode for the storage instance. + :paramtype billing_mode: str + :keyword sku: the SKU type that is provisioned. + :paramtype sku: str + """ + super().__init__(**kwargs) + self.billing_mode = billing_mode + self.sku = sku + + +class StorageProfile(_serialization.Model): + """Specifies the storage settings for the Azure Large Instance disks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar nfs_ip_address: IP Address to connect to storage. + :vartype nfs_ip_address: str + :ivar os_disks: Specifies information about the operating system disk used by Azure Large + Instance. + :vartype os_disks: list[~azure.mgmt.azurelargeinstance.models.Disk] + """ + + _validation = { + "nfs_ip_address": {"readonly": True}, + } + + _attribute_map = { + "nfs_ip_address": {"key": "nfsIpAddress", "type": "str"}, + "os_disks": {"key": "osDisks", "type": "[Disk]"}, + } + + def __init__(self, *, os_disks: Optional[List["_models.Disk"]] = None, **kwargs: Any) -> None: + """ + :keyword os_disks: Specifies information about the operating system disk used by Azure Large + Instance. + :paramtype os_disks: list[~azure.mgmt.azurelargeinstance.models.Disk] + """ + super().__init__(**kwargs) + self.nfs_ip_address = None + self.os_disks = os_disks + + +class StorageProperties(_serialization.Model): + """described the storage properties of the azure large storage instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of provisioning of the AzureLargeStorageInstance. Known values + are: "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Canceled", and + "Migrating". + :vartype provisioning_state: str or ~azure.mgmt.azurelargeinstance.models.ProvisioningState + :ivar offering_type: the offering type for which the resource is getting provisioned. + :vartype offering_type: str + :ivar storage_type: the storage protocol for which the resource is getting provisioned. + :vartype storage_type: str + :ivar generation: the kind of storage instance. + :vartype generation: str + :ivar hardware_type: the hardware type of the storage instance. Known values are: "Cisco_UCS", + "HPE", and "SDFLEX". + :vartype hardware_type: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceHardwareTypeNamesEnum + :ivar workload_type: the workload for which the resource is getting provisioned. + :vartype workload_type: str + :ivar storage_billing_properties: the billing related information for the resource. + :vartype storage_billing_properties: + ~azure.mgmt.azurelargeinstance.models.StorageBillingProperties + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "offering_type": {"key": "offeringType", "type": "str"}, + "storage_type": {"key": "storageType", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "hardware_type": {"key": "hardwareType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "storage_billing_properties": {"key": "storageBillingProperties", "type": "StorageBillingProperties"}, + } + + def __init__( + self, + *, + offering_type: Optional[str] = None, + storage_type: Optional[str] = None, + generation: Optional[str] = None, + hardware_type: Optional[Union[str, "_models.AzureLargeInstanceHardwareTypeNamesEnum"]] = None, + workload_type: Optional[str] = None, + storage_billing_properties: Optional["_models.StorageBillingProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword offering_type: the offering type for which the resource is getting provisioned. + :paramtype offering_type: str + :keyword storage_type: the storage protocol for which the resource is getting provisioned. + :paramtype storage_type: str + :keyword generation: the kind of storage instance. + :paramtype generation: str + :keyword hardware_type: the hardware type of the storage instance. Known values are: + "Cisco_UCS", "HPE", and "SDFLEX". + :paramtype hardware_type: str or + ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceHardwareTypeNamesEnum + :keyword workload_type: the workload for which the resource is getting provisioned. + :paramtype workload_type: str + :keyword storage_billing_properties: the billing related information for the resource. + :paramtype storage_billing_properties: + ~azure.mgmt.azurelargeinstance.models.StorageBillingProperties + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.offering_type = offering_type + self.storage_type = storage_type + self.generation = generation + self.hardware_type = hardware_type + self.workload_type = workload_type + self.storage_billing_properties = storage_billing_properties + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.azurelargeinstance.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.azurelargeinstance.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.azurelargeinstance.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.azurelargeinstance.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Tags(_serialization.Model): + """Tags field of the AzureLargeInstance instance. + + :ivar tags: Tags field of the AzureLargeInstance instance. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Tags field of the AzureLargeInstance instance. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_patch.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/__init__.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/__init__.py new file mode 100644 index 000000000000..9b4f2bf7ab5c --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._azure_large_instance_operations import AzureLargeInstanceOperations +from ._azure_large_storage_instance_operations import AzureLargeStorageInstanceOperations + +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", + "AzureLargeInstanceOperations", + "AzureLargeStorageInstanceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_instance_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_instance_operations.py new file mode 100644 index 000000000000..45c2e30369a0 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_instance_operations.py @@ -0,0 +1,1184 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_get_request( + resource_group_name: str, azure_large_instance_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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeInstanceName": _SERIALIZER.url( + "azure_large_instance_name", azure_large_instance_name, "str", pattern=r".*" + ), + } + + _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, azure_large_instance_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-07-20-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.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeInstanceName": _SERIALIZER.url( + "azure_large_instance_name", azure_large_instance_name, "str", pattern=r".*" + ), + } + + _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_restart_request( + resource_group_name: str, azure_large_instance_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-07-20-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.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeInstanceName": _SERIALIZER.url( + "azure_large_instance_name", azure_large_instance_name, "str", pattern=r".*" + ), + } + + _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_shutdown_request( + resource_group_name: str, azure_large_instance_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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeInstanceName": _SERIALIZER.url( + "azure_large_instance_name", azure_large_instance_name, "str", pattern=r".*" + ), + } + + _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_start_request( + resource_group_name: str, azure_large_instance_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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeInstanceName": _SERIALIZER.url( + "azure_large_instance_name", azure_large_instance_name, "str", pattern=r".*" + ), + } + + _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 AzureLargeInstanceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.LargeInstanceMgmtClient`'s + :attr:`azure_large_instance` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AzureLargeInstance"]: + """Gets a list of Azure Large Instances in the specified subscription. The + operations returns various properties of each Azure Large Instance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureLargeInstance or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :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.AzureLargeInstanceListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureLargeInstanceListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AzureLargeInstance"]: + """Gets a list of Azure Large Instances in the specified subscription and resource + group. The operations returns various properties of each Azure Large Instance. + + :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 AzureLargeInstance or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeInstance] + :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.AzureLargeInstanceListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureLargeInstanceListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" + } + + @distributed_trace + def get( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> _models.AzureLargeInstance: + """Gets an Azure Large Instance for the specified subscription, resource group, + and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :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.AzureLargeInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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("AzureLargeInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + } + + @overload + def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: _models.AzureLargeInstanceTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceTagsUpdate + :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: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + azure_large_instance_name: str, + properties: Union[_models.AzureLargeInstanceTagsUpdate, IO], + **kwargs: Any + ) -> _models.AzureLargeInstance: + """Patches the Tags field of an Azure Large Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param properties: The resource properties to be updated. Is either a + AzureLargeInstanceTagsUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstanceTagsUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureLargeInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AzureLargeInstanceTagsUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + 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) + + _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("AzureLargeInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" + } + + def _restart_initial( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[Union[_models.ForceState, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(force_parameter, (IOBase, bytes)): + _content = force_parameter + else: + if force_parameter is not None: + _json = self._serialize.body(force_parameter, "ForceState") + else: + _json = None + + request = build_restart_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._restart_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" + } + + @overload + def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[_models.ForceState] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Default value is None. + :type force_parameter: ~azure.mgmt.azurelargeinstance.models.ForceState + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Default value is None. + :type force_parameter: 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restart( + self, + resource_group_name: str, + azure_large_instance_name: str, + force_parameter: Optional[Union[_models.ForceState, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """The operation to restart an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_name: str + :param force_parameter: When set to 'active', this parameter empowers the server with the + ability to forcefully terminate and halt any existing processes that may be running on the + server. Is either a ForceState type or a IO type. Default value is None. + :type force_parameter: ~azure.mgmt.azurelargeinstance.models.ForceState 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._restart_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + force_parameter=force_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" + } + + def _shutdown_initial( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + 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[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_shutdown_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._shutdown_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _shutdown_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" + } + + @distributed_trace + def begin_shutdown( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """The operation to shutdown an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._shutdown_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_shutdown.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" + } + + def _start_initial( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + 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[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" + } + + @distributed_trace + def begin_start( + self, resource_group_name: str, azure_large_instance_name: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """The operation to start an Azure Large Instance (only for compute instances). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_instance_name: Name of the AzureLargeInstance. Required. + :type azure_large_instance_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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurelargeinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_initial( + resource_group_name=resource_group_name, + azure_large_instance_name=azure_large_instance_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): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" + } diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_storage_instance_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_storage_instance_operations.py new file mode 100644 index 000000000000..1d137708a1a3 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_azure_large_storage_instance_operations.py @@ -0,0 +1,579 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_get_request( + resource_group_name: str, azure_large_storage_instance_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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeStorageInstanceName": _SERIALIZER.url( + "azure_large_storage_instance_name", azure_large_storage_instance_name, "str", pattern=r".*" + ), + } + + _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, azure_large_storage_instance_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-07-20-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.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "azureLargeStorageInstanceName": _SERIALIZER.url( + "azure_large_storage_instance_name", azure_large_storage_instance_name, "str", pattern=r".*" + ), + } + + _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) + + +class AzureLargeStorageInstanceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.LargeInstanceMgmtClient`'s + :attr:`azure_large_storage_instance` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AzureLargeStorageInstance"]: + """Gets a list of AzureLargeStorageInstances in the specified subscription. The + operations returns various properties of each Azure LargeStorage instance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureLargeStorageInstance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :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.AzureLargeStorageInstanceListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureLargeStorageInstanceListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AzureLargeStorageInstance"]: + """Gets a list of AzureLargeStorageInstances in the specified subscription and + resource group. The operations returns various properties of each Azure + LargeStorage instance. + + :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 AzureLargeStorageInstance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance] + :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.AzureLargeStorageInstanceListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureLargeStorageInstanceListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" + } + + @distributed_trace + def get( + self, resource_group_name: str, azure_large_storage_instance_name: str, **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Gets an Azure Large Storage instance for the specified subscription, resource + group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :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.AzureLargeStorageInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + azure_large_storage_instance_name=azure_large_storage_instance_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("AzureLargeStorageInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + } + + @overload + def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: _models.AzureLargeStorageInstanceTagsUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceTagsUpdate + :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: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + azure_large_storage_instance_name: str, + properties: Union[_models.AzureLargeStorageInstanceTagsUpdate, IO], + **kwargs: Any + ) -> _models.AzureLargeStorageInstance: + """Patches the Tags field of a Azure Large Storage Instance for the specified + subscription, resource group, and instance name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_large_storage_instance_name: Name of the AzureLargeStorageInstance. Required. + :type azure_large_storage_instance_name: str + :param properties: The resource properties to be updated. Is either a + AzureLargeStorageInstanceTagsUpdate type or a IO type. Required. + :type properties: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstanceTagsUpdate or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureLargeStorageInstance or the result of cls(response) + :rtype: ~azure.mgmt.azurelargeinstance.models.AzureLargeStorageInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AzureLargeStorageInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AzureLargeStorageInstanceTagsUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + azure_large_storage_instance_name=azure_large_storage_instance_name, + 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) + + _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("AzureLargeStorageInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" + } diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_operations.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_operations.py new file mode 100644 index 000000000000..2565456bf2da --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-07-20-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AzureLargeInstance/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurelargeinstance.LargeInstanceMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurelargeinstance.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.AzureLargeInstance/operations"} diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_patch.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/py.typed b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/azure/mgmt/azurelargeinstance/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_get.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_get.py new file mode 100644 index 000000000000..83774810afe3 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_instance.get( + resource_group_name="myResourceGroup", + azure_large_instance_name="myAzureLargeInstance", + ) + print(response) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_resource_group.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_resource_group.py new file mode 100644 index 000000000000..2e813660d9a5 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_list_by_resource_group.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_instance.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_subscription.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_subscription.py new file mode 100644 index 000000000000..5d6a9651a97e --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_list_by_subscription.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_instance.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_operations_list.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_operations_list.py new file mode 100644 index 000000000000..1144b0f82b38 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_operations_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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstanceOperations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_restart.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_restart.py new file mode 100644 index 000000000000..e167d0f5001d --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_restart.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_restart.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.azure_large_instance.begin_restart( + resource_group_name="myResourceGroup", + azure_large_instance_name="myALInstance", + ).result() + print(response) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Restart.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_shutdown.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_shutdown.py new file mode 100644 index 000000000000..ab8d96de96e7 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_shutdown.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_shutdown.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.azure_large_instance.begin_shutdown( + resource_group_name="myResourceGroup", + azure_large_instance_name="myALInstance", + ).result() + print(response) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Shutdown.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_start.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_start.py new file mode 100644 index 000000000000..b66a32a9bc3a --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_instance_start.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_instance_start.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.azure_large_instance.begin_start( + resource_group_name="myResourceGroup", + azure_large_instance_name="myALInstance", + ).result() + print(response) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Start.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_get.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_get.py new file mode 100644 index 000000000000..7cadfd5c5296 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_storage_instance_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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_storage_instance.get( + resource_group_name="myResourceGroup", + azure_large_storage_instance_name="myAzureLargeStorageInstance", + ) + print(response) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_resource_group.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_resource_group.py new file mode 100644 index 000000000000..b30e377cdc37 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_storage_instance_list_by_resource_group.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_storage_instance.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_subscription.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_subscription.py new file mode 100644 index 000000000000..a11426e7296f --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/generated_samples/azure_large_storage_instance_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.azurelargeinstance import LargeInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurelargeinstance +# USAGE + python azure_large_storage_instance_list_by_subscription.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 = LargeInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", + ) + + response = client.azure_large_storage_instance.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/sdk_packaging.toml b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/sdk_packaging.toml new file mode 100644 index 000000000000..0ff59a46abfe --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-azurelargeinstance" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/setup.py b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/setup.py new file mode 100644 index 000000000000..1fcb9875e95b --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-azurelargeinstance" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/azurelargeinstance/ci.yml b/sdk/azurelargeinstance/ci.yml new file mode 100644 index 000000000000..66b21e1bc91d --- /dev/null +++ b/sdk/azurelargeinstance/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azurelargeinstance/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azurelargeinstance/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azurelargeinstance + TestProxy: true + Artifacts: + - name: azure-mgmt-azurelargeinstance + safeName: azuremgmtazurelargeinstance diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json index ff7441707e7c..1b38732ffbd5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4b7481587132ce0bde5f0a6d6ab590129f7b7179", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/cognitiveservices/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/cognitiveservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py index abaa9824b87e..8a19f243b6ba 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py @@ -22,10 +22,15 @@ CommitmentTiersOperations, DeletedAccountsOperations, DeploymentsOperations, + EncryptionScopesOperations, ModelsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + RaiBlocklistItemsOperations, + RaiBlocklistsOperations, + RaiContentFiltersOperations, + RaiPoliciesOperations, ResourceSkusOperations, UsagesOperations, ) @@ -64,14 +69,26 @@ class CognitiveServicesManagementClient( :vartype deployments: azure.mgmt.cognitiveservices.operations.DeploymentsOperations :ivar commitment_plans: CommitmentPlansOperations operations :vartype commitment_plans: azure.mgmt.cognitiveservices.operations.CommitmentPlansOperations + :ivar encryption_scopes: EncryptionScopesOperations operations + :vartype encryption_scopes: azure.mgmt.cognitiveservices.operations.EncryptionScopesOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.cognitiveservices.operations.RaiPoliciesOperations + :ivar rai_blocklists: RaiBlocklistsOperations operations + :vartype rai_blocklists: azure.mgmt.cognitiveservices.operations.RaiBlocklistsOperations + :ivar rai_blocklist_items: RaiBlocklistItemsOperations operations + :vartype rai_blocklist_items: + azure.mgmt.cognitiveservices.operations.RaiBlocklistItemsOperations + :ivar rai_content_filters: RaiContentFiltersOperations operations + :vartype rai_content_filters: + azure.mgmt.cognitiveservices.operations.RaiContentFiltersOperations :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-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. @@ -114,6 +131,17 @@ def __init__( self.commitment_plans = CommitmentPlansOperations( self._client, self._config, self._serialize, self._deserialize ) + self.encryption_scopes = EncryptionScopesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_blocklists = RaiBlocklistsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_blocklist_items = RaiBlocklistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.rai_content_filters = RaiContentFiltersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py index 7cfb8d0ace29..e41f2863c518 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py @@ -29,14 +29,14 @@ class CognitiveServicesManagementClientConfiguration(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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-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(CognitiveServicesManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py index 1866139c50f9..aa1538903582 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class CognitiveServicesManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py index 59a719dd7a03..75a1436b862f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "13.5.0" +VERSION = "11.0.0b1" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py index 81522e39b1e2..991ae2da9e47 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py @@ -22,10 +22,15 @@ CommitmentTiersOperations, DeletedAccountsOperations, DeploymentsOperations, + EncryptionScopesOperations, ModelsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + RaiBlocklistItemsOperations, + RaiBlocklistsOperations, + RaiContentFiltersOperations, + RaiPoliciesOperations, ResourceSkusOperations, UsagesOperations, ) @@ -67,14 +72,27 @@ class CognitiveServicesManagementClient( :ivar commitment_plans: CommitmentPlansOperations operations :vartype commitment_plans: azure.mgmt.cognitiveservices.aio.operations.CommitmentPlansOperations + :ivar encryption_scopes: EncryptionScopesOperations operations + :vartype encryption_scopes: + azure.mgmt.cognitiveservices.aio.operations.EncryptionScopesOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.cognitiveservices.aio.operations.RaiPoliciesOperations + :ivar rai_blocklists: RaiBlocklistsOperations operations + :vartype rai_blocklists: azure.mgmt.cognitiveservices.aio.operations.RaiBlocklistsOperations + :ivar rai_blocklist_items: RaiBlocklistItemsOperations operations + :vartype rai_blocklist_items: + azure.mgmt.cognitiveservices.aio.operations.RaiBlocklistItemsOperations + :ivar rai_content_filters: RaiContentFiltersOperations operations + :vartype rai_content_filters: + azure.mgmt.cognitiveservices.aio.operations.RaiContentFiltersOperations :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-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. @@ -117,6 +135,17 @@ def __init__( self.commitment_plans = CommitmentPlansOperations( self._client, self._config, self._serialize, self._deserialize ) + self.encryption_scopes = EncryptionScopesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_blocklists = RaiBlocklistsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_blocklist_items = RaiBlocklistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.rai_content_filters = RaiContentFiltersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py index b3746e44eafd..02cab76e9954 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py @@ -29,14 +29,14 @@ class CognitiveServicesManagementClientConfiguration(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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-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(CognitiveServicesManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py index 26043fb0a303..1c8b275c8cc9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py @@ -18,6 +18,11 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._deployments_operations import DeploymentsOperations from ._commitment_plans_operations import CommitmentPlansOperations +from ._encryption_scopes_operations import EncryptionScopesOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_blocklists_operations import RaiBlocklistsOperations +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations +from ._rai_content_filters_operations import RaiContentFiltersOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -36,6 +41,11 @@ "PrivateLinkResourcesOperations", "DeploymentsOperations", "CommitmentPlansOperations", + "EncryptionScopesOperations", + "RaiPoliciesOperations", + "RaiBlocklistsOperations", + "RaiBlocklistItemsOperations", + "RaiContentFiltersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py index 9335902dd41f..37f2e9bf55b9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py @@ -36,6 +36,8 @@ build_delete_request, build_get_request, build_list_request, + build_list_skus_request, + build_update_request, ) from .._vendor import CognitiveServicesManagementClientMixinABC @@ -466,6 +468,251 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" } + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, IO], + **kwargs: Any + ) -> Optional[_models.Deployment]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Deployment]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment, (IOBase, bytes)): + _content = deployment + else: + _json = self._serialize.body(deployment, "PatchResourceTagsAndSku") + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Deployment", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: _models.PatchResourceTagsAndSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku + :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 Deployment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Deployment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Is either a PatchResourceTagsAndSku type or a IO + type. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Deployment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :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.Deployment] = 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, + account_name=account_name, + deployment_name=deployment_name, + deployment=deployment, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Deployment", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" + } + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> None: @@ -584,3 +831,100 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" } + + @distributed_trace + def list_skus( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SkuResource"]: + """Lists the specified deployments skus associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: 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.cognitiveservices.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.DeploymentSkuListResult] = 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_skus_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + 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) + + 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("DeploymentSkuListResult", 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_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py new file mode 100644 index 000000000000..5c3320bdaed6 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py @@ -0,0 +1,508 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._encryption_scopes_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import CognitiveServicesManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EncryptionScopesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`encryption_scopes` 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, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.EncryptionScope"]: + """Gets the 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EncryptionScope or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.EncryptionScope] + :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.EncryptionScopeListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + 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("EncryptionScopeListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> _models.EncryptionScope: + """Gets the specified EncryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :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.EncryptionScope] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_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 = 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("EncryptionScope", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: _models.EncryptionScope, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :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: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: Union[_models.EncryptionScope, IO], + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Is either a EncryptionScope type or a + IO type. Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EncryptionScope] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(encryption_scope, (IOBase, bytes)): + _content = encryption_scope + else: + _json = self._serialize.body(encryption_scope, "EncryptionScope") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("EncryptionScope", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("EncryptionScope", pipeline_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.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, encryption_scope_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, + account_name=account_name, + encryption_scope_name=encryption_scope_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_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, + account_name=account_name, + encryption_scope_name=encryption_scope_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.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py new file mode 100644 index 000000000000..946f9a76126a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py @@ -0,0 +1,551 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rai_blocklist_items_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import CognitiveServicesManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RaiBlocklistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`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, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RaiBlocklistItem"]: + """Gets the blocklist items associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiBlocklistItem or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] + :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.RaiBlockListItemsResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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) + + 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("RaiBlockListItemsResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Gets the specified custom blocklist Item associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :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.RaiBlocklistItem] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_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, + 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 = 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("RaiBlocklistItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: _models.RaiBlocklistItem, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :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: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: Union[_models.RaiBlocklistItem, IO], + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Is either a + RaiBlocklistItem type or a IO type. Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiBlocklistItem] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_blocklist_item, (IOBase, bytes)): + _content = rai_blocklist_item + else: + _json = self._serialize.body(rai_blocklist_item, "RaiBlocklistItem") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiBlocklistItem", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiBlocklistItem", pipeline_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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_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, + account_name=account_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, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified blocklist Item associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_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, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py new file mode 100644 index 000000000000..fb4eb4c82d20 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py @@ -0,0 +1,508 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rai_blocklists_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import CognitiveServicesManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RaiBlocklistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`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, account_name: str, **kwargs: Any) -> AsyncIterable["_models.RaiBlocklist"]: + """Gets the custom blocklists 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiBlocklist or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklist] + :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.RaiBlockListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + 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("RaiBlockListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> _models.RaiBlocklist: + """Gets the specified custom blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :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.RaiBlocklist] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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 = 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("RaiBlocklist", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: _models.RaiBlocklist, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :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: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: Union[_models.RaiBlocklist, IO], + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Is either a RaiBlocklist type + or a IO type. Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiBlocklist] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_blocklist, (IOBase, bytes)): + _content = rai_blocklist + else: + _json = self._serialize.body(rai_blocklist, "RaiBlocklist") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_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, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiBlocklist", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiBlocklist", pipeline_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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, rai_blocklist_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, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_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, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py similarity index 79% rename from sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_skus_operations.py rename to sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py index be94838ae620..0b41f17d7f43 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,24 +27,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request +from ...operations._rai_content_filters_operations import build_list_request +from .._vendor import CognitiveServicesManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SkusOperations: +class RaiContentFiltersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redisenterprise.aio.RedisEnterpriseManagementClient`'s - :attr:`skus` attribute. + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`rai_content_filters` attribute. """ models = _models @@ -58,24 +54,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RegionSkuDetail"]: - """Gets information about skus in specified location for the given subscription id. + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RaiContentFilter"]: + """List Content Filters types. - :param location: The name of Azure region. Required. + :param location: Resource location. 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 RegionSkuDetail or the result of cls(response) + :return: An iterator like instance of either RaiContentFilter or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.RegionSkuDetail] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.RaiContentFilter] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.RegionSkuDetails] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -118,11 +112,11 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("RegionSkuDetails", pipeline_response) + deserialized = self._deserialize("RaiContentFilterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) @@ -142,4 +136,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus"} + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py new file mode 100644 index 000000000000..01595e76e2a1 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py @@ -0,0 +1,507 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rai_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import CognitiveServicesManagementClientMixinABC + +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.cognitiveservices.aio.CognitiveServicesManagementClient`'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, account_name: str, **kwargs: Any) -> AsyncIterable["_models.RaiPolicy"]: + """Gets the 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicy or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.RaiPolicy] + :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.RaiPolicyListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + 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("RaiPolicyListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :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.RaiPolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_policy_name=rai_policy_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 = 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("RaiPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: _models.RaiPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :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: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: Union[_models.RaiPolicy, IO], + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Is either a RaiPolicy type or a + IO type. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_policy, (IOBase, bytes)): + _content = rai_policy + else: + _json = self._serialize.body(rai_policy, "RaiPolicy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_policy_name=rai_policy_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiPolicy", pipeline_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.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, rai_policy_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, + account_name=account_name, + rai_policy_name=rai_policy_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_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, + account_name=account_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py index 5b9928198255..ca51920b7019 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py @@ -33,12 +33,17 @@ from ._models_py3 import CommitmentTier from ._models_py3 import CommitmentTierListResult from ._models_py3 import Deployment +from ._models_py3 import DeploymentCapacitySettings from ._models_py3 import DeploymentListResult from ._models_py3 import DeploymentModel from ._models_py3 import DeploymentProperties from ._models_py3 import DeploymentScaleSettings +from ._models_py3 import DeploymentSkuListResult from ._models_py3 import DomainAvailability from ._models_py3 import Encryption +from ._models_py3 import EncryptionScope +from ._models_py3 import EncryptionScopeListResult +from ._models_py3 import EncryptionScopeProperties from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -67,6 +72,19 @@ from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import QuotaLimit +from ._models_py3 import RaiBlockListItemsResult +from ._models_py3 import RaiBlockListResult +from ._models_py3 import RaiBlocklist +from ._models_py3 import RaiBlocklistConfig +from ._models_py3 import RaiBlocklistItem +from ._models_py3 import RaiBlocklistItemProperties +from ._models_py3 import RaiBlocklistProperties +from ._models_py3 import RaiContentFilter +from ._models_py3 import RaiContentFilterListResult +from ._models_py3 import RaiPolicy +from ._models_py3 import RaiPolicyContentFilter +from ._models_py3 import RaiPolicyListResult +from ._models_py3 import RaiPolicyProperties from ._models_py3 import RegenerateKeyParameters from ._models_py3 import RegionSetting from ._models_py3 import RequestMatchPattern @@ -80,21 +98,27 @@ from ._models_py3 import SkuAvailabilityListResult from ._models_py3 import SkuCapability from ._models_py3 import SkuChangeInfo +from ._models_py3 import SkuResource from ._models_py3 import SystemData from ._models_py3 import ThrottlingRule from ._models_py3 import Usage from ._models_py3 import UsageListResult from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserOwnedAmlWorkspace from ._models_py3 import UserOwnedStorage from ._models_py3 import VirtualNetworkRule from ._cognitive_services_management_client_enums import AbusePenaltyAction from ._cognitive_services_management_client_enums import ActionType +from ._cognitive_services_management_client_enums import AllowedContentLevel +from ._cognitive_services_management_client_enums import ByPassSelection from ._cognitive_services_management_client_enums import CommitmentPlanProvisioningState from ._cognitive_services_management_client_enums import CreatedByType from ._cognitive_services_management_client_enums import DeploymentModelVersionUpgradeOption from ._cognitive_services_management_client_enums import DeploymentProvisioningState from ._cognitive_services_management_client_enums import DeploymentScaleType +from ._cognitive_services_management_client_enums import EncryptionScopeProvisioningState +from ._cognitive_services_management_client_enums import EncryptionScopeState from ._cognitive_services_management_client_enums import HostingModel from ._cognitive_services_management_client_enums import KeyName from ._cognitive_services_management_client_enums import KeySource @@ -106,6 +130,10 @@ from ._cognitive_services_management_client_enums import ProvisioningState from ._cognitive_services_management_client_enums import PublicNetworkAccess from ._cognitive_services_management_client_enums import QuotaUsageStatus +from ._cognitive_services_management_client_enums import RaiContentFilterType +from ._cognitive_services_management_client_enums import RaiPolicyContentSource +from ._cognitive_services_management_client_enums import RaiPolicyMode +from ._cognitive_services_management_client_enums import RaiPolicyType from ._cognitive_services_management_client_enums import ResourceIdentityType from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsReasonCode from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsType @@ -144,12 +172,17 @@ "CommitmentTier", "CommitmentTierListResult", "Deployment", + "DeploymentCapacitySettings", "DeploymentListResult", "DeploymentModel", "DeploymentProperties", "DeploymentScaleSettings", + "DeploymentSkuListResult", "DomainAvailability", "Encryption", + "EncryptionScope", + "EncryptionScopeListResult", + "EncryptionScopeProperties", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -178,6 +211,19 @@ "PrivateLinkServiceConnectionState", "ProxyResource", "QuotaLimit", + "RaiBlockListItemsResult", + "RaiBlockListResult", + "RaiBlocklist", + "RaiBlocklistConfig", + "RaiBlocklistItem", + "RaiBlocklistItemProperties", + "RaiBlocklistProperties", + "RaiContentFilter", + "RaiContentFilterListResult", + "RaiPolicy", + "RaiPolicyContentFilter", + "RaiPolicyListResult", + "RaiPolicyProperties", "RegenerateKeyParameters", "RegionSetting", "RequestMatchPattern", @@ -191,20 +237,26 @@ "SkuAvailabilityListResult", "SkuCapability", "SkuChangeInfo", + "SkuResource", "SystemData", "ThrottlingRule", "Usage", "UsageListResult", "UserAssignedIdentity", + "UserOwnedAmlWorkspace", "UserOwnedStorage", "VirtualNetworkRule", "AbusePenaltyAction", "ActionType", + "AllowedContentLevel", + "ByPassSelection", "CommitmentPlanProvisioningState", "CreatedByType", "DeploymentModelVersionUpgradeOption", "DeploymentProvisioningState", "DeploymentScaleType", + "EncryptionScopeProvisioningState", + "EncryptionScopeState", "HostingModel", "KeyName", "KeySource", @@ -216,6 +268,10 @@ "ProvisioningState", "PublicNetworkAccess", "QuotaUsageStatus", + "RaiContentFilterType", + "RaiPolicyContentSource", + "RaiPolicyMode", + "RaiPolicyType", "ResourceIdentityType", "ResourceSkuRestrictionsReasonCode", "ResourceSkuRestrictionsType", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py index 487963207201..4771f0b06b81 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py @@ -23,6 +23,21 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class AllowedContentLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level at which content is filtered.""" + + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" + + +class ByPassSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Setting for trusted services.""" + + NONE = "None" + AZURE_SERVICES = "AzureServices" + + class CommitmentPlanProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets the status of the resource at the time the operation was called.""" @@ -72,6 +87,25 @@ class DeploymentScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MANUAL = "Manual" +class EncryptionScopeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets the status of the resource at the time the operation was called.""" + + ACCEPTED = "Accepted" + CREATING = "Creating" + DELETING = "Deleting" + MOVING = "Moving" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + + +class EncryptionScopeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The encryptionScope state.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + class HostingModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Account hosting model.""" @@ -166,6 +200,35 @@ class QuotaUsageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNKNOWN = "Unknown" +class RaiContentFilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Content Filter type.""" + + MULTI_LEVEL = "MultiLevel" + SWITCH = "Switch" + + +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 ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The identity type.""" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py index e336054b57c8..0b9a79220a9f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py @@ -496,6 +496,8 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta :vartype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :ivar user_owned_storage: The storage accounts for this resource. :vartype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] + :ivar aml_workspace: The user owned AML workspace properties. + :vartype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :ivar private_endpoint_connections: The private endpoint connection associated with the Cognitive Services account. :vartype private_endpoint_connections: @@ -567,6 +569,7 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta "network_acls": {"key": "networkAcls", "type": "NetworkRuleSet"}, "encryption": {"key": "encryption", "type": "Encryption"}, "user_owned_storage": {"key": "userOwnedStorage", "type": "[UserOwnedStorage]"}, + "aml_workspace": {"key": "amlWorkspace", "type": "UserOwnedAmlWorkspace"}, "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[PrivateEndpointConnection]"}, "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, "api_properties": {"key": "apiProperties", "type": "ApiProperties"}, @@ -594,6 +597,7 @@ def __init__( # pylint: disable=too-many-locals network_acls: Optional["_models.NetworkRuleSet"] = None, encryption: Optional["_models.Encryption"] = None, user_owned_storage: Optional[List["_models.UserOwnedStorage"]] = None, + aml_workspace: Optional["_models.UserOwnedAmlWorkspace"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, api_properties: Optional["_models.ApiProperties"] = None, dynamic_throttling_enabled: Optional[bool] = None, @@ -616,6 +620,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :keyword user_owned_storage: The storage accounts for this resource. :paramtype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] + :keyword aml_workspace: The user owned AML workspace properties. + :paramtype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :keyword public_network_access: Whether or not public endpoint access is allowed for this account. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or @@ -647,6 +653,7 @@ def __init__( # pylint: disable=too-many-locals self.network_acls = network_acls self.encryption = encryption self.user_owned_storage = user_owned_storage + self.aml_workspace = aml_workspace self.private_endpoint_connections = None self.public_network_access = public_network_access self.api_properties = api_properties @@ -908,6 +915,8 @@ class CapacityConfig(_serialization.Model): :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 = { @@ -915,6 +924,7 @@ class CapacityConfig(_serialization.Model): "maximum": {"key": "maximum", "type": "int"}, "step": {"key": "step", "type": "int"}, "default": {"key": "default", "type": "int"}, + "allowed_values": {"key": "allowedValues", "type": "[int]"}, } def __init__( @@ -924,6 +934,7 @@ def __init__( maximum: Optional[int] = None, step: Optional[int] = None, default: Optional[int] = None, + allowed_values: Optional[List[int]] = None, **kwargs: Any ) -> None: """ @@ -935,12 +946,15 @@ def __init__( :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.minimum = minimum self.maximum = maximum self.step = step self.default = default + self.allowed_values = allowed_values class CheckDomainAvailabilityParameter(_serialization.Model): @@ -1228,6 +1242,8 @@ class CommitmentPlanAccountAssociation(ProxyResource): :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData :ivar etag: Resource Etag. :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] :ivar account_id: The Azure resource id of the account. :vartype account_id: str """ @@ -1246,17 +1262,23 @@ class CommitmentPlanAccountAssociation(ProxyResource): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, "account_id": {"key": "properties.accountId", "type": "str"}, } - def __init__(self, *, account_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, account_id: Optional[str] = None, **kwargs: Any + ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] :keyword account_id: The Azure resource id of the account. :paramtype account_id: str """ super().__init__(**kwargs) self.system_data = None self.etag = None + self.tags = tags self.account_id = account_id @@ -1585,6 +1607,8 @@ class Deployment(ProxyResource): :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData :ivar etag: Resource Etag. :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] :ivar properties: Properties of Cognitive Services account deployment. :vartype properties: ~azure.mgmt.cognitiveservices.models.DeploymentProperties """ @@ -1604,6 +1628,7 @@ class Deployment(ProxyResource): "sku": {"key": "sku", "type": "Sku"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, "properties": {"key": "properties", "type": "DeploymentProperties"}, } @@ -1611,12 +1636,15 @@ def __init__( self, *, sku: Optional["_models.Sku"] = None, + tags: Optional[Dict[str, str]] = None, properties: Optional["_models.DeploymentProperties"] = None, **kwargs: Any ) -> None: """ :keyword sku: The resource model definition representing SKU. :paramtype sku: ~azure.mgmt.cognitiveservices.models.Sku + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] :keyword properties: Properties of Cognitive Services account deployment. :paramtype properties: ~azure.mgmt.cognitiveservices.models.DeploymentProperties """ @@ -1624,9 +1652,43 @@ def __init__( self.sku = sku self.system_data = None self.etag = None + self.tags = tags self.properties = properties +class DeploymentCapacitySettings(_serialization.Model): + """Internal use only. + + :ivar designated_capacity: The designated capacity. + :vartype designated_capacity: int + :ivar priority: The priority of this capacity setting. + :vartype priority: int + """ + + _validation = { + "designated_capacity": {"minimum": 0}, + "priority": {"minimum": 0}, + } + + _attribute_map = { + "designated_capacity": {"key": "designatedCapacity", "type": "int"}, + "priority": {"key": "priority", "type": "int"}, + } + + def __init__( + self, *, designated_capacity: Optional[int] = None, priority: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword designated_capacity: The designated capacity. + :paramtype designated_capacity: int + :keyword priority: The priority of this capacity setting. + :paramtype priority: int + """ + super().__init__(**kwargs) + self.designated_capacity = designated_capacity + self.priority = priority + + class DeploymentListResult(_serialization.Model): """The list of cognitive services accounts operation response. @@ -1657,7 +1719,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.value = None -class DeploymentProperties(_serialization.Model): +class DeploymentProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties of Cognitive Services account deployment. Variables are only populated by the server, and will be ignored when sending a request. @@ -1669,7 +1731,8 @@ class DeploymentProperties(_serialization.Model): ~azure.mgmt.cognitiveservices.models.DeploymentProvisioningState :ivar model: Properties of Cognitive Services account deployment model. :vartype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel - :ivar scale_settings: Properties of Cognitive Services account deployment model. + :ivar scale_settings: Properties of Cognitive Services account deployment model. (Deprecated, + please use Deployment.sku instead.). :vartype scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings :ivar capabilities: The capabilities. :vartype capabilities: dict[str, str] @@ -1683,6 +1746,12 @@ class DeploymentProperties(_serialization.Model): "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". :vartype version_upgrade_option: str or ~azure.mgmt.cognitiveservices.models.DeploymentModelVersionUpgradeOption + :ivar dynamic_throttling_enabled: If the dynamic throttling is enabled. + :vartype dynamic_throttling_enabled: bool + :ivar current_capacity: The current capacity. + :vartype current_capacity: int + :ivar capacity_settings: Internal use only. + :vartype capacity_settings: ~azure.mgmt.cognitiveservices.models.DeploymentCapacitySettings """ _validation = { @@ -1690,6 +1759,7 @@ class DeploymentProperties(_serialization.Model): "capabilities": {"readonly": True}, "call_rate_limit": {"readonly": True}, "rate_limits": {"readonly": True}, + "dynamic_throttling_enabled": {"readonly": True}, } _attribute_map = { @@ -1701,6 +1771,9 @@ class DeploymentProperties(_serialization.Model): "call_rate_limit": {"key": "callRateLimit", "type": "CallRateLimit"}, "rate_limits": {"key": "rateLimits", "type": "[ThrottlingRule]"}, "version_upgrade_option": {"key": "versionUpgradeOption", "type": "str"}, + "dynamic_throttling_enabled": {"key": "dynamicThrottlingEnabled", "type": "bool"}, + "current_capacity": {"key": "currentCapacity", "type": "int"}, + "capacity_settings": {"key": "capacitySettings", "type": "DeploymentCapacitySettings"}, } def __init__( @@ -1710,12 +1783,15 @@ def __init__( scale_settings: Optional["_models.DeploymentScaleSettings"] = None, rai_policy_name: Optional[str] = None, version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, + current_capacity: Optional[int] = None, + capacity_settings: Optional["_models.DeploymentCapacitySettings"] = None, **kwargs: Any ) -> None: """ :keyword model: Properties of Cognitive Services account deployment model. :paramtype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel :keyword scale_settings: Properties of Cognitive Services account deployment model. + (Deprecated, please use Deployment.sku instead.). :paramtype scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings :keyword rai_policy_name: The name of RAI policy. :paramtype rai_policy_name: str @@ -1723,6 +1799,10 @@ def __init__( "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". :paramtype version_upgrade_option: str or ~azure.mgmt.cognitiveservices.models.DeploymentModelVersionUpgradeOption + :keyword current_capacity: The current capacity. + :paramtype current_capacity: int + :keyword capacity_settings: Internal use only. + :paramtype capacity_settings: ~azure.mgmt.cognitiveservices.models.DeploymentCapacitySettings """ super().__init__(**kwargs) self.provisioning_state = None @@ -1733,10 +1813,14 @@ def __init__( self.call_rate_limit = None self.rate_limits = None self.version_upgrade_option = version_upgrade_option + self.dynamic_throttling_enabled = None + self.current_capacity = current_capacity + self.capacity_settings = capacity_settings class DeploymentScaleSettings(_serialization.Model): - """Properties of Cognitive Services account deployment model. + """Properties of Cognitive Services account deployment model. (Deprecated, please use + Deployment.sku instead.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1778,6 +1862,36 @@ def __init__( self.active_capacity = None +class DeploymentSkuListResult(_serialization.Model): + """The list of cognitive services accounts operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of deployment skus. + :vartype next_link: str + :ivar value: Gets the list of Cognitive Services accounts deployment skus. + :vartype value: list[~azure.mgmt.cognitiveservices.models.SkuResource] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[SkuResource]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link used to get the next page of deployment skus. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = None + + class DomainAvailability(_serialization.Model): """Domain availability. @@ -1865,6 +1979,147 @@ def __init__( self.key_source = key_source +class EncryptionScope(ProxyResource): + """Cognitive Services EncryptionScope. + + 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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of Cognitive Services EncryptionScope. + :vartype properties: ~azure.mgmt.cognitiveservices.models.EncryptionScopeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "EncryptionScopeProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.EncryptionScopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of Cognitive Services EncryptionScope. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.EncryptionScopeProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.etag = None + self.tags = tags + self.properties = properties + + +class EncryptionScopeListResult(_serialization.Model): + """The list of cognitive services EncryptionScopes. + + :ivar next_link: The link used to get the next page of EncryptionScope. + :vartype next_link: str + :ivar value: The list of EncryptionScope. + :vartype value: list[~azure.mgmt.cognitiveservices.models.EncryptionScope] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EncryptionScope]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.EncryptionScope"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of EncryptionScope. + :paramtype next_link: str + :keyword value: The list of EncryptionScope. + :paramtype value: list[~azure.mgmt.cognitiveservices.models.EncryptionScope] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class EncryptionScopeProperties(Encryption): + """Properties to EncryptionScope. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key_vault_properties: Properties of KeyVault. + :vartype key_vault_properties: ~azure.mgmt.cognitiveservices.models.KeyVaultProperties + :ivar key_source: Enumerates the possible value of keySource for Encryption. Known values are: + "Microsoft.CognitiveServices" and "Microsoft.KeyVault". + :vartype key_source: str or ~azure.mgmt.cognitiveservices.models.KeySource + :ivar provisioning_state: Gets the status of the resource at the time the operation was called. + Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", "Succeeded", and + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.EncryptionScopeProvisioningState + :ivar state: The encryptionScope state. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.cognitiveservices.models.EncryptionScopeState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, + "key_source": {"key": "keySource", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, + *, + key_vault_properties: Optional["_models.KeyVaultProperties"] = None, + key_source: Union[str, "_models.KeySource"] = "Microsoft.KeyVault", + state: Optional[Union[str, "_models.EncryptionScopeState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_vault_properties: Properties of KeyVault. + :paramtype key_vault_properties: ~azure.mgmt.cognitiveservices.models.KeyVaultProperties + :keyword key_source: Enumerates the possible value of keySource for Encryption. Known values + are: "Microsoft.CognitiveServices" and "Microsoft.KeyVault". + :paramtype key_source: str or ~azure.mgmt.cognitiveservices.models.KeySource + :keyword state: The encryptionScope state. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.cognitiveservices.models.EncryptionScopeState + """ + super().__init__(key_vault_properties=key_vault_properties, key_source=key_source, **kwargs) + self.provisioning_state = None + self.state = state + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -2299,6 +2554,8 @@ class NetworkRuleSet(_serialization.Model): match. This is only used after the bypass property has been evaluated. Known values are: "Allow" and "Deny". :vartype default_action: str or ~azure.mgmt.cognitiveservices.models.NetworkRuleAction + :ivar bypass: Setting for trusted services. Known values are: "None" and "AzureServices". + :vartype bypass: str or ~azure.mgmt.cognitiveservices.models.ByPassSelection :ivar ip_rules: The list of IP address rules. :vartype ip_rules: list[~azure.mgmt.cognitiveservices.models.IpRule] :ivar virtual_network_rules: The list of virtual network rules. @@ -2307,6 +2564,7 @@ class NetworkRuleSet(_serialization.Model): _attribute_map = { "default_action": {"key": "defaultAction", "type": "str"}, + "bypass": {"key": "bypass", "type": "str"}, "ip_rules": {"key": "ipRules", "type": "[IpRule]"}, "virtual_network_rules": {"key": "virtualNetworkRules", "type": "[VirtualNetworkRule]"}, } @@ -2315,6 +2573,7 @@ def __init__( self, *, default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + bypass: Optional[Union[str, "_models.ByPassSelection"]] = None, ip_rules: Optional[List["_models.IpRule"]] = None, virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs: Any @@ -2324,6 +2583,8 @@ def __init__( virtualNetworkRules match. This is only used after the bypass property has been evaluated. Known values are: "Allow" and "Deny". :paramtype default_action: str or ~azure.mgmt.cognitiveservices.models.NetworkRuleAction + :keyword bypass: Setting for trusted services. Known values are: "None" and "AzureServices". + :paramtype bypass: str or ~azure.mgmt.cognitiveservices.models.ByPassSelection :keyword ip_rules: The list of IP address rules. :paramtype ip_rules: list[~azure.mgmt.cognitiveservices.models.IpRule] :keyword virtual_network_rules: The list of virtual network rules. @@ -2331,6 +2592,7 @@ def __init__( """ super().__init__(**kwargs) self.default_action = default_action + self.bypass = bypass self.ip_rules = ip_rules self.virtual_network_rules = virtual_network_rules @@ -2852,79 +3114,615 @@ def __init__( self.rules = rules -class RegenerateKeyParameters(_serialization.Model): - """Regenerate key parameters. +class RaiBlocklist(ProxyResource): + """Cognitive Services RaiBlocklist. - 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 key_name: key name to generate (Key1|Key2). Required. Known values are: "Key1" and - "Key2". - :vartype key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName + :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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of Cognitive Services RaiBlocklist. + :vartype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistProperties """ _validation = { - "key_name": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"readonly": True}, } _attribute_map = { - "key_name": {"key": "keyName", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "RaiBlocklistProperties"}, } - def __init__(self, *, key_name: Union[str, "_models.KeyName"], **kwargs: Any) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.RaiBlocklistProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword key_name: key name to generate (Key1|Key2). Required. Known values are: "Key1" and - "Key2". - :paramtype key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of Cognitive Services RaiBlocklist. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistProperties """ super().__init__(**kwargs) - self.key_name = key_name + self.system_data = None + self.etag = None + self.tags = tags + self.properties = properties -class RegionSetting(_serialization.Model): - """The call rate limit Cognitive Services account. +class RaiBlocklistConfig(_serialization.Model): + """Azure OpenAI blocklist config. - :ivar name: Name of the region. - :vartype name: str - :ivar value: A value for priority or weighted routing methods. - :vartype value: float - :ivar customsubdomain: Maps the region to the regional custom subdomain. - :vartype customsubdomain: str + :ivar blocklist_name: Name of ContentFilter. + :vartype blocklist_name: str + :ivar blocking: If blocking would occur. + :vartype blocking: bool """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "float"}, - "customsubdomain": {"key": "customsubdomain", "type": "str"}, + "blocklist_name": {"key": "blocklistName", "type": "str"}, + "blocking": {"key": "blocking", "type": "bool"}, } - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[float] = None, - customsubdomain: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, blocklist_name: Optional[str] = None, blocking: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword name: Name of the region. - :paramtype name: str - :keyword value: A value for priority or weighted routing methods. - :paramtype value: float - :keyword customsubdomain: Maps the region to the regional custom subdomain. - :paramtype customsubdomain: str + :keyword blocklist_name: Name of ContentFilter. + :paramtype blocklist_name: str + :keyword blocking: If blocking would occur. + :paramtype blocking: bool """ super().__init__(**kwargs) - self.name = name - self.value = value - self.customsubdomain = customsubdomain + self.blocklist_name = blocklist_name + self.blocking = blocking -class RequestMatchPattern(_serialization.Model): - """RequestMatchPattern. +class RaiBlocklistItem(ProxyResource): + """Cognitive Services RaiBlocklist Item. - :ivar path: - :vartype path: str - :ivar method: + 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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of Cognitive Services RaiBlocklist Item. + :vartype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItemProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "RaiBlocklistItemProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.RaiBlocklistItemProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of Cognitive Services RaiBlocklist Item. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItemProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.etag = None + self.tags = tags + self.properties = properties + + +class RaiBlocklistItemProperties(_serialization.Model): + """RAI Custom Blocklist Item properties. + + :ivar pattern: Pattern to match against. + :vartype pattern: str + :ivar is_regex: If the pattern is a regex pattern. + :vartype is_regex: bool + """ + + _attribute_map = { + "pattern": {"key": "pattern", "type": "str"}, + "is_regex": {"key": "isRegex", "type": "bool"}, + } + + def __init__(self, *, pattern: Optional[str] = None, is_regex: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword pattern: Pattern to match against. + :paramtype pattern: str + :keyword is_regex: If the pattern is a regex pattern. + :paramtype is_regex: bool + """ + super().__init__(**kwargs) + self.pattern = pattern + self.is_regex = is_regex + + +class RaiBlockListItemsResult(_serialization.Model): + """The list of cognitive services RAI Blocklist Items. + + :ivar next_link: The link used to get the next page of RaiBlocklistItems. + :vartype next_link: str + :ivar value: The list of RaiBlocklistItems. + :vartype value: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiBlocklistItem]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.RaiBlocklistItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of RaiBlocklistItems. + :paramtype next_link: str + :keyword value: The list of RaiBlocklistItems. + :paramtype value: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class RaiBlocklistProperties(_serialization.Model): + """RAI Custom Blocklist properties. + + :ivar description: Description of the block list. + :vartype description: str + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: Description of the block list. + :paramtype description: str + """ + super().__init__(**kwargs) + self.description = description + + +class RaiBlockListResult(_serialization.Model): + """The list of cognitive services RAI Blocklists. + + :ivar next_link: The link used to get the next page of RaiBlocklists. + :vartype next_link: str + :ivar value: The list of RaiBlocklist. + :vartype value: list[~azure.mgmt.cognitiveservices.models.RaiBlocklist] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiBlocklist]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.RaiBlocklist"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of RaiBlocklists. + :paramtype next_link: str + :keyword value: The list of RaiBlocklist. + :paramtype value: list[~azure.mgmt.cognitiveservices.models.RaiBlocklist] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class RaiContentFilter(_serialization.Model): + """Azure OpenAI Content Filter. + + :ivar policy_name: Name of Content Filter. + :vartype policy_name: str + :ivar description: Description of Content Filter. + :vartype description: str + :ivar filter_type: Content Filter type. Known values are: "MultiLevel" and "Switch". + :vartype filter_type: str or ~azure.mgmt.cognitiveservices.models.RaiContentFilterType + """ + + _attribute_map = { + "policy_name": {"key": "policyName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "filter_type": {"key": "filterType", "type": "str"}, + } + + def __init__( + self, + *, + policy_name: Optional[str] = None, + description: Optional[str] = None, + filter_type: Optional[Union[str, "_models.RaiContentFilterType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword policy_name: Name of Content Filter. + :paramtype policy_name: str + :keyword description: Description of Content Filter. + :paramtype description: str + :keyword filter_type: Content Filter type. Known values are: "MultiLevel" and "Switch". + :paramtype filter_type: str or ~azure.mgmt.cognitiveservices.models.RaiContentFilterType + """ + super().__init__(**kwargs) + self.policy_name = policy_name + self.description = description + self.filter_type = filter_type + + +class RaiContentFilterListResult(_serialization.Model): + """The list of Content Filters. + + :ivar next_link: The link used to get the next page of Content Filters. + :vartype next_link: str + :ivar value: The list of RaiContentFilter. + :vartype value: list[~azure.mgmt.cognitiveservices.models.RaiContentFilter] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiContentFilter]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.RaiContentFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of Content Filters. + :paramtype next_link: str + :keyword value: The list of RaiContentFilter. + :paramtype value: list[~azure.mgmt.cognitiveservices.models.RaiContentFilter] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class RaiPolicy(ProxyResource): + """Cognitive Services RaiPolicy. + + 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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of Cognitive Services RaiPolicy. + :vartype properties: ~azure.mgmt.cognitiveservices.models.RaiPolicyProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "RaiPolicyProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.RaiPolicyProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of Cognitive Services RaiPolicy. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiPolicyProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.etag = None + self.tags = tags + self.properties = properties + + +class RaiPolicyContentFilter(_serialization.Model): + """Azure OpenAI Content Filter. + + :ivar name: Name of ContentFilter. + :vartype name: str + :ivar enabled: If the ContentFilter is enabled. + :vartype enabled: bool + :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.cognitiveservices.models.AllowedContentLevel + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar source: Content source to apply the Content Filters. Known values are: "Prompt" and + "Completion". + :vartype source: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyContentSource + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + "allowed_content_level": {"key": "allowedContentLevel", "type": "str"}, + "blocking": {"key": "blocking", "type": "bool"}, + "source": {"key": "source", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + enabled: Optional[bool] = None, + allowed_content_level: Optional[Union[str, "_models.AllowedContentLevel"]] = None, + blocking: Optional[bool] = None, + source: Optional[Union[str, "_models.RaiPolicyContentSource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of ContentFilter. + :paramtype name: str + :keyword enabled: If the ContentFilter is enabled. + :paramtype enabled: bool + :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.cognitiveservices.models.AllowedContentLevel + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword source: Content source to apply the Content Filters. Known values are: "Prompt" and + "Completion". + :paramtype source: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyContentSource + """ + super().__init__(**kwargs) + self.name = name + self.enabled = enabled + self.allowed_content_level = allowed_content_level + self.blocking = blocking + self.source = source + + +class RaiPolicyListResult(_serialization.Model): + """The list of cognitive services RaiPolicies. + + :ivar next_link: The link used to get the next page of RaiPolicy. + :vartype next_link: str + :ivar value: The list of RaiPolicy. + :vartype value: list[~azure.mgmt.cognitiveservices.models.RaiPolicy] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiPolicy]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.RaiPolicy"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link used to get the next page of RaiPolicy. + :paramtype next_link: str + :keyword value: The list of RaiPolicy. + :paramtype value: list[~azure.mgmt.cognitiveservices.models.RaiPolicy] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class RaiPolicyProperties(_serialization.Model): + """Azure OpenAI Content Filters properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar policy_type: Content Filters policy type. Known values are: "UserManaged" and + "SystemManaged". + :vartype policy_type: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyType + :ivar mode: Content Filters mode. Known values are: "Default", "Deferred", and "Blocking". + :vartype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode + :ivar base_policy_name: Name of the base Content Filters. + :vartype base_policy_name: str + :ivar prompt_blocklists: The list of blocklists for prompt. + :vartype prompt_blocklists: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistConfig] + :ivar completion_blocklists: The list of blocklists for completion. + :vartype completion_blocklists: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistConfig] + :ivar content_filters: The list of Content Filters. + :vartype content_filters: list[~azure.mgmt.cognitiveservices.models.RaiPolicyContentFilter] + """ + + _validation = { + "policy_type": {"readonly": True}, + } + + _attribute_map = { + "policy_type": {"key": "policyType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "base_policy_name": {"key": "basePolicyName", "type": "str"}, + "prompt_blocklists": {"key": "promptBlocklists", "type": "[RaiBlocklistConfig]"}, + "completion_blocklists": {"key": "completionBlocklists", "type": "[RaiBlocklistConfig]"}, + "content_filters": {"key": "contentFilters", "type": "[RaiPolicyContentFilter]"}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "_models.RaiPolicyMode"]] = None, + base_policy_name: Optional[str] = None, + prompt_blocklists: Optional[List["_models.RaiBlocklistConfig"]] = None, + completion_blocklists: Optional[List["_models.RaiBlocklistConfig"]] = None, + content_filters: Optional[List["_models.RaiPolicyContentFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: Content Filters mode. Known values are: "Default", "Deferred", and "Blocking". + :paramtype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode + :keyword base_policy_name: Name of the base Content Filters. + :paramtype base_policy_name: str + :keyword prompt_blocklists: The list of blocklists for prompt. + :paramtype prompt_blocklists: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistConfig] + :keyword completion_blocklists: The list of blocklists for completion. + :paramtype completion_blocklists: list[~azure.mgmt.cognitiveservices.models.RaiBlocklistConfig] + :keyword content_filters: The list of Content Filters. + :paramtype content_filters: list[~azure.mgmt.cognitiveservices.models.RaiPolicyContentFilter] + """ + super().__init__(**kwargs) + self.policy_type = None + self.mode = mode + self.base_policy_name = base_policy_name + self.prompt_blocklists = prompt_blocklists + self.completion_blocklists = completion_blocklists + self.content_filters = content_filters + + +class RegenerateKeyParameters(_serialization.Model): + """Regenerate key parameters. + + All required parameters must be populated in order to send to Azure. + + :ivar key_name: key name to generate (Key1|Key2). Required. Known values are: "Key1" and + "Key2". + :vartype key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName + """ + + _validation = { + "key_name": {"required": True}, + } + + _attribute_map = { + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__(self, *, key_name: Union[str, "_models.KeyName"], **kwargs: Any) -> None: + """ + :keyword key_name: key name to generate (Key1|Key2). Required. Known values are: "Key1" and + "Key2". + :paramtype key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName + """ + super().__init__(**kwargs) + self.key_name = key_name + + +class RegionSetting(_serialization.Model): + """The call rate limit Cognitive Services account. + + :ivar name: Name of the region. + :vartype name: str + :ivar value: A value for priority or weighted routing methods. + :vartype value: float + :ivar customsubdomain: Maps the region to the regional custom subdomain. + :vartype customsubdomain: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "float"}, + "customsubdomain": {"key": "customsubdomain", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[float] = None, + customsubdomain: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the region. + :paramtype name: str + :keyword value: A value for priority or weighted routing methods. + :paramtype value: float + :keyword customsubdomain: Maps the region to the regional custom subdomain. + :paramtype customsubdomain: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + self.customsubdomain = customsubdomain + + +class RequestMatchPattern(_serialization.Model): + """RequestMatchPattern. + + :ivar path: + :vartype path: str + :ivar method: :vartype method: str """ @@ -3333,6 +4131,45 @@ def __init__( self.last_change_date = last_change_date +class SkuResource(_serialization.Model): + """Properties of Cognitive Services account resource sku resource properties. + + :ivar resource_type: The resource type name. + :vartype resource_type: str + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.cognitiveservices.models.Sku + :ivar capacity: The capacity configuration. + :vartype capacity: ~azure.mgmt.cognitiveservices.models.CapacityConfig + """ + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "capacity": {"key": "capacity", "type": "CapacityConfig"}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + capacity: Optional["_models.CapacityConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_type: The resource type name. + :paramtype resource_type: str + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.cognitiveservices.models.Sku + :keyword capacity: The capacity configuration. + :paramtype capacity: ~azure.mgmt.cognitiveservices.models.CapacityConfig + """ + super().__init__(**kwargs) + self.resource_type = resource_type + self.sku = sku + self.capacity = capacity + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -3584,6 +4421,34 @@ def __init__(self, **kwargs: Any) -> None: self.client_id = None +class UserOwnedAmlWorkspace(_serialization.Model): + """The user owned AML workspace for Cognitive Services account. + + :ivar resource_id: Full resource id of a AML workspace resource. + :vartype resource_id: str + :ivar identity_client_id: Identity Client id of a AML workspace resource. + :vartype identity_client_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "identity_client_id": {"key": "identityClientId", "type": "str"}, + } + + def __init__( + self, *, resource_id: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_id: Full resource id of a AML workspace resource. + :paramtype resource_id: str + :keyword identity_client_id: Identity Client id of a AML workspace resource. + :paramtype identity_client_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.identity_client_id = identity_client_id + + class UserOwnedStorage(_serialization.Model): """The user owned storage for Cognitive Services account. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py index 26043fb0a303..1c8b275c8cc9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py @@ -18,6 +18,11 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._deployments_operations import DeploymentsOperations from ._commitment_plans_operations import CommitmentPlansOperations +from ._encryption_scopes_operations import EncryptionScopesOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_blocklists_operations import RaiBlocklistsOperations +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations +from ._rai_content_filters_operations import RaiContentFiltersOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -36,6 +41,11 @@ "PrivateLinkResourcesOperations", "DeploymentsOperations", "CommitmentPlansOperations", + "EncryptionScopesOperations", + "RaiPoliciesOperations", + "RaiBlocklistsOperations", + "RaiBlocklistItemsOperations", + "RaiContentFiltersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py index 7f21631c2eda..b9dd7a36a3f0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_create_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +64,7 @@ def build_create_request( "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") @@ -83,7 +83,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -102,7 +102,7 @@ def build_update_request( "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") @@ -121,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_delete_request( "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") @@ -154,7 +154,7 @@ def build_get_request(resource_group_name: str, account_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +172,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ "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") @@ -187,7 +187,7 @@ def build_list_by_resource_group_request(resource_group_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +202,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "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") @@ -217,7 +217,7 @@ def build_list_request(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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +226,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -243,7 +243,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -261,7 +261,7 @@ def build_list_keys_request( "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") @@ -278,7 +278,7 @@ def build_regenerate_key_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -297,7 +297,7 @@ def build_regenerate_key_request( "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") @@ -316,7 +316,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -334,7 +334,7 @@ def build_list_skus_request( "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") @@ -351,7 +351,7 @@ def build_list_usages_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -369,7 +369,7 @@ def build_list_usages_request( "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") @@ -388,7 +388,7 @@ def build_list_models_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -406,7 +406,7 @@ def build_list_models_request( "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py index 2ad07e47bcf0..815219735b45 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_check_sku_availability_request(location: str, subscription_id: str, ** _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -52,7 +52,7 @@ def build_check_sku_availability_request(location: str, subscription_id: str, ** "location": _SERIALIZER.url("location", location, "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") @@ -69,7 +69,7 @@ def build_check_domain_availability_request(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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -81,7 +81,7 @@ def build_check_domain_availability_request(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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py index 511bac31955f..f67a911ad6f9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,7 @@ def build_list_request(resource_group_name: str, account_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "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") @@ -78,7 +78,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request( "commitmentPlanName": _SERIALIZER.url("commitment_plan_name", commitment_plan_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 +114,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +134,7 @@ def build_create_or_update_request( "commitmentPlanName": _SERIALIZER.url("commitment_plan_name", commitment_plan_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") @@ -153,7 +153,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +172,7 @@ def build_delete_request( "commitmentPlanName": _SERIALIZER.url("commitment_plan_name", commitment_plan_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") @@ -189,7 +189,7 @@ def build_create_or_update_plan_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -208,7 +208,7 @@ def build_create_or_update_plan_request( "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") @@ -227,7 +227,7 @@ def build_update_plan_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +246,7 @@ def build_update_plan_request( "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") @@ -265,7 +265,7 @@ def build_delete_plan_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +283,7 @@ def build_delete_plan_request( "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") @@ -300,7 +300,7 @@ def build_get_plan_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +318,7 @@ def build_get_plan_request( "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") @@ -335,7 +335,7 @@ def build_list_plans_by_resource_group_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -350,7 +350,7 @@ def build_list_plans_by_resource_group_request( "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") @@ -365,7 +365,7 @@ def build_list_plans_by_subscription_request(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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -376,7 +376,7 @@ def build_list_plans_by_subscription_request(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") @@ -393,7 +393,7 @@ def build_list_associations_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -411,7 +411,7 @@ def build_list_associations_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") @@ -432,7 +432,7 @@ def build_get_association_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -456,7 +456,7 @@ def build_get_association_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") @@ -477,7 +477,7 @@ def build_create_or_update_association_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -502,7 +502,7 @@ def build_create_or_update_association_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") @@ -525,7 +525,7 @@ def build_delete_association_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -549,7 +549,7 @@ def build_delete_association_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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py index 8856f976a8b4..7594c0f1e4ef 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "location": _SERIALIZER.url("location", location, "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py index 8aedc3ed54de..699c5f3f66cd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +44,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +63,7 @@ def build_get_request( "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") @@ -80,7 +80,7 @@ def build_purge_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_purge_request( "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") @@ -114,7 +114,7 @@ def build_list_request(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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py index 9e161dbdfcc6..408f567137d6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,7 @@ def build_list_request(resource_group_name: str, account_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "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") @@ -78,7 +78,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,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") @@ -114,7 +114,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +134,7 @@ def build_create_or_update_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") @@ -147,13 +147,52 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_request( + resource_group_name: str, account_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", "2023-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.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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_delete_request( resource_group_name: str, account_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", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +211,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") @@ -183,6 +222,42 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_skus_request( + resource_group_name: str, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_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) + + class DeploymentsOperations: """ .. warning:: @@ -601,6 +676,248 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" } + def _update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, IO], + **kwargs: Any + ) -> Optional[_models.Deployment]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Deployment]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(deployment, (IOBase, bytes)): + _content = deployment + else: + _json = self._serialize.body(deployment, "PatchResourceTagsAndSku") + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Deployment", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: _models.PatchResourceTagsAndSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku + :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 Deployment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: 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 Deployment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, IO], + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Is either a PatchResourceTagsAndSku type or a IO + type. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku 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 Deployment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :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.Deployment] = 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, + account_name=account_name, + deployment_name=deployment_name, + deployment=deployment, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Deployment", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" + } + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> None: @@ -719,3 +1036,99 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" } + + @distributed_trace + def list_skus( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> Iterable["_models.SkuResource"]: + """Lists the specified deployments skus associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: 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.cognitiveservices.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.DeploymentSkuListResult] = 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_skus_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentSkuListResult", 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) + + list_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py new file mode 100644 index 000000000000..10a65ccdbb2a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py @@ -0,0 +1,651 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request + +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, account_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_get_request( + resource_group_name: str, account_name: str, encryption_scope_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "encryptionScopeName": _SERIALIZER.url( + "encryption_scope_name", encryption_scope_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_or_update_request( + resource_group_name: str, account_name: str, encryption_scope_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-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.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "encryptionScopeName": _SERIALIZER.url( + "encryption_scope_name", encryption_scope_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, encryption_scope_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "encryptionScopeName": _SERIALIZER.url( + "encryption_scope_name", encryption_scope_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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class EncryptionScopesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`encryption_scopes` 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, account_name: str, **kwargs: Any) -> Iterable["_models.EncryptionScope"]: + """Gets the 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EncryptionScope or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.EncryptionScope] + :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.EncryptionScopeListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EncryptionScopeListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes" + } + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> _models.EncryptionScope: + """Gets the specified EncryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :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.EncryptionScope] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_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("EncryptionScope", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: _models.EncryptionScope, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :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: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: Union[_models.EncryptionScope, IO], + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Is either a EncryptionScope type or a + IO type. Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EncryptionScope or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EncryptionScope] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(encryption_scope, (IOBase, bytes)): + _content = encryption_scope + else: + _json = self._serialize.body(encryption_scope, "EncryptionScope") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("EncryptionScope", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("EncryptionScope", pipeline_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.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, encryption_scope_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, + account_name=account_name, + encryption_scope_name=encryption_scope_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py index ede90845c4f7..a7f720f47a7a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "location": _SERIALIZER.url("location", location, "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py index d101497980fe..36608a58970a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py index 687324b670c7..7b74602f58ed 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_list_request(resource_group_name: str, account_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "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") @@ -80,7 +80,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,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") @@ -122,7 +122,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +144,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") @@ -167,7 +167,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +188,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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py index f45b5a3b9a67..e74dfa075787 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_list_request(resource_group_name: str, account_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py new file mode 100644 index 000000000000..1d7fb7dd7b91 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py @@ -0,0 +1,725 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request + +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, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_get_request( + resource_group_name: str, + account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_or_update_request( + resource_group_name: str, + account_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", "2023-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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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 + 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_delete_request( + resource_group_name: str, + account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class RaiBlocklistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`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, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> Iterable["_models.RaiBlocklistItem"]: + """Gets the blocklist items associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] + :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.RaiBlockListItemsResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlockListItemsResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Gets the specified custom blocklist Item associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :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.RaiBlocklistItem] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_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, + 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("RaiBlocklistItem", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: _models.RaiBlocklistItem, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :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: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: Union[_models.RaiBlocklistItem, IO], + **kwargs: Any + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Is either a + RaiBlocklistItem type or a IO type. Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItem or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiBlocklistItem] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_blocklist_item, (IOBase, bytes)): + _content = rai_blocklist_item + else: + _json = self._serialize.body(rai_blocklist_item, "RaiBlocklistItem") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiBlocklistItem", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiBlocklistItem", pipeline_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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_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, + account_name=account_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, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified blocklist Item associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py new file mode 100644 index 000000000000..5a4d7ea6845f --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py @@ -0,0 +1,653 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request + +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, account_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_get_request( + resource_group_name: str, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_or_update_request( + resource_group_name: str, account_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", "2023-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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class RaiBlocklistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`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, account_name: str, **kwargs: Any) -> Iterable["_models.RaiBlocklist"]: + """Gets the custom blocklists 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiBlocklist or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklist] + :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.RaiBlockListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlockListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists" + } + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> _models.RaiBlocklist: + """Gets the specified custom blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :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.RaiBlocklist] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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("RaiBlocklist", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: _models.RaiBlocklist, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :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: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: Union[_models.RaiBlocklist, IO], + **kwargs: Any + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Is either a RaiBlocklist type + or a IO type. Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklist or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiBlocklist] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_blocklist, (IOBase, bytes)): + _content = rai_blocklist + else: + _json = self._serialize.body(rai_blocklist, "RaiBlocklist") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_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, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiBlocklist", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiBlocklist", pipeline_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.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, rai_blocklist_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, + account_name=account_name, + rai_blocklist_name=rai_blocklist_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified custom blocklist 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + } diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py similarity index 77% rename from sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_skus_operations.py rename to sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py index 1f1e1712b1a0..57197a874aad 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,21 +40,20 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus" - ) + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters", + ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "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") @@ -70,14 +64,14 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class SkusOperations: +class RaiContentFiltersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.redisenterprise.RedisEnterpriseManagementClient`'s - :attr:`skus` attribute. + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`rai_content_filters` attribute. """ models = _models @@ -90,23 +84,21 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.RegionSkuDetail"]: - """Gets information about skus in specified location for the given subscription id. + def list(self, location: str, **kwargs: Any) -> Iterable["_models.RaiContentFilter"]: + """List Content Filters types. - :param location: The name of Azure region. Required. + :param location: Resource location. 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 RegionSkuDetail or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.RegionSkuDetail] + :return: An iterator like instance of either RaiContentFilter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiContentFilter] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.RegionSkuDetails] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -149,11 +141,11 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("RegionSkuDetails", pipeline_response) + deserialized = self._deserialize("RaiContentFilterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -173,4 +165,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus"} + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py new file mode 100644 index 000000000000..3dbd31e4ecf4 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py @@ -0,0 +1,653 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request + +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, account_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_get_request( + resource_group_name: str, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_or_update_request( + resource_group_name: str, account_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", "2023-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.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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 + 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_delete_request( + resource_group_name: str, account_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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="DELETE", 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.cognitiveservices.CognitiveServicesManagementClient`'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, account_name: str, **kwargs: Any) -> Iterable["_models.RaiPolicy"]: + """Gets the 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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiPolicy] + :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.RaiPolicyListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies" + } + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :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.RaiPolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_policy_name=rai_policy_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("RaiPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: _models.RaiPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :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: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_policy_name: str, + rai_policy: Union[_models.RaiPolicy, IO], + **kwargs: Any + ) -> _models.RaiPolicy: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Is either a RaiPolicy type or a + IO type. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicy or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.RaiPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rai_policy, (IOBase, bytes)): + _content = rai_policy + else: + _json = self._serialize.body(rai_policy, "RaiPolicy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_policy_name=rai_policy_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RaiPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RaiPolicy", pipeline_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.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, rai_policy_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, + account_name=account_name, + rai_policy_name=rai_policy_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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 account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + account_name=account_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + } diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py index a30c5ca819a6..53ce0b5b9cfd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py index 5ac6eac7b9cf..9895580be7ee 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import CognitiveServicesManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +55,7 @@ def build_list_request( "location": _SERIALIZER.url("location", location, "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") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py index b7d83a6efc18..4fdbbc5dfd81 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py index 4b387803291f..969c6d3de654 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccountMin.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateAccountMin.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py index 55335a3bb966..8bb3e7b69adf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py index ea81114d35ca..f408f17b120d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py index 9f757f111d3e..3086d3c4fe3e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py index 5a00237f4a1b..2660d338e4b6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py index b202a2f9dd08..af83e248ae02 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py new file mode 100644 index 000000000000..4fb90e313e8a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_encryption_scope.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.encryption_scopes.begin_delete( + resource_group_name="resourceGroupName", + account_name="accountName", + encryption_scope_name="encryptionScopeName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteEncryptionScope.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py index 4d89790032e4..5d9a01a16fbe 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py new file mode 100644 index 000000000000..23c51e0f0995 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_rai_blocklist.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.rai_blocklists.begin_delete( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiBlocklist.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py new file mode 100644 index 000000000000..f3e3b23d18eb --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_rai_blocklist_item.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.rai_blocklist_items.begin_delete( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiBlocklistItem.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py new file mode 100644 index 000000000000..986503c8ad62 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_rai_policy.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.rai_policies.begin_delete( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_policy_name="raiPolicyName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py index d00ff5a24e6f..52a8babbc05a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py index 64b88eda24e1..47b43ed29026 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py index 2556f8438904..f32302eea685 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py index a7a9264a1db1..02224871406c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py index ea0b8bdc47da..6f8f19bac4a9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py index fe99b684d8e5..6aa1c1971a1b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py new file mode 100644 index 000000000000..75cc8f5d3d2c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_encryption_scope.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.encryption_scopes.get( + resource_group_name="resourceGroupName", + account_name="accountName", + encryption_scope_name="encryptionScopeName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetEncryptionScope.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py index f7e952879586..963249f3caf7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetOperations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py index 77228c051511..4329735e3d8e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py new file mode 100644 index 000000000000..5af2a6215434 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_rai_blocklist.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklists.get( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklist.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py new file mode 100644 index 000000000000..bf313ea9dd14 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_rai_blocklist_item.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklist_items.get( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklistItem.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py new file mode 100644 index 000000000000..a5d7bae4a9b4 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_rai_policy.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_policies.get( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_policy_name="raiPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py index d095d0a18e7a..c1befea10daf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py index 31dbb4bfc45a..bb3bbc704038 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py index e788c8cbb045..4d238d5d2b23 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py index 6bca17f6c7b2..9cc02d305205 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py index cca00e0f0fab..b0626a8b4f34 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py index 2164063843ac..06b5949bff77 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py index b891f21638ac..1cf02c9d655f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py new file mode 100644 index 000000000000..d24fb49100f7 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_blocklist_items.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklist_items.list( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListBlocklistItems.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py new file mode 100644 index 000000000000..23b6e43b031a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_blocklists.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklists.list( + resource_group_name="resourceGroupName", + account_name="accountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListBlocklists.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py index 05baddbec3a3..9051b5c6a958 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentPlans.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListCommitmentPlans.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py index 52026e299a8c..e01397895d6d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentTiers.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListCommitmentTiers.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py index 6caab01fd7d6..a3c91e1381f8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeletedAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeletedAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py new file mode 100644 index 000000000000..ab5f800618c2 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_deployment_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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.list_skus( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="deploymentName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeploymentSkus.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py index 117cf35fd6f7..98ab86c2658e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeployments.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeployments.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py new file mode 100644 index 000000000000..395afeb3f69a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_encryption_scopes.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.encryption_scopes.list( + resource_group_name="resourceGroupName", + account_name="accountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListEncryptionScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py index aff624848bfd..732494f82213 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListKeys.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_models.py index f218282f795c..a6aeb4059260 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_models.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py index 6ea149ae3515..4c296205b8a9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py index 58f358763729..b5783eb05939 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py new file mode 100644 index 000000000000..c61358a24a04 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_rai_content_filters.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_content_filters.list( + location="WestUS", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListRaiContentFilters.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py new file mode 100644 index 000000000000..1a6ff0c9e727 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_rai_policies.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_policies.list( + resource_group_name="resourceGroupName", + account_name="accountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListRaiPolicies.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py index affc2e5c25cb..af33b90263b2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlanAssociations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlanAssociations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py index e22a4ca092c1..d5bfe08ec808 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlansByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py index cd3627dd22ec..e271639c4a4c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlansBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py index 9ff283f30044..ce6b697b18ab 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py index 21b6ff85551c..06ea4a2426bf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py index 8367a400dd01..38296944d2e4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PurgeDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PurgeDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py index eb4aeb36c313..c9a443c0f9c8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py index 6e42102775f1..a74c15ef2791 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py new file mode 100644 index 000000000000..13f24a0b8e37 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_encryption_scope.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.encryption_scopes.create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + encryption_scope_name="encryptionScopeName", + encryption_scope={ + "properties": { + "keySource": "Microsoft.KeyVault", + "keyVaultProperties": { + "identityClientId": "00000000-0000-0000-0000-000000000000", + "keyName": "DevKeyWestUS2", + "keyVaultUri": "https://devkvwestus2.vault.azure.net/", + "keyVersion": "9f85549d7bf14ff4bf178c10d3bdca95", + }, + "state": "Enabled", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutEncryptionScope.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py index d1666e3f3fb5..b0a7cfabb723 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py new file mode 100644 index 000000000000..16687683cf15 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_rai_blocklist.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklists.create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + rai_blocklist={"properties": {"description": "Basic blocklist description"}}, + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklist.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py new file mode 100644 index 000000000000..f46b7c5807f5 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_rai_blocklist_item.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_blocklist_items.create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + rai_blocklist_item={"properties": {"isRegex": False, "pattern": "Pattern To Block"}}, + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklistItem.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py new file mode 100644 index 000000000000..e2bdcfe6404b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_rai_policy.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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.rai_policies.create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + rai_policy_name="raiPolicyName", + rai_policy={ + "properties": { + "basePolicyName": "112", + "contentFilters": [ + {"allowedContentLevel": "Low", "blocking": True, "name": "hate"}, + {"allowedContentLevel": "Low", "name": "sexual"}, + {"enabled": False, "name": "violence"}, + {"enabled": False, "name": "DefaultHateSpeechBlockList"}, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py index 13c709ef36cb..1ad284396168 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py new file mode 100644 index 000000000000..932dba6a3113 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_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.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_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 = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.begin_update( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="deploymentName", + deployment={"sku": {"capacity": 1, "name": "Standard"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py index 9942bdba52a5..4fc82d0a7a24 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/CHANGELOG.md b/sdk/communitytraining/azure-mgmt-communitytraining/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/LICENSE b/sdk/communitytraining/azure-mgmt-communitytraining/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/MANIFEST.in b/sdk/communitytraining/azure-mgmt-communitytraining/MANIFEST.in new file mode 100644 index 000000000000..869d8735ba76 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/communitytraining/py.typed diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/README.md b/sdk/communitytraining/azure-mgmt-communitytraining/README.md new file mode 100644 index 000000000000..e00640fe3c7c --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-communitytraining +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.communitytraining import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/_meta.json b/sdk/communitytraining/azure-mgmt-communitytraining/_meta.json new file mode 100644 index 000000000000..ebeee89e54cf --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/communitytraining/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/communitytraining/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/__init__.py new file mode 100644 index 000000000000..7bc232391345 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._microsoft_community import MicrosoftCommunity +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "MicrosoftCommunity", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_configuration.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_configuration.py new file mode 100644 index 000000000000..e79ba9c92087 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class MicrosoftCommunityConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for MicrosoftCommunity. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-11-01". 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(MicrosoftCommunityConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-11-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-communitytraining/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_microsoft_community.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_microsoft_community.py new file mode 100644 index 000000000000..57fed8cb8e55 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_microsoft_community.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import MicrosoftCommunityConfiguration +from ._serialization import Deserializer, Serializer +from .operations import CommunityTrainingsOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class MicrosoftCommunity: # pylint: disable=client-accepts-api-version-keyword + """MicrosoftCommunity. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.communitytraining.operations.Operations + :ivar community_trainings: CommunityTrainingsOperations operations + :vartype community_trainings: + azure.mgmt.communitytraining.operations.CommunityTrainingsOperations + :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-11-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = MicrosoftCommunityConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.community_trainings = CommunityTrainingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "MicrosoftCommunity": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_patch.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_serialization.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_vendor.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_version.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/__init__.py new file mode 100644 index 000000000000..917fa6ad0fd5 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._microsoft_community import MicrosoftCommunity + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "MicrosoftCommunity", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_configuration.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_configuration.py new file mode 100644 index 000000000000..fcb76fb4158b --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MicrosoftCommunityConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for MicrosoftCommunity. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-11-01". 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(MicrosoftCommunityConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-11-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-communitytraining/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_microsoft_community.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_microsoft_community.py new file mode 100644 index 000000000000..ef13310aa403 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_microsoft_community.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import MicrosoftCommunityConfiguration +from .operations import CommunityTrainingsOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MicrosoftCommunity: # pylint: disable=client-accepts-api-version-keyword + """MicrosoftCommunity. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.communitytraining.aio.operations.Operations + :ivar community_trainings: CommunityTrainingsOperations operations + :vartype community_trainings: + azure.mgmt.communitytraining.aio.operations.CommunityTrainingsOperations + :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-11-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = MicrosoftCommunityConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.community_trainings = CommunityTrainingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MicrosoftCommunity": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_patch.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/__init__.py new file mode 100644 index 000000000000..3449d035402c --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._community_trainings_operations import CommunityTrainingsOperations + +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", + "CommunityTrainingsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_community_trainings_operations.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_community_trainings_operations.py new file mode 100644 index 000000000000..608b6a05f99e --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_community_trainings_operations.py @@ -0,0 +1,893 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._community_trainings_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CommunityTrainingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communitytraining.aio.MicrosoftCommunity`'s + :attr:`community_trainings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CommunityTraining"]: + """List CommunityTraining resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityTraining or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTrainingListResult] = 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, + 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("CommunityTrainingListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CommunityTraining"]: + """List CommunityTraining resources by resource group. + + :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 CommunityTraining or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTrainingListResult] = 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, + 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("CommunityTrainingListResult", 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.Community/communityTrainings" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, community_training_name: str, **kwargs: Any + ) -> _models.CommunityTraining: + """Get a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityTraining or the result of cls(response) + :rtype: ~azure.mgmt.communitytraining.models.CommunityTraining + :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.CommunityTraining] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + community_training_name=community_training_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 = 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("CommunityTraining", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + async def _create_initial( + self, + resource_group_name: str, + community_training_name: str, + resource: Union[_models.CommunityTraining, IO], + **kwargs: Any + ) -> _models.CommunityTraining: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CommunityTraining] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CommunityTraining") + + request = build_create_request( + resource_group_name=resource_group_name, + community_training_name=community_training_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CommunityTraining", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CommunityTraining", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: _models.CommunityTraining, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.communitytraining.models.CommunityTraining + :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 CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: Union[_models.CommunityTraining, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Is either a CommunityTraining type or a IO type. + Required. + :type resource: ~azure.mgmt.communitytraining.models.CommunityTraining or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTraining] = 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, + community_training_name=community_training_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommunityTraining", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + async def _update_initial( + self, + resource_group_name: str, + community_training_name: str, + properties: Union[_models.CommunityTrainingUpdate, IO], + **kwargs: Any + ) -> Optional[_models.CommunityTraining]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CommunityTraining]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CommunityTrainingUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + community_training_name=community_training_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("CommunityTraining", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: _models.CommunityTrainingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.communitytraining.models.CommunityTrainingUpdate + :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 CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: Union[_models.CommunityTrainingUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Is either a CommunityTrainingUpdate + type or a IO type. Required. + :type properties: ~azure.mgmt.communitytraining.models.CommunityTrainingUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CommunityTraining or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTraining] = 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, + community_training_name=community_training_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommunityTraining", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, community_training_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, + community_training_name=community_training_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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, community_training_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_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, + community_training_name=community_training_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_operations.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_operations.py new file mode 100644 index 000000000000..164d063d9b1b --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communitytraining.aio.MicrosoftCommunity`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.communitytraining.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.Community/operations"} diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_patch.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/__init__.py new file mode 100644 index 000000000000..13f313c652d1 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/__init__.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 ._models_py3 import CommunityTraining +from ._models_py3 import CommunityTrainingListResult +from ._models_py3 import CommunityTrainingUpdate +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import IdentityConfigurationProperties +from ._models_py3 import IdentityConfigurationPropertiesUpdate +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource + +from ._microsoft_community_enums import ActionType +from ._microsoft_community_enums import CreatedByType +from ._microsoft_community_enums import Origin +from ._microsoft_community_enums import ProvisioningState +from ._microsoft_community_enums import SkuTier +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "CommunityTraining", + "CommunityTrainingListResult", + "CommunityTrainingUpdate", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "IdentityConfigurationProperties", + "IdentityConfigurationPropertiesUpdate", + "Operation", + "OperationDisplay", + "OperationListResult", + "Resource", + "Sku", + "SystemData", + "TrackedResource", + "ActionType", + "CreatedByType", + "Origin", + "ProvisioningState", + "SkuTier", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_microsoft_community_enums.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_microsoft_community_enums.py new file mode 100644 index 000000000000..d3c56c1910f9 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_microsoft_community_enums.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the current operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """Initial provisioning in progress""" + UPDATING = "Updating" + """Update in progress""" + DELETING = "Deleting" + """Deletion in progress""" + ACCEPTED = "Accepted" + """Change accepted for processing""" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_models_py3.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_models_py3.py new file mode 100644 index 000000000000..58b2d41855c6 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_models_py3.py @@ -0,0 +1,864 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.communitytraining.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.communitytraining.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class CommunityTraining(TrackedResource): # pylint: disable=too-many-instance-attributes + """A CommunityProviderHub 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}. + :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.communitytraining.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 sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.communitytraining.models.Sku + :ivar portal_name: The portal name (website name) of the Community Training instance. + :vartype portal_name: str + :ivar portal_admin_email_address: The email address of the portal admin. + :vartype portal_admin_email_address: str + :ivar portal_owner_organization_name: The organization name of the portal owner. + :vartype portal_owner_organization_name: str + :ivar portal_owner_email_address: The email address of the portal owner. Will be used as the + primary contact. + :vartype portal_owner_email_address: str + :ivar identity_configuration: The identity configuration of the Community Training resource. + :vartype identity_configuration: + ~azure.mgmt.communitytraining.models.IdentityConfigurationProperties + :ivar zone_redundancy_enabled: To indicate whether the Community Training instance has Zone + Redundancy enabled. + :vartype zone_redundancy_enabled: bool + :ivar disaster_recovery_enabled: To indicate whether the Community Training instance has + Disaster Recovery enabled. + :vartype disaster_recovery_enabled: bool + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.communitytraining.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "portal_name": {"key": "properties.portalName", "type": "str"}, + "portal_admin_email_address": {"key": "properties.portalAdminEmailAddress", "type": "str"}, + "portal_owner_organization_name": {"key": "properties.portalOwnerOrganizationName", "type": "str"}, + "portal_owner_email_address": {"key": "properties.portalOwnerEmailAddress", "type": "str"}, + "identity_configuration": { + "key": "properties.identityConfiguration", + "type": "IdentityConfigurationProperties", + }, + "zone_redundancy_enabled": {"key": "properties.zoneRedundancyEnabled", "type": "bool"}, + "disaster_recovery_enabled": {"key": "properties.disasterRecoveryEnabled", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + portal_name: Optional[str] = None, + portal_admin_email_address: Optional[str] = None, + portal_owner_organization_name: Optional[str] = None, + portal_owner_email_address: Optional[str] = None, + identity_configuration: Optional["_models.IdentityConfigurationProperties"] = None, + zone_redundancy_enabled: Optional[bool] = None, + disaster_recovery_enabled: Optional[bool] = 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 sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.communitytraining.models.Sku + :keyword portal_name: The portal name (website name) of the Community Training instance. + :paramtype portal_name: str + :keyword portal_admin_email_address: The email address of the portal admin. + :paramtype portal_admin_email_address: str + :keyword portal_owner_organization_name: The organization name of the portal owner. + :paramtype portal_owner_organization_name: str + :keyword portal_owner_email_address: The email address of the portal owner. Will be used as the + primary contact. + :paramtype portal_owner_email_address: str + :keyword identity_configuration: The identity configuration of the Community Training resource. + :paramtype identity_configuration: + ~azure.mgmt.communitytraining.models.IdentityConfigurationProperties + :keyword zone_redundancy_enabled: To indicate whether the Community Training instance has Zone + Redundancy enabled. + :paramtype zone_redundancy_enabled: bool + :keyword disaster_recovery_enabled: To indicate whether the Community Training instance has + Disaster Recovery enabled. + :paramtype disaster_recovery_enabled: bool + """ + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.portal_name = portal_name + self.portal_admin_email_address = portal_admin_email_address + self.portal_owner_organization_name = portal_owner_organization_name + self.portal_owner_email_address = portal_owner_email_address + self.identity_configuration = identity_configuration + self.zone_redundancy_enabled = zone_redundancy_enabled + self.disaster_recovery_enabled = disaster_recovery_enabled + self.provisioning_state = None + + +class CommunityTrainingListResult(_serialization.Model): + """The response of a CommunityTraining list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The CommunityTraining items on this page. Required. + :vartype value: list[~azure.mgmt.communitytraining.models.CommunityTraining] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CommunityTraining]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.CommunityTraining"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The CommunityTraining items on this page. Required. + :paramtype value: list[~azure.mgmt.communitytraining.models.CommunityTraining] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CommunityTrainingUpdate(_serialization.Model): + """The type used for update operations of the CommunityTraining. + + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.communitytraining.models.Sku + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity_configuration: The identity configuration of the Community Training resource. + :vartype identity_configuration: + ~azure.mgmt.communitytraining.models.IdentityConfigurationPropertiesUpdate + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity_configuration": { + "key": "properties.identityConfiguration", + "type": "IdentityConfigurationPropertiesUpdate", + }, + } + + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + tags: Optional[Dict[str, str]] = None, + identity_configuration: Optional["_models.IdentityConfigurationPropertiesUpdate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.communitytraining.models.Sku + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity_configuration: The identity configuration of the Community Training resource. + :paramtype identity_configuration: + ~azure.mgmt.communitytraining.models.IdentityConfigurationPropertiesUpdate + """ + super().__init__(**kwargs) + self.sku = sku + self.tags = tags + self.identity_configuration = identity_configuration + + +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.communitytraining.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.communitytraining.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.communitytraining.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.communitytraining.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class IdentityConfigurationProperties(_serialization.Model): + """Details of the Community CommunityTraining Identity Configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar identity_type: The identity type of the Community Training Resource. Required. + :vartype identity_type: str + :ivar teams_enabled: To indicate whether the Community Training Resource has Teams enabled. + :vartype teams_enabled: bool + :ivar tenant_id: The tenantId of the selected identity provider for the Community Training + Resource. Required. + :vartype tenant_id: str + :ivar domain_name: The domain name of the selected identity provider for the Community Training + Resource. Required. + :vartype domain_name: str + :ivar client_id: The clientId of the application registered in the selected identity provider + for the Community Training Resource. Required. + :vartype client_id: str + :ivar client_secret: The client secret of the application registered in the selected identity + provider for the Community Training Resource. Required. + :vartype client_secret: str + :ivar b2_c_authentication_policy: The name of the authentication policy registered in ADB2C for + the Community Training Resource. + :vartype b2_c_authentication_policy: str + :ivar b2_c_password_reset_policy: The name of the password reset policy registered in ADB2C for + the Community Training Resource. + :vartype b2_c_password_reset_policy: str + :ivar custom_login_parameters: The custom login parameters for the Community Training Resource. + :vartype custom_login_parameters: str + """ + + _validation = { + "identity_type": {"required": True}, + "tenant_id": {"required": True}, + "domain_name": {"required": True}, + "client_id": {"required": True}, + "client_secret": {"required": True}, + } + + _attribute_map = { + "identity_type": {"key": "identityType", "type": "str"}, + "teams_enabled": {"key": "teamsEnabled", "type": "bool"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "b2_c_authentication_policy": {"key": "b2cAuthenticationPolicy", "type": "str"}, + "b2_c_password_reset_policy": {"key": "b2cPasswordResetPolicy", "type": "str"}, + "custom_login_parameters": {"key": "customLoginParameters", "type": "str"}, + } + + def __init__( + self, + *, + identity_type: str, + tenant_id: str, + domain_name: str, + client_id: str, + client_secret: str, + teams_enabled: bool = False, + b2_c_authentication_policy: Optional[str] = None, + b2_c_password_reset_policy: Optional[str] = None, + custom_login_parameters: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity_type: The identity type of the Community Training Resource. Required. + :paramtype identity_type: str + :keyword teams_enabled: To indicate whether the Community Training Resource has Teams enabled. + :paramtype teams_enabled: bool + :keyword tenant_id: The tenantId of the selected identity provider for the Community Training + Resource. Required. + :paramtype tenant_id: str + :keyword domain_name: The domain name of the selected identity provider for the Community + Training Resource. Required. + :paramtype domain_name: str + :keyword client_id: The clientId of the application registered in the selected identity + provider for the Community Training Resource. Required. + :paramtype client_id: str + :keyword client_secret: The client secret of the application registered in the selected + identity provider for the Community Training Resource. Required. + :paramtype client_secret: str + :keyword b2_c_authentication_policy: The name of the authentication policy registered in ADB2C + for the Community Training Resource. + :paramtype b2_c_authentication_policy: str + :keyword b2_c_password_reset_policy: The name of the password reset policy registered in ADB2C + for the Community Training Resource. + :paramtype b2_c_password_reset_policy: str + :keyword custom_login_parameters: The custom login parameters for the Community Training + Resource. + :paramtype custom_login_parameters: str + """ + super().__init__(**kwargs) + self.identity_type = identity_type + self.teams_enabled = teams_enabled + self.tenant_id = tenant_id + self.domain_name = domain_name + self.client_id = client_id + self.client_secret = client_secret + self.b2_c_authentication_policy = b2_c_authentication_policy + self.b2_c_password_reset_policy = b2_c_password_reset_policy + self.custom_login_parameters = custom_login_parameters + + +class IdentityConfigurationPropertiesUpdate(_serialization.Model): + """Details of the Community CommunityTraining Identity Configuration. + + :ivar identity_type: The identity type of the Community Training Resource. + :vartype identity_type: str + :ivar teams_enabled: To indicate whether the Community Training Resource has Teams enabled. + :vartype teams_enabled: bool + :ivar tenant_id: The tenantId of the selected identity provider for the Community Training + Resource. + :vartype tenant_id: str + :ivar domain_name: The domain name of the selected identity provider for the Community Training + Resource. + :vartype domain_name: str + :ivar client_id: The clientId of the application registered in the selected identity provider + for the Community Training Resource. + :vartype client_id: str + :ivar client_secret: The client secret of the application registered in the selected identity + provider for the Community Training Resource. + :vartype client_secret: str + :ivar b2_c_authentication_policy: The name of the authentication policy registered in ADB2C for + the Community Training Resource. + :vartype b2_c_authentication_policy: str + :ivar b2_c_password_reset_policy: The name of the password reset policy registered in ADB2C for + the Community Training Resource. + :vartype b2_c_password_reset_policy: str + :ivar custom_login_parameters: The custom login parameters for the Community Training Resource. + :vartype custom_login_parameters: str + """ + + _attribute_map = { + "identity_type": {"key": "identityType", "type": "str"}, + "teams_enabled": {"key": "teamsEnabled", "type": "bool"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "b2_c_authentication_policy": {"key": "b2cAuthenticationPolicy", "type": "str"}, + "b2_c_password_reset_policy": {"key": "b2cPasswordResetPolicy", "type": "str"}, + "custom_login_parameters": {"key": "customLoginParameters", "type": "str"}, + } + + def __init__( + self, + *, + identity_type: Optional[str] = None, + teams_enabled: bool = False, + tenant_id: Optional[str] = None, + domain_name: Optional[str] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + b2_c_authentication_policy: Optional[str] = None, + b2_c_password_reset_policy: Optional[str] = None, + custom_login_parameters: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity_type: The identity type of the Community Training Resource. + :paramtype identity_type: str + :keyword teams_enabled: To indicate whether the Community Training Resource has Teams enabled. + :paramtype teams_enabled: bool + :keyword tenant_id: The tenantId of the selected identity provider for the Community Training + Resource. + :paramtype tenant_id: str + :keyword domain_name: The domain name of the selected identity provider for the Community + Training Resource. + :paramtype domain_name: str + :keyword client_id: The clientId of the application registered in the selected identity + provider for the Community Training Resource. + :paramtype client_id: str + :keyword client_secret: The client secret of the application registered in the selected + identity provider for the Community Training Resource. + :paramtype client_secret: str + :keyword b2_c_authentication_policy: The name of the authentication policy registered in ADB2C + for the Community Training Resource. + :paramtype b2_c_authentication_policy: str + :keyword b2_c_password_reset_policy: The name of the password reset policy registered in ADB2C + for the Community Training Resource. + :paramtype b2_c_password_reset_policy: str + :keyword custom_login_parameters: The custom login parameters for the Community Training + Resource. + :paramtype custom_login_parameters: str + """ + super().__init__(**kwargs) + self.identity_type = identity_type + self.teams_enabled = teams_enabled + self.tenant_id = tenant_id + self.domain_name = domain_name + self.client_id = client_id + self.client_secret = client_secret + self.b2_c_authentication_policy = b2_c_authentication_policy + self.b2_c_password_reset_policy = b2_c_password_reset_policy + self.custom_login_parameters = custom_login_parameters + + +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 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.communitytraining.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.communitytraining.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.communitytraining.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.communitytraining.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.communitytraining.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Sku(_serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :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.communitytraining.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 = { + "name": {"required": True}, + } + + _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"}, + } + + 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: + """ + :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.communitytraining.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__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.communitytraining.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.communitytraining.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.communitytraining.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.communitytraining.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_patch.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/__init__.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/__init__.py new file mode 100644 index 000000000000..3449d035402c --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._community_trainings_operations import CommunityTrainingsOperations + +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", + "CommunityTrainingsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_community_trainings_operations.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_community_trainings_operations.py new file mode 100644 index 000000000000..680e0c7af908 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_community_trainings_operations.py @@ -0,0 +1,1075 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_by_resource_group_request(resource_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", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_get_request( + resource_group_name: str, community_training_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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}", + ) # 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 + ), + "communityTrainingName": _SERIALIZER.url( + "community_training_name", community_training_name, "str", pattern=r"^[a-zA-Z0-9-]{3,24}$" + ), + } + + _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, community_training_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-11-01")) + 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.Community/communityTrainings/{communityTrainingName}", + ) # 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 + ), + "communityTrainingName": _SERIALIZER.url( + "community_training_name", community_training_name, "str", pattern=r"^[a-zA-Z0-9-]{3,24}$" + ), + } + + _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_update_request( + resource_group_name: str, community_training_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-11-01")) + 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.Community/communityTrainings/{communityTrainingName}", + ) # 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 + ), + "communityTrainingName": _SERIALIZER.url( + "community_training_name", community_training_name, "str", pattern=r"^[a-zA-Z0-9-]{3,24}$" + ), + } + + _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_delete_request( + resource_group_name: str, community_training_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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}", + ) # 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 + ), + "communityTrainingName": _SERIALIZER.url( + "community_training_name", community_training_name, "str", pattern=r"^[a-zA-Z0-9-]{3,24}$" + ), + } + + _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) + + +class CommunityTrainingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communitytraining.MicrosoftCommunity`'s + :attr:`community_trainings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CommunityTraining"]: + """List CommunityTraining resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityTraining or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTrainingListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityTrainingListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.CommunityTraining"]: + """List CommunityTraining resources by resource group. + + :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 CommunityTraining or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTrainingListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityTrainingListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings" + } + + @distributed_trace + def get(self, resource_group_name: str, community_training_name: str, **kwargs: Any) -> _models.CommunityTraining: + """Get a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityTraining or the result of cls(response) + :rtype: ~azure.mgmt.communitytraining.models.CommunityTraining + :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.CommunityTraining] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + community_training_name=community_training_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("CommunityTraining", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + def _create_initial( + self, + resource_group_name: str, + community_training_name: str, + resource: Union[_models.CommunityTraining, IO], + **kwargs: Any + ) -> _models.CommunityTraining: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CommunityTraining] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CommunityTraining") + + request = build_create_request( + resource_group_name=resource_group_name, + community_training_name=community_training_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CommunityTraining", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CommunityTraining", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: _models.CommunityTraining, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.communitytraining.models.CommunityTraining + :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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + community_training_name: str, + resource: Union[_models.CommunityTraining, IO], + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Create a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param resource: Resource create parameters. Is either a CommunityTraining type or a IO type. + Required. + :type resource: ~azure.mgmt.communitytraining.models.CommunityTraining 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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTraining] = 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, + community_training_name=community_training_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommunityTraining", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + def _update_initial( + self, + resource_group_name: str, + community_training_name: str, + properties: Union[_models.CommunityTrainingUpdate, IO], + **kwargs: Any + ) -> Optional[_models.CommunityTraining]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CommunityTraining]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CommunityTrainingUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + community_training_name=community_training_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CommunityTraining", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: _models.CommunityTrainingUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.communitytraining.models.CommunityTrainingUpdate + :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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + community_training_name: str, + properties: Union[_models.CommunityTrainingUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.CommunityTraining]: + """Update a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :param properties: The resource properties to be updated. Is either a CommunityTrainingUpdate + type or a IO type. Required. + :type properties: ~azure.mgmt.communitytraining.models.CommunityTrainingUpdate 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 CommunityTraining or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.communitytraining.models.CommunityTraining] + :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.CommunityTraining] = 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, + community_training_name=community_training_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommunityTraining", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, community_training_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, + community_training_name=community_training_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, community_training_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a CommunityTraining. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param community_training_name: The name of the Community Training Resource. Required. + :type community_training_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + community_training_name=community_training_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + } diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_operations.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_operations.py new file mode 100644 index 000000000000..8b3f45a40e17 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Community/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communitytraining.MicrosoftCommunity`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.communitytraining.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.Community/operations"} diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_patch.py b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/py.typed b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/azure/mgmt/communitytraining/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_create.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_create.py new file mode 100644 index 000000000000..e49ce9788ba1 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_create.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.community_trainings.begin_create( + resource_group_name="rgCommunityTaining", + community_training_name="ctApplication", + resource={ + "location": "southeastasia", + "properties": { + "disasterRecoveryEnabled": True, + "identityConfiguration": { + "b2cAuthenticationPolicy": "B2C_1_signup_signin", + "b2cPasswordResetPolicy": "B2C_1_pwd_reset", + "clientId": "8c92390f-2f30-493d-bd13-d3c3eba3709d", + "clientSecret": "idenityConfigurationClientSecret", + "customLoginParameters": "custom_hint", + "domainName": "cttenant", + "identityType": "ADB2C", + "teamsEnabled": False, + "tenantId": "c1ffbb60-88cf-4b83-b54f-c47ae6220c19", + }, + "portalAdminEmailAddress": "ctadmin@ct.com", + "portalName": "ctwebsite", + "portalOwnerEmailAddress": "ctcontact@ct.com", + "portalOwnerOrganizationName": "CT Portal Owner Organization", + "zoneRedundancyEnabled": True, + }, + "sku": {"name": "Commercial", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_delete.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_delete.py new file mode 100644 index 000000000000..0c6c5acfe08f --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.community_trainings.begin_delete( + resource_group_name="rgCommunityTraining", + community_training_name="ctApplication", + ).result() + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_get.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_get.py new file mode 100644 index 000000000000..a7a01e419193 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.community_trainings.get( + resource_group_name="rgCommunityTraining", + community_training_name="ctApplication", + ) + print(response) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_resource_group.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_resource_group.py new file mode 100644 index 000000000000..45d1120dc939 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_list_by_resource_group.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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.community_trainings.list_by_resource_group( + resource_group_name="rgCommunityTraining", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_subscription.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_subscription.py new file mode 100644 index 000000000000..5fb8cfd8de88 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_list_by_subscription.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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.community_trainings.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_update.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_update.py new file mode 100644 index 000000000000..5d9e136a95f3 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/community_trainings_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.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python community_trainings_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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.community_trainings.begin_update( + resource_group_name="rgCommunityTraining", + community_training_name="ctApplication", + properties={ + "properties": { + "identityConfiguration": { + "b2cAuthenticationPolicy": "B2C_1_signup_signin", + "b2cPasswordResetPolicy": "B2C_1_pwd_reset", + "clientId": "8c92390f-2f30-493d-bd13-d3c3eba3709d", + "clientSecret": "idenityConfigurationClientSecret", + "customLoginParameters": "custom_hint", + "domainName": "cttenant", + "identityType": "ADB2C", + "teamsEnabled": False, + "tenantId": "c1ffbb60-88cf-4b83-b54f-c47ae6220c19", + } + }, + "sku": {"name": "Commercial", "tier": "Standard"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/operations_list.py b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/operations_list.py new file mode 100644 index 000000000000..a4030a940224 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.communitytraining import MicrosoftCommunity + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communitytraining +# USAGE + python operations_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 = MicrosoftCommunity( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/sdk_packaging.toml b/sdk/communitytraining/azure-mgmt-communitytraining/sdk_packaging.toml new file mode 100644 index 000000000000..8685c94661a9 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-communitytraining" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/communitytraining/azure-mgmt-communitytraining/setup.py b/sdk/communitytraining/azure-mgmt-communitytraining/setup.py new file mode 100644 index 000000000000..19b3ed2fe210 --- /dev/null +++ b/sdk/communitytraining/azure-mgmt-communitytraining/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-communitytraining" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/communitytraining/ci.yml b/sdk/communitytraining/ci.yml new file mode 100644 index 000000000000..1d6581079ee1 --- /dev/null +++ b/sdk/communitytraining/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/communitytraining/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/communitytraining/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: communitytraining + TestProxy: true + Artifacts: + - name: azure-mgmt-communitytraining + safeName: azuremgmtcommunitytraining diff --git a/sdk/containerservice/azure-mgmt-containerservice/_meta.json b/sdk/containerservice/azure-mgmt-containerservice/_meta.json index ddc66ec78fef..e2923841da02 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservice/_meta.json @@ -1,12 +1,12 @@ { - "commit": "8b5618d760532b69d6f7434f57172ea52e109c79", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/aks/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md", "package-2023-06": "2023-07-21 03:39:44 +0800 e413760a8ba680c5d71dea6a47ce021af5dab6e2 stable/2023-06-01/managedClusters.json", "package-2023-05": "2023-06-28 14:33:18 +1200 e7db720b9842d971cd008d16b7cdb579e7b802f2 stable/2023-05-01/managedClusters.json", @@ -78,5 +78,6 @@ "package-2023-09": "2023-10-20 10:06:44 +0800 8c49a56458eeb093c0a6dee16e9b71ccdda0a888 stable/2023-09-01/managedClusters.json", "package-preview-2023-09": "2023-10-25 17:47:27 +0800 a032c2413b49d297196a0c64393e862433fccbb1 preview/2023-09-02-preview/managedClusters.json", "package-preview-2023-08": "2023-09-29 00:37:40 +0800 657bda014dd85860f8d5eb3fefd00e6888a9259b preview/2023-08-02-preview/managedClusters.json", - "package-2023-11": "2024-01-18 03:51:18 +0800 ebf29a8107ea2d7f65c2d74bf9196ec672ed18c2 stable/2023-11-01/managedClusters.json" + "package-2023-11": "2024-01-18 03:51:18 +0800 ebf29a8107ea2d7f65c2d74bf9196ec672ed18c2 stable/2023-11-01/managedClusters.json", + "package-preview-2023-11": "2024-02-02 00:15:59 +0800 eca452ea5bedf668299276087531e98558540e3c preview/2023-11-02-preview/managedClusters.json" } \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py index 2e2d45a15e83..8c39f93706c4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py @@ -61,10 +61,7 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): 'container_services': '2019-04-01', 'fleet_members': '2022-09-02-preview', 'fleets': '2022-09-02-preview', - 'machines': '2023-10-02-preview', - 'managed_cluster_snapshots': '2023-10-02-preview', 'open_shift_managed_clusters': '2019-04-30', - 'operation_status_result': '2023-10-02-preview', }}, _PROFILE_TAG + " latest" ) @@ -166,6 +163,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-10-01: :mod:`v2023_10_01.models` * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` * 2023-11-01: :mod:`v2023_11_01.models` + * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` """ if api_version == '2017-07-01': from .v2017_07_01 import models @@ -380,6 +378,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-11-01': from .v2023_11_01 import models return models + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -450,6 +451,7 @@ def agent_pools(self): * 2023-10-01: :class:`AgentPoolsOperations` * 2023-10-02-preview: :class:`AgentPoolsOperations` * 2023-11-01: :class:`AgentPoolsOperations` + * 2023-11-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -580,6 +582,8 @@ def agent_pools(self): from .v2023_10_02_preview.operations import AgentPoolsOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import AgentPoolsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) self._config.api_version = api_version @@ -650,6 +654,7 @@ def machines(self): * 2023-08-02-preview: :class:`MachinesOperations` * 2023-09-02-preview: :class:`MachinesOperations` * 2023-10-02-preview: :class:`MachinesOperations` + * 2023-11-02-preview: :class:`MachinesOperations` """ api_version = self._get_api_version('machines') if api_version == '2023-07-02-preview': @@ -660,6 +665,8 @@ def machines(self): from .v2023_09_02_preview.operations import MachinesOperations as OperationClass elif api_version == '2023-10-02-preview': from .v2023_10_02_preview.operations import MachinesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import MachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'machines'".format(api_version)) self._config.api_version = api_version @@ -719,6 +726,7 @@ def maintenance_configurations(self): * 2023-10-01: :class:`MaintenanceConfigurationsOperations` * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` * 2023-11-01: :class:`MaintenanceConfigurationsOperations` + * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -821,6 +829,8 @@ def maintenance_configurations(self): from .v2023_10_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) self._config.api_version = api_version @@ -851,6 +861,7 @@ def managed_cluster_snapshots(self): * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -895,6 +906,8 @@ def managed_cluster_snapshots(self): from .v2023_09_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2023-10-02-preview': from .v2023_10_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) self._config.api_version = api_version @@ -970,6 +983,7 @@ def managed_clusters(self): * 2023-10-01: :class:`ManagedClustersOperations` * 2023-10-02-preview: :class:`ManagedClustersOperations` * 2023-11-01: :class:`ManagedClustersOperations` + * 2023-11-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -1104,6 +1118,8 @@ def managed_clusters(self): from .v2023_10_02_preview.operations import ManagedClustersOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import ManagedClustersOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) self._config.api_version = api_version @@ -1137,10 +1153,13 @@ def operation_status_result(self): """Instance depends on the API version: * 2023-10-02-preview: :class:`OperationStatusResultOperations` + * 2023-11-02-preview: :class:`OperationStatusResultOperations` """ api_version = self._get_api_version('operation_status_result') if api_version == '2023-10-02-preview': from .v2023_10_02_preview.operations import OperationStatusResultOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import OperationStatusResultOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'operation_status_result'".format(api_version)) self._config.api_version = api_version @@ -1216,6 +1235,7 @@ def operations(self): * 2023-10-01: :class:`Operations` * 2023-10-02-preview: :class:`Operations` * 2023-11-01: :class:`Operations` + * 2023-11-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -1350,6 +1370,8 @@ def operations(self): from .v2023_10_02_preview.operations import Operations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import Operations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -1413,6 +1435,7 @@ def private_endpoint_connections(self): * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -1523,6 +1546,8 @@ def private_endpoint_connections(self): from .v2023_10_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) self._config.api_version = api_version @@ -1584,6 +1609,7 @@ def private_link_resources(self): * 2023-10-01: :class:`PrivateLinkResourcesOperations` * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` * 2023-11-01: :class:`PrivateLinkResourcesOperations` + * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -1690,6 +1716,8 @@ def private_link_resources(self): from .v2023_10_02_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) self._config.api_version = api_version @@ -1751,6 +1779,7 @@ def resolve_private_link_service_id(self): * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -1857,6 +1886,8 @@ def resolve_private_link_service_id(self): from .v2023_10_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) self._config.api_version = api_version @@ -1911,6 +1942,7 @@ def snapshots(self): * 2023-10-01: :class:`SnapshotsOperations` * 2023-10-02-preview: :class:`SnapshotsOperations` * 2023-11-01: :class:`SnapshotsOperations` + * 2023-11-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -2003,6 +2035,8 @@ def snapshots(self): from .v2023_10_02_preview.operations import SnapshotsOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import SnapshotsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) self._config.api_version = api_version @@ -2034,6 +2068,7 @@ def trusted_access_role_bindings(self): * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': @@ -2080,6 +2115,8 @@ def trusted_access_role_bindings(self): from .v2023_10_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) self._config.api_version = api_version @@ -2111,6 +2148,7 @@ def trusted_access_roles(self): * 2023-10-01: :class:`TrustedAccessRolesOperations` * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` * 2023-11-01: :class:`TrustedAccessRolesOperations` + * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': @@ -2157,6 +2195,8 @@ def trusted_access_roles(self): from .v2023_10_02_preview.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2023-11-01': from .v2023_11_01.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from .v2023_11_02_preview.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py index 778ac87f2535..4061650b81b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py @@ -61,10 +61,7 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): 'container_services': '2019-04-01', 'fleet_members': '2022-09-02-preview', 'fleets': '2022-09-02-preview', - 'machines': '2023-10-02-preview', - 'managed_cluster_snapshots': '2023-10-02-preview', 'open_shift_managed_clusters': '2019-04-30', - 'operation_status_result': '2023-10-02-preview', }}, _PROFILE_TAG + " latest" ) @@ -166,6 +163,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-10-01: :mod:`v2023_10_01.models` * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` * 2023-11-01: :mod:`v2023_11_01.models` + * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` """ if api_version == '2017-07-01': from ..v2017_07_01 import models @@ -380,6 +378,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-11-01': from ..v2023_11_01 import models return models + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -450,6 +451,7 @@ def agent_pools(self): * 2023-10-01: :class:`AgentPoolsOperations` * 2023-10-02-preview: :class:`AgentPoolsOperations` * 2023-11-01: :class:`AgentPoolsOperations` + * 2023-11-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -580,6 +582,8 @@ def agent_pools(self): from ..v2023_10_02_preview.aio.operations import AgentPoolsOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import AgentPoolsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) self._config.api_version = api_version @@ -650,6 +654,7 @@ def machines(self): * 2023-08-02-preview: :class:`MachinesOperations` * 2023-09-02-preview: :class:`MachinesOperations` * 2023-10-02-preview: :class:`MachinesOperations` + * 2023-11-02-preview: :class:`MachinesOperations` """ api_version = self._get_api_version('machines') if api_version == '2023-07-02-preview': @@ -660,6 +665,8 @@ def machines(self): from ..v2023_09_02_preview.aio.operations import MachinesOperations as OperationClass elif api_version == '2023-10-02-preview': from ..v2023_10_02_preview.aio.operations import MachinesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import MachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'machines'".format(api_version)) self._config.api_version = api_version @@ -719,6 +726,7 @@ def maintenance_configurations(self): * 2023-10-01: :class:`MaintenanceConfigurationsOperations` * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` * 2023-11-01: :class:`MaintenanceConfigurationsOperations` + * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -821,6 +829,8 @@ def maintenance_configurations(self): from ..v2023_10_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) self._config.api_version = api_version @@ -851,6 +861,7 @@ def managed_cluster_snapshots(self): * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -895,6 +906,8 @@ def managed_cluster_snapshots(self): from ..v2023_09_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2023-10-02-preview': from ..v2023_10_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) self._config.api_version = api_version @@ -970,6 +983,7 @@ def managed_clusters(self): * 2023-10-01: :class:`ManagedClustersOperations` * 2023-10-02-preview: :class:`ManagedClustersOperations` * 2023-11-01: :class:`ManagedClustersOperations` + * 2023-11-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -1104,6 +1118,8 @@ def managed_clusters(self): from ..v2023_10_02_preview.aio.operations import ManagedClustersOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import ManagedClustersOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) self._config.api_version = api_version @@ -1137,10 +1153,13 @@ def operation_status_result(self): """Instance depends on the API version: * 2023-10-02-preview: :class:`OperationStatusResultOperations` + * 2023-11-02-preview: :class:`OperationStatusResultOperations` """ api_version = self._get_api_version('operation_status_result') if api_version == '2023-10-02-preview': from ..v2023_10_02_preview.aio.operations import OperationStatusResultOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import OperationStatusResultOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'operation_status_result'".format(api_version)) self._config.api_version = api_version @@ -1216,6 +1235,7 @@ def operations(self): * 2023-10-01: :class:`Operations` * 2023-10-02-preview: :class:`Operations` * 2023-11-01: :class:`Operations` + * 2023-11-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -1350,6 +1370,8 @@ def operations(self): from ..v2023_10_02_preview.aio.operations import Operations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import Operations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -1413,6 +1435,7 @@ def private_endpoint_connections(self): * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -1523,6 +1546,8 @@ def private_endpoint_connections(self): from ..v2023_10_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) self._config.api_version = api_version @@ -1584,6 +1609,7 @@ def private_link_resources(self): * 2023-10-01: :class:`PrivateLinkResourcesOperations` * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` * 2023-11-01: :class:`PrivateLinkResourcesOperations` + * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -1690,6 +1716,8 @@ def private_link_resources(self): from ..v2023_10_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) self._config.api_version = api_version @@ -1751,6 +1779,7 @@ def resolve_private_link_service_id(self): * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -1857,6 +1886,8 @@ def resolve_private_link_service_id(self): from ..v2023_10_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) self._config.api_version = api_version @@ -1911,6 +1942,7 @@ def snapshots(self): * 2023-10-01: :class:`SnapshotsOperations` * 2023-10-02-preview: :class:`SnapshotsOperations` * 2023-11-01: :class:`SnapshotsOperations` + * 2023-11-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -2003,6 +2035,8 @@ def snapshots(self): from ..v2023_10_02_preview.aio.operations import SnapshotsOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import SnapshotsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) self._config.api_version = api_version @@ -2034,6 +2068,7 @@ def trusted_access_role_bindings(self): * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': @@ -2080,6 +2115,8 @@ def trusted_access_role_bindings(self): from ..v2023_10_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) self._config.api_version = api_version @@ -2111,6 +2148,7 @@ def trusted_access_roles(self): * 2023-10-01: :class:`TrustedAccessRolesOperations` * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` * 2023-11-01: :class:`TrustedAccessRolesOperations` + * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': @@ -2157,6 +2195,8 @@ def trusted_access_roles(self): from ..v2023_10_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2023-11-01': from ..v2023_11_01.aio.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2023-11-02-preview': + from ..v2023_11_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py index 713463c6e53c..07ded8c01db8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py @@ -7,5 +7,4 @@ from .v2019_04_01.models import * from .v2019_04_30.models import * from .v2022_09_02_preview.models import * -from .v2023_10_02_preview.models import * from .v2023_11_01.models import * diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/__init__.py new file mode 100644 index 000000000000..4f004a298ed4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._container_service_client import ContainerServiceClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ContainerServiceClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_configuration.py new file mode 100644 index 000000000000..e3daf2fbdf3e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-11-02-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(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_container_service_client.py new file mode 100644 index 000000000000..453e70a9d8c9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_container_service_client.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import ( + AgentPoolsOperations, + MachinesOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + OperationStatusResultOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2023_11_02_preview.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2023_11_02_preview.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2023_11_02_preview.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2023_11_02_preview.operations.AgentPoolsOperations + :ivar machines: MachinesOperations operations + :vartype machines: + azure.mgmt.containerservice.v2023_11_02_preview.operations.MachinesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2023_11_02_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2023_11_02_preview.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2023_11_02_preview.operations.ResolvePrivateLinkServiceIdOperations + :ivar operation_status_result: OperationStatusResultOperations operations + :vartype operation_status_result: + azure.mgmt.containerservice.v2023_11_02_preview.operations.OperationStatusResultOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2023_11_02_preview.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2023_11_02_preview.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2023_11_02_preview.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2023_11_02_preview.operations.TrustedAccessRoleBindingsOperations + :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. The value must be an UUID. 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-11-02-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.machines = MachinesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.operation_status_result = OperationStatusResultOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "ContainerServiceClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_metadata.json new file mode 100644 index 000000000000..f8af1ee747f3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_metadata.json @@ -0,0 +1,122 @@ +{ + "chosen_version": "2023-11-02-preview", + "total_api_version_list": ["2023-11-02-preview"], + "client": { + "name": "ContainerServiceClient", + "filename": "_container_service_client", + "description": "The Container Service Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. The value must be an UUID. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. The value must be an UUID. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "managed_clusters": "ManagedClustersOperations", + "maintenance_configurations": "MaintenanceConfigurationsOperations", + "agent_pools": "AgentPoolsOperations", + "machines": "MachinesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "resolve_private_link_service_id": "ResolvePrivateLinkServiceIdOperations", + "operation_status_result": "OperationStatusResultOperations", + "snapshots": "SnapshotsOperations", + "managed_cluster_snapshots": "ManagedClusterSnapshotsOperations", + "trusted_access_roles": "TrustedAccessRolesOperations", + "trusted_access_role_bindings": "TrustedAccessRoleBindingsOperations" + } +} diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/__init__.py new file mode 100644 index 000000000000..d14e96ddb36e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ContainerServiceClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..ef93e0caca36 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-11-02-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(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_container_service_client.py new file mode 100644 index 000000000000..5b6eed4184e5 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_container_service_client.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import ( + AgentPoolsOperations, + MachinesOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + OperationStatusResultOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.AgentPoolsOperations + :ivar machines: MachinesOperations operations + :vartype machines: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.MachinesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.ResolvePrivateLinkServiceIdOperations + :ivar operation_status_result: OperationStatusResultOperations operations + :vartype operation_status_result: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.OperationStatusResultOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2023_11_02_preview.aio.operations.TrustedAccessRoleBindingsOperations + :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. The value must be an UUID. 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-11-02-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.machines = MachinesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.operation_status_result = OperationStatusResultOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-11-02-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerServiceClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..a035074bb195 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/__init__.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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._machines_operations import MachinesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._operation_status_result_operations import OperationStatusResultOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations + +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", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "MachinesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "OperationStatusResultOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..6cbd80f7d41a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_agent_pools_operations.py @@ -0,0 +1,1288 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._agent_pools_operations import ( + build_abort_latest_operation_request, + build_create_or_update_request, + build_delete_machines_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _abort_latest_operation_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, agent_pool_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._abort_latest_operation_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _abort_latest_operation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + } + + @distributed_trace_async + async def begin_abort_latest_operation( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Aborts last operation running on agent pool. + + Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a + Canceling state and eventually to a Canceled state when cancellation finishes. If the operation + completes before cancellation can take place, an error is returned. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_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._api_version or "2023-11-02-preview") + ) + 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._abort_latest_operation_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_abort_latest_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + } + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + 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("AgentPoolListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = 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, "AgentPool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AgentPool", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool + :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 AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. 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 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 AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a AgentPool type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = 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, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-11-02-preview") + ) + 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, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @distributed_trace_async + async def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default" + } + + async def _delete_machines_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: Union[_models.AgentPoolDeleteMachinesParameter, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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(machines, (IOBase, bytes)): + _content = machines + else: + _json = self._serialize.body(machines, "AgentPoolDeleteMachinesParameter") + + request = build_delete_machines_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_machines_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_machines_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines" + } + + @overload + async def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: _models.AgentPoolDeleteMachinesParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Required. + :type machines: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolDeleteMachinesParameter + :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: + """ + + @overload + async def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Required. + :type machines: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: Union[_models.AgentPoolDeleteMachinesParameter, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Is either a + AgentPoolDeleteMachinesParameter type or a IO type. Required. + :type machines: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolDeleteMachinesParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-11-02-preview") + ) + 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._delete_machines_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + machines=machines, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # 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_machines.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines" + } + + @distributed_trace_async + async def get_available_agent_pool_versions( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolAvailableVersions + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolAvailableVersions] = kwargs.pop("cls", None) + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions" + } + + async def _upgrade_node_image_version_initial( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> Optional[_models.AgentPool]: + 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._api_version or "2023-11-02-preview") + ) + cls: ClsType[Optional[_models.AgentPool]] = kwargs.pop("cls", None) + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion" + } + + @distributed_trace_async + async def begin_upgrade_node_image_version( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_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 AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + 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._upgrade_node_image_version_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade_node_image_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_machines_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_machines_operations.py new file mode 100644 index 000000000000..63af1f3f0e3a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_machines_operations.py @@ -0,0 +1,228 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._machines_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`machines` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Machine"]: + """Gets a list of machines in the specified agent pool. + + Gets a list of machines in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Machine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + 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("MachineListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, machine_name: str, **kwargs: Any + ) -> _models.Machine: + """Get a specific machine in the specified agent pool. + + Get a specific machine in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machine_name: host name of the machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Machine or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.Machine] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + machine_name=machine_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Machine", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..c041a42d5a10 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,462 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_managed_cluster( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MaintenanceConfigurationListResult] = 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_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.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("MaintenanceConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_managed_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MaintenanceConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :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: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a + MaintenanceConfiguration type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfiguration] = 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, "MaintenanceConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_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.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..603592574a3c --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,679 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshotListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + 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("ManagedClusterSnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :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 ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshotListResult] = 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, + 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("ManagedClusterSnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :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: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a + ManagedClusterSnapshot type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedClusterSnapshot] = 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, "ManagedClusterSnapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_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.ContainerService/managedclustersnapshots/{resourceName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedClusterSnapshot] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..1666c97d080f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_managed_clusters_operations.py @@ -0,0 +1,3594 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_clusters_operations import ( + build_abort_latest_operation_request, + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_guardrails_versions_request, + build_get_mesh_revision_profile_request, + build_get_mesh_upgrade_profile_request, + build_get_os_options_request, + build_get_request, + build_get_safeguards_versions_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_guardrails_versions_request, + build_list_kubernetes_versions_request, + build_list_mesh_revision_profiles_request, + build_list_mesh_upgrade_profiles_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_list_safeguards_versions_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_rotate_service_account_signing_keys_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get_os_options( + self, location: str, resource_type: Optional[str] = None, **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSOptionProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OSOptionProfile] = kwargs.pop("cls", None) + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSOptionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default" + } + + @distributed_trace_async + async def list_kubernetes_versions(self, location: str, **kwargs: Any) -> _models.KubernetesVersionListResult: + """Gets a list of supported Kubernetes versions in the specified subscription. + + Contains extra metadata on the version, including supported patch versions, capabilities, + available upgrades, and details on preview status of the version. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KubernetesVersionListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersionListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.KubernetesVersionListResult] = kwargs.pop("cls", None) + + request = build_list_kubernetes_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_kubernetes_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KubernetesVersionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_kubernetes_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + 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("ManagedClusterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :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 ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterListResult] = 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, + 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("ManagedClusterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters" + } + + @distributed_trace_async + async def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default" + } + + @distributed_trace_async + async def get_access_profile( + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAccessProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterAccessProfile] = kwargs.pop("cls", None) + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential" + } + + @distributed_trace_async + async def list_cluster_admin_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential" + } + + @distributed_trace_async + async def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, _models.Format]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure", "exec", and + "exec". Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential" + } + + @distributed_trace_async + async def list_cluster_monitoring_user_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedCluster] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, "ManagedCluster") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. 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 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a ManagedCluster type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + async def _update_tags_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. 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 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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_tags_initial( + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-11-02-preview") + ) + 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, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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.ContainerService/managedClusters/{resourceName}" + } + + async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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, "ManagedClusterServicePrincipalProfile") + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reset_service_principal_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile" + } + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + :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: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. 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 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: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + ManagedClusterServicePrincipalProfile type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-11-02-preview") + ) + 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._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_service_principal_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile" + } + + async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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, "ManagedClusterAADProfile") + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reset_aad_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile" + } + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile + :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: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. 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 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: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a + ManagedClusterAADProfile type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-11-02-preview") + ) + 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._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_aad_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile" + } + + async def _abort_latest_operation_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._abort_latest_operation_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _abort_latest_operation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + } + + @distributed_trace_async + async def begin_abort_latest_operation( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Aborts last operation running on managed cluster. + + Aborts the currently running operation on the managed cluster. The Managed Cluster will be + moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If + the operation completes before cancellation can take place, an error is returned. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + 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._abort_latest_operation_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_abort_latest_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + } + + async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _rotate_cluster_certificates_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates" + } + + @distributed_trace_async + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + 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._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_rotate_cluster_certificates.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates" + } + + async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_rotate_service_account_signing_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _rotate_service_account_signing_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + } + + @distributed_trace_async + async def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + 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._rotate_service_account_signing_keys_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_rotate_service_account_signing_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop" + } + + @distributed_trace_async + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop" + } + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start" + } + + @distributed_trace_async + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start" + } + + async def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.RunCommandResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IOBase, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _run_command_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand" + } + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandRequest + :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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a RunCommandRequest type or a IO + type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = 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._run_command_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_run_command.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand" + } + + @distributed_trace_async + async def get_command_result( + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult or 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._api_version or "2023-11-02-preview") + ) + cls: ClsType[Optional[_models.RunCommandResult]] = kwargs.pop("cls", None) + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get_command_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}" + } + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundEnvironmentEndpoint] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = 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_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + 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("OutboundEnvironmentEndpointCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_outbound_network_dependencies_endpoints.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints" + } + + @distributed_trace_async + async def get_guardrails_versions( + self, location: str, version: str, **kwargs: Any + ) -> _models.GuardrailsAvailableVersion: + """Gets supported Guardrails version in the specified subscription and location. + + Contains Guardrails version along with its support info and whether it is a default version. + + :param location: The name of the Azure region. Required. + :type location: str + :param version: Safeguards version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuardrailsAvailableVersion or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.GuardrailsAvailableVersion] = kwargs.pop("cls", None) + + request = build_get_guardrails_versions_request( + location=location, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_guardrails_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GuardrailsAvailableVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_guardrails_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version}" + } + + @distributed_trace + def list_guardrails_versions( + self, location: str, **kwargs: Any + ) -> AsyncIterable["_models.GuardrailsAvailableVersion"]: + """Gets a list of supported Guardrails versions in the specified subscription and location. + + Contains list of Guardrails version along with its support info and whether it is a default + version. + + :param location: The name of the Azure region. 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 GuardrailsAvailableVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.GuardrailsAvailableVersionsList] = 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_guardrails_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_guardrails_versions.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("GuardrailsAvailableVersionsList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_guardrails_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions" + } + + @distributed_trace_async + async def get_safeguards_versions( + self, location: str, version: str, **kwargs: Any + ) -> _models.SafeguardsAvailableVersion: + """Gets supported Safeguards version in the specified subscription and location. + + Contains Safeguards version along with its support info and whether it is a default version. + + :param location: The name of the Azure region. Required. + :type location: str + :param version: Safeguards version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SafeguardsAvailableVersion or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SafeguardsAvailableVersion] = kwargs.pop("cls", None) + + request = build_get_safeguards_versions_request( + location=location, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_safeguards_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SafeguardsAvailableVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_safeguards_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version}" + } + + @distributed_trace + def list_safeguards_versions( + self, location: str, **kwargs: Any + ) -> AsyncIterable["_models.SafeguardsAvailableVersion"]: + """Gets a list of supported Safeguards versions in the specified subscription and location. + + Contains list of Safeguards version along with its support info and whether it is a default + version. + + :param location: The name of the Azure region. 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 SafeguardsAvailableVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SafeguardsAvailableVersionsList] = 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_safeguards_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_safeguards_versions.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("SafeguardsAvailableVersionsList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_safeguards_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions" + } + + @distributed_trace + def list_mesh_revision_profiles(self, location: str, **kwargs: Any) -> AsyncIterable["_models.MeshRevisionProfile"]: + """Lists mesh revision profiles for all meshes in the specified location. + + Contains extra metadata on each revision, including supported revisions, cluster compatibility + and available upgrades. + + :param location: The name of the Azure region. 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 MeshRevisionProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshRevisionProfileList] = 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_mesh_revision_profiles_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_mesh_revision_profiles.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("MeshRevisionProfileList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_mesh_revision_profiles.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles" + } + + @distributed_trace_async + async def get_mesh_revision_profile(self, location: str, mode: str, **kwargs: Any) -> _models.MeshRevisionProfile: + """Gets a mesh revision profile for a specified mesh in the specified location. + + Contains extra metadata on the revision, including supported revisions, cluster compatibility + and available upgrades. + + :param location: The name of the Azure region. Required. + :type location: str + :param mode: The mode of the mesh. Required. + :type mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MeshRevisionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshRevisionProfile] = kwargs.pop("cls", None) + + request = build_get_mesh_revision_profile_request( + location=location, + mode=mode, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_mesh_revision_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MeshRevisionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_mesh_revision_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode}" + } + + @distributed_trace + def list_mesh_upgrade_profiles( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MeshUpgradeProfile"]: + """Lists available upgrades for all service meshes in a specific cluster. + + Lists available upgrades for all service meshes in a specific cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MeshUpgradeProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshUpgradeProfileList] = 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_mesh_upgrade_profiles_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_mesh_upgrade_profiles.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("MeshUpgradeProfileList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_mesh_upgrade_profiles.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles" + } + + @distributed_trace_async + async def get_mesh_upgrade_profile( + self, resource_group_name: str, resource_name: str, mode: str, **kwargs: Any + ) -> _models.MeshUpgradeProfile: + """Gets available upgrades for a service mesh in a cluster. + + Gets available upgrades for a service mesh in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param mode: The mode of the mesh. Required. + :type mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MeshUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_mesh_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + mode=mode, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_mesh_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MeshUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_mesh_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operation_status_result_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operation_status_result_operations.py new file mode 100644 index 000000000000..ad8e310ecd6b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operation_status_result_operations.py @@ -0,0 +1,301 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_result_operations import ( + build_get_by_agent_pool_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OperationStatusResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`operation_status_result` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OperationStatusResult"]: + """Gets a list of operations in the specified managedCluster. + + Gets a list of operations in the specified managedCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResultList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + 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("OperationStatusResultList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatusResult: + """Get the status of a specific operation in the specified managed cluster. + + Get the status of a specific operation in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations/{operationId}" + } + + @distributed_trace_async + async def get_by_agent_pool( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatusResult: + """Get the status of a specific operation in the specified agent pool. + + Get the status of a specific operation in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_by_agent_pool_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_by_agent_pool.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_agent_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/operations/{operationId}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..6649cde44b61 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_operations.py @@ -0,0 +1,138 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationValue] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..21120abec975 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,491 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnectionListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. 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.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.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 + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, private_endpoint_connection_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_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._api_version or "2023-11-02-preview") + ) + 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, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9219e39a1939 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,121 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._private_link_resources_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResourcesListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..e4eec758a13c --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._resolve_private_link_service_id_operations import build_post_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :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: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a PrivateLinkResource type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.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 = case_insensitive_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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkResource] = 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, "PrivateLinkResource") + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..daec5ff00e89 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_snapshots_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SnapshotListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + 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("SnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :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 Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SnapshotListResult] = 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, + 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("SnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :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: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a Snapshot type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = 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, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Snapshot", pipeline_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.ContainerService/snapshots/{resourceName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..9bcf0ca0e0c1 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,612 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._trusted_access_role_bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRoleBinding"]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleBindingListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + 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("TrustedAccessRoleBindingListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleBinding] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedAccessRoleBinding] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IOBase, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding + :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 TrustedAccessRoleBinding or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TrustedAccessRoleBinding or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a + TrustedAccessRoleBinding type or a IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TrustedAccessRoleBinding or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedAccessRoleBinding] = 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, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + trusted_access_role_binding=trusted_access_role_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_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._api_version or "2023-11-02-preview") + ) + 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, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..f4c371b6dcc4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._trusted_access_roles_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_roles` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.TrustedAccessRole"]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of the Azure region. 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 TrustedAccessRole or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRole] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + 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("TrustedAccessRoleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/__init__.py new file mode 100644 index 000000000000..bf55388da40d --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/__init__.py @@ -0,0 +1,493 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AbsoluteMonthlySchedule +from ._models_py3 import AgentPool +from ._models_py3 import AgentPoolArtifactStreamingProfile +from ._models_py3 import AgentPoolAvailableVersions +from ._models_py3 import AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem +from ._models_py3 import AgentPoolDeleteMachinesParameter +from ._models_py3 import AgentPoolGPUProfile +from ._models_py3 import AgentPoolListResult +from ._models_py3 import AgentPoolNetworkProfile +from ._models_py3 import AgentPoolSecurityProfile +from ._models_py3 import AgentPoolUpgradeProfile +from ._models_py3 import AgentPoolUpgradeProfilePropertiesUpgradesItem +from ._models_py3 import AgentPoolUpgradeSettings +from ._models_py3 import AgentPoolWindowsProfile +from ._models_py3 import AzureKeyVaultKms +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterUpgradeSettings +from ._models_py3 import CompatibleVersions +from ._models_py3 import ContainerServiceLinuxProfile +from ._models_py3 import ContainerServiceNetworkProfile +from ._models_py3 import ContainerServiceNetworkProfileKubeProxyConfig +from ._models_py3 import ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig +from ._models_py3 import ContainerServiceSshConfiguration +from ._models_py3 import ContainerServiceSshPublicKey +from ._models_py3 import CreationData +from ._models_py3 import CredentialResult +from ._models_py3 import CredentialResults +from ._models_py3 import DailySchedule +from ._models_py3 import DateSpan +from ._models_py3 import DelegatedResource +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtendedLocation +from ._models_py3 import GuardrailsAvailableVersion +from ._models_py3 import GuardrailsAvailableVersionsList +from ._models_py3 import GuardrailsAvailableVersionsProperties +from ._models_py3 import IPTag +from ._models_py3 import IstioCertificateAuthority +from ._models_py3 import IstioComponents +from ._models_py3 import IstioEgressGateway +from ._models_py3 import IstioIngressGateway +from ._models_py3 import IstioPluginCertificateAuthority +from ._models_py3 import IstioServiceMesh +from ._models_py3 import KubeletConfig +from ._models_py3 import KubernetesPatchVersion +from ._models_py3 import KubernetesVersion +from ._models_py3 import KubernetesVersionCapabilities +from ._models_py3 import KubernetesVersionListResult +from ._models_py3 import LinuxOSConfig +from ._models_py3 import Machine +from ._models_py3 import MachineIpAddress +from ._models_py3 import MachineListResult +from ._models_py3 import MachineNetworkProperties +from ._models_py3 import MachineProperties +from ._models_py3 import MaintenanceConfiguration +from ._models_py3 import MaintenanceConfigurationListResult +from ._models_py3 import MaintenanceWindow +from ._models_py3 import ManagedCluster +from ._models_py3 import ManagedClusterAADProfile +from ._models_py3 import ManagedClusterAIToolchainOperatorProfile +from ._models_py3 import ManagedClusterAPIServerAccessProfile +from ._models_py3 import ManagedClusterAccessProfile +from ._models_py3 import ManagedClusterAddonProfile +from ._models_py3 import ManagedClusterAddonProfileIdentity +from ._models_py3 import ManagedClusterAgentPoolProfile +from ._models_py3 import ManagedClusterAgentPoolProfileProperties +from ._models_py3 import ManagedClusterAutoUpgradeProfile +from ._models_py3 import ManagedClusterAzureMonitorProfile +from ._models_py3 import ManagedClusterAzureMonitorProfileAppMonitoring +from ._models_py3 import ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics +from ._models_py3 import ManagedClusterAzureMonitorProfileContainerInsights +from ._models_py3 import ManagedClusterAzureMonitorProfileKubeStateMetrics +from ._models_py3 import ManagedClusterAzureMonitorProfileLogs +from ._models_py3 import ManagedClusterAzureMonitorProfileMetrics +from ._models_py3 import ManagedClusterAzureMonitorProfileWindowsHostLogs +from ._models_py3 import ManagedClusterCostAnalysis +from ._models_py3 import ManagedClusterHTTPProxyConfig +from ._models_py3 import ManagedClusterIdentity +from ._models_py3 import ManagedClusterIngressProfile +from ._models_py3 import ManagedClusterIngressProfileWebAppRouting +from ._models_py3 import ManagedClusterListResult +from ._models_py3 import ManagedClusterLoadBalancerProfile +from ._models_py3 import ManagedClusterLoadBalancerProfileManagedOutboundIPs +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPPrefixes +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPs +from ._models_py3 import ManagedClusterManagedOutboundIPProfile +from ._models_py3 import ManagedClusterMetricsProfile +from ._models_py3 import ManagedClusterNATGatewayProfile +from ._models_py3 import ManagedClusterNodeProvisioningProfile +from ._models_py3 import ManagedClusterNodeResourceGroupProfile +from ._models_py3 import ManagedClusterOIDCIssuerProfile +from ._models_py3 import ManagedClusterPodIdentity +from ._models_py3 import ManagedClusterPodIdentityException +from ._models_py3 import ManagedClusterPodIdentityProfile +from ._models_py3 import ManagedClusterPodIdentityProvisioningError +from ._models_py3 import ManagedClusterPodIdentityProvisioningErrorBody +from ._models_py3 import ManagedClusterPodIdentityProvisioningInfo +from ._models_py3 import ManagedClusterPoolUpgradeProfile +from ._models_py3 import ManagedClusterPoolUpgradeProfileUpgradesItem +from ._models_py3 import ManagedClusterPropertiesAutoScalerProfile +from ._models_py3 import ManagedClusterPropertiesForSnapshot +from ._models_py3 import ManagedClusterSKU +from ._models_py3 import ManagedClusterSecurityProfile +from ._models_py3 import ManagedClusterSecurityProfileDefender +from ._models_py3 import ManagedClusterSecurityProfileDefenderSecurityMonitoring +from ._models_py3 import ManagedClusterSecurityProfileImageCleaner +from ._models_py3 import ManagedClusterSecurityProfileImageIntegrity +from ._models_py3 import ManagedClusterSecurityProfileNodeRestriction +from ._models_py3 import ManagedClusterSecurityProfileWorkloadIdentity +from ._models_py3 import ManagedClusterServicePrincipalProfile +from ._models_py3 import ManagedClusterSnapshot +from ._models_py3 import ManagedClusterSnapshotListResult +from ._models_py3 import ManagedClusterStorageProfile +from ._models_py3 import ManagedClusterStorageProfileBlobCSIDriver +from ._models_py3 import ManagedClusterStorageProfileDiskCSIDriver +from ._models_py3 import ManagedClusterStorageProfileFileCSIDriver +from ._models_py3 import ManagedClusterStorageProfileSnapshotController +from ._models_py3 import ManagedClusterUpgradeProfile +from ._models_py3 import ManagedClusterWindowsProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfileKeda +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler +from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue +from ._models_py3 import ManualScaleProfile +from ._models_py3 import MeshRevision +from ._models_py3 import MeshRevisionProfile +from ._models_py3 import MeshRevisionProfileList +from ._models_py3 import MeshRevisionProfileProperties +from ._models_py3 import MeshUpgradeProfile +from ._models_py3 import MeshUpgradeProfileList +from ._models_py3 import MeshUpgradeProfileProperties +from ._models_py3 import NetworkMonitoring +from ._models_py3 import NetworkProfileForSnapshot +from ._models_py3 import OSOptionProfile +from ._models_py3 import OSOptionProperty +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusResult +from ._models_py3 import OperationStatusResultList +from ._models_py3 import OperationValue +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection +from ._models_py3 import PortRange +from ._models_py3 import PowerState +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import RelativeMonthlySchedule +from ._models_py3 import Resource +from ._models_py3 import ResourceReference +from ._models_py3 import RunCommandRequest +from ._models_py3 import RunCommandResult +from ._models_py3 import SafeguardsAvailableVersion +from ._models_py3 import SafeguardsAvailableVersionsList +from ._models_py3 import SafeguardsAvailableVersionsProperties +from ._models_py3 import SafeguardsProfile +from ._models_py3 import ScaleProfile +from ._models_py3 import Schedule +from ._models_py3 import ServiceMeshProfile +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotListResult +from ._models_py3 import SubResource +from ._models_py3 import SysctlConfig +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import TimeInWeek +from ._models_py3 import TimeSpan +from ._models_py3 import TrackedResource +from ._models_py3 import TrustedAccessRole +from ._models_py3 import TrustedAccessRoleBinding +from ._models_py3 import TrustedAccessRoleBindingListResult +from ._models_py3 import TrustedAccessRoleListResult +from ._models_py3 import TrustedAccessRoleRule +from ._models_py3 import UpgradeOverrideSettings +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VirtualMachineNodes +from ._models_py3 import VirtualMachinesProfile +from ._models_py3 import WeeklySchedule +from ._models_py3 import WindowsGmsaProfile + +from ._container_service_client_enums import AddonAutoscaling +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolSSHAccess +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import BackendPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import GuardrailsSupport +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import IpvsScheduler +from ._container_service_client_enums import IstioIngressGatewayMode +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import KubernetesSupportPlan +from ._container_service_client_enums import Level +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import Mode +from ._container_service_client_enums import NetworkDataplane +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPluginMode +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import NodeOSUpgradeChannel +from ._container_service_client_enums import NodeProvisioningMode +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import Protocol +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import RestrictionLevel +from ._container_service_client_enums import SafeguardsSupport +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import ServiceMeshMode +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import TrustedAccessRoleBindingProvisioningState +from ._container_service_client_enums import Type +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AbsoluteMonthlySchedule", + "AgentPool", + "AgentPoolArtifactStreamingProfile", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolDeleteMachinesParameter", + "AgentPoolGPUProfile", + "AgentPoolListResult", + "AgentPoolNetworkProfile", + "AgentPoolSecurityProfile", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AgentPoolWindowsProfile", + "AzureKeyVaultKms", + "CloudErrorBody", + "ClusterUpgradeSettings", + "CompatibleVersions", + "ContainerServiceLinuxProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceNetworkProfileKubeProxyConfig", + "ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "CreationData", + "CredentialResult", + "CredentialResults", + "DailySchedule", + "DateSpan", + "DelegatedResource", + "EndpointDependency", + "EndpointDetail", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ExtendedLocation", + "GuardrailsAvailableVersion", + "GuardrailsAvailableVersionsList", + "GuardrailsAvailableVersionsProperties", + "IPTag", + "IstioCertificateAuthority", + "IstioComponents", + "IstioEgressGateway", + "IstioIngressGateway", + "IstioPluginCertificateAuthority", + "IstioServiceMesh", + "KubeletConfig", + "KubernetesPatchVersion", + "KubernetesVersion", + "KubernetesVersionCapabilities", + "KubernetesVersionListResult", + "LinuxOSConfig", + "Machine", + "MachineIpAddress", + "MachineListResult", + "MachineNetworkProperties", + "MachineProperties", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "MaintenanceWindow", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAIToolchainOperatorProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterAzureMonitorProfile", + "ManagedClusterAzureMonitorProfileAppMonitoring", + "ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics", + "ManagedClusterAzureMonitorProfileContainerInsights", + "ManagedClusterAzureMonitorProfileKubeStateMetrics", + "ManagedClusterAzureMonitorProfileLogs", + "ManagedClusterAzureMonitorProfileMetrics", + "ManagedClusterAzureMonitorProfileWindowsHostLogs", + "ManagedClusterCostAnalysis", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterIngressProfile", + "ManagedClusterIngressProfileWebAppRouting", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterMetricsProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterNodeProvisioningProfile", + "ManagedClusterNodeResourceGroupProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileDefender", + "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + "ManagedClusterSecurityProfileImageCleaner", + "ManagedClusterSecurityProfileImageIntegrity", + "ManagedClusterSecurityProfileNodeRestriction", + "ManagedClusterSecurityProfileWorkloadIdentity", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileBlobCSIDriver", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedClusterWorkloadAutoScalerProfile", + "ManagedClusterWorkloadAutoScalerProfileKeda", + "ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "ManualScaleProfile", + "MeshRevision", + "MeshRevisionProfile", + "MeshRevisionProfileList", + "MeshRevisionProfileProperties", + "MeshUpgradeProfile", + "MeshUpgradeProfileList", + "MeshUpgradeProfileProperties", + "NetworkMonitoring", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationStatusResult", + "OperationStatusResultList", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PortRange", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "ProxyResource", + "RelativeMonthlySchedule", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "SafeguardsAvailableVersion", + "SafeguardsAvailableVersionsList", + "SafeguardsAvailableVersionsProperties", + "SafeguardsProfile", + "ScaleProfile", + "Schedule", + "ServiceMeshProfile", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "TrustedAccessRole", + "TrustedAccessRoleBinding", + "TrustedAccessRoleBindingListResult", + "TrustedAccessRoleListResult", + "TrustedAccessRoleRule", + "UpgradeOverrideSettings", + "UserAssignedIdentity", + "VirtualMachineNodes", + "VirtualMachinesProfile", + "WeeklySchedule", + "WindowsGmsaProfile", + "AddonAutoscaling", + "AgentPoolMode", + "AgentPoolSSHAccess", + "AgentPoolType", + "BackendPoolType", + "Code", + "ConnectionStatus", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "GuardrailsSupport", + "IpFamily", + "IpvsScheduler", + "IstioIngressGatewayMode", + "KeyVaultNetworkAccessTypes", + "KubeletDiskType", + "KubernetesSupportPlan", + "Level", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "Mode", + "NetworkDataplane", + "NetworkMode", + "NetworkPlugin", + "NetworkPluginMode", + "NetworkPolicy", + "NodeOSUpgradeChannel", + "NodeProvisioningMode", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "Protocol", + "PublicNetworkAccess", + "ResourceIdentityType", + "RestrictionLevel", + "SafeguardsSupport", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "ServiceMeshMode", + "SnapshotType", + "TrustedAccessRoleBindingProvisioningState", + "Type", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_container_service_client_enums.py new file mode 100644 index 000000000000..19891f769802 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_container_service_client_enums.py @@ -0,0 +1,670 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AddonAutoscaling(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether VPA add-on is enabled and configured to scale AKS-managed add-ons.""" + + ENABLED = "Enabled" + """Feature to autoscale AKS-managed add-ons is enabled. The default VPA update mode is Initial + #: mode.""" + DISABLED = "Disabled" + """Feature to autoscale AKS-managed add-ons is disabled.""" + + +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A cluster must have at least one 'System' Agent Pool at all times. For additional information + on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. + """ + + SYSTEM = "System" + """System agent pools are primarily for hosting critical system pods such as CoreDNS and + #: metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + #: least 2vCPUs and 4GB of memory.""" + USER = "User" + """User agent pools are primarily for hosting your application pods.""" + + +class AgentPoolSSHAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SSH access method of an agent pool.""" + + LOCAL_USER = "LocalUser" + """Can SSH onto the node as a local user using private key.""" + DISABLED = "Disabled" + """SSH service will be turned off on the node.""" + + +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Agent Pool.""" + + VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" + """Create an Agent Pool backed by a Virtual Machine Scale Set.""" + AVAILABILITY_SET = "AvailabilitySet" + """Use of this is strongly discouraged.""" + VIRTUAL_MACHINES = "VirtualMachines" + """Create an Agent Pool backed by a Single Instance VM orchestration mode.""" + + +class BackendPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the managed inbound Load Balancer BackendPool.""" + + NODE_IP_CONFIGURATION = "NodeIPConfiguration" + """The type of the managed inbound Load Balancer BackendPool. + #: https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend.""" + NODE_IP = "NodeIP" + """The type of the managed inbound Load Balancer BackendPool. + #: https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend.""" + + +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tells whether the cluster is Running or Stopped.""" + + RUNNING = "Running" + """The cluster is running.""" + STOPPED = "Stopped" + """The cluster is stopped.""" + + +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private link service connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'random'. See `expanders + `_ + for more information. + """ + + LEAST_WASTE = "least-waste" + """Selects the node group that will have the least idle CPU (if tied, unused memory) after + #: scale-up. This is useful when you have different classes of nodes, for example, high CPU or + #: high memory nodes, and only want to expand those when there are pending pods that need a lot of + #: those resources.""" + MOST_PODS = "most-pods" + """Selects the node group that would be able to schedule the most pods when scaling up. This is + #: useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + #: that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple + #: smaller nodes at once.""" + PRIORITY = "priority" + """Selects the node group that has the highest priority assigned by the user. It's configuration + #: is described in more details `here + #: `_.""" + RANDOM = "random" + """Used when you don't have a particular need for the node groups to scale differently.""" + + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation.""" + + EDGE_ZONE = "EdgeZone" + + +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" + + AZURE = "azure" + """Return azure auth-provider kubeconfig. This format is deprecated in v1.22 and will be fully + #: removed in v1.26. See: https://aka.ms/k8s/changes-1-26.""" + EXEC = "exec" + """Return exec format kubeconfig. This format requires kubelogin binary in the path.""" + EXEC_ENUM = "exec" + """Return exec format kubeconfig. This format requires kubelogin binary in the path.""" + + +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" + + MIG1_G = "MIG1g" + MIG2_G = "MIG2g" + MIG3_G = "MIG3g" + MIG4_G = "MIG4g" + MIG7_G = "MIG7g" + + +class GuardrailsSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the version is preview or stable.""" + + PREVIEW = "Preview" + """The version is preview. It is not recommended to use preview versions on critical production + #: clusters. The preview version may not support all use-cases.""" + STABLE = "Stable" + """The version is stable and can be used on critical production clusters.""" + + +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """To determine if address belongs IPv4 or IPv6 family.""" + + I_PV4 = "IPv4" + """IPv4 family""" + I_PV6 = "IPv6" + """IPv6 family""" + + +class IpvsScheduler(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IPVS scheduler, for more information please see + http://www.linuxvirtualserver.org/docs/scheduling.html. + """ + + ROUND_ROBIN = "RoundRobin" + """Round Robin""" + LEAST_CONNECTION = "LeastConnection" + """Least Connection""" + + +class IstioIngressGatewayMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mode of an ingress gateway.""" + + EXTERNAL = "External" + """The ingress gateway is assigned a public IP address and is publicly accessible.""" + INTERNAL = "Internal" + """The ingress gateway is assigned an internal IP address and cannot is accessed publicly.""" + + +class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` + means the key vault allows public access from all networks. ``Private`` means the key vault + disables public access and enables private link. The default value is ``Public``. + """ + + PUBLIC = "Public" + PRIVATE = "Private" + + +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet + ephemeral storage. + """ + + OS = "OS" + """Kubelet will use the OS disk for its data.""" + TEMPORARY = "Temporary" + """Kubelet will use the temporary disk for its data.""" + + +class KubernetesSupportPlan(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Different support tiers for AKS managed clusters.""" + + KUBERNETES_OFFICIAL = "KubernetesOfficial" + """Support for the version is the same as for the open source Kubernetes offering. Official + #: Kubernetes open source community support versions for 1 year after release.""" + AKS_LONG_TERM_SUPPORT = "AKSLongTermSupport" + """Support for the version extended past the KubernetesOfficial support of 1 year. AKS continues + #: to patch CVEs for another 1 year, for a total of 2 years of support.""" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Safeguards level to be used. By default, Safeguards is enabled for all namespaces except + those that AKS excludes via systemExcludedNamespaces. + """ + + OFF = "Off" + WARNING = "Warning" + ENFORCEMENT = "Enforcement" + + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. + """ + + NONE = "None" + """No additional licensing is applied.""" + WINDOWS_SERVER = "Windows_Server" + """Enables Azure Hybrid User Benefits for Windows VMs.""" + + +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. + """ + + STANDARD = "standard" + """Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information + #: about on working with the load balancer in the managed cluster, see the `standard Load Balancer + #: `_ article.""" + BASIC = "basic" + """Use a basic Load Balancer with limited functionality.""" + + +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of the pod identity.""" + + ASSIGNED = "Assigned" + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of a managed cluster SKU.""" + + BASE = "Base" + """Base option for the AKS control plane.""" + + +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'Free'. See `AKS Pricing Tier + `_ for more details. + """ + + PREMIUM = "Premium" + """Cluster has premium capabilities in addition to all of the capabilities included in 'Standard'. + #: Premium enables selection of LongTermSupport (aka.ms/aks/lts) for certain Kubernetes versions.""" + STANDARD = "Standard" + """Recommended for mission-critical and production workloads. Includes Kubernetes control plane + #: autoscaling, workload-intensive testing, and up to 5,000 nodes per cluster. Guarantees 99.95% + #: availability of the Kubernetes API server endpoint for clusters that use Availability Zones and + #: 99.9% of availability for clusters that don't use Availability Zones.""" + FREE = "Free" + """The cluster management is free, but charged for VM, storage, and networking usage. Best for + #: experimenting, learning, simple testing, or workloads with fewer than 10 nodes. Not recommended + #: for production use cases.""" + + +class Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specify which proxy mode to use ('IPTABLES' or 'IPVS').""" + + IPTABLES = "IPTABLES" + """IPTables proxy mode""" + IPVS = "IPVS" + """IPVS proxy mode. Must be using Kubernetes version >= 1.22.""" + + +class NetworkDataplane(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network dataplane used in the Kubernetes cluster.""" + + AZURE = "azure" + """Use Azure network dataplane.""" + CILIUM = "cilium" + """Use Cilium network dataplane. See `Azure CNI Powered by Cilium + #: `_ for more information.""" + + +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This cannot be specified if networkPlugin is anything other than 'azure'.""" + + TRANSPARENT = "transparent" + """No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure + #: CNI. See `Transparent Mode `_ for + #: more information.""" + BRIDGE = "bridge" + """This is no longer supported""" + + +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network plugin used for building the Kubernetes network.""" + + AZURE = "azure" + """Use the Azure CNI network plugin. See `Azure CNI (advanced) networking + #: `_ for + #: more information.""" + KUBENET = "kubenet" + """Use the Kubenet network plugin. See `Kubenet (basic) networking + #: `_ for more + #: information.""" + NONE = "none" + """Do not use a network plugin. A custom CNI will need to be installed after cluster creation for + #: networking functionality.""" + + +class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode the network plugin should use.""" + + OVERLAY = "overlay" + """Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than + #: Kubenet reference plugins host-local and bridge.""" + + +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network policy used for building the Kubernetes network.""" + + NONE = "none" + """Network policies will not be enforced. This is the default value when NetworkPolicy is not + #: specified.""" + CALICO = "calico" + """Use Calico network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information.""" + AZURE = "azure" + """Use Azure network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information.""" + CILIUM = "cilium" + """Use Cilium to enforce network policies. This requires networkDataplane to be 'cilium'.""" + + +class NodeOSUpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA.""" + + NONE = "None" + """No attempt to update your machines OS will be made either by OS or by rolling VHDs. This means + #: you are responsible for your security updates""" + UNMANAGED = "Unmanaged" + """OS updates will be applied automatically through the OS built-in patching infrastructure. Newly + #: scaled in machines will be unpatched initially, and will be patched at some later time by the + #: OS's infrastructure. Behavior of this option depends on the OS in question. Ubuntu and Mariner + #: apply security patches through unattended upgrade roughly once a day around 06:00 UTC. Windows + #: does not apply security patches automatically and so for them this option is equivalent to None + #: till further notice""" + SECURITY_PATCH = "SecurityPatch" + """AKS will update the nodes VHD with patches from the image maintainer labelled "security only" + #: on a regular basis. Where possible, patches will also be applied without reimaging to existing + #: nodes. Some patches, such as kernel patches, cannot be applied to existing nodes without + #: disruption. For such patches, the VHD will be updated, and machines will be rolling reimaged to + #: that VHD following maintenance windows and surge settings. This option incurs the extra cost of + #: hosting the VHDs in your node resource group.""" + NODE_IMAGE = "NodeImage" + """AKS will update the nodes with a newly patched VHD containing security fixes and bugfixes on a + #: weekly cadence. With the VHD update machines will be rolling reimaged to that VHD following + #: maintenance windows and surge settings. No extra VHD cost is incurred when choosing this option + #: as AKS hosts the images.""" + + +class NodeProvisioningMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Once the mode it set to Auto, it cannot be changed back to Manual.""" + + MANUAL = "Manual" + """Nodes are provisioned manually by the user""" + AUTO = "Auto" + """Nodes are provisioned automatically by AKS using Karpenter. Fixed size Node Pools can still be + #: created, but autoscaling Node Pools cannot be. (See aka.ms/aks/nap for more details).""" + + +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested + OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more + information see `Ephemeral OS + `_. + """ + + MANAGED = "Managed" + """Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data + #: loss should the VM need to be relocated to another host. Since containers aren't designed to + #: have local state persisted, this behavior offers limited value while providing some drawbacks, + #: including slower node provisioning and higher read/write latency.""" + EPHEMERAL = "Ephemeral" + """Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This + #: provides lower read/write latency, along with faster node scaling and cluster upgrades.""" + + +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if + OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to + Windows2022 after Windows2019 is deprecated. + """ + + UBUNTU = "Ubuntu" + """Use Ubuntu as the OS for node images.""" + MARINER = "Mariner" + """Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead.""" + AZURE_LINUX = "AzureLinux" + """Use AzureLinux as the OS for node images. Azure Linux is a container-optimized Linux distro + #: built by Microsoft, visit https://aka.ms/azurelinux for more information.""" + CBL_MARINER = "CBLMariner" + """Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead.""" + WINDOWS2019 = "Windows2019" + """Use Windows2019 as the OS for node images. Unsupported for system node pools. Windows2019 only + #: supports Windows2019 containers; it cannot run Windows2022 containers and vice versa.""" + WINDOWS2022 = "Windows2022" + """Use Windows2022 as the OS for node images. Unsupported for system node pools. Windows2022 only + #: supports Windows2022 containers; it cannot run Windows2019 containers and vice versa.""" + WINDOWS_ANNUAL = "WindowsAnnual" + """Use Windows Annual Channel version as the OS for node images. Unsupported for system node + #: pools. Details about supported container images and kubernetes versions under different AKS + #: Annual Channel versions could be seen in https://aka.ms/aks/windows-annual-channel-details.""" + + +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system type. The default is Linux.""" + + LINUX = "Linux" + """Use Linux.""" + WINDOWS = "Windows" + """Use Windows.""" + + +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This can only be set at cluster creation time and cannot be changed later. For more information + see `egress outbound type `_. + """ + + LOAD_BALANCER = "loadBalancer" + """The load balancer is used for egress through an AKS assigned public IP. This supports + #: Kubernetes services of type 'loadBalancer'. For more information see `outbound type + #: loadbalancer + #: `_.""" + USER_DEFINED_ROUTING = "userDefinedRouting" + """Egress paths must be defined by the user. This is an advanced scenario and requires proper + #: network configuration. For more information see `outbound type userDefinedRouting + #: `_.""" + MANAGED_NAT_GATEWAY = "managedNATGateway" + """The AKS-managed NAT gateway is used for egress.""" + USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + """The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an + #: advanced scenario and requires proper network configuration.""" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + + +class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network protocol of the port.""" + + TCP = "TCP" + """TCP protocol.""" + UDP = "UDP" + """UDP protocol.""" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allow or deny public network access for AKS.""" + + ENABLED = "Enabled" + """Inbound/Outbound to the managedCluster is allowed.""" + DISABLED = "Disabled" + """Inbound traffic to managedCluster is disabled, traffic from managedCluster is allowed.""" + SECURED_BY_PERIMETER = "SecuredByPerimeter" + """Inbound/Outbound traffic is managed by Microsoft.Network/NetworkSecurityPerimeters.""" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `use managed identities in AKS + `_. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + """Use an implicitly created system assigned managed identity to manage cluster resources. Master + #: components in the control plane such as kube-controller-manager will use the system assigned + #: managed identity to manipulate Azure resources.""" + USER_ASSIGNED = "UserAssigned" + """Use a user-specified identity to manage cluster resources. Master components in the control + #: plane such as kube-controller-manager will use the specified user assigned managed identity to + #: manipulate Azure resources.""" + NONE = "None" + """Do not use a managed identity for the Managed Cluster, service principal will be used instead.""" + + +class RestrictionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The restriction level applied to the cluster's node resource group.""" + + UNRESTRICTED = "Unrestricted" + """All RBAC permissions are allowed on the managed node resource group""" + READ_ONLY = "ReadOnly" + """Only */read RBAC permissions allowed on the managed node resource group""" + + +class SafeguardsSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the version is preview or stable.""" + + PREVIEW = "Preview" + """The version is preview. It is not recommended to use preview versions on critical production + #: clusters. The preview version may not support all use-cases.""" + STABLE = "Stable" + """The version is stable and can be used on critical production clusters.""" + + +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes how VMs are added to or removed from Agent Pools. See `billing states + `_. + """ + + DELETE = "Delete" + """Create new instances during scale up and remove instances during scale down.""" + DEALLOCATE = "Deallocate" + """Attempt to start deallocated instances (if they exist) during scale up and deallocate instances + #: during scale down.""" + + +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. + For more information about eviction see `spot VMs + `_. + """ + + DELETE = "Delete" + """Nodes in the underlying Scale Set of the node pool are deleted when they're evicted.""" + DEALLOCATE = "Deallocate" + """Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated state + #: upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can + #: cause issues with cluster scaling or upgrading.""" + + +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Virtual Machine Scale Set priority.""" + + SPOT = "Spot" + """Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS + #: `_ for more information.""" + REGULAR = "Regular" + """Regular VMs will be used.""" + + +class ServiceMeshMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mode of the service mesh.""" + + ISTIO = "Istio" + """Istio deployed as an AKS addon.""" + DISABLED = "Disabled" + """Mesh is disabled.""" + + +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a snapshot. The default is NodePool.""" + + NODE_POOL = "NodePool" + """The snapshot is a snapshot of a node pool.""" + MANAGED_CLUSTER = "ManagedCluster" + """The snapshot is a snapshot of a managed cluster.""" + + +class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of trusted access role binding.""" + + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs.""" + + FIRST = "First" + """First.""" + SECOND = "Second" + """Second.""" + THIRD = "Third" + """Third.""" + FOURTH = "Fourth" + """Fourth.""" + LAST = "Last" + """Last.""" + + +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `setting the AKS cluster auto-upgrade channel + `_. + """ + + RAPID = "rapid" + """Automatically upgrade the cluster to the latest supported patch release on the latest supported + #: minor version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor + #: version where N is the latest supported minor version, the cluster first upgrades to the latest + #: supported patch version on N-1 minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is + #: upgraded to 1.18.6, then is upgraded to 1.19.1.""" + STABLE = "stable" + """Automatically upgrade the cluster to the latest supported patch release on minor version N-1, + #: where N is the latest supported minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded + #: to 1.18.6.""" + PATCH = "patch" + """Automatically upgrade the cluster to the latest supported patch version when it becomes + #: available while keeping the minor version the same. For example, if a cluster is running + #: version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is + #: upgraded to 1.17.9.""" + NODE_IMAGE = "node-image" + """Automatically upgrade the node image to the latest version available. Consider using + #: nodeOSUpgradeChannel instead as that allows you to configure node OS patching separate from + #: Kubernetes version patching""" + NONE = "none" + """Disables auto-upgrades and keeps the cluster at its current version of Kubernetes.""" + + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The weekday enum.""" + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + + +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the type of workload a node can run.""" + + OCI_CONTAINER = "OCIContainer" + """Nodes will use Kubelet to run standard OCI container workloads.""" + WASM_WASI = "WasmWasi" + """Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview).""" + KATA_MSHV_VM_ISOLATION = "KataMshvVmIsolation" + """Nodes can use (Kata + Cloud Hypervisor + Hyper-V) to enable Nested VM-based pods (Preview). Due + #: to the use Hyper-V, AKS node OS itself is a nested VM (the root OS) of Hyper-V. Thus it can + #: only be used with VM series that support Nested Virtualization such as Dv3 series.""" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..2efb5d211bf4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_models_py3.py @@ -0,0 +1,10106 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class AbsoluteMonthlySchedule(_serialization.Model): + """For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. + + All required parameters must be populated in order to send to Azure. + + :ivar interval_months: Specifies the number of months between each set of occurrences. + Required. + :vartype interval_months: int + :ivar day_of_month: The date of the month. Required. + :vartype day_of_month: int + """ + + _validation = { + "interval_months": {"required": True, "maximum": 6, "minimum": 1}, + "day_of_month": {"required": True, "maximum": 31, "minimum": 1}, + } + + _attribute_map = { + "interval_months": {"key": "intervalMonths", "type": "int"}, + "day_of_month": {"key": "dayOfMonth", "type": "int"}, + } + + def __init__(self, *, interval_months: int, day_of_month: int, **kwargs: Any) -> None: + """ + :keyword interval_months: Specifies the number of months between each set of occurrences. + Required. + :paramtype interval_months: int + :keyword day_of_month: The date of the month. Required. + :paramtype day_of_month: int + """ + super().__init__(**kwargs) + self.interval_months = interval_months + self.day_of_month = day_of_month + + +class SubResource(_serialization.Model): + """Reference to another subresource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes + """Agent Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :ivar type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet", and "VirtualMachines". + :vartype type_properties_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar node_initialization_taints: These taints will not be reconciled by AKS and can be removed + with a kubectl call. This field can be modified after node pool is created, but nodes will not + be recreated with new taints until another operation that requires recreation (e.g. node image + upgrade) happens. These taints allow for required configuration to run before the node is ready + to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with + ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :vartype node_initialization_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar windows_profile: The Windows agent pool's specific profile. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :ivar network_profile: Network-related settings of an agent pool. + :vartype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :ivar security_profile: The security settings of an agent pool. + :vartype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :ivar gpu_profile: The GPU settings of an agent pool. + :vartype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :ivar artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :vartype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :ivar virtual_machines_profile: Specifications on VirtualMachines agent pool. + :vartype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :ivar virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :vartype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "properties.enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "node_initialization_taints": {"key": "properties.nodeInitializationTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "AgentPoolWindowsProfile"}, + "network_profile": {"key": "properties.networkProfile", "type": "AgentPoolNetworkProfile"}, + "security_profile": {"key": "properties.securityProfile", "type": "AgentPoolSecurityProfile"}, + "gpu_profile": {"key": "properties.gpuProfile", "type": "AgentPoolGPUProfile"}, + "artifact_streaming_profile": { + "key": "properties.artifactStreamingProfile", + "type": "AgentPoolArtifactStreamingProfile", + }, + "virtual_machines_profile": {"key": "properties.virtualMachinesProfile", "type": "VirtualMachinesProfile"}, + "virtual_machine_nodes_status": { + "key": "properties.virtualMachineNodesStatus", + "type": "[VirtualMachineNodes]", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + node_initialization_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + windows_profile: Optional["_models.AgentPoolWindowsProfile"] = None, + network_profile: Optional["_models.AgentPoolNetworkProfile"] = None, + security_profile: Optional["_models.AgentPoolSecurityProfile"] = None, + gpu_profile: Optional["_models.AgentPoolGPUProfile"] = None, + artifact_streaming_profile: Optional["_models.AgentPoolArtifactStreamingProfile"] = None, + virtual_machines_profile: Optional["_models.VirtualMachinesProfile"] = None, + virtual_machine_nodes_status: Optional[List["_models.VirtualMachineNodes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :keyword type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet", and "VirtualMachines". + :paramtype type_properties_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword node_initialization_taints: These taints will not be reconciled by AKS and can be + removed with a kubectl call. This field can be modified after node pool is created, but nodes + will not be recreated with new taints until another operation that requires recreation (e.g. + node image upgrade) happens. These taints allow for required configuration to run before the + node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be + removed with ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :paramtype node_initialization_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword windows_profile: The Windows agent pool's specific profile. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :keyword network_profile: Network-related settings of an agent pool. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :keyword security_profile: The security settings of an agent pool. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :keyword gpu_profile: The GPU settings of an agent pool. + :paramtype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :keyword artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :paramtype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :keyword virtual_machines_profile: Specifications on VirtualMachines agent pool. + :paramtype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :keyword virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :paramtype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type_properties_type = type_properties_type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.node_initialization_taints = node_initialization_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + self.windows_profile = windows_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.gpu_profile = gpu_profile + self.artifact_streaming_profile = artifact_streaming_profile + self.virtual_machines_profile = virtual_machines_profile + self.virtual_machine_nodes_status = virtual_machine_nodes_status + + +class AgentPoolArtifactStreamingProfile(_serialization.Model): + """AgentPoolArtifactStreamingProfile. + + :ivar enabled: Artifact streaming speeds up the cold-start of containers on a node through + on-demand image loading. To use this feature, container images must also enable artifact + streaming on ACR. If not specified, the default is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Artifact streaming speeds up the cold-start of containers on a node through + on-demand image loading. To use this feature, container images must also enable artifact + streaming on ACR. If not specified, the default is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class AgentPoolAvailableVersions(_serialization.Model): + """The list of available versions for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the agent pool version list. + :vartype id: str + :ivar name: The name of the agent pool version list. + :vartype name: str + :ivar type: Type of the agent pool version list. + :vartype type: str + :ivar agent_pool_versions: List of versions available for agent pool. + :vartype agent_pool_versions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, + } + + def __init__( + self, + *, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword agent_pool_versions: List of versions available for agent pool. + :paramtype agent_pool_versions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.agent_pool_versions = agent_pool_versions + + +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): + """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. + + :ivar default: Whether this version is the default agent pool version. + :vartype default: bool + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, + *, + default: Optional[bool] = None, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword default: Whether this version is the default agent pool version. + :paramtype default: bool + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.default = default + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolDeleteMachinesParameter(_serialization.Model): + """Specifies a list of machine names from the agent pool to be deleted. + + All required parameters must be populated in order to send to Azure. + + :ivar machine_names: The agent pool machine names. Required. + :vartype machine_names: list[str] + """ + + _validation = { + "machine_names": {"required": True}, + } + + _attribute_map = { + "machine_names": {"key": "machineNames", "type": "[str]"}, + } + + def __init__(self, *, machine_names: List[str], **kwargs: Any) -> None: + """ + :keyword machine_names: The agent pool machine names. Required. + :paramtype machine_names: list[str] + """ + super().__init__(**kwargs) + self.machine_names = machine_names + + +class AgentPoolGPUProfile(_serialization.Model): + """AgentPoolGPUProfile. + + :ivar install_gpu_driver: The default value is true when the vmSize of the agent pool contains + a GPU, false otherwise. GPU Driver Installation can only be set true when VM has an associated + GPU resource. Setting this field to false prevents automatic GPU driver installation. In that + case, in order for the GPU to be usable, the user must perform GPU driver installation + themselves. + :vartype install_gpu_driver: bool + """ + + _attribute_map = { + "install_gpu_driver": {"key": "installGPUDriver", "type": "bool"}, + } + + def __init__(self, *, install_gpu_driver: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword install_gpu_driver: The default value is true when the vmSize of the agent pool + contains a GPU, false otherwise. GPU Driver Installation can only be set true when VM has an + associated GPU resource. Setting this field to false prevents automatic GPU driver + installation. In that case, in order for the GPU to be usable, the user must perform GPU driver + installation themselves. + :paramtype install_gpu_driver: bool + """ + super().__init__(**kwargs) + self.install_gpu_driver = install_gpu_driver + + +class AgentPoolListResult(_serialization.Model): + """The response from the List Agent Pools operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of agent pools. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :ivar next_link: The URL to get the next set of agent pool results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of agent pools. + :paramtype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AgentPoolNetworkProfile(_serialization.Model): + """Network settings of an agent pool. + + :ivar node_public_ip_tags: IPTags of instance-level public IPs. + :vartype node_public_ip_tags: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IPTag] + :ivar allowed_host_ports: The port ranges that are allowed to access. The specified ranges are + allowed to overlap. + :vartype allowed_host_ports: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PortRange] + :ivar application_security_groups: The IDs of the application security groups which agent pool + will associate when created. + :vartype application_security_groups: list[str] + """ + + _attribute_map = { + "node_public_ip_tags": {"key": "nodePublicIPTags", "type": "[IPTag]"}, + "allowed_host_ports": {"key": "allowedHostPorts", "type": "[PortRange]"}, + "application_security_groups": {"key": "applicationSecurityGroups", "type": "[str]"}, + } + + def __init__( + self, + *, + node_public_ip_tags: Optional[List["_models.IPTag"]] = None, + allowed_host_ports: Optional[List["_models.PortRange"]] = None, + application_security_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword node_public_ip_tags: IPTags of instance-level public IPs. + :paramtype node_public_ip_tags: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IPTag] + :keyword allowed_host_ports: The port ranges that are allowed to access. The specified ranges + are allowed to overlap. + :paramtype allowed_host_ports: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PortRange] + :keyword application_security_groups: The IDs of the application security groups which agent + pool will associate when created. + :paramtype application_security_groups: list[str] + """ + super().__init__(**kwargs) + self.node_public_ip_tags = node_public_ip_tags + self.allowed_host_ports = allowed_host_ports + self.application_security_groups = application_security_groups + + +class AgentPoolSecurityProfile(_serialization.Model): + """The security settings of an agent pool. + + :ivar ssh_access: SSH access method of an agent pool. Known values are: "LocalUser" and + "Disabled". + :vartype ssh_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSSHAccess + :ivar enable_vtpm: vTPM is a Trusted Launch feature for configuring a dedicated secure vault + for keys and measurements held locally on the node. For more details, see + aka.ms/aks/trustedlaunch. If not specified, the default is false. + :vartype enable_vtpm: bool + :ivar enable_secure_boot: Secure Boot is a feature of Trusted Launch which ensures that only + signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. + If not specified, the default is false. + :vartype enable_secure_boot: bool + """ + + _attribute_map = { + "ssh_access": {"key": "sshAccess", "type": "str"}, + "enable_vtpm": {"key": "enableVTPM", "type": "bool"}, + "enable_secure_boot": {"key": "enableSecureBoot", "type": "bool"}, + } + + def __init__( + self, + *, + ssh_access: Optional[Union[str, "_models.AgentPoolSSHAccess"]] = None, + enable_vtpm: Optional[bool] = None, + enable_secure_boot: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword ssh_access: SSH access method of an agent pool. Known values are: "LocalUser" and + "Disabled". + :paramtype ssh_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSSHAccess + :keyword enable_vtpm: vTPM is a Trusted Launch feature for configuring a dedicated secure vault + for keys and measurements held locally on the node. For more details, see + aka.ms/aks/trustedlaunch. If not specified, the default is false. + :paramtype enable_vtpm: bool + :keyword enable_secure_boot: Secure Boot is a feature of Trusted Launch which ensures that only + signed operating systems and drivers can boot. For more details, see aka.ms/aks/trustedlaunch. + If not specified, the default is false. + :paramtype enable_secure_boot: bool + """ + super().__init__(**kwargs) + self.ssh_access = ssh_access + self.enable_vtpm = enable_vtpm + self.enable_secure_boot = enable_secure_boot + + +class AgentPoolUpgradeProfile(_serialization.Model): + """The list of available upgrades for an agent pool. + + 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: The ID of the agent pool upgrade profile. + :vartype id: str + :ivar name: The name of the agent pool upgrade profile. + :vartype name: str + :ivar type: The type of the agent pool upgrade profile. + :vartype type: str + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :ivar latest_node_image_version: The latest AKS supported node image version. + :vartype latest_node_image_version: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + latest_node_image_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :keyword latest_node_image_version: The latest AKS supported node image version. + :paramtype latest_node_image_version: str + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kubernetes_version = kubernetes_version + self.os_type = os_type + self.upgrades = upgrades + self.latest_node_image_version = latest_node_image_version + + +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): + """AgentPoolUpgradeProfilePropertiesUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs: Any + ) -> None: + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolUpgradeSettings(_serialization.Model): + """Settings for upgrading an agentpool. + + :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). + If a percentage is specified, it is the percentage of the total agent pool size at the time of + the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is + 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :vartype max_surge: str + :ivar drain_timeout_in_minutes: The amount of time (in minutes) to wait on eviction of pods and + graceful termination per node. This eviction wait time honors waiting on pod disruption + budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 + minutes. + :vartype drain_timeout_in_minutes: int + :ivar node_soak_duration_in_minutes: The amount of time (in minutes) to wait after draining a + node and before reimaging it and moving on to next node. If not specified, the default is 0 + minutes. + :vartype node_soak_duration_in_minutes: int + """ + + _validation = { + "drain_timeout_in_minutes": {"maximum": 1440, "minimum": 1}, + "node_soak_duration_in_minutes": {"maximum": 30, "minimum": 0}, + } + + _attribute_map = { + "max_surge": {"key": "maxSurge", "type": "str"}, + "drain_timeout_in_minutes": {"key": "drainTimeoutInMinutes", "type": "int"}, + "node_soak_duration_in_minutes": {"key": "nodeSoakDurationInMinutes", "type": "int"}, + } + + def __init__( + self, + *, + max_surge: Optional[str] = None, + drain_timeout_in_minutes: Optional[int] = None, + node_soak_duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. + '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the + time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the + default is 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :paramtype max_surge: str + :keyword drain_timeout_in_minutes: The amount of time (in minutes) to wait on eviction of pods + and graceful termination per node. This eviction wait time honors waiting on pod disruption + budgets. If this time is exceeded, the upgrade fails. If not specified, the default is 30 + minutes. + :paramtype drain_timeout_in_minutes: int + :keyword node_soak_duration_in_minutes: The amount of time (in minutes) to wait after draining + a node and before reimaging it and moving on to next node. If not specified, the default is 0 + minutes. + :paramtype node_soak_duration_in_minutes: int + """ + super().__init__(**kwargs) + self.max_surge = max_surge + self.drain_timeout_in_minutes = drain_timeout_in_minutes + self.node_soak_duration_in_minutes = node_soak_duration_in_minutes + + +class AgentPoolWindowsProfile(_serialization.Model): + """The Windows agent pool's specific profile. + + :ivar disable_outbound_nat: The default value is false. Outbound NAT can only be disabled if + the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP + enabled. + :vartype disable_outbound_nat: bool + """ + + _attribute_map = { + "disable_outbound_nat": {"key": "disableOutboundNat", "type": "bool"}, + } + + def __init__(self, *, disable_outbound_nat: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword disable_outbound_nat: The default value is false. Outbound NAT can only be disabled if + the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP + enabled. + :paramtype disable_outbound_nat: bool + """ + super().__init__(**kwargs) + self.disable_outbound_nat = disable_outbound_nat + + +class AzureKeyVaultKms(_serialization.Model): + """Azure Key Vault key management service settings for the security profile. + + :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. + :vartype enabled: bool + :ivar key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :vartype key_id: str + :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` + and ``Private``. ``Public`` means the key vault allows public access from all networks. + ``Private`` means the key vault disables public access and enables private link. The default + value is ``Public``. Known values are: "Public" and "Private". + :vartype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KeyVaultNetworkAccessTypes + :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :vartype key_vault_resource_id: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + key_id: Optional[str] = None, + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", + key_vault_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether to enable Azure Key Vault key management service. The default is + false. + :paramtype enabled: bool + :keyword key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :paramtype key_id: str + :keyword key_vault_network_access: Network access of key vault. The possible values are + ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all + networks. ``Private`` means the key vault disables public access and enables private link. The + default value is ``Public``. Known values are: "Public" and "Private". + :paramtype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KeyVaultNetworkAccessTypes + :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :paramtype key_vault_resource_id: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.key_id = key_id + self.key_vault_network_access = key_vault_network_access + self.key_vault_resource_id = key_vault_resource_id + + +class CloudErrorBody(_serialization.Model): + """An error response from the Container service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterUpgradeSettings(_serialization.Model): + """Settings for upgrading a cluster. + + :ivar override_settings: Settings for overrides. + :vartype override_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UpgradeOverrideSettings + """ + + _attribute_map = { + "override_settings": {"key": "overrideSettings", "type": "UpgradeOverrideSettings"}, + } + + def __init__(self, *, override_settings: Optional["_models.UpgradeOverrideSettings"] = None, **kwargs: Any) -> None: + """ + :keyword override_settings: Settings for overrides. + :paramtype override_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UpgradeOverrideSettings + """ + super().__init__(**kwargs) + self.override_settings = override_settings + + +class CompatibleVersions(_serialization.Model): + """Version information about a product/service that is compatible with a service mesh revision. + + :ivar name: The product/service name. + :vartype name: str + :ivar versions: Product/service versions compatible with a service mesh add-on revision. + :vartype versions: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "versions": {"key": "versions", "type": "[str]"}, + } + + def __init__(self, *, name: Optional[str] = None, versions: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword name: The product/service name. + :paramtype name: str + :keyword versions: Product/service versions compatible with a service mesh add-on revision. + :paramtype versions: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.versions = versions + + +class ContainerServiceLinuxProfile(_serialization.Model): + """Profile for Linux VMs in the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: The administrator username to use for Linux VMs. Required. + :vartype admin_username: str + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :vartype ssh: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceSshConfiguration + """ + + _validation = { + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, + } + + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs: Any) -> None: + """ + :keyword admin_username: The administrator username to use for Linux VMs. Required. + :paramtype admin_username: str + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :paramtype ssh: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceSshConfiguration + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.ssh = ssh + + +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Profile of network configuration. + + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :vartype network_plugin: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPlugin + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "overlay" + :vartype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPluginMode + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "none", "calico", "azure", and "cilium". + :vartype network_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPolicy + :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. + Known values are: "transparent" and "bridge". + :vartype network_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMode + :ivar network_dataplane: Network dataplane used in the Kubernetes cluster. Known values are: + "azure" and "cilium". + :vartype network_dataplane: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkDataplane + :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :vartype pod_cidr: str + :ivar service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It must + not overlap with any Subnet IP ranges. + :vartype service_cidr: str + :ivar dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be within + the Kubernetes service address range specified in serviceCidr. + :vartype dns_service_ip: str + :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. + For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :vartype outbound_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundType + :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LoadBalancerSku + :ivar load_balancer_profile: Profile of the cluster load balancer. + :vartype load_balancer_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfile + :ivar nat_gateway_profile: Profile of the cluster NAT gateway. + :vartype nat_gateway_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNATGatewayProfile + :ivar pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each + IP family (IPv4/IPv6), is expected for dual-stack networking. + :vartype pod_cidrs: list[str] + :ivar service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with + any Subnet IP ranges. + :vartype service_cidrs: list[str] + :ivar ip_families: IP families are used to determine single-stack or dual-stack clusters. For + single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :vartype ip_families: list[str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IpFamily] + :ivar kube_proxy_config: Holds configuration customizations for kube-proxy. Any values not + defined will use the kube-proxy defaulting behavior. See + https://v:code:``.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + where :code:`` is represented by a :code:``-:code:`` + string. Kubernetes version 1.23 would be '1-23'. + :vartype kube_proxy_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfileKubeProxyConfig + :ivar monitoring: This addon can be used to configure network monitoring and generate network + monitoring data in Prometheus format. + :vartype monitoring: ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMonitoring + """ + + _validation = { + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + } + + _attribute_map = { + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "network_dataplane": {"key": "networkDataplane", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, + "kube_proxy_config": {"key": "kubeProxyConfig", "type": "ContainerServiceNetworkProfileKubeProxyConfig"}, + "monitoring": {"key": "monitoring", "type": "NetworkMonitoring"}, + } + + def __init__( + self, + *, + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + network_dataplane: Optional[Union[str, "_models.NetworkDataplane"]] = None, + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, + pod_cidrs: Optional[List[str]] = None, + service_cidrs: Optional[List[str]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, + kube_proxy_config: Optional["_models.ContainerServiceNetworkProfileKubeProxyConfig"] = None, + monitoring: Optional["_models.NetworkMonitoring"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :paramtype network_plugin: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPlugin + :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "overlay" + :paramtype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPluginMode + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "none", "calico", "azure", and "cilium". + :paramtype network_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPolicy + :keyword network_mode: This cannot be specified if networkPlugin is anything other than + 'azure'. Known values are: "transparent" and "bridge". + :paramtype network_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMode + :keyword network_dataplane: Network dataplane used in the Kubernetes cluster. Known values are: + "azure" and "cilium". + :paramtype network_dataplane: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkDataplane + :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :paramtype pod_cidr: str + :keyword service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It + must not overlap with any Subnet IP ranges. + :paramtype service_cidr: str + :keyword dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be + within the Kubernetes service address range specified in serviceCidr. + :paramtype dns_service_ip: str + :keyword outbound_type: This can only be set at cluster creation time and cannot be changed + later. For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :paramtype outbound_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundType + :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LoadBalancerSku + :keyword load_balancer_profile: Profile of the cluster load balancer. + :paramtype load_balancer_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfile + :keyword nat_gateway_profile: Profile of the cluster NAT gateway. + :paramtype nat_gateway_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNATGatewayProfile + :keyword pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. + :paramtype pod_cidrs: list[str] + :keyword service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one + for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap + with any Subnet IP ranges. + :paramtype service_cidrs: list[str] + :keyword ip_families: IP families are used to determine single-stack or dual-stack clusters. + For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :paramtype ip_families: list[str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IpFamily] + :keyword kube_proxy_config: Holds configuration customizations for kube-proxy. Any values not + defined will use the kube-proxy defaulting behavior. See + https://v:code:``.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + where :code:`` is represented by a :code:``-:code:`` + string. Kubernetes version 1.23 would be '1-23'. + :paramtype kube_proxy_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfileKubeProxyConfig + :keyword monitoring: This addon can be used to configure network monitoring and generate + network monitoring data in Prometheus format. + :paramtype monitoring: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMonitoring + """ + super().__init__(**kwargs) + self.network_plugin = network_plugin + self.network_plugin_mode = network_plugin_mode + self.network_policy = network_policy + self.network_mode = network_mode + self.network_dataplane = network_dataplane + self.pod_cidr = pod_cidr + self.service_cidr = service_cidr + self.dns_service_ip = dns_service_ip + self.outbound_type = outbound_type + self.load_balancer_sku = load_balancer_sku + self.load_balancer_profile = load_balancer_profile + self.nat_gateway_profile = nat_gateway_profile + self.pod_cidrs = pod_cidrs + self.service_cidrs = service_cidrs + self.ip_families = ip_families + self.kube_proxy_config = kube_proxy_config + self.monitoring = monitoring + + +class ContainerServiceNetworkProfileKubeProxyConfig(_serialization.Model): + """Holds configuration customizations for kube-proxy. Any values not defined will use the + kube-proxy defaulting behavior. See + https://v:code:``.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + where :code:`` is represented by a :code:``-:code:`` + string. Kubernetes version 1.23 would be '1-23'. + + :ivar enabled: Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, + kube-proxy is enabled in AKS by default without these customizations). + :vartype enabled: bool + :ivar mode: Specify which proxy mode to use ('IPTABLES' or 'IPVS'). Known values are: + "IPTABLES" and "IPVS". + :vartype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Mode + :ivar ipvs_config: Holds configuration customizations for IPVS. May only be specified if 'mode' + is set to 'IPVS'. + :vartype ipvs_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "mode": {"key": "mode", "type": "str"}, + "ipvs_config": {"key": "ipvsConfig", "type": "ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + mode: Optional[Union[str, "_models.Mode"]] = None, + ipvs_config: Optional["_models.ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' + exists, kube-proxy is enabled in AKS by default without these customizations). + :paramtype enabled: bool + :keyword mode: Specify which proxy mode to use ('IPTABLES' or 'IPVS'). Known values are: + "IPTABLES" and "IPVS". + :paramtype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Mode + :keyword ipvs_config: Holds configuration customizations for IPVS. May only be specified if + 'mode' is set to 'IPVS'. + :paramtype ipvs_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig + """ + super().__init__(**kwargs) + self.enabled = enabled + self.mode = mode + self.ipvs_config = ipvs_config + + +class ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig(_serialization.Model): + """Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. + + :ivar scheduler: IPVS scheduler, for more information please see + http://www.linuxvirtualserver.org/docs/scheduling.html. Known values are: "RoundRobin" and + "LeastConnection". + :vartype scheduler: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IpvsScheduler + :ivar tcp_timeout_seconds: The timeout value used for idle IPVS TCP sessions in seconds. Must + be a positive integer value. + :vartype tcp_timeout_seconds: int + :ivar tcp_fin_timeout_seconds: The timeout value used for IPVS TCP sessions after receiving a + FIN in seconds. Must be a positive integer value. + :vartype tcp_fin_timeout_seconds: int + :ivar udp_timeout_seconds: The timeout value used for IPVS UDP packets in seconds. Must be a + positive integer value. + :vartype udp_timeout_seconds: int + """ + + _attribute_map = { + "scheduler": {"key": "scheduler", "type": "str"}, + "tcp_timeout_seconds": {"key": "tcpTimeoutSeconds", "type": "int"}, + "tcp_fin_timeout_seconds": {"key": "tcpFinTimeoutSeconds", "type": "int"}, + "udp_timeout_seconds": {"key": "udpTimeoutSeconds", "type": "int"}, + } + + def __init__( + self, + *, + scheduler: Optional[Union[str, "_models.IpvsScheduler"]] = None, + tcp_timeout_seconds: Optional[int] = None, + tcp_fin_timeout_seconds: Optional[int] = None, + udp_timeout_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduler: IPVS scheduler, for more information please see + http://www.linuxvirtualserver.org/docs/scheduling.html. Known values are: "RoundRobin" and + "LeastConnection". + :paramtype scheduler: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IpvsScheduler + :keyword tcp_timeout_seconds: The timeout value used for idle IPVS TCP sessions in seconds. + Must be a positive integer value. + :paramtype tcp_timeout_seconds: int + :keyword tcp_fin_timeout_seconds: The timeout value used for IPVS TCP sessions after receiving + a FIN in seconds. Must be a positive integer value. + :paramtype tcp_fin_timeout_seconds: int + :keyword udp_timeout_seconds: The timeout value used for IPVS UDP packets in seconds. Must be a + positive integer value. + :paramtype udp_timeout_seconds: int + """ + super().__init__(**kwargs) + self.scheduler = scheduler + self.tcp_timeout_seconds = tcp_timeout_seconds + self.tcp_fin_timeout_seconds = tcp_fin_timeout_seconds + self.udp_timeout_seconds = udp_timeout_seconds + + +class ContainerServiceSshConfiguration(_serialization.Model): + """SSH configuration for Linux-based VMs running on Azure. + + All required parameters must be populated in order to send to Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :vartype public_keys: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceSshPublicKey] + """ + + _validation = { + "public_keys": {"required": True}, + } + + _attribute_map = { + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, + } + + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs: Any) -> None: + """ + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :paramtype public_keys: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceSshPublicKey] + """ + super().__init__(**kwargs) + self.public_keys = public_keys + + +class ContainerServiceSshPublicKey(_serialization.Model): + """Contains information about SSH certificate public key data. + + All required parameters must be populated in order to send to Azure. + + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :vartype key_data: str + """ + + _validation = { + "key_data": {"required": True}, + } + + _attribute_map = { + "key_data": {"key": "keyData", "type": "str"}, + } + + def __init__(self, *, key_data: str, **kwargs: Any) -> None: + """ + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :paramtype key_data: str + """ + super().__init__(**kwargs) + self.key_data = key_data + + +class CreationData(_serialization.Model): + """Data used when creating a target resource from a source resource. + + :ivar source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :vartype source_resource_id: str + """ + + _attribute_map = { + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + } + + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :paramtype source_resource_id: str + """ + super().__init__(**kwargs) + self.source_resource_id = source_resource_id + + +class CredentialResult(_serialization.Model): + """The credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class CredentialResults(_serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResult] + """ + + _validation = { + "kubeconfigs": {"readonly": True}, + } + + _attribute_map = { + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kubeconfigs = None + + +class DailySchedule(_serialization.Model): + """For schedules like: 'recur every day' or 'recur every 3 days'. + + All required parameters must be populated in order to send to Azure. + + :ivar interval_days: Specifies the number of days between each set of occurrences. Required. + :vartype interval_days: int + """ + + _validation = { + "interval_days": {"required": True, "maximum": 7, "minimum": 1}, + } + + _attribute_map = { + "interval_days": {"key": "intervalDays", "type": "int"}, + } + + def __init__(self, *, interval_days: int, **kwargs: Any) -> None: + """ + :keyword interval_days: Specifies the number of days between each set of occurrences. Required. + :paramtype interval_days: int + """ + super().__init__(**kwargs) + self.interval_days = interval_days + + +class DateSpan(_serialization.Model): + """For example, between '2022-12-23' and '2023-01-05'. + + All required parameters must be populated in order to send to Azure. + + :ivar start: The start date of the date span. Required. + :vartype start: ~datetime.date + :ivar end: The end date of the date span. Required. + :vartype end: ~datetime.date + """ + + _validation = { + "start": {"required": True}, + "end": {"required": True}, + } + + _attribute_map = { + "start": {"key": "start", "type": "date"}, + "end": {"key": "end", "type": "date"}, + } + + def __init__(self, *, start: datetime.date, end: datetime.date, **kwargs: Any) -> None: + """ + :keyword start: The start date of the date span. Required. + :paramtype start: ~datetime.date + :keyword end: The end date of the date span. Required. + :paramtype end: ~datetime.date + """ + super().__init__(**kwargs) + self.start = start + self.end = end + + +class DelegatedResource(_serialization.Model): + """Delegated resource properties - internal use only. + + :ivar resource_id: The ARM resource id of the delegated resource - internal use only. + :vartype resource_id: str + :ivar tenant_id: The tenant id of the delegated resource - internal use only. + :vartype tenant_id: str + :ivar referral_resource: The delegation id of the referral delegation (optional) - internal use + only. + :vartype referral_resource: str + :ivar location: The source resource location - internal use only. + :vartype location: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "referral_resource": {"key": "referralResource", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + tenant_id: Optional[str] = None, + referral_resource: Optional[str] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The ARM resource id of the delegated resource - internal use only. + :paramtype resource_id: str + :keyword tenant_id: The tenant id of the delegated resource - internal use only. + :paramtype tenant_id: str + :keyword referral_resource: The delegation id of the referral delegation (optional) - internal + use only. + :paramtype referral_resource: str + :keyword location: The source resource location - internal use only. + :paramtype location: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.tenant_id = tenant_id + self.referral_resource = referral_resource + self.location = location + + +class EndpointDependency(_serialization.Model): + """A domain name that AKS agent nodes are reaching at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports and Protocols used when connecting to domainName. + :vartype endpoint_details: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.EndpointDetail] + """ + + _attribute_map = { + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports and Protocols used when connecting to domainName. + :paramtype endpoint_details: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.EndpointDetail] + """ + super().__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(_serialization.Model): + """connect information from the AKS agent nodes to a single endpoint. + + :ivar ip_address: An IP Address that Domain Name currently resolves to. + :vartype ip_address: str + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar protocol: The protocol used for connection. + :vartype protocol: str + :ivar description: Description of the detail. + :vartype description: str + """ + + _attribute_map = { + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ip_address: An IP Address that Domain Name currently resolves to. + :paramtype ip_address: str + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword protocol: The protocol used for connection. + :paramtype protocol: str + :keyword description: Description of the detail. + :paramtype description: str + """ + super().__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.protocol = protocol + self.description = description + + +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.containerservice.v2023_11_02_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class GuardrailsAvailableVersion(Resource): + """Available Guardrails Version. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar properties: Whether the version is default or not and support info. Required. + :vartype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersionsProperties + """ + + _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": "GuardrailsAvailableVersionsProperties"}, + } + + def __init__(self, *, properties: "_models.GuardrailsAvailableVersionsProperties", **kwargs: Any) -> None: + """ + :keyword properties: Whether the version is default or not and support info. Required. + :paramtype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GuardrailsAvailableVersionsList(_serialization.Model): + """Hold values properties, which is array of GuardrailsVersions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of AKS supported Guardrails versions. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion] + :ivar next_link: The URL to get the next Guardrails available version. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[GuardrailsAvailableVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.GuardrailsAvailableVersion"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of AKS supported Guardrails versions. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class GuardrailsAvailableVersionsProperties(_serialization.Model): + """Whether the version is default or not and support info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_default_version: + :vartype is_default_version: bool + :ivar support: Whether the version is preview or stable. Known values are: "Preview" and + "Stable". + :vartype support: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsSupport + """ + + _validation = { + "is_default_version": {"readonly": True}, + "support": {"readonly": True}, + } + + _attribute_map = { + "is_default_version": {"key": "isDefaultVersion", "type": "bool"}, + "support": {"key": "support", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.is_default_version = None + self.support = None + + +class IPTag(_serialization.Model): + """Contains the IPTag associated with the object. + + :ivar ip_tag_type: The IP tag type. Example: RoutingPreference. + :vartype ip_tag_type: str + :ivar tag: The value of the IP tag associated with the public IP. Example: Internet. + :vartype tag: str + """ + + _attribute_map = { + "ip_tag_type": {"key": "ipTagType", "type": "str"}, + "tag": {"key": "tag", "type": "str"}, + } + + def __init__(self, *, ip_tag_type: Optional[str] = None, tag: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ip_tag_type: The IP tag type. Example: RoutingPreference. + :paramtype ip_tag_type: str + :keyword tag: The value of the IP tag associated with the public IP. Example: Internet. + :paramtype tag: str + """ + super().__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag + + +class IstioCertificateAuthority(_serialization.Model): + """Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin + certificates as described here https://aka.ms/asm-plugin-ca. + + :ivar plugin: Plugin certificates information for Service Mesh. + :vartype plugin: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioPluginCertificateAuthority + """ + + _attribute_map = { + "plugin": {"key": "plugin", "type": "IstioPluginCertificateAuthority"}, + } + + def __init__(self, *, plugin: Optional["_models.IstioPluginCertificateAuthority"] = None, **kwargs: Any) -> None: + """ + :keyword plugin: Plugin certificates information for Service Mesh. + :paramtype plugin: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioPluginCertificateAuthority + """ + super().__init__(**kwargs) + self.plugin = plugin + + +class IstioComponents(_serialization.Model): + """Istio components configuration. + + :ivar ingress_gateways: Istio ingress gateways. + :vartype ingress_gateways: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioIngressGateway] + :ivar egress_gateways: Istio egress gateways. + :vartype egress_gateways: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioEgressGateway] + """ + + _attribute_map = { + "ingress_gateways": {"key": "ingressGateways", "type": "[IstioIngressGateway]"}, + "egress_gateways": {"key": "egressGateways", "type": "[IstioEgressGateway]"}, + } + + def __init__( + self, + *, + ingress_gateways: Optional[List["_models.IstioIngressGateway"]] = None, + egress_gateways: Optional[List["_models.IstioEgressGateway"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword ingress_gateways: Istio ingress gateways. + :paramtype ingress_gateways: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioIngressGateway] + :keyword egress_gateways: Istio egress gateways. + :paramtype egress_gateways: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioEgressGateway] + """ + super().__init__(**kwargs) + self.ingress_gateways = ingress_gateways + self.egress_gateways = egress_gateways + + +class IstioEgressGateway(_serialization.Model): + """Istio egress gateway configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable the egress gateway. Required. + :vartype enabled: bool + :ivar node_selector: NodeSelector for scheduling the egress gateway. + :vartype node_selector: dict[str, str] + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "node_selector": {"key": "nodeSelector", "type": "{str}"}, + } + + def __init__(self, *, enabled: bool, node_selector: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable the egress gateway. Required. + :paramtype enabled: bool + :keyword node_selector: NodeSelector for scheduling the egress gateway. + :paramtype node_selector: dict[str, str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.node_selector = node_selector + + +class IstioIngressGateway(_serialization.Model): + """Istio ingress gateway configuration. For now, we support up to one external ingress gateway + named ``aks-istio-ingressgateway-external`` and one internal ingress gateway named + ``aks-istio-ingressgateway-internal``. + + All required parameters must be populated in order to send to Azure. + + :ivar mode: Mode of an ingress gateway. Required. Known values are: "External" and "Internal". + :vartype mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioIngressGatewayMode + :ivar enabled: Whether to enable the ingress gateway. Required. + :vartype enabled: bool + """ + + _validation = { + "mode": {"required": True}, + "enabled": {"required": True}, + } + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, mode: Union[str, "_models.IstioIngressGatewayMode"], enabled: bool, **kwargs: Any) -> None: + """ + :keyword mode: Mode of an ingress gateway. Required. Known values are: "External" and + "Internal". + :paramtype mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioIngressGatewayMode + :keyword enabled: Whether to enable the ingress gateway. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.mode = mode + self.enabled = enabled + + +class IstioPluginCertificateAuthority(_serialization.Model): + """Plugin certificates information for Service Mesh. + + :ivar key_vault_id: The resource ID of the Key Vault. + :vartype key_vault_id: str + :ivar cert_object_name: Intermediate certificate object name in Azure Key Vault. + :vartype cert_object_name: str + :ivar key_object_name: Intermediate certificate private key object name in Azure Key Vault. + :vartype key_object_name: str + :ivar root_cert_object_name: Root certificate object name in Azure Key Vault. + :vartype root_cert_object_name: str + :ivar cert_chain_object_name: Certificate chain object name in Azure Key Vault. + :vartype cert_chain_object_name: str + """ + + _attribute_map = { + "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "cert_object_name": {"key": "certObjectName", "type": "str"}, + "key_object_name": {"key": "keyObjectName", "type": "str"}, + "root_cert_object_name": {"key": "rootCertObjectName", "type": "str"}, + "cert_chain_object_name": {"key": "certChainObjectName", "type": "str"}, + } + + def __init__( + self, + *, + key_vault_id: Optional[str] = None, + cert_object_name: Optional[str] = None, + key_object_name: Optional[str] = None, + root_cert_object_name: Optional[str] = None, + cert_chain_object_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_vault_id: The resource ID of the Key Vault. + :paramtype key_vault_id: str + :keyword cert_object_name: Intermediate certificate object name in Azure Key Vault. + :paramtype cert_object_name: str + :keyword key_object_name: Intermediate certificate private key object name in Azure Key Vault. + :paramtype key_object_name: str + :keyword root_cert_object_name: Root certificate object name in Azure Key Vault. + :paramtype root_cert_object_name: str + :keyword cert_chain_object_name: Certificate chain object name in Azure Key Vault. + :paramtype cert_chain_object_name: str + """ + super().__init__(**kwargs) + self.key_vault_id = key_vault_id + self.cert_object_name = cert_object_name + self.key_object_name = key_object_name + self.root_cert_object_name = root_cert_object_name + self.cert_chain_object_name = cert_chain_object_name + + +class IstioServiceMesh(_serialization.Model): + """Istio service mesh configuration. + + :ivar components: Istio components configuration. + :vartype components: ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioComponents + :ivar certificate_authority: Istio Service Mesh Certificate Authority (CA) configuration. For + now, we only support plugin certificates as described here https://aka.ms/asm-plugin-ca. + :vartype certificate_authority: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioCertificateAuthority + :ivar revisions: The list of revisions of the Istio control plane. When an upgrade is not in + progress, this holds one value. When canary upgrade is in progress, this can only hold two + consecutive values. For more information, see: + https://learn.microsoft.com/en-us/azure/aks/istio-upgrade. + :vartype revisions: list[str] + """ + + _validation = { + "revisions": {"max_items": 2, "min_items": 0, "unique": True}, + } + + _attribute_map = { + "components": {"key": "components", "type": "IstioComponents"}, + "certificate_authority": {"key": "certificateAuthority", "type": "IstioCertificateAuthority"}, + "revisions": {"key": "revisions", "type": "[str]"}, + } + + def __init__( + self, + *, + components: Optional["_models.IstioComponents"] = None, + certificate_authority: Optional["_models.IstioCertificateAuthority"] = None, + revisions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword components: Istio components configuration. + :paramtype components: ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioComponents + :keyword certificate_authority: Istio Service Mesh Certificate Authority (CA) configuration. + For now, we only support plugin certificates as described here https://aka.ms/asm-plugin-ca. + :paramtype certificate_authority: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioCertificateAuthority + :keyword revisions: The list of revisions of the Istio control plane. When an upgrade is not in + progress, this holds one value. When canary upgrade is in progress, this can only hold two + consecutive values. For more information, see: + https://learn.microsoft.com/en-us/azure/aks/istio-upgrade. + :paramtype revisions: list[str] + """ + super().__init__(**kwargs) + self.components = components + self.certificate_authority = certificate_authority + self.revisions = revisions + + +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """See `AKS custom node configuration + `_ for more details. + + :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :vartype cpu_manager_policy: str + :ivar cpu_cfs_quota: The default is true. + :vartype cpu_cfs_quota: bool + :ivar cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :vartype cpu_cfs_quota_period: str + :ivar image_gc_high_threshold: To disable image garbage collection, set to 100. The default is + 85%. + :vartype image_gc_high_threshold: int + :ivar image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The default + is 80%. + :vartype image_gc_low_threshold: int + :ivar topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :vartype topology_manager_policy: str + :ivar allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns (ending + in ``*``\ ). + :vartype allowed_unsafe_sysctls: list[str] + :ivar fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled on + the node. + :vartype fail_swap_on: bool + :ivar container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before it + is rotated. + :vartype container_log_max_size_mb: int + :ivar container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :vartype container_log_max_files: int + :ivar pod_max_pids: The maximum number of processes per pod. + :vartype pod_max_pids: int + """ + + _validation = { + "container_log_max_files": {"minimum": 2}, + } + + _attribute_map = { + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, + } + + def __init__( + self, + *, + cpu_manager_policy: Optional[str] = None, + cpu_cfs_quota: Optional[bool] = None, + cpu_cfs_quota_period: Optional[str] = None, + image_gc_high_threshold: Optional[int] = None, + image_gc_low_threshold: Optional[int] = None, + topology_manager_policy: Optional[str] = None, + allowed_unsafe_sysctls: Optional[List[str]] = None, + fail_swap_on: Optional[bool] = None, + container_log_max_size_mb: Optional[int] = None, + container_log_max_files: Optional[int] = None, + pod_max_pids: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :paramtype cpu_manager_policy: str + :keyword cpu_cfs_quota: The default is true. + :paramtype cpu_cfs_quota: bool + :keyword cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :paramtype cpu_cfs_quota_period: str + :keyword image_gc_high_threshold: To disable image garbage collection, set to 100. The default + is 85%. + :paramtype image_gc_high_threshold: int + :keyword image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The + default is 80%. + :paramtype image_gc_low_threshold: int + :keyword topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :paramtype topology_manager_policy: str + :keyword allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns + (ending in ``*``\ ). + :paramtype allowed_unsafe_sysctls: list[str] + :keyword fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled + on the node. + :paramtype fail_swap_on: bool + :keyword container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before + it is rotated. + :paramtype container_log_max_size_mb: int + :keyword container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :paramtype container_log_max_files: int + :keyword pod_max_pids: The maximum number of processes per pod. + :paramtype pod_max_pids: int + """ + super().__init__(**kwargs) + self.cpu_manager_policy = cpu_manager_policy + self.cpu_cfs_quota = cpu_cfs_quota + self.cpu_cfs_quota_period = cpu_cfs_quota_period + self.image_gc_high_threshold = image_gc_high_threshold + self.image_gc_low_threshold = image_gc_low_threshold + self.topology_manager_policy = topology_manager_policy + self.allowed_unsafe_sysctls = allowed_unsafe_sysctls + self.fail_swap_on = fail_swap_on + self.container_log_max_size_mb = container_log_max_size_mb + self.container_log_max_files = container_log_max_files + self.pod_max_pids = pod_max_pids + + +class KubernetesPatchVersion(_serialization.Model): + """Kubernetes patch version profile. + + :ivar upgrades: Possible upgrade path for given patch version. + :vartype upgrades: list[str] + """ + + _attribute_map = { + "upgrades": {"key": "upgrades", "type": "[str]"}, + } + + def __init__(self, *, upgrades: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword upgrades: Possible upgrade path for given patch version. + :paramtype upgrades: list[str] + """ + super().__init__(**kwargs) + self.upgrades = upgrades + + +class KubernetesVersion(_serialization.Model): + """Kubernetes version profile for given major.minor release. + + :ivar version: major.minor version of Kubernetes release. + :vartype version: str + :ivar capabilities: Capabilities on this Kubernetes version. + :vartype capabilities: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersionCapabilities + :ivar is_preview: Whether this version is in preview mode. + :vartype is_preview: bool + :ivar patch_versions: Patch versions of Kubernetes release. + :vartype patch_versions: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesPatchVersion] + """ + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "capabilities": {"key": "capabilities", "type": "KubernetesVersionCapabilities"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "patch_versions": {"key": "patchVersions", "type": "{KubernetesPatchVersion}"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + capabilities: Optional["_models.KubernetesVersionCapabilities"] = None, + is_preview: Optional[bool] = None, + patch_versions: Optional[Dict[str, "_models.KubernetesPatchVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: major.minor version of Kubernetes release. + :paramtype version: str + :keyword capabilities: Capabilities on this Kubernetes version. + :paramtype capabilities: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersionCapabilities + :keyword is_preview: Whether this version is in preview mode. + :paramtype is_preview: bool + :keyword patch_versions: Patch versions of Kubernetes release. + :paramtype patch_versions: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesPatchVersion] + """ + super().__init__(**kwargs) + self.version = version + self.capabilities = capabilities + self.is_preview = is_preview + self.patch_versions = patch_versions + + +class KubernetesVersionCapabilities(_serialization.Model): + """Capabilities on this Kubernetes version. + + :ivar support_plan: + :vartype support_plan: list[str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesSupportPlan] + """ + + _attribute_map = { + "support_plan": {"key": "supportPlan", "type": "[str]"}, + } + + def __init__( + self, *, support_plan: Optional[List[Union[str, "_models.KubernetesSupportPlan"]]] = None, **kwargs: Any + ) -> None: + """ + :keyword support_plan: + :paramtype support_plan: list[str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesSupportPlan] + """ + super().__init__(**kwargs) + self.support_plan = support_plan + + +class KubernetesVersionListResult(_serialization.Model): + """Hold values properties, which is array of KubernetesVersion. + + :ivar values: Array of AKS supported Kubernetes versions. + :vartype values: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersion] + """ + + _attribute_map = { + "values": {"key": "values", "type": "[KubernetesVersion]"}, + } + + def __init__(self, *, values: Optional[List["_models.KubernetesVersion"]] = None, **kwargs: Any) -> None: + """ + :keyword values: Array of AKS supported Kubernetes versions. + :paramtype values: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersion] + """ + super().__init__(**kwargs) + self.values = values + + +class LinuxOSConfig(_serialization.Model): + """See `AKS custom node configuration + `_ for more details. + + :ivar sysctls: Sysctl settings for Linux agent nodes. + :vartype sysctls: ~azure.mgmt.containerservice.v2023_11_02_preview.models.SysctlConfig + :ivar transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :vartype transparent_huge_page_enabled: str + :ivar transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :vartype transparent_huge_page_defrag: str + :ivar swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :vartype swap_file_size_mb: int + """ + + _attribute_map = { + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, + } + + def __init__( + self, + *, + sysctls: Optional["_models.SysctlConfig"] = None, + transparent_huge_page_enabled: Optional[str] = None, + transparent_huge_page_defrag: Optional[str] = None, + swap_file_size_mb: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword sysctls: Sysctl settings for Linux agent nodes. + :paramtype sysctls: ~azure.mgmt.containerservice.v2023_11_02_preview.models.SysctlConfig + :keyword transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :paramtype transparent_huge_page_enabled: str + :keyword transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :paramtype transparent_huge_page_defrag: str + :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :paramtype swap_file_size_mb: int + """ + super().__init__(**kwargs) + self.sysctls = sysctls + self.transparent_huge_page_enabled = transparent_huge_page_enabled + self.transparent_huge_page_defrag = transparent_huge_page_defrag + self.swap_file_size_mb = swap_file_size_mb + + +class Machine(SubResource): + """A machine. Contains details about the underlying virtual machine. A machine may be visible here + but not in kubectl get nodes; if so it may be because the machine has not been registered with + the Kubernetes API Server yet. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar properties: The properties of the machine. + :vartype properties: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MachineProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "MachineProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + +class MachineIpAddress(_serialization.Model): + """The machine IP address details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ip: IPv4 or IPv6 address of the machine. + :vartype ip: str + :ivar family: To determine if address belongs IPv4 or IPv6 family. Known values are: "IPv4" and + "IPv6". + :vartype family: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.IpFamily + """ + + _validation = { + "ip": {"readonly": True}, + "family": {"readonly": True}, + } + + _attribute_map = { + "ip": {"key": "ip", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ip = None + self.family = None + + +class MachineListResult(_serialization.Model): + """The response from the List Machines operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Machines in cluster. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine] + :ivar next_link: The URL to get the next set of machine results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Machine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Machine"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of Machines in cluster. + :paramtype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MachineNetworkProperties(_serialization.Model): + """network properties of the machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ip_addresses: IPv4, IPv6 addresses of the machine. + :vartype ip_addresses: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MachineIpAddress] + """ + + _validation = { + "ip_addresses": {"readonly": True}, + } + + _attribute_map = { + "ip_addresses": {"key": "ipAddresses", "type": "[MachineIpAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ip_addresses = None + + +class MachineProperties(_serialization.Model): + """The properties of the machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network: network properties of the machine. + :vartype network: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MachineNetworkProperties + :ivar resource_id: Arm resource id of the machine. It can be used to GET underlying VM + Instance. + :vartype resource_id: str + """ + + _validation = { + "network": {"readonly": True}, + "resource_id": {"readonly": True}, + } + + _attribute_map = { + "network": {"key": "network", "type": "MachineNetworkProperties"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.network = None + self.resource_id = None + + +class MaintenanceConfiguration(SubResource): + """See `planned maintenance `_ for more + information about planned maintenance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.SystemData + :ivar time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :vartype time_in_week: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TimeInWeek] + :ivar not_allowed_time: Time slots on which upgrade is not allowed. + :vartype not_allowed_time: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TimeSpan] + :ivar maintenance_window: Maintenance window for the maintenance configuration. + :vartype maintenance_window: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceWindow + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, + "maintenance_window": {"key": "properties.maintenanceWindow", "type": "MaintenanceWindow"}, + } + + def __init__( + self, + *, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, + maintenance_window: Optional["_models.MaintenanceWindow"] = None, + **kwargs: Any + ) -> None: + """ + :keyword time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :paramtype time_in_week: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TimeInWeek] + :keyword not_allowed_time: Time slots on which upgrade is not allowed. + :paramtype not_allowed_time: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TimeSpan] + :keyword maintenance_window: Maintenance window for the maintenance configuration. + :paramtype maintenance_window: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceWindow + """ + super().__init__(**kwargs) + self.system_data = None + self.time_in_week = time_in_week + self.not_allowed_time = not_allowed_time + self.maintenance_window = maintenance_window + + +class MaintenanceConfigurationListResult(_serialization.Model): + """The response from the List maintenance configurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of maintenance configurations. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration] + :ivar next_link: The URL to get the next set of maintenance configuration results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of maintenance configurations. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MaintenanceWindow(_serialization.Model): + """Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar schedule: Recurrence schedule for the maintenance window. Required. + :vartype schedule: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Schedule + :ivar duration_hours: Length of maintenance window range from 4 to 24 hours. + :vartype duration_hours: int + :ivar utc_offset: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' + for PST. If not specified, the default is '+00:00'. + :vartype utc_offset: str + :ivar start_date: The date the maintenance window activates. If the current date is before this + date, the maintenance window is inactive and will not be used for upgrades. If not specified, + the maintenance window will be active right away. + :vartype start_date: ~datetime.date + :ivar start_time: The start time of the maintenance window. Accepted values are from '00:00' to + '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means + UTC time '00:00'. Required. + :vartype start_time: str + :ivar not_allowed_dates: Date ranges on which upgrade is not allowed. 'utcOffset' applies to + this field. For example, with 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to + '2023-01-03', maintenance will be blocked from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC + time. + :vartype not_allowed_dates: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.DateSpan] + """ + + _validation = { + "schedule": {"required": True}, + "duration_hours": {"required": True, "maximum": 24, "minimum": 4}, + "utc_offset": {"pattern": r"^(-|\+)[0-9]{2}:[0-9]{2}$"}, + "start_time": {"required": True, "pattern": r"^\d{2}:\d{2}$"}, + } + + _attribute_map = { + "schedule": {"key": "schedule", "type": "Schedule"}, + "duration_hours": {"key": "durationHours", "type": "int"}, + "utc_offset": {"key": "utcOffset", "type": "str"}, + "start_date": {"key": "startDate", "type": "date"}, + "start_time": {"key": "startTime", "type": "str"}, + "not_allowed_dates": {"key": "notAllowedDates", "type": "[DateSpan]"}, + } + + def __init__( + self, + *, + schedule: "_models.Schedule", + duration_hours: int = 24, + start_time: str, + utc_offset: Optional[str] = None, + start_date: Optional[datetime.date] = None, + not_allowed_dates: Optional[List["_models.DateSpan"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule: Recurrence schedule for the maintenance window. Required. + :paramtype schedule: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Schedule + :keyword duration_hours: Length of maintenance window range from 4 to 24 hours. + :paramtype duration_hours: int + :keyword utc_offset: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and + '-07:00' for PST. If not specified, the default is '+00:00'. + :paramtype utc_offset: str + :keyword start_date: The date the maintenance window activates. If the current date is before + this date, the maintenance window is inactive and will not be used for upgrades. If not + specified, the maintenance window will be active right away. + :paramtype start_date: ~datetime.date + :keyword start_time: The start time of the maintenance window. Accepted values are from '00:00' + to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' + means UTC time '00:00'. Required. + :paramtype start_time: str + :keyword not_allowed_dates: Date ranges on which upgrade is not allowed. 'utcOffset' applies to + this field. For example, with 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to + '2023-01-03', maintenance will be blocked from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC + time. + :paramtype not_allowed_dates: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.DateSpan] + """ + super().__init__(**kwargs) + self.schedule = schedule + self.duration_hours = duration_hours + self.utc_offset = utc_offset + self.start_date = start_date + self.start_time = start_time + self.not_allowed_dates = not_allowed_dates + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes + """Managed cluster. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.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 sku: The managed cluster SKU. + :vartype sku: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKU + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ExtendedLocation + :ivar identity: The identity of the managed cluster, if configured. + :vartype identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIdentity + :ivar provisioning_state: The current provisioning state. + :vartype provisioning_state: str + :ivar power_state: The Power State of the cluster. + :vartype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the cluster + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar max_agent_pools: The max number of agent pools for the managed cluster. + :vartype max_agent_pools: int + :ivar kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor versions + cannot be skipped. All upgrades must be performed sequentially by major version number. For + example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> + 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :vartype kubernetes_version: str + :ivar current_kubernetes_version: The version of Kubernetes the Managed Cluster is running. + :vartype current_kubernetes_version: str + :ivar dns_prefix: This cannot be updated once the Managed Cluster has been created. + :vartype dns_prefix: str + :ivar fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :vartype fqdn_subdomain: str + :ivar fqdn: The FQDN of the master pool. + :vartype fqdn: str + :ivar private_fqdn: The FQDN of private cluster. + :vartype private_fqdn: str + :ivar azure_portal_fqdn: The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) + headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. + This special FQDN supports CORS, allowing the Azure Portal to function properly. + :vartype azure_portal_fqdn: str + :ivar agent_pool_profiles: The agent pool properties. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAgentPoolProfile] + :ivar linux_profile: The profile for Linux VMs in the Managed Cluster. + :vartype linux_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceLinuxProfile + :ivar windows_profile: The profile for Windows VMs in the Managed Cluster. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWindowsProfile + :ivar service_principal_profile: Information about a service principal identity for the cluster + to use for manipulating Azure APIs. + :vartype service_principal_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + :ivar addon_profiles: The profile of managed cluster add-on. + :vartype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAddonProfile] + :ivar pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :vartype pod_identity_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProfile + :ivar oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :vartype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterOIDCIssuerProfile + :ivar node_resource_group: The name of the resource group containing agent pool nodes. + :vartype node_resource_group: str + :ivar node_resource_group_profile: The node resource group configuration profile. + :vartype node_resource_group_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNodeResourceGroupProfile + :ivar enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :vartype enable_rbac: bool + :ivar support_plan: The support plan for the Managed Cluster. If unspecified, the default is + 'KubernetesOfficial'. Known values are: "KubernetesOfficial" and "AKSLongTermSupport". + :vartype support_plan: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesSupportPlan + :ivar enable_pod_security_policy: (DEPRECATED) Whether to enable Kubernetes pod security policy + (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in + v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + :vartype enable_pod_security_policy: bool + :ivar enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updating of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :vartype enable_namespace_resources: bool + :ivar network_profile: The network configuration profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfile + :ivar aad_profile: The Azure Active Directory configuration. + :vartype aad_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile + :ivar auto_upgrade_profile: The auto upgrade configuration. + :vartype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAutoUpgradeProfile + :ivar upgrade_settings: Settings for upgrading a cluster. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ClusterUpgradeSettings + :ivar auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :vartype auto_scaler_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :ivar api_server_access_profile: The access profile for managed cluster API server. + :vartype api_server_access_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAPIServerAccessProfile + :ivar disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :vartype disk_encryption_set_id: str + :ivar identity_profile: Identities associated with the cluster. + :vartype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UserAssignedIdentity] + :ivar private_link_resources: Private link resources associated with the cluster. + :vartype private_link_resources: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource] + :ivar disable_local_accounts: If set to true, getting static credentials will be disabled for + this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details + see `disable local accounts + `_. + :vartype disable_local_accounts: bool + :ivar http_proxy_config: Configurations for provisioning the cluster with HTTP proxy servers. + :vartype http_proxy_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterHTTPProxyConfig + :ivar security_profile: Security profile for the managed cluster. + :vartype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfile + :ivar storage_profile: Storage profile for the managed cluster. + :vartype storage_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfile + :ivar ingress_profile: Ingress profile for the managed cluster. + :vartype ingress_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIngressProfile + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.PublicNetworkAccess + :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the managed cluster. + :vartype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + :ivar azure_monitor_profile: Prometheus addon profile for the container service cluster. + :vartype azure_monitor_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfile + :ivar safeguards_profile: The Safeguards profile holds all the safeguards information for a + given cluster. + :vartype safeguards_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsProfile + :ivar service_mesh_profile: Service mesh profile for a managed cluster. + :vartype service_mesh_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ServiceMeshProfile + :ivar resource_uid: The resourceUID uniquely identifies ManagedClusters that reuse ARM + ResourceIds (i.e: create, delete, create sequence). + :vartype resource_uid: str + :ivar metrics_profile: Optional cluster metrics configuration. + :vartype metrics_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterMetricsProfile + :ivar ai_toolchain_operator_profile: AI toolchain operator settings that apply to the whole + cluster. + :vartype ai_toolchain_operator_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAIToolchainOperatorProfile + :ivar node_provisioning_profile: Node provisioning settings that apply to the whole cluster. + :vartype node_provisioning_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNodeProvisioningProfile + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, + "resource_uid": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "node_resource_group_profile": { + "key": "properties.nodeResourceGroupProfile", + "type": "ManagedClusterNodeResourceGroupProfile", + }, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "support_plan": {"key": "properties.supportPlan", "type": "str"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "ClusterUpgradeSettings"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "workload_auto_scaler_profile": { + "key": "properties.workloadAutoScalerProfile", + "type": "ManagedClusterWorkloadAutoScalerProfile", + }, + "azure_monitor_profile": {"key": "properties.azureMonitorProfile", "type": "ManagedClusterAzureMonitorProfile"}, + "safeguards_profile": {"key": "properties.safeguardsProfile", "type": "SafeguardsProfile"}, + "service_mesh_profile": {"key": "properties.serviceMeshProfile", "type": "ServiceMeshProfile"}, + "resource_uid": {"key": "properties.resourceUID", "type": "str"}, + "metrics_profile": {"key": "properties.metricsProfile", "type": "ManagedClusterMetricsProfile"}, + "ai_toolchain_operator_profile": { + "key": "properties.aiToolchainOperatorProfile", + "type": "ManagedClusterAIToolchainOperatorProfile", + }, + "node_provisioning_profile": { + "key": "properties.nodeProvisioningProfile", + "type": "ManagedClusterNodeProvisioningProfile", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, + kubernetes_version: Optional[str] = None, + dns_prefix: Optional[str] = None, + fqdn_subdomain: Optional[str] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, + node_resource_group: Optional[str] = None, + node_resource_group_profile: Optional["_models.ManagedClusterNodeResourceGroupProfile"] = None, + enable_rbac: Optional[bool] = None, + support_plan: Optional[Union[str, "_models.KubernetesSupportPlan"]] = None, + enable_pod_security_policy: Optional[bool] = None, + enable_namespace_resources: Optional[bool] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + upgrade_settings: Optional["_models.ClusterUpgradeSettings"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, + disk_encryption_set_id: Optional[str] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, + disable_local_accounts: Optional[bool] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + workload_auto_scaler_profile: Optional["_models.ManagedClusterWorkloadAutoScalerProfile"] = None, + azure_monitor_profile: Optional["_models.ManagedClusterAzureMonitorProfile"] = None, + safeguards_profile: Optional["_models.SafeguardsProfile"] = None, + service_mesh_profile: Optional["_models.ServiceMeshProfile"] = None, + metrics_profile: Optional["_models.ManagedClusterMetricsProfile"] = None, + ai_toolchain_operator_profile: Optional["_models.ManagedClusterAIToolchainOperatorProfile"] = None, + node_provisioning_profile: Optional["_models.ManagedClusterNodeProvisioningProfile"] = 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 sku: The managed cluster SKU. + :paramtype sku: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKU + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ExtendedLocation + :keyword identity: The identity of the managed cluster, if configured. + :paramtype identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIdentity + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the + cluster will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor + versions cannot be skipped. All upgrades must be performed sequentially by major version + number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however + 1.14.x -> 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :paramtype kubernetes_version: str + :keyword dns_prefix: This cannot be updated once the Managed Cluster has been created. + :paramtype dns_prefix: str + :keyword fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :paramtype fqdn_subdomain: str + :keyword agent_pool_profiles: The agent pool properties. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAgentPoolProfile] + :keyword linux_profile: The profile for Linux VMs in the Managed Cluster. + :paramtype linux_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceLinuxProfile + :keyword windows_profile: The profile for Windows VMs in the Managed Cluster. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWindowsProfile + :keyword service_principal_profile: Information about a service principal identity for the + cluster to use for manipulating Azure APIs. + :paramtype service_principal_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword addon_profiles: The profile of managed cluster add-on. + :paramtype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAddonProfile] + :keyword pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :paramtype pod_identity_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProfile + :keyword oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :paramtype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterOIDCIssuerProfile + :keyword node_resource_group: The name of the resource group containing agent pool nodes. + :paramtype node_resource_group: str + :keyword node_resource_group_profile: The node resource group configuration profile. + :paramtype node_resource_group_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNodeResourceGroupProfile + :keyword enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :paramtype enable_rbac: bool + :keyword support_plan: The support plan for the Managed Cluster. If unspecified, the default is + 'KubernetesOfficial'. Known values are: "KubernetesOfficial" and "AKSLongTermSupport". + :paramtype support_plan: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesSupportPlan + :keyword enable_pod_security_policy: (DEPRECATED) Whether to enable Kubernetes pod security + policy (preview). PodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from + Kubernetes in v1.25. Learn more at https://aka.ms/k8s/psp and https://aka.ms/aks/psp. + :paramtype enable_pod_security_policy: bool + :keyword enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updating of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :paramtype enable_namespace_resources: bool + :keyword network_profile: The network configuration profile. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ContainerServiceNetworkProfile + :keyword aad_profile: The Azure Active Directory configuration. + :paramtype aad_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile + :keyword auto_upgrade_profile: The auto upgrade configuration. + :paramtype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAutoUpgradeProfile + :keyword upgrade_settings: Settings for upgrading a cluster. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ClusterUpgradeSettings + :keyword auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :paramtype auto_scaler_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :keyword api_server_access_profile: The access profile for managed cluster API server. + :paramtype api_server_access_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAPIServerAccessProfile + :keyword disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :paramtype disk_encryption_set_id: str + :keyword identity_profile: Identities associated with the cluster. + :paramtype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UserAssignedIdentity] + :keyword private_link_resources: Private link resources associated with the cluster. + :paramtype private_link_resources: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource] + :keyword disable_local_accounts: If set to true, getting static credentials will be disabled + for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more + details see `disable local accounts + `_. + :paramtype disable_local_accounts: bool + :keyword http_proxy_config: Configurations for provisioning the cluster with HTTP proxy + servers. + :paramtype http_proxy_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterHTTPProxyConfig + :keyword security_profile: Security profile for the managed cluster. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfile + :keyword storage_profile: Storage profile for the managed cluster. + :paramtype storage_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfile + :keyword ingress_profile: Ingress profile for the managed cluster. + :paramtype ingress_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIngressProfile + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :paramtype public_network_access: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.PublicNetworkAccess + :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the managed cluster. + :paramtype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + :keyword azure_monitor_profile: Prometheus addon profile for the container service cluster. + :paramtype azure_monitor_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfile + :keyword safeguards_profile: The Safeguards profile holds all the safeguards information for a + given cluster. + :paramtype safeguards_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsProfile + :keyword service_mesh_profile: Service mesh profile for a managed cluster. + :paramtype service_mesh_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ServiceMeshProfile + :keyword metrics_profile: Optional cluster metrics configuration. + :paramtype metrics_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterMetricsProfile + :keyword ai_toolchain_operator_profile: AI toolchain operator settings that apply to the whole + cluster. + :paramtype ai_toolchain_operator_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAIToolchainOperatorProfile + :keyword node_provisioning_profile: Node provisioning settings that apply to the whole cluster. + :paramtype node_provisioning_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterNodeProvisioningProfile + """ + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.extended_location = extended_location + self.identity = identity + self.provisioning_state = None + self.power_state = None + self.creation_data = creation_data + self.max_agent_pools = None + self.kubernetes_version = kubernetes_version + self.current_kubernetes_version = None + self.dns_prefix = dns_prefix + self.fqdn_subdomain = fqdn_subdomain + self.fqdn = None + self.private_fqdn = None + self.azure_portal_fqdn = None + self.agent_pool_profiles = agent_pool_profiles + self.linux_profile = linux_profile + self.windows_profile = windows_profile + self.service_principal_profile = service_principal_profile + self.addon_profiles = addon_profiles + self.pod_identity_profile = pod_identity_profile + self.oidc_issuer_profile = oidc_issuer_profile + self.node_resource_group = node_resource_group + self.node_resource_group_profile = node_resource_group_profile + self.enable_rbac = enable_rbac + self.support_plan = support_plan + self.enable_pod_security_policy = enable_pod_security_policy + self.enable_namespace_resources = enable_namespace_resources + self.network_profile = network_profile + self.aad_profile = aad_profile + self.auto_upgrade_profile = auto_upgrade_profile + self.upgrade_settings = upgrade_settings + self.auto_scaler_profile = auto_scaler_profile + self.api_server_access_profile = api_server_access_profile + self.disk_encryption_set_id = disk_encryption_set_id + self.identity_profile = identity_profile + self.private_link_resources = private_link_resources + self.disable_local_accounts = disable_local_accounts + self.http_proxy_config = http_proxy_config + self.security_profile = security_profile + self.storage_profile = storage_profile + self.ingress_profile = ingress_profile + self.public_network_access = public_network_access + self.workload_auto_scaler_profile = workload_auto_scaler_profile + self.azure_monitor_profile = azure_monitor_profile + self.safeguards_profile = safeguards_profile + self.service_mesh_profile = service_mesh_profile + self.resource_uid = None + self.metrics_profile = metrics_profile + self.ai_toolchain_operator_profile = ai_toolchain_operator_profile + self.node_provisioning_profile = node_provisioning_profile + + +class ManagedClusterAADProfile(_serialization.Model): + """For more details see `managed AAD on AKS `_. + + :ivar managed: Whether to enable managed AAD. + :vartype managed: bool + :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :vartype enable_azure_rbac: bool + :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :vartype admin_group_object_i_ds: list[str] + :ivar client_app_id: (DEPRECATED) The client AAD application ID. Learn more at + https://aka.ms/aks/aad-legacy. + :vartype client_app_id: str + :ivar server_app_id: (DEPRECATED) The server AAD application ID. Learn more at + https://aka.ms/aks/aad-legacy. + :vartype server_app_id: str + :ivar server_app_secret: (DEPRECATED) The server AAD application secret. Learn more at + https://aka.ms/aks/aad-legacy. + :vartype server_app_secret: str + :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :vartype tenant_id: str + """ + + _attribute_map = { + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, + } + + def __init__( + self, + *, + managed: Optional[bool] = None, + enable_azure_rbac: Optional[bool] = None, + admin_group_object_i_ds: Optional[List[str]] = None, + client_app_id: Optional[str] = None, + server_app_id: Optional[str] = None, + server_app_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword managed: Whether to enable managed AAD. + :paramtype managed: bool + :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :paramtype enable_azure_rbac: bool + :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :paramtype admin_group_object_i_ds: list[str] + :keyword client_app_id: (DEPRECATED) The client AAD application ID. Learn more at + https://aka.ms/aks/aad-legacy. + :paramtype client_app_id: str + :keyword server_app_id: (DEPRECATED) The server AAD application ID. Learn more at + https://aka.ms/aks/aad-legacy. + :paramtype server_app_id: str + :keyword server_app_secret: (DEPRECATED) The server AAD application secret. Learn more at + https://aka.ms/aks/aad-legacy. + :paramtype server_app_secret: str + :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.managed = managed + self.enable_azure_rbac = enable_azure_rbac + self.admin_group_object_i_ds = admin_group_object_i_ds + self.client_app_id = client_app_id + self.server_app_id = server_app_id + self.server_app_secret = server_app_secret + self.tenant_id = tenant_id + + +class ManagedClusterAccessProfile(TrackedResource): + """Managed cluster Access Profile. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.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 kube_config: Base64-encoded Kubernetes configuration file. + :vartype kube_config: bytes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kube_config: Optional[bytes] = 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 kube_config: Base64-encoded Kubernetes configuration file. + :paramtype kube_config: bytes + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kube_config = kube_config + + +class ManagedClusterAddonProfile(_serialization.Model): + """A Kubernetes add-on profile for a managed cluster. + + 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 enabled: Whether the add-on is enabled or not. Required. + :vartype enabled: bool + :ivar config: Key-value pairs for configuring an add-on. + :vartype config: dict[str, str] + :ivar identity: Information of user assigned identity used by this add-on. + :vartype identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAddonProfileIdentity + """ + + _validation = { + "enabled": {"required": True}, + "identity": {"readonly": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, + } + + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether the add-on is enabled or not. Required. + :paramtype enabled: bool + :keyword config: Key-value pairs for configuring an add-on. + :paramtype config: dict[str, str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.config = config + self.identity = None + + +class UserAssignedIdentity(_serialization.Model): + """Details about a user assigned identity. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.client_id = client_id + self.object_id = object_id + + +class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): + """Information of user assigned identity used by this add-on. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + + +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties for the container service agent pool profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet", and "VirtualMachines". + :vartype type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar node_initialization_taints: These taints will not be reconciled by AKS and can be removed + with a kubectl call. This field can be modified after node pool is created, but nodes will not + be recreated with new taints until another operation that requires recreation (e.g. node image + upgrade) happens. These taints allow for required configuration to run before the node is ready + to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with + ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :vartype node_initialization_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar windows_profile: The Windows agent pool's specific profile. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :ivar network_profile: Network-related settings of an agent pool. + :vartype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :ivar security_profile: The security settings of an agent pool. + :vartype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :ivar gpu_profile: The GPU settings of an agent pool. + :vartype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :ivar artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :vartype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :ivar virtual_machines_profile: Specifications on VirtualMachines agent pool. + :vartype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :ivar virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :vartype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + """ + + _validation = { + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "node_initialization_taints": {"key": "nodeInitializationTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "windows_profile": {"key": "windowsProfile", "type": "AgentPoolWindowsProfile"}, + "network_profile": {"key": "networkProfile", "type": "AgentPoolNetworkProfile"}, + "security_profile": {"key": "securityProfile", "type": "AgentPoolSecurityProfile"}, + "gpu_profile": {"key": "gpuProfile", "type": "AgentPoolGPUProfile"}, + "artifact_streaming_profile": {"key": "artifactStreamingProfile", "type": "AgentPoolArtifactStreamingProfile"}, + "virtual_machines_profile": {"key": "virtualMachinesProfile", "type": "VirtualMachinesProfile"}, + "virtual_machine_nodes_status": {"key": "virtualMachineNodesStatus", "type": "[VirtualMachineNodes]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + node_initialization_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + windows_profile: Optional["_models.AgentPoolWindowsProfile"] = None, + network_profile: Optional["_models.AgentPoolNetworkProfile"] = None, + security_profile: Optional["_models.AgentPoolSecurityProfile"] = None, + gpu_profile: Optional["_models.AgentPoolGPUProfile"] = None, + artifact_streaming_profile: Optional["_models.AgentPoolArtifactStreamingProfile"] = None, + virtual_machines_profile: Optional["_models.VirtualMachinesProfile"] = None, + virtual_machine_nodes_status: Optional[List["_models.VirtualMachineNodes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet", and "VirtualMachines". + :paramtype type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword node_initialization_taints: These taints will not be reconciled by AKS and can be + removed with a kubectl call. This field can be modified after node pool is created, but nodes + will not be recreated with new taints until another operation that requires recreation (e.g. + node image upgrade) happens. These taints allow for required configuration to run before the + node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be + removed with ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :paramtype node_initialization_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword windows_profile: The Windows agent pool's specific profile. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :keyword network_profile: Network-related settings of an agent pool. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :keyword security_profile: The security settings of an agent pool. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :keyword gpu_profile: The GPU settings of an agent pool. + :paramtype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :keyword artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :paramtype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :keyword virtual_machines_profile: Specifications on VirtualMachines agent pool. + :paramtype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :keyword virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :paramtype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type = type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.node_initialization_taints = node_initialization_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + self.windows_profile = windows_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.gpu_profile = gpu_profile + self.artifact_streaming_profile = artifact_streaming_profile + self.virtual_machines_profile = virtual_machines_profile + self.virtual_machine_nodes_status = virtual_machine_nodes_status + + +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes + """Profile for the container service agent pool. + + 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 count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet", and "VirtualMachines". + :vartype type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar node_initialization_taints: These taints will not be reconciled by AKS and can be removed + with a kubectl call. This field can be modified after node pool is created, but nodes will not + be recreated with new taints until another operation that requires recreation (e.g. node image + upgrade) happens. These taints allow for required configuration to run before the node is ready + to accept workloads, for example 'key1=value1:NoSchedule' that then can be removed with + ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :vartype node_initialization_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar windows_profile: The Windows agent pool's specific profile. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :ivar network_profile: Network-related settings of an agent pool. + :vartype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :ivar security_profile: The security settings of an agent pool. + :vartype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :ivar gpu_profile: The GPU settings of an agent pool. + :vartype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :ivar artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :vartype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :ivar virtual_machines_profile: Specifications on VirtualMachines agent pool. + :vartype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :ivar virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :vartype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + :ivar name: Windows agent pool names must be 6 characters or less. Required. + :vartype name: str + """ + + _validation = { + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "node_initialization_taints": {"key": "nodeInitializationTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "windows_profile": {"key": "windowsProfile", "type": "AgentPoolWindowsProfile"}, + "network_profile": {"key": "networkProfile", "type": "AgentPoolNetworkProfile"}, + "security_profile": {"key": "securityProfile", "type": "AgentPoolSecurityProfile"}, + "gpu_profile": {"key": "gpuProfile", "type": "AgentPoolGPUProfile"}, + "artifact_streaming_profile": {"key": "artifactStreamingProfile", "type": "AgentPoolArtifactStreamingProfile"}, + "virtual_machines_profile": {"key": "virtualMachinesProfile", "type": "VirtualMachinesProfile"}, + "virtual_machine_nodes_status": {"key": "virtualMachineNodesStatus", "type": "[VirtualMachineNodes]"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + name: str, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + node_initialization_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + windows_profile: Optional["_models.AgentPoolWindowsProfile"] = None, + network_profile: Optional["_models.AgentPoolNetworkProfile"] = None, + security_profile: Optional["_models.AgentPoolSecurityProfile"] = None, + gpu_profile: Optional["_models.AgentPoolGPUProfile"] = None, + artifact_streaming_profile: Optional["_models.AgentPoolArtifactStreamingProfile"] = None, + virtual_machines_profile: Optional["_models.VirtualMachinesProfile"] = None, + virtual_machine_nodes_status: Optional[List["_models.VirtualMachineNodes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi", and "KataMshvVmIsolation". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet", and "VirtualMachines". + :paramtype type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS adds a label to the node indicating that + the feature is enabled and deploys a daemonset along with host services to sync custom + certificate authorities from user-provided list of base64 encoded certificates into node trust + stores. Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword node_initialization_taints: These taints will not be reconciled by AKS and can be + removed with a kubectl call. This field can be modified after node pool is created, but nodes + will not be recreated with new taints until another operation that requires recreation (e.g. + node image upgrade) happens. These taints allow for required configuration to run before the + node is ready to accept workloads, for example 'key1=value1:NoSchedule' that then can be + removed with ``kubectl taint nodes node1 key1=value1:NoSchedule-``. + :paramtype node_initialization_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword windows_profile: The Windows agent pool's specific profile. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolWindowsProfile + :keyword network_profile: Network-related settings of an agent pool. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolNetworkProfile + :keyword security_profile: The security settings of an agent pool. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolSecurityProfile + :keyword gpu_profile: The GPU settings of an agent pool. + :paramtype gpu_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolGPUProfile + :keyword artifact_streaming_profile: Configuration for using artifact streaming on AKS. + :paramtype artifact_streaming_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolArtifactStreamingProfile + :keyword virtual_machines_profile: Specifications on VirtualMachines agent pool. + :paramtype virtual_machines_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachinesProfile + :keyword virtual_machine_nodes_status: The status of nodes in a VirtualMachines agent pool. + :paramtype virtual_machine_nodes_status: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.VirtualMachineNodes] + :keyword name: Windows agent pool names must be 6 characters or less. Required. + :paramtype name: str + """ + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + enable_custom_ca_trust=enable_custom_ca_trust, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + node_initialization_taints=node_initialization_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + windows_profile=windows_profile, + network_profile=network_profile, + security_profile=security_profile, + gpu_profile=gpu_profile, + artifact_streaming_profile=artifact_streaming_profile, + virtual_machines_profile=virtual_machines_profile, + virtual_machine_nodes_status=virtual_machine_nodes_status, + **kwargs + ) + self.name = name + + +class ManagedClusterAIToolchainOperatorProfile(_serialization.Model): + """When enabling the operator, a set of AKS managed CRDs and controllers will be installed in the + cluster. The operator automates the deployment of OSS models for inference and/or training + purposes. It provides a set of preset models and enables distributed inference against them. + + :ivar enabled: Indicates if AI toolchain operator enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Indicates if AI toolchain operator enabled or not. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterAPIServerAccessProfile(_serialization.Model): + """Access profile for managed cluster API server. + + :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :vartype authorized_ip_ranges: list[str] + :ivar enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :vartype enable_private_cluster: bool + :ivar private_dns_zone: The default is System. For more details see `configure private DNS zone + `_. Allowed + values are 'system' and 'none'. + :vartype private_dns_zone: str + :ivar enable_private_cluster_public_fqdn: Whether to create additional public FQDN for private + cluster or not. + :vartype enable_private_cluster_public_fqdn: bool + :ivar disable_run_command: Whether to disable run command for the cluster or not. + :vartype disable_run_command: bool + :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster or + not. + :vartype enable_vnet_integration: bool + :ivar subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an + existing cluster to enable apiserver vnet integration. + :vartype subnet_id: str + """ + + _attribute_map = { + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + } + + def __init__( + self, + *, + authorized_ip_ranges: Optional[List[str]] = None, + enable_private_cluster: Optional[bool] = None, + private_dns_zone: Optional[str] = None, + enable_private_cluster_public_fqdn: Optional[bool] = None, + disable_run_command: Optional[bool] = None, + enable_vnet_integration: Optional[bool] = None, + subnet_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :paramtype authorized_ip_ranges: list[str] + :keyword enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :paramtype enable_private_cluster: bool + :keyword private_dns_zone: The default is System. For more details see `configure private DNS + zone `_. + Allowed values are 'system' and 'none'. + :paramtype private_dns_zone: str + :keyword enable_private_cluster_public_fqdn: Whether to create additional public FQDN for + private cluster or not. + :paramtype enable_private_cluster_public_fqdn: bool + :keyword disable_run_command: Whether to disable run command for the cluster or not. + :paramtype disable_run_command: bool + :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster + or not. + :paramtype enable_vnet_integration: bool + :keyword subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating + an existing cluster to enable apiserver vnet integration. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) + self.authorized_ip_ranges = authorized_ip_ranges + self.enable_private_cluster = enable_private_cluster + self.private_dns_zone = private_dns_zone + self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn + self.disable_run_command = disable_run_command + self.enable_vnet_integration = enable_vnet_integration + self.subnet_id = subnet_id + + +class ManagedClusterAutoUpgradeProfile(_serialization.Model): + """Auto upgrade profile for a managed cluster. + + :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel + `_. Known values + are: "rapid", "stable", "patch", "node-image", and "none". + :vartype upgrade_channel: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UpgradeChannel + :ivar node_os_upgrade_channel: The default is Unmanaged, but may change to either NodeImage or + SecurityPatch at GA. Known values are: "None", "Unmanaged", "SecurityPatch", and "NodeImage". + :vartype node_os_upgrade_channel: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NodeOSUpgradeChannel + """ + + _attribute_map = { + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, + "node_os_upgrade_channel": {"key": "nodeOSUpgradeChannel", "type": "str"}, + } + + def __init__( + self, + *, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, + node_os_upgrade_channel: Optional[Union[str, "_models.NodeOSUpgradeChannel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade + channel `_. + Known values are: "rapid", "stable", "patch", "node-image", and "none". + :paramtype upgrade_channel: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UpgradeChannel + :keyword node_os_upgrade_channel: The default is Unmanaged, but may change to either NodeImage + or SecurityPatch at GA. Known values are: "None", "Unmanaged", "SecurityPatch", and + "NodeImage". + :paramtype node_os_upgrade_channel: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NodeOSUpgradeChannel + """ + super().__init__(**kwargs) + self.upgrade_channel = upgrade_channel + self.node_os_upgrade_channel = node_os_upgrade_channel + + +class ManagedClusterAzureMonitorProfile(_serialization.Model): + """Prometheus addon profile for the container service cluster. + + :ivar metrics: Metrics profile for the prometheus service addon. + :vartype metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileMetrics + :ivar logs: Logs profile for the Azure Monitor Infrastructure and Application Logs. Collect + out-of-the-box Kubernetes infrastructure & application logs to send to Azure Monitor. See + aka.ms/AzureMonitorContainerInsights for an overview. + :vartype logs: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileLogs + """ + + _attribute_map = { + "metrics": {"key": "metrics", "type": "ManagedClusterAzureMonitorProfileMetrics"}, + "logs": {"key": "logs", "type": "ManagedClusterAzureMonitorProfileLogs"}, + } + + def __init__( + self, + *, + metrics: Optional["_models.ManagedClusterAzureMonitorProfileMetrics"] = None, + logs: Optional["_models.ManagedClusterAzureMonitorProfileLogs"] = None, + **kwargs: Any + ) -> None: + """ + :keyword metrics: Metrics profile for the prometheus service addon. + :paramtype metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileMetrics + :keyword logs: Logs profile for the Azure Monitor Infrastructure and Application Logs. Collect + out-of-the-box Kubernetes infrastructure & application logs to send to Azure Monitor. See + aka.ms/AzureMonitorContainerInsights for an overview. + :paramtype logs: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileLogs + """ + super().__init__(**kwargs) + self.metrics = metrics + self.logs = logs + + +class ManagedClusterAzureMonitorProfileAppMonitoring(_serialization.Model): + """Application Monitoring Profile for Kubernetes Application Container. Collects application logs, + metrics and traces through auto-instrumentation of the application using Azure Monitor + OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + + :ivar enabled: Indicates if Application Monitoring enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Indicates if Application Monitoring enabled or not. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics(_serialization.Model): + """Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container + Metrics. Collects OpenTelemetry metrics through auto-instrumentation of the application using + Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an + overview. + + :ivar enabled: Indicates if Application Monitoring Open Telemetry Metrics is enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Indicates if Application Monitoring Open Telemetry Metrics is enabled or not. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterAzureMonitorProfileContainerInsights(_serialization.Model): + """Azure Monitor Container Insights Profile for Kubernetes Events, Inventory and Container stdout + & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. + + :ivar enabled: Indicates if Azure Monitor Container Insights Logs Addon is enabled or not. + :vartype enabled: bool + :ivar log_analytics_workspace_resource_id: Fully Qualified ARM Resource Id of Azure Log + Analytics Workspace for storing Azure Monitor Container Insights Logs. + :vartype log_analytics_workspace_resource_id: str + :ivar windows_host_logs: Windows Host Logs Profile for Kubernetes Windows Nodes Log Collection. + Collects ETW, Event Logs and Text logs etc. See aka.ms/AzureMonitorContainerInsights for an + overview. + :vartype windows_host_logs: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileWindowsHostLogs + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "windows_host_logs": {"key": "windowsHostLogs", "type": "ManagedClusterAzureMonitorProfileWindowsHostLogs"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + log_analytics_workspace_resource_id: Optional[str] = None, + windows_host_logs: Optional["_models.ManagedClusterAzureMonitorProfileWindowsHostLogs"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Indicates if Azure Monitor Container Insights Logs Addon is enabled or not. + :paramtype enabled: bool + :keyword log_analytics_workspace_resource_id: Fully Qualified ARM Resource Id of Azure Log + Analytics Workspace for storing Azure Monitor Container Insights Logs. + :paramtype log_analytics_workspace_resource_id: str + :keyword windows_host_logs: Windows Host Logs Profile for Kubernetes Windows Nodes Log + Collection. Collects ETW, Event Logs and Text logs etc. See + aka.ms/AzureMonitorContainerInsights for an overview. + :paramtype windows_host_logs: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileWindowsHostLogs + """ + super().__init__(**kwargs) + self.enabled = enabled + self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id + self.windows_host_logs = windows_host_logs + + +class ManagedClusterAzureMonitorProfileKubeStateMetrics(_serialization.Model): + """Kube State Metrics for prometheus addon profile for the container service cluster. + + :ivar metric_labels_allowlist: Comma-separated list of Kubernetes annotations keys that will be + used in the resource's labels metric. + :vartype metric_labels_allowlist: str + :ivar metric_annotations_allow_list: Comma-separated list of additional Kubernetes label keys + that will be used in the resource's labels metric. + :vartype metric_annotations_allow_list: str + """ + + _attribute_map = { + "metric_labels_allowlist": {"key": "metricLabelsAllowlist", "type": "str"}, + "metric_annotations_allow_list": {"key": "metricAnnotationsAllowList", "type": "str"}, + } + + def __init__( + self, + *, + metric_labels_allowlist: Optional[str] = None, + metric_annotations_allow_list: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword metric_labels_allowlist: Comma-separated list of Kubernetes annotations keys that will + be used in the resource's labels metric. + :paramtype metric_labels_allowlist: str + :keyword metric_annotations_allow_list: Comma-separated list of additional Kubernetes label + keys that will be used in the resource's labels metric. + :paramtype metric_annotations_allow_list: str + """ + super().__init__(**kwargs) + self.metric_labels_allowlist = metric_labels_allowlist + self.metric_annotations_allow_list = metric_annotations_allow_list + + +class ManagedClusterAzureMonitorProfileLogs(_serialization.Model): + """Logs profile for the Azure Monitor Infrastructure and Application Logs. Collect out-of-the-box + Kubernetes infrastructure & application logs to send to Azure Monitor. See + aka.ms/AzureMonitorContainerInsights for an overview. + + :ivar container_insights: Azure Monitor Container Insights Profile for Kubernetes Events, + Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for + an overview. + :vartype container_insights: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileContainerInsights + :ivar app_monitoring: Application Monitoring Profile for Kubernetes Application Container. + Collects application logs, metrics and traces through auto-instrumentation of the application + using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for + an overview. + :vartype app_monitoring: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileAppMonitoring + """ + + _attribute_map = { + "container_insights": { + "key": "containerInsights", + "type": "ManagedClusterAzureMonitorProfileContainerInsights", + }, + "app_monitoring": {"key": "appMonitoring", "type": "ManagedClusterAzureMonitorProfileAppMonitoring"}, + } + + def __init__( + self, + *, + container_insights: Optional["_models.ManagedClusterAzureMonitorProfileContainerInsights"] = None, + app_monitoring: Optional["_models.ManagedClusterAzureMonitorProfileAppMonitoring"] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_insights: Azure Monitor Container Insights Profile for Kubernetes Events, + Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for + an overview. + :paramtype container_insights: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileContainerInsights + :keyword app_monitoring: Application Monitoring Profile for Kubernetes Application Container. + Collects application logs, metrics and traces through auto-instrumentation of the application + using Azure Monitor OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for + an overview. + :paramtype app_monitoring: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileAppMonitoring + """ + super().__init__(**kwargs) + self.container_insights = container_insights + self.app_monitoring = app_monitoring + + +class ManagedClusterAzureMonitorProfileMetrics(_serialization.Model): + """Metrics profile for the prometheus service addon. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable the Prometheus collector. Required. + :vartype enabled: bool + :ivar kube_state_metrics: Kube State Metrics for prometheus addon profile for the container + service cluster. + :vartype kube_state_metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileKubeStateMetrics + :ivar app_monitoring_open_telemetry_metrics: Application Monitoring Open Telemetry Metrics + Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics through + auto-instrumentation of the application using Azure Monitor OpenTelemetry based SDKs. See + aka.ms/AzureMonitorApplicationMonitoring for an overview. + :vartype app_monitoring_open_telemetry_metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "kube_state_metrics": {"key": "kubeStateMetrics", "type": "ManagedClusterAzureMonitorProfileKubeStateMetrics"}, + "app_monitoring_open_telemetry_metrics": { + "key": "appMonitoringOpenTelemetryMetrics", + "type": "ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics", + }, + } + + def __init__( + self, + *, + enabled: bool, + kube_state_metrics: Optional["_models.ManagedClusterAzureMonitorProfileKubeStateMetrics"] = None, + app_monitoring_open_telemetry_metrics: Optional[ + "_models.ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether to enable the Prometheus collector. Required. + :paramtype enabled: bool + :keyword kube_state_metrics: Kube State Metrics for prometheus addon profile for the container + service cluster. + :paramtype kube_state_metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileKubeStateMetrics + :keyword app_monitoring_open_telemetry_metrics: Application Monitoring Open Telemetry Metrics + Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics through + auto-instrumentation of the application using Azure Monitor OpenTelemetry based SDKs. See + aka.ms/AzureMonitorApplicationMonitoring for an overview. + :paramtype app_monitoring_open_telemetry_metrics: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics + """ + super().__init__(**kwargs) + self.enabled = enabled + self.kube_state_metrics = kube_state_metrics + self.app_monitoring_open_telemetry_metrics = app_monitoring_open_telemetry_metrics + + +class ManagedClusterAzureMonitorProfileWindowsHostLogs(_serialization.Model): + """Windows Host Logs Profile for Kubernetes Windows Nodes Log Collection. Collects ETW, Event Logs + and Text logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. + + :ivar enabled: Indicates if Windows Host Log Collection is enabled or not for Azure Monitor + Container Insights Logs Addon. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Indicates if Windows Host Log Collection is enabled or not for Azure Monitor + Container Insights Logs Addon. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterCostAnalysis(_serialization.Model): + """The cost analysis configuration for the cluster. + + :ivar enabled: The Managed Cluster sku.tier must be set to 'Standard' to enable this feature. + Enabling this will add Kubernetes Namespace and Deployment details to the Cost Analysis views + in the Azure portal. If not specified, the default is false. For more information see + aka.ms/aks/docs/cost-analysis. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: The Managed Cluster sku.tier must be set to 'Standard' to enable this + feature. Enabling this will add Kubernetes Namespace and Deployment details to the Cost + Analysis views in the Azure portal. If not specified, the default is false. For more + information see aka.ms/aks/docs/cost-analysis. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterHTTPProxyConfig(_serialization.Model): + """Cluster HTTP proxy configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar http_proxy: The HTTP proxy server endpoint to use. + :vartype http_proxy: str + :ivar https_proxy: The HTTPS proxy server endpoint to use. + :vartype https_proxy: str + :ivar no_proxy: The endpoints that should not go through proxy. + :vartype no_proxy: list[str] + :ivar effective_no_proxy: A read-only list of all endpoints for which traffic should not be + sent to the proxy. This list is a superset of noProxy and values injected by AKS. + :vartype effective_no_proxy: list[str] + :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :vartype trusted_ca: str + """ + + _validation = { + "effective_no_proxy": {"readonly": True}, + } + + _attribute_map = { + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, + } + + def __init__( + self, + *, + http_proxy: Optional[str] = None, + https_proxy: Optional[str] = None, + no_proxy: Optional[List[str]] = None, + trusted_ca: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_proxy: The HTTP proxy server endpoint to use. + :paramtype http_proxy: str + :keyword https_proxy: The HTTPS proxy server endpoint to use. + :paramtype https_proxy: str + :keyword no_proxy: The endpoints that should not go through proxy. + :paramtype no_proxy: list[str] + :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :paramtype trusted_ca: str + """ + super().__init__(**kwargs) + self.http_proxy = http_proxy + self.https_proxy = https_proxy + self.no_proxy = no_proxy + self.effective_no_proxy = None + self.trusted_ca = trusted_ca + + +class ManagedClusterIdentity(_serialization.Model): + """Identity for the managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity which is used by master + components. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity which is used by master + components. + :vartype tenant_id: str + :ivar type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :vartype type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceIdentityType + :ivar delegated_resources: The delegated identity resources assigned to this managed cluster. + This can only be set by another Azure Resource Provider, and managed cluster only accept one + delegated identity resource. Internal use only. + :vartype delegated_resources: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.DelegatedResource] + :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "delegated_resources": {"key": "delegatedResources", "type": "{DelegatedResource}"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + delegated_resources: Optional[Dict[str, "_models.DelegatedResource"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :paramtype type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceIdentityType + :keyword delegated_resources: The delegated identity resources assigned to this managed + cluster. This can only be set by another Azure Resource Provider, and managed cluster only + accept one delegated identity resource. Internal use only. + :paramtype delegated_resources: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.DelegatedResource] + :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.delegated_resources = delegated_resources + self.user_assigned_identities = user_assigned_identities + + +class ManagedClusterIngressProfile(_serialization.Model): + """Ingress profile for the container service cluster. + + :ivar web_app_routing: Web App Routing settings for the ingress profile. + :vartype web_app_routing: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + + _attribute_map = { + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, + } + + def __init__( + self, *, web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs: Any + ) -> None: + """ + :keyword web_app_routing: Web App Routing settings for the ingress profile. + :paramtype web_app_routing: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + super().__init__(**kwargs) + self.web_app_routing = web_app_routing + + +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): + """Web App Routing settings for the ingress profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: Whether to enable Web App Routing. + :vartype enabled: bool + :ivar dns_zone_resource_ids: Resource IDs of the DNS zones to be associated with the Web App + Routing add-on. Used only when Web App Routing is enabled. Public and private DNS zones can be + in different resource groups, but all public DNS zones must be in the same resource group and + all private DNS zones must be in the same resource group. + :vartype dns_zone_resource_ids: list[str] + :ivar identity: Managed identity of the Web Application Routing add-on. This is the identity + that should be granted permissions, for example, to manage the associated Azure DNS resource + and get certificates from Azure Key Vault. See `this overview of the add-on + `_ for more + instructions. + :vartype identity: ~azure.mgmt.containerservice.v2023_11_02_preview.models.UserAssignedIdentity + """ + + _validation = { + "dns_zone_resource_ids": {"max_items": 5, "min_items": 0}, + "identity": {"readonly": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_ids": {"key": "dnsZoneResourceIds", "type": "[str]"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + } + + def __init__( + self, *, enabled: Optional[bool] = None, dns_zone_resource_ids: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether to enable Web App Routing. + :paramtype enabled: bool + :keyword dns_zone_resource_ids: Resource IDs of the DNS zones to be associated with the Web App + Routing add-on. Used only when Web App Routing is enabled. Public and private DNS zones can be + in different resource groups, but all public DNS zones must be in the same resource group and + all private DNS zones must be in the same resource group. + :paramtype dns_zone_resource_ids: list[str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.dns_zone_resource_ids = dns_zone_resource_ids + self.identity = None + + +class ManagedClusterListResult(_serialization.Model): + """The response from the List Managed Clusters operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed clusters. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :ivar next_link: The URL to get the next set of managed cluster results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of managed clusters. + :paramtype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterLoadBalancerProfile(_serialization.Model): + """Profile of the managed cluster load balancer. + + :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :vartype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :ivar outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load balancer. + :vartype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :ivar outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :vartype outbound_i_ps: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :vartype allocated_outbound_ports: int + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :vartype idle_timeout_in_minutes: int + :ivar enable_multiple_standard_load_balancers: Enable multiple standard load balancers per AKS + cluster or not. + :vartype enable_multiple_standard_load_balancers: bool + :ivar backend_pool_type: The type of the managed inbound Load Balancer BackendPool. Known + values are: "NodeIPConfiguration" and "NodeIP". + :vartype backend_pool_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.BackendPoolType + """ + + _validation = { + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, + } + + _attribute_map = { + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, + "backend_pool_type": {"key": "backendPoolType", "type": "str"}, + } + + def __init__( + self, + *, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, + enable_multiple_standard_load_balancers: Optional[bool] = None, + backend_pool_type: Union[str, "_models.BackendPoolType"] = "NodeIPConfiguration", + **kwargs: Any + ) -> None: + """ + :keyword managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :paramtype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :keyword outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :keyword outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :paramtype outbound_i_ps: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :paramtype allocated_outbound_ports: int + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :paramtype idle_timeout_in_minutes: int + :keyword enable_multiple_standard_load_balancers: Enable multiple standard load balancers per + AKS cluster or not. + :paramtype enable_multiple_standard_load_balancers: bool + :keyword backend_pool_type: The type of the managed inbound Load Balancer BackendPool. Known + values are: "NodeIPConfiguration" and "NodeIP". + :paramtype backend_pool_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.BackendPoolType + """ + super().__init__(**kwargs) + self.managed_outbound_i_ps = managed_outbound_i_ps + self.outbound_ip_prefixes = outbound_ip_prefixes + self.outbound_i_ps = outbound_i_ps + self.effective_outbound_i_ps = effective_outbound_i_ps + self.allocated_outbound_ports = allocated_outbound_ports + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers + self.backend_pool_type = backend_pool_type + + +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): + """Desired managed outbound IPs for the cluster load balancer. + + :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster + load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value + is 1. + :vartype count: int + :ivar count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :vartype count_ipv6: int + """ + + _validation = { + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, + } + + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs: Any) -> None: + """ + :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 1. + :paramtype count: int + :keyword count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :paramtype count_ipv6: int + """ + super().__init__(**kwargs) + self.count = count + self.count_ipv6 = count_ipv6 + + +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): + """Desired outbound IP Prefix resources for the cluster load balancer. + + :ivar public_ip_prefixes: A list of public IP prefix resources. + :vartype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + """ + + _attribute_map = { + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, + } + + def __init__( + self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs: Any + ) -> None: + """ + :keyword public_ip_prefixes: A list of public IP prefix resources. + :paramtype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_ip_prefixes = public_ip_prefixes + + +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): + """Desired outbound IP resources for the cluster load balancer. + + :ivar public_i_ps: A list of public IP resources. + :vartype public_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + """ + + _attribute_map = { + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, + } + + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs: Any) -> None: + """ + :keyword public_i_ps: A list of public IP resources. + :paramtype public_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_i_ps = public_i_ps + + +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): + """Profile of the managed outbound IP resources of the managed cluster. + + :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must + be in the range of 1 to 16 (inclusive). The default value is 1. + :vartype count: int + """ + + _validation = { + "count": {"maximum": 16, "minimum": 1}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, *, count: int = 1, **kwargs: Any) -> None: + """ + :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values + must be in the range of 1 to 16 (inclusive). The default value is 1. + :paramtype count: int + """ + super().__init__(**kwargs) + self.count = count + + +class ManagedClusterMetricsProfile(_serialization.Model): + """The metrics profile for the ManagedCluster. + + :ivar cost_analysis: The cost analysis configuration for the cluster. + :vartype cost_analysis: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterCostAnalysis + """ + + _attribute_map = { + "cost_analysis": {"key": "costAnalysis", "type": "ManagedClusterCostAnalysis"}, + } + + def __init__(self, *, cost_analysis: Optional["_models.ManagedClusterCostAnalysis"] = None, **kwargs: Any) -> None: + """ + :keyword cost_analysis: The cost analysis configuration for the cluster. + :paramtype cost_analysis: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterCostAnalysis + """ + super().__init__(**kwargs) + self.cost_analysis = cost_analysis + + +class ManagedClusterNATGatewayProfile(_serialization.Model): + """Profile of the managed cluster NAT gateway. + + :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster + NAT gateway. + :vartype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterManagedOutboundIPProfile + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT gateway. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :vartype idle_timeout_in_minutes: int + """ + + _validation = { + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, + } + + _attribute_map = { + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + } + + def __init__( + self, + *, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + idle_timeout_in_minutes: int = 4, + **kwargs: Any + ) -> None: + """ + :keyword managed_outbound_ip_profile: Profile of the managed outbound IP resources of the + cluster NAT gateway. + :paramtype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterManagedOutboundIPProfile + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT + gateway. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ResourceReference] + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :paramtype idle_timeout_in_minutes: int + """ + super().__init__(**kwargs) + self.managed_outbound_ip_profile = managed_outbound_ip_profile + self.effective_outbound_i_ps = effective_outbound_i_ps + self.idle_timeout_in_minutes = idle_timeout_in_minutes + + +class ManagedClusterNodeProvisioningProfile(_serialization.Model): + """ManagedClusterNodeProvisioningProfile. + + :ivar mode: Once the mode it set to Auto, it cannot be changed back to Manual. Known values + are: "Manual" and "Auto". + :vartype mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NodeProvisioningMode + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + } + + def __init__(self, *, mode: Optional[Union[str, "_models.NodeProvisioningMode"]] = None, **kwargs: Any) -> None: + """ + :keyword mode: Once the mode it set to Auto, it cannot be changed back to Manual. Known values + are: "Manual" and "Auto". + :paramtype mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NodeProvisioningMode + """ + super().__init__(**kwargs) + self.mode = mode + + +class ManagedClusterNodeResourceGroupProfile(_serialization.Model): + """Node resource group lockdown profile for a managed cluster. + + :ivar restriction_level: The restriction level applied to the cluster's node resource group. + Known values are: "Unrestricted" and "ReadOnly". + :vartype restriction_level: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RestrictionLevel + """ + + _attribute_map = { + "restriction_level": {"key": "restrictionLevel", "type": "str"}, + } + + def __init__( + self, *, restriction_level: Optional[Union[str, "_models.RestrictionLevel"]] = None, **kwargs: Any + ) -> None: + """ + :keyword restriction_level: The restriction level applied to the cluster's node resource group. + Known values are: "Unrestricted" and "ReadOnly". + :paramtype restriction_level: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RestrictionLevel + """ + super().__init__(**kwargs) + self.restriction_level = restriction_level + + +class ManagedClusterOIDCIssuerProfile(_serialization.Model): + """The OIDC issuer profile of the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issuer_url: The OIDC issuer url of the Managed Cluster. + :vartype issuer_url: str + :ivar enabled: Whether the OIDC issuer is enabled. + :vartype enabled: bool + """ + + _validation = { + "issuer_url": {"readonly": True}, + } + + _attribute_map = { + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether the OIDC issuer is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.issuer_url = None + self.enabled = enabled + + +class ManagedClusterPodIdentity(_serialization.Model): + """Details about the pod identity assigned to the Managed Cluster. + + 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 name: The name of the pod identity. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity. Required. + :vartype namespace: str + :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :vartype binding_selector: str + :ivar identity: The user assigned identity details. Required. + :vartype identity: ~azure.mgmt.containerservice.v2023_11_02_preview.models.UserAssignedIdentity + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Canceled", "Deleting", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningState + :ivar provisioning_info: + :vartype provisioning_info: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningInfo + """ + + _validation = { + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + identity: "_models.UserAssignedIdentity", + binding_selector: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the pod identity. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity. Required. + :paramtype namespace: str + :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :paramtype binding_selector: str + :keyword identity: The user assigned identity details. Required. + :paramtype identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.UserAssignedIdentity + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.binding_selector = binding_selector + self.identity = identity + self.provisioning_state = None + self.provisioning_info = None + + +class ManagedClusterPodIdentityException(_serialization.Model): + """See `disable AAD Pod Identity for a specific Pod/Application + `_ for more + details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the pod identity exception. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity exception. Required. + :vartype namespace: str + :ivar pod_labels: The pod labels to match. Required. + :vartype pod_labels: dict[str, str] + """ + + _validation = { + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, + } + + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs: Any) -> None: + """ + :keyword name: The name of the pod identity exception. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity exception. Required. + :paramtype namespace: str + :keyword pod_labels: The pod labels to match. Required. + :paramtype pod_labels: dict[str, str] + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.pod_labels = pod_labels + + +class ManagedClusterPodIdentityProfile(_serialization.Model): + """See `use AAD pod identity `_ + for more details on pod identity integration. + + :ivar enabled: Whether the pod identity addon is enabled. + :vartype enabled: bool + :ivar allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :vartype allow_network_plugin_kubenet: bool + :ivar user_assigned_identities: The pod identities to use in the cluster. + :vartype user_assigned_identities: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentity] + :ivar user_assigned_identity_exceptions: The pod identity exceptions to allow. + :vartype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityException] + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + allow_network_plugin_kubenet: Optional[bool] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether the pod identity addon is enabled. + :paramtype enabled: bool + :keyword allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :paramtype allow_network_plugin_kubenet: bool + :keyword user_assigned_identities: The pod identities to use in the cluster. + :paramtype user_assigned_identities: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentity] + :keyword user_assigned_identity_exceptions: The pod identity exceptions to allow. + :paramtype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityException] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.allow_network_plugin_kubenet = allow_network_plugin_kubenet + self.user_assigned_identities = user_assigned_identities + self.user_assigned_identity_exceptions = user_assigned_identity_exceptions + + +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar error: Details about the error. + :vartype error: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, + } + + def __init__( + self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs: Any + ) -> None: + """ + :keyword error: Details about the error. + :paramtype error: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): + """ManagedClusterPodIdentityProvisioningInfo. + + :ivar error: Pod identity assignment error (if any). + :vartype error: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, + } + + def __init__( + self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs: Any + ) -> None: + """ + :keyword error: Pod identity assignment error (if any). + :paramtype error: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPoolUpgradeProfile(_serialization.Model): + """The list of available upgrade versions. + + All required parameters must be populated in order to send to Azure. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar name: The Agent Pool name. + :vartype name: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + + _validation = { + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, + } + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + name: Optional[str] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword name: The Agent Pool name. + :paramtype name: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.name = name + self.os_type = os_type + self.upgrades = upgrades + + +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): + """ManagedClusterPoolUpgradeProfileUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs: Any + ) -> None: + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Parameters to be applied to the cluster-autoscaler when enabled. + + :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. + :vartype balance_similar_node_groups: str + :ivar daemonset_eviction_for_empty_nodes: If set to true, all daemonset pods on empty nodes + will be evicted before deletion of the node. If the daemonset pod cannot be evicted another + node will be chosen for scaling. If set to false, the node will be deleted without ensuring + that daemonset pods are deleted or evicted. + :vartype daemonset_eviction_for_empty_nodes: bool + :ivar daemonset_eviction_for_occupied_nodes: If set to true, all daemonset pods on occupied + nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted + another node will be chosen for scaling. If set to false, the node will be deleted without + ensuring that daemonset pods are deleted or evicted. + :vartype daemonset_eviction_for_occupied_nodes: bool + :ivar ignore_daemonsets_utilization: If set to true, the resources used by daemonset will be + taken into account when making scaling down decisions. + :vartype ignore_daemonsets_utilization: bool + :ivar expander: Available values are: 'least-waste', 'most-pods', 'priority', 'random'. Known + values are: "least-waste", "most-pods", "priority", and "random". + :vartype expander: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Expander + :ivar max_empty_bulk_delete: The default is 10. + :vartype max_empty_bulk_delete: str + :ivar max_graceful_termination_sec: The default is 600. + :vartype max_graceful_termination_sec: str + :ivar max_node_provision_time: The default is '15m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype max_node_provision_time: str + :ivar max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is 0. + :vartype max_total_unready_percentage: str + :ivar new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA to + act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :vartype new_pod_scale_up_delay: str + :ivar ok_total_unready_count: This must be an integer. The default is 3. + :vartype ok_total_unready_count: str + :ivar scan_interval: The default is '10'. Values must be an integer number of seconds. + :vartype scan_interval: str + :ivar scale_down_delay_after_add: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_add: str + :ivar scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_delete: str + :ivar scale_down_delay_after_failure: The default is '3m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_failure: str + :ivar scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unneeded_time: str + :ivar scale_down_unready_time: The default is '20m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unready_time: str + :ivar scale_down_utilization_threshold: The default is '0.5'. + :vartype scale_down_utilization_threshold: str + :ivar skip_nodes_with_local_storage: The default is true. + :vartype skip_nodes_with_local_storage: str + :ivar skip_nodes_with_system_pods: The default is true. + :vartype skip_nodes_with_system_pods: str + """ + + _attribute_map = { + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "daemonset_eviction_for_empty_nodes": {"key": "daemonset-eviction-for-empty-nodes", "type": "bool"}, + "daemonset_eviction_for_occupied_nodes": {"key": "daemonset-eviction-for-occupied-nodes", "type": "bool"}, + "ignore_daemonsets_utilization": {"key": "ignore-daemonsets-utilization", "type": "bool"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, + } + + def __init__( + self, + *, + balance_similar_node_groups: Optional[str] = None, + daemonset_eviction_for_empty_nodes: Optional[bool] = None, + daemonset_eviction_for_occupied_nodes: Optional[bool] = None, + ignore_daemonsets_utilization: Optional[bool] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, + max_empty_bulk_delete: Optional[str] = None, + max_graceful_termination_sec: Optional[str] = None, + max_node_provision_time: Optional[str] = None, + max_total_unready_percentage: Optional[str] = None, + new_pod_scale_up_delay: Optional[str] = None, + ok_total_unready_count: Optional[str] = None, + scan_interval: Optional[str] = None, + scale_down_delay_after_add: Optional[str] = None, + scale_down_delay_after_delete: Optional[str] = None, + scale_down_delay_after_failure: Optional[str] = None, + scale_down_unneeded_time: Optional[str] = None, + scale_down_unready_time: Optional[str] = None, + scale_down_utilization_threshold: Optional[str] = None, + skip_nodes_with_local_storage: Optional[str] = None, + skip_nodes_with_system_pods: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword balance_similar_node_groups: Valid values are 'true' and 'false'. + :paramtype balance_similar_node_groups: str + :keyword daemonset_eviction_for_empty_nodes: If set to true, all daemonset pods on empty nodes + will be evicted before deletion of the node. If the daemonset pod cannot be evicted another + node will be chosen for scaling. If set to false, the node will be deleted without ensuring + that daemonset pods are deleted or evicted. + :paramtype daemonset_eviction_for_empty_nodes: bool + :keyword daemonset_eviction_for_occupied_nodes: If set to true, all daemonset pods on occupied + nodes will be evicted before deletion of the node. If the daemonset pod cannot be evicted + another node will be chosen for scaling. If set to false, the node will be deleted without + ensuring that daemonset pods are deleted or evicted. + :paramtype daemonset_eviction_for_occupied_nodes: bool + :keyword ignore_daemonsets_utilization: If set to true, the resources used by daemonset will be + taken into account when making scaling down decisions. + :paramtype ignore_daemonsets_utilization: bool + :keyword expander: Available values are: 'least-waste', 'most-pods', 'priority', 'random'. + Known values are: "least-waste", "most-pods", "priority", and "random". + :paramtype expander: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Expander + :keyword max_empty_bulk_delete: The default is 10. + :paramtype max_empty_bulk_delete: str + :keyword max_graceful_termination_sec: The default is 600. + :paramtype max_graceful_termination_sec: str + :keyword max_node_provision_time: The default is '15m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype max_node_provision_time: str + :keyword max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is + 0. + :paramtype max_total_unready_percentage: str + :keyword new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA + to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :paramtype new_pod_scale_up_delay: str + :keyword ok_total_unready_count: This must be an integer. The default is 3. + :paramtype ok_total_unready_count: str + :keyword scan_interval: The default is '10'. Values must be an integer number of seconds. + :paramtype scan_interval: str + :keyword scale_down_delay_after_add: The default is '10m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_add: str + :keyword scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_delete: str + :keyword scale_down_delay_after_failure: The default is '3m'. Values must be an integer + followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_failure: str + :keyword scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unneeded_time: str + :keyword scale_down_unready_time: The default is '20m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unready_time: str + :keyword scale_down_utilization_threshold: The default is '0.5'. + :paramtype scale_down_utilization_threshold: str + :keyword skip_nodes_with_local_storage: The default is true. + :paramtype skip_nodes_with_local_storage: str + :keyword skip_nodes_with_system_pods: The default is true. + :paramtype skip_nodes_with_system_pods: str + """ + super().__init__(**kwargs) + self.balance_similar_node_groups = balance_similar_node_groups + self.daemonset_eviction_for_empty_nodes = daemonset_eviction_for_empty_nodes + self.daemonset_eviction_for_occupied_nodes = daemonset_eviction_for_occupied_nodes + self.ignore_daemonsets_utilization = ignore_daemonsets_utilization + self.expander = expander + self.max_empty_bulk_delete = max_empty_bulk_delete + self.max_graceful_termination_sec = max_graceful_termination_sec + self.max_node_provision_time = max_node_provision_time + self.max_total_unready_percentage = max_total_unready_percentage + self.new_pod_scale_up_delay = new_pod_scale_up_delay + self.ok_total_unready_count = ok_total_unready_count + self.scan_interval = scan_interval + self.scale_down_delay_after_add = scale_down_delay_after_add + self.scale_down_delay_after_delete = scale_down_delay_after_delete + self.scale_down_delay_after_failure = scale_down_delay_after_failure + self.scale_down_unneeded_time = scale_down_unneeded_time + self.scale_down_unready_time = scale_down_unready_time + self.scale_down_utilization_threshold = scale_down_utilization_threshold + self.skip_nodes_with_local_storage = skip_nodes_with_local_storage + self.skip_nodes_with_system_pods = skip_nodes_with_system_pods + + +class ManagedClusterPropertiesForSnapshot(_serialization.Model): + """managed cluster properties for snapshot, these properties are read only. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubernetes_version: The current kubernetes version. + :vartype kubernetes_version: str + :ivar sku: The current managed cluster sku. + :vartype sku: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKU + :ivar enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + :vartype enable_rbac: bool + :ivar network_profile: The current network profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkProfileForSnapshot + """ + + _validation = { + "network_profile": {"readonly": True}, + } + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + enable_rbac: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword kubernetes_version: The current kubernetes version. + :paramtype kubernetes_version: str + :keyword sku: The current managed cluster sku. + :paramtype sku: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKU + :keyword enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or + not. + :paramtype enable_rbac: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.sku = sku + self.enable_rbac = enable_rbac + self.network_profile = None + + +class ManagedClusterSecurityProfile(_serialization.Model): + """Security profile for the container service cluster. + + :ivar defender: Microsoft Defender settings for the security profile. + :vartype defender: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileDefender + :ivar azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :vartype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AzureKeyVaultKms + :ivar workload_identity: Workload identity settings for the security profile. Workload identity + enables Kubernetes applications to access Azure cloud resources securely with Azure AD. See + https://aka.ms/aks/wi for more details. + :vartype workload_identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + :ivar image_cleaner: Image Cleaner settings for the security profile. + :vartype image_cleaner: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileImageCleaner + :ivar image_integrity: Image integrity is a feature that works with Azure Policy to verify + image integrity by signature. This will not have any effect unless Azure Policy is applied to + enforce image signatures. See https://aka.ms/aks/image-integrity for how to use this feature + via policy. + :vartype image_integrity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileImageIntegrity + :ivar node_restriction: `Node Restriction + `_ + settings for the security profile. + :vartype node_restriction: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileNodeRestriction + :ivar custom_ca_trust_certificates: A list of up to 10 base64 encoded CAs that will be added to + the trust store on nodes with the Custom CA Trust feature enabled. For more information see + `Custom CA Trust Certificates + `_. + :vartype custom_ca_trust_certificates: list[bytes] + """ + + _validation = { + "custom_ca_trust_certificates": {"max_items": 10, "min_items": 0}, + } + + _attribute_map = { + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, + "image_cleaner": {"key": "imageCleaner", "type": "ManagedClusterSecurityProfileImageCleaner"}, + "image_integrity": {"key": "imageIntegrity", "type": "ManagedClusterSecurityProfileImageIntegrity"}, + "node_restriction": {"key": "nodeRestriction", "type": "ManagedClusterSecurityProfileNodeRestriction"}, + "custom_ca_trust_certificates": {"key": "customCATrustCertificates", "type": "[bytearray]"}, + } + + def __init__( + self, + *, + defender: Optional["_models.ManagedClusterSecurityProfileDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, + image_cleaner: Optional["_models.ManagedClusterSecurityProfileImageCleaner"] = None, + image_integrity: Optional["_models.ManagedClusterSecurityProfileImageIntegrity"] = None, + node_restriction: Optional["_models.ManagedClusterSecurityProfileNodeRestriction"] = None, + custom_ca_trust_certificates: Optional[List[bytes]] = None, + **kwargs: Any + ) -> None: + """ + :keyword defender: Microsoft Defender settings for the security profile. + :paramtype defender: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileDefender + :keyword azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :paramtype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AzureKeyVaultKms + :keyword workload_identity: Workload identity settings for the security profile. Workload + identity enables Kubernetes applications to access Azure cloud resources securely with Azure + AD. See https://aka.ms/aks/wi for more details. + :paramtype workload_identity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + :keyword image_cleaner: Image Cleaner settings for the security profile. + :paramtype image_cleaner: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileImageCleaner + :keyword image_integrity: Image integrity is a feature that works with Azure Policy to verify + image integrity by signature. This will not have any effect unless Azure Policy is applied to + enforce image signatures. See https://aka.ms/aks/image-integrity for how to use this feature + via policy. + :paramtype image_integrity: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileImageIntegrity + :keyword node_restriction: `Node Restriction + `_ + settings for the security profile. + :paramtype node_restriction: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileNodeRestriction + :keyword custom_ca_trust_certificates: A list of up to 10 base64 encoded CAs that will be added + to the trust store on nodes with the Custom CA Trust feature enabled. For more information see + `Custom CA Trust Certificates + `_. + :paramtype custom_ca_trust_certificates: list[bytes] + """ + super().__init__(**kwargs) + self.defender = defender + self.azure_key_vault_kms = azure_key_vault_kms + self.workload_identity = workload_identity + self.image_cleaner = image_cleaner + self.image_integrity = image_integrity + self.node_restriction = node_restriction + self.custom_ca_trust_certificates = custom_ca_trust_certificates + + +class ManagedClusterSecurityProfileDefender(_serialization.Model): + """Microsoft Defender settings for the security profile. + + :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :vartype log_analytics_workspace_resource_id: str + :ivar security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :vartype security_monitoring: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + + _attribute_map = { + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": { + "key": "securityMonitoring", + "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + }, + } + + def __init__( + self, + *, + log_analytics_workspace_resource_id: Optional[str] = None, + security_monitoring: Optional["_models.ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :paramtype log_analytics_workspace_resource_id: str + :keyword security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :paramtype security_monitoring: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + super().__init__(**kwargs) + self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id + self.security_monitoring = security_monitoring + + +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): + """Microsoft Defender settings for the security profile threat detection. + + :ivar enabled: Whether to enable Defender threat detection. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable Defender threat detection. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileImageCleaner(_serialization.Model): + """Image Cleaner removes unused images from nodes, freeing up disk space and helping to reduce + attack surface area. Here are settings for the security profile. + + :ivar enabled: Whether to enable Image Cleaner on AKS cluster. + :vartype enabled: bool + :ivar interval_hours: Image Cleaner scanning interval in hours. + :vartype interval_hours: int + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "interval_hours": {"key": "intervalHours", "type": "int"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, interval_hours: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable Image Cleaner on AKS cluster. + :paramtype enabled: bool + :keyword interval_hours: Image Cleaner scanning interval in hours. + :paramtype interval_hours: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.interval_hours = interval_hours + + +class ManagedClusterSecurityProfileImageIntegrity(_serialization.Model): + """Image integrity related settings for the security profile. + + :ivar enabled: Whether to enable image integrity. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable image integrity. The default value is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileNodeRestriction(_serialization.Model): + """Node Restriction settings for the security profile. + + :ivar enabled: Whether to enable Node Restriction. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable Node Restriction. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): + """Workload identity settings for the security profile. + + :ivar enabled: Whether to enable workload identity. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable workload identity. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterServicePrincipalProfile(_serialization.Model): + """Information about a service principal identity for the cluster to use for manipulating Azure + APIs. + + All required parameters must be populated in order to send to Azure. + + :ivar client_id: The ID for the service principal. Required. + :vartype client_id: str + :ivar secret: The secret password associated with the service principal in plain text. + :vartype secret: str + """ + + _validation = { + "client_id": {"required": True}, + } + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + } + + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: The ID for the service principal. Required. + :paramtype client_id: str + :keyword secret: The secret password associated with the service principal in plain text. + :paramtype secret: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.secret = secret + + +class ManagedClusterSKU(_serialization.Model): + """The SKU of a Managed Cluster. + + :ivar name: The name of a managed cluster SKU. "Base" + :vartype name: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKUName + :ivar tier: If not specified, the default is 'Free'. See `AKS Pricing Tier + `_ for more details. Known + values are: "Premium", "Standard", and "Free". + :vartype tier: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKUTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of a managed cluster SKU. "Base" + :paramtype name: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKUName + :keyword tier: If not specified, the default is 'Free'. See `AKS Pricing Tier + `_ for more details. Known + values are: "Premium", "Standard", and "Free". + :paramtype tier: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSKUTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class ManagedClusterSnapshot(TrackedResource): + """A managed cluster snapshot 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. E.g. + "/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.containerservice.v2023_11_02_preview.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 creation_data: CreationData to be used to specify the source resource ID to create this + snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :vartype snapshot_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SnapshotType + :ivar managed_cluster_properties_read_only: What the properties will be showed when getting + managed cluster snapshot. Those properties are read-only. + :vartype managed_cluster_properties_read_only: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPropertiesForSnapshot + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", + **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 creation_data: CreationData to be used to specify the source resource ID to create + this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :paramtype snapshot_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SnapshotType + """ + super().__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.managed_cluster_properties_read_only = None + + +class ManagedClusterSnapshotListResult(_serialization.Model): + """The response from the List Managed Cluster Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed cluster snapshots. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + :ivar next_link: The URL to get the next set of managed cluster snapshot results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of managed cluster snapshots. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterStorageProfile(_serialization.Model): + """Storage profile for the container service cluster. + + :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :vartype disk_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :ivar file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :vartype file_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :ivar snapshot_controller: Snapshot Controller settings for the storage profile. + :vartype snapshot_controller: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileSnapshotController + :ivar blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :vartype blob_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + + _attribute_map = { + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, + "blob_csi_driver": {"key": "blobCSIDriver", "type": "ManagedClusterStorageProfileBlobCSIDriver"}, + } + + def __init__( + self, + *, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, + blob_csi_driver: Optional["_models.ManagedClusterStorageProfileBlobCSIDriver"] = None, + **kwargs: Any + ) -> None: + """ + :keyword disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :paramtype disk_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :keyword file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :paramtype file_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :keyword snapshot_controller: Snapshot Controller settings for the storage profile. + :paramtype snapshot_controller: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileSnapshotController + :keyword blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :paramtype blob_csi_driver: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + super().__init__(**kwargs) + self.disk_csi_driver = disk_csi_driver + self.file_csi_driver = file_csi_driver + self.snapshot_controller = snapshot_controller + self.blob_csi_driver = blob_csi_driver + + +class ManagedClusterStorageProfileBlobCSIDriver(_serialization.Model): + """AzureBlob CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): + """AzureDisk CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :vartype enabled: bool + :ivar version: The version of AzureDisk CSI Driver. The default value is v1. + :vartype version: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :paramtype enabled: bool + :keyword version: The version of AzureDisk CSI Driver. The default value is v1. + :paramtype version: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.version = version + + +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): + """AzureFile CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): + """Snapshot Controller settings for the storage profile. + + :ivar enabled: Whether to enable Snapshot Controller. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable Snapshot Controller. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterUpgradeProfile(_serialization.Model): + """The list of available upgrades for compute pools. + + 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: The ID of the upgrade profile. + :vartype id: str + :ivar name: The name of the upgrade profile. + :vartype name: str + :ivar type: The type of the upgrade profile. + :vartype type: str + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :vartype control_plane_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfile + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, + } + + def __init__( + self, + *, + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], + **kwargs: Any + ) -> None: + """ + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :paramtype control_plane_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfile + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.control_plane_profile = control_plane_profile + self.agent_pool_profiles = agent_pool_profiles + + +class ManagedClusterWindowsProfile(_serialization.Model): + """Profile for Windows VMs in the managed cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :vartype admin_password: str + :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :vartype license_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LicenseType + :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :vartype enable_csi_proxy: bool + :ivar gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :vartype gmsa_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WindowsGmsaProfile + """ + + _validation = { + "admin_username": {"required": True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, + } + + def __init__( + self, + *, + admin_username: str, + admin_password: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + enable_csi_proxy: Optional[bool] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` + **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", + "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", + "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", + "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :paramtype admin_username: str + :keyword admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :paramtype admin_password: str + :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :paramtype license_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LicenseType + :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :paramtype enable_csi_proxy: bool + :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :paramtype gmsa_profile: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.WindowsGmsaProfile + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.license_type = license_type + self.enable_csi_proxy = enable_csi_proxy + self.gmsa_profile = gmsa_profile + + +class ManagedClusterWorkloadAutoScalerProfile(_serialization.Model): + """Workload Auto-scaler profile for the managed cluster. + + :ivar keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :vartype keda: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + :ivar vertical_pod_autoscaler: + :vartype vertical_pod_autoscaler: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler + """ + + _attribute_map = { + "keda": {"key": "keda", "type": "ManagedClusterWorkloadAutoScalerProfileKeda"}, + "vertical_pod_autoscaler": { + "key": "verticalPodAutoscaler", + "type": "ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler", + }, + } + + def __init__( + self, + *, + keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, + vertical_pod_autoscaler: Optional[ + "_models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :paramtype keda: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + :keyword vertical_pod_autoscaler: + :paramtype vertical_pod_autoscaler: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler + """ + super().__init__(**kwargs) + self.keda = keda + self.vertical_pod_autoscaler = vertical_pod_autoscaler + + +class ManagedClusterWorkloadAutoScalerProfileKeda(_serialization.Model): + """KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable KEDA. Required. + :vartype enabled: bool + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: bool, **kwargs: Any) -> None: + """ + :keyword enabled: Whether to enable KEDA. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler(_serialization.Model): + """ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable VPA add-on in cluster. Default value is false. Required. + :vartype enabled: bool + :ivar addon_autoscaling: Whether VPA add-on is enabled and configured to scale AKS-managed + add-ons. Known values are: "Enabled" and "Disabled". + :vartype addon_autoscaling: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AddonAutoscaling + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "addon_autoscaling": {"key": "addonAutoscaling", "type": "str"}, + } + + def __init__( + self, + *, + enabled: bool = False, + addon_autoscaling: Union[str, "_models.AddonAutoscaling"] = "Disabled", + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether to enable VPA add-on in cluster. Default value is false. Required. + :paramtype enabled: bool + :keyword addon_autoscaling: Whether VPA add-on is enabled and configured to scale AKS-managed + add-ons. Known values are: "Enabled" and "Disabled". + :paramtype addon_autoscaling: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AddonAutoscaling + """ + super().__init__(**kwargs) + self.enabled = enabled + self.addon_autoscaling = addon_autoscaling + + +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): + """ManagedServiceIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ManualScaleProfile(_serialization.Model): + """Specifications on number of machines. + + :ivar sizes: The list of allowed vm sizes. AKS will use the first available one when scaling. + If a VM size is unavailable (e.g. due to quota or regional capacity reasons), AKS will use the + next size. + :vartype sizes: list[str] + :ivar count: Number of nodes. + :vartype count: int + """ + + _validation = { + "count": {"maximum": 1000, "minimum": 0}, + } + + _attribute_map = { + "sizes": {"key": "sizes", "type": "[str]"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, *, sizes: Optional[List[str]] = None, count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword sizes: The list of allowed vm sizes. AKS will use the first available one when + scaling. If a VM size is unavailable (e.g. due to quota or regional capacity reasons), AKS will + use the next size. + :paramtype sizes: list[str] + :keyword count: Number of nodes. + :paramtype count: int + """ + super().__init__(**kwargs) + self.sizes = sizes + self.count = count + + +class MeshRevision(_serialization.Model): + """Holds information on upgrades and compatibility for given major.minor mesh release. + + :ivar revision: The revision of the mesh release. + :vartype revision: str + :ivar upgrades: List of revisions available for upgrade of a specific mesh revision. + :vartype upgrades: list[str] + :ivar compatible_with: List of items this revision of service mesh is compatible with, and + their associated versions. + :vartype compatible_with: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CompatibleVersions] + """ + + _attribute_map = { + "revision": {"key": "revision", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, + "compatible_with": {"key": "compatibleWith", "type": "[CompatibleVersions]"}, + } + + def __init__( + self, + *, + revision: Optional[str] = None, + upgrades: Optional[List[str]] = None, + compatible_with: Optional[List["_models.CompatibleVersions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword revision: The revision of the mesh release. + :paramtype revision: str + :keyword upgrades: List of revisions available for upgrade of a specific mesh revision. + :paramtype upgrades: list[str] + :keyword compatible_with: List of items this revision of service mesh is compatible with, and + their associated versions. + :paramtype compatible_with: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CompatibleVersions] + """ + super().__init__(**kwargs) + self.revision = revision + self.upgrades = upgrades + self.compatible_with = compatible_with + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class MeshRevisionProfile(ProxyResource): + """Mesh revision profile for a mesh. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar properties: Mesh revision profile properties for a mesh. + :vartype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfileProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "MeshRevisionProfileProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MeshRevisionProfileProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Mesh revision profile properties for a mesh. + :paramtype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfileProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MeshRevisionProfileList(_serialization.Model): + """Holds an array of MeshRevisionsProfiles. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of service mesh add-on revision profiles for all supported mesh modes. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile] + :ivar next_link: The URL to get the next set of mesh revision profile. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MeshRevisionProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.MeshRevisionProfile"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of service mesh add-on revision profiles for all supported mesh modes. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MeshRevisionProfileProperties(_serialization.Model): + """Mesh revision profile properties for a mesh. + + :ivar mesh_revisions: + :vartype mesh_revisions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevision] + """ + + _attribute_map = { + "mesh_revisions": {"key": "meshRevisions", "type": "[MeshRevision]"}, + } + + def __init__(self, *, mesh_revisions: Optional[List["_models.MeshRevision"]] = None, **kwargs: Any) -> None: + """ + :keyword mesh_revisions: + :paramtype mesh_revisions: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevision] + """ + super().__init__(**kwargs) + self.mesh_revisions = mesh_revisions + + +class MeshUpgradeProfile(ProxyResource): + """Upgrade profile for given mesh. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar properties: Mesh upgrade profile properties for a major.minor release. + :vartype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfileProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "MeshUpgradeProfileProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MeshUpgradeProfileProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Mesh upgrade profile properties for a major.minor release. + :paramtype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfileProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MeshUpgradeProfileList(_serialization.Model): + """Holds an array of MeshUpgradeProfiles. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of supported service mesh add-on upgrade profiles. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile] + :ivar next_link: The URL to get the next set of mesh upgrade profile. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MeshUpgradeProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.MeshUpgradeProfile"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of supported service mesh add-on upgrade profiles. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MeshUpgradeProfileProperties(MeshRevision): + """Mesh upgrade profile properties for a major.minor release. + + :ivar revision: The revision of the mesh release. + :vartype revision: str + :ivar upgrades: List of revisions available for upgrade of a specific mesh revision. + :vartype upgrades: list[str] + :ivar compatible_with: List of items this revision of service mesh is compatible with, and + their associated versions. + :vartype compatible_with: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CompatibleVersions] + """ + + _attribute_map = { + "revision": {"key": "revision", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, + "compatible_with": {"key": "compatibleWith", "type": "[CompatibleVersions]"}, + } + + def __init__( + self, + *, + revision: Optional[str] = None, + upgrades: Optional[List[str]] = None, + compatible_with: Optional[List["_models.CompatibleVersions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword revision: The revision of the mesh release. + :paramtype revision: str + :keyword upgrades: List of revisions available for upgrade of a specific mesh revision. + :paramtype upgrades: list[str] + :keyword compatible_with: List of items this revision of service mesh is compatible with, and + their associated versions. + :paramtype compatible_with: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.CompatibleVersions] + """ + super().__init__(revision=revision, upgrades=upgrades, compatible_with=compatible_with, **kwargs) + + +class NetworkMonitoring(_serialization.Model): + """This addon can be used to configure network monitoring and generate network monitoring data in + Prometheus format. + + :ivar enabled: Enable or disable the network monitoring plugin on the cluster. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Enable or disable the network monitoring plugin on the cluster. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class NetworkProfileForSnapshot(_serialization.Model): + """network profile for managed cluster snapshot, these properties are read only. + + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", and "none". + :vartype network_plugin: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPlugin + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "overlay" + :vartype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPluginMode + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "none", + "calico", "azure", and "cilium". + :vartype network_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPolicy + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". + :vartype network_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMode + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard" and "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LoadBalancerSku + """ + + _attribute_map = { + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + } + + def __init__( + self, + *, + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", and "none". + :paramtype network_plugin: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPlugin + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "overlay" + :paramtype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPluginMode + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "none", + "calico", "azure", and "cilium". + :paramtype network_policy: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkPolicy + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: + "transparent" and "bridge". + :paramtype network_mode: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.NetworkMode + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard" and "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.LoadBalancerSku + """ + super().__init__(**kwargs) + self.network_plugin = network_plugin + self.network_plugin_mode = network_plugin_mode + self.network_policy = network_policy + self.network_mode = network_mode + self.load_balancer_sku = load_balancer_sku + + +class OperationListResult(_serialization.Model): + """The List Operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationValue] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OperationValue]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. + + 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 ID for the async operation. + :vartype id: str + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ErrorDetail + """ + + _validation = { + "resource_id": {"readonly": True}, + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[OperationStatusResult]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.id = id + self.resource_id = None + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class OperationStatusResultList(_serialization.Model): + """The operations list. 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: List of operations. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OperationStatusResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationValue(_serialization.Model): + """Describes the properties of a Operation value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar name: The name of the operation. + :vartype name: str + :ivar operation: The display name of the operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + _validation = { + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, + } + + _attribute_map = { + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.origin = None + self.name = None + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class OSOptionProfile(_serialization.Model): + """The OS option profile. + + 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: The ID of the OS option resource. + :vartype id: str + :ivar name: The name of the OS option resource. + :vartype name: str + :ivar type: The type of the OS option resource. + :vartype type: str + :ivar os_option_property_list: The list of OS options. Required. + :vartype os_option_property_list: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OSOptionProperty] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, + } + + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs: Any) -> None: + """ + :keyword os_option_property_list: The list of OS options. Required. + :paramtype os_option_property_list: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OSOptionProperty] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.os_option_property_list = os_option_property_list + + +class OSOptionProperty(_serialization.Model): + """OS option property. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: The OS type. Required. + :vartype os_type: str + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. + :vartype enable_fips_image: bool + """ + + _validation = { + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, + } + + _attribute_map = { + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, + } + + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs: Any) -> None: + """ + :keyword os_type: The OS type. Required. + :paramtype os_type: str + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. + :paramtype enable_fips_image: bool + """ + super().__init__(**kwargs) + self.os_type = os_type + self.enable_fips_image = enable_fips_image + + +class OutboundEnvironmentEndpoint(_serialization.Model): + """Egress endpoints which AKS agent nodes connect to for common purpose. + + :ivar category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :vartype category: str + :ivar endpoints: The endpoints that AKS agent nodes connect to. + :vartype endpoints: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.EndpointDependency] + """ + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :paramtype category: str + :keyword endpoints: The endpoints that AKS agent nodes connect to. + :paramtype endpoints: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.EndpointDependency] + """ + super().__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointCollection(_serialization.Model): + """Collection of OutboundEnvironmentEndpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundEnvironmentEndpoint] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PortRange(_serialization.Model): + """The port range. + + :ivar port_start: The minimum port that is included in the range. It should be ranged from 1 to + 65535, and be less than or equal to portEnd. + :vartype port_start: int + :ivar port_end: The maximum port that is included in the range. It should be ranged from 1 to + 65535, and be greater than or equal to portStart. + :vartype port_end: int + :ivar protocol: The network protocol of the port. Known values are: "TCP" and "UDP". + :vartype protocol: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Protocol + """ + + _validation = { + "port_start": {"maximum": 65535, "minimum": 1}, + "port_end": {"maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "port_start": {"key": "portStart", "type": "int"}, + "port_end": {"key": "portEnd", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + } + + def __init__( + self, + *, + port_start: Optional[int] = None, + port_end: Optional[int] = None, + protocol: Optional[Union[str, "_models.Protocol"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword port_start: The minimum port that is included in the range. It should be ranged from 1 + to 65535, and be less than or equal to portEnd. + :paramtype port_start: int + :keyword port_end: The maximum port that is included in the range. It should be ranged from 1 + to 65535, and be greater than or equal to portStart. + :paramtype port_end: int + :keyword protocol: The network protocol of the port. Known values are: "TCP" and "UDP". + :paramtype protocol: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Protocol + """ + super().__init__(**kwargs) + self.port_start = port_start + self.port_end = port_end + self.protocol = protocol + + +class PowerState(_serialization.Model): + """Describes the Power State of the cluster. + + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and + "Stopped". + :vartype code: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Code + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + } + + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs: Any) -> None: + """ + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and + "Stopped". + :paramtype code: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Code + """ + super().__init__(**kwargs) + self.code = code + + +class PrivateEndpoint(_serialization.Model): + """Private endpoint which a connection belongs to. + + :ivar id: The resource ID of the private endpoint. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The resource ID of the private endpoint. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(_serialization.Model): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private endpoint connection. + :vartype id: str + :ivar name: The name of the private endpoint connection. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar provisioning_state: The current provisioning state. Known values are: "Canceled", + "Creating", "Deleting", "Failed", and "Succeeded". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnectionProvisioningState + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: + ~azure.mgmt.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.models.PrivateLinkServiceConnectionState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + } + + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.models.PrivateLinkServiceConnectionState + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """A list of private endpoint connections. + + :ivar value: The collection value. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The collection value. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(_serialization.Model): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private link resource. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar group_id: The group ID of the resource. + :vartype group_id: str + :ivar required_members: The RequiredMembers of the resource. + :vartype required_members: list[str] + :ivar private_link_service_id: The private link service ID of the resource, this field is + exposed only to NRP internally. + :vartype private_link_service_id: str + """ + + _validation = { + "private_link_service_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The ID of the private link resource. + :paramtype id: str + :keyword name: The name of the private link resource. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + :keyword group_id: The group ID of the resource. + :paramtype group_id: str + :keyword required_members: The RequiredMembers of the resource. + :paramtype required_members: list[str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.private_link_service_id = None + + +class PrivateLinkResourcesListResult(_serialization.Model): + """A list of private link resources. + + :ivar value: The collection value. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The collection value. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", and "Disconnected". + :vartype status: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ConnectionStatus + :ivar description: The private link service connection description. + :vartype description: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", and "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ConnectionStatus + :keyword description: The private link service connection description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + + +class RelativeMonthlySchedule(_serialization.Model): + """For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last + Friday'. + + All required parameters must be populated in order to send to Azure. + + :ivar interval_months: Specifies the number of months between each set of occurrences. + Required. + :vartype interval_months: int + :ivar week_index: Specifies on which instance of the allowed days specified in daysOfWeek the + maintenance occurs. Required. Known values are: "First", "Second", "Third", "Fourth", and + "Last". + :vartype week_index: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Type + :ivar day_of_week: Specifies on which day of the week the maintenance occurs. Required. Known + values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday". + :vartype day_of_week: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + """ + + _validation = { + "interval_months": {"required": True, "maximum": 6, "minimum": 1}, + "week_index": {"required": True}, + "day_of_week": {"required": True}, + } + + _attribute_map = { + "interval_months": {"key": "intervalMonths", "type": "int"}, + "week_index": {"key": "weekIndex", "type": "str"}, + "day_of_week": {"key": "dayOfWeek", "type": "str"}, + } + + def __init__( + self, + *, + interval_months: int, + week_index: Union[str, "_models.Type"], + day_of_week: Union[str, "_models.WeekDay"], + **kwargs: Any + ) -> None: + """ + :keyword interval_months: Specifies the number of months between each set of occurrences. + Required. + :paramtype interval_months: int + :keyword week_index: Specifies on which instance of the allowed days specified in daysOfWeek + the maintenance occurs. Required. Known values are: "First", "Second", "Third", "Fourth", and + "Last". + :paramtype week_index: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Type + :keyword day_of_week: Specifies on which day of the week the maintenance occurs. Required. + Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and + "Saturday". + :paramtype day_of_week: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + """ + super().__init__(**kwargs) + self.interval_months = interval_months + self.week_index = week_index + self.day_of_week = day_of_week + + +class ResourceReference(_serialization.Model): + """A reference to an Azure resource. + + :ivar id: The fully qualified Azure resource id. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The fully qualified Azure resource id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class RunCommandRequest(_serialization.Model): + """A run command request. + + All required parameters must be populated in order to send to Azure. + + :ivar command: The command to run. Required. + :vartype command: str + :ivar context: A base64 encoded zip file containing the files required by the command. + :vartype context: str + :ivar cluster_token: AuthToken issued for AKS AAD Server App. + :vartype cluster_token: str + """ + + _validation = { + "command": {"required": True}, + } + + _attribute_map = { + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, + } + + def __init__( + self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword command: The command to run. Required. + :paramtype command: str + :keyword context: A base64 encoded zip file containing the files required by the command. + :paramtype context: str + :keyword cluster_token: AuthToken issued for AKS AAD Server App. + :paramtype cluster_token: str + """ + super().__init__(**kwargs) + self.command = command + self.context = context + self.cluster_token = cluster_token + + +class RunCommandResult(_serialization.Model): + """run command result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The command id. + :vartype id: str + :ivar provisioning_state: provisioning State. + :vartype provisioning_state: str + :ivar exit_code: The exit code of the command. + :vartype exit_code: int + :ivar started_at: The time when the command started. + :vartype started_at: ~datetime.datetime + :ivar finished_at: The time when the command finished. + :vartype finished_at: ~datetime.datetime + :ivar logs: The command output. + :vartype logs: str + :ivar reason: An explanation of why provisioningState is set to failed (if so). + :vartype reason: str + """ + + _validation = { + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.provisioning_state = None + self.exit_code = None + self.started_at = None + self.finished_at = None + self.logs = None + self.reason = None + + +class SafeguardsAvailableVersion(Resource): + """Available Safeguards Version. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar properties: Whether the version is default or not and support info. Required. + :vartype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersionsProperties + """ + + _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": "SafeguardsAvailableVersionsProperties"}, + } + + def __init__(self, *, properties: "_models.SafeguardsAvailableVersionsProperties", **kwargs: Any) -> None: + """ + :keyword properties: Whether the version is default or not and support info. Required. + :paramtype properties: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SafeguardsAvailableVersionsList(_serialization.Model): + """Hold values properties, which is array of SafeguardsVersions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of AKS supported Safeguards versions. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion] + :ivar next_link: The URL to get the next Safeguards available version. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SafeguardsAvailableVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SafeguardsAvailableVersion"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of AKS supported Safeguards versions. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SafeguardsAvailableVersionsProperties(_serialization.Model): + """Whether the version is default or not and support info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_default_version: + :vartype is_default_version: bool + :ivar support: Whether the version is preview or stable. Known values are: "Preview" and + "Stable". + :vartype support: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsSupport + """ + + _validation = { + "is_default_version": {"readonly": True}, + "support": {"readonly": True}, + } + + _attribute_map = { + "is_default_version": {"key": "isDefaultVersion", "type": "bool"}, + "support": {"key": "support", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.is_default_version = None + self.support = None + + +class SafeguardsProfile(_serialization.Model): + """The Safeguards profile. + + 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 system_excluded_namespaces: List of namespaces specified by AKS to be excluded from + Safeguards. + :vartype system_excluded_namespaces: list[str] + :ivar version: The version of constraints to use. + :vartype version: str + :ivar level: The Safeguards level to be used. By default, Safeguards is enabled for all + namespaces except those that AKS excludes via systemExcludedNamespaces. Required. Known values + are: "Off", "Warning", and "Enforcement". + :vartype level: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Level + :ivar excluded_namespaces: List of namespaces excluded from Safeguards checks. + :vartype excluded_namespaces: list[str] + """ + + _validation = { + "system_excluded_namespaces": {"readonly": True}, + "level": {"required": True}, + } + + _attribute_map = { + "system_excluded_namespaces": {"key": "systemExcludedNamespaces", "type": "[str]"}, + "version": {"key": "version", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "excluded_namespaces": {"key": "excludedNamespaces", "type": "[str]"}, + } + + def __init__( + self, + *, + level: Union[str, "_models.Level"], + version: Optional[str] = None, + excluded_namespaces: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: The version of constraints to use. + :paramtype version: str + :keyword level: The Safeguards level to be used. By default, Safeguards is enabled for all + namespaces except those that AKS excludes via systemExcludedNamespaces. Required. Known values + are: "Off", "Warning", and "Enforcement". + :paramtype level: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Level + :keyword excluded_namespaces: List of namespaces excluded from Safeguards checks. + :paramtype excluded_namespaces: list[str] + """ + super().__init__(**kwargs) + self.system_excluded_namespaces = None + self.version = version + self.level = level + self.excluded_namespaces = excluded_namespaces + + +class ScaleProfile(_serialization.Model): + """Specifications on how to scale a VirtualMachines agent pool. + + :ivar manual: Specifications on how to scale the VirtualMachines agent pool to a fixed size. + :vartype manual: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManualScaleProfile] + """ + + _attribute_map = { + "manual": {"key": "manual", "type": "[ManualScaleProfile]"}, + } + + def __init__(self, *, manual: Optional[List["_models.ManualScaleProfile"]] = None, **kwargs: Any) -> None: + """ + :keyword manual: Specifications on how to scale the VirtualMachines agent pool to a fixed size. + :paramtype manual: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManualScaleProfile] + """ + super().__init__(**kwargs) + self.manual = manual + + +class Schedule(_serialization.Model): + """One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', + 'absoluteMonthly' or 'relativeMonthly' for your maintenance schedule. + + :ivar daily: For schedules like: 'recur every day' or 'recur every 3 days'. + :vartype daily: ~azure.mgmt.containerservice.v2023_11_02_preview.models.DailySchedule + :ivar weekly: For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. + :vartype weekly: ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeeklySchedule + :ivar absolute_monthly: For schedules like: 'recur every month on the 15th' or 'recur every 3 + months on the 20th'. + :vartype absolute_monthly: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AbsoluteMonthlySchedule + :ivar relative_monthly: For schedules like: 'recur every month on the first Monday' or 'recur + every 3 months on last Friday'. + :vartype relative_monthly: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RelativeMonthlySchedule + """ + + _attribute_map = { + "daily": {"key": "daily", "type": "DailySchedule"}, + "weekly": {"key": "weekly", "type": "WeeklySchedule"}, + "absolute_monthly": {"key": "absoluteMonthly", "type": "AbsoluteMonthlySchedule"}, + "relative_monthly": {"key": "relativeMonthly", "type": "RelativeMonthlySchedule"}, + } + + def __init__( + self, + *, + daily: Optional["_models.DailySchedule"] = None, + weekly: Optional["_models.WeeklySchedule"] = None, + absolute_monthly: Optional["_models.AbsoluteMonthlySchedule"] = None, + relative_monthly: Optional["_models.RelativeMonthlySchedule"] = None, + **kwargs: Any + ) -> None: + """ + :keyword daily: For schedules like: 'recur every day' or 'recur every 3 days'. + :paramtype daily: ~azure.mgmt.containerservice.v2023_11_02_preview.models.DailySchedule + :keyword weekly: For schedules like: 'recur every Monday' or 'recur every 3 weeks on + Wednesday'. + :paramtype weekly: ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeeklySchedule + :keyword absolute_monthly: For schedules like: 'recur every month on the 15th' or 'recur every + 3 months on the 20th'. + :paramtype absolute_monthly: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AbsoluteMonthlySchedule + :keyword relative_monthly: For schedules like: 'recur every month on the first Monday' or + 'recur every 3 months on last Friday'. + :paramtype relative_monthly: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RelativeMonthlySchedule + """ + super().__init__(**kwargs) + self.daily = daily + self.weekly = weekly + self.absolute_monthly = absolute_monthly + self.relative_monthly = relative_monthly + + +class ServiceMeshProfile(_serialization.Model): + """Service mesh profile for a managed cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar mode: Mode of the service mesh. Required. Known values are: "Istio" and "Disabled". + :vartype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.ServiceMeshMode + :ivar istio: Istio service mesh configuration. + :vartype istio: ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioServiceMesh + """ + + _validation = { + "mode": {"required": True}, + } + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "istio": {"key": "istio", "type": "IstioServiceMesh"}, + } + + def __init__( + self, + *, + mode: Union[str, "_models.ServiceMeshMode"], + istio: Optional["_models.IstioServiceMesh"] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: Mode of the service mesh. Required. Known values are: "Istio" and "Disabled". + :paramtype mode: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.ServiceMeshMode + :keyword istio: Istio service mesh configuration. + :paramtype istio: ~azure.mgmt.containerservice.v2023_11_02_preview.models.IstioServiceMesh + """ + super().__init__(**kwargs) + self.mode = mode + self.istio = istio + + +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes + """A node pool snapshot 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. E.g. + "/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.containerservice.v2023_11_02_preview.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 creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :vartype snapshot_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SnapshotType + :ivar kubernetes_version: The version of Kubernetes. + :vartype kubernetes_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "Mariner", + "AzureLinux", "CBLMariner", "Windows2019", "Windows2022", and "WindowsAnnual". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSSKU + :ivar vm_size: The size of the VM. + :vartype vm_size: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. + :vartype enable_fips: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", + **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 creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :paramtype snapshot_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.SnapshotType + """ + super().__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.kubernetes_version = None + self.node_image_version = None + self.os_type = None + self.os_sku = None + self.vm_size = None + self.enable_fips = None + + +class SnapshotListResult(_serialization.Model): + """The response from the List Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of snapshots. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + :ivar next_link: The URL to get the next set of snapshot results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of snapshots. + :paramtype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Sysctl settings for Linux agent nodes. + + :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. + :vartype net_core_somaxconn: int + :ivar net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :vartype net_core_netdev_max_backlog: int + :ivar net_core_rmem_default: Sysctl setting net.core.rmem_default. + :vartype net_core_rmem_default: int + :ivar net_core_rmem_max: Sysctl setting net.core.rmem_max. + :vartype net_core_rmem_max: int + :ivar net_core_wmem_default: Sysctl setting net.core.wmem_default. + :vartype net_core_wmem_default: int + :ivar net_core_wmem_max: Sysctl setting net.core.wmem_max. + :vartype net_core_wmem_max: int + :ivar net_core_optmem_max: Sysctl setting net.core.optmem_max. + :vartype net_core_optmem_max: int + :ivar net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :vartype net_ipv4_tcp_max_syn_backlog: int + :ivar net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :vartype net_ipv4_tcp_max_tw_buckets: int + :ivar net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :vartype net_ipv4_tcp_fin_timeout: int + :ivar net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :vartype net_ipv4_tcp_keepalive_time: int + :ivar net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :vartype net_ipv4_tcp_keepalive_probes: int + :ivar net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :vartype net_ipv4_tcpkeepalive_intvl: int + :ivar net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :vartype net_ipv4_tcp_tw_reuse: bool + :ivar net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :vartype net_ipv4_ip_local_port_range: str + :ivar net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :vartype net_ipv4_neigh_default_gc_thresh1: int + :ivar net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :vartype net_ipv4_neigh_default_gc_thresh2: int + :ivar net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :vartype net_ipv4_neigh_default_gc_thresh3: int + :ivar net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :vartype net_netfilter_nf_conntrack_max: int + :ivar net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :vartype net_netfilter_nf_conntrack_buckets: int + :ivar fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :vartype fs_inotify_max_user_watches: int + :ivar fs_file_max: Sysctl setting fs.file-max. + :vartype fs_file_max: int + :ivar fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :vartype fs_aio_max_nr: int + :ivar fs_nr_open: Sysctl setting fs.nr_open. + :vartype fs_nr_open: int + :ivar kernel_threads_max: Sysctl setting kernel.threads-max. + :vartype kernel_threads_max: int + :ivar vm_max_map_count: Sysctl setting vm.max_map_count. + :vartype vm_max_map_count: int + :ivar vm_swappiness: Sysctl setting vm.swappiness. + :vartype vm_swappiness: int + :ivar vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :vartype vm_vfs_cache_pressure: int + """ + + _validation = { + "net_ipv4_tcpkeepalive_intvl": {"maximum": 90, "minimum": 10}, + "net_netfilter_nf_conntrack_max": {"maximum": 2097152, "minimum": 131072}, + "net_netfilter_nf_conntrack_buckets": {"maximum": 524288, "minimum": 65536}, + } + + _attribute_map = { + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + net_core_somaxconn: Optional[int] = None, + net_core_netdev_max_backlog: Optional[int] = None, + net_core_rmem_default: Optional[int] = None, + net_core_rmem_max: Optional[int] = None, + net_core_wmem_default: Optional[int] = None, + net_core_wmem_max: Optional[int] = None, + net_core_optmem_max: Optional[int] = None, + net_ipv4_tcp_max_syn_backlog: Optional[int] = None, + net_ipv4_tcp_max_tw_buckets: Optional[int] = None, + net_ipv4_tcp_fin_timeout: Optional[int] = None, + net_ipv4_tcp_keepalive_time: Optional[int] = None, + net_ipv4_tcp_keepalive_probes: Optional[int] = None, + net_ipv4_tcpkeepalive_intvl: Optional[int] = None, + net_ipv4_tcp_tw_reuse: Optional[bool] = None, + net_ipv4_ip_local_port_range: Optional[str] = None, + net_ipv4_neigh_default_gc_thresh1: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh2: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh3: Optional[int] = None, + net_netfilter_nf_conntrack_max: Optional[int] = None, + net_netfilter_nf_conntrack_buckets: Optional[int] = None, + fs_inotify_max_user_watches: Optional[int] = None, + fs_file_max: Optional[int] = None, + fs_aio_max_nr: Optional[int] = None, + fs_nr_open: Optional[int] = None, + kernel_threads_max: Optional[int] = None, + vm_max_map_count: Optional[int] = None, + vm_swappiness: Optional[int] = None, + vm_vfs_cache_pressure: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword net_core_somaxconn: Sysctl setting net.core.somaxconn. + :paramtype net_core_somaxconn: int + :keyword net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :paramtype net_core_netdev_max_backlog: int + :keyword net_core_rmem_default: Sysctl setting net.core.rmem_default. + :paramtype net_core_rmem_default: int + :keyword net_core_rmem_max: Sysctl setting net.core.rmem_max. + :paramtype net_core_rmem_max: int + :keyword net_core_wmem_default: Sysctl setting net.core.wmem_default. + :paramtype net_core_wmem_default: int + :keyword net_core_wmem_max: Sysctl setting net.core.wmem_max. + :paramtype net_core_wmem_max: int + :keyword net_core_optmem_max: Sysctl setting net.core.optmem_max. + :paramtype net_core_optmem_max: int + :keyword net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :paramtype net_ipv4_tcp_max_syn_backlog: int + :keyword net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :paramtype net_ipv4_tcp_max_tw_buckets: int + :keyword net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :paramtype net_ipv4_tcp_fin_timeout: int + :keyword net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :paramtype net_ipv4_tcp_keepalive_time: int + :keyword net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :paramtype net_ipv4_tcp_keepalive_probes: int + :keyword net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :paramtype net_ipv4_tcpkeepalive_intvl: int + :keyword net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :paramtype net_ipv4_tcp_tw_reuse: bool + :keyword net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :paramtype net_ipv4_ip_local_port_range: str + :keyword net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :paramtype net_ipv4_neigh_default_gc_thresh1: int + :keyword net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :paramtype net_ipv4_neigh_default_gc_thresh2: int + :keyword net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :paramtype net_ipv4_neigh_default_gc_thresh3: int + :keyword net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :paramtype net_netfilter_nf_conntrack_max: int + :keyword net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :paramtype net_netfilter_nf_conntrack_buckets: int + :keyword fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :paramtype fs_inotify_max_user_watches: int + :keyword fs_file_max: Sysctl setting fs.file-max. + :paramtype fs_file_max: int + :keyword fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :paramtype fs_aio_max_nr: int + :keyword fs_nr_open: Sysctl setting fs.nr_open. + :paramtype fs_nr_open: int + :keyword kernel_threads_max: Sysctl setting kernel.threads-max. + :paramtype kernel_threads_max: int + :keyword vm_max_map_count: Sysctl setting vm.max_map_count. + :paramtype vm_max_map_count: int + :keyword vm_swappiness: Sysctl setting vm.swappiness. + :paramtype vm_swappiness: int + :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :paramtype vm_vfs_cache_pressure: int + """ + super().__init__(**kwargs) + self.net_core_somaxconn = net_core_somaxconn + self.net_core_netdev_max_backlog = net_core_netdev_max_backlog + self.net_core_rmem_default = net_core_rmem_default + self.net_core_rmem_max = net_core_rmem_max + self.net_core_wmem_default = net_core_wmem_default + self.net_core_wmem_max = net_core_wmem_max + self.net_core_optmem_max = net_core_optmem_max + self.net_ipv4_tcp_max_syn_backlog = net_ipv4_tcp_max_syn_backlog + self.net_ipv4_tcp_max_tw_buckets = net_ipv4_tcp_max_tw_buckets + self.net_ipv4_tcp_fin_timeout = net_ipv4_tcp_fin_timeout + self.net_ipv4_tcp_keepalive_time = net_ipv4_tcp_keepalive_time + self.net_ipv4_tcp_keepalive_probes = net_ipv4_tcp_keepalive_probes + self.net_ipv4_tcpkeepalive_intvl = net_ipv4_tcpkeepalive_intvl + self.net_ipv4_tcp_tw_reuse = net_ipv4_tcp_tw_reuse + self.net_ipv4_ip_local_port_range = net_ipv4_ip_local_port_range + self.net_ipv4_neigh_default_gc_thresh1 = net_ipv4_neigh_default_gc_thresh1 + self.net_ipv4_neigh_default_gc_thresh2 = net_ipv4_neigh_default_gc_thresh2 + self.net_ipv4_neigh_default_gc_thresh3 = net_ipv4_neigh_default_gc_thresh3 + self.net_netfilter_nf_conntrack_max = net_netfilter_nf_conntrack_max + self.net_netfilter_nf_conntrack_buckets = net_netfilter_nf_conntrack_buckets + self.fs_inotify_max_user_watches = fs_inotify_max_user_watches + self.fs_file_max = fs_file_max + self.fs_aio_max_nr = fs_aio_max_nr + self.fs_nr_open = fs_nr_open + self.kernel_threads_max = kernel_threads_max + self.vm_max_map_count = vm_max_map_count + self.vm_swappiness = vm_swappiness + self.vm_vfs_cache_pressure = vm_vfs_cache_pressure + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(_serialization.Model): + """Tags object for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 TimeInWeek(_serialization.Model): + """Time in a week. + + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", and "Saturday". + :vartype day: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :vartype hour_slots: list[int] + """ + + _attribute_map = { + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, + } + + def __init__( + self, + *, + day: Optional[Union[str, "_models.WeekDay"]] = None, + hour_slots: Optional[List[int]] = None, + **kwargs: Any + ) -> None: + """ + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :paramtype day: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :paramtype hour_slots: list[int] + """ + super().__init__(**kwargs) + self.day = day + self.hour_slots = hour_slots + + +class TimeSpan(_serialization.Model): + """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. + + :ivar start: The start of a time span. + :vartype start: ~datetime.datetime + :ivar end: The end of a time span. + :vartype end: ~datetime.datetime + """ + + _attribute_map = { + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, + } + + def __init__( + self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: + """ + :keyword start: The start of a time span. + :paramtype start: ~datetime.datetime + :keyword end: The end of a time span. + :paramtype end: ~datetime.datetime + """ + super().__init__(**kwargs) + self.start = start + self.end = end + + +class TrustedAccessRole(_serialization.Model): + """Trusted access role definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source_resource_type: Resource type of Azure resource. + :vartype source_resource_type: str + :ivar name: Name of role, name is unique under a source resource type. + :vartype name: str + :ivar rules: List of rules for the role. This maps to 'rules' property of `Kubernetes Cluster + Role + `_. + :vartype rules: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleRule] + """ + + _validation = { + "source_resource_type": {"readonly": True}, + "name": {"readonly": True}, + "rules": {"readonly": True}, + } + + _attribute_map = { + "source_resource_type": {"key": "sourceResourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rules": {"key": "rules", "type": "[TrustedAccessRoleRule]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.source_resource_type = None + self.name = None + self.rules = None + + +class TrustedAccessRoleBinding(Resource): + """Defines binding between a resource and role. + + 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. E.g. + "/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.containerservice.v2023_11_02_preview.models.SystemData + :ivar provisioning_state: The current provisioning state of trusted access role binding. Known + values are: "Canceled", "Deleting", "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBindingProvisioningState + :ivar source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. + :vartype source_resource_id: str + :ivar roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. + :vartype roles: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "source_resource_id": {"required": True}, + "roles": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "roles": {"key": "properties.roles", "type": "[str]"}, + } + + def __init__(self, *, source_resource_id: str, roles: List[str], **kwargs: Any) -> None: + """ + :keyword source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. + :paramtype source_resource_id: str + :keyword roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. + :paramtype roles: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.source_resource_id = source_resource_id + self.roles = roles + + +class TrustedAccessRoleBindingListResult(_serialization.Model): + """List of trusted access role bindings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role binding list. + :vartype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TrustedAccessRoleBinding]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Role binding list. + :paramtype value: + list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class TrustedAccessRoleListResult(_serialization.Model): + """List of trusted access roles. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role list. + :vartype value: list[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRole] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TrustedAccessRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class TrustedAccessRoleRule(_serialization.Model): + """Rule for trusted access role. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar verbs: List of allowed verbs. + :vartype verbs: list[str] + :ivar api_groups: List of allowed apiGroups. + :vartype api_groups: list[str] + :ivar resources: List of allowed resources. + :vartype resources: list[str] + :ivar resource_names: List of allowed names. + :vartype resource_names: list[str] + :ivar non_resource_ur_ls: List of allowed nonResourceURLs. + :vartype non_resource_ur_ls: list[str] + """ + + _validation = { + "verbs": {"readonly": True}, + "api_groups": {"readonly": True}, + "resources": {"readonly": True}, + "resource_names": {"readonly": True}, + "non_resource_ur_ls": {"readonly": True}, + } + + _attribute_map = { + "verbs": {"key": "verbs", "type": "[str]"}, + "api_groups": {"key": "apiGroups", "type": "[str]"}, + "resources": {"key": "resources", "type": "[str]"}, + "resource_names": {"key": "resourceNames", "type": "[str]"}, + "non_resource_ur_ls": {"key": "nonResourceURLs", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.verbs = None + self.api_groups = None + self.resources = None + self.resource_names = None + self.non_resource_ur_ls = None + + +class UpgradeOverrideSettings(_serialization.Model): + """Settings for overrides when upgrading a cluster. + + :ivar force_upgrade: Whether to force upgrade the cluster. Note that this option instructs + upgrade operation to bypass upgrade protections such as checking for deprecated API usage. + Enable this option only with caution. + :vartype force_upgrade: bool + :ivar until: Until when the overrides are effective. Note that this only matches the start time + of an upgrade, and the effectiveness won't change once an upgrade starts even if the ``until`` + expires as upgrade proceeds. This field is not set by default. It must be set for the overrides + to take effect. + :vartype until: ~datetime.datetime + """ + + _attribute_map = { + "force_upgrade": {"key": "forceUpgrade", "type": "bool"}, + "until": {"key": "until", "type": "iso-8601"}, + } + + def __init__( + self, *, force_upgrade: Optional[bool] = None, until: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: + """ + :keyword force_upgrade: Whether to force upgrade the cluster. Note that this option instructs + upgrade operation to bypass upgrade protections such as checking for deprecated API usage. + Enable this option only with caution. + :paramtype force_upgrade: bool + :keyword until: Until when the overrides are effective. Note that this only matches the start + time of an upgrade, and the effectiveness won't change once an upgrade starts even if the + ``until`` expires as upgrade proceeds. This field is not set by default. It must be set for the + overrides to take effect. + :paramtype until: ~datetime.datetime + """ + super().__init__(**kwargs) + self.force_upgrade = force_upgrade + self.until = until + + +class VirtualMachineNodes(_serialization.Model): + """Current status on a group of nodes of the same vm size. + + :ivar size: The VM size of the agents used to host this group of nodes. + :vartype size: str + :ivar count: Number of nodes. + :vartype count: int + """ + + _attribute_map = { + "size": {"key": "size", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, *, size: Optional[str] = None, count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword size: The VM size of the agents used to host this group of nodes. + :paramtype size: str + :keyword count: Number of nodes. + :paramtype count: int + """ + super().__init__(**kwargs) + self.size = size + self.count = count + + +class VirtualMachinesProfile(_serialization.Model): + """Specifications on VirtualMachines agent pool. + + :ivar scale: Specifications on how to scale a VirtualMachines agent pool. + :vartype scale: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleProfile + """ + + _attribute_map = { + "scale": {"key": "scale", "type": "ScaleProfile"}, + } + + def __init__(self, *, scale: Optional["_models.ScaleProfile"] = None, **kwargs: Any) -> None: + """ + :keyword scale: Specifications on how to scale a VirtualMachines agent pool. + :paramtype scale: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ScaleProfile + """ + super().__init__(**kwargs) + self.scale = scale + + +class WeeklySchedule(_serialization.Model): + """For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. + + All required parameters must be populated in order to send to Azure. + + :ivar interval_weeks: Specifies the number of weeks between each set of occurrences. Required. + :vartype interval_weeks: int + :ivar day_of_week: Specifies on which day of the week the maintenance occurs. Required. Known + values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday". + :vartype day_of_week: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + """ + + _validation = { + "interval_weeks": {"required": True, "maximum": 4, "minimum": 1}, + "day_of_week": {"required": True}, + } + + _attribute_map = { + "interval_weeks": {"key": "intervalWeeks", "type": "int"}, + "day_of_week": {"key": "dayOfWeek", "type": "str"}, + } + + def __init__(self, *, interval_weeks: int, day_of_week: Union[str, "_models.WeekDay"], **kwargs: Any) -> None: + """ + :keyword interval_weeks: Specifies the number of weeks between each set of occurrences. + Required. + :paramtype interval_weeks: int + :keyword day_of_week: Specifies on which day of the week the maintenance occurs. Required. + Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and + "Saturday". + :paramtype day_of_week: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.WeekDay + """ + super().__init__(**kwargs) + self.interval_weeks = interval_weeks + self.day_of_week = day_of_week + + +class WindowsGmsaProfile(_serialization.Model): + """Windows gMSA Profile in the managed cluster. + + :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :vartype enabled: bool + :ivar dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it to + empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :vartype dns_server: str + :ivar root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :vartype root_domain_name: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_server: Optional[str] = None, + root_domain_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :paramtype enabled: bool + :keyword dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it + to empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :paramtype dns_server: str + :keyword root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :paramtype root_domain_name: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.dns_server = dns_server + self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/__init__.py new file mode 100644 index 000000000000..a035074bb195 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/__init__.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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._machines_operations import MachinesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._operation_status_result_operations import OperationStatusResultOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations + +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", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "MachinesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "OperationStatusResultOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..27f6eadebffb --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_agent_pools_operations.py @@ -0,0 +1,1673 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_abort_latest_operation_request( + resource_group_name: str, resource_name: str, agent_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_request( + resource_group_name: str, resource_name: str, agent_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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, resource_name: str, agent_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", "2023-11-02-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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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_delete_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + *, + ignore_pod_disruption_budget: Optional[bool] = 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ignore_pod_disruption_budget is not None: + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_upgrade_profile_request( + resource_group_name: str, resource_name: str, agent_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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_machines_request( + resource_group_name: str, resource_name: str, agent_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", "2023-11-02-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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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_available_agent_pool_versions_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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 AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`agent_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _abort_latest_operation_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, agent_pool_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._abort_latest_operation_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _abort_latest_operation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + } + + @distributed_trace + def begin_abort_latest_operation( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Aborts last operation running on agent pool. + + Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a + Canceling state and eventually to a Canceled state when cancellation finishes. If the operation + completes before cancellation can take place, an error is returned. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._abort_latest_operation_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_abort_latest_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + } + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = 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, "AgentPool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AgentPool", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool + :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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. 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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a AgentPool type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool 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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = 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, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}" + } + + @distributed_trace + def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default" + } + + def _delete_machines_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: Union[_models.AgentPoolDeleteMachinesParameter, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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(machines, (IOBase, bytes)): + _content = machines + else: + _json = self._serialize.body(machines, "AgentPoolDeleteMachinesParameter") + + request = build_delete_machines_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_machines_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_machines_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines" + } + + @overload + def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: _models.AgentPoolDeleteMachinesParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Required. + :type machines: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolDeleteMachinesParameter + :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: + """ + + @overload + def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Required. + :type machines: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_machines( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machines: Union[_models.AgentPoolDeleteMachinesParameter, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes specific machines in an agent pool. + + Deletes specific machines in an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machines: A list of machines from the agent pool to be deleted. Is either a + AgentPoolDeleteMachinesParameter type or a IO type. Required. + :type machines: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolDeleteMachinesParameter 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 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._api_version or "2023-11-02-preview") + ) + 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._delete_machines_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + machines=machines, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_machines.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/deleteMachines" + } + + @distributed_trace + def get_available_agent_pool_versions( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPoolAvailableVersions + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.AgentPoolAvailableVersions] = kwargs.pop("cls", None) + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions" + } + + def _upgrade_node_image_version_initial( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> Optional[_models.AgentPool]: + 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._api_version or "2023-11-02-preview") + ) + cls: ClsType[Optional[_models.AgentPool]] = kwargs.pop("cls", None) + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion" + } + + @distributed_trace + def begin_upgrade_node_image_version( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.AgentPool] + :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._api_version or "2023-11-02-preview") + ) + 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._upgrade_node_image_version_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade_node_image_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_machines_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_machines_operations.py new file mode 100644 index 000000000000..a02194884aca --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_machines_operations.py @@ -0,0 +1,324 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, resource_name: str, agent_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + } + + _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_get_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + machine_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + "machineName": _SERIALIZER.url( + "machine_name", machine_name, "str", pattern=r"^[a-zA-Z0-9][-_a-zA-Z0-9]{0,39}$" + ), + } + + _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 MachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`machines` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> Iterable["_models.Machine"]: + """Gets a list of machines in the specified agent pool. + + Gets a list of machines in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Machine or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MachineListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MachineListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, machine_name: str, **kwargs: Any + ) -> _models.Machine: + """Get a specific machine in the specified agent pool. + + Get a specific machine in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param machine_name: host name of the machine. Required. + :type machine_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Machine or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Machine + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.Machine] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + machine_name=machine_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Machine", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..06652bfe2bb1 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_maintenance_configurations_operations.py @@ -0,0 +1,625 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_managed_cluster_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_request( + resource_group_name: str, resource_name: str, config_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_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, resource_name: str, config_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-11-02-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.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, config_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_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) + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_managed_cluster( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MaintenanceConfigurationListResult] = 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_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_managed_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MaintenanceConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :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: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a + MaintenanceConfiguration type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfiguration] = 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, "MaintenanceConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_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.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..2de6a7c3973b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,894 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_get_request(resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_or_update_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshotListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :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 ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshotListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots" + } + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterSnapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :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: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a + ManagedClusterSnapshot type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedClusterSnapshot] = 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, "ManagedClusterSnapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_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.ContainerService/managedclustersnapshots/{resourceName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedClusterSnapshot] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..2791994b112a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_managed_clusters_operations.py @@ -0,0 +1,4750 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_os_options_request( + location: str, subscription_id: str, *, resource_type: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if resource_type is not None: + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_kubernetes_versions_request(location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_list_request(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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_get_upgrade_profile_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_access_profile_request( + resource_group_name: str, resource_name: str, role_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_admin_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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 server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, _models.Format]] = 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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 server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_monitoring_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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 server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_or_update_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + ignore_pod_disruption_budget: Optional[bool] = 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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 ignore_pod_disruption_budget is not None: + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_reset_aad_profile_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_abort_latest_operation_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_run_command_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_command_result_request( + resource_group_name: str, resource_name: str, command_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "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_list_outbound_network_dependencies_endpoints_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_guardrails_versions_request( + location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "version": _SERIALIZER.url("version", version, "str", max_length=24, min_length=1), + } + + _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_list_guardrails_versions_request(location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_get_safeguards_versions_request( + location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "version": _SERIALIZER.url("version", version, "str", max_length=24, min_length=1), + } + + _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_list_safeguards_versions_request(location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_list_mesh_revision_profiles_request(location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_get_mesh_revision_profile_request( + location: str, mode: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "mode": _SERIALIZER.url( + "mode", + mode, + "str", + max_length=24, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_list_mesh_upgrade_profiles_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_mesh_upgrade_profile_request( + resource_group_name: str, resource_name: str, mode: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "mode": _SERIALIZER.url( + "mode", + mode, + "str", + max_length=24, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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) + + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get_os_options( + self, location: str, resource_type: Optional[str] = None, **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OSOptionProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OSOptionProfile] = kwargs.pop("cls", None) + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSOptionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default" + } + + @distributed_trace + def list_kubernetes_versions(self, location: str, **kwargs: Any) -> _models.KubernetesVersionListResult: + """Gets a list of supported Kubernetes versions in the specified subscription. + + Contains extra metadata on the version, including supported patch versions, capabilities, + available upgrades, and details on preview status of the version. + + :param location: The name of the Azure region. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KubernetesVersionListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.KubernetesVersionListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.KubernetesVersionListResult] = kwargs.pop("cls", None) + + request = build_list_kubernetes_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_kubernetes_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KubernetesVersionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_kubernetes_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :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 ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters" + } + + @distributed_trace + def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default" + } + + @distributed_trace + def get_access_profile( + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAccessProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedClusterAccessProfile] = kwargs.pop("cls", None) + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential" + } + + @distributed_trace + def list_cluster_admin_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential" + } + + @distributed_trace + def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, _models.Format]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure", "exec", and + "exec". Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2023_11_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential" + } + + @distributed_trace + def list_cluster_monitoring_user_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.CredentialResults + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.CredentialResults] = kwargs.pop("cls", None) + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential" + } + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.ManagedCluster] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, "ManagedCluster") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a ManagedCluster type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + def _update_tags_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject 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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedCluster] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedCluster] = 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_tags_initial( + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}" + } + + def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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, "ManagedClusterServicePrincipalProfile") + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reset_service_principal_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile" + } + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + :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: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + ManagedClusterServicePrincipalProfile type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterServicePrincipalProfile + 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 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._api_version or "2023-11-02-preview") + ) + 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._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_service_principal_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile" + } + + def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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, "ManagedClusterAADProfile") + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _reset_aad_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile" + } + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile + :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: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Please see `AKS-managed Azure Active Directory + integration `_ to update your cluster with AKS-managed Azure + AD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a + ManagedClusterAADProfile type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.ManagedClusterAADProfile 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 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._api_version or "2023-11-02-preview") + ) + 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._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_aad_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile" + } + + def _abort_latest_operation_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._abort_latest_operation_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _abort_latest_operation_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + } + + @distributed_trace + def begin_abort_latest_operation( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Aborts last operation running on managed cluster. + + Aborts the currently running operation on the managed cluster. The Managed Cluster will be + moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If + the operation completes before cancellation can take place, an error is returned. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._abort_latest_operation_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_abort_latest_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + } + + def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _rotate_cluster_certificates_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates" + } + + @distributed_trace + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_rotate_cluster_certificates.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates" + } + + def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_rotate_service_account_signing_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _rotate_service_account_signing_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + } + + @distributed_trace + def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._rotate_service_account_signing_keys_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_rotate_service_account_signing_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop" + } + + @distributed_trace + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start" + } + + @distributed_trace + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start" + } + + def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.RunCommandResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IOBase, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _run_command_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand" + } + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandRequest + :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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: 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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a RunCommandRequest type or a IO + type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandRequest 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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = 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._run_command_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_run_command.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand" + } + + @distributed_trace + def get_command_result( + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.RunCommandResult or 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._api_version or "2023-11-02-preview") + ) + cls: ClsType[Optional[_models.RunCommandResult]] = kwargs.pop("cls", None) + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get_command_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}" + } + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OutboundEnvironmentEndpoint] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = 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_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_outbound_network_dependencies_endpoints.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints" + } + + @distributed_trace + def get_guardrails_versions(self, location: str, version: str, **kwargs: Any) -> _models.GuardrailsAvailableVersion: + """Gets supported Guardrails version in the specified subscription and location. + + Contains Guardrails version along with its support info and whether it is a default version. + + :param location: The name of the Azure region. Required. + :type location: str + :param version: Safeguards version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuardrailsAvailableVersion or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.GuardrailsAvailableVersion] = kwargs.pop("cls", None) + + request = build_get_guardrails_versions_request( + location=location, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_guardrails_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GuardrailsAvailableVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_guardrails_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version}" + } + + @distributed_trace + def list_guardrails_versions(self, location: str, **kwargs: Any) -> Iterable["_models.GuardrailsAvailableVersion"]: + """Gets a list of supported Guardrails versions in the specified subscription and location. + + Contains list of Guardrails version along with its support info and whether it is a default + version. + + :param location: The name of the Azure region. 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 GuardrailsAvailableVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.GuardrailsAvailableVersion] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.GuardrailsAvailableVersionsList] = 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_guardrails_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_guardrails_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GuardrailsAvailableVersionsList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_guardrails_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions" + } + + @distributed_trace + def get_safeguards_versions(self, location: str, version: str, **kwargs: Any) -> _models.SafeguardsAvailableVersion: + """Gets supported Safeguards version in the specified subscription and location. + + Contains Safeguards version along with its support info and whether it is a default version. + + :param location: The name of the Azure region. Required. + :type location: str + :param version: Safeguards version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SafeguardsAvailableVersion or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SafeguardsAvailableVersion] = kwargs.pop("cls", None) + + request = build_get_safeguards_versions_request( + location=location, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_safeguards_versions.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SafeguardsAvailableVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_safeguards_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions/{version}" + } + + @distributed_trace + def list_safeguards_versions(self, location: str, **kwargs: Any) -> Iterable["_models.SafeguardsAvailableVersion"]: + """Gets a list of supported Safeguards versions in the specified subscription and location. + + Contains list of Safeguards version along with its support info and whether it is a default + version. + + :param location: The name of the Azure region. 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 SafeguardsAvailableVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.SafeguardsAvailableVersion] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SafeguardsAvailableVersionsList] = 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_safeguards_versions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_safeguards_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SafeguardsAvailableVersionsList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_safeguards_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/safeguardsVersions" + } + + @distributed_trace + def list_mesh_revision_profiles(self, location: str, **kwargs: Any) -> Iterable["_models.MeshRevisionProfile"]: + """Lists mesh revision profiles for all meshes in the specified location. + + Contains extra metadata on each revision, including supported revisions, cluster compatibility + and available upgrades. + + :param location: The name of the Azure region. 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 MeshRevisionProfile or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshRevisionProfileList] = 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_mesh_revision_profiles_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_mesh_revision_profiles.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MeshRevisionProfileList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_mesh_revision_profiles.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles" + } + + @distributed_trace + def get_mesh_revision_profile(self, location: str, mode: str, **kwargs: Any) -> _models.MeshRevisionProfile: + """Gets a mesh revision profile for a specified mesh in the specified location. + + Contains extra metadata on the revision, including supported revisions, cluster compatibility + and available upgrades. + + :param location: The name of the Azure region. Required. + :type location: str + :param mode: The mode of the mesh. Required. + :type mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MeshRevisionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshRevisionProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshRevisionProfile] = kwargs.pop("cls", None) + + request = build_get_mesh_revision_profile_request( + location=location, + mode=mode, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_mesh_revision_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MeshRevisionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_mesh_revision_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode}" + } + + @distributed_trace + def list_mesh_upgrade_profiles( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MeshUpgradeProfile"]: + """Lists available upgrades for all service meshes in a specific cluster. + + Lists available upgrades for all service meshes in a specific cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MeshUpgradeProfile or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshUpgradeProfileList] = 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_mesh_upgrade_profiles_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_mesh_upgrade_profiles.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MeshUpgradeProfileList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_mesh_upgrade_profiles.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles" + } + + @distributed_trace + def get_mesh_upgrade_profile( + self, resource_group_name: str, resource_name: str, mode: str, **kwargs: Any + ) -> _models.MeshUpgradeProfile: + """Gets available upgrades for a service mesh in a cluster. + + Gets available upgrades for a service mesh in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param mode: The mode of the mesh. Required. + :type mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MeshUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.MeshUpgradeProfile + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.MeshUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_mesh_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + mode=mode, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_mesh_upgrade_profile.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MeshUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_mesh_upgrade_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operation_status_result_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operation_status_result_operations.py new file mode 100644 index 000000000000..d31fd28a1a48 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operation_status_result_operations.py @@ -0,0 +1,429 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_request( + resource_group_name: str, resource_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations/{operationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), + } + + _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_get_by_agent_pool_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/operations/{operationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", agent_pool_name, "str", max_length=12, min_length=1, pattern=r"^[a-z][a-z0-9]{0,11}$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), + } + + _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 OperationStatusResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`operation_status_result` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OperationStatusResult"]: + """Gets a list of operations in the specified managedCluster. + + Gets a list of operations in the specified managedCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResultList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusResultList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatusResult: + """Get the status of a specific operation in the specified managed cluster. + + Get the status of a specific operation in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/operations/{operationId}" + } + + @distributed_trace + def get_by_agent_pool( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatusResult: + """Get the status of a specific operation in the specified agent pool. + + Get the status of a specific operation in the specified agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationStatusResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_by_agent_pool_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_by_agent_pool.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_agent_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/operations/{operationId}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operations.py new file mode 100644 index 000000000000..f29e507400a3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_operations.py @@ -0,0 +1,160 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(**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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.OperationValue] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..a66ab9499787 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,673 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_request( + resource_group_name: str, + resource_name: str, + private_endpoint_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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, + resource_name: str, + private_endpoint_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-11-02-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.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + private_endpoint_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_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) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnectionListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. 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.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.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.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a + PrivateEndpointConnection type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2023_11_02_preview.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 + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, private_endpoint_connection_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..0b82f6d010df --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,164 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +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, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResourcesListResult + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None) + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..e70960c602bc --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,250 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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) + + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :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: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a PrivateLinkResource type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.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 = case_insensitive_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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkResource] = 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, "PrivateLinkResource") + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_snapshots_operations.py new file mode 100644 index 000000000000..ed415730adf0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_snapshots_operations.py @@ -0,0 +1,878 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _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_get_request(resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_or_update_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_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-11-02-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.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`snapshots` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SnapshotListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :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 Snapshot or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.SnapshotListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots" + } + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :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: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a Snapshot type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = 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, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Snapshot", pipeline_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.ContainerService/snapshots/{resourceName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject + :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: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = 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, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..ce953ac0b880 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,808 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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, resource_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[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_get_request( + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", + trusted_access_role_binding_name, + "str", + max_length=24, + min_length=1, + pattern=r"^([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_or_update_request( + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_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-11-02-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.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", + trusted_access_role_binding_name, + "str", + max_length=24, + min_length=1, + pattern=r"^([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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", + trusted_access_role_binding_name, + "str", + max_length=24, + min_length=1, + pattern=r"^([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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.TrustedAccessRoleBinding"]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleBindingListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBindingListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings" + } + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleBinding] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedAccessRoleBinding] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IOBase, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + + 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.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding + :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 TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: 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 TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> LROPoller[_models.TrustedAccessRoleBinding]: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a + TrustedAccessRoleBinding type or a IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding 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 TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRoleBinding] + :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._api_version or "2023-11-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TrustedAccessRoleBinding] = 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, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + trusted_access_role_binding=trusted_access_role_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_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._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-11-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..c0a64224ca62 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/operations/_trusted_access_roles_operations.py @@ -0,0 +1,175 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(location: 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-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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 TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2023_11_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_roles` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.TrustedAccessRole"]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of the Azure region. 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 TrustedAccessRole or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2023_11_02_preview.models.TrustedAccessRole] + :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._api_version or "2023-11-02-preview") + ) + cls: ClsType[_models.TrustedAccessRoleListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles" + } diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2023_11_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json index 1caa03ff82fa..d3eb698479c9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json @@ -1,18 +1,19 @@ { - "commit": "1f0722d117a66ec48674c9644f786972d57a29b5", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md", - "package-2023-06-preview": "2023-09-25 18:13:20 -0700 3f4960b89849332a527280332fab992a4e99e0f0 preview/2023-06-15-preview/fleets.json", - "package-2023-03-preview": "2023-09-25 18:13:20 -0700 3f4960b89849332a527280332fab992a4e99e0f0 preview/2023-03-15-preview/fleets.json", - "package-2022-09-preview": "2023-08-24 23:54:30 -0700 802fc0a5edd13b96e8a6aeadb742657188e9e866 preview/2022-09-02-preview/fleets.json", + "package-2023-06-preview": "2024-02-04 17:43:16 -0800 409c7eecd602e02f7998915796d8b2d290e817ba preview/2023-06-15-preview/fleets.json", + "package-2023-03-preview": "2024-02-04 17:43:16 -0800 409c7eecd602e02f7998915796d8b2d290e817ba preview/2023-03-15-preview/fleets.json", + "package-2022-09-preview": "2024-02-12 15:32:39 -0800 764a782d02506c70bc4c43308f5be488d5fd543e preview/2022-09-02-preview/fleets.json", "package-2022-07-preview": "2023-02-15 15:17:59 +0800 67527326606bd3c71700e2b96ff3c9ce9e655e29 preview/2022-07-02-preview/fleets.json", "package-2022-06-preview": "2023-02-15 15:17:59 +0800 67527326606bd3c71700e2b96ff3c9ce9e655e29 preview/2022-06-02-preview/fleets.json", - "package-2023-08-preview": "2023-09-25 18:13:20 -0700 3f4960b89849332a527280332fab992a4e99e0f0 preview/2023-08-15-preview/fleets.json", - "package-2023-10": "2023-10-19 11:14:26 -0700 8f889f0967e411fc1042aed0a097868b360f525a stable/2023-10-15/fleets.json" + "package-2023-08-preview": "2024-02-04 17:43:16 -0800 409c7eecd602e02f7998915796d8b2d290e817ba preview/2023-08-15-preview/fleets.json", + "package-2023-10": "2024-02-04 17:43:16 -0800 409c7eecd602e02f7998915796d8b2d290e817ba stable/2023-10-15/fleets.json", + "package-2024-02-preview": "2024-02-13 14:56:59 -0800 52aa4b1bcedff239e6c68f87021ec906c3762409 preview/2024-02-02-preview/fleets.json" } \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py index 9e8c3731dc26..c42b764d9cb4 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py @@ -95,6 +95,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-06-15-preview: :mod:`v2023_06_15_preview.models` * 2023-08-15-preview: :mod:`v2023_08_15_preview.models` * 2023-10-15: :mod:`v2023_10_15.models` + * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` """ if api_version == '2022-09-02-preview': from .v2022_06_02_preview import models @@ -117,6 +118,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-10-15': from .v2023_10_15 import models return models + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -130,6 +134,7 @@ def fleet_members(self): * 2023-06-15-preview: :class:`FleetMembersOperations` * 2023-08-15-preview: :class:`FleetMembersOperations` * 2023-10-15: :class:`FleetMembersOperations` + * 2024-02-02-preview: :class:`FleetMembersOperations` """ api_version = self._get_api_version('fleet_members') if api_version == '2022-09-02-preview': @@ -146,6 +151,8 @@ def fleet_members(self): from .v2023_08_15_preview.operations import FleetMembersOperations as OperationClass elif api_version == '2023-10-15': from .v2023_10_15.operations import FleetMembersOperations as OperationClass + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) self._config.api_version = api_version @@ -157,12 +164,15 @@ def fleet_update_strategies(self): * 2023-08-15-preview: :class:`FleetUpdateStrategiesOperations` * 2023-10-15: :class:`FleetUpdateStrategiesOperations` + * 2024-02-02-preview: :class:`FleetUpdateStrategiesOperations` """ api_version = self._get_api_version('fleet_update_strategies') if api_version == '2023-08-15-preview': from .v2023_08_15_preview.operations import FleetUpdateStrategiesOperations as OperationClass elif api_version == '2023-10-15': from .v2023_10_15.operations import FleetUpdateStrategiesOperations as OperationClass + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview.operations import FleetUpdateStrategiesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_update_strategies'".format(api_version)) self._config.api_version = api_version @@ -179,6 +189,7 @@ def fleets(self): * 2023-06-15-preview: :class:`FleetsOperations` * 2023-08-15-preview: :class:`FleetsOperations` * 2023-10-15: :class:`FleetsOperations` + * 2024-02-02-preview: :class:`FleetsOperations` """ api_version = self._get_api_version('fleets') if api_version == '2022-09-02-preview': @@ -195,6 +206,8 @@ def fleets(self): from .v2023_08_15_preview.operations import FleetsOperations as OperationClass elif api_version == '2023-10-15': from .v2023_10_15.operations import FleetsOperations as OperationClass + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) self._config.api_version = api_version @@ -209,6 +222,7 @@ def operations(self): * 2023-06-15-preview: :class:`Operations` * 2023-08-15-preview: :class:`Operations` * 2023-10-15: :class:`Operations` + * 2024-02-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2022-09-02-preview': @@ -221,6 +235,8 @@ def operations(self): from .v2023_08_15_preview.operations import Operations as OperationClass elif api_version == '2023-10-15': from .v2023_10_15.operations import Operations as OperationClass + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -234,6 +250,7 @@ def update_runs(self): * 2023-06-15-preview: :class:`UpdateRunsOperations` * 2023-08-15-preview: :class:`UpdateRunsOperations` * 2023-10-15: :class:`UpdateRunsOperations` + * 2024-02-02-preview: :class:`UpdateRunsOperations` """ api_version = self._get_api_version('update_runs') if api_version == '2023-03-15-preview': @@ -244,6 +261,8 @@ def update_runs(self): from .v2023_08_15_preview.operations import UpdateRunsOperations as OperationClass elif api_version == '2023-10-15': from .v2023_10_15.operations import UpdateRunsOperations as OperationClass + elif api_version == '2024-02-02-preview': + from .v2024_02_02_preview.operations import UpdateRunsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'update_runs'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py index 66185c3c4eca..ad76f5970a44 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py @@ -95,6 +95,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2023-06-15-preview: :mod:`v2023_06_15_preview.models` * 2023-08-15-preview: :mod:`v2023_08_15_preview.models` * 2023-10-15: :mod:`v2023_10_15.models` + * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` """ if api_version == '2022-09-02-preview': from ..v2022_06_02_preview import models @@ -117,6 +118,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2023-10-15': from ..v2023_10_15 import models return models + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -130,6 +134,7 @@ def fleet_members(self): * 2023-06-15-preview: :class:`FleetMembersOperations` * 2023-08-15-preview: :class:`FleetMembersOperations` * 2023-10-15: :class:`FleetMembersOperations` + * 2024-02-02-preview: :class:`FleetMembersOperations` """ api_version = self._get_api_version('fleet_members') if api_version == '2022-09-02-preview': @@ -146,6 +151,8 @@ def fleet_members(self): from ..v2023_08_15_preview.aio.operations import FleetMembersOperations as OperationClass elif api_version == '2023-10-15': from ..v2023_10_15.aio.operations import FleetMembersOperations as OperationClass + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview.aio.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) self._config.api_version = api_version @@ -157,12 +164,15 @@ def fleet_update_strategies(self): * 2023-08-15-preview: :class:`FleetUpdateStrategiesOperations` * 2023-10-15: :class:`FleetUpdateStrategiesOperations` + * 2024-02-02-preview: :class:`FleetUpdateStrategiesOperations` """ api_version = self._get_api_version('fleet_update_strategies') if api_version == '2023-08-15-preview': from ..v2023_08_15_preview.aio.operations import FleetUpdateStrategiesOperations as OperationClass elif api_version == '2023-10-15': from ..v2023_10_15.aio.operations import FleetUpdateStrategiesOperations as OperationClass + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview.aio.operations import FleetUpdateStrategiesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_update_strategies'".format(api_version)) self._config.api_version = api_version @@ -179,6 +189,7 @@ def fleets(self): * 2023-06-15-preview: :class:`FleetsOperations` * 2023-08-15-preview: :class:`FleetsOperations` * 2023-10-15: :class:`FleetsOperations` + * 2024-02-02-preview: :class:`FleetsOperations` """ api_version = self._get_api_version('fleets') if api_version == '2022-09-02-preview': @@ -195,6 +206,8 @@ def fleets(self): from ..v2023_08_15_preview.aio.operations import FleetsOperations as OperationClass elif api_version == '2023-10-15': from ..v2023_10_15.aio.operations import FleetsOperations as OperationClass + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview.aio.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) self._config.api_version = api_version @@ -209,6 +222,7 @@ def operations(self): * 2023-06-15-preview: :class:`Operations` * 2023-08-15-preview: :class:`Operations` * 2023-10-15: :class:`Operations` + * 2024-02-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2022-09-02-preview': @@ -221,6 +235,8 @@ def operations(self): from ..v2023_08_15_preview.aio.operations import Operations as OperationClass elif api_version == '2023-10-15': from ..v2023_10_15.aio.operations import Operations as OperationClass + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -234,6 +250,7 @@ def update_runs(self): * 2023-06-15-preview: :class:`UpdateRunsOperations` * 2023-08-15-preview: :class:`UpdateRunsOperations` * 2023-10-15: :class:`UpdateRunsOperations` + * 2024-02-02-preview: :class:`UpdateRunsOperations` """ api_version = self._get_api_version('update_runs') if api_version == '2023-03-15-preview': @@ -244,6 +261,8 @@ def update_runs(self): from ..v2023_08_15_preview.aio.operations import UpdateRunsOperations as OperationClass elif api_version == '2023-10-15': from ..v2023_10_15.aio.operations import UpdateRunsOperations as OperationClass + elif api_version == '2024-02-02-preview': + from ..v2024_02_02_preview.aio.operations import UpdateRunsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'update_runs'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py index b5ce99fc042d..98d80899ec38 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py @@ -63,9 +63,11 @@ class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of upgrade to perform when targeting ManagedClusters.""" FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters.""" + """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters.""" + """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py index 37ed758b4245..68e5a5aba07b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py @@ -631,10 +631,8 @@ class ManagedClusterUpgradeSpec(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :vartype type: str or ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeType :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. @@ -658,10 +656,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :paramtype type: str or ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeType :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py index 0cb0a311ffe2..160dc6d5fd10 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py @@ -757,7 +757,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py index bd759aa494f6..69d91385f8c9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py @@ -802,7 +802,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py index 1704bc43a977..364a80a0c983 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py @@ -63,9 +63,11 @@ class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of upgrade to perform when targeting ManagedClusters.""" FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters.""" + """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters.""" + """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py index 66b42c01e0cf..5d26471ef91b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py @@ -758,10 +758,8 @@ class ManagedClusterUpgradeSpec(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :vartype type: str or ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeType :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. @@ -785,10 +783,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :paramtype type: str or ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeType :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py index 39b05450d833..19e55ebeb92e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py @@ -992,7 +992,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py index 9ca8dcd1009b..690b4daf27e7 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py @@ -1042,7 +1042,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py index ab8f37ad8e3e..25a134e29096 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py @@ -757,7 +757,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py index fd8e3f4ae712..de2e08e891d6 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py @@ -802,7 +802,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py index 330375adbee9..87e96ce6dd8a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py @@ -74,9 +74,11 @@ class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of upgrade to perform when targeting ManagedClusters.""" FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters.""" + """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters.""" + """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py index 9b5af6b8a0c9..4f851763ffe7 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py @@ -866,10 +866,8 @@ class ManagedClusterUpgradeSpec(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :vartype type: str or ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeType :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. @@ -893,10 +891,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :paramtype type: str or ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeType :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py index 151407f65d3a..16f4b2cef656 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py @@ -992,7 +992,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py index f264a4ed7203..f64d931d18e9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py @@ -1042,7 +1042,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py index 5cbb8ecc8cf4..5f8d5e58e3aa 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py @@ -743,7 +743,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py index 857a48aa8c59..cbec5bd23d78 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py @@ -788,7 +788,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py index 330375adbee9..87e96ce6dd8a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py @@ -74,9 +74,11 @@ class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of upgrade to perform when targeting ManagedClusters.""" FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters.""" + """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters.""" + """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py index 0ea3655f9d55..957c7b17adec 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py @@ -711,10 +711,8 @@ class ManagedClusterUpgradeSpec(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :vartype type: str or ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeType :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. @@ -738,10 +736,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword type: The upgrade type. - Full requires the KubernetesVersion property to be set. - NodeImageOnly requires the KubernetesVersion property not to be set. Required. Known values - are: "Full" and "NodeImageOnly". + :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full" and "NodeImageOnly". :paramtype type: str or ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeType :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py index 2cc1b73e1664..6da19f8b0efb 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py @@ -978,7 +978,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py index 9c5c28cd4813..f6983bba250d 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py @@ -1028,7 +1028,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py new file mode 100644 index 000000000000..78b8b4b91a49 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ContainerServiceFleetMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py new file mode 100644 index 000000000000..0999a0e469c8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerServiceFleetMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceFleetMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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 "2024-02-02-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(ContainerServiceFleetMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-02-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py new file mode 100644 index 000000000000..0325cd0f7c68 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceFleetMgmtClientConfiguration +from .operations import ( + FleetMembersOperations, + FleetUpdateStrategiesOperations, + FleetsOperations, + Operations, + UpdateRunsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """Azure Kubernetes Fleet Manager api client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.Operations + :ivar fleets: FleetsOperations operations + :vartype fleets: + azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetMembersOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: + azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.UpdateRunsOperations + :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations + :vartype fleet_update_strategies: + azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetUpdateStrategiesOperations + :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 "2024-02-02-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceFleetMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.update_runs = UpdateRunsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleet_update_strategies = FleetUpdateStrategiesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "ContainerServiceFleetMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json new file mode 100644 index 000000000000..49105d88af8e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json @@ -0,0 +1,114 @@ +{ + "chosen_version": "2024-02-02-preview", + "total_api_version_list": ["2024-02-02-preview"], + "client": { + "name": "ContainerServiceFleetMgmtClient", + "filename": "_container_service_fleet_mgmt_client", + "description": "Azure Kubernetes Fleet Manager api client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "fleets": "FleetsOperations", + "fleet_members": "FleetMembersOperations", + "update_runs": "UpdateRunsOperations", + "fleet_update_strategies": "FleetUpdateStrategiesOperations" + } +} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py new file mode 100644 index 000000000000..af1d7b0b47fe --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ContainerServiceFleetMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..de1793ec6bed --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerServiceFleetMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceFleetMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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 "2024-02-02-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(ContainerServiceFleetMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-02-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py new file mode 100644 index 000000000000..79acd44d663e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceFleetMgmtClientConfiguration +from .operations import ( + FleetMembersOperations, + FleetUpdateStrategiesOperations, + FleetsOperations, + Operations, + UpdateRunsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """Azure Kubernetes Fleet Manager api client. + + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.Operations + :ivar fleets: FleetsOperations operations + :vartype fleets: + azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetMembersOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: + azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.UpdateRunsOperations + :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations + :vartype fleet_update_strategies: + azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetUpdateStrategiesOperations + :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 "2024-02-02-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceFleetMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.update_runs = UpdateRunsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + self.fleet_update_strategies = FleetUpdateStrategiesOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerServiceFleetMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..2233c34e005a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations +from ._update_runs_operations import UpdateRunsOperations +from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations + +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", + "FleetsOperations", + "FleetMembersOperations", + "UpdateRunsOperations", + "FleetUpdateStrategiesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..0e99d00ac719 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py @@ -0,0 +1,922 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._fleet_members_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_fleet_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s + :attr:`fleet_members` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FleetMember"]: + """List FleetMember resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMember or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetMemberListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.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("FleetMemberListResult", 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_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any + ) -> _models.FleetMember: + """Get a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_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 = 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("FleetMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + async def _create_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "FleetMember") + + request = build_create_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FleetMember", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("FleetMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Is either a FleetMember type or a IO type. + Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = 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, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetMember", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + async def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: Union[_models.FleetMemberUpdate, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.FleetMember]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FleetMember]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "FleetMemberUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("FleetMember", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: _models.FleetMemberUpdate, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Required. + :type properties: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: Union[_models.FleetMemberUpdate, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or + a IO type. Required. + :type properties: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = 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, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + properties=properties, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetMember", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2024-02-02-preview") + ) + 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, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py new file mode 100644 index 000000000000..55e70d4d39aa --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py @@ -0,0 +1,656 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._fleet_update_strategies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_fleet_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FleetUpdateStrategiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s + :attr:`fleet_update_strategies` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FleetUpdateStrategy"]: + """List FleetUpdateStrategy resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetUpdateStrategyListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.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("FleetUpdateStrategyListResult", 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_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any + ) -> _models.FleetUpdateStrategy: + """Get a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetUpdateStrategy or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_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 = 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("FleetUpdateStrategy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: Union[_models.FleetUpdateStrategy, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetUpdateStrategy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "FleetUpdateStrategy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: _models.FleetUpdateStrategy, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Required. + :type resource: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: Union[_models.FleetUpdateStrategy, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a IO type. + Required. + :type resource: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetUpdateStrategy] = 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, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2024-02-02-preview") + ) + 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, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py new file mode 100644 index 000000000000..72d5df5ef941 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py @@ -0,0 +1,1020 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._fleets_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_list_credentials_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s + :attr:`fleets` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: + """Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetListResult] = 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, + 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("FleetListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: + """Lists fleets in the specified subscription and resource group. + + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetListResult] = 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, + 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("FleetListResult", 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.ContainerService/fleets" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: + """Gets a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_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 = 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("Fleet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + resource: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Fleet") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Fleet", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Fleet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Is either a Fleet type or a IO type. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = 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, + fleet_name=fleet_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Fleet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + async def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + properties: Union[_models.FleetPatch, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.Fleet]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Fleet]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "FleetPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Fleet", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: _models.FleetPatch, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: Union[_models.FleetPatch, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Is either a FleetPatch type or a IO + type. Required. + :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = 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, + fleet_name=fleet_name, + properties=properties, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Fleet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2024-02-02-preview") + ) + 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, + fleet_name=fleet_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @distributed_trace_async + async def list_credentials( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResults + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.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("FleetCredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..80d698a2f57e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py @@ -0,0 +1,137 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py new file mode 100644 index 000000000000..0d7ea82933fd --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py @@ -0,0 +1,1228 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._update_runs_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_fleet_request, + build_skip_request, + build_start_request, + build_stop_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class UpdateRunsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s + :attr:`update_runs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UpdateRun"]: + """List UpdateRun resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateRun or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRunListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.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("UpdateRunListResult", 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_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any + ) -> _models.UpdateRun: + """Get a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_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 = 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("UpdateRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: Union[_models.UpdateRun, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.UpdateRun: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "UpdateRun") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: _models.UpdateRun, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: Union[_models.UpdateRun, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Is either a UpdateRun type or a IO type. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = 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, + fleet_name=fleet_name, + update_run_name=update_run_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2024-02-02-preview") + ) + 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, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + async def _skip_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: Union[_models.SkipProperties, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.UpdateRun]] = 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, "SkipProperties") + + request = build_skip_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._skip_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _skip_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip" + } + + @overload + async def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: _models.SkipProperties, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Required. + :type body: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: Union[_models.SkipProperties, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Is either a SkipProperties type or a IO type. + Required. + :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = 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._skip_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + body=body, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_skip.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip" + } + + async def _start_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + 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._api_version or "2024-02-02-preview") + ) + cls: ClsType[Optional[_models.UpdateRun]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start" + } + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Starts an UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = 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._start_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + 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): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start" + } + + async def _stop_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + 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._api_version or "2024-02-02-preview") + ) + cls: ClsType[Optional[_models.UpdateRun]] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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]: + map_error(status_code=response.status_code, 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("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.UpdateRun]: + """Stops an UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 UpdateRun or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = 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._stop_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + 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): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py new file mode 100644 index 000000000000..3d046c826956 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import APIServerAccessProfile +from ._models_py3 import AgentProfile +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Fleet +from ._models_py3 import FleetCredentialResult +from ._models_py3 import FleetCredentialResults +from ._models_py3 import FleetHubProfile +from ._models_py3 import FleetListResult +from ._models_py3 import FleetMember +from ._models_py3 import FleetMemberListResult +from ._models_py3 import FleetMemberUpdate +from ._models_py3 import FleetPatch +from ._models_py3 import FleetUpdateStrategy +from ._models_py3 import FleetUpdateStrategyListResult +from ._models_py3 import ManagedClusterUpdate +from ._models_py3 import ManagedClusterUpgradeSpec +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MemberUpdateStatus +from ._models_py3 import NodeImageSelection +from ._models_py3 import NodeImageSelectionStatus +from ._models_py3 import NodeImageVersion +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import SkipProperties +from ._models_py3 import SkipTarget +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateGroup +from ._models_py3 import UpdateGroupStatus +from ._models_py3 import UpdateRun +from ._models_py3 import UpdateRunListResult +from ._models_py3 import UpdateRunStatus +from ._models_py3 import UpdateRunStrategy +from ._models_py3 import UpdateStage +from ._models_py3 import UpdateStageStatus +from ._models_py3 import UpdateStatus +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import WaitStatus + +from ._container_service_fleet_mgmt_client_enums import ActionType +from ._container_service_fleet_mgmt_client_enums import CreatedByType +from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState +from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState +from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState +from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType +from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType +from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType +from ._container_service_fleet_mgmt_client_enums import Origin +from ._container_service_fleet_mgmt_client_enums import TargetType +from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState +from ._container_service_fleet_mgmt_client_enums import UpdateState +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "APIServerAccessProfile", + "AgentProfile", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "Fleet", + "FleetCredentialResult", + "FleetCredentialResults", + "FleetHubProfile", + "FleetListResult", + "FleetMember", + "FleetMemberListResult", + "FleetMemberUpdate", + "FleetPatch", + "FleetUpdateStrategy", + "FleetUpdateStrategyListResult", + "ManagedClusterUpdate", + "ManagedClusterUpgradeSpec", + "ManagedServiceIdentity", + "MemberUpdateStatus", + "NodeImageSelection", + "NodeImageSelectionStatus", + "NodeImageVersion", + "Operation", + "OperationDisplay", + "OperationListResult", + "ProxyResource", + "Resource", + "SkipProperties", + "SkipTarget", + "SystemData", + "TrackedResource", + "UpdateGroup", + "UpdateGroupStatus", + "UpdateRun", + "UpdateRunListResult", + "UpdateRunStatus", + "UpdateRunStrategy", + "UpdateStage", + "UpdateStageStatus", + "UpdateStatus", + "UserAssignedIdentity", + "WaitStatus", + "ActionType", + "CreatedByType", + "FleetMemberProvisioningState", + "FleetProvisioningState", + "FleetUpdateStrategyProvisioningState", + "ManagedClusterUpgradeType", + "ManagedServiceIdentityType", + "NodeImageSelectionType", + "Origin", + "TargetType", + "UpdateRunProvisioningState", + "UpdateState", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py new file mode 100644 index 000000000000..e19a0acee23f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + JOINING = "Joining" + """The provisioning state of a member joining a fleet.""" + LEAVING = "Leaving" + """The provisioning state of a member leaving a fleet.""" + UPDATING = "Updating" + """The provisioning state of a member being updated.""" + + +class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + CREATING = "Creating" + """The provisioning state of a fleet being created.""" + UPDATING = "Updating" + """The provisioning state of a fleet being updated.""" + DELETING = "Deleting" + """The provisioning state of a fleet being deleted.""" + + +class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the UpdateStrategy resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of upgrade to perform when targeting ManagedClusters.""" + + FULL = "Full" + """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" + NODE_IMAGE_ONLY = "NodeImageOnly" + """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the + #: ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" + CONTROL_PLANE_ONLY = "ControlPlaneOnly" + """ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will + #: not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion + #: property to be set.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + + +class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The node image upgrade type.""" + + LATEST = "Latest" + """Use the latest image version when upgrading nodes. Clusters may use different image versions + #: (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') + #: because, for example, the latest available version is different in different regions.""" + CONSISTENT = "Consistent" + """The image versions to upgrade nodes to are selected as described below: for each node pool in + #: managed clusters affected by the update run, the system selects the latest image version such + #: that it is available across all other node pools (in all other clusters) of the same image + #: type. As a result, all node pools of the same image type will be upgraded to the same image + #: version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' + #: is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is + #: 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system + #: will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" + + +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 TargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The target type of a skip request.""" + + MEMBER = "Member" + """Skip the update of a member.""" + GROUP = "Group" + """Skip the update of a group.""" + STAGE = "Stage" + """Skip the update of an entire stage including the after stage wait.""" + AFTER_STAGE_WAIT = "AfterStageWait" + """Skip the update of the after stage wait of a certain stage.""" + + +class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the UpdateRun resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" + + NOT_STARTED = "NotStarted" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" + RUNNING = "Running" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" + STOPPING = "Stopping" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" + STOPPED = "Stopped" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" + SKIPPED = "Skipped" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" + FAILED = "Failed" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" + COMPLETED = "Completed" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..ee904cd98faf --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py @@ -0,0 +1,1823 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class AgentProfile(_serialization.Model): + """Agent profile for the Fleet hub. + + :ivar subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this is + not specified, a vnet and subnet will be generated and used. + :vartype subnet_id: str + :ivar vm_size: The virtual machine size of the Fleet hub. + :vartype vm_size: str + """ + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + } + + def __init__(self, *, subnet_id: Optional[str] = None, vm_size: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this + is not specified, a vnet and subnet will be generated and used. + :paramtype subnet_id: str + :keyword vm_size: The virtual machine size of the Fleet hub. + :paramtype vm_size: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.vm_size = vm_size + + +class APIServerAccessProfile(_serialization.Model): + """Access profile for the Fleet hub API server. + + :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. + :vartype enable_private_cluster: bool + :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub + or not. + :vartype enable_vnet_integration: bool + :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is + required when creating a new Fleet with BYO vnet. + :vartype subnet_id: str + """ + + _attribute_map = { + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + } + + def __init__( + self, + *, + enable_private_cluster: Optional[bool] = None, + enable_vnet_integration: Optional[bool] = None, + subnet_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. + :paramtype enable_private_cluster: bool + :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet + hub or not. + :paramtype enable_vnet_integration: bool + :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is + required when creating a new Fleet with BYO vnet. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) + self.enable_private_cluster = enable_private_cluster + self.enable_vnet_integration = enable_vnet_integration + self.subnet_id = subnet_id + + +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.containerservicefleet.v2024_02_02_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.containerservicefleet.v2024_02_02_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Fleet(TrackedResource): + """The Fleet 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}. + :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.containerservicefleet.v2024_02_02_preview.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 e_tag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + :vartype e_tag: str + :ivar identity: Managed identity. + :vartype identity: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetProvisioningState + :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. + :vartype hub_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetHubProfile + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "e_tag": {"readonly": True}, + "provisioning_state": {"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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "e_tag": {"key": "eTag", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + hub_profile: Optional["_models.FleetHubProfile"] = 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 identity. + :paramtype identity: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity + :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. + :paramtype hub_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetHubProfile + """ + super().__init__(tags=tags, location=location, **kwargs) + self.e_tag = None + self.identity = identity + self.provisioning_state = None + self.hub_profile = hub_profile + + +class FleetCredentialResult(_serialization.Model): + """One credential result item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class FleetCredentialResults(_serialization.Model): + """The Credential results response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. + :vartype kubeconfigs: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResult] + """ + + _validation = { + "kubeconfigs": {"readonly": True}, + } + + _attribute_map = { + "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kubeconfigs = None + + +class FleetHubProfile(_serialization.Model): + """The FleetHubProfile configures the fleet hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :vartype dns_prefix: str + :ivar api_server_access_profile: The access profile for the Fleet hub API server. + :vartype api_server_access_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.APIServerAccessProfile + :ivar agent_profile: The agent profile for the Fleet hub. + :vartype agent_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.AgentProfile + :ivar fqdn: The FQDN of the Fleet hub. + :vartype fqdn: str + :ivar kubernetes_version: The Kubernetes version of the Fleet hub. + :vartype kubernetes_version: str + :ivar portal_fqdn: The Azure Portal FQDN of the Fleet hub. + :vartype portal_fqdn: str + """ + + _validation = { + "dns_prefix": { + "max_length": 54, + "min_length": 1, + "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", + }, + "fqdn": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "portal_fqdn": {"readonly": True}, + } + + _attribute_map = { + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "api_server_access_profile": {"key": "apiServerAccessProfile", "type": "APIServerAccessProfile"}, + "agent_profile": {"key": "agentProfile", "type": "AgentProfile"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "portal_fqdn": {"key": "portalFqdn", "type": "str"}, + } + + def __init__( + self, + *, + dns_prefix: Optional[str] = None, + api_server_access_profile: Optional["_models.APIServerAccessProfile"] = None, + agent_profile: Optional["_models.AgentProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :paramtype dns_prefix: str + :keyword api_server_access_profile: The access profile for the Fleet hub API server. + :paramtype api_server_access_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.APIServerAccessProfile + :keyword agent_profile: The agent profile for the Fleet hub. + :paramtype agent_profile: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.AgentProfile + """ + super().__init__(**kwargs) + self.dns_prefix = dns_prefix + self.api_server_access_profile = api_server_access_profile + self.agent_profile = agent_profile + self.fqdn = None + self.kubernetes_version = None + self.portal_fqdn = None + + +class FleetListResult(_serialization.Model): + """The response of a Fleet list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Fleet items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Fleet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Fleet items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + 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.containerservicefleet.v2024_02_02_preview.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class FleetMember(ProxyResource): + """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. + + 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.containerservicefleet.v2024_02_02_preview.models.SystemData + :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + :vartype e_tag: str + :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a + valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + :vartype cluster_resource_id: str + :ivar group: The group this member belongs to for multi-cluster update management. + :vartype group: str + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Joining", "Leaving", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"readonly": True}, + "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + "provisioning_state": {"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"}, + "e_tag": {"key": "eTag", "type": "str"}, + "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, + "group": {"key": "properties.group", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be + a valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + :paramtype cluster_resource_id: str + :keyword group: The group this member belongs to for multi-cluster update management. + :paramtype group: str + """ + super().__init__(**kwargs) + self.e_tag = None + self.cluster_resource_id = cluster_resource_id + self.group = group + self.provisioning_state = None + + +class FleetMemberListResult(_serialization.Model): + """The response of a FleetMember list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The FleetMember items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FleetMember]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The FleetMember items on this page. Required. + :paramtype value: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class FleetMemberUpdate(_serialization.Model): + """The type used for update operations of the FleetMember. + + :ivar group: The group this member belongs to for multi-cluster update management. + :vartype group: str + """ + + _validation = { + "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + } + + _attribute_map = { + "group": {"key": "properties.group", "type": "str"}, + } + + def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword group: The group this member belongs to for multi-cluster update management. + :paramtype group: str + """ + super().__init__(**kwargs) + self.group = group + + +class FleetPatch(_serialization.Model): + """Properties of a Fleet that can be patched. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed identity. + :vartype identity: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed identity. + :paramtype identity: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class FleetUpdateStrategy(ProxyResource): + """Defines a multi-stage process to perform update operations across members of a Fleet. + + 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.containerservicefleet.v2024_02_02_preview.models.SystemData + :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + :vartype e_tag: str + :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values + are: "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategyProvisioningState + :ivar strategy: Defines the update sequence of the clusters. + :vartype strategy: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"readonly": True}, + "provisioning_state": {"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"}, + "e_tag": {"key": "eTag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, + } + + def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: + """ + :keyword strategy: Defines the update sequence of the clusters. + :paramtype strategy: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy + """ + super().__init__(**kwargs) + self.e_tag = None + self.provisioning_state = None + self.strategy = strategy + + +class FleetUpdateStrategyListResult(_serialization.Model): + """The response of a FleetUpdateStrategy list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The FleetUpdateStrategy items on this page. Required. + :vartype value: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The FleetUpdateStrategy items on this page. Required. + :paramtype value: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ManagedClusterUpdate(_serialization.Model): + """The update to be applied to the ManagedClusters. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. + :vartype upgrade: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeSpec + :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update + run. + :vartype node_image_selection: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelection + """ + + _validation = { + "upgrade": {"required": True}, + } + + _attribute_map = { + "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, + "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, + } + + def __init__( + self, + *, + upgrade: "_models.ManagedClusterUpgradeSpec", + node_image_selection: Optional["_models.NodeImageSelection"] = None, + **kwargs: Any + ) -> None: + """ + :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. + :paramtype upgrade: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeSpec + :keyword node_image_selection: The node image upgrade to be applied to the target nodes in + update run. + :paramtype node_image_selection: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelection + """ + super().__init__(**kwargs) + self.upgrade = upgrade + self.node_image_selection = node_image_selection + + +class ManagedClusterUpgradeSpec(_serialization.Model): + """The upgrade to apply to a ManagedCluster. + + All required parameters must be populated in order to send to Azure. + + :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". + :vartype type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeType + :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. + :vartype kubernetes_version: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedClusterUpgradeType"], + kubernetes_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known + values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". + :paramtype type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeType + :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. + :paramtype kubernetes_version: str + """ + super().__init__(**kwargs) + self.type = type + self.kubernetes_version = kubernetes_version + + +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 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". + :vartype type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MemberUpdateStatus(_serialization.Model): + """The status of a member update operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the MemberUpdate operation. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus + :ivar name: The name of the FleetMember. + :vartype name: str + :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. + :vartype cluster_resource_id: str + :ivar operation_id: The operation resource id of the latest attempt to perform the operation. + :vartype operation_id: str + :ivar message: The status message after processing the member update operation. + :vartype message: str + """ + + _validation = { + "status": {"readonly": True}, + "name": {"readonly": True}, + "cluster_resource_id": {"readonly": True}, + "operation_id": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "UpdateStatus"}, + "name": {"key": "name", "type": "str"}, + "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, + "operation_id": {"key": "operationId", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.name = None + self.cluster_resource_id = None + self.operation_id = None + self.message = None + + +class NodeImageSelection(_serialization.Model): + """The node image upgrade to be applied to the target nodes in update run. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". + :vartype type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: + """ + :keyword type: The node image upgrade type. Required. Known values are: "Latest" and + "Consistent". + :paramtype type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionType + """ + super().__init__(**kwargs) + self.type = type + + +class NodeImageSelectionStatus(_serialization.Model): + """The node image upgrade specs for the update run. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar selected_node_image_versions: The image versions to upgrade the nodes to. + :vartype selected_node_image_versions: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageVersion] + """ + + _validation = { + "selected_node_image_versions": {"readonly": True}, + } + + _attribute_map = { + "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.selected_node_image_versions = None + + +class NodeImageVersion(_serialization.Model): + """The node upgrade image version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The image version to upgrade the nodes to (e.g., + 'AKSUbuntu-1804gen2containerd-2022.12.13'). + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + + +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 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.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.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.containerservicefleet.v2024_02_02_preview.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class SkipProperties(_serialization.Model): + """The properties of a skip operation containing multiple skip requests. + + All required parameters must be populated in order to send to Azure. + + :ivar targets: The targets to skip. Required. + :vartype targets: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipTarget] + """ + + _validation = { + "targets": {"required": True}, + } + + _attribute_map = { + "targets": {"key": "targets", "type": "[SkipTarget]"}, + } + + def __init__(self, *, targets: List["_models.SkipTarget"], **kwargs: Any) -> None: + """ + :keyword targets: The targets to skip. Required. + :paramtype targets: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipTarget] + """ + super().__init__(**kwargs) + self.targets = targets + + +class SkipTarget(_serialization.Model): + """The definition of a single skip request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The skip target type. Required. Known values are: "Member", "Group", "Stage", and + "AfterStageWait". + :vartype type: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.TargetType + :ivar name: The skip target's name. + To skip a member/group/stage, use the member/group/stage's name; + Tp skip an after stage wait, use the parent stage's name. Required. + :vartype name: str + """ + + _validation = { + "type": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.TargetType"], name: str, **kwargs: Any) -> None: + """ + :keyword type: The skip target type. Required. Known values are: "Member", "Group", "Stage", + and "AfterStageWait". + :paramtype type: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.TargetType + :keyword name: The skip target's name. + To skip a member/group/stage, use the member/group/stage's name; + Tp skip an after stage wait, use the parent stage's name. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.type = type + self.name = name + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UpdateGroup(_serialization.Model): + """A group to be updated. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the group. + It must match a group name of an existing fleet member. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, **kwargs: Any) -> None: + """ + :keyword name: Name of the group. + It must match a group name of an existing fleet member. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class UpdateGroupStatus(_serialization.Model): + """The status of a UpdateGroup. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the UpdateGroup. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus + :ivar name: The name of the UpdateGroup. + :vartype name: str + :ivar members: The list of member this UpdateGroup updates. + :vartype members: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.MemberUpdateStatus] + """ + + _validation = { + "status": {"readonly": True}, + "name": {"readonly": True}, + "members": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "UpdateStatus"}, + "name": {"key": "name", "type": "str"}, + "members": {"key": "members", "type": "[MemberUpdateStatus]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.name = None + self.members = None + + +class UpdateRun(ProxyResource): + """A multi-stage process to perform update operations across members of a Fleet. + + 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.containerservicefleet.v2024_02_02_preview.models.SystemData + :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + :vartype e_tag: str + :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunProvisioningState + :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. + + When creating a new run, there are three ways to define a strategy for the run: + + + #. Define a new strategy in place: Set the "strategy" field. + #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + #. Use the default strategy to update all the members one by one: Leave both + "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + + Setting both "updateStrategyId" and "strategy" is invalid. + + UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of + creation and store it in the "strategy" field. + Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + UpdateRunStrategy changes can be made directly on the "strategy" field before launching the + UpdateRun. + :vartype update_strategy_id: str + :ivar strategy: The strategy defines the order in which the clusters will be updated. + If not set, all members will be updated sequentially. The UpdateRun status will show a single + UpdateStage and a single UpdateGroup targeting all members. + The strategy of the UpdateRun can be modified until the run is started. + :vartype strategy: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy + :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The + managedClusterUpdate can be modified until the run is started. + :vartype managed_cluster_update: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpdate + :ivar status: The status of the UpdateRun. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStatus + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"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"}, + "e_tag": {"key": "eTag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, + "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, + "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, + "status": {"key": "properties.status", "type": "UpdateRunStatus"}, + } + + def __init__( + self, + *, + update_strategy_id: Optional[str] = None, + strategy: Optional["_models.UpdateRunStrategy"] = None, + managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. + + When creating a new run, there are three ways to define a strategy for the run: + + + #. Define a new strategy in place: Set the "strategy" field. + #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + #. Use the default strategy to update all the members one by one: Leave both + "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + + Setting both "updateStrategyId" and "strategy" is invalid. + + UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of + creation and store it in the "strategy" field. + Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + UpdateRunStrategy changes can be made directly on the "strategy" field before launching the + UpdateRun. + :paramtype update_strategy_id: str + :keyword strategy: The strategy defines the order in which the clusters will be updated. + If not set, all members will be updated sequentially. The UpdateRun status will show a single + UpdateStage and a single UpdateGroup targeting all members. + The strategy of the UpdateRun can be modified until the run is started. + :paramtype strategy: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy + :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The + managedClusterUpdate can be modified until the run is started. + :paramtype managed_cluster_update: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpdate + """ + super().__init__(**kwargs) + self.e_tag = None + self.provisioning_state = None + self.update_strategy_id = update_strategy_id + self.strategy = strategy + self.managed_cluster_update = managed_cluster_update + self.status = None + + +class UpdateRunListResult(_serialization.Model): + """The response of a UpdateRun list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The UpdateRun items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[UpdateRun]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The UpdateRun items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateRunStatus(_serialization.Model): + """The status of a UpdateRun. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the UpdateRun. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus + :ivar stages: The stages composing an update run. Stages are run sequentially withing an + UpdateRun. + :vartype stages: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStageStatus] + :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in + update run when ``NodeImageSelection.type`` is ``Consistent``. + :vartype node_image_selection: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionStatus + """ + + _validation = { + "status": {"readonly": True}, + "stages": {"readonly": True}, + "node_image_selection": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "UpdateStatus"}, + "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, + "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.stages = None + self.node_image_selection = None + + +class UpdateRunStrategy(_serialization.Model): + """Defines the update sequence of the clusters via stages and groups. + + Stages within a run are executed sequentially one after another. + Groups within a stage are executed in parallel. + Member clusters within a group are updated sequentially one after another. + + A valid strategy contains no duplicate groups within or across stages. + + All required parameters must be populated in order to send to Azure. + + :ivar stages: The list of stages that compose this update run. Min size: 1. Required. + :vartype stages: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStage] + """ + + _validation = { + "stages": {"required": True}, + } + + _attribute_map = { + "stages": {"key": "stages", "type": "[UpdateStage]"}, + } + + def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: + """ + :keyword stages: The list of stages that compose this update run. Min size: 1. Required. + :paramtype stages: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStage] + """ + super().__init__(**kwargs) + self.stages = stages + + +class UpdateStage(_serialization.Model): + """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a + time period) before starting the next stage. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. + :vartype name: str + :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are + not allowed. Min size: 1. + :vartype groups: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroup] + :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before + starting the next one. Defaults to 0 seconds if unspecified. + :vartype after_stage_wait_in_seconds: int + """ + + _validation = { + "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "groups": {"key": "groups", "type": "[UpdateGroup]"}, + "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + name: str, + groups: Optional[List["_models.UpdateGroup"]] = None, + after_stage_wait_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. + :paramtype name: str + :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups + are not allowed. Min size: 1. + :paramtype groups: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroup] + :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage + before starting the next one. Defaults to 0 seconds if unspecified. + :paramtype after_stage_wait_in_seconds: int + """ + super().__init__(**kwargs) + self.name = name + self.groups = groups + self.after_stage_wait_in_seconds = after_stage_wait_in_seconds + + +class UpdateStageStatus(_serialization.Model): + """The status of a UpdateStage. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the UpdateStage. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus + :ivar name: The name of the UpdateStage. + :vartype name: str + :ivar groups: The list of groups to be updated as part of this UpdateStage. + :vartype groups: + list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroupStatus] + :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. + :vartype after_stage_wait_status: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.WaitStatus + """ + + _validation = { + "status": {"readonly": True}, + "name": {"readonly": True}, + "groups": {"readonly": True}, + "after_stage_wait_status": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "UpdateStatus"}, + "name": {"key": "name", "type": "str"}, + "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, + "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.name = None + self.groups = None + self.after_stage_wait_status = None + + +class UpdateStatus(_serialization.Model): + """The status for an operation or group of operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_time: The time the operation or group was started. + :vartype start_time: ~datetime.datetime + :ivar completed_time: The time the operation or group was completed. + :vartype completed_time: ~datetime.datetime + :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", + "Stopping", "Stopped", "Skipped", "Failed", and "Completed". + :vartype state: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateState + :ivar error: The error details when a failure is encountered. + :vartype error: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorDetail + """ + + _validation = { + "start_time": {"readonly": True}, + "completed_time": {"readonly": True}, + "state": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "completed_time": {"key": "completedTime", "type": "iso-8601"}, + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.start_time = None + self.completed_time = None + self.state = None + self.error = None + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class WaitStatus(_serialization.Model): + """The status of the wait duration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the wait duration. + :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus + :ivar wait_duration_in_seconds: The wait duration configured in seconds. + :vartype wait_duration_in_seconds: int + """ + + _validation = { + "status": {"readonly": True}, + "wait_duration_in_seconds": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "UpdateStatus"}, + "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py new file mode 100644 index 000000000000..2233c34e005a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations +from ._update_runs_operations import UpdateRunsOperations +from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations + +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", + "FleetsOperations", + "FleetMembersOperations", + "UpdateRunsOperations", + "FleetUpdateStrategiesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..d0d74aaedd3a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py @@ -0,0 +1,1156 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_fleet_request( + resource_group_name: str, fleet_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_get_request( + resource_group_name: str, fleet_name: str, fleet_member_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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, + fleet_name: str, + fleet_member_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: 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-02-02-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.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + 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_update_request( + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + subscription_id: str, + *, + if_match: 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-02-02-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.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_delete_request( + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + subscription_id: str, + *, + if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s + :attr:`fleet_members` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> Iterable["_models.FleetMember"]: + """List FleetMember resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMember or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetMemberListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetMemberListResult", 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) + + list_by_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members" + } + + @distributed_trace + def get( + self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any + ) -> _models.FleetMember: + """Get a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_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("FleetMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + def _create_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "FleetMember") + + request = build_create_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FleetMember", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("FleetMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + resource: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Create a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param resource: Resource create parameters. Is either a FleetMember type or a IO type. + Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = 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, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetMember", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: Union[_models.FleetMemberUpdate, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.FleetMember]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.FleetMember]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "FleetMemberUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FleetMember", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: _models.FleetMemberUpdate, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Required. + :type properties: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + properties: Union[_models.FleetMemberUpdate, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Update a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or + a IO type. Required. + :type properties: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetMember] = 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, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + properties=properties, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetMember", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a FleetMember. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py new file mode 100644 index 000000000000..5cb904d7cc2e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py @@ -0,0 +1,837 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_fleet_request( + resource_group_name: str, fleet_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_get_request( + resource_group_name: str, fleet_name: str, update_strategy_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateStrategyName": _SERIALIZER.url( + "update_strategy_name", + update_strategy_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_or_update_request( + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: 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-02-02-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.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateStrategyName": _SERIALIZER.url( + "update_strategy_name", + update_strategy_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + 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_delete_request( + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + subscription_id: str, + *, + if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateStrategyName": _SERIALIZER.url( + "update_strategy_name", + update_strategy_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class FleetUpdateStrategiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s + :attr:`fleet_update_strategies` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> Iterable["_models.FleetUpdateStrategy"]: + """List FleetUpdateStrategy resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetUpdateStrategyListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetUpdateStrategyListResult", 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) + + list_by_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies" + } + + @distributed_trace + def get( + self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any + ) -> _models.FleetUpdateStrategy: + """Get a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetUpdateStrategy or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_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("FleetUpdateStrategy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: Union[_models.FleetUpdateStrategy, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetUpdateStrategy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "FleetUpdateStrategy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: _models.FleetUpdateStrategy, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Required. + :type resource: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + resource: Union[_models.FleetUpdateStrategy, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetUpdateStrategy]: + """Create a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a IO type. + Required. + :type resource: + ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 FleetUpdateStrategy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetUpdateStrategy] = 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, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + update_strategy_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a FleetUpdateStrategy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_strategy_name: The name of the UpdateStrategy resource. Required. + :type update_strategy_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_strategy_name=update_strategy_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py new file mode 100644 index 000000000000..5084c1d428b2 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py @@ -0,0 +1,1259 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_by_resource_group_request(resource_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_get_request(resource_group_name: str, fleet_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_or_update_request( + resource_group_name: str, + fleet_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: 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-02-02-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.ContainerService/fleets/{fleetName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + 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_update_request( + resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: 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-02-02-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.ContainerService/fleets/{fleetName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_delete_request( + resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_credentials_request( + resource_group_name: str, fleet_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s + :attr:`fleets` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: + """Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: + """Lists fleets in the specified subscription and resource group. + + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets" + } + + @distributed_trace + def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: + """Gets a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_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("Fleet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + resource: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Fleet") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Fleet", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Fleet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + resource: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param resource: Resource create parameters. Is either a Fleet type or a IO type. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = 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, + fleet_name=fleet_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Fleet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + properties: Union[_models.FleetPatch, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.Fleet]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Fleet]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "FleetPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Fleet", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: _models.FleetPatch, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + properties: Union[_models.FleetPatch, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Update a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param properties: The resource properties to be updated. Is either a FleetPatch type or a IO + type. Required. + :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Fleet] = 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, + fleet_name=fleet_name, + properties=properties, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Fleet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResults + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.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("FleetCredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py new file mode 100644 index 000000000000..507c6d7f969a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py @@ -0,0 +1,159 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +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(**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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py new file mode 100644 index 000000000000..1c61d5b289d9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py @@ -0,0 +1,1551 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_fleet_request( + resource_group_name: str, fleet_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_get_request( + resource_group_name: str, fleet_name: str, update_run_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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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_or_update_request( + resource_group_name: str, + fleet_name: str, + update_run_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: 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-02-02-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.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + 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_delete_request( + resource_group_name: str, + fleet_name: str, + update_run_name: str, + subscription_id: str, + *, + if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_skip_request( + resource_group_name: str, + fleet_name: str, + update_run_name: str, + subscription_id: str, + *, + if_match: 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-02-02-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.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_start_request( + resource_group_name: str, + fleet_name: str, + update_run_name: str, + subscription_id: str, + *, + if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, + fleet_name: str, + update_run_name: str, + subscription_id: str, + *, + if_match: 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-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", + ) # 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 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "updateRunName": _SERIALIZER.url( + "update_run_name", + update_run_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class UpdateRunsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s + :attr:`update_runs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: + """List UpdateRun resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateRun or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRunListResult] = 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_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_fleet.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateRunListResult", 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) + + list_by_fleet.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns" + } + + @distributed_trace + def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: + """Get a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_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("UpdateRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: Union[_models.UpdateRun, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.UpdateRun: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "UpdateRun") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: _models.UpdateRun, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + resource: Union[_models.UpdateRun, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Create a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param resource: Resource create parameters. Is either a UpdateRun type or a IO type. Required. + :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = 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, + fleet_name=fleet_name, + update_run_name=update_run_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **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._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" + } + + def _skip_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: Union[_models.SkipProperties, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.UpdateRun]] = 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, "SkipProperties") + + request = build_skip_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._skip_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _skip_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip" + } + + @overload + def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: _models.SkipProperties, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Required. + :type body: IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_skip( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + body: Union[_models.SkipProperties, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param body: The content of the action request. Is either a SkipProperties type or a IO type. + Required. + :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties or IO + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UpdateRun] = 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._skip_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + body=body, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_skip.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip" + } + + def _start_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + 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._api_version or "2024-02-02-preview") + ) + cls: ClsType[Optional[_models.UpdateRun]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start" + } + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Starts an UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = 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._start_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + 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): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start" + } + + def _stop_initial( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.UpdateRun]: + 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._api_version or "2024-02-02-preview") + ) + cls: ClsType[Optional[_models.UpdateRun]] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + 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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("UpdateRun", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop" + } + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + fleet_name: str, + update_run_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.UpdateRun]: + """Stops an UpdateRun. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param update_run_name: The name of the UpdateRun resource. Required. + :type update_run_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 UpdateRun or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] + :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._api_version or "2024-02-02-preview") + ) + cls: ClsType[_models.UpdateRun] = 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._stop_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + update_run_name=update_run_name, + if_match=if_match, + 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): + deserialized = self._deserialize("UpdateRun", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop" + } diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/CHANGELOG.md b/sdk/containerstorage/azure-mgmt-containerstorage/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/LICENSE b/sdk/containerstorage/azure-mgmt-containerstorage/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/MANIFEST.in b/sdk/containerstorage/azure-mgmt-containerstorage/MANIFEST.in new file mode 100644 index 000000000000..532b338210b9 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/containerstorage/py.typed diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/README.md b/sdk/containerstorage/azure-mgmt-containerstorage/README.md new file mode 100644 index 000000000000..f0a5b5d33735 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-containerstorage +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/_meta.json b/sdk/containerstorage/azure-mgmt-containerstorage/_meta.json new file mode 100644 index 000000000000..54aa5a9a0cda --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/containerstorage/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/containerstorage/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/__init__.py new file mode 100644 index 000000000000..8d90b783f5bb --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_container_storage_rp import AzureContainerStorageRP +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureContainerStorageRP", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_azure_container_storage_rp.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_azure_container_storage_rp.py new file mode 100644 index 000000000000..f02679d161a7 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_azure_container_storage_rp.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import AzureContainerStorageRPConfiguration +from ._serialization import Deserializer, Serializer +from .operations import Operations, PoolsOperations, SnapshotsOperations, VolumesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AzureContainerStorageRP: # pylint: disable=client-accepts-api-version-keyword + """Azure Container Storage Resource Provider API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerstorage.operations.Operations + :ivar pools: PoolsOperations operations + :vartype pools: azure.mgmt.containerstorage.operations.PoolsOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.containerstorage.operations.SnapshotsOperations + :ivar volumes: VolumesOperations operations + :vartype volumes: azure.mgmt.containerstorage.operations.VolumesOperations + :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-07-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureContainerStorageRPConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volumes = VolumesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "AzureContainerStorageRP": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_configuration.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_configuration.py new file mode 100644 index 000000000000..1cc40f0f5eac --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AzureContainerStorageRPConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AzureContainerStorageRP. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-07-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(AzureContainerStorageRPConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerstorage/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_patch.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_serialization.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node
is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_vendor.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_version.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/__init__.py new file mode 100644 index 000000000000..3be3572998f9 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_container_storage_rp import AzureContainerStorageRP + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureContainerStorageRP", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_azure_container_storage_rp.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_azure_container_storage_rp.py new file mode 100644 index 000000000000..a0e462a1387f --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_azure_container_storage_rp.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AzureContainerStorageRPConfiguration +from .operations import Operations, PoolsOperations, SnapshotsOperations, VolumesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureContainerStorageRP: # pylint: disable=client-accepts-api-version-keyword + """Azure Container Storage Resource Provider API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerstorage.aio.operations.Operations + :ivar pools: PoolsOperations operations + :vartype pools: azure.mgmt.containerstorage.aio.operations.PoolsOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.containerstorage.aio.operations.SnapshotsOperations + :ivar volumes: VolumesOperations operations + :vartype volumes: azure.mgmt.containerstorage.aio.operations.VolumesOperations + :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-07-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureContainerStorageRPConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volumes = VolumesOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureContainerStorageRP": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_configuration.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_configuration.py new file mode 100644 index 000000000000..6ce85cde3828 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureContainerStorageRPConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AzureContainerStorageRP. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-07-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(AzureContainerStorageRPConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-07-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerstorage/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_patch.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/__init__.py new file mode 100644 index 000000000000..476c98f2d5a5 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._pools_operations import PoolsOperations +from ._snapshots_operations import SnapshotsOperations +from ._volumes_operations import VolumesOperations + +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", + "PoolsOperations", + "SnapshotsOperations", + "VolumesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_operations.py new file mode 100644 index 000000000000..97112e896f93 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.aio.AzureContainerStorageRP`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerstorage.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.ContainerStorage/operations"} diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_patch.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_pools_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_pools_operations.py new file mode 100644 index 000000000000..7a30922bab7c --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_pools_operations.py @@ -0,0 +1,855 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.aio.AzureContainerStorageRP`'s + :attr:`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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + """List Pool resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerstorage.models.Pool] + :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.PoolListResult] = 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, + 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("PoolListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerStorage/pools" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + """List Pool resources by resource group. + + :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 Pool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerstorage.models.Pool] + :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.PoolListResult] = 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, + 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("PoolListResult", 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.ContainerStorage/pools" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: + """Get a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pool or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Pool + :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.Pool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_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 = 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("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> _models.Pool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Pool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: _models.Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Pool + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Is either a Pool type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Pool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + async def _update_initial( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> Optional[_models.Pool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PoolUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Pool", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: _models.PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerstorage.models.PoolUpdate + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.containerstorage.models.PoolUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_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, + pool_name=pool_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_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, + pool_name=pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_snapshots_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..d4509bc0628b --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_snapshots_operations.py @@ -0,0 +1,589 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_pool_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.aio.AzureContainerStorageRP`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_pool( + self, resource_group_name: str, pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Snapshot"]: + """List Snapshot resources by Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerstorage.models.Snapshot] + :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.SnapshotListResult] = 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_pool_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_pool.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("SnapshotListResult", 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_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, pool_name: str, snapshot_name: str, **kwargs: Any + ) -> _models.Snapshot: + """Get a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Snapshot + :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.Snapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + snapshot_name=snapshot_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 = 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("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> _models.Snapshot: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Snapshot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + snapshot_name=snapshot_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Snapshot + :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 Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Is either a Snapshot type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :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.Snapshot] = 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, + pool_name=pool_name, + snapshot_name=snapshot_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Snapshot", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_name: str, snapshot_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, + pool_name=pool_name, + snapshot_name=snapshot_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, pool_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_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, + pool_name=pool_name, + snapshot_name=snapshot_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_volumes_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_volumes_operations.py new file mode 100644 index 000000000000..d9d4273c3879 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/aio/operations/_volumes_operations.py @@ -0,0 +1,829 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._volumes_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_pool_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VolumesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.aio.AzureContainerStorageRP`'s + :attr:`volumes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_pool(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> AsyncIterable["_models.Volume"]: + """List Volume resources by Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Volume or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerstorage.models.Volume] + :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.VolumeListResult] = 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_pool_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_pool.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("VolumeListResult", 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_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, pool_name: str, volume_name: str, **kwargs: Any) -> _models.Volume: + """Get a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Volume or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Volume + :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.Volume] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_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 = 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("Volume", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: Union[_models.Volume, IO], + **kwargs: Any + ) -> _models.Volume: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Volume] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Volume") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Volume", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Volume", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: _models.Volume, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Volume + :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 Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: Union[_models.Volume, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Is either a Volume type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Volume or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :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.Volume] = 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, + pool_name=pool_name, + volume_name=volume_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Volume", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + async def _update_initial( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: Union[_models.VolumeUpdate, IO], + **kwargs: Any + ) -> Optional[_models.Volume]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Volume]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "VolumeUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Volume", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: _models.VolumeUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerstorage.models.VolumeUpdate + :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 Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: Union[_models.VolumeUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Is either a VolumeUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.containerstorage.models.VolumeUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerstorage.models.Volume] + :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.Volume] = 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, + pool_name=pool_name, + volume_name=volume_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Volume", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_name: str, volume_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, + pool_name=pool_name, + volume_name=volume_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, pool_name: str, volume_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_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, + pool_name=pool_name, + volume_name=volume_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/__init__.py new file mode 100644 index 000000000000..14dd0d080743 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/__init__.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import Assignment +from ._models_py3 import AssignmentStatus +from ._models_py3 import AzureDisk +from ._models_py3 import AzureDiskUpdate +from ._models_py3 import Disk +from ._models_py3 import DiskPoolProperties +from ._models_py3 import ElasticSan +from ._models_py3 import ElasticSanVolumeProperties +from ._models_py3 import Encryption +from ._models_py3 import EphemeralDisk +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Pool +from ._models_py3 import PoolListResult +from ._models_py3 import PoolType +from ._models_py3 import PoolTypeUpdate +from ._models_py3 import PoolUpdate +from ._models_py3 import ProxyResource +from ._models_py3 import Requests +from ._models_py3 import Resource +from ._models_py3 import ResourceOperationalStatus +from ._models_py3 import Resources +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotListResult +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import Volume +from ._models_py3 import VolumeListResult +from ._models_py3 import VolumeType +from ._models_py3 import VolumeUpdate + +from ._azure_container_storage_rp_enums import ActionType +from ._azure_container_storage_rp_enums import AssignmentStatusState +from ._azure_container_storage_rp_enums import AzureDiskSkuName +from ._azure_container_storage_rp_enums import CreatedByType +from ._azure_container_storage_rp_enums import ElasticSanSkuName +from ._azure_container_storage_rp_enums import ManagedServiceIdentityType +from ._azure_container_storage_rp_enums import Origin +from ._azure_container_storage_rp_enums import ProvisioningState +from ._azure_container_storage_rp_enums import ReclaimPolicy +from ._azure_container_storage_rp_enums import ResourceOperationStatusState +from ._azure_container_storage_rp_enums import Zone +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Assignment", + "AssignmentStatus", + "AzureDisk", + "AzureDiskUpdate", + "Disk", + "DiskPoolProperties", + "ElasticSan", + "ElasticSanVolumeProperties", + "Encryption", + "EphemeralDisk", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ManagedServiceIdentity", + "Operation", + "OperationDisplay", + "OperationListResult", + "Pool", + "PoolListResult", + "PoolType", + "PoolTypeUpdate", + "PoolUpdate", + "ProxyResource", + "Requests", + "Resource", + "ResourceOperationalStatus", + "Resources", + "Snapshot", + "SnapshotListResult", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "Volume", + "VolumeListResult", + "VolumeType", + "VolumeUpdate", + "ActionType", + "AssignmentStatusState", + "AzureDiskSkuName", + "CreatedByType", + "ElasticSanSkuName", + "ManagedServiceIdentityType", + "Origin", + "ProvisioningState", + "ReclaimPolicy", + "ResourceOperationStatusState", + "Zone", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_azure_container_storage_rp_enums.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_azure_container_storage_rp_enums.py new file mode 100644 index 000000000000..774e191cb4ca --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_azure_container_storage_rp_enums.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. +# -------------------------------------------------------------------------- + +from enum import Enum +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 AssignmentStatusState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the assignment resource.""" + + ASSIGNING = "Assigning" + """The assignment of the pool to the resource is in progress""" + ASSIGNED = "Assigned" + """The assignment to the pool was successful.""" + UNASSIGNING = "Unassigning" + """The pool is being unassigned.""" + FAILED = "Failed" + """The operation of assigning or unassigning the pool failed.""" + + +class AzureDiskSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SKU of the underlying managed disk.""" + + PREMIUM_LRS = "Premium_LRS" + """Premium_LRS SKU""" + STANDARD_LRS = "Standard_LRS" + """Standard_LRS SKU""" + STANDARD_SSD_LRS = "StandardSSD_LRS" + """StandardSSD_LRS SKU""" + ULTRA_SSD_LRS = "UltraSSD_LRS" + """UltraSSD_LRS SKU""" + PREMIUM_ZRS = "Premium_ZRS" + """Premium_ZRS SKU""" + PREMIUM_V2_LRS = "PremiumV2_LRS" + """PremiumV2_LRS SKU""" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + """StandardSSD_ZRS SKU""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class ElasticSanSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ElasticSAN SKUs.""" + + PREMIUM_LRS = "Premium_LRS" + """Premium_LRS SKU""" + PREMIUM_ZRS = "Premium_ZRS" + """Premium_ZRS SKU""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + + +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """The resource is being provisioned""" + UPDATING = "Updating" + """The resource is updating""" + DELETING = "Deleting" + """The resource is being deleted""" + ACCEPTED = "Accepted" + """The resource create request has been accepted""" + + +class ReclaimPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Reclaim policy.""" + + DELETE = "Delete" + """Delete resource""" + RETAIN = "Retain" + """Retain resource""" + + +class ResourceOperationStatusState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the resource.""" + + PENDING = "Pending" + """The resource is pending.""" + AVAILABLE = "Available" + """The resource is available.""" + UNAVAILABLE = "Unavailable" + """The resource is unavailable.""" + + +class Zone(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Availability Zones.""" + + ZONE1 = "1" + """First availability zone.""" + ZONE2 = "2" + """Second availability zone.""" + ZONE3 = "3" + """Third availability zone.""" diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_models_py3.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_models_py3.py new file mode 100644 index 000000000000..c635dae95e52 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_models_py3.py @@ -0,0 +1,1485 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class Assignment(_serialization.Model): + """Assignment 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 status: Indicates if the assignment is in a usable state. + :vartype status: ~azure.mgmt.containerstorage.models.AssignmentStatus + :ivar id: Resource id for the assigned resource. Required. + :vartype id: str + """ + + _validation = { + "status": {"readonly": True}, + "id": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "AssignmentStatus"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource id for the assigned resource. Required. + :paramtype id: str + """ + super().__init__(**kwargs) + self.status = None + self.id = id + + +class AssignmentStatus(_serialization.Model): + """Status of the assignment resource. + + All required parameters must be populated in order to send to Azure. + + :ivar state: State of the assignment resource. Required. Known values are: "Assigning", + "Assigned", "Unassigning", and "Failed". + :vartype state: str or ~azure.mgmt.containerstorage.models.AssignmentStatusState + :ivar message: Reason for the status. + :vartype message: str + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, *, state: Union[str, "_models.AssignmentStatusState"], message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword state: State of the assignment resource. Required. Known values are: "Assigning", + "Assigned", "Unassigning", and "Failed". + :paramtype state: str or ~azure.mgmt.containerstorage.models.AssignmentStatusState + :keyword message: Reason for the status. + :paramtype message: str + """ + super().__init__(**kwargs) + self.state = state + self.message = message + + +class AzureDisk(_serialization.Model): + """Azure Disk Pool Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_group: Managed resource group for the pool. + :vartype resource_group: str + :ivar sku_name: Sku name. Known values are: "Premium_LRS", "Standard_LRS", "StandardSSD_LRS", + "UltraSSD_LRS", "Premium_ZRS", "PremiumV2_LRS", and "StandardSSD_ZRS". + :vartype sku_name: str or ~azure.mgmt.containerstorage.models.AzureDiskSkuName + :ivar encryption: Encryption specifies the encryption configuration for the Azure Disk pool. + :vartype encryption: ~azure.mgmt.containerstorage.models.Encryption + :ivar disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :vartype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + + _validation = { + "resource_group": {"readonly": True}, + } + + _attribute_map = { + "resource_group": {"key": "resourceGroup", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "encryption": {"key": "encryption", "type": "Encryption"}, + "disks": {"key": "disks", "type": "[Disk]"}, + } + + def __init__( + self, + *, + sku_name: Optional[Union[str, "_models.AzureDiskSkuName"]] = None, + encryption: Optional["_models.Encryption"] = None, + disks: Optional[List["_models.Disk"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku_name: Sku name. Known values are: "Premium_LRS", "Standard_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "PremiumV2_LRS", and "StandardSSD_ZRS". + :paramtype sku_name: str or ~azure.mgmt.containerstorage.models.AzureDiskSkuName + :keyword encryption: Encryption specifies the encryption configuration for the Azure Disk pool. + :paramtype encryption: ~azure.mgmt.containerstorage.models.Encryption + :keyword disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :paramtype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + super().__init__(**kwargs) + self.resource_group = None + self.sku_name = sku_name + self.encryption = encryption + self.disks = disks + + +class AzureDiskUpdate(_serialization.Model): + """Azure Disk Pool Properties. + + :ivar disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :vartype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + + _attribute_map = { + "disks": {"key": "disks", "type": "[Disk]"}, + } + + def __init__(self, *, disks: Optional[List["_models.Disk"]] = None, **kwargs: Any) -> None: + """ + :keyword disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :paramtype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + super().__init__(**kwargs) + self.disks = disks + + +class Disk(_serialization.Model): + """Model for disk for that pool is using. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID is the disk identifier visible to the OS. It is typically the WWN or disk ID in + formats such as eui.e8238fa6bf530001001b448b45263379 or 0x5002cf6cbc5dd460. Required. + :vartype id: str + :ivar reference: Reference is the location of the disk in an external system. Required. + :vartype reference: str + """ + + _validation = { + "id": {"required": True}, + "reference": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "reference": {"key": "reference", "type": "str"}, + } + + def __init__(self, *, id: str, reference: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: ID is the disk identifier visible to the OS. It is typically the WWN or disk ID in + formats such as eui.e8238fa6bf530001001b448b45263379 or 0x5002cf6cbc5dd460. Required. + :paramtype id: str + :keyword reference: Reference is the location of the disk in an external system. Required. + :paramtype reference: str + """ + super().__init__(**kwargs) + self.id = id + self.reference = reference + + +class DiskPoolProperties(_serialization.Model): + """Properties shared between the azureDisk and ephemeralDisk. + + :ivar disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :vartype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + + _attribute_map = { + "disks": {"key": "disks", "type": "[Disk]"}, + } + + def __init__(self, *, disks: Optional[List["_models.Disk"]] = None, **kwargs: Any) -> None: + """ + :keyword disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :paramtype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + super().__init__(**kwargs) + self.disks = disks + + +class ElasticSan(_serialization.Model): + """Elastic San Pool Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_group: Managed resource group for the pool. + :vartype resource_group: str + :ivar sku_name: Sku name. Known values are: "Premium_LRS" and "Premium_ZRS". + :vartype sku_name: str or ~azure.mgmt.containerstorage.models.ElasticSanSkuName + :ivar encryption: Encryption specifies the encryption configuration for the Azure Disk pool. + :vartype encryption: ~azure.mgmt.containerstorage.models.Encryption + """ + + _validation = { + "resource_group": {"readonly": True}, + } + + _attribute_map = { + "resource_group": {"key": "resourceGroup", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "encryption": {"key": "encryption", "type": "Encryption"}, + } + + def __init__( + self, + *, + sku_name: Optional[Union[str, "_models.ElasticSanSkuName"]] = None, + encryption: Optional["_models.Encryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku_name: Sku name. Known values are: "Premium_LRS" and "Premium_ZRS". + :paramtype sku_name: str or ~azure.mgmt.containerstorage.models.ElasticSanSkuName + :keyword encryption: Encryption specifies the encryption configuration for the Azure Disk pool. + :paramtype encryption: ~azure.mgmt.containerstorage.models.Encryption + """ + super().__init__(**kwargs) + self.resource_group = None + self.sku_name = sku_name + self.encryption = encryption + + +class ElasticSanVolumeProperties(_serialization.Model): + """Properties of the ElasticSAN iSCSI target. + + All required parameters must be populated in order to send to Azure. + + :ivar target_iqn: iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". Required. + :vartype target_iqn: str + :ivar target_portal_hostname: iSCSI Target Portal Host Name. Required. + :vartype target_portal_hostname: str + :ivar target_portal_port: iSCSI Target Portal Port. Required. + :vartype target_portal_port: int + """ + + _validation = { + "target_iqn": {"required": True}, + "target_portal_hostname": {"required": True}, + "target_portal_port": {"required": True}, + } + + _attribute_map = { + "target_iqn": {"key": "targetIqn", "type": "str"}, + "target_portal_hostname": {"key": "targetPortalHostname", "type": "str"}, + "target_portal_port": {"key": "targetPortalPort", "type": "int"}, + } + + def __init__(self, *, target_iqn: str, target_portal_hostname: str, target_portal_port: int, **kwargs: Any) -> None: + """ + :keyword target_iqn: iSCSI Target IQN (iSCSI Qualified Name); example: + "iqn.2005-03.org.iscsi:server". Required. + :paramtype target_iqn: str + :keyword target_portal_hostname: iSCSI Target Portal Host Name. Required. + :paramtype target_portal_hostname: str + :keyword target_portal_port: iSCSI Target Portal Port. Required. + :paramtype target_portal_port: int + """ + super().__init__(**kwargs) + self.target_iqn = target_iqn + self.target_portal_hostname = target_portal_hostname + self.target_portal_port = target_portal_port + + +class Encryption(_serialization.Model): + """Encryption key properties for the pool. + + All required parameters must be populated in order to send to Azure. + + :ivar key_name: The name of the key vault key. Required. + :vartype key_name: str + :ivar key_vault_uri: The URI of the key vault. Required. + :vartype key_vault_uri: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.containerstorage.models.ManagedServiceIdentity + """ + + _validation = { + "key_name": {"required": True}, + "key_vault_uri": {"required": True}, + } + + _attribute_map = { + "key_name": {"key": "keyName", "type": "str"}, + "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + key_name: str, + key_vault_uri: str, + identity: Optional["_models.ManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_name: The name of the key vault key. Required. + :paramtype key_name: str + :keyword key_vault_uri: The URI of the key vault. Required. + :paramtype key_vault_uri: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.containerstorage.models.ManagedServiceIdentity + """ + super().__init__(**kwargs) + self.key_name = key_name + self.key_vault_uri = key_vault_uri + self.identity = identity + + +class EphemeralDisk(_serialization.Model): + """Ephemeral Disk Pool Properties. + + :ivar replicas: The number of data copies. Default 3. + :vartype replicas: int + :ivar disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :vartype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + + _validation = { + "replicas": {"maximum": 3, "minimum": 1}, + } + + _attribute_map = { + "replicas": {"key": "replicas", "type": "int"}, + "disks": {"key": "disks", "type": "[Disk]"}, + } + + def __init__(self, *, replicas: int = 3, disks: Optional[List["_models.Disk"]] = None, **kwargs: Any) -> None: + """ + :keyword replicas: The number of data copies. Default 3. + :paramtype replicas: int + :keyword disks: Only required if individual disk selection is desired. Path to disk, e.g. + :code:``:/dev/sda or WWN. Supports specifying multiple disks (same syntax as tags). + :paramtype disks: list[~azure.mgmt.containerstorage.models.Disk] + """ + super().__init__(**kwargs) + self.replicas = replicas + self.disks = disks + + +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.containerstorage.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.containerstorage.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.containerstorage.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.containerstorage.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +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 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". + :vartype type: str or ~azure.mgmt.containerstorage.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.containerstorage.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.containerstorage.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.containerstorage.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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 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.containerstorage.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.containerstorage.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.containerstorage.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.containerstorage.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.containerstorage.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.containerstorage.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerstorage.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Pool(TrackedResource): # pylint: disable=too-many-instance-attributes + """Pool 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}. + :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.containerstorage.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 provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.containerstorage.models.ProvisioningState + :ivar status: The operational status of the resource. + :vartype status: ~azure.mgmt.containerstorage.models.ResourceOperationalStatus + :ivar zones: List of availability zones that resources can be created in. + :vartype zones: list[str or ~azure.mgmt.containerstorage.models.Zone] + :ivar resources: Resources represent the resources the pool should have. + :vartype resources: ~azure.mgmt.containerstorage.models.Resources + :ivar pool_type: Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + :vartype pool_type: ~azure.mgmt.containerstorage.models.PoolType + :ivar reclaim_policy: ReclaimPolicy defines what happens to the backend storage when + StoragePool is deleted. Known values are: "Delete" and "Retain". + :vartype reclaim_policy: str or ~azure.mgmt.containerstorage.models.ReclaimPolicy + :ivar assignments: List of resources that should have access to the pool. Typically ARM + references to AKS clusters or ACI Container Groups. For local and standard this must be a + single reference. For ElasticSAN there can be many. + :vartype assignments: list[~azure.mgmt.containerstorage.models.Assignment] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "zones": {"max_items": 3, "min_items": 0}, + } + + _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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "ResourceOperationalStatus"}, + "zones": {"key": "properties.zones", "type": "[str]"}, + "resources": {"key": "properties.resources", "type": "Resources"}, + "pool_type": {"key": "properties.poolType", "type": "PoolType"}, + "reclaim_policy": {"key": "properties.reclaimPolicy", "type": "str"}, + "assignments": {"key": "properties.assignments", "type": "[Assignment]"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[Union[str, "_models.Zone"]]] = None, + resources: Optional["_models.Resources"] = None, + pool_type: Optional["_models.PoolType"] = None, + reclaim_policy: Optional[Union[str, "_models.ReclaimPolicy"]] = None, + assignments: Optional[List["_models.Assignment"]] = 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 zones: List of availability zones that resources can be created in. + :paramtype zones: list[str or ~azure.mgmt.containerstorage.models.Zone] + :keyword resources: Resources represent the resources the pool should have. + :paramtype resources: ~azure.mgmt.containerstorage.models.Resources + :keyword pool_type: Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + :paramtype pool_type: ~azure.mgmt.containerstorage.models.PoolType + :keyword reclaim_policy: ReclaimPolicy defines what happens to the backend storage when + StoragePool is deleted. Known values are: "Delete" and "Retain". + :paramtype reclaim_policy: str or ~azure.mgmt.containerstorage.models.ReclaimPolicy + :keyword assignments: List of resources that should have access to the pool. Typically ARM + references to AKS clusters or ACI Container Groups. For local and standard this must be a + single reference. For ElasticSAN there can be many. + :paramtype assignments: list[~azure.mgmt.containerstorage.models.Assignment] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.status = None + self.zones = zones + self.resources = resources + self.pool_type = pool_type + self.reclaim_policy = reclaim_policy + self.assignments = assignments + + +class PoolListResult(_serialization.Model): + """The response of a Pool list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Pool items on this page. Required. + :vartype value: list[~azure.mgmt.containerstorage.models.Pool] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Pool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Pool"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Pool items on this page. Required. + :paramtype value: list[~azure.mgmt.containerstorage.models.Pool] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PoolType(_serialization.Model): + """Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + + :ivar azure_disk: Disk Pool Properties. + :vartype azure_disk: ~azure.mgmt.containerstorage.models.AzureDisk + :ivar elastic_san: Elastic San Pool Properties. + :vartype elastic_san: ~azure.mgmt.containerstorage.models.ElasticSan + :ivar ephemeral_disk: Ephemeral Pool Properties. + :vartype ephemeral_disk: ~azure.mgmt.containerstorage.models.EphemeralDisk + """ + + _attribute_map = { + "azure_disk": {"key": "azureDisk", "type": "AzureDisk"}, + "elastic_san": {"key": "elasticSan", "type": "ElasticSan"}, + "ephemeral_disk": {"key": "ephemeralDisk", "type": "EphemeralDisk"}, + } + + def __init__( + self, + *, + azure_disk: Optional["_models.AzureDisk"] = None, + elastic_san: Optional["_models.ElasticSan"] = None, + ephemeral_disk: Optional["_models.EphemeralDisk"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_disk: Disk Pool Properties. + :paramtype azure_disk: ~azure.mgmt.containerstorage.models.AzureDisk + :keyword elastic_san: Elastic San Pool Properties. + :paramtype elastic_san: ~azure.mgmt.containerstorage.models.ElasticSan + :keyword ephemeral_disk: Ephemeral Pool Properties. + :paramtype ephemeral_disk: ~azure.mgmt.containerstorage.models.EphemeralDisk + """ + super().__init__(**kwargs) + self.azure_disk = azure_disk + self.elastic_san = elastic_san + self.ephemeral_disk = ephemeral_disk + + +class PoolTypeUpdate(_serialization.Model): + """Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + + :ivar azure_disk: Disk Pool Properties. + :vartype azure_disk: ~azure.mgmt.containerstorage.models.AzureDiskUpdate + :ivar elastic_san: Elastic San Pool Properties. + :vartype elastic_san: JSON + :ivar ephemeral_disk: Ephemeral Pool Properties. + :vartype ephemeral_disk: ~azure.mgmt.containerstorage.models.EphemeralDisk + """ + + _attribute_map = { + "azure_disk": {"key": "azureDisk", "type": "AzureDiskUpdate"}, + "elastic_san": {"key": "elasticSan", "type": "object"}, + "ephemeral_disk": {"key": "ephemeralDisk", "type": "EphemeralDisk"}, + } + + def __init__( + self, + *, + azure_disk: Optional["_models.AzureDiskUpdate"] = None, + elastic_san: Optional[JSON] = None, + ephemeral_disk: Optional["_models.EphemeralDisk"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_disk: Disk Pool Properties. + :paramtype azure_disk: ~azure.mgmt.containerstorage.models.AzureDiskUpdate + :keyword elastic_san: Elastic San Pool Properties. + :paramtype elastic_san: JSON + :keyword ephemeral_disk: Ephemeral Pool Properties. + :paramtype ephemeral_disk: ~azure.mgmt.containerstorage.models.EphemeralDisk + """ + super().__init__(**kwargs) + self.azure_disk = azure_disk + self.elastic_san = elastic_san + self.ephemeral_disk = ephemeral_disk + + +class PoolUpdate(_serialization.Model): + """The type used for update operations of the Pool. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar resources: Resources represent the resources the pool should have. + :vartype resources: ~azure.mgmt.containerstorage.models.Resources + :ivar pool_type: Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + :vartype pool_type: ~azure.mgmt.containerstorage.models.PoolTypeUpdate + :ivar assignments: List of resources that should have access to the pool. Typically ARM + references to AKS clusters or ACI Container Groups. For local and standard this must be a + single reference. For ElasticSAN there can be many. + :vartype assignments: list[~azure.mgmt.containerstorage.models.Assignment] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "resources": {"key": "properties.resources", "type": "Resources"}, + "pool_type": {"key": "properties.poolType", "type": "PoolTypeUpdate"}, + "assignments": {"key": "properties.assignments", "type": "[Assignment]"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + resources: Optional["_models.Resources"] = None, + pool_type: Optional["_models.PoolTypeUpdate"] = None, + assignments: Optional[List["_models.Assignment"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword resources: Resources represent the resources the pool should have. + :paramtype resources: ~azure.mgmt.containerstorage.models.Resources + :keyword pool_type: Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + :paramtype pool_type: ~azure.mgmt.containerstorage.models.PoolTypeUpdate + :keyword assignments: List of resources that should have access to the pool. Typically ARM + references to AKS clusters or ACI Container Groups. For local and standard this must be a + single reference. For ElasticSAN there can be many. + :paramtype assignments: list[~azure.mgmt.containerstorage.models.Assignment] + """ + super().__init__(**kwargs) + self.tags = tags + self.resources = resources + self.pool_type = pool_type + self.assignments = assignments + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + 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.containerstorage.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class Requests(_serialization.Model): + """Requests for capacity for the pool. + + :ivar storage: Requested capacity of the pool in GiB. + :vartype storage: int + """ + + _validation = { + "storage": {"maximum": 65536, "minimum": 1024}, + } + + _attribute_map = { + "storage": {"key": "storage", "type": "int"}, + } + + def __init__(self, *, storage: int = 1024, **kwargs: Any) -> None: + """ + :keyword storage: Requested capacity of the pool in GiB. + :paramtype storage: int + """ + super().__init__(**kwargs) + self.storage = storage + + +class ResourceOperationalStatus(_serialization.Model): + """Status of the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar state: state of the resource. Required. Known values are: "Pending", "Available", and + "Unavailable". + :vartype state: str or ~azure.mgmt.containerstorage.models.ResourceOperationStatusState + :ivar message: Reason for state. + :vartype message: str + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, *, state: Union[str, "_models.ResourceOperationStatusState"], message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword state: state of the resource. Required. Known values are: "Pending", "Available", and + "Unavailable". + :paramtype state: str or ~azure.mgmt.containerstorage.models.ResourceOperationStatusState + :keyword message: Reason for state. + :paramtype message: str + """ + super().__init__(**kwargs) + self.state = state + self.message = message + + +class Resources(_serialization.Model): + """Resource Requests for the pool. + + :ivar requests: Requests for capacity for the pool. + :vartype requests: ~azure.mgmt.containerstorage.models.Requests + """ + + _attribute_map = { + "requests": {"key": "requests", "type": "Requests"}, + } + + def __init__(self, *, requests: Optional["_models.Requests"] = None, **kwargs: Any) -> None: + """ + :keyword requests: Requests for capacity for the pool. + :paramtype requests: ~azure.mgmt.containerstorage.models.Requests + """ + super().__init__(**kwargs) + self.requests = requests + + +class Snapshot(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + 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.containerstorage.models.SystemData + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.containerstorage.models.ProvisioningState + :ivar status: The status of the resource. + :vartype status: ~azure.mgmt.containerstorage.models.ResourceOperationalStatus + :ivar source: Reference to the source volume. + :vartype source: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "source": {"max_length": 253, "min_length": 3, "pattern": r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$"}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "ResourceOperationalStatus"}, + "source": {"key": "properties.source", "type": "str"}, + } + + def __init__(self, *, source: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword source: Reference to the source volume. + :paramtype source: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.status = None + self.source = source + + +class SnapshotListResult(_serialization.Model): + """The response of a Snapshot list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Snapshot items on this page. Required. + :vartype value: list[~azure.mgmt.containerstorage.models.Snapshot] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Snapshot"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Snapshot items on this page. Required. + :paramtype value: list[~azure.mgmt.containerstorage.models.Snapshot] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.containerstorage.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.containerstorage.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.containerstorage.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.containerstorage.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Volume(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + 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.containerstorage.models.SystemData + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.containerstorage.models.ProvisioningState + :ivar status: The status of the resource. + :vartype status: ~azure.mgmt.containerstorage.models.ResourceOperationalStatus + :ivar labels: String KV pairs indicating labels. + :vartype labels: dict[str, str] + :ivar capacity_gi_b: Requested capacity in GiB. + :vartype capacity_gi_b: int + :ivar volume_type: Properties of the volume. + :vartype volume_type: ~azure.mgmt.containerstorage.models.VolumeType + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "capacity_gi_b": {"maximum": 65536, "minimum": 1}, + "volume_type": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "ResourceOperationalStatus"}, + "labels": {"key": "properties.labels", "type": "{str}"}, + "capacity_gi_b": {"key": "properties.capacityGiB", "type": "int"}, + "volume_type": {"key": "properties.volumeType", "type": "VolumeType"}, + } + + def __init__( + self, *, labels: Optional[Dict[str, str]] = None, capacity_gi_b: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword labels: String KV pairs indicating labels. + :paramtype labels: dict[str, str] + :keyword capacity_gi_b: Requested capacity in GiB. + :paramtype capacity_gi_b: int + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.status = None + self.labels = labels + self.capacity_gi_b = capacity_gi_b + self.volume_type = None + + +class VolumeListResult(_serialization.Model): + """The response of a Volume list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Volume items on this page. Required. + :vartype value: list[~azure.mgmt.containerstorage.models.Volume] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Volume]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Volume"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Volume items on this page. Required. + :paramtype value: list[~azure.mgmt.containerstorage.models.Volume] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VolumeType(_serialization.Model): + """Properties of the volume. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar elastic_san: Properties of the ElasticSAN iSCSI target. + :vartype elastic_san: ~azure.mgmt.containerstorage.models.ElasticSanVolumeProperties + """ + + _validation = { + "elastic_san": {"readonly": True}, + } + + _attribute_map = { + "elastic_san": {"key": "elasticSan", "type": "ElasticSanVolumeProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.elastic_san = None + + +class VolumeUpdate(_serialization.Model): + """The type used for update operations of the Volume. + + :ivar labels: String KV pairs indicating labels. + :vartype labels: dict[str, str] + :ivar capacity_gi_b: Requested capacity in GiB. + :vartype capacity_gi_b: int + """ + + _validation = { + "capacity_gi_b": {"maximum": 65536, "minimum": 1}, + } + + _attribute_map = { + "labels": {"key": "properties.labels", "type": "{str}"}, + "capacity_gi_b": {"key": "properties.capacityGiB", "type": "int"}, + } + + def __init__( + self, *, labels: Optional[Dict[str, str]] = None, capacity_gi_b: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword labels: String KV pairs indicating labels. + :paramtype labels: dict[str, str] + :keyword capacity_gi_b: Requested capacity in GiB. + :paramtype capacity_gi_b: int + """ + super().__init__(**kwargs) + self.labels = labels + self.capacity_gi_b = capacity_gi_b diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_patch.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/__init__.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/__init__.py new file mode 100644 index 000000000000..476c98f2d5a5 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._pools_operations import PoolsOperations +from ._snapshots_operations import SnapshotsOperations +from ._volumes_operations import VolumesOperations + +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", + "PoolsOperations", + "SnapshotsOperations", + "VolumesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_operations.py new file mode 100644 index 000000000000..5ed8f47ac956 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerStorage/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.AzureContainerStorageRP`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerstorage.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.ContainerStorage/operations"} diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_patch.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_pools_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_pools_operations.py new file mode 100644 index 000000000000..b766fc306b64 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_pools_operations.py @@ -0,0 +1,1064 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerStorage/pools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_by_resource_group_request(resource_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", "2023-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_get_request(resource_group_name: str, 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", "2023-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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_or_update_request( + resource_group_name: str, 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", "2023-07-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.ContainerStorage/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(resource_group_name: str, 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", "2023-07-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.ContainerStorage/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_group_name: str, 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", "2023-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.AzureContainerStorageRP`'s + :attr:`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_by_subscription(self, **kwargs: Any) -> Iterable["_models.Pool"]: + """List Pool resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerstorage.models.Pool] + :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.PoolListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PoolListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerStorage/pools" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pool"]: + """List Pool resources by resource group. + + :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 Pool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerstorage.models.Pool] + :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.PoolListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("PoolListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools" + } + + @distributed_trace + def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: + """Get a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pool or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Pool + :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.Pool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_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("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> _models.Pool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Pool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: _models.Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Pool + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param resource: Resource create parameters. Is either a Pool type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Pool 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + def _update_initial( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> Optional[_models.Pool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PoolUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: _models.PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerstorage.models.PoolUpdate + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.containerstorage.models.PoolUpdate 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_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, + pool_name=pool_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + pool_name=pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_snapshots_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_snapshots_operations.py new file mode 100644 index 000000000000..83e7933de0e4 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_snapshots_operations.py @@ -0,0 +1,766 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_pool_request( + resource_group_name: str, 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", "2023-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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_get_request( + resource_group_name: str, pool_name: str, snapshot_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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "snapshotName": _SERIALIZER.url( + "snapshot_name", + snapshot_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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_or_update_request( + resource_group_name: str, pool_name: str, snapshot_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-07-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.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "snapshotName": _SERIALIZER.url( + "snapshot_name", + snapshot_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, pool_name: str, snapshot_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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "snapshotName": _SERIALIZER.url( + "snapshot_name", + snapshot_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.AzureContainerStorageRP`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_pool(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """List Snapshot resources by Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerstorage.models.Snapshot] + :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.SnapshotListResult] = 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_pool_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_pool.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", 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) + + list_by_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots" + } + + @distributed_trace + def get(self, resource_group_name: str, pool_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Get a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Snapshot + :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.Snapshot] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + snapshot_name=snapshot_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("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> _models.Snapshot: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Snapshot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + snapshot_name=snapshot_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Snapshot + :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 Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + snapshot_name: str, + resource: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Create a Snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :param resource: Resource create parameters. Is either a Snapshot type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Snapshot 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 Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Snapshot] + :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.Snapshot] = 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, + pool_name=pool_name, + snapshot_name=snapshot_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Snapshot", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_name: str, snapshot_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, + pool_name=pool_name, + snapshot_name=snapshot_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, pool_name: str, snapshot_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param snapshot_name: Volume Snapshot Resource. Required. + :type snapshot_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + pool_name=pool_name, + snapshot_name=snapshot_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_volumes_operations.py b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_volumes_operations.py new file mode 100644 index 000000000000..dbd1106d6e82 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/operations/_volumes_operations.py @@ -0,0 +1,1057 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_pool_request( + resource_group_name: str, 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", "2023-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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_get_request( + resource_group_name: str, pool_name: str, volume_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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "volumeName": _SERIALIZER.url( + "volume_name", + volume_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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_or_update_request( + resource_group_name: str, pool_name: str, volume_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-07-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.ContainerStorage/pools/{poolName}/volumes/{volumeName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "volumeName": _SERIALIZER.url( + "volume_name", + volume_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, pool_name: str, volume_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-07-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.ContainerStorage/pools/{poolName}/volumes/{volumeName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "volumeName": _SERIALIZER.url( + "volume_name", + volume_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, pool_name: str, volume_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-07-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}", + ) # 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 + ), + "poolName": _SERIALIZER.url( + "pool_name", + pool_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$", + ), + "volumeName": _SERIALIZER.url( + "volume_name", + volume_name, + "str", + max_length=253, + min_length=3, + pattern=r"^[a-zA-Z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class VolumesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerstorage.AzureContainerStorageRP`'s + :attr:`volumes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_pool(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> Iterable["_models.Volume"]: + """List Volume resources by Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Volume or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerstorage.models.Volume] + :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.VolumeListResult] = 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_pool_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_pool.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VolumeListResult", 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) + + list_by_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes" + } + + @distributed_trace + def get(self, resource_group_name: str, pool_name: str, volume_name: str, **kwargs: Any) -> _models.Volume: + """Get a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Volume or the result of cls(response) + :rtype: ~azure.mgmt.containerstorage.models.Volume + :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.Volume] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_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("Volume", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: Union[_models.Volume, IO], + **kwargs: Any + ) -> _models.Volume: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Volume] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Volume") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Volume", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Volume", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: _models.Volume, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerstorage.models.Volume + :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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + resource: Union[_models.Volume, IO], + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Create a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param resource: Resource create parameters. Is either a Volume type or a IO type. Required. + :type resource: ~azure.mgmt.containerstorage.models.Volume 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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :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.Volume] = 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, + pool_name=pool_name, + volume_name=volume_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Volume", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + def _update_initial( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: Union[_models.VolumeUpdate, IO], + **kwargs: Any + ) -> Optional[_models.Volume]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Volume]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "VolumeUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Volume", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: _models.VolumeUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerstorage.models.VolumeUpdate + :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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + pool_name: str, + volume_name: str, + properties: Union[_models.VolumeUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.Volume]: + """Update a Volume. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :param properties: The resource properties to be updated. Is either a VolumeUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.containerstorage.models.VolumeUpdate 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 Volume or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerstorage.models.Volume] + :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.Volume] = 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, + pool_name=pool_name, + volume_name=volume_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Volume", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_name: str, volume_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, + pool_name=pool_name, + volume_name=volume_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, pool_name: str, volume_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Compliant create or update template/**. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Pool Object. Required. + :type pool_name: str + :param volume_name: Volume Resource. Required. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + pool_name=pool_name, + volume_name=volume_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + } diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/py.typed b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/azure/mgmt/containerstorage/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/operations_list.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/operations_list.py new file mode 100644 index 000000000000..923298d0e834 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python operations_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_azure_disk.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_azure_disk.py new file mode 100644 index 000000000000..6d36edbabea2 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_azure_disk.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_create_or_update_azure_disk.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="test-rg", + pool_name="test-pool", + resource={ + "location": "eastus", + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest" + } + ], + "poolType": { + "azureDisk": { + "encryption": { + "identity": {"type": "None", "userAssignedIdentities": {"key7678": {}}}, + "keyName": "test-key", + "keyVaultUri": "https://test-kv.vault.azure.net/", + }, + "skuName": "Premium_LRS", + } + }, + "provisioningState": "Succeeded", + "reclaimPolicy": "Delete", + "resources": {"requests": {"storage": 15578}}, + "status": {"message": "Operation is Pending", "state": "Pending"}, + "zones": ["1", "2", "3"], + }, + "tags": {"key1888": "value1888"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_CreateOrUpdate_AzureDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_elastic_san.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_elastic_san.py new file mode 100644 index 000000000000..570e7088cf0f --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_elastic_san.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_create_or_update_elastic_san.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="test-rg", + pool_name="test-pool", + resource={ + "location": "eastus", + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest" + } + ], + "poolType": { + "elasticSan": { + "encryption": { + "identity": {"type": "None", "userAssignedIdentities": {"key7678": {}}}, + "keyName": "test-key", + "keyVaultUri": "https://test-kv.vault.azure.net/", + }, + "skuName": "Premium_LRS", + } + }, + "provisioningState": "Succeeded", + "reclaimPolicy": "Delete", + "resources": {"requests": {"storage": 15578}}, + "status": {"message": "Operation is Pending", "state": "Pending"}, + "zones": ["1", "2", "3"], + }, + "tags": {"key1888": "value1888"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_CreateOrUpdate_ElasticSan.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_ephemeral.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_ephemeral.py new file mode 100644 index 000000000000..f634f86e5300 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_create_or_update_ephemeral.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_create_or_update_ephemeral.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="test-rg", + pool_name="test-pool", + resource={ + "location": "eastus", + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest" + } + ], + "poolType": {"ephemeralDisk": {"replicas": 3}}, + "provisioningState": "Succeeded", + "reclaimPolicy": "Delete", + "resources": {"requests": {"storage": 15578}}, + "status": {"message": "Operation is Pending", "state": "Pending"}, + "zones": ["1", "2", "3"], + }, + "tags": {"key1888": "value1888"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_CreateOrUpdate_Ephemeral.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_delete.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_delete.py new file mode 100644 index 000000000000..55040517e42e --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + client.pools.begin_delete( + resource_group_name="test-rg", + pool_name="test-pool", + ).result() + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_azure_disk.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_azure_disk.py new file mode 100644 index 000000000000..ebe8143e93e2 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_azure_disk.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_get_azure_disk.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.get( + resource_group_name="test-rg", + pool_name="test-pool", + ) + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Get_AzureDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_elastic_san.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_elastic_san.py new file mode 100644 index 000000000000..efeb6b2d0640 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_elastic_san.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_get_elastic_san.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.get( + resource_group_name="test-rg", + pool_name="test-pool", + ) + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Get_ElasticSan.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_ephemeral.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_ephemeral.py new file mode 100644 index 000000000000..c1c86ca3ccb1 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_get_ephemeral.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_get_ephemeral.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.get( + resource_group_name="test-rg", + pool_name="test-pool", + ) + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Get_Ephemeral.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_azure_disk.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_azure_disk.py new file mode 100644 index 000000000000..3d68e73bce8c --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_azure_disk.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_resource_group_azure_disk.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_resource_group( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListByResourceGroup_AzureDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_elastic_san.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_elastic_san.py new file mode 100644 index 000000000000..33c9a587864a --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_elastic_san.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_resource_group_elastic_san.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_resource_group( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListByResourceGroup_ElasticSan.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_ephemeral.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_ephemeral.py new file mode 100644 index 000000000000..92bebeb996be --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_resource_group_ephemeral.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_resource_group_ephemeral.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_resource_group( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListByResourceGroup_Ephemeral.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_azure_disk.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_azure_disk.py new file mode 100644 index 000000000000..4ecce3da09f0 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_azure_disk.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_subscription_azure_disk.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListBySubscription_AzureDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_elastic_san.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_elastic_san.py new file mode 100644 index 000000000000..323ee4a6220b --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_elastic_san.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_subscription_elastic_san.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListBySubscription_ElasticSan.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_ephemeral.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_ephemeral.py new file mode 100644 index 000000000000..97b40de4118a --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_list_by_subscription_ephemeral.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_list_by_subscription_ephemeral.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_ListBySubscription_Ephemeral.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_azure_disk.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_azure_disk.py new file mode 100644 index 000000000000..fb836682ebec --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_azure_disk.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_update_azure_disk.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_update( + resource_group_name="test-rg", + pool_name="test-pool", + properties={ + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest", + "status": { + "message": "The assignment of the pool to the resource is in progress", + "state": "Assigning", + }, + } + ], + "poolType": {"azureDisk": {}}, + "resources": {"requests": {"storage": 15578}}, + }, + "tags": {"key7124": "value7124"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Update_AzureDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_elastic_san.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_elastic_san.py new file mode 100644 index 000000000000..86f2aeadf8fb --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_elastic_san.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_update_elastic_san.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_update( + resource_group_name="test-rg", + pool_name="test-pool", + properties={ + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest", + "status": { + "message": "The assignment of the pool to the resource is in progress", + "state": "Assigning", + }, + } + ], + "poolType": {"elasticSan": {}}, + "resources": {"requests": {"storage": 15578}}, + }, + "tags": {"key7124": "value7124"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Update_ElasticSan.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_ephemeral.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_ephemeral.py new file mode 100644 index 000000000000..322b33291aa6 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/pools_update_ephemeral.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python pools_update_ephemeral.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.pools.begin_update( + resource_group_name="test-rg", + pool_name="test-pool", + properties={ + "properties": { + "assignments": [ + { + "id": "/subscriptions/bb4d87a2-4273-466c-a6ba-61d818061b3a/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/containerstoragetest", + "status": { + "message": "The assignment of the pool to the resource is in progress", + "state": "Assigning", + }, + } + ], + "poolType": {"ephemeralDisk": {"replicas": 3}}, + "resources": {"requests": {"storage": 15578}}, + }, + "tags": {"key7124": "value7124"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Pools_Update_Ephemeral.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_create_or_update.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_create_or_update.py new file mode 100644 index 000000000000..419511668edf --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_create_or_update.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python snapshots_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="test-rg", + pool_name="test-pool", + snapshot_name="test-snapshot", + resource={ + "properties": { + "provisioningState": "Succeeded", + "source": "C0C6I6", + "status": {"message": "Operation is Pending", "state": "Pending"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Snapshots_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_delete.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_delete.py new file mode 100644 index 000000000000..babe8d11667a --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python snapshots_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + client.snapshots.begin_delete( + resource_group_name="test-rg", + pool_name="test-pool", + snapshot_name="test-snapshot", + ).result() + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Snapshots_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_get.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_get.py new file mode 100644 index 000000000000..0b6fb09c62ca --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_get.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python snapshots_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.snapshots.get( + resource_group_name="test-rg", + pool_name="test-pool", + snapshot_name="test-snapshot", + ) + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Snapshots_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_list_by_pool.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_list_by_pool.py new file mode 100644 index 000000000000..a0ef975e1ceb --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/snapshots_list_by_pool.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python snapshots_list_by_pool.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.snapshots.list_by_pool( + resource_group_name="test-rg", + pool_name="test-pool", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Snapshots_ListByPool.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_create_or_update.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_create_or_update.py new file mode 100644 index 000000000000..340a34beb5c6 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_create_or_update.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python volumes_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.volumes.begin_create_or_update( + resource_group_name="test-rg", + pool_name="test-pool", + volume_name="test-volume", + resource={ + "properties": { + "capacityGiB": 25838, + "labels": {"key2039": "value2039"}, + "provisioningState": "Succeeded", + "status": {"message": "Operation is Pending", "state": "Pending"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Volumes_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_delete.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_delete.py new file mode 100644 index 000000000000..c89722f8d34d --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python volumes_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + client.volumes.begin_delete( + resource_group_name="test-rg", + pool_name="test-pool", + volume_name="test-volume", + ).result() + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Volumes_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_get.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_get.py new file mode 100644 index 000000000000..30993f6a9c27 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_get.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python volumes_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.volumes.get( + resource_group_name="test-rg", + pool_name="test-pool", + volume_name="test-volume", + ) + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Volumes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_list_by_pool.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_list_by_pool.py new file mode 100644 index 000000000000..a248ef347dca --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_list_by_pool.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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python volumes_list_by_pool.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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.volumes.list_by_pool( + resource_group_name="test-rg", + pool_name="test-pool", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Volumes_ListByPool.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_update.py b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_update.py new file mode 100644 index 000000000000..8280933c9db4 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/generated_samples/volumes_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.containerstorage import AzureContainerStorageRP + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerstorage +# USAGE + python volumes_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 = AzureContainerStorageRP( + credential=DefaultAzureCredential(), + subscription_id="bb4d87a2-4273-466c-a6ba-61d818061b3a", + ) + + response = client.volumes.begin_update( + resource_group_name="test-rg", + pool_name="test-pool", + volume_name="test-volume", + properties={"properties": {"capacityGiB": 61986, "labels": {"key6684": "ssgphiygc"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerstorage/resource-manager/Microsoft.ContainerStorage/preview/2023-07-01-preview/examples/Volumes_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/sdk_packaging.toml b/sdk/containerstorage/azure-mgmt-containerstorage/sdk_packaging.toml new file mode 100644 index 000000000000..62bf138f12c9 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-containerstorage" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/containerstorage/azure-mgmt-containerstorage/setup.py b/sdk/containerstorage/azure-mgmt-containerstorage/setup.py new file mode 100644 index 000000000000..9b4a7fe38471 --- /dev/null +++ b/sdk/containerstorage/azure-mgmt-containerstorage/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-containerstorage" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/containerstorage/ci.yml b/sdk/containerstorage/ci.yml new file mode 100644 index 000000000000..6345aabf66f0 --- /dev/null +++ b/sdk/containerstorage/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/containerstorage/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/containerstorage/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: containerstorage + TestProxy: true + Artifacts: + - name: azure-mgmt-containerstorage + safeName: azuremgmtcontainerstorage diff --git a/sdk/databox/azure-mgmt-databox/_meta.json b/sdk/databox/azure-mgmt-databox/_meta.json index f61cee449bfe..9db9fb8abbc6 100644 --- a/sdk/databox/azure-mgmt-databox/_meta.json +++ b/sdk/databox/azure-mgmt-databox/_meta.json @@ -1,11 +1,26 @@ { - "commit": "6e70667577cfb7bc194785683ca591b95abd524c", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/databox/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.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/databox/resource-manager/readme.md" + "autorest_command": "autorest specification/databox/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/databox/resource-manager/readme.md", + "package-2024-02-preview": "2024-01-25 12:09:08 +0530 4307895c13b5bc76d3d6e5d6346a32577842ac17 Microsoft.DataBox/preview/2024-02-01-preview/databox.json", + "package-2023-12": "2023-12-08 06:10:08 +0530 9b5ad5f47dad225e8ae03d86b509c1140c8abdc6 Microsoft.DataBox/stable/2023-12-01/databox.json", + "package-2023-03": "2023-08-03 04:23:58 +0530 58be094c6b365f8d4d73a91e293dfb4818e57cf6 Microsoft.DataBox/stable/2023-03-01/databox.json", + "package-2022-12": "2023-04-01 17:35:41 +0530 56ec6a3d73eac40b3f4763806c795b2f3066d64f Microsoft.DataBox/stable/2022-12-01/databox.json", + "package-2022-10": "2023-02-28 11:08:57 +0530 2d05fdbacbde4cede3d2caee36ab612f160c4b85 Microsoft.DataBox/stable/2022-10-01/databox.json", + "package-2022-09": "2022-11-30 08:03:12 +0530 85ea3e489c45e80383801d4f3a1278f1e687a7b8 Microsoft.DataBox/stable/2022-09-01/databox.json", + "package-2022-02": "2022-10-26 11:47:06 +0530 a1fcaf3d60ff4ab3358e879cd0aeb24389ae3383 Microsoft.DataBox/stable/2022-02-01/databox.json", + "package-2021-12": "2022-10-26 11:47:06 +0530 a1fcaf3d60ff4ab3358e879cd0aeb24389ae3383 Microsoft.DataBox/stable/2021-12-01/databox.json", + "package-2021-08-preview": "2022-01-28 09:23:23 +0530 31e3d74717007c0e674ee38b331bbb4d67de3639 Microsoft.DataBox/preview/2021-08-01-preview/databox.json", + "package-2021-05": "2022-02-18 02:35:34 +0100 1659cfde425308fc46b5f2cd962c3be40ba04ace Microsoft.DataBox/stable/2021-05-01/databox.json", + "package-2021-03": "2021-03-29 12:02:17 +0530 8db31684c2957241dd704e2acc76841c076a4a2c Microsoft.DataBox/stable/2021-03-01/databox.json", + "package-2020-11": "2021-03-01 08:31:04 +0530 997de0f031e58a105e13305c6d241cc3f4d5cb50 Microsoft.DataBox/stable/2020-11-01/databox.json", + "package-2020-04": "2021-02-23 04:48:35 +0530 3cf56bc95ad52617ad71aeb318cb6729eafd6b88 Microsoft.DataBox/stable/2020-04-01/databox.json", + "package-2019-09": "2021-02-23 04:48:35 +0530 3cf56bc95ad52617ad71aeb318cb6729eafd6b88 Microsoft.DataBox/stable/2019-09-01/databox.json", + "package-2018-01": "2021-02-23 04:48:35 +0530 3cf56bc95ad52617ad71aeb318cb6729eafd6b88 Microsoft.DataBox/stable/2018-01-01/databox.json" } \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py index b8236d53f569..d736f87812eb 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py @@ -54,7 +54,7 @@ class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-12-01' + DEFAULT_API_VERSION = '2023-12-01' _PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxManagementClient, self).__init__( @@ -99,6 +101,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2022-10-01: :mod:`v2022_10_01.models` * 2022-12-01: :mod:`v2022_12_01.models` + * 2023-03-01: :mod:`v2023_03_01.models` + * 2023-12-01: :mod:`v2023_12_01.models` + * 2024-02-01-preview: :mod:`v2024_02_01_preview.models` """ if api_version == '2018-01-01': from .v2018_01_01 import models @@ -136,6 +141,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-12-01': from .v2022_12_01 import models return models + elif api_version == '2023-03-01': + from .v2023_03_01 import models + return models + elif api_version == '2023-12-01': + from .v2023_12_01 import models + return models + elif api_version == '2024-02-01-preview': + from .v2024_02_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -154,6 +168,9 @@ def jobs(self): * 2022-09-01: :class:`JobsOperations` * 2022-10-01: :class:`JobsOperations` * 2022-12-01: :class:`JobsOperations` + * 2023-03-01: :class:`JobsOperations` + * 2023-12-01: :class:`JobsOperations` + * 2024-02-01-preview: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') if api_version == '2018-01-01': @@ -180,10 +197,16 @@ def jobs(self): from .v2022_10_01.operations import JobsOperations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import JobsOperations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import JobsOperations as OperationClass + elif api_version == '2023-12-01': + from .v2023_12_01.operations import JobsOperations as OperationClass + elif api_version == '2024-02-01-preview': + from .v2024_02_01_preview.operations import JobsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -201,6 +224,9 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2022-10-01: :class:`Operations` * 2022-12-01: :class:`Operations` + * 2023-03-01: :class:`Operations` + * 2023-12-01: :class:`Operations` + * 2024-02-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-01-01': @@ -227,10 +253,16 @@ def operations(self): from .v2022_10_01.operations import Operations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import Operations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import Operations as OperationClass + elif api_version == '2023-12-01': + from .v2023_12_01.operations import Operations as OperationClass + elif api_version == '2024-02-01-preview': + from .v2024_02_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def service(self): @@ -248,6 +280,9 @@ def service(self): * 2022-09-01: :class:`ServiceOperations` * 2022-10-01: :class:`ServiceOperations` * 2022-12-01: :class:`ServiceOperations` + * 2023-03-01: :class:`ServiceOperations` + * 2023-12-01: :class:`ServiceOperations` + * 2024-02-01-preview: :class:`ServiceOperations` """ api_version = self._get_api_version('service') if api_version == '2018-01-01': @@ -274,10 +309,16 @@ def service(self): from .v2022_10_01.operations import ServiceOperations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import ServiceOperations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import ServiceOperations as OperationClass + elif api_version == '2023-12-01': + from .v2023_12_01.operations import ServiceOperations as OperationClass + elif api_version == '2024-02-01-preview': + from .v2024_02_01_preview.operations import ServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py index 44671cbe3044..ffedcba9a6b7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, IO, Optional, Union from . import models as _models @@ -33,7 +34,7 @@ def mitigate( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO type. Required. - :type mitigate_job_request: ~azure.mgmt.databox.v2022_12_01.models.MitigateJobRequest or IO + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -59,6 +60,12 @@ def mitigate( # pylint: disable=inconsistent-return-statements from .v2022_10_01.operations import DataBoxManagementClientOperationsMixin as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-12-01': + from .v2023_12_01.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2024-02-01-preview': + from .v2024_02_01_preview.operations import DataBoxManagementClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'mitigate'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_serialization.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_serialization.py index e3cc6ce6ed6f..a00658b1fc19 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_serialization.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_serialization.py @@ -664,8 +664,9 @@ 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)) @@ -743,6 +744,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,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 str(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) @@ -893,6 +894,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): @@ -905,9 +908,18 @@ 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) @@ -952,7 +964,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: diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py index 60d1797efcd3..2cf3bef4d79a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py @@ -54,7 +54,7 @@ class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-12-01' + DEFAULT_API_VERSION = '2023-12-01' _PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxManagementClient, self).__init__( @@ -99,6 +101,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2022-10-01: :mod:`v2022_10_01.models` * 2022-12-01: :mod:`v2022_12_01.models` + * 2023-03-01: :mod:`v2023_03_01.models` + * 2023-12-01: :mod:`v2023_12_01.models` + * 2024-02-01-preview: :mod:`v2024_02_01_preview.models` """ if api_version == '2018-01-01': from ..v2018_01_01 import models @@ -136,6 +141,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-12-01': from ..v2022_12_01 import models return models + elif api_version == '2023-03-01': + from ..v2023_03_01 import models + return models + elif api_version == '2023-12-01': + from ..v2023_12_01 import models + return models + elif api_version == '2024-02-01-preview': + from ..v2024_02_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -154,6 +168,9 @@ def jobs(self): * 2022-09-01: :class:`JobsOperations` * 2022-10-01: :class:`JobsOperations` * 2022-12-01: :class:`JobsOperations` + * 2023-03-01: :class:`JobsOperations` + * 2023-12-01: :class:`JobsOperations` + * 2024-02-01-preview: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') if api_version == '2018-01-01': @@ -180,10 +197,16 @@ def jobs(self): from ..v2022_10_01.aio.operations import JobsOperations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import JobsOperations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import JobsOperations as OperationClass + elif api_version == '2023-12-01': + from ..v2023_12_01.aio.operations import JobsOperations as OperationClass + elif api_version == '2024-02-01-preview': + from ..v2024_02_01_preview.aio.operations import JobsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -201,6 +224,9 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2022-10-01: :class:`Operations` * 2022-12-01: :class:`Operations` + * 2023-03-01: :class:`Operations` + * 2023-12-01: :class:`Operations` + * 2024-02-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-01-01': @@ -227,10 +253,16 @@ def operations(self): from ..v2022_10_01.aio.operations import Operations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import Operations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import Operations as OperationClass + elif api_version == '2023-12-01': + from ..v2023_12_01.aio.operations import Operations as OperationClass + elif api_version == '2024-02-01-preview': + from ..v2024_02_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def service(self): @@ -248,6 +280,9 @@ def service(self): * 2022-09-01: :class:`ServiceOperations` * 2022-10-01: :class:`ServiceOperations` * 2022-12-01: :class:`ServiceOperations` + * 2023-03-01: :class:`ServiceOperations` + * 2023-12-01: :class:`ServiceOperations` + * 2024-02-01-preview: :class:`ServiceOperations` """ api_version = self._get_api_version('service') if api_version == '2018-01-01': @@ -274,10 +309,16 @@ def service(self): from ..v2022_10_01.aio.operations import ServiceOperations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import ServiceOperations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import ServiceOperations as OperationClass + elif api_version == '2023-12-01': + from ..v2023_12_01.aio.operations import ServiceOperations as OperationClass + elif api_version == '2024-02-01-preview': + from ..v2024_02_01_preview.aio.operations import ServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py index 26d6fadd95cf..717316ac4bf5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from .._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, IO, Optional, Union from .. import models as _models @@ -33,7 +34,7 @@ async def mitigate( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO type. Required. - :type mitigate_job_request: ~azure.mgmt.databox.v2022_12_01.models.MitigateJobRequest or IO + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -59,6 +60,12 @@ async def mitigate( # pylint: disable=inconsistent-return-statements from ..v2022_10_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-12-01': + from ..v2023_12_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2024-02-01-preview': + from ..v2024_02_01_preview.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'mitigate'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py index 9b63e14258de..3e2bc3234959 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2022_12_01.models import * +from .v2023_12_01.models import * diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py index ed1e190b9410..64447c9e309e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py index 27aa34f1eed3..748748093a2b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py index 10b7ebc0d07a..dd07a079f1bd 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -170,7 +172,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -273,7 +275,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -325,14 +327,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -487,7 +489,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -546,7 +548,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -604,7 +606,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) 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) @@ -663,14 +665,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -841,7 +843,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -984,14 +986,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1129,14 +1131,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1196,7 +1198,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py index 81f998c57982..c4c379337f30 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py index 8f22e7c3c5f3..5096ff75960e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -121,7 +123,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -135,7 +137,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -276,14 +278,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py index efadbc3db7c6..546e5e0d7a78 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -176,7 +177,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -205,7 +206,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -241,7 +242,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -271,7 +272,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -303,7 +304,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -332,6 +333,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -348,7 +350,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -436,7 +438,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -539,7 +541,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -591,14 +593,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -753,7 +755,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -812,7 +814,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -870,7 +872,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) 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) @@ -929,14 +931,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1107,7 +1109,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1250,14 +1252,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1395,14 +1397,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1462,7 +1464,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py index a16fe63d2dfc..d01718ad4492 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py index cf3b808cee12..2b2efa444792 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_available_skus_request(location: str, subscription_id: str, **kwa "location": _SERIALIZER.url("location", location, "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") @@ -84,7 +85,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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") @@ -115,6 +116,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -181,7 +183,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -195,7 +197,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -336,14 +338,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py index 64cbdaa4001f..9e6da4f27d92 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py index 6ecd302a97e3..f3fab9f09502 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py index 0f8581a0c298..0220fffdb42b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -170,7 +172,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -273,7 +275,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -325,14 +327,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -487,7 +489,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -546,7 +548,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -604,7 +606,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) 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) @@ -663,14 +665,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -841,7 +843,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -984,14 +986,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1129,14 +1131,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1196,7 +1198,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py index d205d75717f7..7cdfaf525106 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py index 3304f5c45bdd..e33fd4bd1852 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -128,7 +130,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -142,7 +144,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -298,7 +300,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -312,7 +314,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -457,14 +459,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -595,14 +597,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -717,14 +719,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -842,14 +844,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py index c36c15bdc8a4..fda851bb3461 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -179,7 +180,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -211,7 +212,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -247,7 +248,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -279,7 +280,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -312,7 +313,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -445,7 +447,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -548,7 +550,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -600,14 +602,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -762,7 +764,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -821,7 +823,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -879,7 +881,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) 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) @@ -938,14 +940,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1116,7 +1118,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1259,14 +1261,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1404,14 +1406,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1471,7 +1473,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py index 7dd09d7e3cf1..99e597c77dff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py index 583c0b444d58..584fb480529e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_available_skus_request(location: str, subscription_id: str, **kwa "location": _SERIALIZER.url("location", location, "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") @@ -66,7 +67,7 @@ def build_list_available_skus_request(location: str, subscription_id: str, **kwa return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -87,7 +88,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -118,7 +119,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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") @@ -131,7 +132,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -152,7 +153,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -183,7 +184,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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") @@ -214,7 +215,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -245,6 +246,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -311,7 +313,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -325,7 +327,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -478,7 +480,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -492,7 +494,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -637,14 +639,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -775,14 +777,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -897,14 +899,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -1022,14 +1024,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py index 5cf52ec91103..3b07cfcd8739 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py index cf68687a0459..5bd4e9fe8c40 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py index eef4cd4a9d9e..b14554e6aafa 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -171,7 +173,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -275,7 +277,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -328,14 +330,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -491,7 +493,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,7 +611,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) 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) @@ -668,14 +670,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -847,7 +849,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -990,14 +992,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1136,14 +1138,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1204,7 +1206,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py index 186ed5d0fd28..2a1ae258fb2a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py index e3ec2fd1edeb..46205c1b3b74 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -148,7 +150,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -162,7 +164,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -308,14 +310,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -447,14 +449,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -570,14 +572,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -699,14 +701,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -845,14 +847,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py index ba14152b714a..4fda49684ec2 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -179,7 +180,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -211,7 +212,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -247,7 +248,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -279,7 +280,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -312,7 +313,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) 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) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py index 5b9ea9da5eba..a6eef976ba00 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py index 8a54dd5c2818..421f9a095688 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py index f497599a751b..f742e06fe5a5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py index 7dde29730a9f..ae2165b137d5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py index f2df0c31914a..82822efce7f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -171,7 +173,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -275,7 +277,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -328,14 +330,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -491,7 +493,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,7 +611,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) 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) @@ -668,14 +670,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -847,7 +849,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -990,14 +992,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1136,14 +1138,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1204,7 +1206,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py index a7a98689f79c..2ecc07ef01f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py index c05e68254e8b..c106a8e6b2e4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -148,7 +150,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -162,7 +164,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -308,14 +310,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -447,14 +449,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -570,14 +572,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -699,14 +701,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -845,14 +847,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py index 7d0e7750608a..0b7d2475476b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -179,7 +180,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -211,7 +212,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -247,7 +248,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -279,7 +280,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -312,7 +313,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) 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) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py index cbe9a98b454d..3c1c4d2ca3c5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py index 9a3179c2ce5d..c40a00faa1ea 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py index bcfa59dcd828..8306dec14e0a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json index 0ae7fe8ee06b..6ce10b8bac28 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py index b4ef1b3148ed..56fec44405a7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py index df68c5af7282..38437920ae10 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-03-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py index e91ad4ac279f..0300e958a52c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -82,7 +84,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -172,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -276,7 +278,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -329,14 +331,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -492,7 +494,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -551,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -610,7 +612,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) 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) @@ -669,14 +671,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -848,7 +850,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -991,14 +993,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1137,14 +1139,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1205,7 +1207,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py index 4dd8b9d246e0..6c46f9d0a93b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py index a92d389ee394..8fe6a2af603a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py index 64c601a9ad1f..334fbf316c1e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-03-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py index 009bbb92024c..bf950d2ce595 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -179,7 +180,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -211,7 +212,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -247,7 +248,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -279,7 +280,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -312,7 +313,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) 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) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py index 58cacc55eec4..d08e5a438cdf 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py index 1f746c6fc445..4f731b3a2940 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py index c2a21d5ea0e8..b5cfb66e881a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json index a11ff6d73786..e8521eb86417 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py index c0384889553e..1918e1eb4173 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py index d5702ee6beeb..fababcde6126 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-05-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py index 7f2a6d7885ad..30b8de32a063 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -82,7 +84,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -172,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -276,7 +278,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -329,14 +331,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -492,7 +494,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -551,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -610,7 +612,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) 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) @@ -669,14 +671,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -848,7 +850,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -991,14 +993,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1137,14 +1139,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1205,7 +1207,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py index 7cb78def255c..68cb7fb54d2c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py index 17cfa434d4a1..e80199eb7aad 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py index 57894b14f443..12c067b626e0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-05-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py index 42661ab49d20..50db634ee9da 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +117,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -148,7 +149,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -179,7 +180,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -211,7 +212,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -247,7 +248,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -279,7 +280,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -312,7 +313,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) 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) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py index 3fa30b00bee2..6af3c4e763ad 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py index 44b1fc10bee6..79b8fcea4d59 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py index 1780310bb86d..d4409cdfd6a9 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py @@ -62,9 +62,13 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json index 723bb3551693..90f2bce9ad02 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py index f9a3b3896ae9..db045aa7cf37 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py @@ -62,9 +62,13 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py index dd6395df7fcf..4e0e5e05939c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -130,14 +137,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-08-01-preview") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py index be495fac17ef..b25cc86b63c4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,9 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +255,16 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +323,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +429,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +484,16 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -640,7 +652,9 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -699,7 +713,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -758,7 +774,9 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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) @@ -817,14 +835,16 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -999,7 +1019,9 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1143,14 +1165,16 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1314,16 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1384,9 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py index 981c903171ac..d5127e411b26 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py index 65d2e11b60ac..7613041d8221 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -150,7 +152,9 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -164,7 +168,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -310,14 +314,16 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -450,14 +456,16 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -574,14 +582,16 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -703,14 +713,16 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -849,14 +861,16 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py index 7d071802c658..3dbcf4a226f6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -164,14 +171,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-08-01-preview") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py index c10c8d5b9a2f..011bc3d18e29 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -392,7 +394,9 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -560,14 +564,16 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -626,7 +632,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -730,7 +738,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -783,14 +793,16 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -949,7 +961,9 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1008,7 +1022,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1067,7 +1083,9 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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) @@ -1126,14 +1144,16 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1328,9 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1452,14 +1474,16 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1599,14 +1623,16 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1667,7 +1693,9 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py index 698998454f77..e2bf4d79d7ab 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py index 5b42d1f7408f..5ca8eb7632a2 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -339,7 +341,9 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -353,7 +357,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -499,14 +503,16 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -639,14 +645,16 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -763,14 +771,16 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -892,14 +902,16 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1038,14 +1050,16 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py index 7fbf42ad5361..a13d81c6351f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json index 9be4f502274b..5253cd8b10c0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py index a0e045602b21..6152927dc35f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py index 5576f92363e2..fe11c094d347 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-12-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py index ca448438ed6c..d51180270941 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -755,7 +757,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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) @@ -814,14 +816,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -993,7 +995,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1136,14 +1138,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1282,14 +1284,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1350,7 +1352,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py index 123f2db390eb..420e21944fe5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py index d201b7bd09e4..1b65211ff248 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py index 4a7112748091..0dfbca76d969 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-12-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py index a9ea33461aeb..9b2f250e5b64 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1062,7 +1064,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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) @@ -1121,14 +1123,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1300,7 +1302,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1443,14 +1445,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1589,14 +1591,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1657,7 +1659,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py index 4480beae538b..666f199fab6c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py index 4ca7ca0528aa..a9eef9615509 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py index 672108e0a0f5..64ac6320f190 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json index 6ea2711f5443..bc5a4c1048c1 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py index 93a6c5fa4f40..d38dd558d80a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py index 98224f67df95..8d59164bcc29 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-02-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py index e335e4040a6d..ef12750bdd26 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -755,7 +757,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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) @@ -814,14 +816,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -993,7 +995,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1136,14 +1138,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1282,14 +1284,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1350,7 +1352,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py index 5ca5b405a9db..f653ebf468e9 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py index 2b79c20ec4fe..67cf318b7b09 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py index 459ae9506465..611ef3dbd284 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-02-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py index af4d660d9695..4a06c49c3657 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1062,7 +1064,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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) @@ -1121,14 +1123,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1300,7 +1302,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1443,14 +1445,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1589,14 +1591,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1657,7 +1659,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py index 75612938ade1..634de61ad99a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py index 1abb0c2b10be..9ceff20045b3 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py index 12a9ae472094..b83f51600fe1 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json index 879373027b55..5b010b121a2f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py index c58d4a2be848..f9a2f9f0543a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py index e489342faa0d..6c21245cb2d7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-09-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py index 31e4d866e35f..65efcb311a7a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py index d768d9798c7e..06cb565f542b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py index ee5e433f777a..280c78ab3c5f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py index 0c2e090e360e..b216975dc66c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-09-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py index 2a1797e21393..21813d33fef5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py index 1620898f063d..461e98d32370 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py index 164144b481a0..d5acd64fa5f7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py index abb0bfd77611..68aaaa401928 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json index b67476eb5fa4..7f5a6e0deceb 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py index 157f92f3a74b..5a817e4fcd17 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py index 1db8b41616e1..3f651cff3d85 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-10-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py index 154830720520..8931f017832e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py index 3d00fb6aebb0..8a135190aea6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py index ac82c2c62441..1c32619d0d0f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py index 2341c336899a..7d9029920fda 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-10-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py index 097793c05056..342a7cc01613 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py index acde6931fb82..49e9804f083d 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py index c189abb657b1..51b896cb2da0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py index 91fe025a43d1..914b9d7083f7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json index 5589f7f180c3..6d59eeeb5384 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_vendor.py index ec8d8f6dd7b4..9f9a6a04708b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_vendor.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class DataBoxManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py index 34416e5ebff4..c25eab0db2ba 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( 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.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py index 143079f74210..eb03bf8d254e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-12-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py index 2c1a7efc5c42..f8f24f83e7f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py index d5b3d10d4b36..1cb66801a8e0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py index aa4b6a937c05..003955b11dc0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py index bcbc02eab000..9ba6f5fac6a0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-12-01") + ) 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(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py index 3300801ba281..6bba0af99561 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,7 +86,7 @@ def build_mark_devices_shipped_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,7 +118,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +151,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -182,7 +183,7 @@ def build_create_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -213,7 +214,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -245,7 +246,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -281,7 +282,7 @@ def build_book_shipment_pick_up_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -313,7 +314,7 @@ def build_cancel_request(resource_group_name: str, job_name: str, subscription_i "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -346,7 +347,7 @@ def build_list_credentials_request( "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, 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") @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py index 5800edfae7bb..66375851ee07 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py index a50ea56fee4d..98c01041c443 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import DataBoxManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -57,7 +58,7 @@ def build_list_available_skus_by_resource_group_request( # pylint: disable=name "location": _SERIALIZER.url("location", location, "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") @@ -88,7 +89,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "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 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -122,7 +123,7 @@ def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too "location": _SERIALIZER.url("location", location, "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") @@ -153,7 +154,7 @@ def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: "location": _SERIALIZER.url("location", location, "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 +185,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw "location": _SERIALIZER.url("location", location, "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") @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -218,7 +219,7 @@ def build_region_configuration_by_resource_group_request( # pylint: disable=nam "location": _SERIALIZER.url("location", location, "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") @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py new file mode 100644 index 000000000000..063260fb2814 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py new file mode 100644 index 000000000000..03bb837d6c53 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-03-01". 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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-03-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py new file mode 100644 index 000000000000..96bdf94320a7 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_03_01.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_03_01.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_03_01.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. 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-03-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "DataBoxManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json new file mode 100644 index 000000000000..813f70e6f4a8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json @@ -0,0 +1,133 @@ +{ + "chosen_version": "2023-03-01", + "total_api_version_list": ["2023-03-01"], + "client": { + "name": "DataBoxManagementClient", + "filename": "_data_box_management_client", + "description": "The DataBox Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "jobs": "JobsOperations", + "service": "ServiceOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", + "operations": { + "mitigate" : { + "sync": { + "signature": "def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + } + } + } + } +} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py new file mode 100644 index 000000000000..9f9a6a04708b --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + +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 + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py new file mode 100644 index 000000000000..955dbd6c6677 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py new file mode 100644 index 000000000000..46a49bad20af --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-03-01". 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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-03-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py new file mode 100644 index 000000000000..1cabfa5a53c6 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_03_01.aio.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_03_01.aio.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_03_01.aio.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. 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-03-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataBoxManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py new file mode 100644 index 000000000000..54f3d3ec6541 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..9a9f48e22fa1 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._data_box_management_client_operations import build_mitigate_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-03-01") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py new file mode 100644 index 000000000000..8382f0674699 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py @@ -0,0 +1,1434 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import ( + build_book_shipment_pick_up_request, + build_cancel_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_credentials_request, + build_list_request, + build_mark_devices_shipped_request, + build_update_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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("JobResourceList", 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.ApiError, 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.DataBox/jobs" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_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._api_version or "2023-03-01")) + 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, + job_name=job_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.DataBox/jobs/{jobName}" + } + + async def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.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("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py new file mode 100644 index 000000000000..b3df02152871 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.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._api_version or "2023-03-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py new file mode 100644 index 000000000000..0ee6af375b78 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py @@ -0,0 +1,899 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_operations import ( + build_list_available_skus_by_resource_group_request, + build_region_configuration_by_resource_group_request, + build_region_configuration_request, + build_validate_address_request, + build_validate_inputs_by_resource_group_request, + build_validate_inputs_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + async def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py new file mode 100644 index 000000000000..3eb7624e41b8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py @@ -0,0 +1,331 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AccountCredentialDetails +from ._models_py3 import AdditionalErrorInfo +from ._models_py3 import AddressValidationOutput +from ._models_py3 import AddressValidationProperties +from ._models_py3 import ApiError +from ._models_py3 import ApplianceNetworkConfiguration +from ._models_py3 import ArmBaseObject +from ._models_py3 import AvailableSkuRequest +from ._models_py3 import AvailableSkusResult +from ._models_py3 import AzureFileFilterDetails +from ._models_py3 import BlobFilterDetails +from ._models_py3 import CancellationReason +from ._models_py3 import CloudError +from ._models_py3 import ContactDetails +from ._models_py3 import ContactInfo +from ._models_py3 import CopyLogDetails +from ._models_py3 import CopyProgress +from ._models_py3 import CreateJobValidations +from ._models_py3 import CreateOrderLimitForSubscriptionValidationRequest +from ._models_py3 import CreateOrderLimitForSubscriptionValidationResponseProperties +from ._models_py3 import CustomerDiskJobSecrets +from ._models_py3 import DataAccountDetails +from ._models_py3 import DataBoxAccountCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyProgress +from ._models_py3 import DataBoxCustomerDiskJobDetails +from ._models_py3 import DataBoxDiskCopyLogDetails +from ._models_py3 import DataBoxDiskCopyProgress +from ._models_py3 import DataBoxDiskGranularCopyLogDetails +from ._models_py3 import DataBoxDiskGranularCopyProgress +from ._models_py3 import DataBoxDiskJobDetails +from ._models_py3 import DataBoxDiskJobSecrets +from ._models_py3 import DataBoxHeavyAccountCopyLogDetails +from ._models_py3 import DataBoxHeavyJobDetails +from ._models_py3 import DataBoxHeavyJobSecrets +from ._models_py3 import DataBoxHeavySecret +from ._models_py3 import DataBoxJobDetails +from ._models_py3 import DataBoxScheduleAvailabilityRequest +from ._models_py3 import DataBoxSecret +from ._models_py3 import DataExportDetails +from ._models_py3 import DataImportDetails +from ._models_py3 import DataLocationToServiceLocationMap +from ._models_py3 import DataTransferDetailsValidationRequest +from ._models_py3 import DataTransferDetailsValidationResponseProperties +from ._models_py3 import DataboxJobSecrets +from ._models_py3 import DatacenterAddressInstructionResponse +from ._models_py3 import DatacenterAddressLocationResponse +from ._models_py3 import DatacenterAddressRequest +from ._models_py3 import DatacenterAddressResponse +from ._models_py3 import DcAccessSecurityCode +from ._models_py3 import Details +from ._models_py3 import DeviceErasureDetails +from ._models_py3 import DiskScheduleAvailabilityRequest +from ._models_py3 import DiskSecret +from ._models_py3 import EncryptionPreferences +from ._models_py3 import ErrorDetail +from ._models_py3 import ExportDiskDetails +from ._models_py3 import FilterFileDetails +from ._models_py3 import GranularCopyLogDetails +from ._models_py3 import GranularCopyProgress +from ._models_py3 import HeavyScheduleAvailabilityRequest +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportDiskDetails +from ._models_py3 import JobDelayDetails +from ._models_py3 import JobDeliveryInfo +from ._models_py3 import JobDetails +from ._models_py3 import JobResource +from ._models_py3 import JobResourceList +from ._models_py3 import JobResourceUpdateParameter +from ._models_py3 import JobSecrets +from ._models_py3 import JobStages +from ._models_py3 import KeyEncryptionKey +from ._models_py3 import LastMitigationActionOnJob +from ._models_py3 import ManagedDiskDetails +from ._models_py3 import MarkDevicesShippedRequest +from ._models_py3 import MitigateJobRequest +from ._models_py3 import NotificationPreference +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import PackageCarrierDetails +from ._models_py3 import PackageCarrierInfo +from ._models_py3 import PackageShippingDetails +from ._models_py3 import Preferences +from ._models_py3 import PreferencesValidationRequest +from ._models_py3 import PreferencesValidationResponseProperties +from ._models_py3 import RegionConfigurationRequest +from ._models_py3 import RegionConfigurationResponse +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import ReverseShippingDetails +from ._models_py3 import ScheduleAvailabilityRequest +from ._models_py3 import ScheduleAvailabilityResponse +from ._models_py3 import ShareCredentialDetails +from ._models_py3 import ShipmentPickUpRequest +from ._models_py3 import ShipmentPickUpResponse +from ._models_py3 import ShippingAddress +from ._models_py3 import Sku +from ._models_py3 import SkuAvailabilityValidationRequest +from ._models_py3 import SkuAvailabilityValidationResponseProperties +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import StorageAccountDetails +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationRequest +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationResponseProperties +from ._models_py3 import SystemData +from ._models_py3 import TransferAllDetails +from ._models_py3 import TransferConfiguration +from ._models_py3 import TransferConfigurationTransferAllDetails +from ._models_py3 import TransferConfigurationTransferFilterDetails +from ._models_py3 import TransferFilterDetails +from ._models_py3 import TransportAvailabilityDetails +from ._models_py3 import TransportAvailabilityRequest +from ._models_py3 import TransportAvailabilityResponse +from ._models_py3 import TransportPreferences +from ._models_py3 import UnencryptedCredentials +from ._models_py3 import UnencryptedCredentialsList +from ._models_py3 import UpdateJobDetails +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedProperties +from ._models_py3 import ValidateAddress +from ._models_py3 import ValidationInputRequest +from ._models_py3 import ValidationInputResponse +from ._models_py3 import ValidationRequest +from ._models_py3 import ValidationResponse + +from ._data_box_management_client_enums import AccessProtocol +from ._data_box_management_client_enums import AddressType +from ._data_box_management_client_enums import AddressValidationStatus +from ._data_box_management_client_enums import ClassDiscriminator +from ._data_box_management_client_enums import CopyStatus +from ._data_box_management_client_enums import CustomerResolutionCode +from ._data_box_management_client_enums import DataAccountType +from ._data_box_management_client_enums import DataCenterCode +from ._data_box_management_client_enums import DatacenterAddressType +from ._data_box_management_client_enums import DelayNotificationStatus +from ._data_box_management_client_enums import DoubleEncryption +from ._data_box_management_client_enums import FilterFileType +from ._data_box_management_client_enums import HardwareEncryption +from ._data_box_management_client_enums import JobDeliveryType +from ._data_box_management_client_enums import KekType +from ._data_box_management_client_enums import LogCollectionLevel +from ._data_box_management_client_enums import NotificationStageName +from ._data_box_management_client_enums import OverallValidationStatus +from ._data_box_management_client_enums import PortalDelayErrorCode +from ._data_box_management_client_enums import ReverseShippingDetailsEditStatus +from ._data_box_management_client_enums import ReverseTransportPreferenceEditStatus +from ._data_box_management_client_enums import ShareDestinationFormatType +from ._data_box_management_client_enums import SkuDisabledReason +from ._data_box_management_client_enums import SkuName +from ._data_box_management_client_enums import StageName +from ._data_box_management_client_enums import StageStatus +from ._data_box_management_client_enums import TransferConfigurationType +from ._data_box_management_client_enums import TransferType +from ._data_box_management_client_enums import TransportShipmentTypes +from ._data_box_management_client_enums import ValidationInputDiscriminator +from ._data_box_management_client_enums import ValidationStatus +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccountCredentialDetails", + "AdditionalErrorInfo", + "AddressValidationOutput", + "AddressValidationProperties", + "ApiError", + "ApplianceNetworkConfiguration", + "ArmBaseObject", + "AvailableSkuRequest", + "AvailableSkusResult", + "AzureFileFilterDetails", + "BlobFilterDetails", + "CancellationReason", + "CloudError", + "ContactDetails", + "ContactInfo", + "CopyLogDetails", + "CopyProgress", + "CreateJobValidations", + "CreateOrderLimitForSubscriptionValidationRequest", + "CreateOrderLimitForSubscriptionValidationResponseProperties", + "CustomerDiskJobSecrets", + "DataAccountDetails", + "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDiskCopyLogDetails", + "DataBoxCustomerDiskCopyProgress", + "DataBoxCustomerDiskJobDetails", + "DataBoxDiskCopyLogDetails", + "DataBoxDiskCopyProgress", + "DataBoxDiskGranularCopyLogDetails", + "DataBoxDiskGranularCopyProgress", + "DataBoxDiskJobDetails", + "DataBoxDiskJobSecrets", + "DataBoxHeavyAccountCopyLogDetails", + "DataBoxHeavyJobDetails", + "DataBoxHeavyJobSecrets", + "DataBoxHeavySecret", + "DataBoxJobDetails", + "DataBoxScheduleAvailabilityRequest", + "DataBoxSecret", + "DataExportDetails", + "DataImportDetails", + "DataLocationToServiceLocationMap", + "DataTransferDetailsValidationRequest", + "DataTransferDetailsValidationResponseProperties", + "DataboxJobSecrets", + "DatacenterAddressInstructionResponse", + "DatacenterAddressLocationResponse", + "DatacenterAddressRequest", + "DatacenterAddressResponse", + "DcAccessSecurityCode", + "Details", + "DeviceErasureDetails", + "DiskScheduleAvailabilityRequest", + "DiskSecret", + "EncryptionPreferences", + "ErrorDetail", + "ExportDiskDetails", + "FilterFileDetails", + "GranularCopyLogDetails", + "GranularCopyProgress", + "HeavyScheduleAvailabilityRequest", + "IdentityProperties", + "ImportDiskDetails", + "JobDelayDetails", + "JobDeliveryInfo", + "JobDetails", + "JobResource", + "JobResourceList", + "JobResourceUpdateParameter", + "JobSecrets", + "JobStages", + "KeyEncryptionKey", + "LastMitigationActionOnJob", + "ManagedDiskDetails", + "MarkDevicesShippedRequest", + "MitigateJobRequest", + "NotificationPreference", + "Operation", + "OperationDisplay", + "OperationList", + "PackageCarrierDetails", + "PackageCarrierInfo", + "PackageShippingDetails", + "Preferences", + "PreferencesValidationRequest", + "PreferencesValidationResponseProperties", + "RegionConfigurationRequest", + "RegionConfigurationResponse", + "Resource", + "ResourceIdentity", + "ReverseShippingDetails", + "ScheduleAvailabilityRequest", + "ScheduleAvailabilityResponse", + "ShareCredentialDetails", + "ShipmentPickUpRequest", + "ShipmentPickUpResponse", + "ShippingAddress", + "Sku", + "SkuAvailabilityValidationRequest", + "SkuAvailabilityValidationResponseProperties", + "SkuCapacity", + "SkuCost", + "SkuInformation", + "StorageAccountDetails", + "SubscriptionIsAllowedToCreateJobValidationRequest", + "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + "SystemData", + "TransferAllDetails", + "TransferConfiguration", + "TransferConfigurationTransferAllDetails", + "TransferConfigurationTransferFilterDetails", + "TransferFilterDetails", + "TransportAvailabilityDetails", + "TransportAvailabilityRequest", + "TransportAvailabilityResponse", + "TransportPreferences", + "UnencryptedCredentials", + "UnencryptedCredentialsList", + "UpdateJobDetails", + "UserAssignedIdentity", + "UserAssignedProperties", + "ValidateAddress", + "ValidationInputRequest", + "ValidationInputResponse", + "ValidationRequest", + "ValidationResponse", + "AccessProtocol", + "AddressType", + "AddressValidationStatus", + "ClassDiscriminator", + "CopyStatus", + "CustomerResolutionCode", + "DataAccountType", + "DataCenterCode", + "DatacenterAddressType", + "DelayNotificationStatus", + "DoubleEncryption", + "FilterFileType", + "HardwareEncryption", + "JobDeliveryType", + "KekType", + "LogCollectionLevel", + "NotificationStageName", + "OverallValidationStatus", + "PortalDelayErrorCode", + "ReverseShippingDetailsEditStatus", + "ReverseTransportPreferenceEditStatus", + "ShareDestinationFormatType", + "SkuDisabledReason", + "SkuName", + "StageName", + "StageStatus", + "TransferConfigurationType", + "TransferType", + "TransportShipmentTypes", + "ValidationInputDiscriminator", + "ValidationStatus", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py new file mode 100644 index 000000000000..20d8d293952b --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py @@ -0,0 +1,505 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AccessProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessProtocol.""" + + SMB = "SMB" + """Server Message Block protocol(SMB).""" + NFS = "NFS" + """Network File System protocol(NFS).""" + + +class AddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of address.""" + + NONE = "None" + """Address type not known.""" + RESIDENTIAL = "Residential" + """Residential Address.""" + COMMERCIAL = "Commercial" + """Commercial Address.""" + + +class AddressValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The address validation status.""" + + VALID = "Valid" + """Address provided is valid.""" + INVALID = "Invalid" + """Address provided is invalid or not supported.""" + AMBIGUOUS = "Ambiguous" + """Address provided is ambiguous, please choose one of the alternate addresses returned.""" + + +class ClassDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the type of job details.""" + + DATA_BOX = "DataBox" + """Data Box orders.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk orders.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy orders.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk orders.""" + + +class CopyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Status of the copy.""" + + NOT_STARTED = "NotStarted" + """Data copy hasn't started yet.""" + IN_PROGRESS = "InProgress" + """Data copy is in progress.""" + COMPLETED = "Completed" + """Data copy completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Data copy completed with errors.""" + FAILED = "Failed" + """Data copy failed. No data was copied.""" + NOT_RETURNED = "NotReturned" + """No copy triggered as device was not returned.""" + HARDWARE_ERROR = "HardwareError" + """The Device has hit hardware issues.""" + DEVICE_FORMATTED = "DeviceFormatted" + """Data copy failed. The Device was formatted by user.""" + DEVICE_METADATA_MODIFIED = "DeviceMetadataModified" + """Data copy failed. Device metadata was modified by user.""" + STORAGE_ACCOUNT_NOT_ACCESSIBLE = "StorageAccountNotAccessible" + """Data copy failed. Storage Account was not accessible during copy.""" + UNSUPPORTED_DATA = "UnsupportedData" + """Data copy failed. The Device data content is not supported.""" + DRIVE_NOT_RECEIVED = "DriveNotReceived" + """No copy triggered as device was not received.""" + UNSUPPORTED_DRIVE = "UnsupportedDrive" + """No copy triggered as device type is not supported.""" + OTHER_SERVICE_ERROR = "OtherServiceError" + """Copy failed due to service error.""" + OTHER_USER_ERROR = "OtherUserError" + """Copy failed due to user error.""" + DRIVE_NOT_DETECTED = "DriveNotDetected" + """Copy failed due to disk detection error.""" + DRIVE_CORRUPTED = "DriveCorrupted" + """Copy failed due to corrupted drive.""" + METADATA_FILES_MODIFIED_OR_REMOVED = "MetadataFilesModifiedOrRemoved" + """Copy failed due to modified or removed metadata files.""" + + +class CustomerResolutionCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CustomerResolutionCode.""" + + NONE = "None" + """No Resolution Yet""" + MOVE_TO_CLEAN_UP_DEVICE = "MoveToCleanUpDevice" + """Clean the device""" + RESUME = "Resume" + """Resume the job to same stage""" + RESTART = "Restart" + """Restart whole action.""" + REACH_OUT_TO_OPERATION = "ReachOutToOperation" + """Reach out to operation for further action.""" + + +class DataAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the account.""" + + STORAGE_ACCOUNT = "StorageAccount" + """Storage Accounts .""" + MANAGED_DISK = "ManagedDisk" + """Azure Managed disk storage.""" + + +class DatacenterAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data center address type.""" + + DATACENTER_ADDRESS_LOCATION = "DatacenterAddressLocation" + """Data center address location.""" + DATACENTER_ADDRESS_INSTRUCTION = "DatacenterAddressInstruction" + """Data center address instruction.""" + + +class DataCenterCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataCenter code.""" + + INVALID = "Invalid" + BY2 = "BY2" + BY1 = "BY1" + ORK70 = "ORK70" + AM2 = "AM2" + AMS20 = "AMS20" + BY21 = "BY21" + BY24 = "BY24" + MWH01 = "MWH01" + AMS06 = "AMS06" + SSE90 = "SSE90" + SYD03 = "SYD03" + SYD23 = "SYD23" + CBR20 = "CBR20" + YTO20 = "YTO20" + CWL20 = "CWL20" + LON24 = "LON24" + BOM01 = "BOM01" + BL20 = "BL20" + BL7 = "BL7" + SEL20 = "SEL20" + TYO01 = "TYO01" + BN1 = "BN1" + SN5 = "SN5" + CYS04 = "CYS04" + TYO22 = "TYO22" + YTO21 = "YTO21" + YQB20 = "YQB20" + FRA22 = "FRA22" + MAA01 = "MAA01" + CPQ02 = "CPQ02" + CPQ20 = "CPQ20" + SIN20 = "SIN20" + HKG20 = "HKG20" + SG2 = "SG2" + MEL23 = "MEL23" + SEL21 = "SEL21" + OSA20 = "OSA20" + SHA03 = "SHA03" + BJB = "BJB" + JNB22 = "JNB22" + JNB21 = "JNB21" + MNZ21 = "MNZ21" + SN8 = "SN8" + AUH20 = "AUH20" + ZRH20 = "ZRH20" + PUS20 = "PUS20" + AD_HOC = "AdHoc" + CH1 = "CH1" + DSM05 = "DSM05" + DUB07 = "DUB07" + PNQ01 = "PNQ01" + SVG20 = "SVG20" + OSA02 = "OSA02" + OSA22 = "OSA22" + PAR22 = "PAR22" + BN7 = "BN7" + SN6 = "SN6" + BJS20 = "BJS20" + + +class DelayNotificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of notification.""" + + ACTIVE = "Active" + """Delay is still active""" + RESOLVED = "Resolved" + """Delay has been resolved""" + + +class DoubleEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines secondary layer of software-based encryption enablement.""" + + ENABLED = "Enabled" + """Software-based encryption is enabled.""" + DISABLED = "Disabled" + """Software-based encryption is disabled.""" + + +class FilterFileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the filter file.""" + + AZURE_BLOB = "AzureBlob" + """Filter file is of the type AzureBlob.""" + AZURE_FILE = "AzureFile" + """Filter file is of the type AzureFiles.""" + + +class HardwareEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines Hardware level encryption (Only for disk).""" + + ENABLED = "Enabled" + """Hardware-based encryption is enabled.""" + DISABLED = "Disabled" + """Hardware-based encryption is enabled.""" + + +class JobDeliveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delivery type of Job.""" + + NON_SCHEDULED = "NonScheduled" + """Non Scheduled job.""" + SCHEDULED = "Scheduled" + """Scheduled job.""" + + +class KekType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of encryption key used for key encryption.""" + + MICROSOFT_MANAGED = "MicrosoftManaged" + """Key encryption key is managed by Microsoft.""" + CUSTOMER_MANAGED = "CustomerManaged" + """Key encryption key is managed by the Customer.""" + + +class LogCollectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the logs to be collected.""" + + ERROR = "Error" + """Only Errors will be collected in the logs.""" + VERBOSE = "Verbose" + """Verbose logging (includes Errors, CRC, size information and others).""" + + +class NotificationStageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage.""" + + DEVICE_PREPARED = "DevicePrepared" + """Notification at device prepared stage.""" + DISPATCHED = "Dispatched" + """Notification at device dispatched stage.""" + DELIVERED = "Delivered" + """Notification at device delivered stage.""" + PICKED_UP = "PickedUp" + """Notification at device picked up from user stage.""" + AT_AZURE_DC = "AtAzureDC" + """Notification at device received at Azure datacenter stage.""" + DATA_COPY = "DataCopy" + """Notification at data copy started stage.""" + CREATED = "Created" + """Notification at job created stage.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Notification at shipped devices to customer stage.""" + + +class OverallValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Overall validation status.""" + + ALL_VALID_TO_PROCEED = "AllValidToProceed" + """Every input request is valid.""" + INPUTS_REVISIT_REQUIRED = "InputsRevisitRequired" + """Some input requests are not valid.""" + CERTAIN_INPUT_VALIDATIONS_SKIPPED = "CertainInputValidationsSkipped" + """Certain input validations skipped.""" + + +class PortalDelayErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delay Error code.""" + + INTERNAL_ISSUE_DELAY = "InternalIssueDelay" + """Delay due to any internal reasons""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Active Order limit breached.""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """High demand""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Slow copy due to large number of files""" + + +class ReverseShippingDetailsEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Shipping Address and Contact Info.""" + + ENABLED = "Enabled" + """Reverse shipping details can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse shipping details.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse shipping details. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ReverseTransportPreferenceEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Transport preferences.""" + + ENABLED = "Enabled" + """Reverse Transport Preferences can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse Transport Preferences.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse Transport Preferences. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ShareDestinationFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the share.""" + + UNKNOWN_TYPE = "UnknownType" + """Unknown format.""" + HCS = "HCS" + """Storsimple data format.""" + BLOCK_BLOB = "BlockBlob" + """Azure storage block blob format.""" + PAGE_BLOB = "PageBlob" + """Azure storage page blob format.""" + AZURE_FILE = "AzureFile" + """Azure storage file format.""" + MANAGED_DISK = "ManagedDisk" + """Azure Compute Disk.""" + + +class SkuDisabledReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Reason why the Sku is disabled.""" + + NONE = "None" + """SKU is not disabled.""" + COUNTRY = "Country" + """SKU is not available in the requested country.""" + REGION = "Region" + """SKU is not available to push data to the requested Azure region.""" + FEATURE = "Feature" + """Required features are not enabled for the SKU.""" + OFFER_TYPE = "OfferType" + """Subscription does not have required offer types for the SKU.""" + NO_SUBSCRIPTION_INFO = "NoSubscriptionInfo" + """Subscription has not registered to Microsoft.DataBox and Service does not have the subscription + #: notification.""" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SkuName.""" + + DATA_BOX = "DataBox" + """Data Box.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk""" + + +class StageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage which is in progress.""" + + DEVICE_ORDERED = "DeviceOrdered" + """An order has been created.""" + DEVICE_PREPARED = "DevicePrepared" + """A device has been prepared for the order.""" + DISPATCHED = "Dispatched" + """Device has been dispatched to the user of the order.""" + DELIVERED = "Delivered" + """Device has been delivered to the user of the order.""" + PICKED_UP = "PickedUp" + """Device has been picked up from user and in transit to Azure datacenter.""" + AT_AZURE_DC = "AtAzureDC" + """Device has been received at Azure datacenter from the user.""" + DATA_COPY = "DataCopy" + """Data copy from the device at Azure datacenter.""" + COMPLETED = "Completed" + """Order has completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Order has completed with errors.""" + CANCELLED = "Cancelled" + """Order has been cancelled.""" + FAILED_ISSUE_REPORTED_AT_CUSTOMER = "Failed_IssueReportedAtCustomer" + """Order has failed due to issue reported by user.""" + FAILED_ISSUE_DETECTED_AT_AZURE_DC = "Failed_IssueDetectedAtAzureDC" + """Order has failed due to issue detected at Azure datacenter.""" + ABORTED = "Aborted" + """Order has been aborted.""" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """Order has completed with warnings.""" + READY_TO_DISPATCH_FROM_AZURE_DC = "ReadyToDispatchFromAzureDC" + """Device is ready to be handed to customer from Azure DC.""" + READY_TO_RECEIVE_AT_AZURE_DC = "ReadyToReceiveAtAzureDC" + """Device can be dropped off at Azure DC.""" + CREATED = "Created" + """Job created by the customer.""" + SHIPPED_TO_AZURE_DC = "ShippedToAzureDC" + """User shipped the device to AzureDC.""" + AWAITING_SHIPMENT_DETAILS = "AwaitingShipmentDetails" + """Awaiting shipment details of device from customer.""" + PREPARING_TO_SHIP_FROM_AZURE_DC = "PreparingToShipFromAzureDC" + """Preparing the device to ship to customer.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Shipped the device to customer.""" + + +class StageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Holds the device erasure completion status.""" + + NONE = "None" + """No status available yet.""" + IN_PROGRESS = "InProgress" + """Stage is in progress.""" + SUCCEEDED = "Succeeded" + """Stage has succeeded.""" + FAILED = "Failed" + """Stage has failed.""" + CANCELLED = "Cancelled" + """Stage has been cancelled.""" + CANCELLING = "Cancelling" + """Stage is cancelling.""" + SUCCEEDED_WITH_ERRORS = "SucceededWithErrors" + """Stage has succeeded with errors.""" + WAITING_FOR_CUSTOMER_ACTION = "WaitingForCustomerAction" + """Stage is stuck until customer takes some action.""" + SUCCEEDED_WITH_WARNINGS = "SucceededWithWarnings" + """Stage has succeeded with warnings.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_KEK = "WaitingForCustomerActionForKek" + """Stage is waiting for customer action for kek action items.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_CLEAN_UP = "WaitingForCustomerActionForCleanUp" + """Stage is waiting for customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED_FOR_CLEAN_UP = "CustomerActionPerformedForCleanUp" + """Stage has performed customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED = "CustomerActionPerformed" + """Stage has performed customer action for clean up.""" + + +class TransferConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the configuration for transfer.""" + + TRANSFER_ALL = "TransferAll" + """Transfer all the data.""" + TRANSFER_USING_FILTER = "TransferUsingFilter" + """Transfer using filter.""" + + +class TransferType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the transfer.""" + + IMPORT_TO_AZURE = "ImportToAzure" + """Import data to azure.""" + EXPORT_FROM_AZURE = "ExportFromAzure" + """Export data from azure.""" + + +class TransportShipmentTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transport Shipment Type supported for given region.""" + + CUSTOMER_MANAGED = "CustomerManaged" + """Shipment Logistics is handled by the customer.""" + MICROSOFT_MANAGED = "MicrosoftManaged" + """Shipment Logistics is handled by Microsoft.""" + + +class ValidationInputDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identifies the type of validation request.""" + + VALIDATE_ADDRESS = "ValidateAddress" + """Identify request and response of address validation.""" + VALIDATE_SUBSCRIPTION_IS_ALLOWED_TO_CREATE_JOB = "ValidateSubscriptionIsAllowedToCreateJob" + """Identify request and response for validation of subscription permission to create job.""" + VALIDATE_PREFERENCES = "ValidatePreferences" + """Identify request and response of preference validation.""" + VALIDATE_CREATE_ORDER_LIMIT = "ValidateCreateOrderLimit" + """Identify request and response of create order limit for subscription validation.""" + VALIDATE_SKU_AVAILABILITY = "ValidateSkuAvailability" + """Identify request and response of active job limit for sku availability.""" + VALIDATE_DATA_TRANSFER_DETAILS = "ValidateDataTransferDetails" + """Identify request and response of data transfer details validation.""" + + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Create order limit validation status.""" + + VALID = "Valid" + """Validation is successful""" + INVALID = "Invalid" + """Validation is not successful""" + SKIPPED = "Skipped" + """Validation is skipped""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py new file mode 100644 index 000000000000..0b46baa61bcb --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py @@ -0,0 +1,6457 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccountCredentialDetails(_serialization.Model): + """Credential details of the account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_name: Name of the account. + :vartype account_name: str + :ivar data_account_type: Type of the account. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_connection_string: Connection string of the account endpoint to use the account + as a storage endpoint on the device. + :vartype account_connection_string: str + :ivar share_credential_details: Per share level unencrypted access credentials. + :vartype share_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.ShareCredentialDetails] + """ + + _validation = { + "account_name": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_connection_string": {"readonly": True}, + "share_credential_details": {"readonly": True}, + } + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_connection_string": {"key": "accountConnectionString", "type": "str"}, + "share_credential_details": {"key": "shareCredentialDetails", "type": "[ShareCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.account_name = None + self.data_account_type = None + self.account_connection_string = None + self.share_credential_details = None + + +class AdditionalErrorInfo(_serialization.Model): + """This class represents additional info which Resource Providers pass when an error occurs. + + :ivar info: Additional information of the type of error. + :vartype info: JSON + :ivar type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :vartype type: str + """ + + _attribute_map = { + "info": {"key": "info", "type": "object"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, info: Optional[JSON] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword info: Additional information of the type of error. + :paramtype info: JSON + :keyword type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :paramtype type: str + """ + super().__init__(**kwargs) + self.info = info + self.type = type + + +class AddressValidationOutput(_serialization.Model): + """Output of the address validation api. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_type: Identifies the type of validation response. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_03_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_03_01.models.ShippingAddress] + """ + + _validation = { + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "properties.validationType", "type": "str"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "validation_status": {"key": "properties.validationStatus", "type": "str"}, + "alternate_addresses": {"key": "properties.alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + self.validation_status = None + self.alternate_addresses = None + + +class ValidationInputResponse(_serialization.Model): + """Minimum properties that should be present in each individual validation response. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AddressValidationProperties, CreateOrderLimitForSubscriptionValidationResponseProperties, + DataTransferDetailsValidationResponseProperties, PreferencesValidationResponseProperties, + SkuAvailabilityValidationResponseProperties, + SubscriptionIsAllowedToCreateJobValidationResponseProperties + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "AddressValidationProperties", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationResponseProperties", + "ValidateDataTransferDetails": "DataTransferDetailsValidationResponseProperties", + "ValidatePreferences": "PreferencesValidationResponseProperties", + "ValidateSkuAvailability": "SkuAvailabilityValidationResponseProperties", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + + +class AddressValidationProperties(ValidationInputResponse): + """The address validation output. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_03_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_03_01.models.ShippingAddress] + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "validation_status": {"key": "validationStatus", "type": "str"}, + "alternate_addresses": {"key": "alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.validation_status = None + self.alternate_addresses = None + + +class ApiError(_serialization.Model): + """ApiError. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.ErrorDetail + """ + + _validation = { + "error": {"required": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: "_models.ErrorDetail", **kwargs: Any) -> None: + """ + :keyword error: Required. + :paramtype error: ~azure.mgmt.databox.v2023_03_01.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ApplianceNetworkConfiguration(_serialization.Model): + """The Network Adapter configuration of a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the network. + :vartype name: str + :ivar mac_address: Mac Address. + :vartype mac_address: str + """ + + _validation = { + "name": {"readonly": True}, + "mac_address": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.mac_address = None + + +class ArmBaseObject(_serialization.Model): + """Base class for all objects under resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class AvailableSkuRequest(_serialization.Model): + """The filters for showing the available skus. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + :ivar sku_names: Sku Names to filter for available skus. + :vartype sku_names: list[str or ~azure.mgmt.databox.v2023_03_01.models.SkuName] + """ + + _validation = { + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "sku_names": {"key": "skuNames", "type": "[str]"}, + } + + def __init__( + self, + *, + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + sku_names: Optional[List[Union[str, "_models.SkuName"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + :keyword sku_names: Sku Names to filter for available skus. + :paramtype sku_names: list[str or ~azure.mgmt.databox.v2023_03_01.models.SkuName] + """ + super().__init__(**kwargs) + self.transfer_type = transfer_type + self.country = country + self.location = location + self.sku_names = sku_names + + +class AvailableSkusResult(_serialization.Model): + """The available skus operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of available skus. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :ivar next_link: Link for the next set of skus. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SkuInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of skus. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class AzureFileFilterDetails(_serialization.Model): + """Filter details to transfer Azure files. + + :ivar file_prefix_list: Prefix list of the Azure files to be transferred. + :vartype file_prefix_list: list[str] + :ivar file_path_list: List of full path of the files to be transferred. + :vartype file_path_list: list[str] + :ivar file_share_list: List of file shares to be transferred. + :vartype file_share_list: list[str] + """ + + _attribute_map = { + "file_prefix_list": {"key": "filePrefixList", "type": "[str]"}, + "file_path_list": {"key": "filePathList", "type": "[str]"}, + "file_share_list": {"key": "fileShareList", "type": "[str]"}, + } + + def __init__( + self, + *, + file_prefix_list: Optional[List[str]] = None, + file_path_list: Optional[List[str]] = None, + file_share_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword file_prefix_list: Prefix list of the Azure files to be transferred. + :paramtype file_prefix_list: list[str] + :keyword file_path_list: List of full path of the files to be transferred. + :paramtype file_path_list: list[str] + :keyword file_share_list: List of file shares to be transferred. + :paramtype file_share_list: list[str] + """ + super().__init__(**kwargs) + self.file_prefix_list = file_prefix_list + self.file_path_list = file_path_list + self.file_share_list = file_share_list + + +class BlobFilterDetails(_serialization.Model): + """Filter details to transfer Azure Blobs. + + :ivar blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :vartype blob_prefix_list: list[str] + :ivar blob_path_list: List of full path of the blobs to be transferred. + :vartype blob_path_list: list[str] + :ivar container_list: List of blob containers to be transferred. + :vartype container_list: list[str] + """ + + _attribute_map = { + "blob_prefix_list": {"key": "blobPrefixList", "type": "[str]"}, + "blob_path_list": {"key": "blobPathList", "type": "[str]"}, + "container_list": {"key": "containerList", "type": "[str]"}, + } + + def __init__( + self, + *, + blob_prefix_list: Optional[List[str]] = None, + blob_path_list: Optional[List[str]] = None, + container_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :paramtype blob_prefix_list: list[str] + :keyword blob_path_list: List of full path of the blobs to be transferred. + :paramtype blob_path_list: list[str] + :keyword container_list: List of blob containers to be transferred. + :paramtype container_list: list[str] + """ + super().__init__(**kwargs) + self.blob_prefix_list = blob_prefix_list + self.blob_path_list = blob_path_list + self.container_list = container_list + + +class CancellationReason(_serialization.Model): + """Reason for cancellation. + + All required parameters must be populated in order to send to Azure. + + :ivar reason: Reason for cancellation. Required. + :vartype reason: str + """ + + _validation = { + "reason": {"required": True}, + } + + _attribute_map = { + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, *, reason: str, **kwargs: Any) -> None: + """ + :keyword reason: Reason for cancellation. Required. + :paramtype reason: str + """ + super().__init__(**kwargs) + self.reason = reason + + +class CloudError(_serialization.Model): + """Provides additional information about an http error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_info: Gets or sets additional error info. + :vartype additional_info: list[~azure.mgmt.databox.v2023_03_01.models.AdditionalErrorInfo] + :ivar code: Error code. + :vartype code: str + :ivar details: Gets or sets details for the error. + :vartype details: list[~azure.mgmt.databox.v2023_03_01.models.CloudError] + :ivar message: The error message parsed from the body of the http error response. + :vartype message: str + :ivar target: Gets or sets the target of the error. + :vartype target: str + """ + + _validation = { + "additional_info": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "additional_info": {"key": "additionalInfo", "type": "[AdditionalErrorInfo]"}, + "code": {"key": "code", "type": "str"}, + "details": {"key": "details", "type": "[CloudError]"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: The error message parsed from the body of the http error response. + :paramtype message: str + :keyword target: Gets or sets the target of the error. + :paramtype target: str + """ + super().__init__(**kwargs) + self.additional_info = None + self.code = code + self.details = None + self.message = message + self.target = target + + +class ContactDetails(_serialization.Model): + """Contact Details. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + :ivar email_list: List of Email-ids to be notified about job progress. Required. + :vartype email_list: list[str] + :ivar notification_preference: Notification preference for a job stage. + :vartype notification_preference: + list[~azure.mgmt.databox.v2023_03_01.models.NotificationPreference] + """ + + _validation = { + "contact_name": {"required": True}, + "phone": {"required": True}, + "email_list": {"required": True}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + "email_list": {"key": "emailList", "type": "[str]"}, + "notification_preference": {"key": "notificationPreference", "type": "[NotificationPreference]"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + email_list: List[str], + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + notification_preference: Optional[List["_models.NotificationPreference"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + :keyword email_list: List of Email-ids to be notified about job progress. Required. + :paramtype email_list: list[str] + :keyword notification_preference: Notification preference for a job stage. + :paramtype notification_preference: + list[~azure.mgmt.databox.v2023_03_01.models.NotificationPreference] + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + self.email_list = email_list + self.notification_preference = notification_preference + + +class ContactInfo(_serialization.Model): + """Contact Info. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + """ + + _validation = { + "contact_name": {"required": True, "min_length": 1}, + "phone": {"required": True, "min_length": 1}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + + +class CopyLogDetails(_serialization.Model): + """Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxAccountCopyLogDetails, DataBoxCustomerDiskCopyLogDetails, DataBoxDiskCopyLogDetails, + DataBoxHeavyAccountCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = { + "copy_log_details_type": { + "DataBox": "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskCopyLogDetails", + "DataBoxDisk": "DataBoxDiskCopyLogDetails", + "DataBoxHeavy": "DataBoxHeavyAccountCopyLogDetails", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class CopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class ValidationRequest(_serialization.Model): + """Minimum request requirement of any validation category. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateJobValidations + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + _subtype_map = {"validation_category": {"JobCreationValidation": "CreateJobValidations"}} + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + super().__init__(**kwargs) + self.validation_category: Optional[str] = None + self.individual_request_details = individual_request_details + + +class CreateJobValidations(ValidationRequest): + """It does all pre-job creation validations. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + super().__init__(individual_request_details=individual_request_details, **kwargs) + self.validation_category: str = "JobCreationValidation" + + +class ValidationInputRequest(_serialization.Model): + """Minimum fields that must be present in any type of validation request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateAddress, CreateOrderLimitForSubscriptionValidationRequest, + DataTransferDetailsValidationRequest, PreferencesValidationRequest, + SkuAvailabilityValidationRequest, SubscriptionIsAllowedToCreateJobValidationRequest + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "ValidateAddress", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationRequest", + "ValidateDataTransferDetails": "DataTransferDetailsValidationRequest", + "ValidatePreferences": "PreferencesValidationRequest", + "ValidateSkuAvailability": "SkuAvailabilityValidationRequest", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationRequest", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + + +class CreateOrderLimitForSubscriptionValidationRequest(ValidationInputRequest): + """Request to validate create order limit for current subscription. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__(self, *, device_type: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.device_type = device_type + + +class CreateOrderLimitForSubscriptionValidationResponseProperties(ValidationInputResponse): + """Properties of create order limit for subscription validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Create order limit validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.status = None + + +class JobSecrets(_serialization.Model): + """The base class for the secrets. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataboxJobSecrets, CustomerDiskJobSecrets, DataBoxDiskJobSecrets, DataBoxHeavyJobSecrets + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "job_secrets_type": { + "DataBox": "DataboxJobSecrets", + "DataBoxCustomerDisk": "CustomerDiskJobSecrets", + "DataBoxDisk": "DataBoxDiskJobSecrets", + "DataBoxHeavy": "DataBoxHeavyJobSecrets", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: Optional[str] = None + self.dc_access_security_code = None + self.error = None + + +class CustomerDiskJobSecrets(JobSecrets): + """The secrets related to customer disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DiskSecret] + :ivar carrier_account_number: Carrier Account Number of the customer. + :vartype carrier_account_number: str + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "carrier_account_number": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxCustomerDisk" + self.disk_secrets = None + self.carrier_account_number = None + + +class DataAccountDetails(_serialization.Model): + """Account details of the data to be transferred. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ManagedDiskDetails, StorageAccountDetails + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + } + + _subtype_map = { + "data_account_type": {"ManagedDisk": "ManagedDiskDetails", "StorageAccount": "StorageAccountDetails"} + } + + def __init__(self, *, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + """ + super().__init__(**kwargs) + self.data_account_type: Optional[str] = None + self.share_password = share_password + + +class DataBoxAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account of a DataBox job. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: str + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when + LogCollectionLevel is set to Verbose. + :vartype copy_verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "str"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBox" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxCustomerDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxCustomerDiskCopyProgress(CopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox CustomerDisk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class JobDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Job details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxJobDetails, DataBoxCustomerDiskJobDetails, DataBoxDiskJobDetails, DataBoxHeavyJobDetails + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + } + + _subtype_map = { + "job_details_type": { + "DataBox": "DataBoxJobDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskJobDetails", + "DataBoxDisk": "DataBoxDiskJobDetails", + "DataBoxHeavy": "DataBoxHeavyJobDetails", + } + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(**kwargs) + self.job_stages = None + self.contact_details = contact_details + self.shipping_address = shipping_address + self.delivery_package = None + self.return_package = None + self.data_import_details = data_import_details + self.data_export_details = data_export_details + self.job_details_type: Optional[str] = None + self.preferences = preferences + self.reverse_shipping_details = reverse_shipping_details + self.copy_log_details = None + self.reverse_shipment_label_sas_key = None + self.chain_of_custody_sas_key = None + self.device_erasure_details = None + self.key_encryption_key = key_encryption_key + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + self.actions = None + self.last_mitigation_action_on_job = None + self.datacenter_address = None + self.data_center_code = None + + +class DataBoxCustomerDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Customer disk job details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :vartype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ImportDiskDetails] + :ivar export_disk_details_collection: Contains the map of disk serial number to the disk + details for export jobs. + :vartype export_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ExportDiskDetails] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxCustomerDiskCopyProgress] + :ivar deliver_to_dc_package_details: Delivery package shipping details. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + :ivar return_to_customer_package_details: Return package shipping details. Required. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + :ivar enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :vartype enable_manifest_backup: bool + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "export_disk_details_collection": {"readonly": True}, + "copy_progress": {"readonly": True}, + "deliver_to_dc_package_details": {"readonly": True}, + "return_to_customer_package_details": {"required": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "import_disk_details_collection": {"key": "importDiskDetailsCollection", "type": "{ImportDiskDetails}"}, + "export_disk_details_collection": {"key": "exportDiskDetailsCollection", "type": "{ExportDiskDetails}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxCustomerDiskCopyProgress]"}, + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + "enable_manifest_backup": {"key": "enableManifestBackup", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + return_to_customer_package_details: "_models.PackageCarrierDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + import_disk_details_collection: Optional[Dict[str, "_models.ImportDiskDetails"]] = None, + enable_manifest_backup: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :paramtype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ImportDiskDetails] + :keyword return_to_customer_package_details: Return package shipping details. Required. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + :keyword enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :paramtype enable_manifest_backup: bool + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxCustomerDisk" + self.import_disk_details_collection = import_disk_details_collection + self.export_disk_details_collection = None + self.copy_progress = None + self.deliver_to_dc_package_details = None + self.return_to_customer_package_details = return_to_customer_package_details + self.enable_manifest_backup = enable_manifest_backup + + +class DataBoxDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for a disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar disk_serial_number: Disk Serial Number. + :vartype disk_serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "disk_serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxDisk" + self.disk_serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxDiskCopyProgress(_serialization.Model): + """DataBox Disk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar serial_number: The serial number of the disk. + :vartype serial_number: str + :ivar bytes_copied: Bytes copied during the copy of disk. + :vartype bytes_copied: int + :ivar percent_complete: Indicates the percentage completed for the copy of the disk. + :vartype percent_complete: int + :ivar status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "serial_number": {"readonly": True}, + "bytes_copied": {"readonly": True}, + "percent_complete": {"readonly": True}, + "status": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "bytes_copied": {"key": "bytesCopied", "type": "int"}, + "percent_complete": {"key": "percentComplete", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.bytes_copied = None + self.percent_complete = None + self.status = None + self.error = None + self.actions = None + + +class GranularCopyLogDetails(_serialization.Model): + """Granular Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxDiskGranularCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = {"copy_log_details_type": {"DataBoxCustomerDisk": "DataBoxDiskGranularCopyLogDetails"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class DataBoxDiskGranularCopyLogDetails(GranularCopyLogDetails): + """Granular Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar account_id: Account id. + :vartype account_id: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "account_id": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.account_id = None + self.error_log_link = None + self.verbose_log_link = None + + +class GranularCopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Granular Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class DataBoxDiskGranularCopyProgress(GranularCopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox Disk Granular Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class DataBoxDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """DataBox Disk Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :vartype preferred_disks: dict[str, int] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskCopyProgress] + :ivar granular_copy_progress: Copy progress per disk. + :vartype granular_copy_progress: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskGranularCopyProgress] + :ivar granular_copy_log_details: Copy progress per disk. + :vartype granular_copy_log_details: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskGranularCopyLogDetails] + :ivar disks_and_size_details: Contains the map of disk serial number to the disk size being + used for the job. Is returned only after the disks are shipped to the customer. + :vartype disks_and_size_details: dict[str, int] + :ivar passkey: User entered passkey for DataBox Disk job. + :vartype passkey: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + "granular_copy_progress": {"readonly": True}, + "granular_copy_log_details": {"readonly": True}, + "disks_and_size_details": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "preferred_disks": {"key": "preferredDisks", "type": "{int}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxDiskCopyProgress]"}, + "granular_copy_progress": {"key": "granularCopyProgress", "type": "[DataBoxDiskGranularCopyProgress]"}, + "granular_copy_log_details": {"key": "granularCopyLogDetails", "type": "[DataBoxDiskGranularCopyLogDetails]"}, + "disks_and_size_details": {"key": "disksAndSizeDetails", "type": "{int}"}, + "passkey": {"key": "passkey", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + preferred_disks: Optional[Dict[str, int]] = None, + passkey: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :paramtype preferred_disks: dict[str, int] + :keyword passkey: User entered passkey for DataBox Disk job. + :paramtype passkey: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxDisk" + self.preferred_disks = preferred_disks + self.copy_progress = None + self.granular_copy_progress = None + self.granular_copy_log_details = None + self.disks_and_size_details = None + self.passkey = passkey + + +class DataBoxDiskJobSecrets(JobSecrets): + """The secrets related to disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DiskSecret] + :ivar pass_key: PassKey for the disk Job. + :vartype pass_key: str + :ivar is_passkey_user_defined: Whether passkey was provided by user. + :vartype is_passkey_user_defined: bool + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "pass_key": {"readonly": True}, + "is_passkey_user_defined": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "pass_key": {"key": "passKey", "type": "str"}, + "is_passkey_user_defined": {"key": "isPasskeyUserDefined", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxDisk" + self.disk_secrets = None + self.pass_key = None + self.is_passkey_user_defined = None + + +class DataBoxHeavyAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account for Databox heavy. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: list[str] + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when the + LogCollectionLevel is set to verbose. + :vartype copy_verbose_log_link: list[str] + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "[str]"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxHeavy" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxHeavyJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Heavy Device Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar copy_progress: Copy progress per account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxHeavy" + self.copy_progress = None + self.device_password = device_password + + +class DataBoxHeavyJobSecrets(JobSecrets): + """The secrets related to a databox heavy job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar cabinet_pod_secrets: Contains the list of secret objects for a databox heavy job. + :vartype cabinet_pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxHeavySecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "cabinet_pod_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "cabinet_pod_secrets": {"key": "cabinetPodSecrets", "type": "[DataBoxHeavySecret]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxHeavy" + self.cabinet_pod_secrets = None + + +class DataBoxHeavySecret(_serialization.Model): + """The secrets related to a databox heavy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_03_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DataBoxJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar copy_progress: Copy progress per storage account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBox" + self.copy_progress = None + self.device_password = device_password + + +class DataboxJobSecrets(JobSecrets): + """The secrets related to a databox job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar pod_secrets: Contains the list of secret objects for a job. + :vartype pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxSecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "pod_secrets": {"key": "podSecrets", "type": "[DataBoxSecret]"}, + } + + def __init__(self, *, pod_secrets: Optional[List["_models.DataBoxSecret"]] = None, **kwargs: Any) -> None: + """ + :keyword pod_secrets: Contains the list of secret objects for a job. + :paramtype pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxSecret] + """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBox" + self.pod_secrets = pod_secrets + + +class ScheduleAvailabilityRequest(_serialization.Model): + """Request body to get the availability for scheduling orders. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxScheduleAvailabilityRequest, DiskScheduleAvailabilityRequest, + HeavyScheduleAvailabilityRequest + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + _subtype_map = { + "sku_name": { + "DataBox": "DataBoxScheduleAvailabilityRequest", + "DataBoxDisk": "DiskScheduleAvailabilityRequest", + "DataBoxHeavy": "HeavyScheduleAvailabilityRequest", + } + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name: Optional[str] = None + self.country = country + + +class DataBoxScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling data box orders orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBox" + + +class DataBoxSecret(_serialization.Model): + """The secrets related to a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_03_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DatacenterAddressResponse(_serialization.Model): + """Datacenter address for given storage location. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DatacenterAddressInstructionResponse, DatacenterAddressLocationResponse + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + } + + _subtype_map = { + "datacenter_address_type": { + "DatacenterAddressInstruction": "DatacenterAddressInstructionResponse", + "DatacenterAddressLocation": "DatacenterAddressLocationResponse", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: Optional[str] = None + self.supported_carriers_for_return_shipment = None + self.data_center_azure_location = None + + +class DatacenterAddressInstructionResponse(DatacenterAddressResponse): + """Datacenter instruction for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar communication_instruction: Data center communication instruction. + :vartype communication_instruction: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "communication_instruction": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "communication_instruction": {"key": "communicationInstruction", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressInstruction" + self.communication_instruction = None + + +class DatacenterAddressLocationResponse(DatacenterAddressResponse): # pylint: disable=too-many-instance-attributes + """Datacenter address for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar contact_person_name: Contact person name. + :vartype contact_person_name: str + :ivar company: Company name. + :vartype company: str + :ivar street1: Street address line 1. + :vartype street1: str + :ivar street2: Street address line 2. + :vartype street2: str + :ivar street3: Street address line 3. + :vartype street3: str + :ivar city: City name. + :vartype city: str + :ivar state: name of the state. + :vartype state: str + :ivar zip: Zip code. + :vartype zip: str + :ivar country: name of the country. + :vartype country: str + :ivar phone: Phone number. + :vartype phone: str + :ivar phone_extension: Phone extension. + :vartype phone_extension: str + :ivar address_type: Address type. + :vartype address_type: str + :ivar additional_shipping_information: Special instruction for shipping. + :vartype additional_shipping_information: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "contact_person_name": {"readonly": True}, + "company": {"readonly": True}, + "street1": {"readonly": True}, + "street2": {"readonly": True}, + "street3": {"readonly": True}, + "city": {"readonly": True}, + "state": {"readonly": True}, + "zip": {"readonly": True}, + "country": {"readonly": True}, + "phone": {"readonly": True}, + "phone_extension": {"readonly": True}, + "address_type": {"readonly": True}, + "additional_shipping_information": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "contact_person_name": {"key": "contactPersonName", "type": "str"}, + "company": {"key": "company", "type": "str"}, + "street1": {"key": "street1", "type": "str"}, + "street2": {"key": "street2", "type": "str"}, + "street3": {"key": "street3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "zip": {"key": "zip", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "additional_shipping_information": {"key": "additionalShippingInformation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressLocation" + self.contact_person_name = None + self.company = None + self.street1 = None + self.street2 = None + self.street3 = None + self.city = None + self.state = None + self.zip = None + self.country = None + self.phone = None + self.phone_extension = None + self.address_type = None + self.additional_shipping_information = None + + +class DatacenterAddressRequest(_serialization.Model): + """Request body to get the datacenter address. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, storage_location: str, sku_name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name = sku_name + + +class DataExportDetails(_serialization.Model): + """Details of the data to be used for exporting data from azure. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration: Configuration for the data transfer. Required. + :vartype transfer_configuration: ~azure.mgmt.databox.v2023_03_01.models.TransferConfiguration + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + """ + + _validation = { + "transfer_configuration": {"required": True}, + "account_details": {"required": True}, + } + + _attribute_map = { + "transfer_configuration": {"key": "transferConfiguration", "type": "TransferConfiguration"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + } + + def __init__( + self, + *, + transfer_configuration: "_models.TransferConfiguration", + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration: Configuration for the data transfer. Required. + :paramtype transfer_configuration: ~azure.mgmt.databox.v2023_03_01.models.TransferConfiguration + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + """ + super().__init__(**kwargs) + self.transfer_configuration = transfer_configuration + self.log_collection_level = log_collection_level + self.account_details = account_details + + +class DataImportDetails(_serialization.Model): + """Details of the data to be used for importing data to azure. + + All required parameters must be populated in order to send to Azure. + + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + """ + + _validation = { + "account_details": {"required": True}, + } + + _attribute_map = { + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + } + + def __init__( + self, + *, + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + """ + super().__init__(**kwargs) + self.account_details = account_details + self.log_collection_level = log_collection_level + + +class DataLocationToServiceLocationMap(_serialization.Model): + """Map of data location to service location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_location: Location of the data. + :vartype data_location: str + :ivar service_location: Location of the service. + :vartype service_location: str + """ + + _validation = { + "data_location": {"readonly": True}, + "service_location": {"readonly": True}, + } + + _attribute_map = { + "data_location": {"key": "dataLocation", "type": "str"}, + "service_location": {"key": "serviceLocation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.data_location = None + self.service_location = None + + +class DataTransferDetailsValidationRequest(ValidationInputRequest): + """Request to validate export and import data details. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar data_export_details: List of DataTransfer details to be used to export data from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar data_import_details: List of DataTransfer details to be used to import data to azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_export_details: List of DataTransfer details to be used to export data from + azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword data_import_details: List of DataTransfer details to be used to import data to azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.data_export_details = data_export_details + self.data_import_details = data_import_details + self.device_type = device_type + self.transfer_type = transfer_type + + +class DataTransferDetailsValidationResponseProperties(ValidationInputResponse): + """Properties of data transfer details validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Data transfer details validation status. Known values are: "Valid", "Invalid", + and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.status = None + + +class DcAccessSecurityCode(_serialization.Model): + """Dc access security code. + + :ivar reverse_dc_access_code: Reverse Dc access security code. + :vartype reverse_dc_access_code: str + :ivar forward_dc_access_code: Forward Dc access security code. + :vartype forward_dc_access_code: str + """ + + _attribute_map = { + "reverse_dc_access_code": {"key": "reverseDCAccessCode", "type": "str"}, + "forward_dc_access_code": {"key": "forwardDCAccessCode", "type": "str"}, + } + + def __init__( + self, + *, + reverse_dc_access_code: Optional[str] = None, + forward_dc_access_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword reverse_dc_access_code: Reverse Dc access security code. + :paramtype reverse_dc_access_code: str + :keyword forward_dc_access_code: Forward Dc access security code. + :paramtype forward_dc_access_code: str + """ + super().__init__(**kwargs) + self.reverse_dc_access_code = reverse_dc_access_code + self.forward_dc_access_code = forward_dc_access_code + + +class Details(_serialization.Model): + """Details. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class DeviceErasureDetails(_serialization.Model): + """Device erasure details with erasure completion status and erasureordestructionlog sas key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_erasure_status: Holds the device erasure completion status. Known values are: + "None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype device_erasure_status: str or ~azure.mgmt.databox.v2023_03_01.models.StageStatus + :ivar erasure_or_destruction_certificate_sas_key: Shared access key to download cleanup or + destruction certificate for device. + :vartype erasure_or_destruction_certificate_sas_key: str + """ + + _validation = { + "device_erasure_status": {"readonly": True}, + "erasure_or_destruction_certificate_sas_key": {"readonly": True}, + } + + _attribute_map = { + "device_erasure_status": {"key": "deviceErasureStatus", "type": "str"}, + "erasure_or_destruction_certificate_sas_key": {"key": "erasureOrDestructionCertificateSasKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_erasure_status = None + self.erasure_or_destruction_certificate_sas_key = None + + +class DiskScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling disk orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :vartype expected_data_size_in_tera_bytes: int + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + "expected_data_size_in_tera_bytes": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + } + + def __init__( + self, + *, + storage_location: str, + expected_data_size_in_tera_bytes: int, + country: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxDisk" + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + + +class DiskSecret(_serialization.Model): + """Contains all the secrets of a Disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_serial_number: Serial number of the assigned disk. + :vartype disk_serial_number: str + :ivar bit_locker_key: Bit Locker key of the disk which can be used to unlock the disk to copy + data. + :vartype bit_locker_key: str + """ + + _validation = { + "disk_serial_number": {"readonly": True}, + "bit_locker_key": {"readonly": True}, + } + + _attribute_map = { + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.disk_serial_number = None + self.bit_locker_key = None + + +class EncryptionPreferences(_serialization.Model): + """Preferences related to the Encryption. + + :ivar double_encryption: Defines secondary layer of software-based encryption enablement. Known + values are: "Enabled" and "Disabled". + :vartype double_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.DoubleEncryption + :ivar hardware_encryption: Defines Hardware level encryption (Only for disk). Known values are: + "Enabled" and "Disabled". + :vartype hardware_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.HardwareEncryption + """ + + _attribute_map = { + "double_encryption": {"key": "doubleEncryption", "type": "str"}, + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__( + self, + *, + double_encryption: Union[str, "_models.DoubleEncryption"] = "Disabled", + hardware_encryption: Optional[Union[str, "_models.HardwareEncryption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword double_encryption: Defines secondary layer of software-based encryption enablement. + Known values are: "Enabled" and "Disabled". + :paramtype double_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.DoubleEncryption + :keyword hardware_encryption: Defines Hardware level encryption (Only for disk). Known values + are: "Enabled" and "Disabled". + :paramtype hardware_encryption: str or + ~azure.mgmt.databox.v2023_03_01.models.HardwareEncryption + """ + super().__init__(**kwargs) + self.double_encryption = double_encryption + self.hardware_encryption = hardware_encryption + + +class ErrorDetail(_serialization.Model): + """ErrorDetail. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar details: + :vartype details: list[~azure.mgmt.databox.v2023_03_01.models.Details] + :ivar target: + :vartype target: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[Details]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + code: str, + message: str, + details: Optional[List["_models.Details"]] = None, + target: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + :keyword details: + :paramtype details: list[~azure.mgmt.databox.v2023_03_01.models.Details] + :keyword target: + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + + +class ExportDiskDetails(_serialization.Model): + """Export disk details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar manifest_file: The relative path of the manifest file on the disk. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. + :vartype manifest_hash: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"readonly": True}, + "manifest_hash": {"readonly": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.manifest_file = None + self.manifest_hash = None + self.backup_manifest_cloud_path = None + + +class FilterFileDetails(_serialization.Model): + """Details of the filter files to be used for data transfer. + + All required parameters must be populated in order to send to Azure. + + :ivar filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :vartype filter_file_type: str or ~azure.mgmt.databox.v2023_03_01.models.FilterFileType + :ivar filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :vartype filter_file_path: str + """ + + _validation = { + "filter_file_type": {"required": True}, + "filter_file_path": {"required": True}, + } + + _attribute_map = { + "filter_file_type": {"key": "filterFileType", "type": "str"}, + "filter_file_path": {"key": "filterFilePath", "type": "str"}, + } + + def __init__( + self, *, filter_file_type: Union[str, "_models.FilterFileType"], filter_file_path: str, **kwargs: Any + ) -> None: + """ + :keyword filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :paramtype filter_file_type: str or ~azure.mgmt.databox.v2023_03_01.models.FilterFileType + :keyword filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :paramtype filter_file_path: str + """ + super().__init__(**kwargs) + self.filter_file_type = filter_file_type + self.filter_file_path = filter_file_path + + +class HeavyScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling heavy orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxHeavy" + + +class IdentityProperties(_serialization.Model): + """Managed identity properties. + + :ivar type: Managed service identity type. + :vartype type: str + :ivar user_assigned: User assigned identity properties. + :vartype user_assigned: ~azure.mgmt.databox.v2023_03_01.models.UserAssignedProperties + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "user_assigned": {"key": "userAssigned", "type": "UserAssignedProperties"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned: Optional["_models.UserAssignedProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Managed service identity type. + :paramtype type: str + :keyword user_assigned: User assigned identity properties. + :paramtype user_assigned: ~azure.mgmt.databox.v2023_03_01.models.UserAssignedProperties + """ + super().__init__(**kwargs) + self.type = type + self.user_assigned = user_assigned + + +class ImportDiskDetails(_serialization.Model): + """Import disk details. + + 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 manifest_file: The relative path of the manifest file on the disk. Required. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :vartype manifest_hash: str + :ivar bit_locker_key: BitLocker key used to encrypt the disk. Required. + :vartype bit_locker_key: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"required": True}, + "manifest_hash": {"required": True}, + "bit_locker_key": {"required": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, *, manifest_file: str, manifest_hash: str, bit_locker_key: str, **kwargs: Any) -> None: + """ + :keyword manifest_file: The relative path of the manifest file on the disk. Required. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :paramtype manifest_hash: str + :keyword bit_locker_key: BitLocker key used to encrypt the disk. Required. + :paramtype bit_locker_key: str + """ + super().__init__(**kwargs) + self.manifest_file = manifest_file + self.manifest_hash = manifest_hash + self.bit_locker_key = bit_locker_key + self.backup_manifest_cloud_path = None + + +class JobDelayDetails(_serialization.Model): + """Job Delay Notification details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Status of notification. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.DelayNotificationStatus + :ivar error_code: Delay Error code. Known values are: "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", "ActiveOrderLimitBreachedDelay", and + "ActiveOrderLimitBreachedDelay". + :vartype error_code: str or ~azure.mgmt.databox.v2023_03_01.models.PortalDelayErrorCode + :ivar description: Description of the delay. + :vartype description: str + :ivar start_time: Timestamp when the delay notification was created. + :vartype start_time: ~datetime.datetime + :ivar resolution_time: Timestamp when the delay notification was resolved. + :vartype resolution_time: ~datetime.datetime + """ + + _validation = { + "status": {"readonly": True}, + "error_code": {"readonly": True}, + "description": {"readonly": True}, + "start_time": {"readonly": True}, + "resolution_time": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "resolution_time": {"key": "resolutionTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.error_code = None + self.description = None + self.start_time = None + self.resolution_time = None + + +class JobDeliveryInfo(_serialization.Model): + """Additional delivery info. + + :ivar scheduled_date_time: Scheduled date time. + :vartype scheduled_date_time: ~datetime.datetime + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + } + + def __init__(self, *, scheduled_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_date_time: Scheduled date time. + :paramtype scheduled_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + + +class Resource(_serialization.Model): + """Model of the Resource. + + All required parameters must be populated in order to send to Azure. + + :ivar location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + } + + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.sku = sku + self.identity = identity + + +class JobResource(Resource): # pylint: disable=too-many-instance-attributes + """Job 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 location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.databox.v2023_03_01.models.SystemData + :ivar transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar is_cancellable: Describes whether the job is cancellable or not. + :vartype is_cancellable: bool + :ivar is_deletable: Describes whether the job is deletable or not. + :vartype is_deletable: bool + :ivar is_shipping_address_editable: Describes whether the shipping address is editable or not. + :vartype is_shipping_address_editable: bool + :ivar reverse_shipping_details_update: The Editable status for Reverse Shipping Address and + Contact Info. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_shipping_details_update: str or + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetailsEditStatus + :ivar reverse_transport_preference_update: The Editable status for Reverse Transport + preferences. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_transport_preference_update: str or + ~azure.mgmt.databox.v2023_03_01.models.ReverseTransportPreferenceEditStatus + :ivar is_prepare_to_ship_enabled: Is Prepare To Ship Enabled on this job. + :vartype is_prepare_to_ship_enabled: bool + :ivar status: Name of the stage which is in progress. Known values are: "DeviceOrdered", + "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar delayed_stage: Name of the stage where delay might be present. Known values are: + "DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", + "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype delayed_stage: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar start_time: Time at which the job was started in UTC ISO 8601 format. + :vartype start_time: ~datetime.datetime + :ivar error: Top level error for the job. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar details: Details of a job run. This field will only be sent for expand details filter. + :vartype details: ~azure.mgmt.databox.v2023_03_01.models.JobDetails + :ivar cancellation_reason: Reason for cancellation. + :vartype cancellation_reason: str + :ivar delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :vartype delivery_type: str or ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryType + :ivar delivery_info: Delivery Info of Job. + :vartype delivery_info: ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryInfo + :ivar is_cancellable_without_fee: Flag to indicate cancellation of scheduled job. + :vartype is_cancellable_without_fee: bool + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "transfer_type": {"required": True}, + "is_cancellable": {"readonly": True}, + "is_deletable": {"readonly": True}, + "is_shipping_address_editable": {"readonly": True}, + "reverse_shipping_details_update": {"readonly": True}, + "reverse_transport_preference_update": {"readonly": True}, + "is_prepare_to_ship_enabled": {"readonly": True}, + "status": {"readonly": True}, + "delayed_stage": {"readonly": True}, + "start_time": {"readonly": True}, + "error": {"readonly": True}, + "cancellation_reason": {"readonly": True}, + "is_cancellable_without_fee": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "transfer_type": {"key": "properties.transferType", "type": "str"}, + "is_cancellable": {"key": "properties.isCancellable", "type": "bool"}, + "is_deletable": {"key": "properties.isDeletable", "type": "bool"}, + "is_shipping_address_editable": {"key": "properties.isShippingAddressEditable", "type": "bool"}, + "reverse_shipping_details_update": {"key": "properties.reverseShippingDetailsUpdate", "type": "str"}, + "reverse_transport_preference_update": {"key": "properties.reverseTransportPreferenceUpdate", "type": "str"}, + "is_prepare_to_ship_enabled": {"key": "properties.isPrepareToShipEnabled", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "delayed_stage": {"key": "properties.delayedStage", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "details": {"key": "properties.details", "type": "JobDetails"}, + "cancellation_reason": {"key": "properties.cancellationReason", "type": "str"}, + "delivery_type": {"key": "properties.deliveryType", "type": "str"}, + "delivery_info": {"key": "properties.deliveryInfo", "type": "JobDeliveryInfo"}, + "is_cancellable_without_fee": {"key": "properties.isCancellableWithoutFee", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + sku: "_models.Sku", + transfer_type: Union[str, "_models.TransferType"], + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.JobDetails"] = None, + delivery_type: Union[str, "_models.JobDeliveryType"] = "NonScheduled", + delivery_info: Optional["_models.JobDeliveryInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :keyword transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" + and "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword details: Details of a job run. This field will only be sent for expand details filter. + :paramtype details: ~azure.mgmt.databox.v2023_03_01.models.JobDetails + :keyword delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :paramtype delivery_type: str or ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryType + :keyword delivery_info: Delivery Info of Job. + :paramtype delivery_info: ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryInfo + """ + super().__init__(location=location, tags=tags, sku=sku, identity=identity, **kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.transfer_type = transfer_type + self.is_cancellable = None + self.is_deletable = None + self.is_shipping_address_editable = None + self.reverse_shipping_details_update = None + self.reverse_transport_preference_update = None + self.is_prepare_to_ship_enabled = None + self.status = None + self.delayed_stage = None + self.start_time = None + self.error = None + self.details = details + self.cancellation_reason = None + self.delivery_type = delivery_type + self.delivery_info = delivery_info + self.is_cancellable_without_fee = None + + +class JobResourceList(_serialization.Model): + """Job Resource Collection. + + :ivar value: List of job resources. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :ivar next_link: Link for the next set of job resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[JobResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.JobResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of job resources. + :paramtype value: list[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :keyword next_link: Link for the next set of job resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class JobResourceUpdateParameter(_serialization.Model): + """The JobResourceUpdateParameter. + + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :ivar details: Details of a job to be updated. + :vartype details: ~azure.mgmt.databox.v2023_03_01.models.UpdateJobDetails + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "details": {"key": "properties.details", "type": "UpdateJobDetails"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.UpdateJobDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :keyword details: Details of a job to be updated. + :paramtype details: ~azure.mgmt.databox.v2023_03_01.models.UpdateJobDetails + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.details = details + + +class JobStages(_serialization.Model): + """Job stages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stage_name: Name of the job stage. Known values are: "DeviceOrdered", "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar display_name: Display name of the job stage. + :vartype display_name: str + :ivar stage_status: Status of the job stage. Known values are: "None", "InProgress", + "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype stage_status: str or ~azure.mgmt.databox.v2023_03_01.models.StageStatus + :ivar stage_time: Time for the job stage in UTC ISO 8601 format. + :vartype stage_time: ~datetime.datetime + :ivar job_stage_details: Job Stage Details. + :vartype job_stage_details: JSON + :ivar delay_information: Delay information for the job stages. + :vartype delay_information: list[~azure.mgmt.databox.v2023_03_01.models.JobDelayDetails] + """ + + _validation = { + "stage_name": {"readonly": True}, + "display_name": {"readonly": True}, + "stage_status": {"readonly": True}, + "stage_time": {"readonly": True}, + "job_stage_details": {"readonly": True}, + "delay_information": {"readonly": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "stage_status": {"key": "stageStatus", "type": "str"}, + "stage_time": {"key": "stageTime", "type": "iso-8601"}, + "job_stage_details": {"key": "jobStageDetails", "type": "object"}, + "delay_information": {"key": "delayInformation", "type": "[JobDelayDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.stage_name = None + self.display_name = None + self.stage_status = None + self.stage_time = None + self.job_stage_details = None + self.delay_information = None + + +class KeyEncryptionKey(_serialization.Model): + """Encryption key containing details about key to encrypt different keys. + + All required parameters must be populated in order to send to Azure. + + :ivar kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :vartype kek_type: str or ~azure.mgmt.databox.v2023_03_01.models.KekType + :ivar identity_properties: Managed identity properties used for key encryption. + :vartype identity_properties: ~azure.mgmt.databox.v2023_03_01.models.IdentityProperties + :ivar kek_url: Key encryption key. It is required in case of Customer managed KekType. + :vartype kek_url: str + :ivar kek_vault_resource_id: Kek vault resource id. It is required in case of Customer managed + KekType. + :vartype kek_vault_resource_id: str + """ + + _validation = { + "kek_type": {"required": True}, + } + + _attribute_map = { + "kek_type": {"key": "kekType", "type": "str"}, + "identity_properties": {"key": "identityProperties", "type": "IdentityProperties"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "kek_vault_resource_id": {"key": "kekVaultResourceID", "type": "str"}, + } + + def __init__( + self, + *, + kek_type: Union[str, "_models.KekType"] = "MicrosoftManaged", + identity_properties: Optional["_models.IdentityProperties"] = None, + kek_url: Optional[str] = None, + kek_vault_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :paramtype kek_type: str or ~azure.mgmt.databox.v2023_03_01.models.KekType + :keyword identity_properties: Managed identity properties used for key encryption. + :paramtype identity_properties: ~azure.mgmt.databox.v2023_03_01.models.IdentityProperties + :keyword kek_url: Key encryption key. It is required in case of Customer managed KekType. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Kek vault resource id. It is required in case of Customer + managed KekType. + :paramtype kek_vault_resource_id: str + """ + super().__init__(**kwargs) + self.kek_type = kek_type + self.identity_properties = identity_properties + self.kek_url = kek_url + self.kek_vault_resource_id = kek_vault_resource_id + + +class LastMitigationActionOnJob(_serialization.Model): + """Last Mitigation Action Performed On Job. + + :ivar action_date_time_in_utc: Action performed date time. + :vartype action_date_time_in_utc: ~datetime.datetime + :ivar is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :vartype is_performed_by_customer: bool + :ivar customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + """ + + _attribute_map = { + "action_date_time_in_utc": {"key": "actionDateTimeInUtc", "type": "iso-8601"}, + "is_performed_by_customer": {"key": "isPerformedByCustomer", "type": "bool"}, + "customer_resolution": {"key": "customerResolution", "type": "str"}, + } + + def __init__( + self, + *, + action_date_time_in_utc: Optional[datetime.datetime] = None, + is_performed_by_customer: Optional[bool] = None, + customer_resolution: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword action_date_time_in_utc: Action performed date time. + :paramtype action_date_time_in_utc: ~datetime.datetime + :keyword is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :paramtype is_performed_by_customer: bool + :keyword customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + """ + super().__init__(**kwargs) + self.action_date_time_in_utc = action_date_time_in_utc + self.is_performed_by_customer = is_performed_by_customer + self.customer_resolution = customer_resolution + + +class ManagedDiskDetails(DataAccountDetails): + """Details of the managed disks. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar resource_group_id: Resource Group Id of the compute disks. Required. + :vartype resource_group_id: str + :ivar staging_storage_account_id: Resource Id of the storage account that can be used to copy + the vhd for staging. Required. + :vartype staging_storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "resource_group_id": {"required": True}, + "staging_storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "resource_group_id": {"key": "resourceGroupId", "type": "str"}, + "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, + } + + def __init__( + self, + *, + resource_group_id: str, + staging_storage_account_id: str, + share_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword resource_group_id: Resource Group Id of the compute disks. Required. + :paramtype resource_group_id: str + :keyword staging_storage_account_id: Resource Id of the storage account that can be used to + copy the vhd for staging. Required. + :paramtype staging_storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "ManagedDisk" + self.resource_group_id = resource_group_id + self.staging_storage_account_id = staging_storage_account_id + + +class MarkDevicesShippedRequest(_serialization.Model): + """The request body to provide the delivery package details of job. + + All required parameters must be populated in order to send to Azure. + + :ivar deliver_to_dc_package_details: Delivery package details. Required. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + """ + + _validation = { + "deliver_to_dc_package_details": {"required": True}, + } + + _attribute_map = { + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + } + + def __init__(self, *, deliver_to_dc_package_details: "_models.PackageCarrierInfo", **kwargs: Any) -> None: + """ + :keyword deliver_to_dc_package_details: Delivery package details. Required. + :paramtype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + """ + super().__init__(**kwargs) + self.deliver_to_dc_package_details = deliver_to_dc_package_details + + +class MitigateJobRequest(_serialization.Model): + """The Mitigate Job captured from request body for Mitigate API. + + :ivar customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + :ivar serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :vartype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _attribute_map = { + "customer_resolution_code": {"key": "customerResolutionCode", "type": "str"}, + "serial_number_customer_resolution_map": {"key": "serialNumberCustomerResolutionMap", "type": "{str}"}, + } + + def __init__( + self, + *, + customer_resolution_code: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + serial_number_customer_resolution_map: Optional[Dict[str, Union[str, "_models.CustomerResolutionCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + :keyword serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :paramtype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + super().__init__(**kwargs) + self.customer_resolution_code = customer_resolution_code + self.serial_number_customer_resolution_map = serial_number_customer_resolution_map + + +class NotificationPreference(_serialization.Model): + """Notification preference for a job stage. + + All required parameters must be populated in order to send to Azure. + + :ivar stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.NotificationStageName + :ivar send_notification: Notification is required or not. + :vartype send_notification: bool + """ + + _validation = { + "stage_name": {"required": True}, + "send_notification": {"required": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "send_notification": {"key": "sendNotification", "type": "bool"}, + } + + def __init__( + self, *, stage_name: Union[str, "_models.NotificationStageName"], send_notification: bool = True, **kwargs: Any + ) -> None: + """ + :keyword stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :paramtype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.NotificationStageName + :keyword send_notification: Notification is required or not. + :paramtype send_notification: bool + """ + super().__init__(**kwargs) + self.stage_name = stage_name + self.send_notification = send_notification + + +class Operation(_serialization.Model): + """Operation entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. Format: + {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :vartype name: str + :ivar display: Operation display values. + :vartype display: ~azure.mgmt.databox.v2023_03_01.models.OperationDisplay + :ivar properties: Operation properties. + :vartype properties: JSON + :ivar origin: Origin of the operation. Can be : user|system|user,system. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + """ + + _validation = { + "name": {"readonly": True}, + "display": {"readonly": True}, + "properties": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "properties": {"key": "properties", "type": "object"}, + "origin": {"key": "origin", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + } + + def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ + super().__init__(**kwargs) + self.name = None + self.display = None + self.properties = None + self.origin = None + self.is_data_action = is_data_action + + +class OperationDisplay(_serialization.Model): + """Operation display. + + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str + :ivar operation: Localized name of the operation for display purpose. + :vartype operation: str + :ivar description: Localized description of the operation for display purpose. + :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: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + :keyword operation: Localized name of the operation for display purpose. + :paramtype operation: str + :keyword description: Localized description of the operation for display purpose. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(_serialization.Model): + """Operation Collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.Operation] + :ivar next_link: Link for the next set of operations. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of operations. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class PackageCarrierDetails(_serialization.Model): + """Package carrier details. + + :ivar carrier_account_number: Carrier Account Number of customer for customer disk. + :vartype carrier_account_number: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__( + self, + *, + carrier_account_number: Optional[str] = None, + carrier_name: Optional[str] = None, + tracking_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword carrier_account_number: Carrier Account Number of customer for customer disk. + :paramtype carrier_account_number: str + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_account_number = carrier_account_number + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageCarrierInfo(_serialization.Model): + """package carrier info. + + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, *, carrier_name: Optional[str] = None, tracking_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageShippingDetails(_serialization.Model): + """package shipping details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tracking_url: Url where shipment can be tracked. + :vartype tracking_url: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _validation = { + "tracking_url": {"readonly": True}, + "carrier_name": {"readonly": True}, + "tracking_id": {"readonly": True}, + } + + _attribute_map = { + "tracking_url": {"key": "trackingUrl", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tracking_url = None + self.carrier_name = None + self.tracking_id = None + + +class Preferences(_serialization.Model): + """Preferences related to the order. + + :ivar preferred_data_center_region: Preferred data center region. + :vartype preferred_data_center_region: list[str] + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :ivar reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :vartype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :ivar encryption_preferences: Preferences related to the Encryption. + :vartype encryption_preferences: ~azure.mgmt.databox.v2023_03_01.models.EncryptionPreferences + :ivar storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :vartype storage_account_access_tier_preferences: list[str] + """ + + _attribute_map = { + "preferred_data_center_region": {"key": "preferredDataCenterRegion", "type": "[str]"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + "reverse_transport_preferences": {"key": "reverseTransportPreferences", "type": "TransportPreferences"}, + "encryption_preferences": {"key": "encryptionPreferences", "type": "EncryptionPreferences"}, + "storage_account_access_tier_preferences": {"key": "storageAccountAccessTierPreferences", "type": "[str]"}, + } + + def __init__( + self, + *, + preferred_data_center_region: Optional[List[str]] = None, + transport_preferences: Optional["_models.TransportPreferences"] = None, + reverse_transport_preferences: Optional["_models.TransportPreferences"] = None, + encryption_preferences: Optional["_models.EncryptionPreferences"] = None, + storage_account_access_tier_preferences: Optional[List[Literal["Archive"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword preferred_data_center_region: Preferred data center region. + :paramtype preferred_data_center_region: list[str] + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :keyword reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :paramtype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :keyword encryption_preferences: Preferences related to the Encryption. + :paramtype encryption_preferences: ~azure.mgmt.databox.v2023_03_01.models.EncryptionPreferences + :keyword storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :paramtype storage_account_access_tier_preferences: list[str] + """ + super().__init__(**kwargs) + self.preferred_data_center_region = preferred_data_center_region + self.transport_preferences = transport_preferences + self.reverse_transport_preferences = reverse_transport_preferences + self.encryption_preferences = encryption_preferences + self.storage_account_access_tier_preferences = storage_account_access_tier_preferences + + +class PreferencesValidationRequest(ValidationInputRequest): + """Request to validate preference of transport and data center. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar preference: Preference of transport and data center. + :vartype preference: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "preference": {"key": "preference", "type": "Preferences"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + preference: Optional["_models.Preferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword preference: Preference of transport and data center. + :paramtype preference: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.preference = preference + self.device_type = device_type + + +class PreferencesValidationResponseProperties(ValidationInputResponse): + """Properties of data center and transport preference validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Validation status of requested data center and transport. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.status = None + + +class RegionConfigurationRequest(_serialization.Model): + """Request body to get the configuration for the region. + + :ivar schedule_availability_request: Request body to get the availability for scheduling + orders. + :vartype schedule_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityRequest + :ivar transport_availability_request: Request body to get the transport availability for given + sku. + :vartype transport_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityRequest + :ivar datacenter_address_request: Request body to get the datacenter address for given sku. + :vartype datacenter_address_request: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressRequest + """ + + _attribute_map = { + "schedule_availability_request": {"key": "scheduleAvailabilityRequest", "type": "ScheduleAvailabilityRequest"}, + "transport_availability_request": { + "key": "transportAvailabilityRequest", + "type": "TransportAvailabilityRequest", + }, + "datacenter_address_request": {"key": "datacenterAddressRequest", "type": "DatacenterAddressRequest"}, + } + + def __init__( + self, + *, + schedule_availability_request: Optional["_models.ScheduleAvailabilityRequest"] = None, + transport_availability_request: Optional["_models.TransportAvailabilityRequest"] = None, + datacenter_address_request: Optional["_models.DatacenterAddressRequest"] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_availability_request: Request body to get the availability for scheduling + orders. + :paramtype schedule_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityRequest + :keyword transport_availability_request: Request body to get the transport availability for + given sku. + :paramtype transport_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityRequest + :keyword datacenter_address_request: Request body to get the datacenter address for given sku. + :paramtype datacenter_address_request: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressRequest + """ + super().__init__(**kwargs) + self.schedule_availability_request = schedule_availability_request + self.transport_availability_request = transport_availability_request + self.datacenter_address_request = datacenter_address_request + + +class RegionConfigurationResponse(_serialization.Model): + """Configuration response specific to a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar schedule_availability_response: Schedule availability for given sku in a region. + :vartype schedule_availability_response: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityResponse + :ivar transport_availability_response: Transport options available for given sku in a region. + :vartype transport_availability_response: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityResponse + :ivar datacenter_address_response: Datacenter address for given sku in a region. + :vartype datacenter_address_response: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + """ + + _validation = { + "schedule_availability_response": {"readonly": True}, + "transport_availability_response": {"readonly": True}, + "datacenter_address_response": {"readonly": True}, + } + + _attribute_map = { + "schedule_availability_response": { + "key": "scheduleAvailabilityResponse", + "type": "ScheduleAvailabilityResponse", + }, + "transport_availability_response": { + "key": "transportAvailabilityResponse", + "type": "TransportAvailabilityResponse", + }, + "datacenter_address_response": {"key": "datacenterAddressResponse", "type": "DatacenterAddressResponse"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.schedule_availability_response = None + self.transport_availability_response = None + self.datacenter_address_response = None + + +class ResourceIdentity(_serialization.Model): + """Msi identity details of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Identity type. + :vartype type: str + :ivar principal_id: Service Principal Id backing the Msi. + :vartype principal_id: str + :ivar tenant_id: Home Tenant Id. + :vartype tenant_id: str + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: str = "None", + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Identity type. + :paramtype type: str + :keyword user_assigned_identities: User Assigned Identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None + self.user_assigned_identities = user_assigned_identities + + +class ReverseShippingDetails(_serialization.Model): + """Reverse Shipping Address and contact details for a job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar contact_details: Contact Info. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactInfo + :ivar shipping_address: Shipping address where customer wishes to receive the device. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar is_updated: A flag to indicate whether Reverse Shipping details are updated or not after + device has been prepared. + Read only field. + :vartype is_updated: bool + """ + + _validation = { + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactInfo"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactInfo"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact Info. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactInfo + :keyword shipping_address: Shipping address where customer wishes to receive the device. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.is_updated = None + + +class ScheduleAvailabilityResponse(_serialization.Model): + """Schedule availability for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar available_dates: List of dates available to schedule. + :vartype available_dates: list[~datetime.datetime] + """ + + _validation = { + "available_dates": {"readonly": True}, + } + + _attribute_map = { + "available_dates": {"key": "availableDates", "type": "[iso-8601]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.available_dates = None + + +class ShareCredentialDetails(_serialization.Model): + """Credential details of the shares in account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar share_name: Name of the share. + :vartype share_name: str + :ivar share_type: Type of the share. Known values are: "UnknownType", "HCS", "BlockBlob", + "PageBlob", "AzureFile", and "ManagedDisk". + :vartype share_type: str or ~azure.mgmt.databox.v2023_03_01.models.ShareDestinationFormatType + :ivar user_name: User name for the share. + :vartype user_name: str + :ivar password: Password for the share. + :vartype password: str + :ivar supported_access_protocols: Access protocols supported on the device. + :vartype supported_access_protocols: list[str or + ~azure.mgmt.databox.v2023_03_01.models.AccessProtocol] + """ + + _validation = { + "share_name": {"readonly": True}, + "share_type": {"readonly": True}, + "user_name": {"readonly": True}, + "password": {"readonly": True}, + "supported_access_protocols": {"readonly": True}, + } + + _attribute_map = { + "share_name": {"key": "shareName", "type": "str"}, + "share_type": {"key": "shareType", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "supported_access_protocols": {"key": "supportedAccessProtocols", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.share_name = None + self.share_type = None + self.user_name = None + self.password = None + self.supported_access_protocols = None + + +class ShipmentPickUpRequest(_serialization.Model): + """Shipment pick up request details. + + All required parameters must be populated in order to send to Azure. + + :ivar start_time: Minimum date after which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype end_time: ~datetime.datetime + :ivar shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :vartype shipment_location: str + """ + + _validation = { + "start_time": {"required": True}, + "end_time": {"required": True}, + "shipment_location": {"required": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "shipment_location": {"key": "shipmentLocation", "type": "str"}, + } + + def __init__( + self, *, start_time: datetime.datetime, end_time: datetime.datetime, shipment_location: str, **kwargs: Any + ) -> None: + """ + :keyword start_time: Minimum date after which the pick up should commence, this must be in + local time of pick up area. Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :paramtype end_time: ~datetime.datetime + :keyword shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :paramtype shipment_location: str + """ + super().__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.shipment_location = shipment_location + + +class ShipmentPickUpResponse(_serialization.Model): + """Shipment pick up response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confirmation_number: Confirmation number for the pick up request. + :vartype confirmation_number: str + :ivar ready_by_time: Time by which shipment should be ready for pick up, this is in local time + of pick up area. + :vartype ready_by_time: ~datetime.datetime + """ + + _validation = { + "confirmation_number": {"readonly": True}, + "ready_by_time": {"readonly": True}, + } + + _attribute_map = { + "confirmation_number": {"key": "confirmationNumber", "type": "str"}, + "ready_by_time": {"key": "readyByTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.confirmation_number = None + self.ready_by_time = None + + +class ShippingAddress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Shipping address where customer wishes to receive the device. + + All required parameters must be populated in order to send to Azure. + + :ivar street_address1: Street Address line 1. Required. + :vartype street_address1: str + :ivar street_address2: Street Address line 2. + :vartype street_address2: str + :ivar street_address3: Street Address line 3. + :vartype street_address3: str + :ivar city: Name of the City. + :vartype city: str + :ivar state_or_province: Name of the State or Province. + :vartype state_or_province: str + :ivar country: Name of the Country. Required. + :vartype country: str + :ivar postal_code: Postal code. + :vartype postal_code: str + :ivar zip_extended_code: Extended Zip Code. + :vartype zip_extended_code: str + :ivar company_name: Name of the company. + :vartype company_name: str + :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". + :vartype address_type: str or ~azure.mgmt.databox.v2023_03_01.models.AddressType + :ivar skip_address_validation: Flag to indicate if customer has chosen to skip default address + validation. + :vartype skip_address_validation: bool + :ivar tax_identification_number: Tax Identification Number. + :vartype tax_identification_number: str + """ + + _validation = { + "street_address1": {"required": True}, + "country": {"required": True}, + } + + _attribute_map = { + "street_address1": {"key": "streetAddress1", "type": "str"}, + "street_address2": {"key": "streetAddress2", "type": "str"}, + "street_address3": {"key": "streetAddress3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state_or_province": {"key": "stateOrProvince", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "postal_code": {"key": "postalCode", "type": "str"}, + "zip_extended_code": {"key": "zipExtendedCode", "type": "str"}, + "company_name": {"key": "companyName", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "skip_address_validation": {"key": "skipAddressValidation", "type": "bool"}, + "tax_identification_number": {"key": "taxIdentificationNumber", "type": "str"}, + } + + def __init__( + self, + *, + street_address1: str, + country: str, + street_address2: Optional[str] = None, + street_address3: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + zip_extended_code: Optional[str] = None, + company_name: Optional[str] = None, + address_type: Union[str, "_models.AddressType"] = "None", + skip_address_validation: Optional[bool] = None, + tax_identification_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword street_address1: Street Address line 1. Required. + :paramtype street_address1: str + :keyword street_address2: Street Address line 2. + :paramtype street_address2: str + :keyword street_address3: Street Address line 3. + :paramtype street_address3: str + :keyword city: Name of the City. + :paramtype city: str + :keyword state_or_province: Name of the State or Province. + :paramtype state_or_province: str + :keyword country: Name of the Country. Required. + :paramtype country: str + :keyword postal_code: Postal code. + :paramtype postal_code: str + :keyword zip_extended_code: Extended Zip Code. + :paramtype zip_extended_code: str + :keyword company_name: Name of the company. + :paramtype company_name: str + :keyword address_type: Type of address. Known values are: "None", "Residential", and + "Commercial". + :paramtype address_type: str or ~azure.mgmt.databox.v2023_03_01.models.AddressType + :keyword skip_address_validation: Flag to indicate if customer has chosen to skip default + address validation. + :paramtype skip_address_validation: bool + :keyword tax_identification_number: Tax Identification Number. + :paramtype tax_identification_number: str + """ + super().__init__(**kwargs) + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.street_address3 = street_address3 + self.city = city + self.state_or_province = state_or_province + self.country = country + self.postal_code = postal_code + self.zip_extended_code = zip_extended_code + self.company_name = company_name + self.address_type = address_type + self.skip_address_validation = skip_address_validation + self.tax_identification_number = tax_identification_number + + +class Sku(_serialization.Model): + """The Sku. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar display_name: The display name of the sku. + :vartype display_name: str + :ivar family: The sku family. + :vartype family: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + display_name: Optional[str] = None, + family: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword display_name: The display name of the sku. + :paramtype display_name: str + :keyword family: The sku family. + :paramtype family: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.family = family + + +class SkuAvailabilityValidationRequest(ValidationInputRequest): + """Request to validate sku availability. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + **kwargs: Any + ) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.device_type = device_type + self.transfer_type = transfer_type + self.country = country + self.location = location + + +class SkuAvailabilityValidationResponseProperties(ValidationInputResponse): + """Properties of sku availability validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Sku availability validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.status = None + + +class SkuCapacity(_serialization.Model): + """Capacity of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar usable: Usable capacity in TB. + :vartype usable: str + :ivar maximum: Maximum capacity in TB. + :vartype maximum: str + """ + + _validation = { + "usable": {"readonly": True}, + "maximum": {"readonly": True}, + } + + _attribute_map = { + "usable": {"key": "usable", "type": "str"}, + "maximum": {"key": "maximum", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.usable = None + self.maximum = None + + +class SkuCost(_serialization.Model): + """Describes metadata for retrieving price info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar meter_id: Meter id of the Sku. + :vartype meter_id: str + :ivar meter_type: The type of the meter. + :vartype meter_type: str + :ivar multiplier: Multiplier specifies the region specific value to be multiplied with 1$ guid. + Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to + region. + :vartype multiplier: float + """ + + _validation = { + "meter_id": {"readonly": True}, + "meter_type": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "meter_id": {"key": "meterId", "type": "str"}, + "meter_type": {"key": "meterType", "type": "str"}, + "multiplier": {"key": "multiplier", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.meter_id = None + self.meter_type = None + self.multiplier = None + + +class SkuInformation(_serialization.Model): + """Information of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar enabled: The sku is enabled or not. + :vartype enabled: bool + :ivar data_location_to_service_location_map: The map of data location to service location. + :vartype data_location_to_service_location_map: + list[~azure.mgmt.databox.v2023_03_01.models.DataLocationToServiceLocationMap] + :ivar capacity: Capacity of the Sku. + :vartype capacity: ~azure.mgmt.databox.v2023_03_01.models.SkuCapacity + :ivar costs: Cost of the Sku. + :vartype costs: list[~azure.mgmt.databox.v2023_03_01.models.SkuCost] + :ivar api_versions: Api versions that support this Sku. + :vartype api_versions: list[str] + :ivar disabled_reason: Reason why the Sku is disabled. Known values are: "None", "Country", + "Region", "Feature", "OfferType", and "NoSubscriptionInfo". + :vartype disabled_reason: str or ~azure.mgmt.databox.v2023_03_01.models.SkuDisabledReason + :ivar disabled_reason_message: Message for why the Sku is disabled. + :vartype disabled_reason_message: str + :ivar required_feature: Required feature to access the sku. + :vartype required_feature: str + :ivar countries_within_commerce_boundary: List of all the Countries in the SKU specific + commerce boundary. + :vartype countries_within_commerce_boundary: list[str] + """ + + _validation = { + "sku": {"readonly": True}, + "enabled": {"readonly": True}, + "data_location_to_service_location_map": {"readonly": True}, + "capacity": {"readonly": True}, + "costs": {"readonly": True}, + "api_versions": {"readonly": True}, + "disabled_reason": {"readonly": True}, + "disabled_reason_message": {"readonly": True}, + "required_feature": {"readonly": True}, + "countries_within_commerce_boundary": {"readonly": True}, + } + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "enabled": {"key": "enabled", "type": "bool"}, + "data_location_to_service_location_map": { + "key": "properties.dataLocationToServiceLocationMap", + "type": "[DataLocationToServiceLocationMap]", + }, + "capacity": {"key": "properties.capacity", "type": "SkuCapacity"}, + "costs": {"key": "properties.costs", "type": "[SkuCost]"}, + "api_versions": {"key": "properties.apiVersions", "type": "[str]"}, + "disabled_reason": {"key": "properties.disabledReason", "type": "str"}, + "disabled_reason_message": {"key": "properties.disabledReasonMessage", "type": "str"}, + "required_feature": {"key": "properties.requiredFeature", "type": "str"}, + "countries_within_commerce_boundary": {"key": "properties.countriesWithinCommerceBoundary", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku = None + self.enabled = None + self.data_location_to_service_location_map = None + self.capacity = None + self.costs = None + self.api_versions = None + self.disabled_reason = None + self.disabled_reason_message = None + self.required_feature = None + self.countries_within_commerce_boundary = None + + +class StorageAccountDetails(DataAccountDetails): + """Details for the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar storage_account_id: Storage Account Resource Id. Required. + :vartype storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__(self, *, storage_account_id: str, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword storage_account_id: Storage Account Resource Id. Required. + :paramtype storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "StorageAccount" + self.storage_account_id = storage_account_id + + +class SubscriptionIsAllowedToCreateJobValidationRequest(ValidationInputRequest): + """Request to validate subscription permission to create jobs. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + + +class SubscriptionIsAllowedToCreateJobValidationResponseProperties(ValidationInputResponse): + """Properties of subscription permission to create job validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Validation status of subscription permission to create job. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + self.status = None + + +class SystemData(_serialization.Model): + """Provides details about resource creation and update time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: A string identifier for the identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource: user, application, + managedIdentity. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: A string identifier for the identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource: user, + application, managedIdentity. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_by_type": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_by": {"readonly": True}, + "last_modified_by_type": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_by_type = None + self.created_at = None + self.last_modified_by = None + self.last_modified_by_type = None + self.last_modified_at = None + + +class TransferAllDetails(_serialization.Model): + """Details to transfer all data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :vartype transfer_all_blobs: bool + :ivar transfer_all_files: To indicate if all Azure Files have to be transferred. + :vartype transfer_all_files: bool + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "transfer_all_blobs": {"key": "transferAllBlobs", "type": "bool"}, + "transfer_all_files": {"key": "transferAllFiles", "type": "bool"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + transfer_all_blobs: Optional[bool] = None, + transfer_all_files: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :keyword transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :paramtype transfer_all_blobs: bool + :keyword transfer_all_files: To indicate if all Azure Files have to be transferred. + :paramtype transfer_all_files: bool + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.transfer_all_blobs = transfer_all_blobs + self.transfer_all_files = transfer_all_files + + +class TransferConfiguration(_serialization.Model): + """Configuration for defining the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :vartype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationType + :ivar transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :vartype transfer_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferFilterDetails + :ivar transfer_all_details: Map of filter type and the details to transfer all data. This field + is required only if the TransferConfigurationType is given as TransferAll. + :vartype transfer_all_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferAllDetails + """ + + _validation = { + "transfer_configuration_type": {"required": True}, + } + + _attribute_map = { + "transfer_configuration_type": {"key": "transferConfigurationType", "type": "str"}, + "transfer_filter_details": { + "key": "transferFilterDetails", + "type": "TransferConfigurationTransferFilterDetails", + }, + "transfer_all_details": {"key": "transferAllDetails", "type": "TransferConfigurationTransferAllDetails"}, + } + + def __init__( + self, + *, + transfer_configuration_type: Union[str, "_models.TransferConfigurationType"], + transfer_filter_details: Optional["_models.TransferConfigurationTransferFilterDetails"] = None, + transfer_all_details: Optional["_models.TransferConfigurationTransferAllDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :paramtype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationType + :keyword transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :paramtype transfer_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferFilterDetails + :keyword transfer_all_details: Map of filter type and the details to transfer all data. This + field is required only if the TransferConfigurationType is given as TransferAll. + :paramtype transfer_all_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferAllDetails + """ + super().__init__(**kwargs) + self.transfer_configuration_type = transfer_configuration_type + self.transfer_filter_details = transfer_filter_details + self.transfer_all_details = transfer_all_details + + +class TransferConfigurationTransferAllDetails(_serialization.Model): + """Map of filter type and the details to transfer all data. This field is required only if the + TransferConfigurationType is given as TransferAll. + + :ivar include: Details to transfer all data. + :vartype include: ~azure.mgmt.databox.v2023_03_01.models.TransferAllDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferAllDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferAllDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details to transfer all data. + :paramtype include: ~azure.mgmt.databox.v2023_03_01.models.TransferAllDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferConfigurationTransferFilterDetails(_serialization.Model): + """Map of filter type and the details to filter. This field is required only if the + TransferConfigurationType is given as TransferUsingFilter. + + :ivar include: Details of the filtering the transfer of data. + :vartype include: ~azure.mgmt.databox.v2023_03_01.models.TransferFilterDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferFilterDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferFilterDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details of the filtering the transfer of data. + :paramtype include: ~azure.mgmt.databox.v2023_03_01.models.TransferFilterDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferFilterDetails(_serialization.Model): + """Details of the filtering the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar blob_filter_details: Filter details to transfer blobs. + :vartype blob_filter_details: ~azure.mgmt.databox.v2023_03_01.models.BlobFilterDetails + :ivar azure_file_filter_details: Filter details to transfer Azure files. + :vartype azure_file_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.AzureFileFilterDetails + :ivar filter_file_details: Details of the filter files to be used for data transfer. + :vartype filter_file_details: list[~azure.mgmt.databox.v2023_03_01.models.FilterFileDetails] + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "blob_filter_details": {"key": "blobFilterDetails", "type": "BlobFilterDetails"}, + "azure_file_filter_details": {"key": "azureFileFilterDetails", "type": "AzureFileFilterDetails"}, + "filter_file_details": {"key": "filterFileDetails", "type": "[FilterFileDetails]"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + blob_filter_details: Optional["_models.BlobFilterDetails"] = None, + azure_file_filter_details: Optional["_models.AzureFileFilterDetails"] = None, + filter_file_details: Optional[List["_models.FilterFileDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :keyword blob_filter_details: Filter details to transfer blobs. + :paramtype blob_filter_details: ~azure.mgmt.databox.v2023_03_01.models.BlobFilterDetails + :keyword azure_file_filter_details: Filter details to transfer Azure files. + :paramtype azure_file_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.AzureFileFilterDetails + :keyword filter_file_details: Details of the filter files to be used for data transfer. + :paramtype filter_file_details: list[~azure.mgmt.databox.v2023_03_01.models.FilterFileDetails] + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.blob_filter_details = blob_filter_details + self.azure_file_filter_details = azure_file_filter_details + self.filter_file_details = filter_file_details + + +class TransportAvailabilityDetails(_serialization.Model): + """Transport options availability details for given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar shipment_type: Transport Shipment Type supported for given region. Known values are: + "CustomerManaged" and "MicrosoftManaged". + :vartype shipment_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + """ + + _validation = { + "shipment_type": {"readonly": True}, + } + + _attribute_map = { + "shipment_type": {"key": "shipmentType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shipment_type = None + + +class TransportAvailabilityRequest(_serialization.Model): + """Request body to get the transport availability for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class TransportAvailabilityResponse(_serialization.Model): + """Transport options available for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar transport_availability_details: List of transport availability details for given region. + :vartype transport_availability_details: + list[~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityDetails] + """ + + _validation = { + "transport_availability_details": {"readonly": True}, + } + + _attribute_map = { + "transport_availability_details": { + "key": "transportAvailabilityDetails", + "type": "[TransportAvailabilityDetails]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.transport_availability_details = None + + +class TransportPreferences(_serialization.Model): + """Preferences related to the shipment logistics of the sku. + + 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 preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. + Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :vartype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + :ivar is_updated: Read only property which indicates whether transport preferences has been + updated or not after device is prepared. + :vartype is_updated: bool + """ + + _validation = { + "preferred_shipment_type": {"required": True}, + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "preferred_shipment_type": {"key": "preferredShipmentType", "type": "str"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__(self, *, preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], **kwargs: Any) -> None: + """ + :keyword preferred_shipment_type: Indicates Shipment Logistics type that the customer + preferred. Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :paramtype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + """ + super().__init__(**kwargs) + self.preferred_shipment_type = preferred_shipment_type + self.is_updated = None + + +class UnencryptedCredentials(_serialization.Model): + """Unencrypted credentials for accessing device. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_name: Name of the job. + :vartype job_name: str + :ivar job_secrets: Secrets related to this job. + :vartype job_secrets: ~azure.mgmt.databox.v2023_03_01.models.JobSecrets + """ + + _validation = { + "job_name": {"readonly": True}, + "job_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_name": {"key": "jobName", "type": "str"}, + "job_secrets": {"key": "jobSecrets", "type": "JobSecrets"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_name = None + self.job_secrets = None + + +class UnencryptedCredentialsList(_serialization.Model): + """List of unencrypted credentials for accessing device. + + :ivar value: List of unencrypted credentials. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :ivar next_link: Link for the next set of unencrypted credentials. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[UnencryptedCredentials]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.UnencryptedCredentials"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of unencrypted credentials. + :paramtype value: list[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :keyword next_link: Link for the next set of unencrypted credentials. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateJobDetails(_serialization.Model): + """Job details for update. + + :ivar contact_details: Contact details for notification and shipping. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar preferences: Preferences related to the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar key_encryption_key: Key encryption key for the job. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar return_to_customer_package_details: Return package details of job. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + """ + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactDetails"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + preferences: Optional["_models.Preferences"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + return_to_customer_package_details: Optional["_models.PackageCarrierDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword preferences: Preferences related to the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword key_encryption_key: Key encryption key for the job. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword return_to_customer_package_details: Return package details of job. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.reverse_shipping_details = reverse_shipping_details + self.preferences = preferences + self.key_encryption_key = key_encryption_key + self.return_to_customer_package_details = return_to_customer_package_details + + +class UserAssignedIdentity(_serialization.Model): + """Class defining User assigned identity details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedProperties(_serialization.Model): + """User assigned identity properties. + + :ivar resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ValidateAddress(ValidationInputRequest): + """The requirements to validate customer address where the device needs to be shipped. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar shipping_address: Shipping address of the customer. Required. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + """ + + _validation = { + "validation_type": {"required": True}, + "shipping_address": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + } + + def __init__( + self, + *, + shipping_address: "_models.ShippingAddress", + device_type: Union[str, "_models.SkuName"], + transport_preferences: Optional["_models.TransportPreferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword shipping_address: Shipping address of the customer. Required. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.shipping_address = shipping_address + self.device_type = device_type + self.transport_preferences = transport_preferences + + +class ValidationResponse(_serialization.Model): + """Response of pre job creation validations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Overall validation status. Known values are: "AllValidToProceed", + "InputsRevisitRequired", and "CertainInputValidationsSkipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.OverallValidationStatus + :ivar individual_response_details: List of response details contain validationType and its + response as key and value respectively. + :vartype individual_response_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputResponse] + """ + + _validation = { + "status": {"readonly": True}, + "individual_response_details": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "properties.status", "type": "str"}, + "individual_response_details": { + "key": "properties.individualResponseDetails", + "type": "[ValidationInputResponse]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.individual_response_details = None diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..af5c057eb7bd --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py @@ -0,0 +1,219 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_mitigate_request(job_name: str, resource_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", "2023-03-01")) + 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.DataBox/jobs/{jobName}/mitigate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-03-01") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py new file mode 100644 index 000000000000..f9a198c8f545 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py @@ -0,0 +1,1741 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(subscription_id: str, *, skip_token: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mark_devices_shipped_request( + job_name: str, resource_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", "2023-03-01")) + 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.DataBox/jobs/{jobName}/markDevicesShipped", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, skip_token: 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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, job_name: str, subscription_id: str, *, 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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_create_request(resource_group_name: str, job_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-03-01")) + 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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_delete_request(resource_group_name: str, job_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_update_request( + resource_group_name: str, job_name: str, subscription_id: str, *, if_match: 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-03-01")) + 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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_book_shipment_pick_up_request( + resource_group_name: str, job_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-03-01")) + 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.DataBox/jobs/{jobName}/bookShipmentPickUp", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_cancel_request(resource_group_name: str, job_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-03-01")) + 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.DataBox/jobs/{jobName}/cancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_credentials_request( + resource_group_name: str, job_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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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 JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + } + + @distributed_trace + def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :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._api_version or "2023-03-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: 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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource 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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> Iterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :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._api_version or "2023-03-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py new file mode 100644 index 000000000000..fb1a22130444 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py @@ -0,0 +1,156 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(**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-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataBox/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.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._api_version or "2023-03-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py new file mode 100644 index 000000000000..c95982425316 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py @@ -0,0 +1,1085 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_available_skus_by_resource_group_request( + resource_group_name: str, location: 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-03-01")) + 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.DataBox/locations/{location}/availableSkus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_address_request(location: 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-03-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/validateAddress", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_by_resource_group_request( + resource_group_name: str, location: 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-03-01")) + 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.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_request(location: 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-03-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_request(location: 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-03-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_by_resource_group_request( + resource_group_name: str, location: 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-03-01")) + 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.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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 ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :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._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/__init__.py new file mode 100644 index 000000000000..063260fb2814 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_configuration.py new file mode 100644 index 000000000000..f6a56fc16cce --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-12-01". 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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-12-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_data_box_management_client.py new file mode 100644 index 000000000000..20084b133e28 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_data_box_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_12_01.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_12_01.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_12_01.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. 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-12-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "DataBoxManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_metadata.json new file mode 100644 index 000000000000..1433311ee560 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_metadata.json @@ -0,0 +1,133 @@ +{ + "chosen_version": "2023-12-01", + "total_api_version_list": ["2023-12-01"], + "client": { + "name": "DataBoxManagementClient", + "filename": "_data_box_management_client", + "description": "The DataBox Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "jobs": "JobsOperations", + "service": "ServiceOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", + "operations": { + "mitigate" : { + "sync": { + "signature": "def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + } + } + } + } +} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_vendor.py new file mode 100644 index 000000000000..9f9a6a04708b --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_vendor.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + +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 + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/__init__.py new file mode 100644 index 000000000000..955dbd6c6677 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_configuration.py new file mode 100644 index 000000000000..37df87e08ccd --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-12-01". 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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-12-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_data_box_management_client.py new file mode 100644 index 000000000000..2bc011b8e51f --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_data_box_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_12_01.aio.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_12_01.aio.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_12_01.aio.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. 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-12-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-12-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataBoxManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_vendor.py new file mode 100644 index 000000000000..54f3d3ec6541 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..1981e4e2f894 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_data_box_management_client_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._data_box_management_client_operations import build_mitigate_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-12-01") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_jobs_operations.py new file mode 100644 index 000000000000..5948ec7729c7 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_jobs_operations.py @@ -0,0 +1,1434 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import ( + build_book_shipment_pick_up_request, + build_cancel_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_credentials_request, + build_list_request, + build_mark_devices_shipped_request, + build_update_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.aio.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_12_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_12_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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("JobResourceList", 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.ApiError, 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.DataBox/jobs" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.JobResource + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_12_01.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_12_01.models.JobResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2023-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_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._api_version or "2023-12-01")) + 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, + job_name=job_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.DataBox/jobs/{jobName}" + } + + async def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_12_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_12_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_12_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_12_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.UnencryptedCredentials] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.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("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_operations.py new file mode 100644 index 000000000000..512df22a9453 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.aio.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.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._api_version or "2023-12-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_service_operations.py new file mode 100644 index 000000000000..ef35bd066c88 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/aio/operations/_service_operations.py @@ -0,0 +1,899 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_operations import ( + build_list_available_skus_by_resource_group_request, + build_region_configuration_by_resource_group_request, + build_region_configuration_request, + build_validate_address_request, + build_validate_inputs_by_resource_group_request, + build_validate_inputs_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.aio.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_12_01.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_12_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + async def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_12_01.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_12_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/__init__.py new file mode 100644 index 000000000000..7025f6c4c8f1 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/__init__.py @@ -0,0 +1,337 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AccountCredentialDetails +from ._models_py3 import AdditionalErrorInfo +from ._models_py3 import AddressValidationOutput +from ._models_py3 import AddressValidationProperties +from ._models_py3 import ApiError +from ._models_py3 import ApplianceNetworkConfiguration +from ._models_py3 import ArmBaseObject +from ._models_py3 import AvailableSkuRequest +from ._models_py3 import AvailableSkusResult +from ._models_py3 import AzureFileFilterDetails +from ._models_py3 import BlobFilterDetails +from ._models_py3 import CancellationReason +from ._models_py3 import CloudError +from ._models_py3 import ContactDetails +from ._models_py3 import ContactInfo +from ._models_py3 import CopyLogDetails +from ._models_py3 import CopyProgress +from ._models_py3 import CreateJobValidations +from ._models_py3 import CreateOrderLimitForSubscriptionValidationRequest +from ._models_py3 import CreateOrderLimitForSubscriptionValidationResponseProperties +from ._models_py3 import CustomerDiskJobSecrets +from ._models_py3 import DataAccountDetails +from ._models_py3 import DataBoxAccountCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyProgress +from ._models_py3 import DataBoxCustomerDiskJobDetails +from ._models_py3 import DataBoxDiskCopyLogDetails +from ._models_py3 import DataBoxDiskCopyProgress +from ._models_py3 import DataBoxDiskGranularCopyLogDetails +from ._models_py3 import DataBoxDiskGranularCopyProgress +from ._models_py3 import DataBoxDiskJobDetails +from ._models_py3 import DataBoxDiskJobSecrets +from ._models_py3 import DataBoxHeavyAccountCopyLogDetails +from ._models_py3 import DataBoxHeavyJobDetails +from ._models_py3 import DataBoxHeavyJobSecrets +from ._models_py3 import DataBoxHeavySecret +from ._models_py3 import DataBoxJobDetails +from ._models_py3 import DataBoxScheduleAvailabilityRequest +from ._models_py3 import DataBoxSecret +from ._models_py3 import DataExportDetails +from ._models_py3 import DataImportDetails +from ._models_py3 import DataLocationToServiceLocationMap +from ._models_py3 import DataTransferDetailsValidationRequest +from ._models_py3 import DataTransferDetailsValidationResponseProperties +from ._models_py3 import DataboxJobSecrets +from ._models_py3 import DatacenterAddressInstructionResponse +from ._models_py3 import DatacenterAddressLocationResponse +from ._models_py3 import DatacenterAddressRequest +from ._models_py3 import DatacenterAddressResponse +from ._models_py3 import DcAccessSecurityCode +from ._models_py3 import Details +from ._models_py3 import DeviceCapabilityDetails +from ._models_py3 import DeviceCapabilityRequest +from ._models_py3 import DeviceCapabilityResponse +from ._models_py3 import DeviceErasureDetails +from ._models_py3 import DiskScheduleAvailabilityRequest +from ._models_py3 import DiskSecret +from ._models_py3 import EncryptionPreferences +from ._models_py3 import ErrorDetail +from ._models_py3 import ExportDiskDetails +from ._models_py3 import FilterFileDetails +from ._models_py3 import GranularCopyLogDetails +from ._models_py3 import GranularCopyProgress +from ._models_py3 import HeavyScheduleAvailabilityRequest +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportDiskDetails +from ._models_py3 import JobDelayDetails +from ._models_py3 import JobDeliveryInfo +from ._models_py3 import JobDetails +from ._models_py3 import JobResource +from ._models_py3 import JobResourceList +from ._models_py3 import JobResourceUpdateParameter +from ._models_py3 import JobSecrets +from ._models_py3 import JobStages +from ._models_py3 import KeyEncryptionKey +from ._models_py3 import LastMitigationActionOnJob +from ._models_py3 import ManagedDiskDetails +from ._models_py3 import MarkDevicesShippedRequest +from ._models_py3 import MitigateJobRequest +from ._models_py3 import NotificationPreference +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import PackageCarrierDetails +from ._models_py3 import PackageCarrierInfo +from ._models_py3 import PackageShippingDetails +from ._models_py3 import Preferences +from ._models_py3 import PreferencesValidationRequest +from ._models_py3 import PreferencesValidationResponseProperties +from ._models_py3 import RegionConfigurationRequest +from ._models_py3 import RegionConfigurationResponse +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import ReverseShippingDetails +from ._models_py3 import ScheduleAvailabilityRequest +from ._models_py3 import ScheduleAvailabilityResponse +from ._models_py3 import ShareCredentialDetails +from ._models_py3 import ShipmentPickUpRequest +from ._models_py3 import ShipmentPickUpResponse +from ._models_py3 import ShippingAddress +from ._models_py3 import Sku +from ._models_py3 import SkuAvailabilityValidationRequest +from ._models_py3 import SkuAvailabilityValidationResponseProperties +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import StorageAccountDetails +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationRequest +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationResponseProperties +from ._models_py3 import SystemData +from ._models_py3 import TransferAllDetails +from ._models_py3 import TransferConfiguration +from ._models_py3 import TransferConfigurationTransferAllDetails +from ._models_py3 import TransferConfigurationTransferFilterDetails +from ._models_py3 import TransferFilterDetails +from ._models_py3 import TransportAvailabilityDetails +from ._models_py3 import TransportAvailabilityRequest +from ._models_py3 import TransportAvailabilityResponse +from ._models_py3 import TransportPreferences +from ._models_py3 import UnencryptedCredentials +from ._models_py3 import UnencryptedCredentialsList +from ._models_py3 import UpdateJobDetails +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedProperties +from ._models_py3 import ValidateAddress +from ._models_py3 import ValidationInputRequest +from ._models_py3 import ValidationInputResponse +from ._models_py3 import ValidationRequest +from ._models_py3 import ValidationResponse + +from ._data_box_management_client_enums import AccessProtocol +from ._data_box_management_client_enums import AddressType +from ._data_box_management_client_enums import AddressValidationStatus +from ._data_box_management_client_enums import ClassDiscriminator +from ._data_box_management_client_enums import CopyStatus +from ._data_box_management_client_enums import CustomerResolutionCode +from ._data_box_management_client_enums import DataAccountType +from ._data_box_management_client_enums import DataCenterCode +from ._data_box_management_client_enums import DatacenterAddressType +from ._data_box_management_client_enums import DelayNotificationStatus +from ._data_box_management_client_enums import DoubleEncryption +from ._data_box_management_client_enums import FilterFileType +from ._data_box_management_client_enums import HardwareEncryption +from ._data_box_management_client_enums import JobDeliveryType +from ._data_box_management_client_enums import KekType +from ._data_box_management_client_enums import LogCollectionLevel +from ._data_box_management_client_enums import NotificationStageName +from ._data_box_management_client_enums import OverallValidationStatus +from ._data_box_management_client_enums import PortalDelayErrorCode +from ._data_box_management_client_enums import ReverseShippingDetailsEditStatus +from ._data_box_management_client_enums import ReverseTransportPreferenceEditStatus +from ._data_box_management_client_enums import ShareDestinationFormatType +from ._data_box_management_client_enums import SkuDisabledReason +from ._data_box_management_client_enums import SkuName +from ._data_box_management_client_enums import StageName +from ._data_box_management_client_enums import StageStatus +from ._data_box_management_client_enums import TransferConfigurationType +from ._data_box_management_client_enums import TransferType +from ._data_box_management_client_enums import TransportShipmentTypes +from ._data_box_management_client_enums import ValidationInputDiscriminator +from ._data_box_management_client_enums import ValidationStatus +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccountCredentialDetails", + "AdditionalErrorInfo", + "AddressValidationOutput", + "AddressValidationProperties", + "ApiError", + "ApplianceNetworkConfiguration", + "ArmBaseObject", + "AvailableSkuRequest", + "AvailableSkusResult", + "AzureFileFilterDetails", + "BlobFilterDetails", + "CancellationReason", + "CloudError", + "ContactDetails", + "ContactInfo", + "CopyLogDetails", + "CopyProgress", + "CreateJobValidations", + "CreateOrderLimitForSubscriptionValidationRequest", + "CreateOrderLimitForSubscriptionValidationResponseProperties", + "CustomerDiskJobSecrets", + "DataAccountDetails", + "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDiskCopyLogDetails", + "DataBoxCustomerDiskCopyProgress", + "DataBoxCustomerDiskJobDetails", + "DataBoxDiskCopyLogDetails", + "DataBoxDiskCopyProgress", + "DataBoxDiskGranularCopyLogDetails", + "DataBoxDiskGranularCopyProgress", + "DataBoxDiskJobDetails", + "DataBoxDiskJobSecrets", + "DataBoxHeavyAccountCopyLogDetails", + "DataBoxHeavyJobDetails", + "DataBoxHeavyJobSecrets", + "DataBoxHeavySecret", + "DataBoxJobDetails", + "DataBoxScheduleAvailabilityRequest", + "DataBoxSecret", + "DataExportDetails", + "DataImportDetails", + "DataLocationToServiceLocationMap", + "DataTransferDetailsValidationRequest", + "DataTransferDetailsValidationResponseProperties", + "DataboxJobSecrets", + "DatacenterAddressInstructionResponse", + "DatacenterAddressLocationResponse", + "DatacenterAddressRequest", + "DatacenterAddressResponse", + "DcAccessSecurityCode", + "Details", + "DeviceCapabilityDetails", + "DeviceCapabilityRequest", + "DeviceCapabilityResponse", + "DeviceErasureDetails", + "DiskScheduleAvailabilityRequest", + "DiskSecret", + "EncryptionPreferences", + "ErrorDetail", + "ExportDiskDetails", + "FilterFileDetails", + "GranularCopyLogDetails", + "GranularCopyProgress", + "HeavyScheduleAvailabilityRequest", + "IdentityProperties", + "ImportDiskDetails", + "JobDelayDetails", + "JobDeliveryInfo", + "JobDetails", + "JobResource", + "JobResourceList", + "JobResourceUpdateParameter", + "JobSecrets", + "JobStages", + "KeyEncryptionKey", + "LastMitigationActionOnJob", + "ManagedDiskDetails", + "MarkDevicesShippedRequest", + "MitigateJobRequest", + "NotificationPreference", + "Operation", + "OperationDisplay", + "OperationList", + "PackageCarrierDetails", + "PackageCarrierInfo", + "PackageShippingDetails", + "Preferences", + "PreferencesValidationRequest", + "PreferencesValidationResponseProperties", + "RegionConfigurationRequest", + "RegionConfigurationResponse", + "Resource", + "ResourceIdentity", + "ReverseShippingDetails", + "ScheduleAvailabilityRequest", + "ScheduleAvailabilityResponse", + "ShareCredentialDetails", + "ShipmentPickUpRequest", + "ShipmentPickUpResponse", + "ShippingAddress", + "Sku", + "SkuAvailabilityValidationRequest", + "SkuAvailabilityValidationResponseProperties", + "SkuCapacity", + "SkuCost", + "SkuInformation", + "StorageAccountDetails", + "SubscriptionIsAllowedToCreateJobValidationRequest", + "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + "SystemData", + "TransferAllDetails", + "TransferConfiguration", + "TransferConfigurationTransferAllDetails", + "TransferConfigurationTransferFilterDetails", + "TransferFilterDetails", + "TransportAvailabilityDetails", + "TransportAvailabilityRequest", + "TransportAvailabilityResponse", + "TransportPreferences", + "UnencryptedCredentials", + "UnencryptedCredentialsList", + "UpdateJobDetails", + "UserAssignedIdentity", + "UserAssignedProperties", + "ValidateAddress", + "ValidationInputRequest", + "ValidationInputResponse", + "ValidationRequest", + "ValidationResponse", + "AccessProtocol", + "AddressType", + "AddressValidationStatus", + "ClassDiscriminator", + "CopyStatus", + "CustomerResolutionCode", + "DataAccountType", + "DataCenterCode", + "DatacenterAddressType", + "DelayNotificationStatus", + "DoubleEncryption", + "FilterFileType", + "HardwareEncryption", + "JobDeliveryType", + "KekType", + "LogCollectionLevel", + "NotificationStageName", + "OverallValidationStatus", + "PortalDelayErrorCode", + "ReverseShippingDetailsEditStatus", + "ReverseTransportPreferenceEditStatus", + "ShareDestinationFormatType", + "SkuDisabledReason", + "SkuName", + "StageName", + "StageStatus", + "TransferConfigurationType", + "TransferType", + "TransportShipmentTypes", + "ValidationInputDiscriminator", + "ValidationStatus", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_data_box_management_client_enums.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_data_box_management_client_enums.py new file mode 100644 index 000000000000..a5b9d634a77a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_data_box_management_client_enums.py @@ -0,0 +1,514 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AccessProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessProtocol.""" + + SMB = "SMB" + """Server Message Block protocol(SMB).""" + NFS = "NFS" + """Network File System protocol(NFS).""" + + +class AddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of address.""" + + NONE = "None" + """Address type not known.""" + RESIDENTIAL = "Residential" + """Residential Address.""" + COMMERCIAL = "Commercial" + """Commercial Address.""" + + +class AddressValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The address validation status.""" + + VALID = "Valid" + """Address provided is valid.""" + INVALID = "Invalid" + """Address provided is invalid or not supported.""" + AMBIGUOUS = "Ambiguous" + """Address provided is ambiguous, please choose one of the alternate addresses returned.""" + + +class ClassDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the type of job details.""" + + DATA_BOX = "DataBox" + """Data Box orders.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk orders.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy orders.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk orders.""" + + +class CopyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Status of the copy.""" + + NOT_STARTED = "NotStarted" + """Data copy hasn't started yet.""" + IN_PROGRESS = "InProgress" + """Data copy is in progress.""" + COMPLETED = "Completed" + """Data copy completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Data copy completed with errors.""" + FAILED = "Failed" + """Data copy failed. No data was copied.""" + NOT_RETURNED = "NotReturned" + """No copy triggered as device was not returned.""" + HARDWARE_ERROR = "HardwareError" + """The Device has hit hardware issues.""" + DEVICE_FORMATTED = "DeviceFormatted" + """Data copy failed. The Device was formatted by user.""" + DEVICE_METADATA_MODIFIED = "DeviceMetadataModified" + """Data copy failed. Device metadata was modified by user.""" + STORAGE_ACCOUNT_NOT_ACCESSIBLE = "StorageAccountNotAccessible" + """Data copy failed. Storage Account was not accessible during copy.""" + UNSUPPORTED_DATA = "UnsupportedData" + """Data copy failed. The Device data content is not supported.""" + DRIVE_NOT_RECEIVED = "DriveNotReceived" + """No copy triggered as device was not received.""" + UNSUPPORTED_DRIVE = "UnsupportedDrive" + """No copy triggered as device type is not supported.""" + OTHER_SERVICE_ERROR = "OtherServiceError" + """Copy failed due to service error.""" + OTHER_USER_ERROR = "OtherUserError" + """Copy failed due to user error.""" + DRIVE_NOT_DETECTED = "DriveNotDetected" + """Copy failed due to disk detection error.""" + DRIVE_CORRUPTED = "DriveCorrupted" + """Copy failed due to corrupted drive.""" + METADATA_FILES_MODIFIED_OR_REMOVED = "MetadataFilesModifiedOrRemoved" + """Copy failed due to modified or removed metadata files.""" + + +class CustomerResolutionCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CustomerResolutionCode.""" + + NONE = "None" + """No Resolution Yet""" + MOVE_TO_CLEAN_UP_DEVICE = "MoveToCleanUpDevice" + """Clean the device""" + RESUME = "Resume" + """Resume the job to same stage""" + RESTART = "Restart" + """Restart whole action.""" + REACH_OUT_TO_OPERATION = "ReachOutToOperation" + """Reach out to operation for further action.""" + + +class DataAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the account.""" + + STORAGE_ACCOUNT = "StorageAccount" + """Storage Accounts .""" + MANAGED_DISK = "ManagedDisk" + """Azure Managed disk storage.""" + + +class DatacenterAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data center address type.""" + + DATACENTER_ADDRESS_LOCATION = "DatacenterAddressLocation" + """Data center address location.""" + DATACENTER_ADDRESS_INSTRUCTION = "DatacenterAddressInstruction" + """Data center address instruction.""" + + +class DataCenterCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataCenter code.""" + + INVALID = "Invalid" + BY2 = "BY2" + BY1 = "BY1" + ORK70 = "ORK70" + AM2 = "AM2" + AMS20 = "AMS20" + BY21 = "BY21" + BY24 = "BY24" + MWH01 = "MWH01" + AMS06 = "AMS06" + SSE90 = "SSE90" + SYD03 = "SYD03" + SYD23 = "SYD23" + CBR20 = "CBR20" + YTO20 = "YTO20" + CWL20 = "CWL20" + LON24 = "LON24" + BOM01 = "BOM01" + BL20 = "BL20" + BL7 = "BL7" + SEL20 = "SEL20" + TYO01 = "TYO01" + BN1 = "BN1" + SN5 = "SN5" + CYS04 = "CYS04" + TYO22 = "TYO22" + YTO21 = "YTO21" + YQB20 = "YQB20" + FRA22 = "FRA22" + MAA01 = "MAA01" + CPQ02 = "CPQ02" + CPQ20 = "CPQ20" + SIN20 = "SIN20" + HKG20 = "HKG20" + SG2 = "SG2" + MEL23 = "MEL23" + SEL21 = "SEL21" + OSA20 = "OSA20" + SHA03 = "SHA03" + BJB = "BJB" + JNB22 = "JNB22" + JNB21 = "JNB21" + MNZ21 = "MNZ21" + SN8 = "SN8" + AUH20 = "AUH20" + ZRH20 = "ZRH20" + PUS20 = "PUS20" + AD_HOC = "AdHoc" + CH1 = "CH1" + DSM05 = "DSM05" + DUB07 = "DUB07" + PNQ01 = "PNQ01" + SVG20 = "SVG20" + OSA02 = "OSA02" + OSA22 = "OSA22" + PAR22 = "PAR22" + BN7 = "BN7" + SN6 = "SN6" + BJS20 = "BJS20" + BL24 = "BL24" + IDC5 = "IDC5" + TYO23 = "TYO23" + CPQ21 = "CPQ21" + NTG20 = "NTG20" + DXB23 = "DXB23" + DSM11 = "DSM11" + OSA23 = "OSA23" + AMS25 = "AMS25" + + +class DelayNotificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of notification.""" + + ACTIVE = "Active" + """Delay is still active""" + RESOLVED = "Resolved" + """Delay has been resolved""" + + +class DoubleEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines secondary layer of software-based encryption enablement.""" + + ENABLED = "Enabled" + """Software-based encryption is enabled.""" + DISABLED = "Disabled" + """Software-based encryption is disabled.""" + + +class FilterFileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the filter file.""" + + AZURE_BLOB = "AzureBlob" + """Filter file is of the type AzureBlob.""" + AZURE_FILE = "AzureFile" + """Filter file is of the type AzureFiles.""" + + +class HardwareEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hardware encryption support for a given sku for a given region.""" + + ENABLED = "Enabled" + """Hardware-based encryption is enabled.""" + DISABLED = "Disabled" + """Hardware-based encryption is disabled.""" + + +class JobDeliveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delivery type of Job.""" + + NON_SCHEDULED = "NonScheduled" + """Non Scheduled job.""" + SCHEDULED = "Scheduled" + """Scheduled job.""" + + +class KekType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of encryption key used for key encryption.""" + + MICROSOFT_MANAGED = "MicrosoftManaged" + """Key encryption key is managed by Microsoft.""" + CUSTOMER_MANAGED = "CustomerManaged" + """Key encryption key is managed by the Customer.""" + + +class LogCollectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the logs to be collected.""" + + ERROR = "Error" + """Only Errors will be collected in the logs.""" + VERBOSE = "Verbose" + """Verbose logging (includes Errors, CRC, size information and others).""" + + +class NotificationStageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage.""" + + DEVICE_PREPARED = "DevicePrepared" + """Notification at device prepared stage.""" + DISPATCHED = "Dispatched" + """Notification at device dispatched stage.""" + DELIVERED = "Delivered" + """Notification at device delivered stage.""" + PICKED_UP = "PickedUp" + """Notification at device picked up from user stage.""" + AT_AZURE_DC = "AtAzureDC" + """Notification at device received at Azure datacenter stage.""" + DATA_COPY = "DataCopy" + """Notification at data copy started stage.""" + CREATED = "Created" + """Notification at job created stage.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Notification at shipped devices to customer stage.""" + + +class OverallValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Overall validation status.""" + + ALL_VALID_TO_PROCEED = "AllValidToProceed" + """Every input request is valid.""" + INPUTS_REVISIT_REQUIRED = "InputsRevisitRequired" + """Some input requests are not valid.""" + CERTAIN_INPUT_VALIDATIONS_SKIPPED = "CertainInputValidationsSkipped" + """Certain input validations skipped.""" + + +class PortalDelayErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delay Error code.""" + + INTERNAL_ISSUE_DELAY = "InternalIssueDelay" + """Delay due to any internal reasons""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Active Order limit breached.""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """High demand""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Slow copy due to large number of files""" + + +class ReverseShippingDetailsEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Shipping Address and Contact Info.""" + + ENABLED = "Enabled" + """Reverse shipping details can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse shipping details.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse shipping details. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ReverseTransportPreferenceEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Transport preferences.""" + + ENABLED = "Enabled" + """Reverse Transport Preferences can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse Transport Preferences.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse Transport Preferences. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ShareDestinationFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the share.""" + + UNKNOWN_TYPE = "UnknownType" + """Unknown format.""" + HCS = "HCS" + """Storsimple data format.""" + BLOCK_BLOB = "BlockBlob" + """Azure storage block blob format.""" + PAGE_BLOB = "PageBlob" + """Azure storage page blob format.""" + AZURE_FILE = "AzureFile" + """Azure storage file format.""" + MANAGED_DISK = "ManagedDisk" + """Azure Compute Disk.""" + + +class SkuDisabledReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Reason why the Sku is disabled.""" + + NONE = "None" + """SKU is not disabled.""" + COUNTRY = "Country" + """SKU is not available in the requested country.""" + REGION = "Region" + """SKU is not available to push data to the requested Azure region.""" + FEATURE = "Feature" + """Required features are not enabled for the SKU.""" + OFFER_TYPE = "OfferType" + """Subscription does not have required offer types for the SKU.""" + NO_SUBSCRIPTION_INFO = "NoSubscriptionInfo" + """Subscription has not registered to Microsoft.DataBox and Service does not have the subscription + #: notification.""" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SkuName.""" + + DATA_BOX = "DataBox" + """Data Box.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk""" + + +class StageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage which is in progress.""" + + DEVICE_ORDERED = "DeviceOrdered" + """An order has been created.""" + DEVICE_PREPARED = "DevicePrepared" + """A device has been prepared for the order.""" + DISPATCHED = "Dispatched" + """Device has been dispatched to the user of the order.""" + DELIVERED = "Delivered" + """Device has been delivered to the user of the order.""" + PICKED_UP = "PickedUp" + """Device has been picked up from user and in transit to Azure datacenter.""" + AT_AZURE_DC = "AtAzureDC" + """Device has been received at Azure datacenter from the user.""" + DATA_COPY = "DataCopy" + """Data copy from the device at Azure datacenter.""" + COMPLETED = "Completed" + """Order has completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Order has completed with errors.""" + CANCELLED = "Cancelled" + """Order has been cancelled.""" + FAILED_ISSUE_REPORTED_AT_CUSTOMER = "Failed_IssueReportedAtCustomer" + """Order has failed due to issue reported by user.""" + FAILED_ISSUE_DETECTED_AT_AZURE_DC = "Failed_IssueDetectedAtAzureDC" + """Order has failed due to issue detected at Azure datacenter.""" + ABORTED = "Aborted" + """Order has been aborted.""" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """Order has completed with warnings.""" + READY_TO_DISPATCH_FROM_AZURE_DC = "ReadyToDispatchFromAzureDC" + """Device is ready to be handed to customer from Azure DC.""" + READY_TO_RECEIVE_AT_AZURE_DC = "ReadyToReceiveAtAzureDC" + """Device can be dropped off at Azure DC.""" + CREATED = "Created" + """Job created by the customer.""" + SHIPPED_TO_AZURE_DC = "ShippedToAzureDC" + """User shipped the device to AzureDC.""" + AWAITING_SHIPMENT_DETAILS = "AwaitingShipmentDetails" + """Awaiting shipment details of device from customer.""" + PREPARING_TO_SHIP_FROM_AZURE_DC = "PreparingToShipFromAzureDC" + """Preparing the device to ship to customer.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Shipped the device to customer.""" + + +class StageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Holds the device erasure completion status.""" + + NONE = "None" + """No status available yet.""" + IN_PROGRESS = "InProgress" + """Stage is in progress.""" + SUCCEEDED = "Succeeded" + """Stage has succeeded.""" + FAILED = "Failed" + """Stage has failed.""" + CANCELLED = "Cancelled" + """Stage has been cancelled.""" + CANCELLING = "Cancelling" + """Stage is cancelling.""" + SUCCEEDED_WITH_ERRORS = "SucceededWithErrors" + """Stage has succeeded with errors.""" + WAITING_FOR_CUSTOMER_ACTION = "WaitingForCustomerAction" + """Stage is stuck until customer takes some action.""" + SUCCEEDED_WITH_WARNINGS = "SucceededWithWarnings" + """Stage has succeeded with warnings.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_KEK = "WaitingForCustomerActionForKek" + """Stage is waiting for customer action for kek action items.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_CLEAN_UP = "WaitingForCustomerActionForCleanUp" + """Stage is waiting for customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED_FOR_CLEAN_UP = "CustomerActionPerformedForCleanUp" + """Stage has performed customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED = "CustomerActionPerformed" + """Stage has performed customer action for clean up.""" + + +class TransferConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the configuration for transfer.""" + + TRANSFER_ALL = "TransferAll" + """Transfer all the data.""" + TRANSFER_USING_FILTER = "TransferUsingFilter" + """Transfer using filter.""" + + +class TransferType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the transfer.""" + + IMPORT_TO_AZURE = "ImportToAzure" + """Import data to azure.""" + EXPORT_FROM_AZURE = "ExportFromAzure" + """Export data from azure.""" + + +class TransportShipmentTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transport Shipment Type supported for given region.""" + + CUSTOMER_MANAGED = "CustomerManaged" + """Shipment Logistics is handled by the customer.""" + MICROSOFT_MANAGED = "MicrosoftManaged" + """Shipment Logistics is handled by Microsoft.""" + + +class ValidationInputDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identifies the type of validation request.""" + + VALIDATE_ADDRESS = "ValidateAddress" + """Identify request and response of address validation.""" + VALIDATE_SUBSCRIPTION_IS_ALLOWED_TO_CREATE_JOB = "ValidateSubscriptionIsAllowedToCreateJob" + """Identify request and response for validation of subscription permission to create job.""" + VALIDATE_PREFERENCES = "ValidatePreferences" + """Identify request and response of preference validation.""" + VALIDATE_CREATE_ORDER_LIMIT = "ValidateCreateOrderLimit" + """Identify request and response of create order limit for subscription validation.""" + VALIDATE_SKU_AVAILABILITY = "ValidateSkuAvailability" + """Identify request and response of active job limit for sku availability.""" + VALIDATE_DATA_TRANSFER_DETAILS = "ValidateDataTransferDetails" + """Identify request and response of data transfer details validation.""" + + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Create order limit validation status.""" + + VALID = "Valid" + """Validation is successful""" + INVALID = "Invalid" + """Validation is not successful""" + SKIPPED = "Skipped" + """Validation is skipped""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_models_py3.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_models_py3.py new file mode 100644 index 000000000000..aad6df7dc806 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_models_py3.py @@ -0,0 +1,6544 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccountCredentialDetails(_serialization.Model): + """Credential details of the account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_name: Name of the account. + :vartype account_name: str + :ivar data_account_type: Type of the account. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar account_connection_string: Connection string of the account endpoint to use the account + as a storage endpoint on the device. + :vartype account_connection_string: str + :ivar share_credential_details: Per share level unencrypted access credentials. + :vartype share_credential_details: + list[~azure.mgmt.databox.v2023_12_01.models.ShareCredentialDetails] + """ + + _validation = { + "account_name": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_connection_string": {"readonly": True}, + "share_credential_details": {"readonly": True}, + } + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_connection_string": {"key": "accountConnectionString", "type": "str"}, + "share_credential_details": {"key": "shareCredentialDetails", "type": "[ShareCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.account_name = None + self.data_account_type = None + self.account_connection_string = None + self.share_credential_details = None + + +class AdditionalErrorInfo(_serialization.Model): + """This class represents additional info which Resource Providers pass when an error occurs. + + :ivar info: Additional information of the type of error. + :vartype info: JSON + :ivar type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :vartype type: str + """ + + _attribute_map = { + "info": {"key": "info", "type": "object"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, info: Optional[JSON] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword info: Additional information of the type of error. + :paramtype info: JSON + :keyword type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :paramtype type: str + """ + super().__init__(**kwargs) + self.info = info + self.type = type + + +class AddressValidationOutput(_serialization.Model): + """Output of the address validation api. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_type: Identifies the type of validation response. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_12_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_12_01.models.ShippingAddress] + """ + + _validation = { + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "properties.validationType", "type": "str"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "validation_status": {"key": "properties.validationStatus", "type": "str"}, + "alternate_addresses": {"key": "properties.alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + self.validation_status = None + self.alternate_addresses = None + + +class ValidationInputResponse(_serialization.Model): + """Minimum properties that should be present in each individual validation response. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AddressValidationProperties, CreateOrderLimitForSubscriptionValidationResponseProperties, + DataTransferDetailsValidationResponseProperties, PreferencesValidationResponseProperties, + SkuAvailabilityValidationResponseProperties, + SubscriptionIsAllowedToCreateJobValidationResponseProperties + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "AddressValidationProperties", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationResponseProperties", + "ValidateDataTransferDetails": "DataTransferDetailsValidationResponseProperties", + "ValidatePreferences": "PreferencesValidationResponseProperties", + "ValidateSkuAvailability": "SkuAvailabilityValidationResponseProperties", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + + +class AddressValidationProperties(ValidationInputResponse): + """The address validation output. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_12_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_12_01.models.ShippingAddress] + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "validation_status": {"key": "validationStatus", "type": "str"}, + "alternate_addresses": {"key": "alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.validation_status = None + self.alternate_addresses = None + + +class ApiError(_serialization.Model): + """ApiError. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.ErrorDetail + """ + + _validation = { + "error": {"required": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: "_models.ErrorDetail", **kwargs: Any) -> None: + """ + :keyword error: Required. + :paramtype error: ~azure.mgmt.databox.v2023_12_01.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ApplianceNetworkConfiguration(_serialization.Model): + """The Network Adapter configuration of a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the network. + :vartype name: str + :ivar mac_address: Mac Address. + :vartype mac_address: str + """ + + _validation = { + "name": {"readonly": True}, + "mac_address": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.mac_address = None + + +class ArmBaseObject(_serialization.Model): + """Base class for all objects under resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class AvailableSkuRequest(_serialization.Model): + """The filters for showing the available skus. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + :ivar sku_names: Sku Names to filter for available skus. + :vartype sku_names: list[str or ~azure.mgmt.databox.v2023_12_01.models.SkuName] + """ + + _validation = { + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "sku_names": {"key": "skuNames", "type": "[str]"}, + } + + def __init__( + self, + *, + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + sku_names: Optional[List[Union[str, "_models.SkuName"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + :keyword sku_names: Sku Names to filter for available skus. + :paramtype sku_names: list[str or ~azure.mgmt.databox.v2023_12_01.models.SkuName] + """ + super().__init__(**kwargs) + self.transfer_type = transfer_type + self.country = country + self.location = location + self.sku_names = sku_names + + +class AvailableSkusResult(_serialization.Model): + """The available skus operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of available skus. + :vartype value: list[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :ivar next_link: Link for the next set of skus. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SkuInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of skus. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class AzureFileFilterDetails(_serialization.Model): + """Filter details to transfer Azure files. + + :ivar file_prefix_list: Prefix list of the Azure files to be transferred. + :vartype file_prefix_list: list[str] + :ivar file_path_list: List of full path of the files to be transferred. + :vartype file_path_list: list[str] + :ivar file_share_list: List of file shares to be transferred. + :vartype file_share_list: list[str] + """ + + _attribute_map = { + "file_prefix_list": {"key": "filePrefixList", "type": "[str]"}, + "file_path_list": {"key": "filePathList", "type": "[str]"}, + "file_share_list": {"key": "fileShareList", "type": "[str]"}, + } + + def __init__( + self, + *, + file_prefix_list: Optional[List[str]] = None, + file_path_list: Optional[List[str]] = None, + file_share_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword file_prefix_list: Prefix list of the Azure files to be transferred. + :paramtype file_prefix_list: list[str] + :keyword file_path_list: List of full path of the files to be transferred. + :paramtype file_path_list: list[str] + :keyword file_share_list: List of file shares to be transferred. + :paramtype file_share_list: list[str] + """ + super().__init__(**kwargs) + self.file_prefix_list = file_prefix_list + self.file_path_list = file_path_list + self.file_share_list = file_share_list + + +class BlobFilterDetails(_serialization.Model): + """Filter details to transfer Azure Blobs. + + :ivar blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :vartype blob_prefix_list: list[str] + :ivar blob_path_list: List of full path of the blobs to be transferred. + :vartype blob_path_list: list[str] + :ivar container_list: List of blob containers to be transferred. + :vartype container_list: list[str] + """ + + _attribute_map = { + "blob_prefix_list": {"key": "blobPrefixList", "type": "[str]"}, + "blob_path_list": {"key": "blobPathList", "type": "[str]"}, + "container_list": {"key": "containerList", "type": "[str]"}, + } + + def __init__( + self, + *, + blob_prefix_list: Optional[List[str]] = None, + blob_path_list: Optional[List[str]] = None, + container_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :paramtype blob_prefix_list: list[str] + :keyword blob_path_list: List of full path of the blobs to be transferred. + :paramtype blob_path_list: list[str] + :keyword container_list: List of blob containers to be transferred. + :paramtype container_list: list[str] + """ + super().__init__(**kwargs) + self.blob_prefix_list = blob_prefix_list + self.blob_path_list = blob_path_list + self.container_list = container_list + + +class CancellationReason(_serialization.Model): + """Reason for cancellation. + + All required parameters must be populated in order to send to Azure. + + :ivar reason: Reason for cancellation. Required. + :vartype reason: str + """ + + _validation = { + "reason": {"required": True}, + } + + _attribute_map = { + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, *, reason: str, **kwargs: Any) -> None: + """ + :keyword reason: Reason for cancellation. Required. + :paramtype reason: str + """ + super().__init__(**kwargs) + self.reason = reason + + +class CloudError(_serialization.Model): + """Provides additional information about an http error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_info: Gets or sets additional error info. + :vartype additional_info: list[~azure.mgmt.databox.v2023_12_01.models.AdditionalErrorInfo] + :ivar code: Error code. + :vartype code: str + :ivar details: Gets or sets details for the error. + :vartype details: list[~azure.mgmt.databox.v2023_12_01.models.CloudError] + :ivar message: The error message parsed from the body of the http error response. + :vartype message: str + :ivar target: Gets or sets the target of the error. + :vartype target: str + """ + + _validation = { + "additional_info": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "additional_info": {"key": "additionalInfo", "type": "[AdditionalErrorInfo]"}, + "code": {"key": "code", "type": "str"}, + "details": {"key": "details", "type": "[CloudError]"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: The error message parsed from the body of the http error response. + :paramtype message: str + :keyword target: Gets or sets the target of the error. + :paramtype target: str + """ + super().__init__(**kwargs) + self.additional_info = None + self.code = code + self.details = None + self.message = message + self.target = target + + +class ContactDetails(_serialization.Model): + """Contact Details. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + :ivar email_list: List of Email-ids to be notified about job progress. Required. + :vartype email_list: list[str] + :ivar notification_preference: Notification preference for a job stage. + :vartype notification_preference: + list[~azure.mgmt.databox.v2023_12_01.models.NotificationPreference] + """ + + _validation = { + "contact_name": {"required": True}, + "phone": {"required": True}, + "email_list": {"required": True}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + "email_list": {"key": "emailList", "type": "[str]"}, + "notification_preference": {"key": "notificationPreference", "type": "[NotificationPreference]"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + email_list: List[str], + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + notification_preference: Optional[List["_models.NotificationPreference"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + :keyword email_list: List of Email-ids to be notified about job progress. Required. + :paramtype email_list: list[str] + :keyword notification_preference: Notification preference for a job stage. + :paramtype notification_preference: + list[~azure.mgmt.databox.v2023_12_01.models.NotificationPreference] + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + self.email_list = email_list + self.notification_preference = notification_preference + + +class ContactInfo(_serialization.Model): + """Contact Info. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + """ + + _validation = { + "contact_name": {"required": True, "min_length": 1}, + "phone": {"required": True, "min_length": 1}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + + +class CopyLogDetails(_serialization.Model): + """Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxAccountCopyLogDetails, DataBoxCustomerDiskCopyLogDetails, DataBoxDiskCopyLogDetails, + DataBoxHeavyAccountCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = { + "copy_log_details_type": { + "DataBox": "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskCopyLogDetails", + "DataBoxDisk": "DataBoxDiskCopyLogDetails", + "DataBoxHeavy": "DataBoxHeavyAccountCopyLogDetails", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class CopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class ValidationRequest(_serialization.Model): + """Minimum request requirement of any validation category. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateJobValidations + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_12_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + _subtype_map = {"validation_category": {"JobCreationValidation": "CreateJobValidations"}} + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_12_01.models.ValidationInputRequest] + """ + super().__init__(**kwargs) + self.validation_category: Optional[str] = None + self.individual_request_details = individual_request_details + + +class CreateJobValidations(ValidationRequest): + """It does all pre-job creation validations. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_12_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_12_01.models.ValidationInputRequest] + """ + super().__init__(individual_request_details=individual_request_details, **kwargs) + self.validation_category: str = "JobCreationValidation" + + +class ValidationInputRequest(_serialization.Model): + """Minimum fields that must be present in any type of validation request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateAddress, CreateOrderLimitForSubscriptionValidationRequest, + DataTransferDetailsValidationRequest, PreferencesValidationRequest, + SkuAvailabilityValidationRequest, SubscriptionIsAllowedToCreateJobValidationRequest + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "ValidateAddress", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationRequest", + "ValidateDataTransferDetails": "DataTransferDetailsValidationRequest", + "ValidatePreferences": "PreferencesValidationRequest", + "ValidateSkuAvailability": "SkuAvailabilityValidationRequest", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationRequest", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + + +class CreateOrderLimitForSubscriptionValidationRequest(ValidationInputRequest): + """Request to validate create order limit for current subscription. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__(self, *, device_type: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.device_type = device_type + + +class CreateOrderLimitForSubscriptionValidationResponseProperties(ValidationInputResponse): + """Properties of create order limit for subscription validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar status: Create order limit validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.status = None + + +class JobSecrets(_serialization.Model): + """The base class for the secrets. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataboxJobSecrets, CustomerDiskJobSecrets, DataBoxDiskJobSecrets, DataBoxHeavyJobSecrets + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_12_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "job_secrets_type": { + "DataBox": "DataboxJobSecrets", + "DataBoxCustomerDisk": "CustomerDiskJobSecrets", + "DataBoxDisk": "DataBoxDiskJobSecrets", + "DataBoxHeavy": "DataBoxHeavyJobSecrets", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: Optional[str] = None + self.dc_access_security_code = None + self.error = None + + +class CustomerDiskJobSecrets(JobSecrets): + """The secrets related to customer disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_12_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_12_01.models.DiskSecret] + :ivar carrier_account_number: Carrier Account Number of the customer. + :vartype carrier_account_number: str + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "carrier_account_number": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxCustomerDisk" + self.disk_secrets = None + self.carrier_account_number = None + + +class DataAccountDetails(_serialization.Model): + """Account details of the data to be transferred. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ManagedDiskDetails, StorageAccountDetails + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + } + + _subtype_map = { + "data_account_type": {"ManagedDisk": "ManagedDiskDetails", "StorageAccount": "StorageAccountDetails"} + } + + def __init__(self, *, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + """ + super().__init__(**kwargs) + self.data_account_type: Optional[str] = None + self.share_password = share_password + + +class DataBoxAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account of a DataBox job. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: str + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when + LogCollectionLevel is set to Verbose. + :vartype copy_verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "str"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBox" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxCustomerDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxCustomerDiskCopyProgress(CopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox CustomerDisk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_12_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class JobDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Job details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxJobDetails, DataBoxCustomerDiskJobDetails, DataBoxDiskJobDetails, DataBoxHeavyJobDetails + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_12_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_12_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_12_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_12_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_12_01.models.DataCenterCode + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + } + + _subtype_map = { + "job_details_type": { + "DataBox": "DataBoxJobDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskJobDetails", + "DataBoxDisk": "DataBoxDiskJobDetails", + "DataBoxHeavy": "DataBoxHeavyJobDetails", + } + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(**kwargs) + self.job_stages = None + self.contact_details = contact_details + self.shipping_address = shipping_address + self.delivery_package = None + self.return_package = None + self.data_import_details = data_import_details + self.data_export_details = data_export_details + self.job_details_type: Optional[str] = None + self.preferences = preferences + self.reverse_shipping_details = reverse_shipping_details + self.copy_log_details = None + self.reverse_shipment_label_sas_key = None + self.chain_of_custody_sas_key = None + self.device_erasure_details = None + self.key_encryption_key = key_encryption_key + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + self.actions = None + self.last_mitigation_action_on_job = None + self.datacenter_address = None + self.data_center_code = None + + +class DataBoxCustomerDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Customer disk job details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_12_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_12_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_12_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_12_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_12_01.models.DataCenterCode + :ivar import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :vartype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_12_01.models.ImportDiskDetails] + :ivar export_disk_details_collection: Contains the map of disk serial number to the disk + details for export jobs. + :vartype export_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_12_01.models.ExportDiskDetails] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: + list[~azure.mgmt.databox.v2023_12_01.models.DataBoxCustomerDiskCopyProgress] + :ivar deliver_to_dc_package_details: Delivery package shipping details. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierInfo + :ivar return_to_customer_package_details: Return package shipping details. Required. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierDetails + :ivar enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :vartype enable_manifest_backup: bool + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "export_disk_details_collection": {"readonly": True}, + "copy_progress": {"readonly": True}, + "deliver_to_dc_package_details": {"readonly": True}, + "return_to_customer_package_details": {"required": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "import_disk_details_collection": {"key": "importDiskDetailsCollection", "type": "{ImportDiskDetails}"}, + "export_disk_details_collection": {"key": "exportDiskDetailsCollection", "type": "{ExportDiskDetails}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxCustomerDiskCopyProgress]"}, + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + "enable_manifest_backup": {"key": "enableManifestBackup", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + return_to_customer_package_details: "_models.PackageCarrierDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + import_disk_details_collection: Optional[Dict[str, "_models.ImportDiskDetails"]] = None, + enable_manifest_backup: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :paramtype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_12_01.models.ImportDiskDetails] + :keyword return_to_customer_package_details: Return package shipping details. Required. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierDetails + :keyword enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :paramtype enable_manifest_backup: bool + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxCustomerDisk" + self.import_disk_details_collection = import_disk_details_collection + self.export_disk_details_collection = None + self.copy_progress = None + self.deliver_to_dc_package_details = None + self.return_to_customer_package_details = return_to_customer_package_details + self.enable_manifest_backup = enable_manifest_backup + + +class DataBoxDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for a disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar disk_serial_number: Disk Serial Number. + :vartype disk_serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "disk_serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxDisk" + self.disk_serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxDiskCopyProgress(_serialization.Model): + """DataBox Disk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar serial_number: The serial number of the disk. + :vartype serial_number: str + :ivar bytes_copied: Bytes copied during the copy of disk. + :vartype bytes_copied: int + :ivar percent_complete: Indicates the percentage completed for the copy of the disk. + :vartype percent_complete: int + :ivar status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.CopyStatus + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + """ + + _validation = { + "serial_number": {"readonly": True}, + "bytes_copied": {"readonly": True}, + "percent_complete": {"readonly": True}, + "status": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "bytes_copied": {"key": "bytesCopied", "type": "int"}, + "percent_complete": {"key": "percentComplete", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.bytes_copied = None + self.percent_complete = None + self.status = None + self.error = None + self.actions = None + + +class GranularCopyLogDetails(_serialization.Model): + """Granular Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxDiskGranularCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = {"copy_log_details_type": {"DataBoxCustomerDisk": "DataBoxDiskGranularCopyLogDetails"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class DataBoxDiskGranularCopyLogDetails(GranularCopyLogDetails): + """Granular Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar account_id: Account id. + :vartype account_id: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "account_id": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.account_id = None + self.error_log_link = None + self.verbose_log_link = None + + +class GranularCopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Granular Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class DataBoxDiskGranularCopyProgress(GranularCopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox Disk Granular Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_12_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class DataBoxDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """DataBox Disk Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_12_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_12_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_12_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_12_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_12_01.models.DataCenterCode + :ivar preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :vartype preferred_disks: dict[str, int] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_12_01.models.DataBoxDiskCopyProgress] + :ivar granular_copy_progress: Copy progress per disk. + :vartype granular_copy_progress: + list[~azure.mgmt.databox.v2023_12_01.models.DataBoxDiskGranularCopyProgress] + :ivar granular_copy_log_details: Copy progress per disk. + :vartype granular_copy_log_details: + list[~azure.mgmt.databox.v2023_12_01.models.DataBoxDiskGranularCopyLogDetails] + :ivar disks_and_size_details: Contains the map of disk serial number to the disk size being + used for the job. Is returned only after the disks are shipped to the customer. + :vartype disks_and_size_details: dict[str, int] + :ivar passkey: User entered passkey for DataBox Disk job. + :vartype passkey: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + "granular_copy_progress": {"readonly": True}, + "granular_copy_log_details": {"readonly": True}, + "disks_and_size_details": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "preferred_disks": {"key": "preferredDisks", "type": "{int}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxDiskCopyProgress]"}, + "granular_copy_progress": {"key": "granularCopyProgress", "type": "[DataBoxDiskGranularCopyProgress]"}, + "granular_copy_log_details": {"key": "granularCopyLogDetails", "type": "[DataBoxDiskGranularCopyLogDetails]"}, + "disks_and_size_details": {"key": "disksAndSizeDetails", "type": "{int}"}, + "passkey": {"key": "passkey", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + preferred_disks: Optional[Dict[str, int]] = None, + passkey: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :paramtype preferred_disks: dict[str, int] + :keyword passkey: User entered passkey for DataBox Disk job. + :paramtype passkey: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxDisk" + self.preferred_disks = preferred_disks + self.copy_progress = None + self.granular_copy_progress = None + self.granular_copy_log_details = None + self.disks_and_size_details = None + self.passkey = passkey + + +class DataBoxDiskJobSecrets(JobSecrets): + """The secrets related to disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_12_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_12_01.models.DiskSecret] + :ivar pass_key: PassKey for the disk Job. + :vartype pass_key: str + :ivar is_passkey_user_defined: Whether passkey was provided by user. + :vartype is_passkey_user_defined: bool + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "pass_key": {"readonly": True}, + "is_passkey_user_defined": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "pass_key": {"key": "passKey", "type": "str"}, + "is_passkey_user_defined": {"key": "isPasskeyUserDefined", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxDisk" + self.disk_secrets = None + self.pass_key = None + self.is_passkey_user_defined = None + + +class DataBoxHeavyAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account for Databox heavy. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: list[str] + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when the + LogCollectionLevel is set to verbose. + :vartype copy_verbose_log_link: list[str] + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "[str]"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxHeavy" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxHeavyJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Heavy Device Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_12_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_12_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_12_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_12_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_12_01.models.DataCenterCode + :ivar copy_progress: Copy progress per account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_12_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxHeavy" + self.copy_progress = None + self.device_password = device_password + + +class DataBoxHeavyJobSecrets(JobSecrets): + """The secrets related to a databox heavy job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_12_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar cabinet_pod_secrets: Contains the list of secret objects for a databox heavy job. + :vartype cabinet_pod_secrets: list[~azure.mgmt.databox.v2023_12_01.models.DataBoxHeavySecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "cabinet_pod_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "cabinet_pod_secrets": {"key": "cabinetPodSecrets", "type": "[DataBoxHeavySecret]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxHeavy" + self.cabinet_pod_secrets = None + + +class DataBoxHeavySecret(_serialization.Model): + """The secrets related to a databox heavy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_12_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_12_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DataBoxJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_12_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_12_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_12_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_12_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_12_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_12_01.models.DataCenterCode + :ivar copy_progress: Copy progress per storage account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_12_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBox" + self.copy_progress = None + self.device_password = device_password + + +class DataboxJobSecrets(JobSecrets): + """The secrets related to a databox job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_12_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_12_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar pod_secrets: Contains the list of secret objects for a job. + :vartype pod_secrets: list[~azure.mgmt.databox.v2023_12_01.models.DataBoxSecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "pod_secrets": {"key": "podSecrets", "type": "[DataBoxSecret]"}, + } + + def __init__(self, *, pod_secrets: Optional[List["_models.DataBoxSecret"]] = None, **kwargs: Any) -> None: + """ + :keyword pod_secrets: Contains the list of secret objects for a job. + :paramtype pod_secrets: list[~azure.mgmt.databox.v2023_12_01.models.DataBoxSecret] + """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBox" + self.pod_secrets = pod_secrets + + +class ScheduleAvailabilityRequest(_serialization.Model): + """Request body to get the availability for scheduling orders. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxScheduleAvailabilityRequest, DiskScheduleAvailabilityRequest, + HeavyScheduleAvailabilityRequest + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + _subtype_map = { + "sku_name": { + "DataBox": "DataBoxScheduleAvailabilityRequest", + "DataBoxDisk": "DiskScheduleAvailabilityRequest", + "DataBoxHeavy": "HeavyScheduleAvailabilityRequest", + } + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name: Optional[str] = None + self.country = country + + +class DataBoxScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling data box orders orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBox" + + +class DataBoxSecret(_serialization.Model): + """The secrets related to a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_12_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_12_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DatacenterAddressResponse(_serialization.Model): + """Datacenter address for given storage location. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DatacenterAddressInstructionResponse, DatacenterAddressLocationResponse + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + } + + _subtype_map = { + "datacenter_address_type": { + "DatacenterAddressInstruction": "DatacenterAddressInstructionResponse", + "DatacenterAddressLocation": "DatacenterAddressLocationResponse", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: Optional[str] = None + self.supported_carriers_for_return_shipment = None + self.data_center_azure_location = None + + +class DatacenterAddressInstructionResponse(DatacenterAddressResponse): + """Datacenter instruction for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar communication_instruction: Data center communication instruction. + :vartype communication_instruction: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "communication_instruction": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "communication_instruction": {"key": "communicationInstruction", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressInstruction" + self.communication_instruction = None + + +class DatacenterAddressLocationResponse(DatacenterAddressResponse): # pylint: disable=too-many-instance-attributes + """Datacenter address for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar contact_person_name: Contact person name. + :vartype contact_person_name: str + :ivar company: Company name. + :vartype company: str + :ivar street1: Street address line 1. + :vartype street1: str + :ivar street2: Street address line 2. + :vartype street2: str + :ivar street3: Street address line 3. + :vartype street3: str + :ivar city: City name. + :vartype city: str + :ivar state: name of the state. + :vartype state: str + :ivar zip: Zip code. + :vartype zip: str + :ivar country: name of the country. + :vartype country: str + :ivar phone: Phone number. + :vartype phone: str + :ivar phone_extension: Phone extension. + :vartype phone_extension: str + :ivar address_type: Address type. + :vartype address_type: str + :ivar additional_shipping_information: Special instruction for shipping. + :vartype additional_shipping_information: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "contact_person_name": {"readonly": True}, + "company": {"readonly": True}, + "street1": {"readonly": True}, + "street2": {"readonly": True}, + "street3": {"readonly": True}, + "city": {"readonly": True}, + "state": {"readonly": True}, + "zip": {"readonly": True}, + "country": {"readonly": True}, + "phone": {"readonly": True}, + "phone_extension": {"readonly": True}, + "address_type": {"readonly": True}, + "additional_shipping_information": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "contact_person_name": {"key": "contactPersonName", "type": "str"}, + "company": {"key": "company", "type": "str"}, + "street1": {"key": "street1", "type": "str"}, + "street2": {"key": "street2", "type": "str"}, + "street3": {"key": "street3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "zip": {"key": "zip", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "additional_shipping_information": {"key": "additionalShippingInformation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressLocation" + self.contact_person_name = None + self.company = None + self.street1 = None + self.street2 = None + self.street3 = None + self.city = None + self.state = None + self.zip = None + self.country = None + self.phone = None + self.phone_extension = None + self.address_type = None + self.additional_shipping_information = None + + +class DatacenterAddressRequest(_serialization.Model): + """Request body to get the datacenter address. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, storage_location: str, sku_name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name = sku_name + + +class DataExportDetails(_serialization.Model): + """Details of the data to be used for exporting data from azure. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration: Configuration for the data transfer. Required. + :vartype transfer_configuration: ~azure.mgmt.databox.v2023_12_01.models.TransferConfiguration + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_12_01.models.LogCollectionLevel + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_12_01.models.DataAccountDetails + """ + + _validation = { + "transfer_configuration": {"required": True}, + "account_details": {"required": True}, + } + + _attribute_map = { + "transfer_configuration": {"key": "transferConfiguration", "type": "TransferConfiguration"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + } + + def __init__( + self, + *, + transfer_configuration: "_models.TransferConfiguration", + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration: Configuration for the data transfer. Required. + :paramtype transfer_configuration: ~azure.mgmt.databox.v2023_12_01.models.TransferConfiguration + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_12_01.models.LogCollectionLevel + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_12_01.models.DataAccountDetails + """ + super().__init__(**kwargs) + self.transfer_configuration = transfer_configuration + self.log_collection_level = log_collection_level + self.account_details = account_details + + +class DataImportDetails(_serialization.Model): + """Details of the data to be used for importing data to azure. + + All required parameters must be populated in order to send to Azure. + + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_12_01.models.DataAccountDetails + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_12_01.models.LogCollectionLevel + """ + + _validation = { + "account_details": {"required": True}, + } + + _attribute_map = { + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + } + + def __init__( + self, + *, + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_12_01.models.DataAccountDetails + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_12_01.models.LogCollectionLevel + """ + super().__init__(**kwargs) + self.account_details = account_details + self.log_collection_level = log_collection_level + + +class DataLocationToServiceLocationMap(_serialization.Model): + """Map of data location to service location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_location: Location of the data. + :vartype data_location: str + :ivar service_location: Location of the service. + :vartype service_location: str + """ + + _validation = { + "data_location": {"readonly": True}, + "service_location": {"readonly": True}, + } + + _attribute_map = { + "data_location": {"key": "dataLocation", "type": "str"}, + "service_location": {"key": "serviceLocation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.data_location = None + self.service_location = None + + +class DataTransferDetailsValidationRequest(ValidationInputRequest): + """Request to validate export and import data details. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar data_export_details: List of DataTransfer details to be used to export data from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :ivar data_import_details: List of DataTransfer details to be used to import data to azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :ivar device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_export_details: List of DataTransfer details to be used to export data from + azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_12_01.models.DataExportDetails] + :keyword data_import_details: List of DataTransfer details to be used to import data to azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_12_01.models.DataImportDetails] + :keyword device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.data_export_details = data_export_details + self.data_import_details = data_import_details + self.device_type = device_type + self.transfer_type = transfer_type + + +class DataTransferDetailsValidationResponseProperties(ValidationInputResponse): + """Properties of data transfer details validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar status: Data transfer details validation status. Known values are: "Valid", "Invalid", + and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.status = None + + +class DcAccessSecurityCode(_serialization.Model): + """Dc access security code. + + :ivar reverse_dc_access_code: Reverse Dc access security code. + :vartype reverse_dc_access_code: str + :ivar forward_dc_access_code: Forward Dc access security code. + :vartype forward_dc_access_code: str + """ + + _attribute_map = { + "reverse_dc_access_code": {"key": "reverseDCAccessCode", "type": "str"}, + "forward_dc_access_code": {"key": "forwardDCAccessCode", "type": "str"}, + } + + def __init__( + self, + *, + reverse_dc_access_code: Optional[str] = None, + forward_dc_access_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword reverse_dc_access_code: Reverse Dc access security code. + :paramtype reverse_dc_access_code: str + :keyword forward_dc_access_code: Forward Dc access security code. + :paramtype forward_dc_access_code: str + """ + super().__init__(**kwargs) + self.reverse_dc_access_code = reverse_dc_access_code + self.forward_dc_access_code = forward_dc_access_code + + +class Details(_serialization.Model): + """Details. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class DeviceCapabilityDetails(_serialization.Model): + """Device capability details for a given sku for a given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hardware_encryption: Hardware encryption support for a given sku for a given region. + Known values are: "Enabled" and "Disabled". + :vartype hardware_encryption: str or ~azure.mgmt.databox.v2023_12_01.models.HardwareEncryption + """ + + _validation = { + "hardware_encryption": {"readonly": True}, + } + + _attribute_map = { + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.hardware_encryption = None + + +class DeviceCapabilityRequest(_serialization.Model): + """Request body to get the device capabilities for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class DeviceCapabilityResponse(_serialization.Model): + """Device capabilities for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_capability_details: List of device capabilities available for a given region and a + given sku. + :vartype device_capability_details: + list[~azure.mgmt.databox.v2023_12_01.models.DeviceCapabilityDetails] + """ + + _validation = { + "device_capability_details": {"readonly": True}, + } + + _attribute_map = { + "device_capability_details": {"key": "deviceCapabilityDetails", "type": "[DeviceCapabilityDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_capability_details = None + + +class DeviceErasureDetails(_serialization.Model): + """Device erasure details with erasure completion status and erasureordestructionlog sas key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_erasure_status: Holds the device erasure completion status. Known values are: + "None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype device_erasure_status: str or ~azure.mgmt.databox.v2023_12_01.models.StageStatus + :ivar erasure_or_destruction_certificate_sas_key: Shared access key to download cleanup or + destruction certificate for device. + :vartype erasure_or_destruction_certificate_sas_key: str + """ + + _validation = { + "device_erasure_status": {"readonly": True}, + "erasure_or_destruction_certificate_sas_key": {"readonly": True}, + } + + _attribute_map = { + "device_erasure_status": {"key": "deviceErasureStatus", "type": "str"}, + "erasure_or_destruction_certificate_sas_key": {"key": "erasureOrDestructionCertificateSasKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_erasure_status = None + self.erasure_or_destruction_certificate_sas_key = None + + +class DiskScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling disk orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :vartype expected_data_size_in_tera_bytes: int + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + "expected_data_size_in_tera_bytes": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + } + + def __init__( + self, + *, + storage_location: str, + expected_data_size_in_tera_bytes: int, + country: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxDisk" + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + + +class DiskSecret(_serialization.Model): + """Contains all the secrets of a Disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_serial_number: Serial number of the assigned disk. + :vartype disk_serial_number: str + :ivar bit_locker_key: Bit Locker key of the disk which can be used to unlock the disk to copy + data. + :vartype bit_locker_key: str + """ + + _validation = { + "disk_serial_number": {"readonly": True}, + "bit_locker_key": {"readonly": True}, + } + + _attribute_map = { + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.disk_serial_number = None + self.bit_locker_key = None + + +class EncryptionPreferences(_serialization.Model): + """Preferences related to the Encryption. + + :ivar double_encryption: Defines secondary layer of software-based encryption enablement. Known + values are: "Enabled" and "Disabled". + :vartype double_encryption: str or ~azure.mgmt.databox.v2023_12_01.models.DoubleEncryption + :ivar hardware_encryption: Defines Hardware level encryption (Only for disk). Known values are: + "Enabled" and "Disabled". + :vartype hardware_encryption: str or ~azure.mgmt.databox.v2023_12_01.models.HardwareEncryption + """ + + _attribute_map = { + "double_encryption": {"key": "doubleEncryption", "type": "str"}, + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__( + self, + *, + double_encryption: Union[str, "_models.DoubleEncryption"] = "Disabled", + hardware_encryption: Optional[Union[str, "_models.HardwareEncryption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword double_encryption: Defines secondary layer of software-based encryption enablement. + Known values are: "Enabled" and "Disabled". + :paramtype double_encryption: str or ~azure.mgmt.databox.v2023_12_01.models.DoubleEncryption + :keyword hardware_encryption: Defines Hardware level encryption (Only for disk). Known values + are: "Enabled" and "Disabled". + :paramtype hardware_encryption: str or + ~azure.mgmt.databox.v2023_12_01.models.HardwareEncryption + """ + super().__init__(**kwargs) + self.double_encryption = double_encryption + self.hardware_encryption = hardware_encryption + + +class ErrorDetail(_serialization.Model): + """ErrorDetail. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar details: + :vartype details: list[~azure.mgmt.databox.v2023_12_01.models.Details] + :ivar target: + :vartype target: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[Details]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + code: str, + message: str, + details: Optional[List["_models.Details"]] = None, + target: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + :keyword details: + :paramtype details: list[~azure.mgmt.databox.v2023_12_01.models.Details] + :keyword target: + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + + +class ExportDiskDetails(_serialization.Model): + """Export disk details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar manifest_file: The relative path of the manifest file on the disk. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. + :vartype manifest_hash: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"readonly": True}, + "manifest_hash": {"readonly": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.manifest_file = None + self.manifest_hash = None + self.backup_manifest_cloud_path = None + + +class FilterFileDetails(_serialization.Model): + """Details of the filter files to be used for data transfer. + + All required parameters must be populated in order to send to Azure. + + :ivar filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :vartype filter_file_type: str or ~azure.mgmt.databox.v2023_12_01.models.FilterFileType + :ivar filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :vartype filter_file_path: str + """ + + _validation = { + "filter_file_type": {"required": True}, + "filter_file_path": {"required": True}, + } + + _attribute_map = { + "filter_file_type": {"key": "filterFileType", "type": "str"}, + "filter_file_path": {"key": "filterFilePath", "type": "str"}, + } + + def __init__( + self, *, filter_file_type: Union[str, "_models.FilterFileType"], filter_file_path: str, **kwargs: Any + ) -> None: + """ + :keyword filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :paramtype filter_file_type: str or ~azure.mgmt.databox.v2023_12_01.models.FilterFileType + :keyword filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :paramtype filter_file_path: str + """ + super().__init__(**kwargs) + self.filter_file_type = filter_file_type + self.filter_file_path = filter_file_path + + +class HeavyScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling heavy orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxHeavy" + + +class IdentityProperties(_serialization.Model): + """Managed identity properties. + + :ivar type: Managed service identity type. + :vartype type: str + :ivar user_assigned: User assigned identity properties. + :vartype user_assigned: ~azure.mgmt.databox.v2023_12_01.models.UserAssignedProperties + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "user_assigned": {"key": "userAssigned", "type": "UserAssignedProperties"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned: Optional["_models.UserAssignedProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Managed service identity type. + :paramtype type: str + :keyword user_assigned: User assigned identity properties. + :paramtype user_assigned: ~azure.mgmt.databox.v2023_12_01.models.UserAssignedProperties + """ + super().__init__(**kwargs) + self.type = type + self.user_assigned = user_assigned + + +class ImportDiskDetails(_serialization.Model): + """Import disk details. + + 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 manifest_file: The relative path of the manifest file on the disk. Required. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :vartype manifest_hash: str + :ivar bit_locker_key: BitLocker key used to encrypt the disk. Required. + :vartype bit_locker_key: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"required": True}, + "manifest_hash": {"required": True}, + "bit_locker_key": {"required": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, *, manifest_file: str, manifest_hash: str, bit_locker_key: str, **kwargs: Any) -> None: + """ + :keyword manifest_file: The relative path of the manifest file on the disk. Required. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :paramtype manifest_hash: str + :keyword bit_locker_key: BitLocker key used to encrypt the disk. Required. + :paramtype bit_locker_key: str + """ + super().__init__(**kwargs) + self.manifest_file = manifest_file + self.manifest_hash = manifest_hash + self.bit_locker_key = bit_locker_key + self.backup_manifest_cloud_path = None + + +class JobDelayDetails(_serialization.Model): + """Job Delay Notification details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Status of notification. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.DelayNotificationStatus + :ivar error_code: Delay Error code. Known values are: "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", "ActiveOrderLimitBreachedDelay", and + "ActiveOrderLimitBreachedDelay". + :vartype error_code: str or ~azure.mgmt.databox.v2023_12_01.models.PortalDelayErrorCode + :ivar description: Description of the delay. + :vartype description: str + :ivar start_time: Timestamp when the delay notification was created. + :vartype start_time: ~datetime.datetime + :ivar resolution_time: Timestamp when the delay notification was resolved. + :vartype resolution_time: ~datetime.datetime + """ + + _validation = { + "status": {"readonly": True}, + "error_code": {"readonly": True}, + "description": {"readonly": True}, + "start_time": {"readonly": True}, + "resolution_time": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "resolution_time": {"key": "resolutionTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.error_code = None + self.description = None + self.start_time = None + self.resolution_time = None + + +class JobDeliveryInfo(_serialization.Model): + """Additional delivery info. + + :ivar scheduled_date_time: Scheduled date time. + :vartype scheduled_date_time: ~datetime.datetime + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + } + + def __init__(self, *, scheduled_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_date_time: Scheduled date time. + :paramtype scheduled_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + + +class Resource(_serialization.Model): + """Model of the Resource. + + All required parameters must be populated in order to send to Azure. + + :ivar location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_12_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + } + + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_12_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.sku = sku + self.identity = identity + + +class JobResource(Resource): # pylint: disable=too-many-instance-attributes + """Job 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 location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_12_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.databox.v2023_12_01.models.SystemData + :ivar transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar is_cancellable: Describes whether the job is cancellable or not. + :vartype is_cancellable: bool + :ivar is_deletable: Describes whether the job is deletable or not. + :vartype is_deletable: bool + :ivar is_shipping_address_editable: Describes whether the shipping address is editable or not. + :vartype is_shipping_address_editable: bool + :ivar reverse_shipping_details_update: The Editable status for Reverse Shipping Address and + Contact Info. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_shipping_details_update: str or + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetailsEditStatus + :ivar reverse_transport_preference_update: The Editable status for Reverse Transport + preferences. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_transport_preference_update: str or + ~azure.mgmt.databox.v2023_12_01.models.ReverseTransportPreferenceEditStatus + :ivar is_prepare_to_ship_enabled: Is Prepare To Ship Enabled on this job. + :vartype is_prepare_to_ship_enabled: bool + :ivar status: Name of the stage which is in progress. Known values are: "DeviceOrdered", + "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.StageName + :ivar delayed_stage: Name of the stage where delay might be present. Known values are: + "DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", + "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype delayed_stage: str or ~azure.mgmt.databox.v2023_12_01.models.StageName + :ivar start_time: Time at which the job was started in UTC ISO 8601 format. + :vartype start_time: ~datetime.datetime + :ivar error: Top level error for the job. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar details: Details of a job run. This field will only be sent for expand details filter. + :vartype details: ~azure.mgmt.databox.v2023_12_01.models.JobDetails + :ivar cancellation_reason: Reason for cancellation. + :vartype cancellation_reason: str + :ivar delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :vartype delivery_type: str or ~azure.mgmt.databox.v2023_12_01.models.JobDeliveryType + :ivar delivery_info: Delivery Info of Job. + :vartype delivery_info: ~azure.mgmt.databox.v2023_12_01.models.JobDeliveryInfo + :ivar is_cancellable_without_fee: Flag to indicate cancellation of scheduled job. + :vartype is_cancellable_without_fee: bool + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "transfer_type": {"required": True}, + "is_cancellable": {"readonly": True}, + "is_deletable": {"readonly": True}, + "is_shipping_address_editable": {"readonly": True}, + "reverse_shipping_details_update": {"readonly": True}, + "reverse_transport_preference_update": {"readonly": True}, + "is_prepare_to_ship_enabled": {"readonly": True}, + "status": {"readonly": True}, + "delayed_stage": {"readonly": True}, + "start_time": {"readonly": True}, + "error": {"readonly": True}, + "cancellation_reason": {"readonly": True}, + "is_cancellable_without_fee": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "transfer_type": {"key": "properties.transferType", "type": "str"}, + "is_cancellable": {"key": "properties.isCancellable", "type": "bool"}, + "is_deletable": {"key": "properties.isDeletable", "type": "bool"}, + "is_shipping_address_editable": {"key": "properties.isShippingAddressEditable", "type": "bool"}, + "reverse_shipping_details_update": {"key": "properties.reverseShippingDetailsUpdate", "type": "str"}, + "reverse_transport_preference_update": {"key": "properties.reverseTransportPreferenceUpdate", "type": "str"}, + "is_prepare_to_ship_enabled": {"key": "properties.isPrepareToShipEnabled", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "delayed_stage": {"key": "properties.delayedStage", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "details": {"key": "properties.details", "type": "JobDetails"}, + "cancellation_reason": {"key": "properties.cancellationReason", "type": "str"}, + "delivery_type": {"key": "properties.deliveryType", "type": "str"}, + "delivery_info": {"key": "properties.deliveryInfo", "type": "JobDeliveryInfo"}, + "is_cancellable_without_fee": {"key": "properties.isCancellableWithoutFee", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + sku: "_models.Sku", + transfer_type: Union[str, "_models.TransferType"], + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.JobDetails"] = None, + delivery_type: Union[str, "_models.JobDeliveryType"] = "NonScheduled", + delivery_info: Optional["_models.JobDeliveryInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_12_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + :keyword transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" + and "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :keyword details: Details of a job run. This field will only be sent for expand details filter. + :paramtype details: ~azure.mgmt.databox.v2023_12_01.models.JobDetails + :keyword delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :paramtype delivery_type: str or ~azure.mgmt.databox.v2023_12_01.models.JobDeliveryType + :keyword delivery_info: Delivery Info of Job. + :paramtype delivery_info: ~azure.mgmt.databox.v2023_12_01.models.JobDeliveryInfo + """ + super().__init__(location=location, tags=tags, sku=sku, identity=identity, **kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.transfer_type = transfer_type + self.is_cancellable = None + self.is_deletable = None + self.is_shipping_address_editable = None + self.reverse_shipping_details_update = None + self.reverse_transport_preference_update = None + self.is_prepare_to_ship_enabled = None + self.status = None + self.delayed_stage = None + self.start_time = None + self.error = None + self.details = details + self.cancellation_reason = None + self.delivery_type = delivery_type + self.delivery_info = delivery_info + self.is_cancellable_without_fee = None + + +class JobResourceList(_serialization.Model): + """Job Resource Collection. + + :ivar value: List of job resources. + :vartype value: list[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :ivar next_link: Link for the next set of job resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[JobResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.JobResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of job resources. + :paramtype value: list[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :keyword next_link: Link for the next set of job resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class JobResourceUpdateParameter(_serialization.Model): + """The JobResourceUpdateParameter. + + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + :ivar details: Details of a job to be updated. + :vartype details: ~azure.mgmt.databox.v2023_12_01.models.UpdateJobDetails + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "details": {"key": "properties.details", "type": "UpdateJobDetails"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.UpdateJobDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_12_01.models.ResourceIdentity + :keyword details: Details of a job to be updated. + :paramtype details: ~azure.mgmt.databox.v2023_12_01.models.UpdateJobDetails + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.details = details + + +class JobStages(_serialization.Model): + """Job stages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stage_name: Name of the job stage. Known values are: "DeviceOrdered", "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_12_01.models.StageName + :ivar display_name: Display name of the job stage. + :vartype display_name: str + :ivar stage_status: Status of the job stage. Known values are: "None", "InProgress", + "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype stage_status: str or ~azure.mgmt.databox.v2023_12_01.models.StageStatus + :ivar stage_time: Time for the job stage in UTC ISO 8601 format. + :vartype stage_time: ~datetime.datetime + :ivar job_stage_details: Job Stage Details. + :vartype job_stage_details: JSON + :ivar delay_information: Delay information for the job stages. + :vartype delay_information: list[~azure.mgmt.databox.v2023_12_01.models.JobDelayDetails] + """ + + _validation = { + "stage_name": {"readonly": True}, + "display_name": {"readonly": True}, + "stage_status": {"readonly": True}, + "stage_time": {"readonly": True}, + "job_stage_details": {"readonly": True}, + "delay_information": {"readonly": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "stage_status": {"key": "stageStatus", "type": "str"}, + "stage_time": {"key": "stageTime", "type": "iso-8601"}, + "job_stage_details": {"key": "jobStageDetails", "type": "object"}, + "delay_information": {"key": "delayInformation", "type": "[JobDelayDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.stage_name = None + self.display_name = None + self.stage_status = None + self.stage_time = None + self.job_stage_details = None + self.delay_information = None + + +class KeyEncryptionKey(_serialization.Model): + """Encryption key containing details about key to encrypt different keys. + + All required parameters must be populated in order to send to Azure. + + :ivar kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :vartype kek_type: str or ~azure.mgmt.databox.v2023_12_01.models.KekType + :ivar identity_properties: Managed identity properties used for key encryption. + :vartype identity_properties: ~azure.mgmt.databox.v2023_12_01.models.IdentityProperties + :ivar kek_url: Key encryption key. It is required in case of Customer managed KekType. + :vartype kek_url: str + :ivar kek_vault_resource_id: Kek vault resource id. It is required in case of Customer managed + KekType. + :vartype kek_vault_resource_id: str + """ + + _validation = { + "kek_type": {"required": True}, + } + + _attribute_map = { + "kek_type": {"key": "kekType", "type": "str"}, + "identity_properties": {"key": "identityProperties", "type": "IdentityProperties"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "kek_vault_resource_id": {"key": "kekVaultResourceID", "type": "str"}, + } + + def __init__( + self, + *, + kek_type: Union[str, "_models.KekType"] = "MicrosoftManaged", + identity_properties: Optional["_models.IdentityProperties"] = None, + kek_url: Optional[str] = None, + kek_vault_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :paramtype kek_type: str or ~azure.mgmt.databox.v2023_12_01.models.KekType + :keyword identity_properties: Managed identity properties used for key encryption. + :paramtype identity_properties: ~azure.mgmt.databox.v2023_12_01.models.IdentityProperties + :keyword kek_url: Key encryption key. It is required in case of Customer managed KekType. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Kek vault resource id. It is required in case of Customer + managed KekType. + :paramtype kek_vault_resource_id: str + """ + super().__init__(**kwargs) + self.kek_type = kek_type + self.identity_properties = identity_properties + self.kek_url = kek_url + self.kek_vault_resource_id = kek_vault_resource_id + + +class LastMitigationActionOnJob(_serialization.Model): + """Last Mitigation Action Performed On Job. + + :ivar action_date_time_in_utc: Action performed date time. + :vartype action_date_time_in_utc: ~datetime.datetime + :ivar is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :vartype is_performed_by_customer: bool + :ivar customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution: str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode + """ + + _attribute_map = { + "action_date_time_in_utc": {"key": "actionDateTimeInUtc", "type": "iso-8601"}, + "is_performed_by_customer": {"key": "isPerformedByCustomer", "type": "bool"}, + "customer_resolution": {"key": "customerResolution", "type": "str"}, + } + + def __init__( + self, + *, + action_date_time_in_utc: Optional[datetime.datetime] = None, + is_performed_by_customer: Optional[bool] = None, + customer_resolution: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword action_date_time_in_utc: Action performed date time. + :paramtype action_date_time_in_utc: ~datetime.datetime + :keyword is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :paramtype is_performed_by_customer: bool + :keyword customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution: str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode + """ + super().__init__(**kwargs) + self.action_date_time_in_utc = action_date_time_in_utc + self.is_performed_by_customer = is_performed_by_customer + self.customer_resolution = customer_resolution + + +class ManagedDiskDetails(DataAccountDetails): + """Details of the managed disks. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar resource_group_id: Resource Group Id of the compute disks. Required. + :vartype resource_group_id: str + :ivar staging_storage_account_id: Resource Id of the storage account that can be used to copy + the vhd for staging. Required. + :vartype staging_storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "resource_group_id": {"required": True}, + "staging_storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "resource_group_id": {"key": "resourceGroupId", "type": "str"}, + "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, + } + + def __init__( + self, + *, + resource_group_id: str, + staging_storage_account_id: str, + share_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword resource_group_id: Resource Group Id of the compute disks. Required. + :paramtype resource_group_id: str + :keyword staging_storage_account_id: Resource Id of the storage account that can be used to + copy the vhd for staging. Required. + :paramtype staging_storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "ManagedDisk" + self.resource_group_id = resource_group_id + self.staging_storage_account_id = staging_storage_account_id + + +class MarkDevicesShippedRequest(_serialization.Model): + """The request body to provide the delivery package details of job. + + All required parameters must be populated in order to send to Azure. + + :ivar deliver_to_dc_package_details: Delivery package details. Required. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierInfo + """ + + _validation = { + "deliver_to_dc_package_details": {"required": True}, + } + + _attribute_map = { + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + } + + def __init__(self, *, deliver_to_dc_package_details: "_models.PackageCarrierInfo", **kwargs: Any) -> None: + """ + :keyword deliver_to_dc_package_details: Delivery package details. Required. + :paramtype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierInfo + """ + super().__init__(**kwargs) + self.deliver_to_dc_package_details = deliver_to_dc_package_details + + +class MitigateJobRequest(_serialization.Model): + """The Mitigate Job captured from request body for Mitigate API. + + :ivar customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode + :ivar serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :vartype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + """ + + _attribute_map = { + "customer_resolution_code": {"key": "customerResolutionCode", "type": "str"}, + "serial_number_customer_resolution_map": {"key": "serialNumberCustomerResolutionMap", "type": "{str}"}, + } + + def __init__( + self, + *, + customer_resolution_code: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + serial_number_customer_resolution_map: Optional[Dict[str, Union[str, "_models.CustomerResolutionCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode + :keyword serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :paramtype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_12_01.models.CustomerResolutionCode] + """ + super().__init__(**kwargs) + self.customer_resolution_code = customer_resolution_code + self.serial_number_customer_resolution_map = serial_number_customer_resolution_map + + +class NotificationPreference(_serialization.Model): + """Notification preference for a job stage. + + All required parameters must be populated in order to send to Azure. + + :ivar stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_12_01.models.NotificationStageName + :ivar send_notification: Notification is required or not. + :vartype send_notification: bool + """ + + _validation = { + "stage_name": {"required": True}, + "send_notification": {"required": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "send_notification": {"key": "sendNotification", "type": "bool"}, + } + + def __init__( + self, *, stage_name: Union[str, "_models.NotificationStageName"], send_notification: bool = True, **kwargs: Any + ) -> None: + """ + :keyword stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :paramtype stage_name: str or ~azure.mgmt.databox.v2023_12_01.models.NotificationStageName + :keyword send_notification: Notification is required or not. + :paramtype send_notification: bool + """ + super().__init__(**kwargs) + self.stage_name = stage_name + self.send_notification = send_notification + + +class Operation(_serialization.Model): + """Operation entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. Format: + {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :vartype name: str + :ivar display: Operation display values. + :vartype display: ~azure.mgmt.databox.v2023_12_01.models.OperationDisplay + :ivar properties: Operation properties. + :vartype properties: JSON + :ivar origin: Origin of the operation. Can be : user|system|user,system. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + """ + + _validation = { + "name": {"readonly": True}, + "display": {"readonly": True}, + "properties": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "properties": {"key": "properties", "type": "object"}, + "origin": {"key": "origin", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + } + + def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ + super().__init__(**kwargs) + self.name = None + self.display = None + self.properties = None + self.origin = None + self.is_data_action = is_data_action + + +class OperationDisplay(_serialization.Model): + """Operation display. + + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str + :ivar operation: Localized name of the operation for display purpose. + :vartype operation: str + :ivar description: Localized description of the operation for display purpose. + :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: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + :keyword operation: Localized name of the operation for display purpose. + :paramtype operation: str + :keyword description: Localized description of the operation for display purpose. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(_serialization.Model): + """Operation Collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.databox.v2023_12_01.models.Operation] + :ivar next_link: Link for the next set of operations. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of operations. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class PackageCarrierDetails(_serialization.Model): + """Package carrier details. + + :ivar carrier_account_number: Carrier Account Number of customer for customer disk. + :vartype carrier_account_number: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__( + self, + *, + carrier_account_number: Optional[str] = None, + carrier_name: Optional[str] = None, + tracking_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword carrier_account_number: Carrier Account Number of customer for customer disk. + :paramtype carrier_account_number: str + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_account_number = carrier_account_number + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageCarrierInfo(_serialization.Model): + """package carrier info. + + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, *, carrier_name: Optional[str] = None, tracking_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageShippingDetails(_serialization.Model): + """package shipping details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tracking_url: Url where shipment can be tracked. + :vartype tracking_url: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _validation = { + "tracking_url": {"readonly": True}, + "carrier_name": {"readonly": True}, + "tracking_id": {"readonly": True}, + } + + _attribute_map = { + "tracking_url": {"key": "trackingUrl", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tracking_url = None + self.carrier_name = None + self.tracking_id = None + + +class Preferences(_serialization.Model): + """Preferences related to the order. + + :ivar preferred_data_center_region: Preferred data center region. + :vartype preferred_data_center_region: list[str] + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + :ivar reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :vartype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + :ivar encryption_preferences: Preferences related to the Encryption. + :vartype encryption_preferences: ~azure.mgmt.databox.v2023_12_01.models.EncryptionPreferences + :ivar storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :vartype storage_account_access_tier_preferences: list[str] + """ + + _attribute_map = { + "preferred_data_center_region": {"key": "preferredDataCenterRegion", "type": "[str]"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + "reverse_transport_preferences": {"key": "reverseTransportPreferences", "type": "TransportPreferences"}, + "encryption_preferences": {"key": "encryptionPreferences", "type": "EncryptionPreferences"}, + "storage_account_access_tier_preferences": {"key": "storageAccountAccessTierPreferences", "type": "[str]"}, + } + + def __init__( + self, + *, + preferred_data_center_region: Optional[List[str]] = None, + transport_preferences: Optional["_models.TransportPreferences"] = None, + reverse_transport_preferences: Optional["_models.TransportPreferences"] = None, + encryption_preferences: Optional["_models.EncryptionPreferences"] = None, + storage_account_access_tier_preferences: Optional[List[Literal["Archive"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword preferred_data_center_region: Preferred data center region. + :paramtype preferred_data_center_region: list[str] + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + :keyword reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :paramtype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + :keyword encryption_preferences: Preferences related to the Encryption. + :paramtype encryption_preferences: ~azure.mgmt.databox.v2023_12_01.models.EncryptionPreferences + :keyword storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :paramtype storage_account_access_tier_preferences: list[str] + """ + super().__init__(**kwargs) + self.preferred_data_center_region = preferred_data_center_region + self.transport_preferences = transport_preferences + self.reverse_transport_preferences = reverse_transport_preferences + self.encryption_preferences = encryption_preferences + self.storage_account_access_tier_preferences = storage_account_access_tier_preferences + + +class PreferencesValidationRequest(ValidationInputRequest): + """Request to validate preference of transport and data center. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar preference: Preference of transport and data center. + :vartype preference: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "preference": {"key": "preference", "type": "Preferences"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + preference: Optional["_models.Preferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword preference: Preference of transport and data center. + :paramtype preference: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.preference = preference + self.device_type = device_type + + +class PreferencesValidationResponseProperties(ValidationInputResponse): + """Properties of data center and transport preference validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar status: Validation status of requested data center and transport. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.status = None + + +class RegionConfigurationRequest(_serialization.Model): + """Request body to get the configuration for the region. + + :ivar schedule_availability_request: Request body to get the availability for scheduling + orders. + :vartype schedule_availability_request: + ~azure.mgmt.databox.v2023_12_01.models.ScheduleAvailabilityRequest + :ivar transport_availability_request: Request body to get the transport availability for given + sku. + :vartype transport_availability_request: + ~azure.mgmt.databox.v2023_12_01.models.TransportAvailabilityRequest + :ivar datacenter_address_request: Request body to get the datacenter address for given sku. + :vartype datacenter_address_request: + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressRequest + :ivar device_capability_request: Request body to get the device capabilities for a given sku. + :vartype device_capability_request: + ~azure.mgmt.databox.v2023_12_01.models.DeviceCapabilityRequest + """ + + _attribute_map = { + "schedule_availability_request": {"key": "scheduleAvailabilityRequest", "type": "ScheduleAvailabilityRequest"}, + "transport_availability_request": { + "key": "transportAvailabilityRequest", + "type": "TransportAvailabilityRequest", + }, + "datacenter_address_request": {"key": "datacenterAddressRequest", "type": "DatacenterAddressRequest"}, + "device_capability_request": {"key": "deviceCapabilityRequest", "type": "DeviceCapabilityRequest"}, + } + + def __init__( + self, + *, + schedule_availability_request: Optional["_models.ScheduleAvailabilityRequest"] = None, + transport_availability_request: Optional["_models.TransportAvailabilityRequest"] = None, + datacenter_address_request: Optional["_models.DatacenterAddressRequest"] = None, + device_capability_request: Optional["_models.DeviceCapabilityRequest"] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_availability_request: Request body to get the availability for scheduling + orders. + :paramtype schedule_availability_request: + ~azure.mgmt.databox.v2023_12_01.models.ScheduleAvailabilityRequest + :keyword transport_availability_request: Request body to get the transport availability for + given sku. + :paramtype transport_availability_request: + ~azure.mgmt.databox.v2023_12_01.models.TransportAvailabilityRequest + :keyword datacenter_address_request: Request body to get the datacenter address for given sku. + :paramtype datacenter_address_request: + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressRequest + :keyword device_capability_request: Request body to get the device capabilities for a given + sku. + :paramtype device_capability_request: + ~azure.mgmt.databox.v2023_12_01.models.DeviceCapabilityRequest + """ + super().__init__(**kwargs) + self.schedule_availability_request = schedule_availability_request + self.transport_availability_request = transport_availability_request + self.datacenter_address_request = datacenter_address_request + self.device_capability_request = device_capability_request + + +class RegionConfigurationResponse(_serialization.Model): + """Configuration response specific to a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar schedule_availability_response: Schedule availability for given sku in a region. + :vartype schedule_availability_response: + ~azure.mgmt.databox.v2023_12_01.models.ScheduleAvailabilityResponse + :ivar transport_availability_response: Transport options available for given sku in a region. + :vartype transport_availability_response: + ~azure.mgmt.databox.v2023_12_01.models.TransportAvailabilityResponse + :ivar datacenter_address_response: Datacenter address for given sku in a region. + :vartype datacenter_address_response: + ~azure.mgmt.databox.v2023_12_01.models.DatacenterAddressResponse + :ivar device_capability_response: Device capabilities available for a given sku in a region. + :vartype device_capability_response: + ~azure.mgmt.databox.v2023_12_01.models.DeviceCapabilityResponse + """ + + _validation = { + "schedule_availability_response": {"readonly": True}, + "transport_availability_response": {"readonly": True}, + "datacenter_address_response": {"readonly": True}, + "device_capability_response": {"readonly": True}, + } + + _attribute_map = { + "schedule_availability_response": { + "key": "scheduleAvailabilityResponse", + "type": "ScheduleAvailabilityResponse", + }, + "transport_availability_response": { + "key": "transportAvailabilityResponse", + "type": "TransportAvailabilityResponse", + }, + "datacenter_address_response": {"key": "datacenterAddressResponse", "type": "DatacenterAddressResponse"}, + "device_capability_response": {"key": "deviceCapabilityResponse", "type": "DeviceCapabilityResponse"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.schedule_availability_response = None + self.transport_availability_response = None + self.datacenter_address_response = None + self.device_capability_response = None + + +class ResourceIdentity(_serialization.Model): + """Msi identity details of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Identity type. + :vartype type: str + :ivar principal_id: Service Principal Id backing the Msi. + :vartype principal_id: str + :ivar tenant_id: Home Tenant Id. + :vartype tenant_id: str + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_12_01.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: str = "None", + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Identity type. + :paramtype type: str + :keyword user_assigned_identities: User Assigned Identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_12_01.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None + self.user_assigned_identities = user_assigned_identities + + +class ReverseShippingDetails(_serialization.Model): + """Reverse Shipping Address and contact details for a job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar contact_details: Contact Info. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactInfo + :ivar shipping_address: Shipping address where customer wishes to receive the device. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar is_updated: A flag to indicate whether Reverse Shipping details are updated or not after + device has been prepared. + Read only field. + :vartype is_updated: bool + """ + + _validation = { + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactInfo"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactInfo"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact Info. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactInfo + :keyword shipping_address: Shipping address where customer wishes to receive the device. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.is_updated = None + + +class ScheduleAvailabilityResponse(_serialization.Model): + """Schedule availability for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar available_dates: List of dates available to schedule. + :vartype available_dates: list[~datetime.datetime] + """ + + _validation = { + "available_dates": {"readonly": True}, + } + + _attribute_map = { + "available_dates": {"key": "availableDates", "type": "[iso-8601]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.available_dates = None + + +class ShareCredentialDetails(_serialization.Model): + """Credential details of the shares in account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar share_name: Name of the share. + :vartype share_name: str + :ivar share_type: Type of the share. Known values are: "UnknownType", "HCS", "BlockBlob", + "PageBlob", "AzureFile", and "ManagedDisk". + :vartype share_type: str or ~azure.mgmt.databox.v2023_12_01.models.ShareDestinationFormatType + :ivar user_name: User name for the share. + :vartype user_name: str + :ivar password: Password for the share. + :vartype password: str + :ivar supported_access_protocols: Access protocols supported on the device. + :vartype supported_access_protocols: list[str or + ~azure.mgmt.databox.v2023_12_01.models.AccessProtocol] + """ + + _validation = { + "share_name": {"readonly": True}, + "share_type": {"readonly": True}, + "user_name": {"readonly": True}, + "password": {"readonly": True}, + "supported_access_protocols": {"readonly": True}, + } + + _attribute_map = { + "share_name": {"key": "shareName", "type": "str"}, + "share_type": {"key": "shareType", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "supported_access_protocols": {"key": "supportedAccessProtocols", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.share_name = None + self.share_type = None + self.user_name = None + self.password = None + self.supported_access_protocols = None + + +class ShipmentPickUpRequest(_serialization.Model): + """Shipment pick up request details. + + All required parameters must be populated in order to send to Azure. + + :ivar start_time: Minimum date after which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype end_time: ~datetime.datetime + :ivar shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :vartype shipment_location: str + """ + + _validation = { + "start_time": {"required": True}, + "end_time": {"required": True}, + "shipment_location": {"required": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "shipment_location": {"key": "shipmentLocation", "type": "str"}, + } + + def __init__( + self, *, start_time: datetime.datetime, end_time: datetime.datetime, shipment_location: str, **kwargs: Any + ) -> None: + """ + :keyword start_time: Minimum date after which the pick up should commence, this must be in + local time of pick up area. Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :paramtype end_time: ~datetime.datetime + :keyword shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :paramtype shipment_location: str + """ + super().__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.shipment_location = shipment_location + + +class ShipmentPickUpResponse(_serialization.Model): + """Shipment pick up response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confirmation_number: Confirmation number for the pick up request. + :vartype confirmation_number: str + :ivar ready_by_time: Time by which shipment should be ready for pick up, this is in local time + of pick up area. + :vartype ready_by_time: ~datetime.datetime + """ + + _validation = { + "confirmation_number": {"readonly": True}, + "ready_by_time": {"readonly": True}, + } + + _attribute_map = { + "confirmation_number": {"key": "confirmationNumber", "type": "str"}, + "ready_by_time": {"key": "readyByTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.confirmation_number = None + self.ready_by_time = None + + +class ShippingAddress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Shipping address where customer wishes to receive the device. + + All required parameters must be populated in order to send to Azure. + + :ivar street_address1: Street Address line 1. Required. + :vartype street_address1: str + :ivar street_address2: Street Address line 2. + :vartype street_address2: str + :ivar street_address3: Street Address line 3. + :vartype street_address3: str + :ivar city: Name of the City. + :vartype city: str + :ivar state_or_province: Name of the State or Province. + :vartype state_or_province: str + :ivar country: Name of the Country. Required. + :vartype country: str + :ivar postal_code: Postal code. + :vartype postal_code: str + :ivar zip_extended_code: Extended Zip Code. + :vartype zip_extended_code: str + :ivar company_name: Name of the company. + :vartype company_name: str + :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". + :vartype address_type: str or ~azure.mgmt.databox.v2023_12_01.models.AddressType + :ivar skip_address_validation: Flag to indicate if customer has chosen to skip default address + validation. + :vartype skip_address_validation: bool + :ivar tax_identification_number: Tax Identification Number. + :vartype tax_identification_number: str + """ + + _validation = { + "street_address1": {"required": True}, + "country": {"required": True}, + } + + _attribute_map = { + "street_address1": {"key": "streetAddress1", "type": "str"}, + "street_address2": {"key": "streetAddress2", "type": "str"}, + "street_address3": {"key": "streetAddress3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state_or_province": {"key": "stateOrProvince", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "postal_code": {"key": "postalCode", "type": "str"}, + "zip_extended_code": {"key": "zipExtendedCode", "type": "str"}, + "company_name": {"key": "companyName", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "skip_address_validation": {"key": "skipAddressValidation", "type": "bool"}, + "tax_identification_number": {"key": "taxIdentificationNumber", "type": "str"}, + } + + def __init__( + self, + *, + street_address1: str, + country: str, + street_address2: Optional[str] = None, + street_address3: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + zip_extended_code: Optional[str] = None, + company_name: Optional[str] = None, + address_type: Union[str, "_models.AddressType"] = "None", + skip_address_validation: Optional[bool] = None, + tax_identification_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword street_address1: Street Address line 1. Required. + :paramtype street_address1: str + :keyword street_address2: Street Address line 2. + :paramtype street_address2: str + :keyword street_address3: Street Address line 3. + :paramtype street_address3: str + :keyword city: Name of the City. + :paramtype city: str + :keyword state_or_province: Name of the State or Province. + :paramtype state_or_province: str + :keyword country: Name of the Country. Required. + :paramtype country: str + :keyword postal_code: Postal code. + :paramtype postal_code: str + :keyword zip_extended_code: Extended Zip Code. + :paramtype zip_extended_code: str + :keyword company_name: Name of the company. + :paramtype company_name: str + :keyword address_type: Type of address. Known values are: "None", "Residential", and + "Commercial". + :paramtype address_type: str or ~azure.mgmt.databox.v2023_12_01.models.AddressType + :keyword skip_address_validation: Flag to indicate if customer has chosen to skip default + address validation. + :paramtype skip_address_validation: bool + :keyword tax_identification_number: Tax Identification Number. + :paramtype tax_identification_number: str + """ + super().__init__(**kwargs) + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.street_address3 = street_address3 + self.city = city + self.state_or_province = state_or_province + self.country = country + self.postal_code = postal_code + self.zip_extended_code = zip_extended_code + self.company_name = company_name + self.address_type = address_type + self.skip_address_validation = skip_address_validation + self.tax_identification_number = tax_identification_number + + +class Sku(_serialization.Model): + """The Sku. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar display_name: The display name of the sku. + :vartype display_name: str + :ivar family: The sku family. + :vartype family: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + display_name: Optional[str] = None, + family: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :keyword display_name: The display name of the sku. + :paramtype display_name: str + :keyword family: The sku family. + :paramtype family: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.family = family + + +class SkuAvailabilityValidationRequest(ValidationInputRequest): + """Request to validate sku availability. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + **kwargs: Any + ) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.device_type = device_type + self.transfer_type = transfer_type + self.country = country + self.location = location + + +class SkuAvailabilityValidationResponseProperties(ValidationInputResponse): + """Properties of sku availability validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar status: Sku availability validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.status = None + + +class SkuCapacity(_serialization.Model): + """Capacity of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar usable: Usable capacity in TB. + :vartype usable: str + :ivar maximum: Maximum capacity in TB. + :vartype maximum: str + """ + + _validation = { + "usable": {"readonly": True}, + "maximum": {"readonly": True}, + } + + _attribute_map = { + "usable": {"key": "usable", "type": "str"}, + "maximum": {"key": "maximum", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.usable = None + self.maximum = None + + +class SkuCost(_serialization.Model): + """Describes metadata for retrieving price info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar meter_id: Meter id of the Sku. + :vartype meter_id: str + :ivar meter_type: The type of the meter. + :vartype meter_type: str + :ivar multiplier: Multiplier specifies the region specific value to be multiplied with 1$ guid. + Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to + region. + :vartype multiplier: float + """ + + _validation = { + "meter_id": {"readonly": True}, + "meter_type": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "meter_id": {"key": "meterId", "type": "str"}, + "meter_type": {"key": "meterType", "type": "str"}, + "multiplier": {"key": "multiplier", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.meter_id = None + self.meter_type = None + self.multiplier = None + + +class SkuInformation(_serialization.Model): + """Information of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.databox.v2023_12_01.models.Sku + :ivar enabled: The sku is enabled or not. + :vartype enabled: bool + :ivar data_location_to_service_location_map: The map of data location to service location. + :vartype data_location_to_service_location_map: + list[~azure.mgmt.databox.v2023_12_01.models.DataLocationToServiceLocationMap] + :ivar capacity: Capacity of the Sku. + :vartype capacity: ~azure.mgmt.databox.v2023_12_01.models.SkuCapacity + :ivar costs: Cost of the Sku. + :vartype costs: list[~azure.mgmt.databox.v2023_12_01.models.SkuCost] + :ivar api_versions: Api versions that support this Sku. + :vartype api_versions: list[str] + :ivar disabled_reason: Reason why the Sku is disabled. Known values are: "None", "Country", + "Region", "Feature", "OfferType", and "NoSubscriptionInfo". + :vartype disabled_reason: str or ~azure.mgmt.databox.v2023_12_01.models.SkuDisabledReason + :ivar disabled_reason_message: Message for why the Sku is disabled. + :vartype disabled_reason_message: str + :ivar required_feature: Required feature to access the sku. + :vartype required_feature: str + :ivar countries_within_commerce_boundary: List of all the Countries in the SKU specific + commerce boundary. + :vartype countries_within_commerce_boundary: list[str] + """ + + _validation = { + "sku": {"readonly": True}, + "enabled": {"readonly": True}, + "data_location_to_service_location_map": {"readonly": True}, + "capacity": {"readonly": True}, + "costs": {"readonly": True}, + "api_versions": {"readonly": True}, + "disabled_reason": {"readonly": True}, + "disabled_reason_message": {"readonly": True}, + "required_feature": {"readonly": True}, + "countries_within_commerce_boundary": {"readonly": True}, + } + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "enabled": {"key": "enabled", "type": "bool"}, + "data_location_to_service_location_map": { + "key": "properties.dataLocationToServiceLocationMap", + "type": "[DataLocationToServiceLocationMap]", + }, + "capacity": {"key": "properties.capacity", "type": "SkuCapacity"}, + "costs": {"key": "properties.costs", "type": "[SkuCost]"}, + "api_versions": {"key": "properties.apiVersions", "type": "[str]"}, + "disabled_reason": {"key": "properties.disabledReason", "type": "str"}, + "disabled_reason_message": {"key": "properties.disabledReasonMessage", "type": "str"}, + "required_feature": {"key": "properties.requiredFeature", "type": "str"}, + "countries_within_commerce_boundary": {"key": "properties.countriesWithinCommerceBoundary", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku = None + self.enabled = None + self.data_location_to_service_location_map = None + self.capacity = None + self.costs = None + self.api_versions = None + self.disabled_reason = None + self.disabled_reason_message = None + self.required_feature = None + self.countries_within_commerce_boundary = None + + +class StorageAccountDetails(DataAccountDetails): + """Details for the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar storage_account_id: Storage Account Resource Id. Required. + :vartype storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__(self, *, storage_account_id: str, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword storage_account_id: Storage Account Resource Id. Required. + :paramtype storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "StorageAccount" + self.storage_account_id = storage_account_id + + +class SubscriptionIsAllowedToCreateJobValidationRequest(ValidationInputRequest): + """Request to validate subscription permission to create jobs. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + + +class SubscriptionIsAllowedToCreateJobValidationResponseProperties(ValidationInputResponse): + """Properties of subscription permission to create job validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_12_01.models.CloudError + :ivar status: Validation status of subscription permission to create job. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + self.status = None + + +class SystemData(_serialization.Model): + """Provides details about resource creation and update time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: A string identifier for the identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource: user, application, + managedIdentity. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: A string identifier for the identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource: user, + application, managedIdentity. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_by_type": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_by": {"readonly": True}, + "last_modified_by_type": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_by_type = None + self.created_at = None + self.last_modified_by = None + self.last_modified_by_type = None + self.last_modified_at = None + + +class TransferAllDetails(_serialization.Model): + """Details to transfer all data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :vartype transfer_all_blobs: bool + :ivar transfer_all_files: To indicate if all Azure Files have to be transferred. + :vartype transfer_all_files: bool + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "transfer_all_blobs": {"key": "transferAllBlobs", "type": "bool"}, + "transfer_all_files": {"key": "transferAllFiles", "type": "bool"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + transfer_all_blobs: Optional[bool] = None, + transfer_all_files: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :keyword transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :paramtype transfer_all_blobs: bool + :keyword transfer_all_files: To indicate if all Azure Files have to be transferred. + :paramtype transfer_all_files: bool + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.transfer_all_blobs = transfer_all_blobs + self.transfer_all_files = transfer_all_files + + +class TransferConfiguration(_serialization.Model): + """Configuration for defining the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :vartype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationType + :ivar transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :vartype transfer_filter_details: + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationTransferFilterDetails + :ivar transfer_all_details: Map of filter type and the details to transfer all data. This field + is required only if the TransferConfigurationType is given as TransferAll. + :vartype transfer_all_details: + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationTransferAllDetails + """ + + _validation = { + "transfer_configuration_type": {"required": True}, + } + + _attribute_map = { + "transfer_configuration_type": {"key": "transferConfigurationType", "type": "str"}, + "transfer_filter_details": { + "key": "transferFilterDetails", + "type": "TransferConfigurationTransferFilterDetails", + }, + "transfer_all_details": {"key": "transferAllDetails", "type": "TransferConfigurationTransferAllDetails"}, + } + + def __init__( + self, + *, + transfer_configuration_type: Union[str, "_models.TransferConfigurationType"], + transfer_filter_details: Optional["_models.TransferConfigurationTransferFilterDetails"] = None, + transfer_all_details: Optional["_models.TransferConfigurationTransferAllDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :paramtype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationType + :keyword transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :paramtype transfer_filter_details: + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationTransferFilterDetails + :keyword transfer_all_details: Map of filter type and the details to transfer all data. This + field is required only if the TransferConfigurationType is given as TransferAll. + :paramtype transfer_all_details: + ~azure.mgmt.databox.v2023_12_01.models.TransferConfigurationTransferAllDetails + """ + super().__init__(**kwargs) + self.transfer_configuration_type = transfer_configuration_type + self.transfer_filter_details = transfer_filter_details + self.transfer_all_details = transfer_all_details + + +class TransferConfigurationTransferAllDetails(_serialization.Model): + """Map of filter type and the details to transfer all data. This field is required only if the + TransferConfigurationType is given as TransferAll. + + :ivar include: Details to transfer all data. + :vartype include: ~azure.mgmt.databox.v2023_12_01.models.TransferAllDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferAllDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferAllDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details to transfer all data. + :paramtype include: ~azure.mgmt.databox.v2023_12_01.models.TransferAllDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferConfigurationTransferFilterDetails(_serialization.Model): + """Map of filter type and the details to filter. This field is required only if the + TransferConfigurationType is given as TransferUsingFilter. + + :ivar include: Details of the filtering the transfer of data. + :vartype include: ~azure.mgmt.databox.v2023_12_01.models.TransferFilterDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferFilterDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferFilterDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details of the filtering the transfer of data. + :paramtype include: ~azure.mgmt.databox.v2023_12_01.models.TransferFilterDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferFilterDetails(_serialization.Model): + """Details of the filtering the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :ivar blob_filter_details: Filter details to transfer blobs. + :vartype blob_filter_details: ~azure.mgmt.databox.v2023_12_01.models.BlobFilterDetails + :ivar azure_file_filter_details: Filter details to transfer Azure files. + :vartype azure_file_filter_details: + ~azure.mgmt.databox.v2023_12_01.models.AzureFileFilterDetails + :ivar filter_file_details: Details of the filter files to be used for data transfer. + :vartype filter_file_details: list[~azure.mgmt.databox.v2023_12_01.models.FilterFileDetails] + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "blob_filter_details": {"key": "blobFilterDetails", "type": "BlobFilterDetails"}, + "azure_file_filter_details": {"key": "azureFileFilterDetails", "type": "AzureFileFilterDetails"}, + "filter_file_details": {"key": "filterFileDetails", "type": "[FilterFileDetails]"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + blob_filter_details: Optional["_models.BlobFilterDetails"] = None, + azure_file_filter_details: Optional["_models.AzureFileFilterDetails"] = None, + filter_file_details: Optional[List["_models.FilterFileDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_12_01.models.DataAccountType + :keyword blob_filter_details: Filter details to transfer blobs. + :paramtype blob_filter_details: ~azure.mgmt.databox.v2023_12_01.models.BlobFilterDetails + :keyword azure_file_filter_details: Filter details to transfer Azure files. + :paramtype azure_file_filter_details: + ~azure.mgmt.databox.v2023_12_01.models.AzureFileFilterDetails + :keyword filter_file_details: Details of the filter files to be used for data transfer. + :paramtype filter_file_details: list[~azure.mgmt.databox.v2023_12_01.models.FilterFileDetails] + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.blob_filter_details = blob_filter_details + self.azure_file_filter_details = azure_file_filter_details + self.filter_file_details = filter_file_details + + +class TransportAvailabilityDetails(_serialization.Model): + """Transport options availability details for given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar shipment_type: Transport Shipment Type supported for given region. Known values are: + "CustomerManaged" and "MicrosoftManaged". + :vartype shipment_type: str or ~azure.mgmt.databox.v2023_12_01.models.TransportShipmentTypes + """ + + _validation = { + "shipment_type": {"readonly": True}, + } + + _attribute_map = { + "shipment_type": {"key": "shipmentType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shipment_type = None + + +class TransportAvailabilityRequest(_serialization.Model): + """Request body to get the transport availability for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class TransportAvailabilityResponse(_serialization.Model): + """Transport options available for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar transport_availability_details: List of transport availability details for given region. + :vartype transport_availability_details: + list[~azure.mgmt.databox.v2023_12_01.models.TransportAvailabilityDetails] + """ + + _validation = { + "transport_availability_details": {"readonly": True}, + } + + _attribute_map = { + "transport_availability_details": { + "key": "transportAvailabilityDetails", + "type": "[TransportAvailabilityDetails]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.transport_availability_details = None + + +class TransportPreferences(_serialization.Model): + """Preferences related to the shipment logistics of the sku. + + 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 preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. + Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :vartype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_12_01.models.TransportShipmentTypes + :ivar is_updated: Read only property which indicates whether transport preferences has been + updated or not after device is prepared. + :vartype is_updated: bool + """ + + _validation = { + "preferred_shipment_type": {"required": True}, + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "preferred_shipment_type": {"key": "preferredShipmentType", "type": "str"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__(self, *, preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], **kwargs: Any) -> None: + """ + :keyword preferred_shipment_type: Indicates Shipment Logistics type that the customer + preferred. Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :paramtype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_12_01.models.TransportShipmentTypes + """ + super().__init__(**kwargs) + self.preferred_shipment_type = preferred_shipment_type + self.is_updated = None + + +class UnencryptedCredentials(_serialization.Model): + """Unencrypted credentials for accessing device. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_name: Name of the job. + :vartype job_name: str + :ivar job_secrets: Secrets related to this job. + :vartype job_secrets: ~azure.mgmt.databox.v2023_12_01.models.JobSecrets + """ + + _validation = { + "job_name": {"readonly": True}, + "job_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_name": {"key": "jobName", "type": "str"}, + "job_secrets": {"key": "jobSecrets", "type": "JobSecrets"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_name = None + self.job_secrets = None + + +class UnencryptedCredentialsList(_serialization.Model): + """List of unencrypted credentials for accessing device. + + :ivar value: List of unencrypted credentials. + :vartype value: list[~azure.mgmt.databox.v2023_12_01.models.UnencryptedCredentials] + :ivar next_link: Link for the next set of unencrypted credentials. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[UnencryptedCredentials]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.UnencryptedCredentials"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of unencrypted credentials. + :paramtype value: list[~azure.mgmt.databox.v2023_12_01.models.UnencryptedCredentials] + :keyword next_link: Link for the next set of unencrypted credentials. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateJobDetails(_serialization.Model): + """Job details for update. + + :ivar contact_details: Contact details for notification and shipping. + :vartype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :ivar preferences: Preferences related to the order. + :vartype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :ivar key_encryption_key: Key encryption key for the job. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :ivar return_to_customer_package_details: Return package details of job. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierDetails + """ + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactDetails"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + preferences: Optional["_models.Preferences"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + return_to_customer_package_details: Optional["_models.PackageCarrierDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. + :paramtype contact_details: ~azure.mgmt.databox.v2023_12_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_12_01.models.ReverseShippingDetails + :keyword preferences: Preferences related to the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_12_01.models.Preferences + :keyword key_encryption_key: Key encryption key for the job. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_12_01.models.KeyEncryptionKey + :keyword return_to_customer_package_details: Return package details of job. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_12_01.models.PackageCarrierDetails + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.reverse_shipping_details = reverse_shipping_details + self.preferences = preferences + self.key_encryption_key = key_encryption_key + self.return_to_customer_package_details = return_to_customer_package_details + + +class UserAssignedIdentity(_serialization.Model): + """Class defining User assigned identity details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedProperties(_serialization.Model): + """User assigned identity properties. + + :ivar resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ValidateAddress(ValidationInputRequest): + """The requirements to validate customer address where the device needs to be shipped. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_12_01.models.ValidationInputDiscriminator + :ivar shipping_address: Shipping address of the customer. Required. + :vartype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + """ + + _validation = { + "validation_type": {"required": True}, + "shipping_address": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + } + + def __init__( + self, + *, + shipping_address: "_models.ShippingAddress", + device_type: Union[str, "_models.SkuName"], + transport_preferences: Optional["_models.TransportPreferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword shipping_address: Shipping address of the customer. Required. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_12_01.models.ShippingAddress + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_12_01.models.SkuName + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_12_01.models.TransportPreferences + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.shipping_address = shipping_address + self.device_type = device_type + self.transport_preferences = transport_preferences + + +class ValidationResponse(_serialization.Model): + """Response of pre job creation validations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Overall validation status. Known values are: "AllValidToProceed", + "InputsRevisitRequired", and "CertainInputValidationsSkipped". + :vartype status: str or ~azure.mgmt.databox.v2023_12_01.models.OverallValidationStatus + :ivar individual_response_details: List of response details contain validationType and its + response as key and value respectively. + :vartype individual_response_details: + list[~azure.mgmt.databox.v2023_12_01.models.ValidationInputResponse] + """ + + _validation = { + "status": {"readonly": True}, + "individual_response_details": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "properties.status", "type": "str"}, + "individual_response_details": { + "key": "properties.individualResponseDetails", + "type": "[ValidationInputResponse]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.individual_response_details = None diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..8cc4ae51c6e3 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_data_box_management_client_operations.py @@ -0,0 +1,219 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_mitigate_request(job_name: str, resource_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", "2023-12-01")) + 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.DataBox/jobs/{jobName}/mitigate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_12_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-12-01") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_jobs_operations.py new file mode 100644 index 000000000000..8f96cb7005d2 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_jobs_operations.py @@ -0,0 +1,1741 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(subscription_id: str, *, skip_token: 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-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mark_devices_shipped_request( + job_name: str, resource_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", "2023-12-01")) + 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.DataBox/jobs/{jobName}/markDevicesShipped", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, skip_token: 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-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, job_name: str, subscription_id: str, *, 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", "2023-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_create_request(resource_group_name: str, job_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-12-01")) + 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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_delete_request(resource_group_name: str, job_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-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_update_request( + resource_group_name: str, job_name: str, subscription_id: str, *, if_match: 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-12-01")) + 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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_book_shipment_pick_up_request( + resource_group_name: str, job_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-12-01")) + 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.DataBox/jobs/{jobName}/bookShipmentPickUp", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_cancel_request(resource_group_name: str, job_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-12-01")) + 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.DataBox/jobs/{jobName}/cancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_credentials_request( + resource_group_name: str, job_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-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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 JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_12_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_12_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + } + + @distributed_trace + def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.JobResource + :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._api_version or "2023-12-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_12_01.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: 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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_12_01.models.JobResource 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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2023-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_12_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_12_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_12_01.models.JobResource] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_12_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_12_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> Iterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.UnencryptedCredentials] + :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._api_version or "2023-12-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_operations.py new file mode 100644 index 000000000000..b5e271869a70 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_operations.py @@ -0,0 +1,156 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(**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-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataBox/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.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._api_version or "2023-12-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_service_operations.py new file mode 100644 index 000000000000..e7e179800c08 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/operations/_service_operations.py @@ -0,0 +1,1085 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_available_skus_by_resource_group_request( + resource_group_name: str, location: 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-12-01")) + 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.DataBox/locations/{location}/availableSkus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_address_request(location: 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-12-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/validateAddress", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_by_resource_group_request( + resource_group_name: str, location: 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-12-01")) + 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.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_request(location: 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-12-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_request(location: 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-12-01")) + 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}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_by_resource_group_request( + resource_group_name: str, location: 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-12-01")) + 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.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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 ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_12_01.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_12_01.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_12_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_12_01.models.SkuInformation] + :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._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_12_01.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_12_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_12_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_12_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/py.typed b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_12_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/__init__.py new file mode 100644 index 000000000000..063260fb2814 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_configuration.py new file mode 100644 index 000000000000..8f4d0780e990 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-02-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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-02-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_data_box_management_client.py new file mode 100644 index 000000000000..416bacf26683 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_data_box_management_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2024_02_01_preview.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2024_02_01_preview.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2024_02_01_preview.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. 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 "2024-02-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "DataBoxManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_metadata.json new file mode 100644 index 000000000000..7b07544e248c --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_metadata.json @@ -0,0 +1,133 @@ +{ + "chosen_version": "2024-02-01-preview", + "total_api_version_list": ["2024-02-01-preview"], + "client": { + "name": "DataBoxManagementClient", + "filename": "_data_box_management_client", + "description": "The DataBox Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "jobs": "JobsOperations", + "service": "ServiceOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", + "operations": { + "mitigate" : { + "sync": { + "signature": "def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + } + } + } + } +} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_vendor.py new file mode 100644 index 000000000000..9f9a6a04708b --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_vendor.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + +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 + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/__init__.py new file mode 100644 index 000000000000..955dbd6c6677 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_box_management_client import DataBoxManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..3b083fb67264 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-02-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(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2024-02-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_data_box_management_client.py new file mode 100644 index 000000000000..19a8f120f1e6 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_data_box_management_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2024_02_01_preview.aio.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2024_02_01_preview.aio.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2024_02_01_preview.aio.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. 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 "2024-02-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-02-01-preview" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataBoxManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_vendor.py new file mode 100644 index 000000000000..54f3d3ec6541 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..136db8b01131 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_data_box_management_client_operations.py @@ -0,0 +1,186 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._data_box_management_client_operations import build_mitigate_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2024-02-01-preview") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_jobs_operations.py new file mode 100644 index 000000000000..087c3faa5292 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_jobs_operations.py @@ -0,0 +1,1468 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import ( + build_book_shipment_pick_up_request, + build_cancel_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_credentials_request, + build_list_request, + build_mark_devices_shipped_request, + build_update_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.aio.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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("JobResourceList", 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.ApiError, 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.DataBox/jobs" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2024-02-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_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._api_version or "2024-02-01-preview") + ) + 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, + job_name=job_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.DataBox/jobs/{jobName}" + } + + async def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2024_02_01_preview.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2024_02_01_preview.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2024_02_01_preview.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2024_02_01_preview.models.CancellationReason or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.UnencryptedCredentials] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.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("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..60481b5a5d26 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_operations.py @@ -0,0 +1,138 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.aio.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_service_operations.py new file mode 100644 index 000000000000..c9ccf8e769a3 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/aio/operations/_service_operations.py @@ -0,0 +1,914 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_operations import ( + build_list_available_skus_by_resource_group_request, + build_region_configuration_by_resource_group_request, + build_region_configuration_request, + build_validate_address_request, + build_validate_inputs_by_resource_group_request, + build_validate_inputs_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.aio.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2024_02_01_preview.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2024_02_01_preview.models.AvailableSkuRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + async def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/__init__.py new file mode 100644 index 000000000000..7025f6c4c8f1 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/__init__.py @@ -0,0 +1,337 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AccountCredentialDetails +from ._models_py3 import AdditionalErrorInfo +from ._models_py3 import AddressValidationOutput +from ._models_py3 import AddressValidationProperties +from ._models_py3 import ApiError +from ._models_py3 import ApplianceNetworkConfiguration +from ._models_py3 import ArmBaseObject +from ._models_py3 import AvailableSkuRequest +from ._models_py3 import AvailableSkusResult +from ._models_py3 import AzureFileFilterDetails +from ._models_py3 import BlobFilterDetails +from ._models_py3 import CancellationReason +from ._models_py3 import CloudError +from ._models_py3 import ContactDetails +from ._models_py3 import ContactInfo +from ._models_py3 import CopyLogDetails +from ._models_py3 import CopyProgress +from ._models_py3 import CreateJobValidations +from ._models_py3 import CreateOrderLimitForSubscriptionValidationRequest +from ._models_py3 import CreateOrderLimitForSubscriptionValidationResponseProperties +from ._models_py3 import CustomerDiskJobSecrets +from ._models_py3 import DataAccountDetails +from ._models_py3 import DataBoxAccountCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyProgress +from ._models_py3 import DataBoxCustomerDiskJobDetails +from ._models_py3 import DataBoxDiskCopyLogDetails +from ._models_py3 import DataBoxDiskCopyProgress +from ._models_py3 import DataBoxDiskGranularCopyLogDetails +from ._models_py3 import DataBoxDiskGranularCopyProgress +from ._models_py3 import DataBoxDiskJobDetails +from ._models_py3 import DataBoxDiskJobSecrets +from ._models_py3 import DataBoxHeavyAccountCopyLogDetails +from ._models_py3 import DataBoxHeavyJobDetails +from ._models_py3 import DataBoxHeavyJobSecrets +from ._models_py3 import DataBoxHeavySecret +from ._models_py3 import DataBoxJobDetails +from ._models_py3 import DataBoxScheduleAvailabilityRequest +from ._models_py3 import DataBoxSecret +from ._models_py3 import DataExportDetails +from ._models_py3 import DataImportDetails +from ._models_py3 import DataLocationToServiceLocationMap +from ._models_py3 import DataTransferDetailsValidationRequest +from ._models_py3 import DataTransferDetailsValidationResponseProperties +from ._models_py3 import DataboxJobSecrets +from ._models_py3 import DatacenterAddressInstructionResponse +from ._models_py3 import DatacenterAddressLocationResponse +from ._models_py3 import DatacenterAddressRequest +from ._models_py3 import DatacenterAddressResponse +from ._models_py3 import DcAccessSecurityCode +from ._models_py3 import Details +from ._models_py3 import DeviceCapabilityDetails +from ._models_py3 import DeviceCapabilityRequest +from ._models_py3 import DeviceCapabilityResponse +from ._models_py3 import DeviceErasureDetails +from ._models_py3 import DiskScheduleAvailabilityRequest +from ._models_py3 import DiskSecret +from ._models_py3 import EncryptionPreferences +from ._models_py3 import ErrorDetail +from ._models_py3 import ExportDiskDetails +from ._models_py3 import FilterFileDetails +from ._models_py3 import GranularCopyLogDetails +from ._models_py3 import GranularCopyProgress +from ._models_py3 import HeavyScheduleAvailabilityRequest +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportDiskDetails +from ._models_py3 import JobDelayDetails +from ._models_py3 import JobDeliveryInfo +from ._models_py3 import JobDetails +from ._models_py3 import JobResource +from ._models_py3 import JobResourceList +from ._models_py3 import JobResourceUpdateParameter +from ._models_py3 import JobSecrets +from ._models_py3 import JobStages +from ._models_py3 import KeyEncryptionKey +from ._models_py3 import LastMitigationActionOnJob +from ._models_py3 import ManagedDiskDetails +from ._models_py3 import MarkDevicesShippedRequest +from ._models_py3 import MitigateJobRequest +from ._models_py3 import NotificationPreference +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import PackageCarrierDetails +from ._models_py3 import PackageCarrierInfo +from ._models_py3 import PackageShippingDetails +from ._models_py3 import Preferences +from ._models_py3 import PreferencesValidationRequest +from ._models_py3 import PreferencesValidationResponseProperties +from ._models_py3 import RegionConfigurationRequest +from ._models_py3 import RegionConfigurationResponse +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import ReverseShippingDetails +from ._models_py3 import ScheduleAvailabilityRequest +from ._models_py3 import ScheduleAvailabilityResponse +from ._models_py3 import ShareCredentialDetails +from ._models_py3 import ShipmentPickUpRequest +from ._models_py3 import ShipmentPickUpResponse +from ._models_py3 import ShippingAddress +from ._models_py3 import Sku +from ._models_py3 import SkuAvailabilityValidationRequest +from ._models_py3 import SkuAvailabilityValidationResponseProperties +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import StorageAccountDetails +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationRequest +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationResponseProperties +from ._models_py3 import SystemData +from ._models_py3 import TransferAllDetails +from ._models_py3 import TransferConfiguration +from ._models_py3 import TransferConfigurationTransferAllDetails +from ._models_py3 import TransferConfigurationTransferFilterDetails +from ._models_py3 import TransferFilterDetails +from ._models_py3 import TransportAvailabilityDetails +from ._models_py3 import TransportAvailabilityRequest +from ._models_py3 import TransportAvailabilityResponse +from ._models_py3 import TransportPreferences +from ._models_py3 import UnencryptedCredentials +from ._models_py3 import UnencryptedCredentialsList +from ._models_py3 import UpdateJobDetails +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedProperties +from ._models_py3 import ValidateAddress +from ._models_py3 import ValidationInputRequest +from ._models_py3 import ValidationInputResponse +from ._models_py3 import ValidationRequest +from ._models_py3 import ValidationResponse + +from ._data_box_management_client_enums import AccessProtocol +from ._data_box_management_client_enums import AddressType +from ._data_box_management_client_enums import AddressValidationStatus +from ._data_box_management_client_enums import ClassDiscriminator +from ._data_box_management_client_enums import CopyStatus +from ._data_box_management_client_enums import CustomerResolutionCode +from ._data_box_management_client_enums import DataAccountType +from ._data_box_management_client_enums import DataCenterCode +from ._data_box_management_client_enums import DatacenterAddressType +from ._data_box_management_client_enums import DelayNotificationStatus +from ._data_box_management_client_enums import DoubleEncryption +from ._data_box_management_client_enums import FilterFileType +from ._data_box_management_client_enums import HardwareEncryption +from ._data_box_management_client_enums import JobDeliveryType +from ._data_box_management_client_enums import KekType +from ._data_box_management_client_enums import LogCollectionLevel +from ._data_box_management_client_enums import NotificationStageName +from ._data_box_management_client_enums import OverallValidationStatus +from ._data_box_management_client_enums import PortalDelayErrorCode +from ._data_box_management_client_enums import ReverseShippingDetailsEditStatus +from ._data_box_management_client_enums import ReverseTransportPreferenceEditStatus +from ._data_box_management_client_enums import ShareDestinationFormatType +from ._data_box_management_client_enums import SkuDisabledReason +from ._data_box_management_client_enums import SkuName +from ._data_box_management_client_enums import StageName +from ._data_box_management_client_enums import StageStatus +from ._data_box_management_client_enums import TransferConfigurationType +from ._data_box_management_client_enums import TransferType +from ._data_box_management_client_enums import TransportShipmentTypes +from ._data_box_management_client_enums import ValidationInputDiscriminator +from ._data_box_management_client_enums import ValidationStatus +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccountCredentialDetails", + "AdditionalErrorInfo", + "AddressValidationOutput", + "AddressValidationProperties", + "ApiError", + "ApplianceNetworkConfiguration", + "ArmBaseObject", + "AvailableSkuRequest", + "AvailableSkusResult", + "AzureFileFilterDetails", + "BlobFilterDetails", + "CancellationReason", + "CloudError", + "ContactDetails", + "ContactInfo", + "CopyLogDetails", + "CopyProgress", + "CreateJobValidations", + "CreateOrderLimitForSubscriptionValidationRequest", + "CreateOrderLimitForSubscriptionValidationResponseProperties", + "CustomerDiskJobSecrets", + "DataAccountDetails", + "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDiskCopyLogDetails", + "DataBoxCustomerDiskCopyProgress", + "DataBoxCustomerDiskJobDetails", + "DataBoxDiskCopyLogDetails", + "DataBoxDiskCopyProgress", + "DataBoxDiskGranularCopyLogDetails", + "DataBoxDiskGranularCopyProgress", + "DataBoxDiskJobDetails", + "DataBoxDiskJobSecrets", + "DataBoxHeavyAccountCopyLogDetails", + "DataBoxHeavyJobDetails", + "DataBoxHeavyJobSecrets", + "DataBoxHeavySecret", + "DataBoxJobDetails", + "DataBoxScheduleAvailabilityRequest", + "DataBoxSecret", + "DataExportDetails", + "DataImportDetails", + "DataLocationToServiceLocationMap", + "DataTransferDetailsValidationRequest", + "DataTransferDetailsValidationResponseProperties", + "DataboxJobSecrets", + "DatacenterAddressInstructionResponse", + "DatacenterAddressLocationResponse", + "DatacenterAddressRequest", + "DatacenterAddressResponse", + "DcAccessSecurityCode", + "Details", + "DeviceCapabilityDetails", + "DeviceCapabilityRequest", + "DeviceCapabilityResponse", + "DeviceErasureDetails", + "DiskScheduleAvailabilityRequest", + "DiskSecret", + "EncryptionPreferences", + "ErrorDetail", + "ExportDiskDetails", + "FilterFileDetails", + "GranularCopyLogDetails", + "GranularCopyProgress", + "HeavyScheduleAvailabilityRequest", + "IdentityProperties", + "ImportDiskDetails", + "JobDelayDetails", + "JobDeliveryInfo", + "JobDetails", + "JobResource", + "JobResourceList", + "JobResourceUpdateParameter", + "JobSecrets", + "JobStages", + "KeyEncryptionKey", + "LastMitigationActionOnJob", + "ManagedDiskDetails", + "MarkDevicesShippedRequest", + "MitigateJobRequest", + "NotificationPreference", + "Operation", + "OperationDisplay", + "OperationList", + "PackageCarrierDetails", + "PackageCarrierInfo", + "PackageShippingDetails", + "Preferences", + "PreferencesValidationRequest", + "PreferencesValidationResponseProperties", + "RegionConfigurationRequest", + "RegionConfigurationResponse", + "Resource", + "ResourceIdentity", + "ReverseShippingDetails", + "ScheduleAvailabilityRequest", + "ScheduleAvailabilityResponse", + "ShareCredentialDetails", + "ShipmentPickUpRequest", + "ShipmentPickUpResponse", + "ShippingAddress", + "Sku", + "SkuAvailabilityValidationRequest", + "SkuAvailabilityValidationResponseProperties", + "SkuCapacity", + "SkuCost", + "SkuInformation", + "StorageAccountDetails", + "SubscriptionIsAllowedToCreateJobValidationRequest", + "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + "SystemData", + "TransferAllDetails", + "TransferConfiguration", + "TransferConfigurationTransferAllDetails", + "TransferConfigurationTransferFilterDetails", + "TransferFilterDetails", + "TransportAvailabilityDetails", + "TransportAvailabilityRequest", + "TransportAvailabilityResponse", + "TransportPreferences", + "UnencryptedCredentials", + "UnencryptedCredentialsList", + "UpdateJobDetails", + "UserAssignedIdentity", + "UserAssignedProperties", + "ValidateAddress", + "ValidationInputRequest", + "ValidationInputResponse", + "ValidationRequest", + "ValidationResponse", + "AccessProtocol", + "AddressType", + "AddressValidationStatus", + "ClassDiscriminator", + "CopyStatus", + "CustomerResolutionCode", + "DataAccountType", + "DataCenterCode", + "DatacenterAddressType", + "DelayNotificationStatus", + "DoubleEncryption", + "FilterFileType", + "HardwareEncryption", + "JobDeliveryType", + "KekType", + "LogCollectionLevel", + "NotificationStageName", + "OverallValidationStatus", + "PortalDelayErrorCode", + "ReverseShippingDetailsEditStatus", + "ReverseTransportPreferenceEditStatus", + "ShareDestinationFormatType", + "SkuDisabledReason", + "SkuName", + "StageName", + "StageStatus", + "TransferConfigurationType", + "TransferType", + "TransportShipmentTypes", + "ValidationInputDiscriminator", + "ValidationStatus", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_data_box_management_client_enums.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_data_box_management_client_enums.py new file mode 100644 index 000000000000..a5b9d634a77a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_data_box_management_client_enums.py @@ -0,0 +1,514 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AccessProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessProtocol.""" + + SMB = "SMB" + """Server Message Block protocol(SMB).""" + NFS = "NFS" + """Network File System protocol(NFS).""" + + +class AddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of address.""" + + NONE = "None" + """Address type not known.""" + RESIDENTIAL = "Residential" + """Residential Address.""" + COMMERCIAL = "Commercial" + """Commercial Address.""" + + +class AddressValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The address validation status.""" + + VALID = "Valid" + """Address provided is valid.""" + INVALID = "Invalid" + """Address provided is invalid or not supported.""" + AMBIGUOUS = "Ambiguous" + """Address provided is ambiguous, please choose one of the alternate addresses returned.""" + + +class ClassDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the type of job details.""" + + DATA_BOX = "DataBox" + """Data Box orders.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk orders.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy orders.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk orders.""" + + +class CopyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Status of the copy.""" + + NOT_STARTED = "NotStarted" + """Data copy hasn't started yet.""" + IN_PROGRESS = "InProgress" + """Data copy is in progress.""" + COMPLETED = "Completed" + """Data copy completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Data copy completed with errors.""" + FAILED = "Failed" + """Data copy failed. No data was copied.""" + NOT_RETURNED = "NotReturned" + """No copy triggered as device was not returned.""" + HARDWARE_ERROR = "HardwareError" + """The Device has hit hardware issues.""" + DEVICE_FORMATTED = "DeviceFormatted" + """Data copy failed. The Device was formatted by user.""" + DEVICE_METADATA_MODIFIED = "DeviceMetadataModified" + """Data copy failed. Device metadata was modified by user.""" + STORAGE_ACCOUNT_NOT_ACCESSIBLE = "StorageAccountNotAccessible" + """Data copy failed. Storage Account was not accessible during copy.""" + UNSUPPORTED_DATA = "UnsupportedData" + """Data copy failed. The Device data content is not supported.""" + DRIVE_NOT_RECEIVED = "DriveNotReceived" + """No copy triggered as device was not received.""" + UNSUPPORTED_DRIVE = "UnsupportedDrive" + """No copy triggered as device type is not supported.""" + OTHER_SERVICE_ERROR = "OtherServiceError" + """Copy failed due to service error.""" + OTHER_USER_ERROR = "OtherUserError" + """Copy failed due to user error.""" + DRIVE_NOT_DETECTED = "DriveNotDetected" + """Copy failed due to disk detection error.""" + DRIVE_CORRUPTED = "DriveCorrupted" + """Copy failed due to corrupted drive.""" + METADATA_FILES_MODIFIED_OR_REMOVED = "MetadataFilesModifiedOrRemoved" + """Copy failed due to modified or removed metadata files.""" + + +class CustomerResolutionCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CustomerResolutionCode.""" + + NONE = "None" + """No Resolution Yet""" + MOVE_TO_CLEAN_UP_DEVICE = "MoveToCleanUpDevice" + """Clean the device""" + RESUME = "Resume" + """Resume the job to same stage""" + RESTART = "Restart" + """Restart whole action.""" + REACH_OUT_TO_OPERATION = "ReachOutToOperation" + """Reach out to operation for further action.""" + + +class DataAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the account.""" + + STORAGE_ACCOUNT = "StorageAccount" + """Storage Accounts .""" + MANAGED_DISK = "ManagedDisk" + """Azure Managed disk storage.""" + + +class DatacenterAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data center address type.""" + + DATACENTER_ADDRESS_LOCATION = "DatacenterAddressLocation" + """Data center address location.""" + DATACENTER_ADDRESS_INSTRUCTION = "DatacenterAddressInstruction" + """Data center address instruction.""" + + +class DataCenterCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataCenter code.""" + + INVALID = "Invalid" + BY2 = "BY2" + BY1 = "BY1" + ORK70 = "ORK70" + AM2 = "AM2" + AMS20 = "AMS20" + BY21 = "BY21" + BY24 = "BY24" + MWH01 = "MWH01" + AMS06 = "AMS06" + SSE90 = "SSE90" + SYD03 = "SYD03" + SYD23 = "SYD23" + CBR20 = "CBR20" + YTO20 = "YTO20" + CWL20 = "CWL20" + LON24 = "LON24" + BOM01 = "BOM01" + BL20 = "BL20" + BL7 = "BL7" + SEL20 = "SEL20" + TYO01 = "TYO01" + BN1 = "BN1" + SN5 = "SN5" + CYS04 = "CYS04" + TYO22 = "TYO22" + YTO21 = "YTO21" + YQB20 = "YQB20" + FRA22 = "FRA22" + MAA01 = "MAA01" + CPQ02 = "CPQ02" + CPQ20 = "CPQ20" + SIN20 = "SIN20" + HKG20 = "HKG20" + SG2 = "SG2" + MEL23 = "MEL23" + SEL21 = "SEL21" + OSA20 = "OSA20" + SHA03 = "SHA03" + BJB = "BJB" + JNB22 = "JNB22" + JNB21 = "JNB21" + MNZ21 = "MNZ21" + SN8 = "SN8" + AUH20 = "AUH20" + ZRH20 = "ZRH20" + PUS20 = "PUS20" + AD_HOC = "AdHoc" + CH1 = "CH1" + DSM05 = "DSM05" + DUB07 = "DUB07" + PNQ01 = "PNQ01" + SVG20 = "SVG20" + OSA02 = "OSA02" + OSA22 = "OSA22" + PAR22 = "PAR22" + BN7 = "BN7" + SN6 = "SN6" + BJS20 = "BJS20" + BL24 = "BL24" + IDC5 = "IDC5" + TYO23 = "TYO23" + CPQ21 = "CPQ21" + NTG20 = "NTG20" + DXB23 = "DXB23" + DSM11 = "DSM11" + OSA23 = "OSA23" + AMS25 = "AMS25" + + +class DelayNotificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of notification.""" + + ACTIVE = "Active" + """Delay is still active""" + RESOLVED = "Resolved" + """Delay has been resolved""" + + +class DoubleEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines secondary layer of software-based encryption enablement.""" + + ENABLED = "Enabled" + """Software-based encryption is enabled.""" + DISABLED = "Disabled" + """Software-based encryption is disabled.""" + + +class FilterFileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the filter file.""" + + AZURE_BLOB = "AzureBlob" + """Filter file is of the type AzureBlob.""" + AZURE_FILE = "AzureFile" + """Filter file is of the type AzureFiles.""" + + +class HardwareEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hardware encryption support for a given sku for a given region.""" + + ENABLED = "Enabled" + """Hardware-based encryption is enabled.""" + DISABLED = "Disabled" + """Hardware-based encryption is disabled.""" + + +class JobDeliveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delivery type of Job.""" + + NON_SCHEDULED = "NonScheduled" + """Non Scheduled job.""" + SCHEDULED = "Scheduled" + """Scheduled job.""" + + +class KekType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of encryption key used for key encryption.""" + + MICROSOFT_MANAGED = "MicrosoftManaged" + """Key encryption key is managed by Microsoft.""" + CUSTOMER_MANAGED = "CustomerManaged" + """Key encryption key is managed by the Customer.""" + + +class LogCollectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the logs to be collected.""" + + ERROR = "Error" + """Only Errors will be collected in the logs.""" + VERBOSE = "Verbose" + """Verbose logging (includes Errors, CRC, size information and others).""" + + +class NotificationStageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage.""" + + DEVICE_PREPARED = "DevicePrepared" + """Notification at device prepared stage.""" + DISPATCHED = "Dispatched" + """Notification at device dispatched stage.""" + DELIVERED = "Delivered" + """Notification at device delivered stage.""" + PICKED_UP = "PickedUp" + """Notification at device picked up from user stage.""" + AT_AZURE_DC = "AtAzureDC" + """Notification at device received at Azure datacenter stage.""" + DATA_COPY = "DataCopy" + """Notification at data copy started stage.""" + CREATED = "Created" + """Notification at job created stage.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Notification at shipped devices to customer stage.""" + + +class OverallValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Overall validation status.""" + + ALL_VALID_TO_PROCEED = "AllValidToProceed" + """Every input request is valid.""" + INPUTS_REVISIT_REQUIRED = "InputsRevisitRequired" + """Some input requests are not valid.""" + CERTAIN_INPUT_VALIDATIONS_SKIPPED = "CertainInputValidationsSkipped" + """Certain input validations skipped.""" + + +class PortalDelayErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delay Error code.""" + + INTERNAL_ISSUE_DELAY = "InternalIssueDelay" + """Delay due to any internal reasons""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Active Order limit breached.""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """High demand""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Slow copy due to large number of files""" + + +class ReverseShippingDetailsEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Shipping Address and Contact Info.""" + + ENABLED = "Enabled" + """Reverse shipping details can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse shipping details.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse shipping details. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ReverseTransportPreferenceEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Transport preferences.""" + + ENABLED = "Enabled" + """Reverse Transport Preferences can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse Transport Preferences.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse Transport Preferences. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ShareDestinationFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the share.""" + + UNKNOWN_TYPE = "UnknownType" + """Unknown format.""" + HCS = "HCS" + """Storsimple data format.""" + BLOCK_BLOB = "BlockBlob" + """Azure storage block blob format.""" + PAGE_BLOB = "PageBlob" + """Azure storage page blob format.""" + AZURE_FILE = "AzureFile" + """Azure storage file format.""" + MANAGED_DISK = "ManagedDisk" + """Azure Compute Disk.""" + + +class SkuDisabledReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Reason why the Sku is disabled.""" + + NONE = "None" + """SKU is not disabled.""" + COUNTRY = "Country" + """SKU is not available in the requested country.""" + REGION = "Region" + """SKU is not available to push data to the requested Azure region.""" + FEATURE = "Feature" + """Required features are not enabled for the SKU.""" + OFFER_TYPE = "OfferType" + """Subscription does not have required offer types for the SKU.""" + NO_SUBSCRIPTION_INFO = "NoSubscriptionInfo" + """Subscription has not registered to Microsoft.DataBox and Service does not have the subscription + #: notification.""" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SkuName.""" + + DATA_BOX = "DataBox" + """Data Box.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk""" + + +class StageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage which is in progress.""" + + DEVICE_ORDERED = "DeviceOrdered" + """An order has been created.""" + DEVICE_PREPARED = "DevicePrepared" + """A device has been prepared for the order.""" + DISPATCHED = "Dispatched" + """Device has been dispatched to the user of the order.""" + DELIVERED = "Delivered" + """Device has been delivered to the user of the order.""" + PICKED_UP = "PickedUp" + """Device has been picked up from user and in transit to Azure datacenter.""" + AT_AZURE_DC = "AtAzureDC" + """Device has been received at Azure datacenter from the user.""" + DATA_COPY = "DataCopy" + """Data copy from the device at Azure datacenter.""" + COMPLETED = "Completed" + """Order has completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Order has completed with errors.""" + CANCELLED = "Cancelled" + """Order has been cancelled.""" + FAILED_ISSUE_REPORTED_AT_CUSTOMER = "Failed_IssueReportedAtCustomer" + """Order has failed due to issue reported by user.""" + FAILED_ISSUE_DETECTED_AT_AZURE_DC = "Failed_IssueDetectedAtAzureDC" + """Order has failed due to issue detected at Azure datacenter.""" + ABORTED = "Aborted" + """Order has been aborted.""" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """Order has completed with warnings.""" + READY_TO_DISPATCH_FROM_AZURE_DC = "ReadyToDispatchFromAzureDC" + """Device is ready to be handed to customer from Azure DC.""" + READY_TO_RECEIVE_AT_AZURE_DC = "ReadyToReceiveAtAzureDC" + """Device can be dropped off at Azure DC.""" + CREATED = "Created" + """Job created by the customer.""" + SHIPPED_TO_AZURE_DC = "ShippedToAzureDC" + """User shipped the device to AzureDC.""" + AWAITING_SHIPMENT_DETAILS = "AwaitingShipmentDetails" + """Awaiting shipment details of device from customer.""" + PREPARING_TO_SHIP_FROM_AZURE_DC = "PreparingToShipFromAzureDC" + """Preparing the device to ship to customer.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Shipped the device to customer.""" + + +class StageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Holds the device erasure completion status.""" + + NONE = "None" + """No status available yet.""" + IN_PROGRESS = "InProgress" + """Stage is in progress.""" + SUCCEEDED = "Succeeded" + """Stage has succeeded.""" + FAILED = "Failed" + """Stage has failed.""" + CANCELLED = "Cancelled" + """Stage has been cancelled.""" + CANCELLING = "Cancelling" + """Stage is cancelling.""" + SUCCEEDED_WITH_ERRORS = "SucceededWithErrors" + """Stage has succeeded with errors.""" + WAITING_FOR_CUSTOMER_ACTION = "WaitingForCustomerAction" + """Stage is stuck until customer takes some action.""" + SUCCEEDED_WITH_WARNINGS = "SucceededWithWarnings" + """Stage has succeeded with warnings.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_KEK = "WaitingForCustomerActionForKek" + """Stage is waiting for customer action for kek action items.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_CLEAN_UP = "WaitingForCustomerActionForCleanUp" + """Stage is waiting for customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED_FOR_CLEAN_UP = "CustomerActionPerformedForCleanUp" + """Stage has performed customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED = "CustomerActionPerformed" + """Stage has performed customer action for clean up.""" + + +class TransferConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the configuration for transfer.""" + + TRANSFER_ALL = "TransferAll" + """Transfer all the data.""" + TRANSFER_USING_FILTER = "TransferUsingFilter" + """Transfer using filter.""" + + +class TransferType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the transfer.""" + + IMPORT_TO_AZURE = "ImportToAzure" + """Import data to azure.""" + EXPORT_FROM_AZURE = "ExportFromAzure" + """Export data from azure.""" + + +class TransportShipmentTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transport Shipment Type supported for given region.""" + + CUSTOMER_MANAGED = "CustomerManaged" + """Shipment Logistics is handled by the customer.""" + MICROSOFT_MANAGED = "MicrosoftManaged" + """Shipment Logistics is handled by Microsoft.""" + + +class ValidationInputDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identifies the type of validation request.""" + + VALIDATE_ADDRESS = "ValidateAddress" + """Identify request and response of address validation.""" + VALIDATE_SUBSCRIPTION_IS_ALLOWED_TO_CREATE_JOB = "ValidateSubscriptionIsAllowedToCreateJob" + """Identify request and response for validation of subscription permission to create job.""" + VALIDATE_PREFERENCES = "ValidatePreferences" + """Identify request and response of preference validation.""" + VALIDATE_CREATE_ORDER_LIMIT = "ValidateCreateOrderLimit" + """Identify request and response of create order limit for subscription validation.""" + VALIDATE_SKU_AVAILABILITY = "ValidateSkuAvailability" + """Identify request and response of active job limit for sku availability.""" + VALIDATE_DATA_TRANSFER_DETAILS = "ValidateDataTransferDetails" + """Identify request and response of data transfer details validation.""" + + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Create order limit validation status.""" + + VALID = "Valid" + """Validation is successful""" + INVALID = "Invalid" + """Validation is not successful""" + SKIPPED = "Skipped" + """Validation is skipped""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_models_py3.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..a33925a17433 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_models_py3.py @@ -0,0 +1,6656 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccountCredentialDetails(_serialization.Model): + """Credential details of the account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_name: Name of the account. + :vartype account_name: str + :ivar data_account_type: Type of the account. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar account_connection_string: Connection string of the account endpoint to use the account + as a storage endpoint on the device. + :vartype account_connection_string: str + :ivar share_credential_details: Per share level unencrypted access credentials. + :vartype share_credential_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ShareCredentialDetails] + """ + + _validation = { + "account_name": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_connection_string": {"readonly": True}, + "share_credential_details": {"readonly": True}, + } + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_connection_string": {"key": "accountConnectionString", "type": "str"}, + "share_credential_details": {"key": "shareCredentialDetails", "type": "[ShareCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.account_name = None + self.data_account_type = None + self.account_connection_string = None + self.share_credential_details = None + + +class AdditionalErrorInfo(_serialization.Model): + """This class represents additional info which Resource Providers pass when an error occurs. + + :ivar info: Additional information of the type of error. + :vartype info: JSON + :ivar type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :vartype type: str + """ + + _attribute_map = { + "info": {"key": "info", "type": "object"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, info: Optional[JSON] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword info: Additional information of the type of error. + :paramtype info: JSON + :keyword type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :paramtype type: str + """ + super().__init__(**kwargs) + self.info = info + self.type = type + + +class AddressValidationOutput(_serialization.Model): + """Output of the address validation api. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_type: Identifies the type of validation response. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress] + """ + + _validation = { + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "properties.validationType", "type": "str"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "validation_status": {"key": "properties.validationStatus", "type": "str"}, + "alternate_addresses": {"key": "properties.alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + self.validation_status = None + self.alternate_addresses = None + + +class ValidationInputResponse(_serialization.Model): + """Minimum properties that should be present in each individual validation response. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AddressValidationProperties, CreateOrderLimitForSubscriptionValidationResponseProperties, + DataTransferDetailsValidationResponseProperties, PreferencesValidationResponseProperties, + SkuAvailabilityValidationResponseProperties, + SubscriptionIsAllowedToCreateJobValidationResponseProperties + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "AddressValidationProperties", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationResponseProperties", + "ValidateDataTransferDetails": "DataTransferDetailsValidationResponseProperties", + "ValidatePreferences": "PreferencesValidationResponseProperties", + "ValidateSkuAvailability": "SkuAvailabilityValidationResponseProperties", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + + +class AddressValidationProperties(ValidationInputResponse): + """The address validation output. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress] + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "validation_status": {"key": "validationStatus", "type": "str"}, + "alternate_addresses": {"key": "alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.validation_status = None + self.alternate_addresses = None + + +class ApiError(_serialization.Model): + """ApiError. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.ErrorDetail + """ + + _validation = { + "error": {"required": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: "_models.ErrorDetail", **kwargs: Any) -> None: + """ + :keyword error: Required. + :paramtype error: ~azure.mgmt.databox.v2024_02_01_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ApplianceNetworkConfiguration(_serialization.Model): + """The Network Adapter configuration of a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the network. + :vartype name: str + :ivar mac_address: Mac Address. + :vartype mac_address: str + """ + + _validation = { + "name": {"readonly": True}, + "mac_address": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.mac_address = None + + +class ArmBaseObject(_serialization.Model): + """Base class for all objects under resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class AvailableSkuRequest(_serialization.Model): + """The filters for showing the available skus. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + :ivar sku_names: Sku Names to filter for available skus. + :vartype sku_names: list[str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName] + """ + + _validation = { + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "sku_names": {"key": "skuNames", "type": "[str]"}, + } + + def __init__( + self, + *, + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + sku_names: Optional[List[Union[str, "_models.SkuName"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + :keyword sku_names: Sku Names to filter for available skus. + :paramtype sku_names: list[str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName] + """ + super().__init__(**kwargs) + self.transfer_type = transfer_type + self.country = country + self.location = location + self.sku_names = sku_names + + +class AvailableSkusResult(_serialization.Model): + """The available skus operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of available skus. + :vartype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :ivar next_link: Link for the next set of skus. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SkuInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of skus. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class AzureFileFilterDetails(_serialization.Model): + """Filter details to transfer Azure files. + + :ivar file_prefix_list: Prefix list of the Azure files to be transferred. + :vartype file_prefix_list: list[str] + :ivar file_path_list: List of full path of the files to be transferred. + :vartype file_path_list: list[str] + :ivar file_share_list: List of file shares to be transferred. + :vartype file_share_list: list[str] + """ + + _attribute_map = { + "file_prefix_list": {"key": "filePrefixList", "type": "[str]"}, + "file_path_list": {"key": "filePathList", "type": "[str]"}, + "file_share_list": {"key": "fileShareList", "type": "[str]"}, + } + + def __init__( + self, + *, + file_prefix_list: Optional[List[str]] = None, + file_path_list: Optional[List[str]] = None, + file_share_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword file_prefix_list: Prefix list of the Azure files to be transferred. + :paramtype file_prefix_list: list[str] + :keyword file_path_list: List of full path of the files to be transferred. + :paramtype file_path_list: list[str] + :keyword file_share_list: List of file shares to be transferred. + :paramtype file_share_list: list[str] + """ + super().__init__(**kwargs) + self.file_prefix_list = file_prefix_list + self.file_path_list = file_path_list + self.file_share_list = file_share_list + + +class BlobFilterDetails(_serialization.Model): + """Filter details to transfer Azure Blobs. + + :ivar blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :vartype blob_prefix_list: list[str] + :ivar blob_path_list: List of full path of the blobs to be transferred. + :vartype blob_path_list: list[str] + :ivar container_list: List of blob containers to be transferred. + :vartype container_list: list[str] + """ + + _attribute_map = { + "blob_prefix_list": {"key": "blobPrefixList", "type": "[str]"}, + "blob_path_list": {"key": "blobPathList", "type": "[str]"}, + "container_list": {"key": "containerList", "type": "[str]"}, + } + + def __init__( + self, + *, + blob_prefix_list: Optional[List[str]] = None, + blob_path_list: Optional[List[str]] = None, + container_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :paramtype blob_prefix_list: list[str] + :keyword blob_path_list: List of full path of the blobs to be transferred. + :paramtype blob_path_list: list[str] + :keyword container_list: List of blob containers to be transferred. + :paramtype container_list: list[str] + """ + super().__init__(**kwargs) + self.blob_prefix_list = blob_prefix_list + self.blob_path_list = blob_path_list + self.container_list = container_list + + +class CancellationReason(_serialization.Model): + """Reason for cancellation. + + All required parameters must be populated in order to send to Azure. + + :ivar reason: Reason for cancellation. Required. + :vartype reason: str + """ + + _validation = { + "reason": {"required": True}, + } + + _attribute_map = { + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, *, reason: str, **kwargs: Any) -> None: + """ + :keyword reason: Reason for cancellation. Required. + :paramtype reason: str + """ + super().__init__(**kwargs) + self.reason = reason + + +class CloudError(_serialization.Model): + """Provides additional information about an http error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_info: Gets or sets additional error info. + :vartype additional_info: + list[~azure.mgmt.databox.v2024_02_01_preview.models.AdditionalErrorInfo] + :ivar code: Error code. + :vartype code: str + :ivar details: Gets or sets details for the error. + :vartype details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CloudError] + :ivar message: The error message parsed from the body of the http error response. + :vartype message: str + :ivar target: Gets or sets the target of the error. + :vartype target: str + """ + + _validation = { + "additional_info": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "additional_info": {"key": "additionalInfo", "type": "[AdditionalErrorInfo]"}, + "code": {"key": "code", "type": "str"}, + "details": {"key": "details", "type": "[CloudError]"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: The error message parsed from the body of the http error response. + :paramtype message: str + :keyword target: Gets or sets the target of the error. + :paramtype target: str + """ + super().__init__(**kwargs) + self.additional_info = None + self.code = code + self.details = None + self.message = message + self.target = target + + +class ContactDetails(_serialization.Model): + """Contact Details. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + :ivar email_list: List of Email-ids to be notified about job progress. Required. + :vartype email_list: list[str] + :ivar notification_preference: Notification preference for a job stage. + :vartype notification_preference: + list[~azure.mgmt.databox.v2024_02_01_preview.models.NotificationPreference] + """ + + _validation = { + "contact_name": {"required": True}, + "phone": {"required": True}, + "email_list": {"required": True}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + "email_list": {"key": "emailList", "type": "[str]"}, + "notification_preference": {"key": "notificationPreference", "type": "[NotificationPreference]"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + email_list: List[str], + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + notification_preference: Optional[List["_models.NotificationPreference"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + :keyword email_list: List of Email-ids to be notified about job progress. Required. + :paramtype email_list: list[str] + :keyword notification_preference: Notification preference for a job stage. + :paramtype notification_preference: + list[~azure.mgmt.databox.v2024_02_01_preview.models.NotificationPreference] + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + self.email_list = email_list + self.notification_preference = notification_preference + + +class ContactInfo(_serialization.Model): + """Contact Info. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + """ + + _validation = { + "contact_name": {"required": True, "min_length": 1}, + "phone": {"required": True, "min_length": 1}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + + +class CopyLogDetails(_serialization.Model): + """Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxAccountCopyLogDetails, DataBoxCustomerDiskCopyLogDetails, DataBoxDiskCopyLogDetails, + DataBoxHeavyAccountCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = { + "copy_log_details_type": { + "DataBox": "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskCopyLogDetails", + "DataBoxDisk": "DataBoxDiskCopyLogDetails", + "DataBoxHeavy": "DataBoxHeavyAccountCopyLogDetails", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class CopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class ValidationRequest(_serialization.Model): + """Minimum request requirement of any validation category. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateJobValidations + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + _subtype_map = {"validation_category": {"JobCreationValidation": "CreateJobValidations"}} + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputRequest] + """ + super().__init__(**kwargs) + self.validation_category: Optional[str] = None + self.individual_request_details = individual_request_details + + +class CreateJobValidations(ValidationRequest): + """It does all pre-job creation validations. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputRequest] + """ + super().__init__(individual_request_details=individual_request_details, **kwargs) + self.validation_category: str = "JobCreationValidation" + + +class ValidationInputRequest(_serialization.Model): + """Minimum fields that must be present in any type of validation request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateAddress, CreateOrderLimitForSubscriptionValidationRequest, + DataTransferDetailsValidationRequest, PreferencesValidationRequest, + SkuAvailabilityValidationRequest, SubscriptionIsAllowedToCreateJobValidationRequest + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "ValidateAddress", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationRequest", + "ValidateDataTransferDetails": "DataTransferDetailsValidationRequest", + "ValidatePreferences": "PreferencesValidationRequest", + "ValidateSkuAvailability": "SkuAvailabilityValidationRequest", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationRequest", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + + +class CreateOrderLimitForSubscriptionValidationRequest(ValidationInputRequest): + """Request to validate create order limit for current subscription. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__(self, *, device_type: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.device_type = device_type + + +class CreateOrderLimitForSubscriptionValidationResponseProperties(ValidationInputResponse): + """Properties of create order limit for subscription validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar status: Create order limit validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.status = None + + +class JobSecrets(_serialization.Model): + """The base class for the secrets. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataboxJobSecrets, CustomerDiskJobSecrets, DataBoxDiskJobSecrets, DataBoxHeavyJobSecrets + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: + ~azure.mgmt.databox.v2024_02_01_preview.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "job_secrets_type": { + "DataBox": "DataboxJobSecrets", + "DataBoxCustomerDisk": "CustomerDiskJobSecrets", + "DataBoxDisk": "DataBoxDiskJobSecrets", + "DataBoxHeavy": "DataBoxHeavyJobSecrets", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: Optional[str] = None + self.dc_access_security_code = None + self.error = None + + +class CustomerDiskJobSecrets(JobSecrets): + """The secrets related to customer disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: + ~azure.mgmt.databox.v2024_02_01_preview.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2024_02_01_preview.models.DiskSecret] + :ivar carrier_account_number: Carrier Account Number of the customer. + :vartype carrier_account_number: str + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "carrier_account_number": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxCustomerDisk" + self.disk_secrets = None + self.carrier_account_number = None + + +class DataAccountDetails(_serialization.Model): + """Account details of the data to be transferred. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ManagedDiskDetails, StorageAccountDetails + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + } + + _subtype_map = { + "data_account_type": {"ManagedDisk": "ManagedDiskDetails", "StorageAccount": "StorageAccountDetails"} + } + + def __init__(self, *, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + """ + super().__init__(**kwargs) + self.data_account_type: Optional[str] = None + self.share_password = share_password + + +class DataBoxAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account of a DataBox job. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: str + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when + LogCollectionLevel is set to Verbose. + :vartype copy_verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "str"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBox" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxCustomerDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxCustomerDiskCopyProgress(CopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox CustomerDisk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class JobDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Job details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxJobDetails, DataBoxCustomerDiskJobDetails, DataBoxDiskJobDetails, DataBoxHeavyJobDetails + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2024_02_01_preview.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DataCenterCode + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + } + + _subtype_map = { + "job_details_type": { + "DataBox": "DataBoxJobDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskJobDetails", + "DataBoxDisk": "DataBoxDiskJobDetails", + "DataBoxHeavy": "DataBoxHeavyJobDetails", + } + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(**kwargs) + self.job_stages = None + self.contact_details = contact_details + self.shipping_address = shipping_address + self.delivery_package = None + self.return_package = None + self.data_import_details = data_import_details + self.data_export_details = data_export_details + self.job_details_type: Optional[str] = None + self.preferences = preferences + self.reverse_shipping_details = reverse_shipping_details + self.copy_log_details = None + self.reverse_shipment_label_sas_key = None + self.chain_of_custody_sas_key = None + self.device_erasure_details = None + self.key_encryption_key = key_encryption_key + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + self.actions = None + self.last_mitigation_action_on_job = None + self.datacenter_address = None + self.data_center_code = None + + +class DataBoxCustomerDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Customer disk job details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2024_02_01_preview.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DataCenterCode + :ivar import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :vartype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2024_02_01_preview.models.ImportDiskDetails] + :ivar export_disk_details_collection: Contains the map of disk serial number to the disk + details for export jobs. + :vartype export_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2024_02_01_preview.models.ExportDiskDetails] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxCustomerDiskCopyProgress] + :ivar deliver_to_dc_package_details: Delivery package shipping details. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierInfo + :ivar return_to_customer_package_details: Return package shipping details. Required. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierDetails + :ivar enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :vartype enable_manifest_backup: bool + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "export_disk_details_collection": {"readonly": True}, + "copy_progress": {"readonly": True}, + "deliver_to_dc_package_details": {"readonly": True}, + "return_to_customer_package_details": {"required": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "import_disk_details_collection": {"key": "importDiskDetailsCollection", "type": "{ImportDiskDetails}"}, + "export_disk_details_collection": {"key": "exportDiskDetailsCollection", "type": "{ExportDiskDetails}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxCustomerDiskCopyProgress]"}, + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + "enable_manifest_backup": {"key": "enableManifestBackup", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + return_to_customer_package_details: "_models.PackageCarrierDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + import_disk_details_collection: Optional[Dict[str, "_models.ImportDiskDetails"]] = None, + enable_manifest_backup: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :paramtype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2024_02_01_preview.models.ImportDiskDetails] + :keyword return_to_customer_package_details: Return package shipping details. Required. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierDetails + :keyword enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :paramtype enable_manifest_backup: bool + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxCustomerDisk" + self.import_disk_details_collection = import_disk_details_collection + self.export_disk_details_collection = None + self.copy_progress = None + self.deliver_to_dc_package_details = None + self.return_to_customer_package_details = return_to_customer_package_details + self.enable_manifest_backup = enable_manifest_backup + + +class DataBoxDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for a disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar disk_serial_number: Disk Serial Number. + :vartype disk_serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "disk_serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxDisk" + self.disk_serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxDiskCopyProgress(_serialization.Model): + """DataBox Disk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar serial_number: The serial number of the disk. + :vartype serial_number: str + :ivar bytes_copied: Bytes copied during the copy of disk. + :vartype bytes_copied: int + :ivar percent_complete: Indicates the percentage completed for the copy of the disk. + :vartype percent_complete: int + :ivar status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.CopyStatus + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + """ + + _validation = { + "serial_number": {"readonly": True}, + "bytes_copied": {"readonly": True}, + "percent_complete": {"readonly": True}, + "status": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "bytes_copied": {"key": "bytesCopied", "type": "int"}, + "percent_complete": {"key": "percentComplete", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.bytes_copied = None + self.percent_complete = None + self.status = None + self.error = None + self.actions = None + + +class GranularCopyLogDetails(_serialization.Model): + """Granular Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxDiskGranularCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = {"copy_log_details_type": {"DataBoxCustomerDisk": "DataBoxDiskGranularCopyLogDetails"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class DataBoxDiskGranularCopyLogDetails(GranularCopyLogDetails): + """Granular Copy Log Details for customer disk. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar account_id: Account id. + :vartype account_id: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "account_id": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.account_id = None + self.error_log_link = None + self.verbose_log_link = None + + +class GranularCopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Granular Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class DataBoxDiskGranularCopyProgress(GranularCopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox Disk Granular Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class DataBoxDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """DataBox Disk Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2024_02_01_preview.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DataCenterCode + :ivar preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :vartype preferred_disks: dict[str, int] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxDiskCopyProgress] + :ivar granular_copy_progress: Copy progress per disk. + :vartype granular_copy_progress: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxDiskGranularCopyProgress] + :ivar granular_copy_log_details: Copy progress per disk. + :vartype granular_copy_log_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxDiskGranularCopyLogDetails] + :ivar disks_and_size_details: Contains the map of disk serial number to the disk size being + used for the job. Is returned only after the disks are shipped to the customer. + :vartype disks_and_size_details: dict[str, int] + :ivar passkey: User entered passkey for DataBox Disk job. + :vartype passkey: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + "granular_copy_progress": {"readonly": True}, + "granular_copy_log_details": {"readonly": True}, + "disks_and_size_details": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "preferred_disks": {"key": "preferredDisks", "type": "{int}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxDiskCopyProgress]"}, + "granular_copy_progress": {"key": "granularCopyProgress", "type": "[DataBoxDiskGranularCopyProgress]"}, + "granular_copy_log_details": {"key": "granularCopyLogDetails", "type": "[DataBoxDiskGranularCopyLogDetails]"}, + "disks_and_size_details": {"key": "disksAndSizeDetails", "type": "{int}"}, + "passkey": {"key": "passkey", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + preferred_disks: Optional[Dict[str, int]] = None, + passkey: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :paramtype preferred_disks: dict[str, int] + :keyword passkey: User entered passkey for DataBox Disk job. + :paramtype passkey: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxDisk" + self.preferred_disks = preferred_disks + self.copy_progress = None + self.granular_copy_progress = None + self.granular_copy_log_details = None + self.disks_and_size_details = None + self.passkey = passkey + + +class DataBoxDiskJobSecrets(JobSecrets): + """The secrets related to disk job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: + ~azure.mgmt.databox.v2024_02_01_preview.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2024_02_01_preview.models.DiskSecret] + :ivar pass_key: PassKey for the disk Job. + :vartype pass_key: str + :ivar is_passkey_user_defined: Whether passkey was provided by user. + :vartype is_passkey_user_defined: bool + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "pass_key": {"readonly": True}, + "is_passkey_user_defined": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "pass_key": {"key": "passKey", "type": "str"}, + "is_passkey_user_defined": {"key": "isPasskeyUserDefined", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxDisk" + self.disk_secrets = None + self.pass_key = None + self.is_passkey_user_defined = None + + +class DataBoxHeavyAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account for Databox heavy. + + 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 copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: list[str] + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when the + LogCollectionLevel is set to verbose. + :vartype copy_verbose_log_link: list[str] + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "[str]"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxHeavy" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxHeavyJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Heavy Device Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2024_02_01_preview.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DataCenterCode + :ivar copy_progress: Copy progress per account. + :vartype copy_progress: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxHeavy" + self.copy_progress = None + self.device_password = device_password + + +class DataBoxHeavyJobSecrets(JobSecrets): + """The secrets related to a databox heavy job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: + ~azure.mgmt.databox.v2024_02_01_preview.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar cabinet_pod_secrets: Contains the list of secret objects for a databox heavy job. + :vartype cabinet_pod_secrets: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxHeavySecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "cabinet_pod_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "cabinet_pod_secrets": {"key": "cabinetPodSecrets", "type": "[DataBoxHeavySecret]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxHeavy" + self.cabinet_pod_secrets = None + + +class DataBoxHeavySecret(_serialization.Model): + """The secrets related to a databox heavy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DataBoxJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Job Details. + + 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 job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2024_02_01_preview.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2024_02_01_preview.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + "BJS20", "BL24", "IDC5", "TYO23", "CPQ21", "NTG20", "DXB23", "DSM11", "OSA23", and "AMS25". + :vartype data_center_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DataCenterCode + :ivar copy_progress: Copy progress per storage account. + :vartype copy_progress: list[~azure.mgmt.databox.v2024_02_01_preview.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBox" + self.copy_progress = None + self.device_password = device_password + + +class DataboxJobSecrets(JobSecrets): + """The secrets related to a databox job. + + 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 job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: + ~azure.mgmt.databox.v2024_02_01_preview.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar pod_secrets: Contains the list of secret objects for a job. + :vartype pod_secrets: list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxSecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "pod_secrets": {"key": "podSecrets", "type": "[DataBoxSecret]"}, + } + + def __init__(self, *, pod_secrets: Optional[List["_models.DataBoxSecret"]] = None, **kwargs: Any) -> None: + """ + :keyword pod_secrets: Contains the list of secret objects for a job. + :paramtype pod_secrets: list[~azure.mgmt.databox.v2024_02_01_preview.models.DataBoxSecret] + """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBox" + self.pod_secrets = pod_secrets + + +class ScheduleAvailabilityRequest(_serialization.Model): + """Request body to get the availability for scheduling orders. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxScheduleAvailabilityRequest, DiskScheduleAvailabilityRequest, + HeavyScheduleAvailabilityRequest + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + _subtype_map = { + "sku_name": { + "DataBox": "DataBoxScheduleAvailabilityRequest", + "DataBoxDisk": "DiskScheduleAvailabilityRequest", + "DataBoxHeavy": "HeavyScheduleAvailabilityRequest", + } + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name: Optional[str] = None + self.country = country + + +class DataBoxScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling data box orders orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBox" + + +class DataBoxSecret(_serialization.Model): + """The secrets related to a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DatacenterAddressResponse(_serialization.Model): + """Datacenter address for given storage location. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DatacenterAddressInstructionResponse, DatacenterAddressLocationResponse + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + } + + _subtype_map = { + "datacenter_address_type": { + "DatacenterAddressInstruction": "DatacenterAddressInstructionResponse", + "DatacenterAddressLocation": "DatacenterAddressLocationResponse", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: Optional[str] = None + self.supported_carriers_for_return_shipment = None + self.data_center_azure_location = None + + +class DatacenterAddressInstructionResponse(DatacenterAddressResponse): + """Datacenter instruction for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar communication_instruction: Data center communication instruction. + :vartype communication_instruction: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "communication_instruction": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "communication_instruction": {"key": "communicationInstruction", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressInstruction" + self.communication_instruction = None + + +class DatacenterAddressLocationResponse(DatacenterAddressResponse): # pylint: disable=too-many-instance-attributes + """Datacenter address for given storage location. + + 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 datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar contact_person_name: Contact person name. + :vartype contact_person_name: str + :ivar company: Company name. + :vartype company: str + :ivar street1: Street address line 1. + :vartype street1: str + :ivar street2: Street address line 2. + :vartype street2: str + :ivar street3: Street address line 3. + :vartype street3: str + :ivar city: City name. + :vartype city: str + :ivar state: name of the state. + :vartype state: str + :ivar zip: Zip code. + :vartype zip: str + :ivar country: name of the country. + :vartype country: str + :ivar phone: Phone number. + :vartype phone: str + :ivar phone_extension: Phone extension. + :vartype phone_extension: str + :ivar address_type: Address type. + :vartype address_type: str + :ivar additional_shipping_information: Special instruction for shipping. + :vartype additional_shipping_information: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "contact_person_name": {"readonly": True}, + "company": {"readonly": True}, + "street1": {"readonly": True}, + "street2": {"readonly": True}, + "street3": {"readonly": True}, + "city": {"readonly": True}, + "state": {"readonly": True}, + "zip": {"readonly": True}, + "country": {"readonly": True}, + "phone": {"readonly": True}, + "phone_extension": {"readonly": True}, + "address_type": {"readonly": True}, + "additional_shipping_information": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "contact_person_name": {"key": "contactPersonName", "type": "str"}, + "company": {"key": "company", "type": "str"}, + "street1": {"key": "street1", "type": "str"}, + "street2": {"key": "street2", "type": "str"}, + "street3": {"key": "street3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "zip": {"key": "zip", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "additional_shipping_information": {"key": "additionalShippingInformation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressLocation" + self.contact_person_name = None + self.company = None + self.street1 = None + self.street2 = None + self.street3 = None + self.city = None + self.state = None + self.zip = None + self.country = None + self.phone = None + self.phone_extension = None + self.address_type = None + self.additional_shipping_information = None + + +class DatacenterAddressRequest(_serialization.Model): + """Request body to get the datacenter address. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, storage_location: str, sku_name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name = sku_name + + +class DataExportDetails(_serialization.Model): + """Details of the data to be used for exporting data from azure. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration: Configuration for the data transfer. Required. + :vartype transfer_configuration: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfiguration + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.LogCollectionLevel + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountDetails + """ + + _validation = { + "transfer_configuration": {"required": True}, + "account_details": {"required": True}, + } + + _attribute_map = { + "transfer_configuration": {"key": "transferConfiguration", "type": "TransferConfiguration"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + } + + def __init__( + self, + *, + transfer_configuration: "_models.TransferConfiguration", + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration: Configuration for the data transfer. Required. + :paramtype transfer_configuration: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfiguration + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.LogCollectionLevel + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountDetails + """ + super().__init__(**kwargs) + self.transfer_configuration = transfer_configuration + self.log_collection_level = log_collection_level + self.account_details = account_details + + +class DataImportDetails(_serialization.Model): + """Details of the data to be used for importing data to azure. + + All required parameters must be populated in order to send to Azure. + + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountDetails + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.LogCollectionLevel + """ + + _validation = { + "account_details": {"required": True}, + } + + _attribute_map = { + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + } + + def __init__( + self, + *, + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountDetails + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.LogCollectionLevel + """ + super().__init__(**kwargs) + self.account_details = account_details + self.log_collection_level = log_collection_level + + +class DataLocationToServiceLocationMap(_serialization.Model): + """Map of data location to service location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_location: Location of the data. + :vartype data_location: str + :ivar service_location: Location of the service. + :vartype service_location: str + """ + + _validation = { + "data_location": {"readonly": True}, + "service_location": {"readonly": True}, + } + + _attribute_map = { + "data_location": {"key": "dataLocation", "type": "str"}, + "service_location": {"key": "serviceLocation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.data_location = None + self.service_location = None + + +class DataTransferDetailsValidationRequest(ValidationInputRequest): + """Request to validate export and import data details. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar data_export_details: List of DataTransfer details to be used to export data from azure. + :vartype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :ivar data_import_details: List of DataTransfer details to be used to import data to azure. + :vartype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :ivar device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_export_details: List of DataTransfer details to be used to export data from + azure. + :paramtype data_export_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataExportDetails] + :keyword data_import_details: List of DataTransfer details to be used to import data to azure. + :paramtype data_import_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataImportDetails] + :keyword device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.data_export_details = data_export_details + self.data_import_details = data_import_details + self.device_type = device_type + self.transfer_type = transfer_type + + +class DataTransferDetailsValidationResponseProperties(ValidationInputResponse): + """Properties of data transfer details validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar status: Data transfer details validation status. Known values are: "Valid", "Invalid", + and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.status = None + + +class DcAccessSecurityCode(_serialization.Model): + """Dc access security code. + + :ivar reverse_dc_access_code: Reverse Dc access security code. + :vartype reverse_dc_access_code: str + :ivar forward_dc_access_code: Forward Dc access security code. + :vartype forward_dc_access_code: str + """ + + _attribute_map = { + "reverse_dc_access_code": {"key": "reverseDCAccessCode", "type": "str"}, + "forward_dc_access_code": {"key": "forwardDCAccessCode", "type": "str"}, + } + + def __init__( + self, + *, + reverse_dc_access_code: Optional[str] = None, + forward_dc_access_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword reverse_dc_access_code: Reverse Dc access security code. + :paramtype reverse_dc_access_code: str + :keyword forward_dc_access_code: Forward Dc access security code. + :paramtype forward_dc_access_code: str + """ + super().__init__(**kwargs) + self.reverse_dc_access_code = reverse_dc_access_code + self.forward_dc_access_code = forward_dc_access_code + + +class Details(_serialization.Model): + """Details. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class DeviceCapabilityDetails(_serialization.Model): + """Device capability details for a given sku for a given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hardware_encryption: Hardware encryption support for a given sku for a given region. + Known values are: "Enabled" and "Disabled". + :vartype hardware_encryption: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.HardwareEncryption + """ + + _validation = { + "hardware_encryption": {"readonly": True}, + } + + _attribute_map = { + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.hardware_encryption = None + + +class DeviceCapabilityRequest(_serialization.Model): + """Request body to get the device capabilities for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class DeviceCapabilityResponse(_serialization.Model): + """Device capabilities for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_capability_details: List of device capabilities available for a given region and a + given sku. + :vartype device_capability_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DeviceCapabilityDetails] + """ + + _validation = { + "device_capability_details": {"readonly": True}, + } + + _attribute_map = { + "device_capability_details": {"key": "deviceCapabilityDetails", "type": "[DeviceCapabilityDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_capability_details = None + + +class DeviceErasureDetails(_serialization.Model): + """Device erasure details with erasure completion status and erasureordestructionlog sas key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_erasure_status: Holds the device erasure completion status. Known values are: + "None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype device_erasure_status: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.StageStatus + :ivar erasure_or_destruction_certificate_sas_key: Shared access key to download cleanup or + destruction certificate for device. + :vartype erasure_or_destruction_certificate_sas_key: str + """ + + _validation = { + "device_erasure_status": {"readonly": True}, + "erasure_or_destruction_certificate_sas_key": {"readonly": True}, + } + + _attribute_map = { + "device_erasure_status": {"key": "deviceErasureStatus", "type": "str"}, + "erasure_or_destruction_certificate_sas_key": {"key": "erasureOrDestructionCertificateSasKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_erasure_status = None + self.erasure_or_destruction_certificate_sas_key = None + + +class DiskScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling disk orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :vartype expected_data_size_in_tera_bytes: int + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + "expected_data_size_in_tera_bytes": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + } + + def __init__( + self, + *, + storage_location: str, + expected_data_size_in_tera_bytes: int, + country: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxDisk" + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + + +class DiskSecret(_serialization.Model): + """Contains all the secrets of a Disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_serial_number: Serial number of the assigned disk. + :vartype disk_serial_number: str + :ivar bit_locker_key: Bit Locker key of the disk which can be used to unlock the disk to copy + data. + :vartype bit_locker_key: str + """ + + _validation = { + "disk_serial_number": {"readonly": True}, + "bit_locker_key": {"readonly": True}, + } + + _attribute_map = { + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.disk_serial_number = None + self.bit_locker_key = None + + +class EncryptionPreferences(_serialization.Model): + """Preferences related to the Encryption. + + :ivar double_encryption: Defines secondary layer of software-based encryption enablement. Known + values are: "Enabled" and "Disabled". + :vartype double_encryption: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DoubleEncryption + :ivar hardware_encryption: Defines Hardware level encryption (Only for disk). Known values are: + "Enabled" and "Disabled". + :vartype hardware_encryption: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.HardwareEncryption + """ + + _attribute_map = { + "double_encryption": {"key": "doubleEncryption", "type": "str"}, + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__( + self, + *, + double_encryption: Union[str, "_models.DoubleEncryption"] = "Disabled", + hardware_encryption: Optional[Union[str, "_models.HardwareEncryption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword double_encryption: Defines secondary layer of software-based encryption enablement. + Known values are: "Enabled" and "Disabled". + :paramtype double_encryption: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DoubleEncryption + :keyword hardware_encryption: Defines Hardware level encryption (Only for disk). Known values + are: "Enabled" and "Disabled". + :paramtype hardware_encryption: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.HardwareEncryption + """ + super().__init__(**kwargs) + self.double_encryption = double_encryption + self.hardware_encryption = hardware_encryption + + +class ErrorDetail(_serialization.Model): + """ErrorDetail. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar details: + :vartype details: list[~azure.mgmt.databox.v2024_02_01_preview.models.Details] + :ivar target: + :vartype target: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[Details]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + code: str, + message: str, + details: Optional[List["_models.Details"]] = None, + target: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + :keyword details: + :paramtype details: list[~azure.mgmt.databox.v2024_02_01_preview.models.Details] + :keyword target: + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + + +class ExportDiskDetails(_serialization.Model): + """Export disk details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar manifest_file: The relative path of the manifest file on the disk. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. + :vartype manifest_hash: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"readonly": True}, + "manifest_hash": {"readonly": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.manifest_file = None + self.manifest_hash = None + self.backup_manifest_cloud_path = None + + +class FilterFileDetails(_serialization.Model): + """Details of the filter files to be used for data transfer. + + All required parameters must be populated in order to send to Azure. + + :ivar filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :vartype filter_file_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.FilterFileType + :ivar filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :vartype filter_file_path: str + """ + + _validation = { + "filter_file_type": {"required": True}, + "filter_file_path": {"required": True}, + } + + _attribute_map = { + "filter_file_type": {"key": "filterFileType", "type": "str"}, + "filter_file_path": {"key": "filterFilePath", "type": "str"}, + } + + def __init__( + self, *, filter_file_type: Union[str, "_models.FilterFileType"], filter_file_path: str, **kwargs: Any + ) -> None: + """ + :keyword filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :paramtype filter_file_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.FilterFileType + :keyword filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :paramtype filter_file_path: str + """ + super().__init__(**kwargs) + self.filter_file_type = filter_file_type + self.filter_file_path = filter_file_path + + +class HeavyScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling heavy orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxHeavy" + + +class IdentityProperties(_serialization.Model): + """Managed identity properties. + + :ivar type: Managed service identity type. + :vartype type: str + :ivar user_assigned: User assigned identity properties. + :vartype user_assigned: ~azure.mgmt.databox.v2024_02_01_preview.models.UserAssignedProperties + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "user_assigned": {"key": "userAssigned", "type": "UserAssignedProperties"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned: Optional["_models.UserAssignedProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Managed service identity type. + :paramtype type: str + :keyword user_assigned: User assigned identity properties. + :paramtype user_assigned: ~azure.mgmt.databox.v2024_02_01_preview.models.UserAssignedProperties + """ + super().__init__(**kwargs) + self.type = type + self.user_assigned = user_assigned + + +class ImportDiskDetails(_serialization.Model): + """Import disk details. + + 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 manifest_file: The relative path of the manifest file on the disk. Required. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :vartype manifest_hash: str + :ivar bit_locker_key: BitLocker key used to encrypt the disk. Required. + :vartype bit_locker_key: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"required": True}, + "manifest_hash": {"required": True}, + "bit_locker_key": {"required": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, *, manifest_file: str, manifest_hash: str, bit_locker_key: str, **kwargs: Any) -> None: + """ + :keyword manifest_file: The relative path of the manifest file on the disk. Required. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :paramtype manifest_hash: str + :keyword bit_locker_key: BitLocker key used to encrypt the disk. Required. + :paramtype bit_locker_key: str + """ + super().__init__(**kwargs) + self.manifest_file = manifest_file + self.manifest_hash = manifest_hash + self.bit_locker_key = bit_locker_key + self.backup_manifest_cloud_path = None + + +class JobDelayDetails(_serialization.Model): + """Job Delay Notification details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Status of notification. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.DelayNotificationStatus + :ivar error_code: Delay Error code. Known values are: "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", "ActiveOrderLimitBreachedDelay", and + "ActiveOrderLimitBreachedDelay". + :vartype error_code: str or ~azure.mgmt.databox.v2024_02_01_preview.models.PortalDelayErrorCode + :ivar description: Description of the delay. + :vartype description: str + :ivar start_time: Timestamp when the delay notification was created. + :vartype start_time: ~datetime.datetime + :ivar resolution_time: Timestamp when the delay notification was resolved. + :vartype resolution_time: ~datetime.datetime + """ + + _validation = { + "status": {"readonly": True}, + "error_code": {"readonly": True}, + "description": {"readonly": True}, + "start_time": {"readonly": True}, + "resolution_time": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "resolution_time": {"key": "resolutionTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.error_code = None + self.description = None + self.start_time = None + self.resolution_time = None + + +class JobDeliveryInfo(_serialization.Model): + """Additional delivery info. + + :ivar scheduled_date_time: Scheduled date time. + :vartype scheduled_date_time: ~datetime.datetime + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + } + + def __init__(self, *, scheduled_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_date_time: Scheduled date time. + :paramtype scheduled_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + + +class Resource(_serialization.Model): + """Model of the Resource. + + All required parameters must be populated in order to send to Azure. + + :ivar location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2024_02_01_preview.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + } + + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2024_02_01_preview.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.sku = sku + self.identity = identity + + +class JobResource(Resource): # pylint: disable=too-many-instance-attributes + """Job 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 location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2024_02_01_preview.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.databox.v2024_02_01_preview.models.SystemData + :ivar transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar is_cancellable: Describes whether the job is cancellable or not. + :vartype is_cancellable: bool + :ivar is_deletable: Describes whether the job is deletable or not. + :vartype is_deletable: bool + :ivar is_shipping_address_editable: Describes whether the shipping address is editable or not. + :vartype is_shipping_address_editable: bool + :ivar reverse_shipping_details_update: The Editable status for Reverse Shipping Address and + Contact Info. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_shipping_details_update: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetailsEditStatus + :ivar reverse_transport_preference_update: The Editable status for Reverse Transport + preferences. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_transport_preference_update: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseTransportPreferenceEditStatus + :ivar is_prepare_to_ship_enabled: Is Prepare To Ship Enabled on this job. + :vartype is_prepare_to_ship_enabled: bool + :ivar status: Name of the stage which is in progress. Known values are: "DeviceOrdered", + "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.StageName + :ivar delayed_stage: Name of the stage where delay might be present. Known values are: + "DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", + "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype delayed_stage: str or ~azure.mgmt.databox.v2024_02_01_preview.models.StageName + :ivar start_time: Time at which the job was started in UTC ISO 8601 format. + :vartype start_time: ~datetime.datetime + :ivar error: Top level error for the job. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar details: Details of a job run. This field will only be sent for expand details filter. + :vartype details: ~azure.mgmt.databox.v2024_02_01_preview.models.JobDetails + :ivar cancellation_reason: Reason for cancellation. + :vartype cancellation_reason: str + :ivar delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :vartype delivery_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.JobDeliveryType + :ivar delivery_info: Delivery Info of Job. + :vartype delivery_info: ~azure.mgmt.databox.v2024_02_01_preview.models.JobDeliveryInfo + :ivar is_cancellable_without_fee: Flag to indicate cancellation of scheduled job. + :vartype is_cancellable_without_fee: bool + :ivar all_devices_lost: Flag to indicate if all devices associated with the job are lost. + :vartype all_devices_lost: bool + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "transfer_type": {"required": True}, + "is_cancellable": {"readonly": True}, + "is_deletable": {"readonly": True}, + "is_shipping_address_editable": {"readonly": True}, + "reverse_shipping_details_update": {"readonly": True}, + "reverse_transport_preference_update": {"readonly": True}, + "is_prepare_to_ship_enabled": {"readonly": True}, + "status": {"readonly": True}, + "delayed_stage": {"readonly": True}, + "start_time": {"readonly": True}, + "error": {"readonly": True}, + "cancellation_reason": {"readonly": True}, + "is_cancellable_without_fee": {"readonly": True}, + "all_devices_lost": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "transfer_type": {"key": "properties.transferType", "type": "str"}, + "is_cancellable": {"key": "properties.isCancellable", "type": "bool"}, + "is_deletable": {"key": "properties.isDeletable", "type": "bool"}, + "is_shipping_address_editable": {"key": "properties.isShippingAddressEditable", "type": "bool"}, + "reverse_shipping_details_update": {"key": "properties.reverseShippingDetailsUpdate", "type": "str"}, + "reverse_transport_preference_update": {"key": "properties.reverseTransportPreferenceUpdate", "type": "str"}, + "is_prepare_to_ship_enabled": {"key": "properties.isPrepareToShipEnabled", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "delayed_stage": {"key": "properties.delayedStage", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "details": {"key": "properties.details", "type": "JobDetails"}, + "cancellation_reason": {"key": "properties.cancellationReason", "type": "str"}, + "delivery_type": {"key": "properties.deliveryType", "type": "str"}, + "delivery_info": {"key": "properties.deliveryInfo", "type": "JobDeliveryInfo"}, + "is_cancellable_without_fee": {"key": "properties.isCancellableWithoutFee", "type": "bool"}, + "all_devices_lost": {"key": "properties.allDevicesLost", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + sku: "_models.Sku", + transfer_type: Union[str, "_models.TransferType"], + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.JobDetails"] = None, + delivery_type: Union[str, "_models.JobDeliveryType"] = "NonScheduled", + delivery_info: Optional["_models.JobDeliveryInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2024_02_01_preview.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + :keyword transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" + and "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :keyword details: Details of a job run. This field will only be sent for expand details filter. + :paramtype details: ~azure.mgmt.databox.v2024_02_01_preview.models.JobDetails + :keyword delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :paramtype delivery_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.JobDeliveryType + :keyword delivery_info: Delivery Info of Job. + :paramtype delivery_info: ~azure.mgmt.databox.v2024_02_01_preview.models.JobDeliveryInfo + """ + super().__init__(location=location, tags=tags, sku=sku, identity=identity, **kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.transfer_type = transfer_type + self.is_cancellable = None + self.is_deletable = None + self.is_shipping_address_editable = None + self.reverse_shipping_details_update = None + self.reverse_transport_preference_update = None + self.is_prepare_to_ship_enabled = None + self.status = None + self.delayed_stage = None + self.start_time = None + self.error = None + self.details = details + self.cancellation_reason = None + self.delivery_type = delivery_type + self.delivery_info = delivery_info + self.is_cancellable_without_fee = None + self.all_devices_lost = None + + +class JobResourceList(_serialization.Model): + """Job Resource Collection. + + :ivar value: List of job resources. + :vartype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :ivar next_link: Link for the next set of job resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[JobResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.JobResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of job resources. + :paramtype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :keyword next_link: Link for the next set of job resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class JobResourceUpdateParameter(_serialization.Model): + """The JobResourceUpdateParameter. + + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + :ivar details: Details of a job to be updated. + :vartype details: ~azure.mgmt.databox.v2024_02_01_preview.models.UpdateJobDetails + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "details": {"key": "properties.details", "type": "UpdateJobDetails"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.UpdateJobDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2024_02_01_preview.models.ResourceIdentity + :keyword details: Details of a job to be updated. + :paramtype details: ~azure.mgmt.databox.v2024_02_01_preview.models.UpdateJobDetails + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.details = details + + +class JobStages(_serialization.Model): + """Job stages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stage_name: Name of the job stage. Known values are: "DeviceOrdered", "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.StageName + :ivar display_name: Display name of the job stage. + :vartype display_name: str + :ivar stage_status: Status of the job stage. Known values are: "None", "InProgress", + "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype stage_status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.StageStatus + :ivar stage_time: Time for the job stage in UTC ISO 8601 format. + :vartype stage_time: ~datetime.datetime + :ivar job_stage_details: Job Stage Details. + :vartype job_stage_details: JSON + :ivar delay_information: Delay information for the job stages. + :vartype delay_information: + list[~azure.mgmt.databox.v2024_02_01_preview.models.JobDelayDetails] + """ + + _validation = { + "stage_name": {"readonly": True}, + "display_name": {"readonly": True}, + "stage_status": {"readonly": True}, + "stage_time": {"readonly": True}, + "job_stage_details": {"readonly": True}, + "delay_information": {"readonly": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "stage_status": {"key": "stageStatus", "type": "str"}, + "stage_time": {"key": "stageTime", "type": "iso-8601"}, + "job_stage_details": {"key": "jobStageDetails", "type": "object"}, + "delay_information": {"key": "delayInformation", "type": "[JobDelayDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.stage_name = None + self.display_name = None + self.stage_status = None + self.stage_time = None + self.job_stage_details = None + self.delay_information = None + + +class KeyEncryptionKey(_serialization.Model): + """Encryption key containing details about key to encrypt different keys. + + All required parameters must be populated in order to send to Azure. + + :ivar kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :vartype kek_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.KekType + :ivar identity_properties: Managed identity properties used for key encryption. + :vartype identity_properties: ~azure.mgmt.databox.v2024_02_01_preview.models.IdentityProperties + :ivar kek_url: Key encryption key. It is required in case of Customer managed KekType. + :vartype kek_url: str + :ivar kek_vault_resource_id: Kek vault resource id. It is required in case of Customer managed + KekType. + :vartype kek_vault_resource_id: str + """ + + _validation = { + "kek_type": {"required": True}, + } + + _attribute_map = { + "kek_type": {"key": "kekType", "type": "str"}, + "identity_properties": {"key": "identityProperties", "type": "IdentityProperties"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "kek_vault_resource_id": {"key": "kekVaultResourceID", "type": "str"}, + } + + def __init__( + self, + *, + kek_type: Union[str, "_models.KekType"] = "MicrosoftManaged", + identity_properties: Optional["_models.IdentityProperties"] = None, + kek_url: Optional[str] = None, + kek_vault_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :paramtype kek_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.KekType + :keyword identity_properties: Managed identity properties used for key encryption. + :paramtype identity_properties: + ~azure.mgmt.databox.v2024_02_01_preview.models.IdentityProperties + :keyword kek_url: Key encryption key. It is required in case of Customer managed KekType. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Kek vault resource id. It is required in case of Customer + managed KekType. + :paramtype kek_vault_resource_id: str + """ + super().__init__(**kwargs) + self.kek_type = kek_type + self.identity_properties = identity_properties + self.kek_url = kek_url + self.kek_vault_resource_id = kek_vault_resource_id + + +class LastMitigationActionOnJob(_serialization.Model): + """Last Mitigation Action Performed On Job. + + :ivar action_date_time_in_utc: Action performed date time. + :vartype action_date_time_in_utc: ~datetime.datetime + :ivar is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :vartype is_performed_by_customer: bool + :ivar customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode + """ + + _attribute_map = { + "action_date_time_in_utc": {"key": "actionDateTimeInUtc", "type": "iso-8601"}, + "is_performed_by_customer": {"key": "isPerformedByCustomer", "type": "bool"}, + "customer_resolution": {"key": "customerResolution", "type": "str"}, + } + + def __init__( + self, + *, + action_date_time_in_utc: Optional[datetime.datetime] = None, + is_performed_by_customer: Optional[bool] = None, + customer_resolution: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword action_date_time_in_utc: Action performed date time. + :paramtype action_date_time_in_utc: ~datetime.datetime + :keyword is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :paramtype is_performed_by_customer: bool + :keyword customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode + """ + super().__init__(**kwargs) + self.action_date_time_in_utc = action_date_time_in_utc + self.is_performed_by_customer = is_performed_by_customer + self.customer_resolution = customer_resolution + + +class ManagedDiskDetails(DataAccountDetails): + """Details of the managed disks. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar resource_group_id: Resource Group Id of the compute disks. Required. + :vartype resource_group_id: str + :ivar staging_storage_account_id: Resource Id of the storage account that can be used to copy + the vhd for staging. Required. + :vartype staging_storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "resource_group_id": {"required": True}, + "staging_storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "resource_group_id": {"key": "resourceGroupId", "type": "str"}, + "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, + } + + def __init__( + self, + *, + resource_group_id: str, + staging_storage_account_id: str, + share_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword resource_group_id: Resource Group Id of the compute disks. Required. + :paramtype resource_group_id: str + :keyword staging_storage_account_id: Resource Id of the storage account that can be used to + copy the vhd for staging. Required. + :paramtype staging_storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "ManagedDisk" + self.resource_group_id = resource_group_id + self.staging_storage_account_id = staging_storage_account_id + + +class MarkDevicesShippedRequest(_serialization.Model): + """The request body to provide the delivery package details of job. + + All required parameters must be populated in order to send to Azure. + + :ivar deliver_to_dc_package_details: Delivery package details. Required. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierInfo + """ + + _validation = { + "deliver_to_dc_package_details": {"required": True}, + } + + _attribute_map = { + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + } + + def __init__(self, *, deliver_to_dc_package_details: "_models.PackageCarrierInfo", **kwargs: Any) -> None: + """ + :keyword deliver_to_dc_package_details: Delivery package details. Required. + :paramtype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierInfo + """ + super().__init__(**kwargs) + self.deliver_to_dc_package_details = deliver_to_dc_package_details + + +class MitigateJobRequest(_serialization.Model): + """The Mitigate Job captured from request body for Mitigate API. + + :ivar customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution_code: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode + :ivar serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :vartype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + """ + + _attribute_map = { + "customer_resolution_code": {"key": "customerResolutionCode", "type": "str"}, + "serial_number_customer_resolution_map": {"key": "serialNumberCustomerResolutionMap", "type": "{str}"}, + } + + def __init__( + self, + *, + customer_resolution_code: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + serial_number_customer_resolution_map: Optional[Dict[str, Union[str, "_models.CustomerResolutionCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution_code: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode + :keyword serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :paramtype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2024_02_01_preview.models.CustomerResolutionCode] + """ + super().__init__(**kwargs) + self.customer_resolution_code = customer_resolution_code + self.serial_number_customer_resolution_map = serial_number_customer_resolution_map + + +class NotificationPreference(_serialization.Model): + """Notification preference for a job stage. + + All required parameters must be populated in order to send to Azure. + + :ivar stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :vartype stage_name: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.NotificationStageName + :ivar send_notification: Notification is required or not. + :vartype send_notification: bool + """ + + _validation = { + "stage_name": {"required": True}, + "send_notification": {"required": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "send_notification": {"key": "sendNotification", "type": "bool"}, + } + + def __init__( + self, *, stage_name: Union[str, "_models.NotificationStageName"], send_notification: bool = True, **kwargs: Any + ) -> None: + """ + :keyword stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :paramtype stage_name: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.NotificationStageName + :keyword send_notification: Notification is required or not. + :paramtype send_notification: bool + """ + super().__init__(**kwargs) + self.stage_name = stage_name + self.send_notification = send_notification + + +class Operation(_serialization.Model): + """Operation entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. Format: + {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :vartype name: str + :ivar display: Operation display values. + :vartype display: ~azure.mgmt.databox.v2024_02_01_preview.models.OperationDisplay + :ivar properties: Operation properties. + :vartype properties: JSON + :ivar origin: Origin of the operation. Can be : user|system|user,system. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + """ + + _validation = { + "name": {"readonly": True}, + "display": {"readonly": True}, + "properties": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "properties": {"key": "properties", "type": "object"}, + "origin": {"key": "origin", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + } + + def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ + super().__init__(**kwargs) + self.name = None + self.display = None + self.properties = None + self.origin = None + self.is_data_action = is_data_action + + +class OperationDisplay(_serialization.Model): + """Operation display. + + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str + :ivar operation: Localized name of the operation for display purpose. + :vartype operation: str + :ivar description: Localized description of the operation for display purpose. + :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: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + :keyword operation: Localized name of the operation for display purpose. + :paramtype operation: str + :keyword description: Localized description of the operation for display purpose. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(_serialization.Model): + """Operation Collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.Operation] + :ivar next_link: Link for the next set of operations. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of operations. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class PackageCarrierDetails(_serialization.Model): + """Package carrier details. + + :ivar carrier_account_number: Carrier Account Number of customer for customer disk. + :vartype carrier_account_number: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__( + self, + *, + carrier_account_number: Optional[str] = None, + carrier_name: Optional[str] = None, + tracking_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword carrier_account_number: Carrier Account Number of customer for customer disk. + :paramtype carrier_account_number: str + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_account_number = carrier_account_number + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageCarrierInfo(_serialization.Model): + """package carrier info. + + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, *, carrier_name: Optional[str] = None, tracking_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageShippingDetails(_serialization.Model): + """package shipping details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tracking_url: Url where shipment can be tracked. + :vartype tracking_url: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _validation = { + "tracking_url": {"readonly": True}, + "carrier_name": {"readonly": True}, + "tracking_id": {"readonly": True}, + } + + _attribute_map = { + "tracking_url": {"key": "trackingUrl", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tracking_url = None + self.carrier_name = None + self.tracking_id = None + + +class Preferences(_serialization.Model): + """Preferences related to the order. + + :ivar preferred_data_center_region: Preferred data center region. + :vartype preferred_data_center_region: list[str] + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + :ivar reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :vartype reverse_transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + :ivar encryption_preferences: Preferences related to the Encryption. + :vartype encryption_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.EncryptionPreferences + :ivar storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :vartype storage_account_access_tier_preferences: list[str] + """ + + _attribute_map = { + "preferred_data_center_region": {"key": "preferredDataCenterRegion", "type": "[str]"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + "reverse_transport_preferences": {"key": "reverseTransportPreferences", "type": "TransportPreferences"}, + "encryption_preferences": {"key": "encryptionPreferences", "type": "EncryptionPreferences"}, + "storage_account_access_tier_preferences": {"key": "storageAccountAccessTierPreferences", "type": "[str]"}, + } + + def __init__( + self, + *, + preferred_data_center_region: Optional[List[str]] = None, + transport_preferences: Optional["_models.TransportPreferences"] = None, + reverse_transport_preferences: Optional["_models.TransportPreferences"] = None, + encryption_preferences: Optional["_models.EncryptionPreferences"] = None, + storage_account_access_tier_preferences: Optional[List[Literal["Archive"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword preferred_data_center_region: Preferred data center region. + :paramtype preferred_data_center_region: list[str] + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + :keyword reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :paramtype reverse_transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + :keyword encryption_preferences: Preferences related to the Encryption. + :paramtype encryption_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.EncryptionPreferences + :keyword storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :paramtype storage_account_access_tier_preferences: list[str] + """ + super().__init__(**kwargs) + self.preferred_data_center_region = preferred_data_center_region + self.transport_preferences = transport_preferences + self.reverse_transport_preferences = reverse_transport_preferences + self.encryption_preferences = encryption_preferences + self.storage_account_access_tier_preferences = storage_account_access_tier_preferences + + +class PreferencesValidationRequest(ValidationInputRequest): + """Request to validate preference of transport and data center. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar preference: Preference of transport and data center. + :vartype preference: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "preference": {"key": "preference", "type": "Preferences"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + preference: Optional["_models.Preferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword preference: Preference of transport and data center. + :paramtype preference: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.preference = preference + self.device_type = device_type + + +class PreferencesValidationResponseProperties(ValidationInputResponse): + """Properties of data center and transport preference validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar status: Validation status of requested data center and transport. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.status = None + + +class RegionConfigurationRequest(_serialization.Model): + """Request body to get the configuration for the region. + + :ivar schedule_availability_request: Request body to get the availability for scheduling + orders. + :vartype schedule_availability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ScheduleAvailabilityRequest + :ivar transport_availability_request: Request body to get the transport availability for given + sku. + :vartype transport_availability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportAvailabilityRequest + :ivar datacenter_address_request: Request body to get the datacenter address for given sku. + :vartype datacenter_address_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressRequest + :ivar device_capability_request: Request body to get the device capabilities for a given sku. + :vartype device_capability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceCapabilityRequest + """ + + _attribute_map = { + "schedule_availability_request": {"key": "scheduleAvailabilityRequest", "type": "ScheduleAvailabilityRequest"}, + "transport_availability_request": { + "key": "transportAvailabilityRequest", + "type": "TransportAvailabilityRequest", + }, + "datacenter_address_request": {"key": "datacenterAddressRequest", "type": "DatacenterAddressRequest"}, + "device_capability_request": {"key": "deviceCapabilityRequest", "type": "DeviceCapabilityRequest"}, + } + + def __init__( + self, + *, + schedule_availability_request: Optional["_models.ScheduleAvailabilityRequest"] = None, + transport_availability_request: Optional["_models.TransportAvailabilityRequest"] = None, + datacenter_address_request: Optional["_models.DatacenterAddressRequest"] = None, + device_capability_request: Optional["_models.DeviceCapabilityRequest"] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_availability_request: Request body to get the availability for scheduling + orders. + :paramtype schedule_availability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ScheduleAvailabilityRequest + :keyword transport_availability_request: Request body to get the transport availability for + given sku. + :paramtype transport_availability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportAvailabilityRequest + :keyword datacenter_address_request: Request body to get the datacenter address for given sku. + :paramtype datacenter_address_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressRequest + :keyword device_capability_request: Request body to get the device capabilities for a given + sku. + :paramtype device_capability_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceCapabilityRequest + """ + super().__init__(**kwargs) + self.schedule_availability_request = schedule_availability_request + self.transport_availability_request = transport_availability_request + self.datacenter_address_request = datacenter_address_request + self.device_capability_request = device_capability_request + + +class RegionConfigurationResponse(_serialization.Model): + """Configuration response specific to a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar schedule_availability_response: Schedule availability for given sku in a region. + :vartype schedule_availability_response: + ~azure.mgmt.databox.v2024_02_01_preview.models.ScheduleAvailabilityResponse + :ivar transport_availability_response: Transport options available for given sku in a region. + :vartype transport_availability_response: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportAvailabilityResponse + :ivar datacenter_address_response: Datacenter address for given sku in a region. + :vartype datacenter_address_response: + ~azure.mgmt.databox.v2024_02_01_preview.models.DatacenterAddressResponse + :ivar device_capability_response: Device capabilities available for a given sku in a region. + :vartype device_capability_response: + ~azure.mgmt.databox.v2024_02_01_preview.models.DeviceCapabilityResponse + """ + + _validation = { + "schedule_availability_response": {"readonly": True}, + "transport_availability_response": {"readonly": True}, + "datacenter_address_response": {"readonly": True}, + "device_capability_response": {"readonly": True}, + } + + _attribute_map = { + "schedule_availability_response": { + "key": "scheduleAvailabilityResponse", + "type": "ScheduleAvailabilityResponse", + }, + "transport_availability_response": { + "key": "transportAvailabilityResponse", + "type": "TransportAvailabilityResponse", + }, + "datacenter_address_response": {"key": "datacenterAddressResponse", "type": "DatacenterAddressResponse"}, + "device_capability_response": {"key": "deviceCapabilityResponse", "type": "DeviceCapabilityResponse"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.schedule_availability_response = None + self.transport_availability_response = None + self.datacenter_address_response = None + self.device_capability_response = None + + +class ResourceIdentity(_serialization.Model): + """Msi identity details of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Identity type. + :vartype type: str + :ivar principal_id: Service Principal Id backing the Msi. + :vartype principal_id: str + :ivar tenant_id: Home Tenant Id. + :vartype tenant_id: str + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2024_02_01_preview.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: str = "None", + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Identity type. + :paramtype type: str + :keyword user_assigned_identities: User Assigned Identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2024_02_01_preview.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None + self.user_assigned_identities = user_assigned_identities + + +class ReverseShippingDetails(_serialization.Model): + """Reverse Shipping Address and contact details for a job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar contact_details: Contact Info. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactInfo + :ivar shipping_address: Shipping address where customer wishes to receive the device. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar is_updated: A flag to indicate whether Reverse Shipping details are updated or not after + device has been prepared. + Read only field. + :vartype is_updated: bool + """ + + _validation = { + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactInfo"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactInfo"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact Info. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactInfo + :keyword shipping_address: Shipping address where customer wishes to receive the device. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.is_updated = None + + +class ScheduleAvailabilityResponse(_serialization.Model): + """Schedule availability for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar available_dates: List of dates available to schedule. + :vartype available_dates: list[~datetime.datetime] + """ + + _validation = { + "available_dates": {"readonly": True}, + } + + _attribute_map = { + "available_dates": {"key": "availableDates", "type": "[iso-8601]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.available_dates = None + + +class ShareCredentialDetails(_serialization.Model): + """Credential details of the shares in account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar share_name: Name of the share. + :vartype share_name: str + :ivar share_type: Type of the share. Known values are: "UnknownType", "HCS", "BlockBlob", + "PageBlob", "AzureFile", and "ManagedDisk". + :vartype share_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ShareDestinationFormatType + :ivar user_name: User name for the share. + :vartype user_name: str + :ivar password: Password for the share. + :vartype password: str + :ivar supported_access_protocols: Access protocols supported on the device. + :vartype supported_access_protocols: list[str or + ~azure.mgmt.databox.v2024_02_01_preview.models.AccessProtocol] + """ + + _validation = { + "share_name": {"readonly": True}, + "share_type": {"readonly": True}, + "user_name": {"readonly": True}, + "password": {"readonly": True}, + "supported_access_protocols": {"readonly": True}, + } + + _attribute_map = { + "share_name": {"key": "shareName", "type": "str"}, + "share_type": {"key": "shareType", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "supported_access_protocols": {"key": "supportedAccessProtocols", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.share_name = None + self.share_type = None + self.user_name = None + self.password = None + self.supported_access_protocols = None + + +class ShipmentPickUpRequest(_serialization.Model): + """Shipment pick up request details. + + All required parameters must be populated in order to send to Azure. + + :ivar start_time: Minimum date after which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype end_time: ~datetime.datetime + :ivar shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :vartype shipment_location: str + """ + + _validation = { + "start_time": {"required": True}, + "end_time": {"required": True}, + "shipment_location": {"required": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "shipment_location": {"key": "shipmentLocation", "type": "str"}, + } + + def __init__( + self, *, start_time: datetime.datetime, end_time: datetime.datetime, shipment_location: str, **kwargs: Any + ) -> None: + """ + :keyword start_time: Minimum date after which the pick up should commence, this must be in + local time of pick up area. Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :paramtype end_time: ~datetime.datetime + :keyword shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :paramtype shipment_location: str + """ + super().__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.shipment_location = shipment_location + + +class ShipmentPickUpResponse(_serialization.Model): + """Shipment pick up response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confirmation_number: Confirmation number for the pick up request. + :vartype confirmation_number: str + :ivar ready_by_time: Time by which shipment should be ready for pick up, this is in local time + of pick up area. + :vartype ready_by_time: ~datetime.datetime + """ + + _validation = { + "confirmation_number": {"readonly": True}, + "ready_by_time": {"readonly": True}, + } + + _attribute_map = { + "confirmation_number": {"key": "confirmationNumber", "type": "str"}, + "ready_by_time": {"key": "readyByTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.confirmation_number = None + self.ready_by_time = None + + +class ShippingAddress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Shipping address where customer wishes to receive the device. + + All required parameters must be populated in order to send to Azure. + + :ivar street_address1: Street Address line 1. Required. + :vartype street_address1: str + :ivar street_address2: Street Address line 2. + :vartype street_address2: str + :ivar street_address3: Street Address line 3. + :vartype street_address3: str + :ivar city: Name of the City. + :vartype city: str + :ivar state_or_province: Name of the State or Province. + :vartype state_or_province: str + :ivar country: Name of the Country. Required. + :vartype country: str + :ivar postal_code: Postal code. + :vartype postal_code: str + :ivar zip_extended_code: Extended Zip Code. + :vartype zip_extended_code: str + :ivar company_name: Name of the company. + :vartype company_name: str + :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". + :vartype address_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.AddressType + :ivar skip_address_validation: Flag to indicate if customer has chosen to skip default address + validation. + :vartype skip_address_validation: bool + :ivar tax_identification_number: Tax Identification Number. + :vartype tax_identification_number: str + """ + + _validation = { + "street_address1": {"required": True}, + "country": {"required": True}, + } + + _attribute_map = { + "street_address1": {"key": "streetAddress1", "type": "str"}, + "street_address2": {"key": "streetAddress2", "type": "str"}, + "street_address3": {"key": "streetAddress3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state_or_province": {"key": "stateOrProvince", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "postal_code": {"key": "postalCode", "type": "str"}, + "zip_extended_code": {"key": "zipExtendedCode", "type": "str"}, + "company_name": {"key": "companyName", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "skip_address_validation": {"key": "skipAddressValidation", "type": "bool"}, + "tax_identification_number": {"key": "taxIdentificationNumber", "type": "str"}, + } + + def __init__( + self, + *, + street_address1: str, + country: str, + street_address2: Optional[str] = None, + street_address3: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + zip_extended_code: Optional[str] = None, + company_name: Optional[str] = None, + address_type: Union[str, "_models.AddressType"] = "None", + skip_address_validation: Optional[bool] = None, + tax_identification_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword street_address1: Street Address line 1. Required. + :paramtype street_address1: str + :keyword street_address2: Street Address line 2. + :paramtype street_address2: str + :keyword street_address3: Street Address line 3. + :paramtype street_address3: str + :keyword city: Name of the City. + :paramtype city: str + :keyword state_or_province: Name of the State or Province. + :paramtype state_or_province: str + :keyword country: Name of the Country. Required. + :paramtype country: str + :keyword postal_code: Postal code. + :paramtype postal_code: str + :keyword zip_extended_code: Extended Zip Code. + :paramtype zip_extended_code: str + :keyword company_name: Name of the company. + :paramtype company_name: str + :keyword address_type: Type of address. Known values are: "None", "Residential", and + "Commercial". + :paramtype address_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.AddressType + :keyword skip_address_validation: Flag to indicate if customer has chosen to skip default + address validation. + :paramtype skip_address_validation: bool + :keyword tax_identification_number: Tax Identification Number. + :paramtype tax_identification_number: str + """ + super().__init__(**kwargs) + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.street_address3 = street_address3 + self.city = city + self.state_or_province = state_or_province + self.country = country + self.postal_code = postal_code + self.zip_extended_code = zip_extended_code + self.company_name = company_name + self.address_type = address_type + self.skip_address_validation = skip_address_validation + self.tax_identification_number = tax_identification_number + + +class Sku(_serialization.Model): + """The Sku. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar display_name: The display name of the sku. + :vartype display_name: str + :ivar family: The sku family. + :vartype family: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + display_name: Optional[str] = None, + family: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :keyword display_name: The display name of the sku. + :paramtype display_name: str + :keyword family: The sku family. + :paramtype family: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.family = family + + +class SkuAvailabilityValidationRequest(ValidationInputRequest): + """Request to validate sku availability. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + **kwargs: Any + ) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.device_type = device_type + self.transfer_type = transfer_type + self.country = country + self.location = location + + +class SkuAvailabilityValidationResponseProperties(ValidationInputResponse): + """Properties of sku availability validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar status: Sku availability validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.status = None + + +class SkuCapacity(_serialization.Model): + """Capacity of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar usable: Usable capacity in TB. + :vartype usable: str + :ivar maximum: Maximum capacity in TB. + :vartype maximum: str + """ + + _validation = { + "usable": {"readonly": True}, + "maximum": {"readonly": True}, + } + + _attribute_map = { + "usable": {"key": "usable", "type": "str"}, + "maximum": {"key": "maximum", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.usable = None + self.maximum = None + + +class SkuCost(_serialization.Model): + """Describes metadata for retrieving price info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar meter_id: Meter id of the Sku. + :vartype meter_id: str + :ivar meter_type: The type of the meter. + :vartype meter_type: str + :ivar multiplier: Multiplier specifies the region specific value to be multiplied with 1$ guid. + Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to + region. + :vartype multiplier: float + """ + + _validation = { + "meter_id": {"readonly": True}, + "meter_type": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "meter_id": {"key": "meterId", "type": "str"}, + "meter_type": {"key": "meterType", "type": "str"}, + "multiplier": {"key": "multiplier", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.meter_id = None + self.meter_type = None + self.multiplier = None + + +class SkuInformation(_serialization.Model): + """Information of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.databox.v2024_02_01_preview.models.Sku + :ivar enabled: The sku is enabled or not. + :vartype enabled: bool + :ivar data_location_to_service_location_map: The map of data location to service location. + :vartype data_location_to_service_location_map: + list[~azure.mgmt.databox.v2024_02_01_preview.models.DataLocationToServiceLocationMap] + :ivar capacity: Capacity of the Sku. + :vartype capacity: ~azure.mgmt.databox.v2024_02_01_preview.models.SkuCapacity + :ivar costs: Cost of the Sku. + :vartype costs: list[~azure.mgmt.databox.v2024_02_01_preview.models.SkuCost] + :ivar api_versions: Api versions that support this Sku. + :vartype api_versions: list[str] + :ivar disabled_reason: Reason why the Sku is disabled. Known values are: "None", "Country", + "Region", "Feature", "OfferType", and "NoSubscriptionInfo". + :vartype disabled_reason: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.SkuDisabledReason + :ivar disabled_reason_message: Message for why the Sku is disabled. + :vartype disabled_reason_message: str + :ivar required_feature: Required feature to access the sku. + :vartype required_feature: str + :ivar countries_within_commerce_boundary: List of all the Countries in the SKU specific + commerce boundary. + :vartype countries_within_commerce_boundary: list[str] + """ + + _validation = { + "sku": {"readonly": True}, + "enabled": {"readonly": True}, + "data_location_to_service_location_map": {"readonly": True}, + "capacity": {"readonly": True}, + "costs": {"readonly": True}, + "api_versions": {"readonly": True}, + "disabled_reason": {"readonly": True}, + "disabled_reason_message": {"readonly": True}, + "required_feature": {"readonly": True}, + "countries_within_commerce_boundary": {"readonly": True}, + } + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "enabled": {"key": "enabled", "type": "bool"}, + "data_location_to_service_location_map": { + "key": "properties.dataLocationToServiceLocationMap", + "type": "[DataLocationToServiceLocationMap]", + }, + "capacity": {"key": "properties.capacity", "type": "SkuCapacity"}, + "costs": {"key": "properties.costs", "type": "[SkuCost]"}, + "api_versions": {"key": "properties.apiVersions", "type": "[str]"}, + "disabled_reason": {"key": "properties.disabledReason", "type": "str"}, + "disabled_reason_message": {"key": "properties.disabledReasonMessage", "type": "str"}, + "required_feature": {"key": "properties.requiredFeature", "type": "str"}, + "countries_within_commerce_boundary": {"key": "properties.countriesWithinCommerceBoundary", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku = None + self.enabled = None + self.data_location_to_service_location_map = None + self.capacity = None + self.costs = None + self.api_versions = None + self.disabled_reason = None + self.disabled_reason_message = None + self.required_feature = None + self.countries_within_commerce_boundary = None + + +class StorageAccountDetails(DataAccountDetails): + """Details for the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar storage_account_id: Storage Account Resource Id. Required. + :vartype storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__(self, *, storage_account_id: str, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword storage_account_id: Storage Account Resource Id. Required. + :paramtype storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "StorageAccount" + self.storage_account_id = storage_account_id + + +class SubscriptionIsAllowedToCreateJobValidationRequest(ValidationInputRequest): + """Request to validate subscription permission to create jobs. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + + +class SubscriptionIsAllowedToCreateJobValidationResponseProperties(ValidationInputResponse): + """Properties of subscription permission to create job validation response. + + 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 validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2024_02_01_preview.models.CloudError + :ivar status: Validation status of subscription permission to create job. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + self.status = None + + +class SystemData(_serialization.Model): + """Provides details about resource creation and update time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: A string identifier for the identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource: user, application, + managedIdentity. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: A string identifier for the identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource: user, + application, managedIdentity. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_by_type": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_by": {"readonly": True}, + "last_modified_by_type": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_by_type = None + self.created_at = None + self.last_modified_by = None + self.last_modified_by_type = None + self.last_modified_at = None + + +class TransferAllDetails(_serialization.Model): + """Details to transfer all data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :vartype transfer_all_blobs: bool + :ivar transfer_all_files: To indicate if all Azure Files have to be transferred. + :vartype transfer_all_files: bool + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "transfer_all_blobs": {"key": "transferAllBlobs", "type": "bool"}, + "transfer_all_files": {"key": "transferAllFiles", "type": "bool"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + transfer_all_blobs: Optional[bool] = None, + transfer_all_files: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :keyword transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :paramtype transfer_all_blobs: bool + :keyword transfer_all_files: To indicate if all Azure Files have to be transferred. + :paramtype transfer_all_files: bool + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.transfer_all_blobs = transfer_all_blobs + self.transfer_all_files = transfer_all_files + + +class TransferConfiguration(_serialization.Model): + """Configuration for defining the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :vartype transfer_configuration_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationType + :ivar transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :vartype transfer_filter_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationTransferFilterDetails + :ivar transfer_all_details: Map of filter type and the details to transfer all data. This field + is required only if the TransferConfigurationType is given as TransferAll. + :vartype transfer_all_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationTransferAllDetails + """ + + _validation = { + "transfer_configuration_type": {"required": True}, + } + + _attribute_map = { + "transfer_configuration_type": {"key": "transferConfigurationType", "type": "str"}, + "transfer_filter_details": { + "key": "transferFilterDetails", + "type": "TransferConfigurationTransferFilterDetails", + }, + "transfer_all_details": {"key": "transferAllDetails", "type": "TransferConfigurationTransferAllDetails"}, + } + + def __init__( + self, + *, + transfer_configuration_type: Union[str, "_models.TransferConfigurationType"], + transfer_filter_details: Optional["_models.TransferConfigurationTransferFilterDetails"] = None, + transfer_all_details: Optional["_models.TransferConfigurationTransferAllDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :paramtype transfer_configuration_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationType + :keyword transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :paramtype transfer_filter_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationTransferFilterDetails + :keyword transfer_all_details: Map of filter type and the details to transfer all data. This + field is required only if the TransferConfigurationType is given as TransferAll. + :paramtype transfer_all_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransferConfigurationTransferAllDetails + """ + super().__init__(**kwargs) + self.transfer_configuration_type = transfer_configuration_type + self.transfer_filter_details = transfer_filter_details + self.transfer_all_details = transfer_all_details + + +class TransferConfigurationTransferAllDetails(_serialization.Model): + """Map of filter type and the details to transfer all data. This field is required only if the + TransferConfigurationType is given as TransferAll. + + :ivar include: Details to transfer all data. + :vartype include: ~azure.mgmt.databox.v2024_02_01_preview.models.TransferAllDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferAllDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferAllDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details to transfer all data. + :paramtype include: ~azure.mgmt.databox.v2024_02_01_preview.models.TransferAllDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferConfigurationTransferFilterDetails(_serialization.Model): + """Map of filter type and the details to filter. This field is required only if the + TransferConfigurationType is given as TransferUsingFilter. + + :ivar include: Details of the filtering the transfer of data. + :vartype include: ~azure.mgmt.databox.v2024_02_01_preview.models.TransferFilterDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferFilterDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferFilterDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details of the filtering the transfer of data. + :paramtype include: ~azure.mgmt.databox.v2024_02_01_preview.models.TransferFilterDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferFilterDetails(_serialization.Model): + """Details of the filtering the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :ivar blob_filter_details: Filter details to transfer blobs. + :vartype blob_filter_details: ~azure.mgmt.databox.v2024_02_01_preview.models.BlobFilterDetails + :ivar azure_file_filter_details: Filter details to transfer Azure files. + :vartype azure_file_filter_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.AzureFileFilterDetails + :ivar filter_file_details: Details of the filter files to be used for data transfer. + :vartype filter_file_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.FilterFileDetails] + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "blob_filter_details": {"key": "blobFilterDetails", "type": "BlobFilterDetails"}, + "azure_file_filter_details": {"key": "azureFileFilterDetails", "type": "AzureFileFilterDetails"}, + "filter_file_details": {"key": "filterFileDetails", "type": "[FilterFileDetails]"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + blob_filter_details: Optional["_models.BlobFilterDetails"] = None, + azure_file_filter_details: Optional["_models.AzureFileFilterDetails"] = None, + filter_file_details: Optional[List["_models.FilterFileDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.DataAccountType + :keyword blob_filter_details: Filter details to transfer blobs. + :paramtype blob_filter_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.BlobFilterDetails + :keyword azure_file_filter_details: Filter details to transfer Azure files. + :paramtype azure_file_filter_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.AzureFileFilterDetails + :keyword filter_file_details: Details of the filter files to be used for data transfer. + :paramtype filter_file_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.FilterFileDetails] + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.blob_filter_details = blob_filter_details + self.azure_file_filter_details = azure_file_filter_details + self.filter_file_details = filter_file_details + + +class TransportAvailabilityDetails(_serialization.Model): + """Transport options availability details for given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar shipment_type: Transport Shipment Type supported for given region. Known values are: + "CustomerManaged" and "MicrosoftManaged". + :vartype shipment_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportShipmentTypes + """ + + _validation = { + "shipment_type": {"readonly": True}, + } + + _attribute_map = { + "shipment_type": {"key": "shipmentType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shipment_type = None + + +class TransportAvailabilityRequest(_serialization.Model): + """Request body to get the transport availability for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class TransportAvailabilityResponse(_serialization.Model): + """Transport options available for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar transport_availability_details: List of transport availability details for given region. + :vartype transport_availability_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.TransportAvailabilityDetails] + """ + + _validation = { + "transport_availability_details": {"readonly": True}, + } + + _attribute_map = { + "transport_availability_details": { + "key": "transportAvailabilityDetails", + "type": "[TransportAvailabilityDetails]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.transport_availability_details = None + + +class TransportPreferences(_serialization.Model): + """Preferences related to the shipment logistics of the sku. + + 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 preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. + Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :vartype preferred_shipment_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportShipmentTypes + :ivar is_updated: Read only property which indicates whether transport preferences has been + updated or not after device is prepared. + :vartype is_updated: bool + """ + + _validation = { + "preferred_shipment_type": {"required": True}, + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "preferred_shipment_type": {"key": "preferredShipmentType", "type": "str"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__(self, *, preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], **kwargs: Any) -> None: + """ + :keyword preferred_shipment_type: Indicates Shipment Logistics type that the customer + preferred. Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :paramtype preferred_shipment_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportShipmentTypes + """ + super().__init__(**kwargs) + self.preferred_shipment_type = preferred_shipment_type + self.is_updated = None + + +class UnencryptedCredentials(_serialization.Model): + """Unencrypted credentials for accessing device. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_name: Name of the job. + :vartype job_name: str + :ivar job_secrets: Secrets related to this job. + :vartype job_secrets: ~azure.mgmt.databox.v2024_02_01_preview.models.JobSecrets + """ + + _validation = { + "job_name": {"readonly": True}, + "job_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_name": {"key": "jobName", "type": "str"}, + "job_secrets": {"key": "jobSecrets", "type": "JobSecrets"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_name = None + self.job_secrets = None + + +class UnencryptedCredentialsList(_serialization.Model): + """List of unencrypted credentials for accessing device. + + :ivar value: List of unencrypted credentials. + :vartype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.UnencryptedCredentials] + :ivar next_link: Link for the next set of unencrypted credentials. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[UnencryptedCredentials]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.UnencryptedCredentials"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of unencrypted credentials. + :paramtype value: list[~azure.mgmt.databox.v2024_02_01_preview.models.UnencryptedCredentials] + :keyword next_link: Link for the next set of unencrypted credentials. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateJobDetails(_serialization.Model): + """Job details for update. + + :ivar contact_details: Contact details for notification and shipping. + :vartype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :ivar preferences: Preferences related to the order. + :vartype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :ivar key_encryption_key: Key encryption key for the job. + :vartype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :ivar return_to_customer_package_details: Return package details of job. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierDetails + """ + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactDetails"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + preferences: Optional["_models.Preferences"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + return_to_customer_package_details: Optional["_models.PackageCarrierDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. + :paramtype contact_details: ~azure.mgmt.databox.v2024_02_01_preview.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.ReverseShippingDetails + :keyword preferences: Preferences related to the order. + :paramtype preferences: ~azure.mgmt.databox.v2024_02_01_preview.models.Preferences + :keyword key_encryption_key: Key encryption key for the job. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2024_02_01_preview.models.KeyEncryptionKey + :keyword return_to_customer_package_details: Return package details of job. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2024_02_01_preview.models.PackageCarrierDetails + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.reverse_shipping_details = reverse_shipping_details + self.preferences = preferences + self.key_encryption_key = key_encryption_key + self.return_to_customer_package_details = return_to_customer_package_details + + +class UserAssignedIdentity(_serialization.Model): + """Class defining User assigned identity details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedProperties(_serialization.Model): + """User assigned identity properties. + + :ivar resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ValidateAddress(ValidationInputRequest): + """The requirements to validate customer address where the device needs to be shipped. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputDiscriminator + :ivar shipping_address: Shipping address of the customer. Required. + :vartype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + """ + + _validation = { + "validation_type": {"required": True}, + "shipping_address": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + } + + def __init__( + self, + *, + shipping_address: "_models.ShippingAddress", + device_type: Union[str, "_models.SkuName"], + transport_preferences: Optional["_models.TransportPreferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword shipping_address: Shipping address of the customer. Required. + :paramtype shipping_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ShippingAddress + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2024_02_01_preview.models.SkuName + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: + ~azure.mgmt.databox.v2024_02_01_preview.models.TransportPreferences + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.shipping_address = shipping_address + self.device_type = device_type + self.transport_preferences = transport_preferences + + +class ValidationResponse(_serialization.Model): + """Response of pre job creation validations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Overall validation status. Known values are: "AllValidToProceed", + "InputsRevisitRequired", and "CertainInputValidationsSkipped". + :vartype status: str or ~azure.mgmt.databox.v2024_02_01_preview.models.OverallValidationStatus + :ivar individual_response_details: List of response details contain validationType and its + response as key and value respectively. + :vartype individual_response_details: + list[~azure.mgmt.databox.v2024_02_01_preview.models.ValidationInputResponse] + """ + + _validation = { + "status": {"readonly": True}, + "individual_response_details": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "properties.status", "type": "str"}, + "individual_response_details": { + "key": "properties.individualResponseDetails", + "type": "[ValidationInputResponse]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.individual_response_details = None diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +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", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..f4a562057ec1 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_data_box_management_client_operations.py @@ -0,0 +1,220 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_mitigate_request(job_name: str, resource_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-02-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.DataBox/jobs/{jobName}/mitigate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2024_02_01_preview.models.MitigateJobRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2024-02-01-preview") + ) + 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(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_jobs_operations.py new file mode 100644 index 000000000000..e36d88f54c4f --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_jobs_operations.py @@ -0,0 +1,1777 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(subscription_id: str, *, skip_token: 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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mark_devices_shipped_request( + job_name: str, resource_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-02-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.DataBox/jobs/{jobName}/markDevicesShipped", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, skip_token: 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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, job_name: str, subscription_id: str, *, 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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_create_request(resource_group_name: str, job_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-02-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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_delete_request(resource_group_name: str, job_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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_update_request( + resource_group_name: str, job_name: str, subscription_id: str, *, if_match: 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-02-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.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_book_shipment_pick_up_request( + resource_group_name: str, job_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-02-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.DataBox/jobs/{jobName}/bookShipmentPickUp", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_cancel_request(resource_group_name: str, job_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-02-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.DataBox/jobs/{jobName}/cancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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_credentials_request( + resource_group_name: str, job_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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _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 JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + 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(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResourceList] = 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_token=skip_token, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + } + + @distributed_trace + def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: 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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2024_02_01_preview.models.JobResource 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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_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._api_version or "2024-02-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, 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")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2024_02_01_preview.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2024_02_01_preview.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :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 JobResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2024_02_01_preview.models.JobResource] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = 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, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpRequest + :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: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2024_02_01_preview.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2024_02_01_preview.models.CancellationReason or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + 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(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> Iterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.UnencryptedCredentials] + :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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.UnencryptedCredentialsList] = 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_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UnencryptedCredentialsList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_operations.py new file mode 100644 index 000000000000..f6336bd00596 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_operations.py @@ -0,0 +1,158 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +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(**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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataBox/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.DataBoxManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.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._api_version or "2024-02-01-preview") + ) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_service_operations.py new file mode 100644 index 000000000000..45f0842da740 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/operations/_service_operations.py @@ -0,0 +1,1103 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_available_skus_by_resource_group_request( + resource_group_name: str, location: 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-02-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.DataBox/locations/{location}/availableSkus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_address_request(location: 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-02-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}/providers/Microsoft.DataBox/locations/{location}/validateAddress", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_by_resource_group_request( + resource_group_name: str, location: 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-02-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.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_validate_inputs_request(location: 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-02-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}/providers/Microsoft.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_request(location: 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-02-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}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_region_configuration_by_resource_group_request( + resource_group_name: str, location: 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-02-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.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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 ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2024_02_01_preview.DataBoxManagementClient`'s + :attr:`service` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2024_02_01_preview.models.AvailableSkuRequest + :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: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2024_02_01_preview.models.AvailableSkuRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2024_02_01_preview.models.SkuInformation] + :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._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 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(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableSkusResult", 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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidateAddress + :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: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest + :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: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest + :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: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2024_02_01_preview.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2024-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.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.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/py.typed b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2024_02_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py index c4588de66fd2..56d0113f24a3 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/AvailableSkusPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/AvailableSkusPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py index 3697bce7c2f2..4f9a37d1834e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/BookShipmentPickupPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/BookShipmentPickupPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py b/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py index 39455180d133..14c6c83e749e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py @@ -29,16 +29,15 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.mitigate( + client.mitigate( job_name="TestJobName1", resource_group_name="YourResourceGroupName", mitigate_job_request={ "serialNumberCustomerResolutionMap": {"testDISK-1": "MoveToCleanUpDevice", "testDISK-2": "Resume"} }, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobMitigate.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobMitigate.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py index 0ae513ad4aa2..308c58a9370c 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py @@ -29,14 +29,13 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.cancel( + client.jobs.cancel( resource_group_name="YourResourceGroupName", job_name="TestJobName1", cancellation_reason={"reason": "CancelTest"}, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCancelPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCancelPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py index 20cb83a9f5d9..333246279358 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreate.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreate.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py index ddd499355079..a2979c351ebd 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py @@ -72,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateDevicePassword.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateDevicePassword.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py index 43586c612591..c0ba58c63de0 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py @@ -71,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateDoubleEncryption.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateDoubleEncryption.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py index 92987af5a6e4..95f6c1ce1541 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py @@ -80,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateExport.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateExport.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py index 6e4301c4c4bb..448979de3be8 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateWithUserAssignedIdentity.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateWithUserAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py index 6997b47fc00a..2af60ffddf8d 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.begin_delete( + client.jobs.begin_delete( resource_group_name="YourResourceGroupName", job_name="TestJobName1", ).result() - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsDelete.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsDelete.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py index 7ed67a69e020..d91cbf2b3d1e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGet.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGet.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py index dac4fa5bba6e..27acbe1ea3aa 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCmk.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetCmk.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py index 5b6ce0ce8e76..6fb24c0ac250 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCopyStuck.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetCopyStuck.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py index 0ba9e91d7282..a26f8534c559 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetExport.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetExport.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py index d956ffd5ba43..af6cfd74663a 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetWaitingForAction.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetWaitingForAction.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py index 6383e85a5241..6c1faafb5891 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsList.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsList.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py index 6a1bccb019af..d01a65fc2d9e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsListByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py index e6b3f7b96590..253d60f8fa4e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsListCredentials.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsListCredentials.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py index 28decddc681b..62503396f824 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatch.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatch.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py index 4f3bdc733e4e..06fed0d9582e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatchCmk.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatchCmk.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py index 541841f60102..2749a2413a75 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatchSystemAssignedToUserAssigned.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatchSystemAssignedToUserAssigned.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py b/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py index 47c2c0c4b5d6..3716d0e6d49f 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py @@ -29,16 +29,15 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.mark_devices_shipped( + client.jobs.mark_devices_shipped( job_name="TestJobName1", resource_group_name="YourResourceGroupName", mark_devices_shipped_request={ "deliverToDcPackageDetails": {"carrierName": "testCarrier", "trackingId": "000000"} }, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/MarkDevicesShipped.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/MarkDevicesShipped.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py b/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py index 9ba275ad01b6..c459996d7199 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/OperationsGet.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/OperationsGet.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py index 487f53271c87..0cd96ecc9e9e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/RegionConfiguration.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/RegionConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py index 0063055d826d..a3519e926323 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/RegionConfigurationByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/RegionConfigurationByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py index 8d10ddf0e5c3..f0b197cf4ea1 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateAddressPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateAddressPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py index ec4bfbf97a5f..3422be65a32b 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py @@ -82,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateInputs.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateInputs.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py index 4b6613759a8b..8d2580c0d664 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py @@ -83,6 +83,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateInputsByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateInputsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json b/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json index 109800da4c8a..70c26e4ae5f6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json +++ b/sdk/databoxedge/azure-mgmt-databoxedge/_meta.json @@ -1,11 +1,21 @@ { - "commit": "f1180941e238bc99ac71f9535ecd126bb8b77d8f", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/databoxedge/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.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/databoxedge/resource-manager/readme.md" + "autorest_command": "autorest specification/databoxedge/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/databoxedge/resource-manager/readme.md", + "package-2022-03-01": "2022-04-18 06:37:29 +0300 5575aeff7364faef03c26a3661e1e64a6bb693a7 Microsoft.DataBoxEdge/stable/2022-03-01/databoxedge.json", + "package-2021-02-01": "2021-08-13 01:54:29 +0530 3b7f6403c2b2295b993cdfe8c033dff9619d8f13 Microsoft.DataBoxEdge/stable/2021-02-01/databoxedge.json", + "package-2021-02-01-preview": "2021-05-06 14:45:54 +0530 6266d33e5c87cfa38dc12b7ff33c594f4cc32f1e Microsoft.DataBoxEdge/preview/2021-02-01-preview/databoxedge.json", + "package-2020-12-01": "2021-02-24 10:24:29 +0530 8577daaf7e174e49904f89ae6478281289dc2860 Microsoft.DataBoxEdge/stable/2020-12-01/databoxedge.json", + "package-2020-09-01-preview": "2021-02-03 13:35:54 +0530 fbd281068937dcf905cb4a87a1c1a40646819bb4 Microsoft.DataBoxEdge/preview/2020-09-01-preview/databoxedge.json", + "package-2020-09-01": "2021-02-03 13:35:54 +0530 fbd281068937dcf905cb4a87a1c1a40646819bb4 Microsoft.DataBoxEdge/preview/2020-09-01-preview/databoxedge.json", + "package-2020-05-preview": "2020-11-03 10:36:22 +0530 ced4891d7f95a4ee3a83e14b5c8abcf2122d9856 Microsoft.DataBoxEdge/preview/2020-05-01-preview/databoxedge.json", + "package-2019-08": "2020-03-11 15:41:00 +0800 4032896969cbaec08c6438972fbb08ac309b0967 Microsoft.DataBoxEdge/stable/2019-08-01/databoxedge.json", + "package-2019-07": "2019-09-18 22:45:44 -0400 cd39848a8a35a212d8e3e7f18b9b6dfd43ee6cdc Microsoft.DataBoxEdge/stable/2019-07-01/databoxedge.json", + "package-2019-03": "2019-09-18 22:45:44 -0400 cd39848a8a35a212d8e3e7f18b9b6dfd43ee6cdc Microsoft.DataBoxEdge/stable/2019-03-01/databoxedge.json" } \ No newline at end of file diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py index 8087afc4f257..5dc077557e83 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_data_box_edge_management_client.py @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxEdgeManagementClient, self).__init__( @@ -157,7 +159,7 @@ def addons(self): else: raise ValueError("API version {} does not have operation group 'addons'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts(self): @@ -198,7 +200,7 @@ def alerts(self): else: raise ValueError("API version {} does not have operation group 'alerts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def available_skus(self): @@ -230,7 +232,7 @@ def available_skus(self): else: raise ValueError("API version {} does not have operation group 'available_skus'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def bandwidth_schedules(self): @@ -271,7 +273,7 @@ def bandwidth_schedules(self): else: raise ValueError("API version {} does not have operation group 'bandwidth_schedules'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def containers(self): @@ -306,7 +308,7 @@ def containers(self): else: raise ValueError("API version {} does not have operation group 'containers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_capacity_check(self): @@ -320,7 +322,7 @@ def device_capacity_check(self): else: raise ValueError("API version {} does not have operation group 'device_capacity_check'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_capacity_info(self): @@ -334,7 +336,7 @@ def device_capacity_info(self): else: raise ValueError("API version {} does not have operation group 'device_capacity_info'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def devices(self): @@ -375,7 +377,7 @@ def devices(self): else: raise ValueError("API version {} does not have operation group 'devices'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def diagnostic_settings(self): @@ -392,7 +394,7 @@ def diagnostic_settings(self): else: raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def jobs(self): @@ -433,7 +435,7 @@ def jobs(self): else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def monitoring_config(self): @@ -462,7 +464,7 @@ def monitoring_config(self): else: raise ValueError("API version {} does not have operation group 'monitoring_config'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def nodes(self): @@ -500,7 +502,7 @@ def nodes(self): else: raise ValueError("API version {} does not have operation group 'nodes'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -541,7 +543,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations_status(self): @@ -582,7 +584,7 @@ def operations_status(self): else: raise ValueError("API version {} does not have operation group 'operations_status'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def orders(self): @@ -623,7 +625,7 @@ def orders(self): else: raise ValueError("API version {} does not have operation group 'orders'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def roles(self): @@ -664,7 +666,7 @@ def roles(self): else: raise ValueError("API version {} does not have operation group 'roles'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def shares(self): @@ -705,7 +707,7 @@ def shares(self): else: raise ValueError("API version {} does not have operation group 'shares'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def skus(self): @@ -722,7 +724,7 @@ def skus(self): else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def storage_account_credentials(self): @@ -763,7 +765,7 @@ def storage_account_credentials(self): else: raise ValueError("API version {} does not have operation group 'storage_account_credentials'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def storage_accounts(self): @@ -798,7 +800,7 @@ def storage_accounts(self): else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def support_packages(self): @@ -815,7 +817,7 @@ def support_packages(self): else: raise ValueError("API version {} does not have operation group 'support_packages'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def triggers(self): @@ -856,7 +858,7 @@ def triggers(self): else: raise ValueError("API version {} does not have operation group 'triggers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def users(self): @@ -897,7 +899,7 @@ def users(self): else: raise ValueError("API version {} does not have operation group 'users'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_serialization.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_serialization.py index 25467dfc00bb..a00658b1fc19 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_serialization.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/_serialization.py @@ -631,7 +631,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -664,8 +664,9 @@ 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)) @@ -743,6 +744,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,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 str(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) @@ -893,6 +894,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): @@ -905,9 +908,18 @@ 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) @@ -952,7 +964,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: @@ -1273,7 +1287,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1297,7 +1311,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py index 3b93a7b5bb9c..54ea9156787a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/aio/_data_box_edge_management_client.py @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxEdgeManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxEdgeManagementClient, self).__init__( @@ -157,7 +159,7 @@ def addons(self): else: raise ValueError("API version {} does not have operation group 'addons'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts(self): @@ -198,7 +200,7 @@ def alerts(self): else: raise ValueError("API version {} does not have operation group 'alerts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def available_skus(self): @@ -230,7 +232,7 @@ def available_skus(self): else: raise ValueError("API version {} does not have operation group 'available_skus'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def bandwidth_schedules(self): @@ -271,7 +273,7 @@ def bandwidth_schedules(self): else: raise ValueError("API version {} does not have operation group 'bandwidth_schedules'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def containers(self): @@ -306,7 +308,7 @@ def containers(self): else: raise ValueError("API version {} does not have operation group 'containers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_capacity_check(self): @@ -320,7 +322,7 @@ def device_capacity_check(self): else: raise ValueError("API version {} does not have operation group 'device_capacity_check'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_capacity_info(self): @@ -334,7 +336,7 @@ def device_capacity_info(self): else: raise ValueError("API version {} does not have operation group 'device_capacity_info'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def devices(self): @@ -375,7 +377,7 @@ def devices(self): else: raise ValueError("API version {} does not have operation group 'devices'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def diagnostic_settings(self): @@ -392,7 +394,7 @@ def diagnostic_settings(self): else: raise ValueError("API version {} does not have operation group 'diagnostic_settings'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def jobs(self): @@ -433,7 +435,7 @@ def jobs(self): else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def monitoring_config(self): @@ -462,7 +464,7 @@ def monitoring_config(self): else: raise ValueError("API version {} does not have operation group 'monitoring_config'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def nodes(self): @@ -500,7 +502,7 @@ def nodes(self): else: raise ValueError("API version {} does not have operation group 'nodes'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -541,7 +543,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations_status(self): @@ -582,7 +584,7 @@ def operations_status(self): else: raise ValueError("API version {} does not have operation group 'operations_status'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def orders(self): @@ -623,7 +625,7 @@ def orders(self): else: raise ValueError("API version {} does not have operation group 'orders'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def roles(self): @@ -664,7 +666,7 @@ def roles(self): else: raise ValueError("API version {} does not have operation group 'roles'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def shares(self): @@ -705,7 +707,7 @@ def shares(self): else: raise ValueError("API version {} does not have operation group 'shares'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def skus(self): @@ -722,7 +724,7 @@ def skus(self): else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def storage_account_credentials(self): @@ -763,7 +765,7 @@ def storage_account_credentials(self): else: raise ValueError("API version {} does not have operation group 'storage_account_credentials'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def storage_accounts(self): @@ -798,7 +800,7 @@ def storage_accounts(self): else: raise ValueError("API version {} does not have operation group 'storage_accounts'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def support_packages(self): @@ -815,7 +817,7 @@ def support_packages(self): else: raise ValueError("API version {} does not have operation group 'support_packages'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def triggers(self): @@ -856,7 +858,7 @@ def triggers(self): else: raise ValueError("API version {} does not have operation group 'triggers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def users(self): @@ -897,7 +899,7 @@ def users(self): else: raise ValueError("API version {} does not have operation group 'users'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py index b37be176840f..8ef0ec6a6ee7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", "2019-03-01") + api_version: str = kwargs.pop("api_version", "2019-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py index a1a7dfb43472..a57298e0894e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_data_box_edge_management_client.py @@ -88,30 +88,30 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py index 895a4ca23feb..87face011abb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", "2019-03-01") + api_version: str = kwargs.pop("api_version", "2019-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py index 82b1df291823..680cf51d2d77 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/_data_box_edge_management_client.py @@ -88,30 +88,30 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-03-01" ) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py index de66519adc09..edb64c6ca07c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py index f08bf5d64af3..a853f10c58f0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py index a9c70e8bc328..2c879bf1b44a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -48,10 +48,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +70,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -94,7 +91,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -147,8 +144,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -239,8 +237,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,7 +279,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -295,8 +294,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,14 +334,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -361,8 +361,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,7 +492,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +551,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -565,8 +566,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -605,7 +607,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -735,14 +737,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -762,8 +764,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,7 +800,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -812,8 +815,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +860,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -922,7 +926,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -937,8 +941,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -972,7 +977,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -987,8 +992,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1031,7 +1037,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1097,7 +1103,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1112,8 +1118,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1147,7 +1154,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1162,8 +1169,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1206,7 +1214,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1264,14 +1272,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1291,8 +1299,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1411,7 +1420,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1484,7 +1493,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1499,8 +1508,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1610,14 +1620,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1637,8 +1647,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py index 5c0d5ed5d4b0..54842a071447 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py index 106461df749b..315c63eceb96 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py index dc4e04c618d3..f95d3b36886d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py index 467c21810205..c96521fa8ceb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -198,8 +196,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,14 +232,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,7 +388,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -447,7 +447,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -462,8 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,7 +505,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py index 21bc02f365bc..99cf2d171410 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py index 13a871b9c79a..945f0c48ba1d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py index 7b21b494d8de..96b0fc7e4250 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py index af8f42cb6d29..d9d8e45b76ae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py index 31f99415487b..c4cb78599db0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py index afb6a34f270e..098634b6dfe6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py index ac185ecde80d..9c360e71864e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py index e20fb082da8e..339ae81721c6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -409,7 +405,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -428,7 +424,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +438,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -505,6 +501,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -525,7 +522,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -578,8 +575,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,7 +614,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -670,8 +668,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,7 +710,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -726,8 +725,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -765,14 +765,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -792,8 +792,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,7 +923,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -981,7 +982,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -996,8 +997,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +1038,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1166,14 +1168,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1193,8 +1195,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1228,7 +1231,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1243,8 +1246,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1285,7 +1289,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1351,7 +1355,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1366,8 +1370,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1401,7 +1406,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1416,8 +1421,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1458,7 +1464,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1524,7 +1530,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1539,8 +1545,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1574,7 +1581,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1589,8 +1596,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1631,7 +1639,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1689,14 +1697,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1716,8 +1724,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1836,7 +1845,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -1907,7 +1916,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1922,8 +1931,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2033,14 +2043,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2060,8 +2070,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py index 807a5e26f983..6cdd8a98a670 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py index fd221114327e..58de92fc43e8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py index 3fff1713d538..e211b535f912 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py index 9b70e30cd929..5227feae9aac 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -186,6 +182,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -207,7 +204,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -261,8 +258,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,7 +302,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -319,8 +317,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,14 +353,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -381,8 +380,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +509,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -568,7 +568,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -583,8 +583,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +626,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py index e4b4ff75b8cf..ef486fcbbcbc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py index 6a2f7c20eabe..15f3b943ad91 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py index c4dbe76e8aaf..62d6ac52450e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py index 474cc80df503..992b11d7d084 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py index 2165c4284080..cb2e05290157 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_03_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py index 54b3124084ea..71c8f73d103c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", "2019-07-01") + api_version: str = kwargs.pop("api_version", "2019-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py index a5858a46295a..2f7a5090dc10 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_data_box_edge_management_client.py @@ -91,31 +91,31 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py index c9147a3552a6..3d34b0999d3b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", "2019-07-01") + api_version: str = kwargs.pop("api_version", "2019-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py index eb6aea29f042..b675f3bfc966 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/_data_box_edge_management_client.py @@ -91,31 +91,31 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-07-01" ) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-07-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py index 785ba507d43b..ca9194f7f51d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py index 8792b2b90367..428d1b9a0810 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py index 596860e3a4ed..002e5e285f97 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -48,10 +48,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +70,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -94,7 +91,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -147,8 +144,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -239,8 +237,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,7 +279,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -295,8 +294,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,14 +334,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -361,8 +361,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,7 +492,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +551,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -565,8 +566,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -605,7 +607,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -735,14 +737,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -762,8 +764,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,7 +800,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -812,8 +815,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +860,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -922,7 +926,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -937,8 +941,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -972,7 +977,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -987,8 +992,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1031,7 +1037,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1097,7 +1103,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1112,8 +1118,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1147,7 +1154,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1162,8 +1169,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1206,7 +1214,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1264,14 +1272,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1291,8 +1299,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1411,7 +1420,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1484,7 +1493,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1499,8 +1508,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1610,14 +1620,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1637,8 +1647,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py index b500599009ee..019409632696 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py index 665f0ef166af..0a0617e3212e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py index b8762962f715..1274d8357b7b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py index de3a6247add8..56f983d2f0ad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py index af02e0455780..f271fe5e982c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -198,8 +196,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,14 +232,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,7 +388,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -447,7 +447,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -462,8 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,7 +505,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py index c6e88eb61165..63aee317a956 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py index ece2478244e1..d71f60a239a8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py index c6d31e4843f6..14a8a253f3ac 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py index 634be883ebbd..11e240db9634 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py index 3f65f8eea56f..b7220567d172 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,7 +392,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -452,7 +452,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -468,8 +468,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,7 +513,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py index f9c5b259958e..7d821219d596 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py index d1ba38bb7f77..de216a9cb0a1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py index 9706ea6f50ad..de7fa1c4d21f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -409,7 +405,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -428,7 +424,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +438,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -505,6 +501,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -525,7 +522,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -578,8 +575,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,7 +614,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -670,8 +668,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,7 +710,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -726,8 +725,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -765,14 +765,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -792,8 +792,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,7 +923,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -981,7 +982,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -996,8 +997,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +1038,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1166,14 +1168,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1193,8 +1195,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1228,7 +1231,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1243,8 +1246,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1285,7 +1289,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1351,7 +1355,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1366,8 +1370,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1401,7 +1406,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1416,8 +1421,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1458,7 +1464,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1524,7 +1530,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1539,8 +1545,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1574,7 +1581,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1589,8 +1596,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1631,7 +1639,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1689,14 +1697,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1716,8 +1724,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1836,7 +1845,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -1907,7 +1916,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1922,8 +1931,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2033,14 +2043,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2060,8 +2070,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py index d7cb90ad1eea..6db6d2ea1f9e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py index 67dbc6a72d6b..cf739cf74c0a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py index 2c6194dd63a1..7cf68e2feb02 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py index 3d7e36ca1253..503c371c8c91 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py index aabea19c2c52..b3203f376335 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -186,6 +182,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -207,7 +204,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -261,8 +258,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,7 +302,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -319,8 +317,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,14 +353,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -381,8 +380,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +509,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -568,7 +568,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -583,8 +583,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +626,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py index f24f091ed9df..fed7a4a7c75e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py index 6d0663a239d6..3f686ba77306 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py index 43c252ed988f..966332e55368 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py index 2ea0f1fc1cae..bc3c5475293a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py index b6b7b70ce667..7001e4b158c3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,7 +518,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -578,7 +578,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -594,8 +594,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -636,7 +637,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-07-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py index 3499033d150c..40b14622b7d7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") + api_version: str = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py index 256f046ed9c5..1465ff5d9eed 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_data_box_edge_management_client.py @@ -101,36 +101,38 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" + ) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py index 63ab5b2695d8..4b6f34637fb1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", "2019-08-01") + api_version: str = kwargs.pop("api_version", "2019-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py index 06821e28b772..c9ad8d6ea014 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/_data_box_edge_management_client.py @@ -101,36 +101,38 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" + ) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2019-08-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py index d98d4d65ba91..8ed27110dd31 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py index cb61a4eb95b6..94ad18d5b2d1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py index ff9843449082..59f1b65ad4d1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,7 +86,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,7 +191,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +208,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,14 +250,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -280,8 +279,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -496,7 +496,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -513,8 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +560,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -615,7 +616,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -632,8 +633,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,7 +682,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py index 37ad4954037c..9eba2c0a976e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -48,10 +48,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +70,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -94,7 +91,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -147,8 +144,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -239,8 +237,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,7 +279,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -295,8 +294,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,14 +334,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -361,8 +361,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,7 +492,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +551,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -565,8 +566,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -605,7 +607,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -735,14 +737,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -762,8 +764,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,7 +800,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -812,8 +815,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +860,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -922,7 +926,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -937,8 +941,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -972,7 +977,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -987,8 +992,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1031,7 +1037,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1097,7 +1103,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1112,8 +1118,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1147,7 +1154,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1162,8 +1169,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1206,7 +1214,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1264,14 +1272,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1291,8 +1299,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1411,7 +1420,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1484,7 +1493,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1499,8 +1508,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1610,14 +1620,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1637,8 +1647,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py index c3aa0ee42905..b1a2e2ef3dff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py index 855b975ac36b..51b372ceecb2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py index cb971267d45e..e4d56f4333f2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py index c768b8b95ee9..2c744bc06554 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py index 7c6f7dd81d46..4caf0640c474 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -198,8 +196,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,14 +232,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,7 +388,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -447,7 +447,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -462,8 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,7 +505,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py index 6bf9a872ec1c..76be22fbb7e0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py index 1f552c6cfb7f..08abdee111a8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py index 03c7f91a8f96..0d9ead794ef0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ResourceTypeSku"]: @@ -75,7 +71,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) error_map = { @@ -128,8 +124,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py index 742a3dedc395..f49605a93b54 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py index 5dbe2afb0536..44796b408877 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,14 +242,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +478,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +539,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py index f460cb24e4dc..434b9bd0cd5a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py index 65e781bfb0fe..28ef1764c492 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py index bcd50d54c199..b5887d0ecec3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py index fb4c8d39ff3b..6f866d5a0f00 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py index 268c8f29d2af..88200a21989a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -86,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +120,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -165,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,7 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -248,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -271,7 +268,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +323,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +373,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -392,8 +390,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,14 +432,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -462,8 +461,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +611,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -672,7 +672,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -689,8 +689,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,7 +736,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -791,7 +792,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -808,8 +809,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +858,7 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py index 019753c3aded..93834a93cd4e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -409,7 +405,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -428,7 +424,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +438,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -505,6 +501,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -525,7 +522,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -578,8 +575,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,7 +614,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -670,8 +668,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,7 +710,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -726,8 +725,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -765,14 +765,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -792,8 +792,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,7 +923,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -981,7 +982,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -996,8 +997,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +1038,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1166,14 +1168,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1193,8 +1195,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1228,7 +1231,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1243,8 +1246,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1285,7 +1289,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1351,7 +1355,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1366,8 +1370,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1401,7 +1406,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1416,8 +1421,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1458,7 +1464,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1524,7 +1530,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1539,8 +1545,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1574,7 +1581,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1589,8 +1596,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1631,7 +1639,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1689,14 +1697,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1716,8 +1724,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1836,7 +1845,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -1907,7 +1916,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1922,8 +1931,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2033,14 +2043,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2060,8 +2070,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py index 4b35c9b1a611..4d4bb06f9daa 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py index 73c544491897..3d7d6aad0ad7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py index f83f07e16a51..439fe5d35ca9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py index 70145acd95b2..4524d0f23444 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py index 2e5ab045d4b9..0ab2ee8e60da 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -186,6 +182,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -207,7 +204,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -261,8 +258,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,7 +302,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -319,8 +317,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,14 +353,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -381,8 +380,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +509,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -568,7 +568,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -583,8 +583,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +626,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py index 3124427cafdf..470bbd2e32da 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py index 530e47e47ec1..8c11223d7fca 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py index cbd54839c94e..659cd265951a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,6 +80,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ResourceTypeSku"]: @@ -104,7 +100,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) error_map = { @@ -157,8 +153,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py index 2c8baad9bbf3..0f83dbbb91ed 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py index 5527839d6f22..ee06c40e47dd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -212,7 +209,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -266,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +544,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -604,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -620,8 +620,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py index 14df809b0474..e3deb0236978 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py index 6a5b6061730f..fd89d98cbef2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,7 +524,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -584,7 +584,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -600,8 +600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,7 +643,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2019-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py index 8c4f29b6c9b4..b04b893f8141 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-05-01-preview"] = kwargs.pop("api_version", "2020-05-01-preview") + api_version: str = kwargs.pop("api_version", "2020-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py index 6fad1f8090eb..7467fc694494 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_data_box_edge_management_client.py @@ -105,37 +105,59 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py index 13994024d238..2c37cb4a9418 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-05-01-preview"] = kwargs.pop("api_version", "2020-05-01-preview") + api_version: str = kwargs.pop("api_version", "2020-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py index 6d6d0d9532bf..68a866a2ae13 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/_data_box_edge_management_client.py @@ -106,37 +106,59 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize, "2020-05-01-preview") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py index e324cf3218e3..86390a1673ad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,8 +73,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -133,8 +129,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,8 +175,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -196,8 +193,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py index bc4df060458f..8c3090b982b4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -126,8 +122,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py index 6e6e33810965..206af4fde9fc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,8 +183,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,8 +242,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -252,7 +251,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -273,8 +272,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,8 +414,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -476,8 +476,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,8 +539,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py index 73e4036ec364..82b4921a27f7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,8 +86,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -146,8 +143,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,8 +193,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -214,8 +212,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,8 +254,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -264,7 +263,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -286,8 +285,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,8 +441,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -504,8 +504,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -523,8 +523,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,8 +570,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -627,8 +628,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -646,8 +647,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -694,8 +696,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py index 4c2b2bf1b79c..b355b1ab1c0f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -48,10 +48,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +70,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -94,8 +91,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -149,8 +146,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,8 +185,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -243,8 +241,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,8 +283,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -301,8 +300,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,8 +340,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -349,7 +349,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -369,8 +369,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,8 +502,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -562,8 +563,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -579,8 +580,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -619,8 +621,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -752,8 +754,8 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -761,7 +763,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -781,8 +783,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -816,8 +819,8 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -833,8 +836,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -877,8 +881,8 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -945,8 +949,8 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -962,8 +966,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -997,8 +1002,8 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1014,8 +1019,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1058,8 +1064,8 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1126,8 +1132,8 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1143,8 +1149,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1178,8 +1185,8 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1195,8 +1202,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1239,8 +1247,8 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1299,8 +1307,8 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1308,7 +1316,7 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1328,8 +1336,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1449,8 +1458,8 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1524,8 +1533,8 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -1541,8 +1550,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1653,8 +1663,8 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -1662,7 +1672,7 @@ async def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1682,8 +1692,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py index e6169f67bb1f..3ffe1b032573 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py index 9ca24674655e..2d8c8140c7eb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,8 +72,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -132,8 +128,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py index 0d9118f3017d..62b111bccd5f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -125,8 +121,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py index 024c892f487c..a0aa8dada564 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py index 4530b052462f..f217b81c43f4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,8 +83,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,8 +183,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -202,8 +200,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,8 +236,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -246,7 +245,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -266,8 +265,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -397,8 +397,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -458,8 +458,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -475,8 +475,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,8 +518,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py index 2b83cfebb77e..3977b1ef33c4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,8 +181,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,8 +235,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -245,7 +244,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -266,8 +265,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,8 +398,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -460,8 +460,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -478,8 +478,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,8 +523,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py index 1cfc25483921..37a987e70882 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,8 +240,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -250,7 +249,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -409,8 +409,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -471,8 +471,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +534,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -590,8 +591,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -608,8 +609,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,8 +656,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py index eefa5e21def0..3909485b0333 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ResourceTypeSku"]: @@ -75,8 +71,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py index d3ee19ae8664..f8567d3fd894 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +245,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -255,7 +254,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -276,8 +275,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,8 +419,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -481,8 +481,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -499,8 +499,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,8 +544,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py index 130da335adff..ccd10152adb6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,8 +83,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,8 +246,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -256,7 +255,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -277,8 +276,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,8 +424,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -486,8 +486,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -504,8 +504,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +549,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py index a7ab36cb1202..96c53bde9dda 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,8 +185,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -205,8 +203,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,8 +239,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -249,7 +248,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,8 +405,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -467,8 +467,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -485,8 +485,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +530,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py index b4e61f75f791..decba43888f0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,8 +185,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -205,8 +203,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,8 +239,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -249,7 +248,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,8 +405,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -467,8 +467,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -485,8 +485,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +530,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py index 2e3d5bf20d54..1d5fef069e88 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -145,8 +137,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -201,8 +193,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +239,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -264,8 +257,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py index c72d6d2980c2..f1425b3fa372 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -101,8 +95,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -155,8 +149,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py index be7906655887..46dcc8baf350 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -219,8 +208,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -275,8 +264,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,8 +308,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -336,8 +326,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,8 +367,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -385,7 +376,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -406,8 +397,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,8 +539,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -609,8 +601,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -627,8 +619,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,8 +662,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py index 98b776f15a13..5a00bc517fbe 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -88,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -128,9 +120,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -171,9 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -211,9 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -258,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -282,8 +269,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -339,8 +326,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +376,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -407,8 +395,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,8 +437,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -457,7 +446,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -479,8 +468,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,8 +621,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -694,8 +684,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -713,8 +703,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +750,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -817,8 +808,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -836,8 +827,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,8 +876,8 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py index efa13f9f628b..743efa5a7730 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -81,9 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -146,9 +136,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -163,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -182,9 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -215,9 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -251,9 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -284,9 +266,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,7 +280,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -317,9 +297,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +311,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -350,9 +328,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,7 +342,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -383,9 +359,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,7 +373,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -416,9 +390,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -433,7 +405,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -452,9 +424,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -468,7 +438,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -485,9 +455,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -502,7 +470,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -533,6 +501,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -553,8 +522,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -608,8 +577,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -646,8 +616,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -702,8 +672,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -743,8 +714,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -760,8 +731,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -799,8 +771,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -808,7 +780,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -828,8 +800,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -960,8 +933,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1021,8 +994,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1038,8 +1011,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1078,8 +1052,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1211,8 +1185,8 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1220,7 +1194,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1240,8 +1214,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1275,8 +1250,8 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1292,8 +1267,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1334,8 +1310,8 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1402,8 +1378,8 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1419,8 +1395,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1454,8 +1431,8 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1471,8 +1448,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1513,8 +1491,8 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1581,8 +1559,8 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1598,8 +1576,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1633,8 +1612,8 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1650,8 +1629,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1692,8 +1672,8 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1752,8 +1732,8 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1761,7 +1741,7 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1781,8 +1761,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1902,8 +1883,8 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1975,8 +1956,8 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -1992,8 +1973,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2104,8 +2086,8 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -2113,7 +2095,7 @@ def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2133,8 +2115,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py index c7087c2e0bd2..e12dc101931d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py index 7bf689acce41..3df950a82116 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -92,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -111,8 +105,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -167,8 +161,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py index efed29b83ac0..15605046fc9c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -96,8 +90,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -149,8 +143,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py index c4176ef32525..ff5b5d9953e5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py index e228acba2503..f50d915bfb24 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,9 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -194,6 +182,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,8 +204,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -271,8 +260,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,8 +304,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -331,8 +321,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,8 +357,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -375,7 +366,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -395,8 +386,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,8 +515,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -584,8 +576,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -601,8 +593,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,8 +636,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py index 5b134070e853..a13811085353 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -218,8 +207,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -274,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,8 +307,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -335,8 +325,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,8 +361,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -379,7 +370,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -400,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +521,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -591,8 +583,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -609,8 +601,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,8 +644,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py index 065ee6302354..7dd05a4021e7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -187,9 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -233,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -254,8 +241,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -310,8 +297,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,8 +343,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -373,8 +361,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,8 +397,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -417,7 +406,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -438,8 +427,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,8 +563,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -635,8 +625,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -653,8 +643,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,8 +686,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -752,8 +743,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -770,8 +761,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,8 +806,8 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py index 518ec4b04b6b..4710f6021fc2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +49,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -87,6 +80,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ResourceTypeSku"]: @@ -106,8 +100,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) @@ -161,8 +155,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py index 97ea2f45b1ac..77b8be2bfd94 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -222,8 +211,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -278,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,8 +313,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -341,8 +331,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,8 +372,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -390,7 +381,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -411,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,8 +546,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -616,8 +608,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -634,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +669,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py index b82c19d06da0..de8f199511db 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -221,8 +210,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -277,8 +266,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,8 +373,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -391,7 +382,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -412,8 +403,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,8 +551,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -621,8 +613,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -639,8 +631,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,8 +676,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py index 46174680a4cf..1d4972a9a8c8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -224,8 +213,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,8 +368,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -386,7 +377,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -407,8 +398,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,8 +531,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -601,8 +593,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,8 +611,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,8 +654,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py index 4ac970773c40..90b38c0a6226 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_05_01_preview/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -223,8 +212,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -280,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,8 +313,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -341,8 +331,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,8 +367,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -385,7 +376,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -406,8 +397,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,8 +530,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -600,8 +592,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -618,8 +610,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -660,8 +653,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py index 57c81d6ea344..0673453a2105 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", "2020-09-01") + api_version: str = kwargs.pop("api_version", "2020-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py index 20bfbcf73e18..46ef610e9370 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_data_box_edge_management_client.py @@ -108,40 +108,44 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py index 938586b7fd4f..4a67a96e7b5d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", "2020-09-01") + api_version: str = kwargs.pop("api_version", "2020-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py index e50caf326bdf..5d776ba2ad09 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/_data_box_edge_management_client.py @@ -109,40 +109,44 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py index a307a29f8b9d..eadbd2034022 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,7 +83,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,7 +186,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +203,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,14 +245,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +479,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -496,8 +496,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +543,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py index 139d27b7189f..07ab0014637b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py index cb0cedcb97eb..2b38c562d833 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -124,8 +120,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py index 5a017d6e07c9..693ae9d6a865 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py index 9f5c7839bbea..80708ce1bd0e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,7 +86,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,7 +191,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +208,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,14 +250,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -280,8 +279,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -496,7 +496,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -513,8 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +560,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -615,7 +616,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -632,8 +633,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,7 +682,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py index 54c406e3b798..add7d2a4275b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,7 +93,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -149,8 +146,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -241,8 +239,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +281,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -297,8 +296,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -336,14 +336,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -363,8 +363,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +494,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -552,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -567,8 +568,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,7 +609,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -737,14 +739,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -764,8 +766,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -799,7 +802,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -814,8 +817,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -858,7 +862,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -924,7 +928,7 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -939,8 +943,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -986,7 +991,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1001,8 +1006,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +1042,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1051,8 +1057,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1095,7 +1102,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1161,7 +1168,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1176,8 +1183,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1211,7 +1219,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1226,8 +1234,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1270,7 +1279,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1328,14 +1337,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1355,8 +1364,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1475,7 +1485,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1609,14 +1619,14 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1636,8 +1646,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1687,7 +1698,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1702,8 +1713,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1813,14 +1825,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1840,8 +1852,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py index 6dc125683737..61302d1ad533 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py index 74a512350ba6..21baa8eb65be 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,7 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +189,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,14 +246,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +424,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -484,7 +484,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -500,8 +500,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +547,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py index 1f34712d7b54..7b751da03eef 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py index f01852d951f0..2169e2dcce48 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py index 39903118a68d..b8a729451815 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py index 2155f98320f6..e61772b84948 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +182,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,14 +233,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -261,8 +260,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -448,7 +448,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -463,8 +463,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,7 +506,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -573,7 +574,7 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -588,8 +589,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py index d431568d22bc..2f8b927de0ec 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py index 9a65468d7ad8..ab38d2ff4ea7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py index a02f78ee83e0..5b61bc7bf16b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py index cc7dbf740a8b..ce467fec0c06 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,14 +242,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +478,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +539,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py index 7cc4365e63df..cf430b39f2a4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py index e7bf40468445..a1cde792b626 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -88,7 +85,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -397,7 +397,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -457,7 +457,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -473,8 +473,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,7 +518,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py index 59e1980965e9..eea5f94a82f2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -195,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -216,7 +213,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -271,8 +268,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +316,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,14 +375,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -405,8 +404,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +548,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -609,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -626,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +673,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py index 936f78d0f59d..434ed9cceaae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py index e3d63cf8a60c..214f21333e45 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -98,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -150,8 +146,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py index 5a84a1422bb0..2ea31317adfb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py index 55081e0dfeb6..08193bf5f436 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -86,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +120,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -165,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,7 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -248,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -271,7 +268,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +323,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +373,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -392,8 +390,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,14 +432,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -462,8 +461,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +611,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -672,7 +672,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -689,8 +689,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,7 +736,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -791,7 +792,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -808,8 +809,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +858,7 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py index f74b98acbad3..aa311e74ae97 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -425,7 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -440,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -493,7 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -507,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -524,7 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -539,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -570,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -590,7 +587,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -643,8 +640,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +679,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -735,8 +733,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +775,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -791,8 +790,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -830,14 +830,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -857,8 +857,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -987,7 +988,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1046,7 +1047,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1061,8 +1062,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1101,7 +1103,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1231,14 +1233,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1258,8 +1260,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1293,7 +1296,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1308,8 +1311,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1354,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1416,7 +1420,7 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -1431,8 +1435,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1478,7 +1483,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1493,8 +1498,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1528,7 +1534,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1543,8 +1549,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1585,7 +1592,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1651,7 +1658,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1666,8 +1673,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1701,7 +1709,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1716,8 +1724,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1758,7 +1767,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -1816,14 +1825,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1843,8 +1852,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1963,7 +1973,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -2097,14 +2107,14 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2124,8 +2134,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2173,7 +2184,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -2188,8 +2199,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2299,14 +2311,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2326,8 +2338,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py index 9f4a3ba6b200..8086e0ef33d3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py index 2b7c233904d3..05d19df0fb67 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,7 +109,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -148,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -192,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -217,7 +214,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -272,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +317,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,14 +374,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -403,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,7 +552,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -612,7 +612,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -628,8 +628,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +675,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py index 70aebbec51d4..c36c3e730a93 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py index 6548f2c2fa65..9e6acf791294 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py index dcb700b8c2ac..460c93f52311 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py index 804d5550c685..8a2231060b9c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -217,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -238,7 +235,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -292,8 +289,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,7 +333,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -350,8 +348,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,14 +384,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -412,8 +411,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -599,7 +599,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -614,8 +614,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,7 +657,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -722,7 +723,7 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -737,8 +738,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py index 10b978cc9532..655c1951bd44 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py index 05ea7e4a8504..cc9004d70c39 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py index ea61e0c736a2..9f3478280f50 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py index 82820cb9940c..5bccc07f53e8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -212,7 +209,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -266,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +544,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -604,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -620,8 +620,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py index cf82c41bcd7f..10917cf39691 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py index 7c87700a55da..ee4b8c09f91d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -216,7 +213,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -271,8 +268,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,7 +312,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -330,8 +328,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -365,14 +364,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -393,8 +392,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +525,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -585,7 +585,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -601,8 +601,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -643,7 +644,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py index ce4180438f5f..650b853592ec 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-09-01-preview"] = kwargs.pop("api_version", "2020-09-01-preview") + api_version: str = kwargs.pop("api_version", "2020-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py index 54750a238900..3456e8f9dade 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_data_box_edge_management_client.py @@ -109,40 +109,64 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py index 8ef9ab424133..63564c4210ce 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-09-01-preview"] = kwargs.pop("api_version", "2020-09-01-preview") + api_version: str = kwargs.pop("api_version", "2020-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py index 33fc308b1ca3..d608bbc4527e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/_data_box_edge_management_client.py @@ -110,40 +110,64 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-09-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py index 825fc26a0a16..5420a45aa214 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,8 +83,8 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,8 +188,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -209,8 +207,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,8 +249,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) @@ -259,7 +258,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -281,8 +280,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,8 +427,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -490,8 +490,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -509,8 +509,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -555,8 +556,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py index aeb113b13902..f981f827be68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,8 +73,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -133,8 +129,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,8 +175,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -196,8 +193,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py index e403a1fc33d9..214d8e8a6be3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -126,8 +122,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py index 7518afb5f846..e02859e89f34 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,8 +183,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,8 +242,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -252,7 +251,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -273,8 +272,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,8 +414,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -476,8 +476,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,8 +539,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py index c680077cc163..66febd49a569 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,8 +86,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -146,8 +143,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,8 +193,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -214,8 +212,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,8 +254,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -264,7 +263,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -286,8 +285,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,8 +441,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -504,8 +504,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -523,8 +523,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,8 +570,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -627,8 +628,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -646,8 +647,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -694,8 +696,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py index 9789344de1e3..615a0f6b098a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,8 +93,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -151,8 +148,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +187,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -245,8 +243,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,8 +285,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -303,8 +302,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,8 +342,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -351,7 +351,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -371,8 +371,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,8 +504,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -564,8 +565,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -581,8 +582,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -621,8 +623,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -754,8 +756,8 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -763,7 +765,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -783,8 +785,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,8 +821,8 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -835,8 +838,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -879,8 +883,8 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -947,8 +951,8 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) @@ -964,8 +968,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1011,8 +1016,8 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1028,8 +1033,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1063,8 +1069,8 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1080,8 +1086,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1124,8 +1131,8 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1192,8 +1199,8 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1209,8 +1216,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1244,8 +1252,8 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1261,8 +1269,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1305,8 +1314,8 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1365,8 +1374,8 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1374,7 +1383,7 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1394,8 +1403,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1515,8 +1525,8 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1652,8 +1662,8 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1661,7 +1671,7 @@ async def update_extended_information( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1681,8 +1691,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1732,8 +1743,8 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -1749,8 +1760,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1861,8 +1873,8 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -1870,7 +1882,7 @@ async def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1890,8 +1902,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py index 06d42c81baa5..662c91ead5c8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py index d2e4d6261c02..4996d0598024 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,8 +86,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) @@ -146,8 +143,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,8 +191,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -211,8 +209,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,8 +250,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) @@ -260,7 +259,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -281,8 +280,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,8 +430,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -492,8 +492,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -510,8 +510,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,8 +557,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py index f15f579c68cd..bd12f46361a1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,8 +72,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -132,8 +128,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py index 1c4fa9db5ce8..b1f4c027c9ad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -125,8 +121,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py index 1cc4290be3d7..1641d4aa5e0c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py index 28c3d18691bf..9ce4354c361e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,8 +184,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -203,8 +201,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,8 +237,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -247,7 +246,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,8 +398,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -459,8 +459,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,8 +519,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -588,8 +589,8 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) @@ -605,8 +606,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py index d21d4250d812..ca2652043081 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,8 +181,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,8 +235,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -245,7 +244,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -266,8 +265,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,8 +398,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -460,8 +460,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -478,8 +478,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,8 +523,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py index bd0feef78bfd..7dfbdb8e70d0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,8 +240,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -250,7 +249,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -409,8 +409,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -471,8 +471,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +534,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -590,8 +591,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -608,8 +609,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,8 +656,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py index 83af09dda345..ba00249c0563 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +245,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -255,7 +254,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -276,8 +275,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,8 +419,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -481,8 +481,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -499,8 +499,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,8 +544,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py index 1849231c08de..944f6ced58ef 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,8 +83,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,8 +246,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -256,7 +255,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -277,8 +276,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,8 +424,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -486,8 +486,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -504,8 +504,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +549,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py index bb946b972ff1..28ed066f82d5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,8 +185,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -205,8 +203,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,8 +239,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -249,7 +248,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,8 +405,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -467,8 +467,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -485,8 +485,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +530,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py index dd64db41f7e1..103fc0b36c5e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -88,8 +85,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -145,8 +142,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,8 +240,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -250,7 +249,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,8 +406,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -468,8 +468,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -486,8 +486,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,8 +531,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py index 5613874d2bc4..04c77b8f499c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -83,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -137,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -156,9 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -224,8 +213,8 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,8 +318,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -347,8 +337,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +379,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) @@ -397,7 +388,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -419,8 +410,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -562,8 +554,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -625,8 +617,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -644,8 +636,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,8 +683,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py index b243a79cbe86..a6febe78aa93 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -145,8 +137,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -201,8 +193,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +239,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -264,8 +257,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py index 3781d0ad7b3c..755b540674ae 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -101,8 +95,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -155,8 +149,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py index 5983cc6b8cc3..066b2a632190 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -219,8 +208,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -275,8 +264,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,8 +308,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -336,8 +326,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,8 +367,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -385,7 +376,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -406,8 +397,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,8 +539,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -609,8 +601,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -627,8 +619,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,8 +662,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py index 29bcaa48471e..17065b8ded69 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -88,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -128,9 +120,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -171,9 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -211,9 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -258,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -282,8 +269,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -339,8 +326,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +376,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -407,8 +395,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,8 +437,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -457,7 +446,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -479,8 +468,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,8 +621,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -694,8 +684,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -713,8 +703,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +750,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -817,8 +808,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -836,8 +827,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,8 +876,8 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py index 52320d359455..7e52b072c879 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -81,9 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -146,9 +136,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -163,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -182,9 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -215,9 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -251,9 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -284,9 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -317,9 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -350,9 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -383,9 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -416,9 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -449,9 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -466,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -485,9 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -502,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -521,9 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -554,9 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -571,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -602,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -622,8 +587,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -677,8 +642,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -715,8 +681,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -771,8 +737,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -812,8 +779,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -829,8 +796,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -868,8 +836,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -877,7 +845,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -897,8 +865,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1029,8 +998,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1090,8 +1059,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1107,8 +1076,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1147,8 +1117,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1280,8 +1250,8 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1289,7 +1259,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1309,8 +1279,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1344,8 +1315,8 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1361,8 +1332,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1403,8 +1375,8 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1471,8 +1443,8 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) @@ -1488,8 +1460,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1535,8 +1508,8 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1552,8 +1525,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1587,8 +1561,8 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1604,8 +1578,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1646,8 +1621,8 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1714,8 +1689,8 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1731,8 +1706,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1766,8 +1742,8 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1783,8 +1759,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1825,8 +1802,8 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1885,8 +1862,8 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1894,7 +1871,7 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1914,8 +1891,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2035,8 +2013,8 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2172,8 +2150,8 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -2181,7 +2159,7 @@ def update_extended_information( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2201,8 +2179,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2250,8 +2229,8 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -2267,8 +2246,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2379,8 +2359,8 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -2388,7 +2368,7 @@ def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2408,8 +2388,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py index a1c173f0a84f..2547b5a01ade 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py index cf1ac1adb46e..9af4f8b35c5c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -83,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,9 +109,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -154,9 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -200,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -225,8 +214,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) @@ -282,8 +271,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,8 +319,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -347,8 +337,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,8 +378,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) @@ -396,7 +387,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -417,8 +408,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,8 +558,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -628,8 +620,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -646,8 +638,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,8 +685,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py index 0fb4eba4bf89..92c376a7390d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -92,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -111,8 +105,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -167,8 +161,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py index 0fcde06ab8df..436c14debe66 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -96,8 +90,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -149,8 +143,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py index 491e7dd92f1b..dc007a59fc51 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py index 0027939c3843..170507f7c6c0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,9 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -182,9 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -227,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -248,8 +235,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -304,8 +291,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,8 +335,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -364,8 +352,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -399,8 +388,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -408,7 +397,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -428,8 +417,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,8 +546,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -617,8 +607,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -634,8 +624,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +667,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -744,8 +735,8 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) @@ -761,8 +752,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py index 63065b8116ab..5594eb3432b7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -218,8 +207,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -274,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,8 +307,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -335,8 +325,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,8 +361,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -379,7 +370,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -400,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +521,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -591,8 +583,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -609,8 +601,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,8 +644,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py index c38812dfcfcf..5a7039869693 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -187,9 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -233,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -254,8 +241,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -310,8 +297,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,8 +343,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -373,8 +361,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,8 +397,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -417,7 +406,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -438,8 +427,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,8 +563,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -635,8 +625,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -653,8 +643,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,8 +686,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -752,8 +743,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -770,8 +761,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,8 +806,8 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py index ae2c921cb129..3d6730c17022 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -222,8 +211,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -278,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,8 +313,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -341,8 +331,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,8 +372,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -390,7 +381,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -411,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,8 +546,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -616,8 +608,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -634,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +669,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py index 263d0ce2a5ee..8b3601901968 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -221,8 +210,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -277,8 +266,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,8 +373,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -391,7 +382,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -412,8 +403,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,8 +551,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -621,8 +613,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -639,8 +631,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,8 +676,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py index f5aa33095b24..f7c928206cd6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -224,8 +213,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,8 +368,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -386,7 +377,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -407,8 +398,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,8 +531,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -601,8 +593,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,8 +611,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,8 +654,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py index af9ecf9d42f4..0c92d29fcc4a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01_preview/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -224,8 +213,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,8 +368,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -386,7 +377,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -407,8 +398,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,8 +531,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -601,8 +593,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,8 +611,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,8 +654,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-09-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_configuration.py index cc696fd00723..746d07532005 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", "2020-12-01") + api_version: str = kwargs.pop("api_version", "2020-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_data_box_edge_management_client.py index b9c0f49b4e8a..aa5c2bfbccf6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_data_box_edge_management_client.py @@ -108,40 +108,44 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_configuration.py index d33ce3bc3cc5..3feb84bccddf 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", "2020-12-01") + api_version: str = kwargs.pop("api_version", "2020-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_data_box_edge_management_client.py index 43513c6831b7..c05a04fd5dc4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/_data_box_edge_management_client.py @@ -109,40 +109,44 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-12-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2020-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_addons_operations.py index cecad63102eb..6f21a0b57713 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,7 +83,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,7 +186,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +203,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,14 +245,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +479,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -496,8 +496,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +543,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_alerts_operations.py index c42190ed2676..7926693cfc93 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_available_skus_operations.py index 0826a62bcda6..f382626587e5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -124,8 +120,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_bandwidth_schedules_operations.py index e12c61f89590..79f07bfcee83 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_containers_operations.py index 3ba73a3f3f60..b33d1117b420 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,7 +86,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,7 +191,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +208,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,14 +250,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -280,8 +279,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -496,7 +496,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -513,8 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +560,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -615,7 +616,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -632,8 +633,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,7 +682,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_devices_operations.py index f0cb808d4645..711fb20d4322 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,7 +93,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -149,8 +146,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -241,8 +239,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +281,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -297,8 +296,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -336,14 +336,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -363,8 +363,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +494,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -552,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -567,8 +568,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,7 +609,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -737,14 +739,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -764,8 +766,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -799,7 +802,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -814,8 +817,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -858,7 +862,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -924,7 +928,7 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -939,8 +943,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -986,7 +991,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1001,8 +1006,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +1042,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1051,8 +1057,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1095,7 +1102,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1161,7 +1168,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1176,8 +1183,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1211,7 +1219,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1226,8 +1234,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1270,7 +1279,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1328,14 +1337,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1355,8 +1364,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1475,7 +1485,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1609,14 +1619,14 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1636,8 +1646,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1687,7 +1698,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1702,8 +1713,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1813,14 +1825,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1840,8 +1852,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_jobs_operations.py index 068d4465b3fe..444b2207a1b6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_monitoring_config_operations.py index bd26e0d2ef93..56d96a124822 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,7 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +189,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,14 +246,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +424,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -484,7 +484,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -500,8 +500,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +547,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_nodes_operations.py index 09aa348995b8..48aef49c40da 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations.py index 64982550fa50..4817690292bf 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations_status_operations.py index 5319127829b8..a406dd12b735 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_orders_operations.py index 9df4e4c5ce02..c5f01cdc45a2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +182,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,14 +233,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -261,8 +260,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -448,7 +448,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -463,8 +463,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,7 +506,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -573,7 +574,7 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -588,8 +589,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_roles_operations.py index 4308a8be1963..0bf89ff4f1ad 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_shares_operations.py index bfec806ac90b..e84316601a19 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_account_credentials_operations.py index 9b43273f0567..af59c06d6ca3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_accounts_operations.py index 775866a5cf78..b07a090610c4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,14 +242,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +478,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +539,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_triggers_operations.py index 155fd69235ab..b1d50fb5b790 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_users_operations.py index 8d9420feb9f0..848876c62115 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_addons_operations.py index 1da772836e52..9f5882bb6473 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -195,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -216,7 +213,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -271,8 +268,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +316,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,14 +375,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -405,8 +404,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +548,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -609,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -626,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +673,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_alerts_operations.py index bde4f5d128b8..17bb16abe7c5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_available_skus_operations.py index c67d704686a6..392584144f65 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -98,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -150,8 +146,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_bandwidth_schedules_operations.py index 5a7d099e98ab..fa928a6fe697 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_containers_operations.py index 7b1ba2720eff..18a7f547b10e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -86,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +120,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -165,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,7 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -248,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -271,7 +268,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +323,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +373,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -392,8 +390,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,14 +432,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -462,8 +461,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +611,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -672,7 +672,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -689,8 +689,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,7 +736,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -791,7 +792,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -808,8 +809,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +858,7 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_devices_operations.py index 7319a605ed53..057db155a922 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -425,7 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -440,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -493,7 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -507,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -524,7 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -539,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -570,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -590,7 +587,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -643,8 +640,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +679,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -735,8 +733,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +775,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -791,8 +790,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -830,14 +830,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -857,8 +857,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -987,7 +988,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1046,7 +1047,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1061,8 +1062,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1101,7 +1103,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1231,14 +1233,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1258,8 +1260,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1293,7 +1296,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1308,8 +1311,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1350,7 +1354,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1416,7 +1420,7 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -1431,8 +1435,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1478,7 +1483,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1493,8 +1498,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1528,7 +1534,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1543,8 +1549,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1585,7 +1592,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1651,7 +1658,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1666,8 +1673,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1701,7 +1709,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1716,8 +1724,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1758,7 +1767,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -1816,14 +1825,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1843,8 +1852,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1963,7 +1973,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -2097,14 +2107,14 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2124,8 +2134,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2173,7 +2184,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -2188,8 +2199,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2299,14 +2311,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2326,8 +2338,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_jobs_operations.py index ceec4b71b497..24d0ee82cde2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_monitoring_config_operations.py index 3bf9d1dcb415..dd6f9a488d16 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,7 +109,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -148,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -192,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -217,7 +214,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -272,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +317,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,14 +374,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -403,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,7 +552,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -612,7 +612,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -628,8 +628,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +675,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_nodes_operations.py index 6fbebb0e31da..9cb766cc7abc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations.py index bdbbbe9cfa94..de0aaeb127af 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations_status_operations.py index 52dc13e7cb98..426a0725b683 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_orders_operations.py index ec1d60afbdf1..e8b8fb36acf7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -217,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -238,7 +235,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -292,8 +289,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,7 +333,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -350,8 +348,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,14 +384,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -412,8 +411,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -599,7 +599,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -614,8 +614,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,7 +657,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -722,7 +723,7 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -737,8 +738,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_roles_operations.py index 602d5a9cee1e..1f91273e1ff5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_shares_operations.py index c4ac42e5d5af..e63d6b898611 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_account_credentials_operations.py index aca6596fca7b..3f6f328c3495 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_accounts_operations.py index 19824c393d05..85b39a4fd577 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -212,7 +209,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -266,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +544,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -604,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -620,8 +620,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_triggers_operations.py index 339d7d4bb502..a3b17a18becb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_users_operations.py index 702eae8f6416..0ec1490f262e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_12_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,7 +524,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -584,7 +584,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -600,8 +600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,7 +643,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py index 7bee31156957..b956857ad061 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", "2021-02-01") + api_version: str = kwargs.pop("api_version", "2021-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py index f18bca7da53b..e49cd1a7da78 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_data_box_edge_management_client.py @@ -116,46 +116,50 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.support_packages = SupportPackagesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py index 1946c0d7bf79..f925fcb11ceb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", "2021-02-01") + api_version: str = kwargs.pop("api_version", "2021-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py index faf8c55900e6..9a51972e651b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/_data_box_edge_management_client.py @@ -117,46 +117,50 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") self.support_packages = SupportPackagesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01" ) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py index a0c942863cb6..01be1010102d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,7 +83,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,7 +186,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +203,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,14 +245,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +479,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -496,8 +496,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +543,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py index a24b30fbf45b..de9c06b68041 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py index 0650410139e3..26919a88cb69 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -124,8 +120,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py index ed287939104b..1ab38eda9899 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py index 5cd6ef20b5d3..a1b8e2c7021a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,7 +86,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,7 +191,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +208,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,14 +250,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -280,8 +279,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -496,7 +496,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -513,8 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +560,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -615,7 +616,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -632,8 +633,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,7 +682,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py index 3b5fd81dccd8..dbf63858abb3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,7 +93,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -149,8 +146,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -241,8 +239,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +281,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -297,8 +296,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,14 +408,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -435,8 +435,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +471,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -485,8 +486,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +527,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -655,14 +657,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -682,8 +684,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,7 +720,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -732,8 +735,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +780,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -842,7 +846,7 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -857,8 +861,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -904,7 +909,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -919,8 +924,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -954,7 +960,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -969,8 +975,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,7 +1020,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1079,7 +1086,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1094,8 +1101,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1129,7 +1137,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1144,8 +1152,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1188,7 +1197,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1246,14 +1255,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1273,8 +1282,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1393,7 +1403,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1527,14 +1537,14 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1554,8 +1564,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1605,7 +1616,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1620,8 +1631,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1731,14 +1743,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1758,8 +1770,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py index ade5786650cc..220031d2ca48 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_diagnostic_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -35,10 +35,6 @@ build_update_diagnostic_remote_support_settings_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +57,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get_diagnostic_proactive_log_collection_settings( @@ -89,7 +86,7 @@ async def get_diagnostic_proactive_log_collection_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_proactive_log_collection_settings_request( @@ -104,8 +101,9 @@ async def get_diagnostic_proactive_log_collection_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,14 +141,14 @@ async def _update_diagnostic_proactive_log_collection_settings_initial( # pylin _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(proactive_log_collection_settings, (IO, bytes)): + if isinstance(proactive_log_collection_settings, (IOBase, bytes)): _content = proactive_log_collection_settings else: _json = self._serialize.body(proactive_log_collection_settings, "DiagnosticProactiveLogCollectionSettings") @@ -170,8 +168,9 @@ async def _update_diagnostic_proactive_log_collection_settings_initial( # pylin 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -292,7 +291,7 @@ async def begin_update_diagnostic_proactive_log_collection_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -362,7 +361,7 @@ async def get_diagnostic_remote_support_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_remote_support_settings_request( @@ -377,8 +376,9 @@ async def get_diagnostic_remote_support_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,14 +416,14 @@ async def _update_diagnostic_remote_support_settings_initial( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(diagnostic_remote_support_settings, (IO, bytes)): + if isinstance(diagnostic_remote_support_settings, (IOBase, bytes)): _content = diagnostic_remote_support_settings else: _json = self._serialize.body(diagnostic_remote_support_settings, "DiagnosticRemoteSupportSettings") @@ -443,8 +443,9 @@ async def _update_diagnostic_remote_support_settings_initial( # pylint: disable 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,7 +566,7 @@ async def begin_update_diagnostic_remote_support_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py index 8dd5f82482b8..6f61a869e198 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py index 3bd4102eaa44..aa392ff10e33 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,7 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +189,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,14 +246,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +424,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -484,7 +484,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -500,8 +500,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +547,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py index 046de870727e..24dddd4c419f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py index 2e9f671a5e57..dde3846d4867 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py index bfcc8b2779ac..2c173f0254c3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py index f29cfb99464e..b2a482f6dbdd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +182,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,14 +233,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -261,8 +260,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -448,7 +448,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -463,8 +463,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,7 +506,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -573,7 +574,7 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -588,8 +589,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py index 1fed968a8637..81d8f6acd0ba 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py index 6f029304af5d..243fac0114d4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py index 05d271625606..deb84a44c8ab 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py index 2046d04d6224..8b96146c51bd 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,14 +242,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +478,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +539,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py index 675f0baa7332..f62315024328 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_support_packages_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._support_packages_operations import build_trigger_support_package_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _trigger_support_package_initial( # pylint: disable=inconsistent-return-statements self, @@ -75,14 +72,14 @@ async def _trigger_support_package_initial( # pylint: disable=inconsistent-retu _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(trigger_support_package_request, (IO, bytes)): + if isinstance(trigger_support_package_request, (IOBase, bytes)): _content = trigger_support_package_request else: _json = self._serialize.body(trigger_support_package_request, "TriggerSupportPackageRequest") @@ -102,8 +99,9 @@ async def _trigger_support_package_initial( # pylint: disable=inconsistent-retu 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,7 +228,7 @@ async def begin_trigger_support_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py index 440a6030f265..2def85c8b6c2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py index fbfccf4a55c6..dc242e2047f6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py index 9d8c78362f0f..1f2077c7a1fb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -195,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -216,7 +213,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -271,8 +268,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +316,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,14 +375,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -405,8 +404,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +548,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -609,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -626,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +673,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py index 5c2632ea46f6..bf8490ddd293 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py index a677f6082635..5eaee089e08e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -98,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -150,8 +146,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py index 29c10874b650..25aa9121f48c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py index a91e01396e17..5abe0503a24e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -86,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +120,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -165,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,7 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -248,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -271,7 +268,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +323,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +373,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -392,8 +390,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,14 +432,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -462,8 +461,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +611,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -672,7 +672,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -689,8 +689,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,7 +736,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -791,7 +792,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -808,8 +809,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +858,7 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py index d5802fac87b3..685a9c302783 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -425,7 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -440,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -493,7 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -507,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -524,7 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -539,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -570,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -590,7 +587,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -643,8 +640,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +679,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -735,8 +733,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +775,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -791,8 +790,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -902,14 +902,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -929,8 +929,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -964,7 +965,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -979,8 +980,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,7 +1021,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1149,14 +1151,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1176,8 +1178,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1211,7 +1214,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1226,8 +1229,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1268,7 +1272,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1334,7 +1338,7 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -1349,8 +1353,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1396,7 +1401,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1411,8 +1416,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1446,7 +1452,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1461,8 +1467,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1503,7 +1510,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1569,7 +1576,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1584,8 +1591,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1619,7 +1627,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1634,8 +1642,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1676,7 +1685,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -1734,14 +1743,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1761,8 +1770,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1881,7 +1891,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -2015,14 +2025,14 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2042,8 +2052,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2091,7 +2102,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -2106,8 +2117,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2217,14 +2229,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2244,8 +2256,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py index 5614c20d32dc..946c24fbcaac 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_diagnostic_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_get_diagnostic_proactive_log_collection_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +57,7 @@ def build_get_diagnostic_proactive_log_collection_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_update_diagnostic_proactive_log_collection_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +89,7 @@ def build_update_diagnostic_proactive_log_collection_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,7 @@ def build_get_diagnostic_remote_support_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +122,7 @@ def build_get_diagnostic_remote_support_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_update_diagnostic_remote_support_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +154,7 @@ def build_update_diagnostic_remote_support_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -189,6 +185,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get_diagnostic_proactive_log_collection_settings( @@ -217,7 +214,7 @@ def get_diagnostic_proactive_log_collection_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_proactive_log_collection_settings_request( @@ -232,8 +229,9 @@ def get_diagnostic_proactive_log_collection_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,14 +269,14 @@ def _update_diagnostic_proactive_log_collection_settings_initial( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(proactive_log_collection_settings, (IO, bytes)): + if isinstance(proactive_log_collection_settings, (IOBase, bytes)): _content = proactive_log_collection_settings else: _json = self._serialize.body(proactive_log_collection_settings, "DiagnosticProactiveLogCollectionSettings") @@ -298,8 +296,9 @@ def _update_diagnostic_proactive_log_collection_settings_initial( # pylint: dis 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,7 +419,7 @@ def begin_update_diagnostic_proactive_log_collection_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -490,7 +489,7 @@ def get_diagnostic_remote_support_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_remote_support_settings_request( @@ -505,8 +504,9 @@ def get_diagnostic_remote_support_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,14 +544,14 @@ def _update_diagnostic_remote_support_settings_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(diagnostic_remote_support_settings, (IO, bytes)): + if isinstance(diagnostic_remote_support_settings, (IOBase, bytes)): _content = diagnostic_remote_support_settings else: _json = self._serialize.body(diagnostic_remote_support_settings, "DiagnosticRemoteSupportSettings") @@ -571,8 +571,9 @@ def _update_diagnostic_remote_support_settings_initial( # pylint: disable=incon 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,7 +694,7 @@ def begin_update_diagnostic_remote_support_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py index 36c9cec4638a..9ac8274f2e2e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py index e0f525ee1e62..4e9b727d4b3d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,7 +109,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -148,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -192,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -217,7 +214,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -272,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +317,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,14 +374,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -403,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,7 +552,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -612,7 +612,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -628,8 +628,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +675,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py index 5b551118a558..db21c94100c1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py index 18fb54d4bef5..efd45e2bd817 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py index 6c7ae4241586..1362aa9eb651 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py index 87a463124aea..fa55c7b47ac3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -217,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -238,7 +235,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -292,8 +289,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,7 +333,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -350,8 +348,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,14 +384,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -412,8 +411,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -599,7 +599,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -614,8 +614,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,7 +657,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -722,7 +723,7 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -737,8 +738,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py index 304f5fa48cb6..339cbb230842 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py index c2f3013ff8d7..0a0a6cc489df 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py index cdb2238e5225..0a0e82932d9b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py index 96c91fae9529..b3e7207617b5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -212,7 +209,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -266,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +544,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -604,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -620,8 +620,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py index f6807dcda6b0..a575e12a2484 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_support_packages_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_trigger_support_package_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62,7 +58,7 @@ def build_trigger_support_package_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -93,6 +89,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _trigger_support_package_initial( # pylint: disable=inconsistent-return-statements self, @@ -112,14 +109,14 @@ def _trigger_support_package_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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(trigger_support_package_request, (IO, bytes)): + if isinstance(trigger_support_package_request, (IOBase, bytes)): _content = trigger_support_package_request else: _json = self._serialize.body(trigger_support_package_request, "TriggerSupportPackageRequest") @@ -139,8 +136,9 @@ def _trigger_support_package_initial( # pylint: disable=inconsistent-return-sta 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,7 +265,7 @@ def begin_trigger_support_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py index 507f2a070cd9..862cabc76ad0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py index 1d7b0e9ece02..2cfccd106dc7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,7 +524,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -584,7 +584,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -600,8 +600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,7 +643,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py index ae5723d90006..75e5872cc534 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-02-01-preview"] = kwargs.pop("api_version", "2021-02-01-preview") + api_version: str = kwargs.pop("api_version", "2021-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py index b339f906c0b4..ce04dab4d7c1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_data_box_edge_management_client.py @@ -109,40 +109,64 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py index a0d19aa0883d..d3c66425dad3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-02-01-preview"] = kwargs.pop("api_version", "2021-02-01-preview") + api_version: str = kwargs.pop("api_version", "2021-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py index 346c1f2ffd5a..baf81150abc7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/_data_box_edge_management_client.py @@ -110,40 +110,64 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.alerts = AlertsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview") + self.nodes = NodesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.roles = RolesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.addons = AddonsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.shares = SharesOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.triggers = TriggersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-02-01-preview" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py index f8f988b1e012..6bf2a66898e3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,8 +83,8 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,8 +188,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -209,8 +207,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,8 +249,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) @@ -259,7 +258,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -281,8 +280,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,8 +427,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -490,8 +490,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -509,8 +509,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -555,8 +556,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py index 04536e1463e2..fb3b751d78b7 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,8 +73,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -133,8 +129,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,8 +175,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -196,8 +193,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py index f221b29de99e..7af6baa258ec 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -126,8 +122,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py index 1cb91fb9adb9..2409a35f5f79 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,8 +183,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,8 +242,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -252,7 +251,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -273,8 +272,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,8 +414,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -476,8 +476,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,8 +539,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py index 494fc6a300cf..786334bbee7b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,8 +86,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -146,8 +143,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,8 +193,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -214,8 +212,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,8 +254,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -264,7 +263,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -286,8 +285,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,8 +441,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -504,8 +504,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -523,8 +523,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,8 +570,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -627,8 +628,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -646,8 +647,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -694,8 +696,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py index ed8fc5d34715..d7d09d0d1d5f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,8 +93,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -151,8 +148,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +187,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -245,8 +243,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,8 +285,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -303,8 +302,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,8 +342,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -351,7 +351,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -371,8 +371,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,8 +504,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -564,8 +565,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -581,8 +582,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -621,8 +623,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -754,8 +756,8 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -763,7 +765,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -783,8 +785,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,8 +821,8 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -835,8 +838,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -879,8 +883,8 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -947,8 +951,8 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) @@ -964,8 +968,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1011,8 +1016,8 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1028,8 +1033,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1063,8 +1069,8 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1080,8 +1086,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1124,8 +1131,8 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1192,8 +1199,8 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1209,8 +1216,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1244,8 +1252,8 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1261,8 +1269,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1305,8 +1314,8 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1365,8 +1374,8 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1374,7 +1383,7 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1394,8 +1403,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1515,8 +1525,8 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1652,8 +1662,8 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1661,7 +1671,7 @@ async def update_extended_information( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1681,8 +1691,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1732,8 +1743,8 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -1749,8 +1760,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1861,8 +1873,8 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -1870,7 +1882,7 @@ async def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1890,8 +1902,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py index 75bd42289f8a..2f6cde1c3278 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py index 27678d8dd536..486d9db9d2e5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,8 +86,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) @@ -146,8 +143,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,8 +191,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -211,8 +209,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,8 +250,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) @@ -260,7 +259,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -281,8 +280,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,8 +430,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -492,8 +492,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -510,8 +510,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,8 +557,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py index f1d5956d1982..e89a74df1c88 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,8 +72,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -132,8 +128,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py index 21277a643788..b6308b27b0dc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,8 +68,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -125,8 +121,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py index 742f6a710b6b..24e91f31578e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,8 +79,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -101,8 +97,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py index 280291e67050..f8e0585c6cf6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,8 +184,8 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -203,8 +201,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,8 +237,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -247,7 +246,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,8 +398,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -459,8 +459,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,8 +519,8 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -588,8 +589,8 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) @@ -605,8 +606,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py index 1672c496599b..f1ba5b3456a2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,8 +81,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,8 +181,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,8 +235,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -245,7 +244,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -266,8 +265,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,8 +398,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -460,8 +460,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -478,8 +478,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,8 +523,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py index 21b4802dac8d..5cd13879059c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,8 +240,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -250,7 +249,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -409,8 +409,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -471,8 +471,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +534,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -590,8 +591,8 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -608,8 +609,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,8 +656,8 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py index fdd88f41fc10..51c5a83bae00 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -143,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +245,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -255,7 +254,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -276,8 +275,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,8 +419,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -481,8 +481,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -499,8 +499,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,8 +544,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py index 023d5c597980..036f8abb607c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,8 +83,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,8 +246,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -256,7 +255,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -277,8 +276,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,8 +424,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -486,8 +486,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -504,8 +504,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +549,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py index 71728a4b4f84..218a1fee5e7c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,8 +84,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,8 +185,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -205,8 +203,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,8 +239,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -249,7 +248,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,8 +405,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -467,8 +467,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -485,8 +485,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +530,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py index 11523ec18da4..e37493debe0b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -88,8 +85,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -145,8 +142,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,8 +186,8 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -206,8 +204,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,8 +240,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -250,7 +249,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,8 +406,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -468,8 +468,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -486,8 +486,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,8 +531,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py index 365fcfa984de..9f6c8ec9f126 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -83,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -137,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -156,9 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -224,8 +213,8 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,8 +318,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -347,8 +337,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +379,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) @@ -397,7 +388,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -419,8 +410,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -562,8 +554,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) @@ -625,8 +617,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -644,8 +636,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,8 +683,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py index f726353f54b6..60de67ccdfde 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -145,8 +137,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) @@ -201,8 +193,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,8 +239,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) @@ -264,8 +257,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py index 5a544cc44581..56ca40f7267d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -85,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -101,8 +95,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) @@ -155,8 +149,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py index bf1795852b2e..a074f235c02f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -219,8 +208,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) @@ -275,8 +264,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,8 +308,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -336,8 +326,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,8 +367,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) @@ -385,7 +376,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -406,8 +397,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,8 +539,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) @@ -609,8 +601,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -627,8 +619,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,8 +662,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py index 5e558bdb0dd7..6b48d3f87720 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -88,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -128,9 +120,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -171,9 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -211,9 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -258,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -282,8 +269,8 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) @@ -339,8 +326,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +376,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -407,8 +395,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,8 +437,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) @@ -457,7 +446,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -479,8 +468,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,8 +621,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) @@ -694,8 +684,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -713,8 +703,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +750,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -817,8 +808,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -836,8 +827,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,8 +876,8 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py index 97982cda5e07..4e0493b005f8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -81,9 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -146,9 +136,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -163,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -182,9 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -215,9 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -251,9 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -284,9 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -317,9 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -350,9 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -383,9 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -416,9 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -449,9 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -466,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -485,9 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -502,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -521,9 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -554,9 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -571,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -602,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -622,8 +587,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -677,8 +642,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -715,8 +681,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) @@ -771,8 +737,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -812,8 +779,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -829,8 +796,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -868,8 +836,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -877,7 +845,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -897,8 +865,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1029,8 +998,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1090,8 +1059,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1107,8 +1076,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1147,8 +1117,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1280,8 +1250,8 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) @@ -1289,7 +1259,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1309,8 +1279,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1344,8 +1315,8 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1361,8 +1332,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1403,8 +1375,8 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1471,8 +1443,8 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) @@ -1488,8 +1460,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1535,8 +1508,8 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -1552,8 +1525,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1587,8 +1561,8 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1604,8 +1578,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1646,8 +1621,8 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1714,8 +1689,8 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) @@ -1731,8 +1706,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1766,8 +1742,8 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1783,8 +1759,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1825,8 +1802,8 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1885,8 +1862,8 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1894,7 +1871,7 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1914,8 +1891,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2035,8 +2013,8 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2172,8 +2150,8 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) @@ -2181,7 +2159,7 @@ def update_extended_information( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2201,8 +2179,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2250,8 +2229,8 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) @@ -2267,8 +2246,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2379,8 +2359,8 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) @@ -2388,7 +2368,7 @@ def upload_certificate( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2408,8 +2388,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py index 70eebe4db0c4..cad17da4699a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py index e852ff243381..c36b05bc53be 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -83,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -117,9 +109,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -154,9 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -200,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -225,8 +214,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) @@ -282,8 +271,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,8 +319,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -347,8 +337,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,8 +378,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) @@ -396,7 +387,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -417,8 +408,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,8 +558,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) @@ -628,8 +620,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -646,8 +638,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,8 +685,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py index 66f2e8466dc0..41e8d59503ee 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -92,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -111,8 +105,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) @@ -167,8 +161,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py index 67583a99e943..cf65af0f5d08 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -96,8 +90,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) @@ -149,8 +143,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py index 3559eb6e0d62..77d0d8b57698 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -91,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -120,8 +114,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Job] = kwargs.pop("cls", None) @@ -138,8 +132,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py index 9f354f357c46..50b5e7901e06 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,9 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,9 +105,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,9 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -182,9 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -227,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -248,8 +235,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) @@ -304,8 +291,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,8 +335,8 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -364,8 +352,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -399,8 +388,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) @@ -408,7 +397,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -428,8 +417,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,8 +546,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) @@ -617,8 +607,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -634,8 +624,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +667,8 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -744,8 +735,8 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) @@ -761,8 +752,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py index 7f833346d53b..00f2db50d8ce 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -218,8 +207,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) @@ -274,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,8 +307,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -335,8 +325,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,8 +361,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) @@ -379,7 +370,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -400,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +521,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) @@ -591,8 +583,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -609,8 +601,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,8 +644,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py index 147558afb1d1..78128908d995 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -187,9 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -233,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -254,8 +241,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) @@ -310,8 +297,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,8 +343,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -373,8 +361,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,8 +397,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) @@ -417,7 +406,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -438,8 +427,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,8 +563,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) @@ -635,8 +625,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -653,8 +643,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,8 +686,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -752,8 +743,8 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -770,8 +761,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,8 +806,8 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py index 9c2fdac3de8a..d2d27f221f1f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -222,8 +211,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) @@ -278,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,8 +313,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -341,8 +331,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,8 +372,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) @@ -390,7 +381,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -411,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,8 +546,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) @@ -616,8 +608,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -634,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,8 +669,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py index c533af0936c4..b3cbac3458ed 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,9 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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,9 +108,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -153,9 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -199,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -221,8 +210,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) @@ -277,8 +266,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,8 +373,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) @@ -391,7 +382,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -412,8 +403,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,8 +551,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) @@ -621,8 +613,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -639,8 +631,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,8 +676,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py index 44a1278fa4a2..0a443696a611 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -224,8 +213,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,8 +368,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) @@ -386,7 +377,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -407,8 +398,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,8 +531,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) @@ -601,8 +593,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,8 +611,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,8 +654,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py index 1591ee8f14dc..7f318e9d6655 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -118,9 +110,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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -155,9 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -201,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -224,8 +213,8 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) @@ -281,8 +270,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +314,8 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -342,8 +332,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,8 +368,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) @@ -386,7 +377,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -407,8 +398,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,8 +531,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) @@ -601,8 +593,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,8 +611,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,8 +654,8 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-02-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_configuration.py index c33abc4b08f1..26437ee06f58 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") + api_version: str = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_data_box_edge_management_client.py index 017a0effcc44..dcf817a84053 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_data_box_edge_management_client.py @@ -124,52 +124,56 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.device_capacity_check = DeviceCapacityCheckOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.device_capacity_info = DeviceCapacityInfoOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.support_packages = SupportPackagesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_vendor.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_vendor.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_version.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_version.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_configuration.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_configuration.py index ac5a3e801e0f..ad535e4e3e20 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_configuration.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class DataBoxEdgeManagementClientConfiguration(Configuration): # pylint: disabl def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataBoxEdgeManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", "2022-03-01") + api_version: str = kwargs.pop("api_version", "2022-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_data_box_edge_management_client.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_data_box_edge_management_client.py index d7dfd3b3e8f3..fb14822f8503 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_data_box_edge_management_client.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/_data_box_edge_management_client.py @@ -125,52 +125,56 @@ def __init__( self._config = DataBoxEdgeManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.available_skus = AvailableSkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.available_skus = AvailableSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" + ) + self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.bandwidth_schedules = BandwidthSchedulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.device_capacity_check = DeviceCapacityCheckOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.device_capacity_info = DeviceCapacityInfoOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.nodes = NodesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.operations_status = OperationsStatusOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) - self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize) + self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.roles = RolesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") + self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.monitoring_config = MonitoringConfigOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shares = SharesOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.storage_account_credentials = StorageAccountCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" + ) + self.containers = ContainersOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") self.support_packages = SupportPackagesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-03-01" ) - self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) + self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_addons_operations.py index a307d07b6bc9..c83bb0460063 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_role_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -86,7 +83,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,7 +186,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +203,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,14 +245,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +479,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -496,8 +496,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +543,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_alerts_operations.py index 23b901861ea3..ae3b0c84c1a9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alerts_operations import build_get_request, build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -77,7 +73,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +173,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +189,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_available_skus_operations.py index 2a5a3d0e6cc4..b7778fc829e3 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_skus_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -124,8 +120,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_bandwidth_schedules_operations.py index 1dd8821fc4c0..18fc96369bbe 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,14 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -267,8 +266,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +408,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -468,7 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -484,8 +484,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,7 +529,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_containers_operations.py index 8e19a3056384..fa3b7c60303b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -89,7 +86,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,7 +191,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +208,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,14 +250,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -280,8 +279,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +435,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -496,7 +496,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -513,8 +513,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +560,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -615,7 +616,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -632,8 +633,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,7 +682,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_check_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_check_operations.py index c112cb5aea89..8c02729ae44f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_check_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_check_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._device_capacity_check_operations import build_check_resource_creation_feasibility_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _check_resource_creation_feasibility_initial( # pylint: disable=inconsistent-return-statements self, @@ -76,14 +73,14 @@ async def _check_resource_creation_feasibility_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(device_capacity_request_info, (IO, bytes)): + if isinstance(device_capacity_request_info, (IOBase, bytes)): _content = device_capacity_request_info else: _json = self._serialize.body(device_capacity_request_info, "DeviceCapacityRequestInfo") @@ -104,8 +101,9 @@ async def _check_resource_creation_feasibility_initial( # pylint: disable=incon 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,7 +233,7 @@ async def begin_check_resource_creation_feasibility( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_info_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_info_operations.py index 775ede819cfd..35729e0d82a6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_info_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_device_capacity_info_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._device_capacity_info_operations import build_get_device_capacity_info_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get_device_capacity_info( @@ -81,7 +77,7 @@ async def get_device_capacity_info( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DeviceCapacityInfo] = kwargs.pop("cls", None) request = build_get_device_capacity_info_request( @@ -96,8 +92,9 @@ async def get_device_capacity_info( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_devices_operations.py index d3f15ec1942e..493e2e0d9e1f 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -50,10 +50,6 @@ build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -96,7 +93,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -149,8 +146,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -241,8 +239,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +281,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -297,8 +296,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,14 +408,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -435,8 +435,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +471,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -485,8 +486,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +527,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -655,14 +657,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -682,8 +684,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,7 +720,7 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -732,8 +735,9 @@ async def _download_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +780,7 @@ async def begin_download_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -842,7 +846,7 @@ async def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -857,8 +861,9 @@ async def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -904,7 +909,7 @@ async def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -919,8 +924,9 @@ async def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -954,7 +960,7 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -969,8 +975,9 @@ async def _install_updates_initial( # pylint: disable=inconsistent-return-state 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,7 +1020,7 @@ async def begin_install_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1079,7 +1086,7 @@ async def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1094,8 +1101,9 @@ async def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1129,7 +1137,7 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1144,8 +1152,9 @@ async def _scan_for_updates_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1188,7 +1197,7 @@ async def begin_scan_for_updates( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1246,14 +1255,14 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1273,8 +1282,9 @@ async def _create_or_update_security_settings_initial( # pylint: disable=incons 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1393,7 +1403,7 @@ async def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1527,14 +1537,14 @@ async def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -1554,8 +1564,9 @@ async def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1605,7 +1616,7 @@ async def get_update_summary( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -1620,8 +1631,9 @@ async def get_update_summary( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1731,14 +1743,14 @@ async def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -1758,8 +1770,9 @@ async def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_diagnostic_settings_operations.py index a1f6e9d8583f..a88baa97a5ce 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_diagnostic_settings_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_diagnostic_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -35,10 +35,6 @@ build_update_diagnostic_remote_support_settings_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +57,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get_diagnostic_proactive_log_collection_settings( @@ -89,7 +86,7 @@ async def get_diagnostic_proactive_log_collection_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_proactive_log_collection_settings_request( @@ -104,8 +101,9 @@ async def get_diagnostic_proactive_log_collection_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,14 +141,14 @@ async def _update_diagnostic_proactive_log_collection_settings_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DiagnosticProactiveLogCollectionSettings]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(proactive_log_collection_settings, (IO, bytes)): + if isinstance(proactive_log_collection_settings, (IOBase, bytes)): _content = proactive_log_collection_settings else: _json = self._serialize.body(proactive_log_collection_settings, "DiagnosticProactiveLogCollectionSettings") @@ -170,8 +168,9 @@ async def _update_diagnostic_proactive_log_collection_settings_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,7 +303,7 @@ async def begin_update_diagnostic_proactive_log_collection_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -376,7 +375,7 @@ async def get_diagnostic_remote_support_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_remote_support_settings_request( @@ -391,8 +390,9 @@ async def get_diagnostic_remote_support_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,14 +430,14 @@ async def _update_diagnostic_remote_support_settings_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DiagnosticRemoteSupportSettings]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(diagnostic_remote_support_settings, (IO, bytes)): + if isinstance(diagnostic_remote_support_settings, (IOBase, bytes)): _content = diagnostic_remote_support_settings else: _json = self._serialize.body(diagnostic_remote_support_settings, "DiagnosticRemoteSupportSettings") @@ -457,8 +457,9 @@ async def _update_diagnostic_remote_support_settings_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,7 +592,7 @@ async def begin_update_diagnostic_remote_support_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_jobs_operations.py index c650334d8173..062ff20acab0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_monitoring_config_operations.py index f70991052ba0..8848342f0994 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -89,7 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +189,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -207,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,14 +246,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -275,8 +274,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +424,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -484,7 +484,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -500,8 +500,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +547,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_nodes_operations.py index 5b73b921577c..c15faad8bb6e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._nodes_operations import build_list_by_data_box_edge_device_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -76,7 +72,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -130,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations.py index 36b6a2b08670..ae21802e5892 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations_status_operations.py index 580c5f486180..bfb87dfdf77b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -83,7 +79,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -99,8 +95,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_orders_operations.py index 1dd2faf8e8b9..eb2d0ecf9bb4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_list_dc_access_code_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +182,7 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +197,9 @@ async def get(self, device_name: str, resource_group_name: str, **kwargs: Any) - 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,14 +233,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -261,8 +260,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -448,7 +448,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -463,8 +463,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,7 +506,7 @@ async def begin_delete(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -573,7 +574,7 @@ async def list_dc_access_code( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -588,8 +589,9 @@ async def list_dc_access_code( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_roles_operations.py index 05ea3dd32c6d..d6b8c538a5b6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -84,7 +81,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -138,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +179,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -197,8 +195,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,14 +231,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -260,8 +259,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +449,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -465,8 +465,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +510,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_shares_operations.py index c9df6c2663d2..05b6397759d6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_refresh_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,14 +236,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -265,8 +264,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,7 +400,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -460,7 +460,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -476,8 +476,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,7 +521,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -575,7 +576,7 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -591,8 +592,9 @@ async def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,7 +639,7 @@ async def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_account_credentials_operations.py index ad74841523b6..f0480631dd63 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -202,8 +200,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,14 +241,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -270,8 +269,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -489,8 +489,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +534,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_accounts_operations.py index c175a5067043..1f0166e209e5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -86,7 +83,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +137,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,14 +242,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -271,8 +270,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +418,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +478,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -494,8 +494,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +539,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_support_packages_operations.py index 5cecd7f99cb4..55babb44fe66 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_support_packages_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_support_packages_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._support_packages_operations import build_trigger_support_package_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _trigger_support_package_initial( # pylint: disable=inconsistent-return-statements self, @@ -75,14 +72,14 @@ async def _trigger_support_package_initial( # pylint: disable=inconsistent-retu _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(trigger_support_package_request, (IO, bytes)): + if isinstance(trigger_support_package_request, (IOBase, bytes)): _content = trigger_support_package_request else: _json = self._serialize.body(trigger_support_package_request, "TriggerSupportPackageRequest") @@ -102,8 +99,9 @@ async def _trigger_support_package_initial( # pylint: disable=inconsistent-retu 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,7 +228,7 @@ async def begin_trigger_support_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_triggers_operations.py index afc038190ee9..80b7c855a59d 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_users_operations.py index b0e0b1ed27cd..d81d9b4510b2 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_data_box_edge_device_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -87,7 +84,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +183,7 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -201,8 +199,9 @@ async def get(self, device_name: str, name: str, resource_group_name: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +235,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -264,8 +263,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,7 +396,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -456,7 +456,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -472,8 +472,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +517,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_addons_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_addons_operations.py index 041ce55bd3f3..12c686efcc70 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_addons_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_addons_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_role_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_role_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +127,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -150,7 +146,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +162,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -195,6 +191,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_role( @@ -216,7 +213,7 @@ def list_by_role( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.AddonList] = kwargs.pop("cls", None) error_map = { @@ -271,8 +268,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +316,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,14 +375,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Addon]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(addon, (IO, bytes)): + if isinstance(addon, (IOBase, bytes)): _content = addon else: _json = self._serialize.body(addon, "Addon") @@ -405,8 +404,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,7 +548,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Addon] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -609,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -626,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +673,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_alerts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_alerts_operations.py index 1638a88ac123..55bdb12a39a5 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_alerts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_alerts_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -122,6 +117,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -141,7 +137,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -195,8 +191,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,7 +237,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( @@ -256,8 +253,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_available_skus_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_available_skus_operations.py index 837cd30362fa..3806d01e0be0 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_available_skus_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_available_skus_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -83,6 +78,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: @@ -98,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DataBoxEdgeSku"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeSkuList] = kwargs.pop("cls", None) error_map = { @@ -150,8 +146,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_bandwidth_schedules_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_bandwidth_schedules_operations.py index 2875ccf1ec33..995dd6b796d6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_bandwidth_schedules_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_bandwidth_schedules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -211,7 +208,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.BandwidthSchedulesList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,7 +306,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) request = build_get_request( @@ -324,8 +322,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BandwidthSchedule]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BandwidthSchedule") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,7 +533,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BandwidthSchedule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -593,7 +593,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,8 +609,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +652,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_containers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_containers_operations.py index b586f28efacd..54e5c95c8d76 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_containers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_containers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_storage_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_storage_account_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -86,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +120,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -165,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +177,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -203,7 +199,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +215,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -248,6 +244,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_storage_account( @@ -271,7 +268,7 @@ def list_by_storage_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.ContainerList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +323,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,7 +373,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Container] = kwargs.pop("cls", None) request = build_get_request( @@ -392,8 +390,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,14 +432,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Container]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(container, (IO, bytes)): + if isinstance(container, (IOBase, bytes)): _content = container else: _json = self._serialize.body(container, "Container") @@ -462,8 +461,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +611,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Container] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -672,7 +672,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -689,8 +689,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -735,7 +736,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -791,7 +792,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -808,8 +809,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,7 +858,7 @@ def begin_refresh( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_check_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_check_operations.py index a0a925ec2bbb..e07f92cd77cb 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_check_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_check_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +48,7 @@ def build_check_resource_creation_feasibility_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67,7 +63,7 @@ def build_check_resource_creation_feasibility_request( "deviceName": _SERIALIZER.url("device_name", device_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,6 +96,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _check_resource_creation_feasibility_initial( # pylint: disable=inconsistent-return-statements self, @@ -120,14 +117,14 @@ def _check_resource_creation_feasibility_initial( # pylint: disable=inconsisten _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(device_capacity_request_info, (IO, bytes)): + if isinstance(device_capacity_request_info, (IOBase, bytes)): _content = device_capacity_request_info else: _json = self._serialize.body(device_capacity_request_info, "DeviceCapacityRequestInfo") @@ -148,8 +145,9 @@ def _check_resource_creation_feasibility_initial( # pylint: disable=inconsisten 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -279,7 +277,7 @@ def begin_check_resource_creation_feasibility( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_info_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_info_operations.py index afa15f549ecf..9eb215386ee6 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_info_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_device_capacity_info_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_device_capacity_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_get_device_capacity_info_request( "deviceName": _SERIALIZER.url("device_name", device_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") @@ -88,6 +83,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get_device_capacity_info( @@ -115,7 +111,7 @@ def get_device_capacity_info( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DeviceCapacityInfo] = kwargs.pop("cls", None) request = build_get_device_capacity_info_request( @@ -130,8 +126,9 @@ def get_device_capacity_info( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_devices_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_devices_operations.py index 5057a8506762..50a100343f2a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_devices_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_devices_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +56,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -79,7 +75,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +119,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -140,7 +136,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +151,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -205,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +216,7 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -239,7 +235,7 @@ def build_download_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_download_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -270,7 +266,7 @@ def build_generate_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,7 +280,7 @@ def build_generate_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -301,7 +297,7 @@ def build_get_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +311,7 @@ def build_get_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +328,7 @@ def build_install_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +342,7 @@ def build_install_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -363,7 +359,7 @@ def build_get_network_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -377,7 +373,7 @@ def build_get_network_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -394,7 +390,7 @@ def build_scan_for_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +404,7 @@ def build_scan_for_updates_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -425,7 +421,7 @@ def build_create_or_update_security_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -440,7 +436,7 @@ def build_create_or_update_security_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -459,7 +455,7 @@ def build_update_extended_information_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -474,7 +470,7 @@ def build_update_extended_information_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -493,7 +489,7 @@ def build_get_update_summary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -507,7 +503,7 @@ def build_get_update_summary_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -524,7 +520,7 @@ def build_upload_certificate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -539,7 +535,7 @@ def build_upload_certificate_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -570,6 +566,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -590,7 +587,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -643,8 +640,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +679,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceList] = kwargs.pop("cls", None) error_map = { @@ -735,8 +733,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,7 +775,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) request = build_get_request( @@ -791,8 +790,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -902,14 +902,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_box_edge_device, (IO, bytes)): + if isinstance(data_box_edge_device, (IOBase, bytes)): _content = data_box_edge_device else: _json = self._serialize.body(data_box_edge_device, "DataBoxEdgeDevice") @@ -929,8 +929,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -964,7 +965,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -979,8 +980,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,7 +1021,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1149,14 +1151,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDevice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDevicePatch") @@ -1176,8 +1178,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1211,7 +1214,7 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_download_updates_request( @@ -1226,8 +1229,9 @@ def _download_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1268,7 +1272,7 @@ def begin_download_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1334,7 +1338,7 @@ def generate_certificate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.GenerateCertResponse] = kwargs.pop("cls", None) request = build_generate_certificate_request( @@ -1349,8 +1353,9 @@ def generate_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1396,7 +1401,7 @@ def get_extended_information( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) request = build_get_extended_information_request( @@ -1411,8 +1416,9 @@ def get_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1446,7 +1452,7 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_install_updates_request( @@ -1461,8 +1467,9 @@ def _install_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1503,7 +1510,7 @@ def begin_install_updates(self, device_name: str, resource_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1569,7 +1576,7 @@ def get_network_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.NetworkSettings] = kwargs.pop("cls", None) request = build_get_network_settings_request( @@ -1584,8 +1591,9 @@ def get_network_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1619,7 +1627,7 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scan_for_updates_request( @@ -1634,8 +1642,9 @@ def _scan_for_updates_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1676,7 +1685,7 @@ def begin_scan_for_updates(self, device_name: str, resource_group_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -1734,14 +1743,14 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(security_settings, (IO, bytes)): + if isinstance(security_settings, (IOBase, bytes)): _content = security_settings else: _json = self._serialize.body(security_settings, "SecuritySettings") @@ -1761,8 +1770,9 @@ def _create_or_update_security_settings_initial( # pylint: disable=inconsistent 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1881,7 +1891,7 @@ def begin_create_or_update_security_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -2015,14 +2025,14 @@ def update_extended_information( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DataBoxEdgeDeviceExtendedInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataBoxEdgeDeviceExtendedInfoPatch") @@ -2042,8 +2052,9 @@ def update_extended_information( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2091,7 +2102,7 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.UpdateSummary] = kwargs.pop("cls", None) request = build_get_update_summary_request( @@ -2106,8 +2117,9 @@ def get_update_summary(self, device_name: str, resource_group_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2217,14 +2229,14 @@ def upload_certificate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UploadCertificateResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "UploadCertificateRequest") @@ -2244,8 +2256,9 @@ def upload_certificate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_diagnostic_settings_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_diagnostic_settings_operations.py index bb7399d12fd8..3e46721d833a 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_diagnostic_settings_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_diagnostic_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_get_diagnostic_proactive_log_collection_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +57,7 @@ def build_get_diagnostic_proactive_log_collection_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_update_diagnostic_proactive_log_collection_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +89,7 @@ def build_update_diagnostic_proactive_log_collection_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,7 @@ def build_get_diagnostic_remote_support_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +122,7 @@ def build_get_diagnostic_remote_support_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_update_diagnostic_remote_support_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +154,7 @@ def build_update_diagnostic_remote_support_settings_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -189,6 +185,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get_diagnostic_proactive_log_collection_settings( @@ -217,7 +214,7 @@ def get_diagnostic_proactive_log_collection_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_proactive_log_collection_settings_request( @@ -232,8 +229,9 @@ def get_diagnostic_proactive_log_collection_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,14 +269,14 @@ def _update_diagnostic_proactive_log_collection_settings_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DiagnosticProactiveLogCollectionSettings]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(proactive_log_collection_settings, (IO, bytes)): + if isinstance(proactive_log_collection_settings, (IOBase, bytes)): _content = proactive_log_collection_settings else: _json = self._serialize.body(proactive_log_collection_settings, "DiagnosticProactiveLogCollectionSettings") @@ -298,8 +296,9 @@ def _update_diagnostic_proactive_log_collection_settings_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -432,7 +431,7 @@ def begin_update_diagnostic_proactive_log_collection_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DiagnosticProactiveLogCollectionSettings] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -504,7 +503,7 @@ def get_diagnostic_remote_support_settings( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) request = build_get_diagnostic_remote_support_settings_request( @@ -519,8 +518,9 @@ def get_diagnostic_remote_support_settings( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,14 +558,14 @@ def _update_diagnostic_remote_support_settings_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.DiagnosticRemoteSupportSettings]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(diagnostic_remote_support_settings, (IO, bytes)): + if isinstance(diagnostic_remote_support_settings, (IOBase, bytes)): _content = diagnostic_remote_support_settings else: _json = self._serialize.body(diagnostic_remote_support_settings, "DiagnosticRemoteSupportSettings") @@ -585,8 +585,9 @@ def _update_diagnostic_remote_support_settings_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -719,7 +720,7 @@ def begin_update_diagnostic_remote_support_settings( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DiagnosticRemoteSupportSettings] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_jobs_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_jobs_operations.py index 604fd5a82df7..e6a1a3ad0cb4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_jobs_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_jobs_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_monitoring_config_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_monitoring_config_operations.py index 809d2c9fe9db..1b502e977c31 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_monitoring_config_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_monitoring_config_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -81,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -113,7 +109,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -148,7 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +159,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -192,6 +188,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -217,7 +214,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.MonitoringMetricConfigurationList] = kwargs.pop("cls", None) error_map = { @@ -272,8 +269,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +317,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) request = build_get_request( @@ -335,8 +333,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,14 +374,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.MonitoringMetricConfiguration]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(monitoring_metric_configuration, (IO, bytes)): + if isinstance(monitoring_metric_configuration, (IOBase, bytes)): _content = monitoring_metric_configuration else: _json = self._serialize.body(monitoring_metric_configuration, "MonitoringMetricConfiguration") @@ -403,8 +402,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,7 +552,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MonitoringMetricConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -612,7 +612,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -628,8 +628,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +675,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_nodes_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_nodes_operations.py index 297e1190af93..02a4cc38b334 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_nodes_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_nodes_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -90,6 +85,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -109,7 +105,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.NodeList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +159,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations.py index c69ae7bd8c83..36115dda3ef9 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +140,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations_status_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations_status_operations.py index 2c5fd16ae4b4..382012e2b355 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations_status_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +55,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -89,6 +84,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: Any) -> _models.Job: @@ -118,7 +114,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( @@ -134,8 +130,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_orders_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_orders_operations.py index 5d15ba962053..8ebf4ada712e 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_orders_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_orders_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -78,7 +74,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_get_request(device_name: str, resource_group_name: str, subscription_i "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -109,7 +105,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +120,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -143,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -174,7 +170,7 @@ def build_list_dc_access_code_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +184,7 @@ def build_list_dc_access_code_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -217,6 +213,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -238,7 +235,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.OrderList] = kwargs.pop("cls", None) error_map = { @@ -292,8 +289,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,7 +333,7 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Order] = kwargs.pop("cls", None) request = build_get_request( @@ -350,8 +348,9 @@ def get(self, device_name: str, resource_group_name: str, **kwargs: Any) -> _mod 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,14 +384,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Order]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order, (IO, bytes)): + if isinstance(order, (IOBase, bytes)): _content = order else: _json = self._serialize.body(order, "Order") @@ -412,8 +411,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Order] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -599,7 +599,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -614,8 +614,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,7 +657,7 @@ def begin_delete(self, device_name: str, resource_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -722,7 +723,7 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.DCAccessCode] = kwargs.pop("cls", None) request = build_list_dc_access_code_request( @@ -737,8 +738,9 @@ def list_dc_access_code(self, device_name: str, resource_group_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_roles_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_roles_operations.py index 9f98b715b6dc..39a64d584187 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_roles_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_roles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -210,7 +207,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.RoleList] = kwargs.pop("cls", None) error_map = { @@ -264,8 +261,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,7 +305,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Role] = kwargs.pop("cls", None) request = build_get_request( @@ -323,8 +321,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,14 +357,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Role]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(role, (IO, bytes)): + if isinstance(role, (IOBase, bytes)): _content = role else: _json = self._serialize.body(role, "Role") @@ -386,8 +385,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +515,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Role] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -575,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -591,8 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,7 +634,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_shares_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_shares_operations.py index fbb8062f90d5..da2176326851 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_shares_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_shares_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -179,7 +175,7 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +190,7 @@ def build_refresh_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -223,6 +219,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -244,7 +241,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.ShareList] = kwargs.pop("cls", None) error_map = { @@ -298,8 +295,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +341,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Share] = kwargs.pop("cls", None) request = build_get_request( @@ -359,8 +357,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +393,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Share]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(share, (IO, bytes)): + if isinstance(share, (IOBase, bytes)): _content = share else: _json = self._serialize.body(share, "Share") @@ -422,8 +421,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Share] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -617,7 +617,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -633,8 +633,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,7 +676,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) @@ -730,7 +731,7 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( @@ -746,8 +747,9 @@ def _refresh_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +792,7 @@ def begin_refresh(self, device_name: str, name: str, resource_group_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_account_credentials_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_account_credentials_operations.py index da6129cc2b1e..fbf470055639 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_account_credentials_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_account_credentials_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -214,7 +211,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountCredentialList] = kwargs.pop("cls", None) error_map = { @@ -268,8 +265,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccountCredential]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account_credential, (IO, bytes)): + if isinstance(storage_account_credential, (IOBase, bytes)): _content = storage_account_credential else: _json = self._serialize.body(storage_account_credential, "StorageAccountCredential") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,7 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccountCredential] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -616,8 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -658,7 +659,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_accounts_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_accounts_operations.py index 086e04776036..aa69adb60e99 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_accounts_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_storage_accounts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -80,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +91,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -112,7 +108,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +124,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -147,7 +143,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +158,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -191,6 +187,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -212,7 +209,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccountList] = kwargs.pop("cls", None) error_map = { @@ -266,8 +263,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,14 +368,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_account, (IO, bytes)): + if isinstance(storage_account, (IOBase, bytes)): _content = storage_account else: _json = self._serialize.body(storage_account, "StorageAccount") @@ -397,8 +396,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +544,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StorageAccount] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -604,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -620,8 +620,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_support_packages_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_support_packages_operations.py index 866525417d4b..46063311ebdc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_support_packages_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_support_packages_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_trigger_support_package_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62,7 +58,7 @@ def build_trigger_support_package_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -93,6 +89,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _trigger_support_package_initial( # pylint: disable=inconsistent-return-statements self, @@ -112,14 +109,14 @@ def _trigger_support_package_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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(trigger_support_package_request, (IO, bytes)): + if isinstance(trigger_support_package_request, (IOBase, bytes)): _content = trigger_support_package_request else: _json = self._serialize.body(trigger_support_package_request, "TriggerSupportPackageRequest") @@ -139,8 +136,9 @@ def _trigger_support_package_initial( # pylint: disable=inconsistent-return-sta 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,7 +265,7 @@ def begin_trigger_support_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_triggers_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_triggers_operations.py index 1f80d7dddb80..04276b2b5135 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_triggers_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_triggers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.TriggerList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Trigger]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(trigger, (IO, bytes)): + if isinstance(trigger, (IOBase, bytes)): _content = trigger else: _json = self._serialize.body(trigger, "Trigger") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,7 +521,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -581,7 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -597,8 +597,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +640,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_users_operations.py b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_users_operations.py index 881b56552428..baaf8c378d6b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_users_operations.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2022_03_01/operations/_users_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_by_data_box_edge_device_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_list_by_data_box_edge_device_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -82,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 +110,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: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +126,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -149,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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") @@ -193,6 +189,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_data_box_edge_device( @@ -215,7 +212,7 @@ def list_by_data_box_edge_device( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { @@ -270,8 +267,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +311,7 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( @@ -329,8 +327,9 @@ def get(self, device_name: str, name: str, resource_group_name: str, **kwargs: A 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +363,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.User]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: _json = self._serialize.body(user, "User") @@ -392,8 +391,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,7 +524,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.User] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -584,7 +584,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -600,8 +600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,7 +643,7 @@ def begin_delete(self, device_name: str, name: str, resource_group_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) 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) diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/bandwidth_schedule_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/bandwidth_schedule_delete.py index d5fa70dc665f..4f3f8ad7e4fa 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/bandwidth_schedule_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/bandwidth_schedule_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.bandwidth_schedules.begin_delete( + client.bandwidth_schedules.begin_delete( device_name="testedgedevice", name="bandwidth-1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/BandwidthScheduleDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_delete.py index adfeb49e47d4..c19d0064c311 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.containers.begin_delete( + client.containers.begin_delete( device_name="testedgedevice", storage_account_name="storageaccount1", container_name="blobcontainer1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ContainerDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_refresh.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_refresh.py index 90f51cfe511f..8515fab30ef8 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_refresh.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/container_refresh.py @@ -29,13 +29,12 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.containers.begin_refresh( + client.containers.begin_refresh( device_name="testedgedevice", storage_account_name="storageaccount1", container_name="blobcontainer1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ContainerRefresh.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/data_box_edge_device_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/data_box_edge_device_delete.py index 30f43303131f..1a3eb1ad5ad4 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/data_box_edge_device_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/data_box_edge_device_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.devices.begin_delete( + client.devices.begin_delete( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DataBoxEdgeDeviceDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_addons.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_addons.py index a7797ceb40e7..a8b88e1a84ec 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_addons.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_addons.py @@ -29,13 +29,12 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.addons.begin_delete( + client.addons.begin_delete( device_name="testedgedevice", role_name="KubernetesRole", addon_name="arcName", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DeleteAddons.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_monitoring_config.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_monitoring_config.py index 8c77347a089f..b2c39fa9f45c 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_monitoring_config.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/delete_monitoring_config.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.monitoring_config.begin_delete( + client.monitoring_config.begin_delete( device_name="testedgedevice", role_name="testrole", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DeleteMonitoringConfig.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/device_capacity_request_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/device_capacity_request_post.py index babc7191b2d5..accbf967cd45 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/device_capacity_request_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/device_capacity_request_post.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.device_capacity_check.begin_check_resource_creation_feasibility( + client.device_capacity_check.begin_check_resource_creation_feasibility( resource_group_name="GroupForEdgeAutomation", device_name="testedgedevice", device_capacity_request_info={"properties": {"vmPlacementQuery": [["Standard_D2_v2"]]}}, ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DeviceCapacityRequestPost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/download_updates_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/download_updates_post.py index 9d0538df493b..a02765d45b93 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/download_updates_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/download_updates_post.py @@ -29,11 +29,10 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.devices.begin_download_updates( + client.devices.begin_download_updates( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/DownloadUpdatesPost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/install_updates_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/install_updates_post.py index 5d8834ff0744..272f955a5165 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/install_updates_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/install_updates_post.py @@ -29,11 +29,10 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.devices.begin_install_updates( + client.devices.begin_install_updates( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/InstallUpdatesPost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/order_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/order_delete.py index 283441eb0e8f..ceb784269082 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/order_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/order_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.orders.begin_delete( + client.orders.begin_delete( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/OrderDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/role_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/role_delete.py index 15728c7fc7ce..0239ab249b64 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/role_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/role_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.roles.begin_delete( + client.roles.begin_delete( device_name="testedgedevice", name="IoTRole1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/RoleDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/sac_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/sac_delete.py index 2a8ba3fbc404..e8deeba26c78 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/sac_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/sac_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.storage_account_credentials.begin_delete( + client.storage_account_credentials.begin_delete( device_name="testedgedevice", name="sac1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/SACDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/scan_for_updates_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/scan_for_updates_post.py index 273160b47b2d..3a2a01a5c490 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/scan_for_updates_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/scan_for_updates_post.py @@ -29,11 +29,10 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.devices.begin_scan_for_updates( + client.devices.begin_scan_for_updates( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ScanForUpdatesPost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/security_settings_update_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/security_settings_update_post.py index e683935f008c..e13fdf44f169 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/security_settings_update_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/security_settings_update_post.py @@ -29,7 +29,7 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.devices.begin_create_or_update_security_settings( + client.devices.begin_create_or_update_security_settings( device_name="testedgedevice", resource_group_name="AzureVM", security_settings={ @@ -42,7 +42,6 @@ def main(): } }, ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/SecuritySettingsUpdatePost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_delete.py index 1e40690070e4..998edb3af68b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.shares.begin_delete( + client.shares.begin_delete( device_name="testedgedevice", name="smbshare", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ShareDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_refresh_post.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_refresh_post.py index 7baafc5b9443..00bf1163f151 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_refresh_post.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/share_refresh_post.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.shares.begin_refresh( + client.shares.begin_refresh( device_name="testedgedevice", name="smbshare", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/ShareRefreshPost.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/storage_account_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/storage_account_delete.py index 3639cae63804..d7041b029a3b 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/storage_account_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/storage_account_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.storage_accounts.begin_delete( + client.storage_accounts.begin_delete( device_name="testedgedevice", storage_account_name="storageaccount1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/StorageAccountDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_delete.py index 2552e6079227..cff924fd71cc 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.triggers.begin_delete( + client.triggers.begin_delete( device_name="testedgedevice", name="trigger1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/TriggerDelete.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_support_package.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_support_package.py index e07c83cd7a3e..216d4e0ae017 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_support_package.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/trigger_support_package.py @@ -29,7 +29,7 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.support_packages.begin_trigger_support_package( + client.support_packages.begin_trigger_support_package( device_name="testedgedevice", resource_group_name="GroupForEdgeAutomation", trigger_support_package_request={ @@ -40,7 +40,6 @@ def main(): } }, ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/TriggerSupportPackage.json diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/user_delete.py b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/user_delete.py index df0f201f1de0..e97f8bc881d1 100644 --- a/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/user_delete.py +++ b/sdk/databoxedge/azure-mgmt-databoxedge/generated_samples/user_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", ) - response = client.users.begin_delete( + client.users.begin_delete( device_name="testedgedevice", name="user1", resource_group_name="GroupForEdgeAutomation", ).result() - print(response) # x-ms-original-file: specification/databoxedge/resource-manager/Microsoft.DataBoxEdge/stable/2022-03-01/examples/UserDelete.json diff --git a/sdk/databricks/azure-mgmt-databricks/_meta.json b/sdk/databricks/azure-mgmt-databricks/_meta.json index f2a9d3dd0662..26f7a1a99591 100644 --- a/sdk/databricks/azure-mgmt-databricks/_meta.json +++ b/sdk/databricks/azure-mgmt-databricks/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f36175f4c54eeec5b6d409406e131dadb540546a", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/databricks/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/databricks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/databricks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_serialization.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_serialization.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_serialization.py @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py index de022539b725..d402d6e9b342 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py @@ -63,7 +63,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py index 9ad1ef8fb372..c01eb1689102 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py @@ -82,7 +82,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[List[_models.OutboundEnvironmentEndpoint]] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py index 1a1dc18d5f27..8ff7e604ff6f 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py @@ -83,7 +83,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateEndpointConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -176,7 +176,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -234,7 +234,7 @@ async def _create_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -419,7 +419,7 @@ async def begin_create( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +479,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -544,7 +544,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py index 292b13ae31ac..503f4fd6a398 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py @@ -74,7 +74,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateLinkResourcesList] = kwargs.pop("cls", None) error_map = { @@ -167,7 +167,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py index 02a4ff40a45c..eb77cd3e83a3 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py @@ -89,7 +89,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[Optional[_models.VirtualNetworkPeering]] = kwargs.pop("cls", None) request = build_get_request( @@ -144,7 +144,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -207,7 +207,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -267,7 +267,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) @@ -443,7 +443,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -510,7 +510,7 @@ def list_by_workspace( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.VirtualNetworkPeeringList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py index b2a46117a8d3..089fd0eb96a8 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py @@ -87,7 +87,7 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) request = build_get_request( @@ -126,7 +126,7 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any + self, resource_group_name: str, workspace_name: str, retain_uc_data: Optional[bool] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -139,13 +139,14 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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, + retain_uc_data=retain_uc_data, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -174,7 +175,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } @distributed_trace_async - async def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete( + self, resource_group_name: str, workspace_name: str, retain_uc_data: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: """Deletes the workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -182,6 +185,9 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str + :param retain_uc_data: Optional parameter to retain default unity catalog data. By default the + data will retained if Uc is enabled on the workspace. Default value is None. + :type retain_uc_data: bool :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -197,7 +203,7 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -206,6 +212,7 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, workspace_name=workspace_name, + retain_uc_data=retain_uc_data, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -251,7 +258,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) @@ -410,7 +417,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -473,7 +480,7 @@ async def _update_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Workspace]] = kwargs.pop("cls", None) @@ -634,7 +641,7 @@ async def begin_update( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -694,7 +701,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) error_map = { @@ -767,7 +774,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspac _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py index ac37825003f8..9dfa7217492e 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py @@ -11,13 +11,18 @@ from ._models_py3 import AccessConnectorProperties from ._models_py3 import AccessConnectorUpdate from ._models_py3 import AddressSpace +from ._models_py3 import AutomaticClusterUpdateDefinition +from ._models_py3 import ComplianceSecurityProfileDefinition from ._models_py3 import CreatedBy +from ._models_py3 import DefaultCatalogProperties from ._models_py3 import Encryption from ._models_py3 import EncryptionEntitiesDefinition from ._models_py3 import EncryptionV2 from ._models_py3 import EncryptionV2KeyVaultProperties from ._models_py3 import EndpointDependency from ._models_py3 import EndpointDetail +from ._models_py3 import EnhancedSecurityComplianceDefinition +from ._models_py3 import EnhancedSecurityMonitoringDefinition from ._models_py3 import ErrorDetail from ._models_py3 import ErrorInfo from ._models_py3 import ErrorResponse @@ -53,17 +58,25 @@ from ._models_py3 import WorkspaceCustomStringParameter from ._models_py3 import WorkspaceEncryptionParameter from ._models_py3 import WorkspaceListResult +from ._models_py3 import WorkspacePropertiesAccessConnector from ._models_py3 import WorkspacePropertiesEncryption from ._models_py3 import WorkspaceProviderAuthorization from ._models_py3 import WorkspaceUpdate +from ._azure_databricks_management_client_enums import AutomaticClusterUpdateValue +from ._azure_databricks_management_client_enums import ComplianceSecurityProfileValue +from ._azure_databricks_management_client_enums import ComplianceStandard from ._azure_databricks_management_client_enums import CreatedByType from ._azure_databricks_management_client_enums import CustomParameterType from ._azure_databricks_management_client_enums import EncryptionKeySource +from ._azure_databricks_management_client_enums import EnhancedSecurityMonitoringValue +from ._azure_databricks_management_client_enums import IdentityType +from ._azure_databricks_management_client_enums import InitialType from ._azure_databricks_management_client_enums import KeySource from ._azure_databricks_management_client_enums import ManagedServiceIdentityType from ._azure_databricks_management_client_enums import PeeringProvisioningState from ._azure_databricks_management_client_enums import PeeringState +from ._azure_databricks_management_client_enums import PrivateDbfsAccess from ._azure_databricks_management_client_enums import PrivateEndpointConnectionProvisioningState from ._azure_databricks_management_client_enums import PrivateLinkServiceConnectionStatus from ._azure_databricks_management_client_enums import ProvisioningState @@ -79,13 +92,18 @@ "AccessConnectorProperties", "AccessConnectorUpdate", "AddressSpace", + "AutomaticClusterUpdateDefinition", + "ComplianceSecurityProfileDefinition", "CreatedBy", + "DefaultCatalogProperties", "Encryption", "EncryptionEntitiesDefinition", "EncryptionV2", "EncryptionV2KeyVaultProperties", "EndpointDependency", "EndpointDetail", + "EnhancedSecurityComplianceDefinition", + "EnhancedSecurityMonitoringDefinition", "ErrorDetail", "ErrorInfo", "ErrorResponse", @@ -121,16 +139,24 @@ "WorkspaceCustomStringParameter", "WorkspaceEncryptionParameter", "WorkspaceListResult", + "WorkspacePropertiesAccessConnector", "WorkspacePropertiesEncryption", "WorkspaceProviderAuthorization", "WorkspaceUpdate", + "AutomaticClusterUpdateValue", + "ComplianceSecurityProfileValue", + "ComplianceStandard", "CreatedByType", "CustomParameterType", "EncryptionKeySource", + "EnhancedSecurityMonitoringValue", + "IdentityType", + "InitialType", "KeySource", "ManagedServiceIdentityType", "PeeringProvisioningState", "PeeringState", + "PrivateDbfsAccess", "PrivateEndpointConnectionProvisioningState", "PrivateLinkServiceConnectionStatus", "ProvisioningState", diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py index d2c537b8f206..8075279146ff 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py @@ -10,6 +10,28 @@ from azure.core import CaseInsensitiveEnumMeta +class AutomaticClusterUpdateValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutomaticClusterUpdateValue.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ComplianceSecurityProfileValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ComplianceSecurityProfileValue.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ComplianceStandard(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Compliance standard that can be associated with a workspace.""" + + NONE = "NONE" + HIPAA = "HIPAA" + PCI_DSS = "PCI_DSS" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -33,6 +55,29 @@ class EncryptionKeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): MICROSOFT_KEYVAULT = "Microsoft.Keyvault" +class EnhancedSecurityMonitoringValue(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """EnhancedSecurityMonitoringValue.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The identity type of the Access Connector Resource.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + + +class InitialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the initial type of the default catalog. Possible values (case-insensitive): + HiveMetastore, UnityCatalog. + """ + + HIVE_METASTORE = "HiveMetastore" + UNITY_CATALOG = "UnityCatalog" + + class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault. @@ -70,6 +115,13 @@ class PeeringState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISCONNECTED = "Disconnected" +class PrivateDbfsAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or Sets Private DBFS Access configuration information.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state.""" @@ -90,18 +142,18 @@ class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnu class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning status of the workspace.""" + """Provisioning status of the accessConnector.""" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" ACCEPTED = "Accepted" RUNNING = "Running" READY = "Ready" CREATING = "Creating" CREATED = "Created" DELETING = "Deleting" - DELETED = "Deleted" CANCELED = "Canceled" - FAILED = "Failed" - SUCCEEDED = "Succeeded" UPDATING = "Updating" diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py index 9e28712ebc0b..65194476b245 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py @@ -212,8 +212,8 @@ class AccessConnectorProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning status of the accessConnector. Known values are: - "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", "Canceled", - "Failed", "Succeeded", and "Updating". + "Deleted", "Failed", "Succeeded", "Accepted", "Running", "Ready", "Creating", "Created", + "Deleting", "Canceled", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.databricks.models.ProvisioningState """ @@ -286,6 +286,60 @@ def __init__(self, *, address_prefixes: Optional[List[str]] = None, **kwargs: An self.address_prefixes = address_prefixes +class AutomaticClusterUpdateDefinition(_serialization.Model): + """Status of automated cluster updates feature. + + :ivar value: Known values are: "Enabled" and "Disabled". + :vartype value: str or ~azure.mgmt.databricks.models.AutomaticClusterUpdateValue + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, *, value: Optional[Union[str, "_models.AutomaticClusterUpdateValue"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Known values are: "Enabled" and "Disabled". + :paramtype value: str or ~azure.mgmt.databricks.models.AutomaticClusterUpdateValue + """ + super().__init__(**kwargs) + self.value = value + + +class ComplianceSecurityProfileDefinition(_serialization.Model): + """Status of Compliance Security Profile feature. + + :ivar compliance_standards: Compliance standards associated with the workspace. + :vartype compliance_standards: list[str or ~azure.mgmt.databricks.models.ComplianceStandard] + :ivar value: Known values are: "Enabled" and "Disabled". + :vartype value: str or ~azure.mgmt.databricks.models.ComplianceSecurityProfileValue + """ + + _attribute_map = { + "compliance_standards": {"key": "complianceStandards", "type": "[str]"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + compliance_standards: Optional[List[Union[str, "_models.ComplianceStandard"]]] = None, + value: Optional[Union[str, "_models.ComplianceSecurityProfileValue"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword compliance_standards: Compliance standards associated with the workspace. + :paramtype compliance_standards: list[str or ~azure.mgmt.databricks.models.ComplianceStandard] + :keyword value: Known values are: "Enabled" and "Disabled". + :paramtype value: str or ~azure.mgmt.databricks.models.ComplianceSecurityProfileValue + """ + super().__init__(**kwargs) + self.compliance_standards = compliance_standards + self.value = value + + class CreatedBy(_serialization.Model): """Provides details of the entity that created/updated the workspace. @@ -320,6 +374,44 @@ def __init__(self, **kwargs: Any) -> None: self.application_id = None +class DefaultCatalogProperties(_serialization.Model): + """These properties lets user specify default catalog properties during workspace creation. + + :ivar initial_type: Defines the initial type of the default catalog. Possible values + (case-insensitive): HiveMetastore, UnityCatalog. Known values are: "HiveMetastore" and + "UnityCatalog". + :vartype initial_type: str or ~azure.mgmt.databricks.models.InitialType + :ivar initial_name: Specifies the initial Name of default catalog. If not specified, the name + of the workspace will be used. + :vartype initial_name: str + """ + + _attribute_map = { + "initial_type": {"key": "initialType", "type": "str"}, + "initial_name": {"key": "initialName", "type": "str"}, + } + + def __init__( + self, + *, + initial_type: Union[str, "_models.InitialType"] = "HiveMetastore", + initial_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword initial_type: Defines the initial type of the default catalog. Possible values + (case-insensitive): HiveMetastore, UnityCatalog. Known values are: "HiveMetastore" and + "UnityCatalog". + :paramtype initial_type: str or ~azure.mgmt.databricks.models.InitialType + :keyword initial_name: Specifies the initial Name of default catalog. If not specified, the + name of the workspace will be used. + :paramtype initial_name: str + """ + super().__init__(**kwargs) + self.initial_type = initial_type + self.initial_name = initial_name + + class Encryption(_serialization.Model): """The object that contains details of encryption used on the workspace. @@ -562,6 +654,79 @@ def __init__( self.is_accessible = is_accessible +class EnhancedSecurityComplianceDefinition(_serialization.Model): + """Status of settings related to the Enhanced Security and Compliance Add-On. + + :ivar automatic_cluster_update: Status of automated cluster updates feature. + :vartype automatic_cluster_update: + ~azure.mgmt.databricks.models.AutomaticClusterUpdateDefinition + :ivar compliance_security_profile: Status of Compliance Security Profile feature. + :vartype compliance_security_profile: + ~azure.mgmt.databricks.models.ComplianceSecurityProfileDefinition + :ivar enhanced_security_monitoring: Status of Enhanced Security Monitoring feature. + :vartype enhanced_security_monitoring: + ~azure.mgmt.databricks.models.EnhancedSecurityMonitoringDefinition + """ + + _attribute_map = { + "automatic_cluster_update": {"key": "automaticClusterUpdate", "type": "AutomaticClusterUpdateDefinition"}, + "compliance_security_profile": { + "key": "complianceSecurityProfile", + "type": "ComplianceSecurityProfileDefinition", + }, + "enhanced_security_monitoring": { + "key": "enhancedSecurityMonitoring", + "type": "EnhancedSecurityMonitoringDefinition", + }, + } + + def __init__( + self, + *, + automatic_cluster_update: Optional["_models.AutomaticClusterUpdateDefinition"] = None, + compliance_security_profile: Optional["_models.ComplianceSecurityProfileDefinition"] = None, + enhanced_security_monitoring: Optional["_models.EnhancedSecurityMonitoringDefinition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword automatic_cluster_update: Status of automated cluster updates feature. + :paramtype automatic_cluster_update: + ~azure.mgmt.databricks.models.AutomaticClusterUpdateDefinition + :keyword compliance_security_profile: Status of Compliance Security Profile feature. + :paramtype compliance_security_profile: + ~azure.mgmt.databricks.models.ComplianceSecurityProfileDefinition + :keyword enhanced_security_monitoring: Status of Enhanced Security Monitoring feature. + :paramtype enhanced_security_monitoring: + ~azure.mgmt.databricks.models.EnhancedSecurityMonitoringDefinition + """ + super().__init__(**kwargs) + self.automatic_cluster_update = automatic_cluster_update + self.compliance_security_profile = compliance_security_profile + self.enhanced_security_monitoring = enhanced_security_monitoring + + +class EnhancedSecurityMonitoringDefinition(_serialization.Model): + """Status of Enhanced Security Monitoring feature. + + :ivar value: Known values are: "Enabled" and "Disabled". + :vartype value: str or ~azure.mgmt.databricks.models.EnhancedSecurityMonitoringValue + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, *, value: Optional[Union[str, "_models.EnhancedSecurityMonitoringValue"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Known values are: "Enabled" and "Disabled". + :paramtype value: str or ~azure.mgmt.databricks.models.EnhancedSecurityMonitoringValue + """ + super().__init__(**kwargs) + self.value = value + + class ErrorDetail(_serialization.Model): """Error details. @@ -1697,9 +1862,9 @@ class Workspace(TrackedResource): # pylint: disable=too-many-instance-attribute :vartype managed_resource_group_id: str :ivar parameters: The workspace's custom parameters. :vartype parameters: ~azure.mgmt.databricks.models.WorkspaceCustomParameters - :ivar provisioning_state: The workspace provisioning state. Known values are: "Accepted", - "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", "Canceled", "Failed", - "Succeeded", and "Updating". + :ivar provisioning_state: The workspace provisioning state. Known values are: "Deleted", + "Failed", "Succeeded", "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", + "Canceled", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.databricks.models.ProvisioningState :ivar ui_definition_uri: The blob URI where the UI definition file is located. :vartype ui_definition_uri: str @@ -1728,6 +1893,10 @@ class Workspace(TrackedResource): # pylint: disable=too-many-instance-attribute :vartype disk_encryption_set_id: str :ivar encryption: Encryption properties for databricks workspace. :vartype encryption: ~azure.mgmt.databricks.models.WorkspacePropertiesEncryption + :ivar enhanced_security_compliance: Contains settings related to the Enhanced Security and + Compliance Add-On. + :vartype enhanced_security_compliance: + ~azure.mgmt.databricks.models.EnhancedSecurityComplianceDefinition :ivar private_endpoint_connections: Private endpoint connections created on the workspace. :vartype private_endpoint_connections: list[~azure.mgmt.databricks.models.PrivateEndpointConnection] @@ -1739,6 +1908,16 @@ class Workspace(TrackedResource): # pylint: disable=too-many-instance-attribute 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Known values are: "AllRules", "NoAzureDatabricksRules", and "NoAzureServiceRules". :vartype required_nsg_rules: str or ~azure.mgmt.databricks.models.RequiredNsgRules + :ivar default_catalog: Properties for Default Catalog configuration during workspace creation. + :vartype default_catalog: ~azure.mgmt.databricks.models.DefaultCatalogProperties + :ivar is_uc_enabled: Indicates whether unity catalog enabled for the workspace or not. + :vartype is_uc_enabled: bool + :ivar access_connector: Access Connector Resource that is going to be associated with + Databricks Workspace. + :vartype access_connector: ~azure.mgmt.databricks.models.WorkspacePropertiesAccessConnector + :ivar private_dbfs_access: Gets or Sets Private DBFS Access configuration information. Known + values are: "Disabled" and "Enabled". + :vartype private_dbfs_access: str or ~azure.mgmt.databricks.models.PrivateDbfsAccess """ _validation = { @@ -1754,6 +1933,7 @@ class Workspace(TrackedResource): # pylint: disable=too-many-instance-attribute "workspace_url": {"readonly": True}, "disk_encryption_set_id": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, + "is_uc_enabled": {"readonly": True}, } _attribute_map = { @@ -1781,12 +1961,20 @@ class Workspace(TrackedResource): # pylint: disable=too-many-instance-attribute "managed_disk_identity": {"key": "properties.managedDiskIdentity", "type": "ManagedIdentityConfiguration"}, "disk_encryption_set_id": {"key": "properties.diskEncryptionSetId", "type": "str"}, "encryption": {"key": "properties.encryption", "type": "WorkspacePropertiesEncryption"}, + "enhanced_security_compliance": { + "key": "properties.enhancedSecurityCompliance", + "type": "EnhancedSecurityComplianceDefinition", + }, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "required_nsg_rules": {"key": "properties.requiredNsgRules", "type": "str"}, + "default_catalog": {"key": "properties.defaultCatalog", "type": "DefaultCatalogProperties"}, + "is_uc_enabled": {"key": "properties.isUcEnabled", "type": "bool"}, + "access_connector": {"key": "properties.accessConnector", "type": "WorkspacePropertiesAccessConnector"}, + "private_dbfs_access": {"key": "properties.privateDbfsAccess", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1804,8 +1992,12 @@ def __init__( # pylint: disable=too-many-locals storage_account_identity: Optional["_models.ManagedIdentityConfiguration"] = None, managed_disk_identity: Optional["_models.ManagedIdentityConfiguration"] = None, encryption: Optional["_models.WorkspacePropertiesEncryption"] = None, + enhanced_security_compliance: Optional["_models.EnhancedSecurityComplianceDefinition"] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, required_nsg_rules: Optional[Union[str, "_models.RequiredNsgRules"]] = None, + default_catalog: Optional["_models.DefaultCatalogProperties"] = None, + access_connector: Optional["_models.WorkspacePropertiesAccessConnector"] = None, + private_dbfs_access: Optional[Union[str, "_models.PrivateDbfsAccess"]] = None, **kwargs: Any ) -> None: """ @@ -1836,6 +2028,10 @@ def __init__( # pylint: disable=too-many-locals :paramtype managed_disk_identity: ~azure.mgmt.databricks.models.ManagedIdentityConfiguration :keyword encryption: Encryption properties for databricks workspace. :paramtype encryption: ~azure.mgmt.databricks.models.WorkspacePropertiesEncryption + :keyword enhanced_security_compliance: Contains settings related to the Enhanced Security and + Compliance Add-On. + :paramtype enhanced_security_compliance: + ~azure.mgmt.databricks.models.EnhancedSecurityComplianceDefinition :keyword public_network_access: The network access type for accessing workspace. Set value to disabled to access workspace only via private link. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.databricks.models.PublicNetworkAccess @@ -1844,6 +2040,15 @@ def __init__( # pylint: disable=too-many-locals 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Known values are: "AllRules", "NoAzureDatabricksRules", and "NoAzureServiceRules". :paramtype required_nsg_rules: str or ~azure.mgmt.databricks.models.RequiredNsgRules + :keyword default_catalog: Properties for Default Catalog configuration during workspace + creation. + :paramtype default_catalog: ~azure.mgmt.databricks.models.DefaultCatalogProperties + :keyword access_connector: Access Connector Resource that is going to be associated with + Databricks Workspace. + :paramtype access_connector: ~azure.mgmt.databricks.models.WorkspacePropertiesAccessConnector + :keyword private_dbfs_access: Gets or Sets Private DBFS Access configuration information. Known + values are: "Disabled" and "Enabled". + :paramtype private_dbfs_access: str or ~azure.mgmt.databricks.models.PrivateDbfsAccess """ super().__init__(tags=tags, location=location, **kwargs) self.sku = sku @@ -1862,9 +2067,14 @@ def __init__( # pylint: disable=too-many-locals self.managed_disk_identity = managed_disk_identity self.disk_encryption_set_id = None self.encryption = encryption + self.enhanced_security_compliance = enhanced_security_compliance self.private_endpoint_connections = None self.public_network_access = public_network_access self.required_nsg_rules = required_nsg_rules + self.default_catalog = default_catalog + self.is_uc_enabled = None + self.access_connector = access_connector + self.private_dbfs_access = private_dbfs_access class WorkspaceCustomBooleanParameter(_serialization.Model): @@ -2201,6 +2411,58 @@ def __init__( self.next_link = next_link +class WorkspacePropertiesAccessConnector(_serialization.Model): + """Access Connector Resource that is going to be associated with Databricks Workspace. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID of Azure Databricks Access Connector Resource. Required. + :vartype id: str + :ivar identity_type: The identity type of the Access Connector Resource. Required. Known values + are: "SystemAssigned" and "UserAssigned". + :vartype identity_type: str or ~azure.mgmt.databricks.models.IdentityType + :ivar user_assigned_identity_id: The resource ID of the User Assigned Identity associated with + the Access Connector Resource. This is required for type 'UserAssigned' and not valid for type + 'SystemAssigned'. + :vartype user_assigned_identity_id: str + """ + + _validation = { + "id": {"required": True}, + "identity_type": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "identity_type": {"key": "identityType", "type": "str"}, + "user_assigned_identity_id": {"key": "userAssignedIdentityId", "type": "str"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + identity_type: Union[str, "_models.IdentityType"], + user_assigned_identity_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The resource ID of Azure Databricks Access Connector Resource. Required. + :paramtype id: str + :keyword identity_type: The identity type of the Access Connector Resource. Required. Known + values are: "SystemAssigned" and "UserAssigned". + :paramtype identity_type: str or ~azure.mgmt.databricks.models.IdentityType + :keyword user_assigned_identity_id: The resource ID of the User Assigned Identity associated + with the Access Connector Resource. This is required for type 'UserAssigned' and not valid for + type 'SystemAssigned'. + :paramtype user_assigned_identity_id: str + """ + super().__init__(**kwargs) + self.id = id + self.identity_type = identity_type + self.user_assigned_identity_id = user_assigned_identity_id + + class WorkspacePropertiesEncryption(_serialization.Model): """Encryption properties for databricks workspace. diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_access_connectors_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_access_connectors_operations.py index c654e272a4e8..2116958339f8 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_access_connectors_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_access_connectors_operations.py @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +60,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -93,7 +93,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -127,7 +127,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -163,7 +163,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -195,7 +195,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -219,7 +219,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py index f7ffaffe1228..40305360049e 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py @@ -39,7 +39,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py index d5a292eb45b2..94844652c0a1 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -118,7 +118,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[List[_models.OutboundEnvironmentEndpoint]] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py index ffe13a16a692..509fbcbaf1f9 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +44,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -81,7 +81,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +100,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") @@ -121,7 +121,7 @@ def build_create_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +141,7 @@ def build_create_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") @@ -164,7 +164,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +183,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") @@ -235,7 +235,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateEndpointConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -328,7 +328,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -386,7 +386,7 @@ def _create_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -568,7 +568,7 @@ def begin_create( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -628,7 +628,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -693,7 +693,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py index ef2b862e3862..98689f504ff5 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -74,7 +74,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_get_request( "groupId": _SERIALIZER.url("group_id", group_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") @@ -142,7 +142,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.PrivateLinkResourcesList] = kwargs.pop("cls", None) error_map = { @@ -235,7 +235,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.GroupIdInformation] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py index 4d8af85087e4..a45f715ae04c 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +44,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_get_request( "peeringName": _SERIALIZER.url("peering_name", peering_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") @@ -78,7 +78,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +95,7 @@ def build_delete_request( "peeringName": _SERIALIZER.url("peering_name", peering_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") @@ -112,7 +112,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +130,7 @@ def build_create_or_update_request( "peeringName": _SERIALIZER.url("peering_name", peering_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") @@ -149,7 +149,7 @@ def build_list_by_workspace_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +165,7 @@ def build_list_by_workspace_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -224,7 +224,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[Optional[_models.VirtualNetworkPeering]] = kwargs.pop("cls", None) request = build_get_request( @@ -279,7 +279,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -342,7 +342,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -402,7 +402,7 @@ def _create_or_update_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) @@ -578,7 +578,7 @@ def begin_create_or_update( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -644,7 +644,7 @@ def list_by_workspace( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.VirtualNetworkPeeringList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py index f45b6816d261..2dcdc58394ea 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +44,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -72,12 +72,17 @@ def build_get_request( 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, + *, + retain_uc_data: Optional[bool] = 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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +98,12 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") + if retain_uc_data is not None: + _params["retainUcData"] = _SERIALIZER.query("retain_uc_data", retain_uc_data, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -110,7 +117,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +134,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -146,7 +153,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -163,7 +170,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -180,7 +187,7 @@ def build_list_by_resource_group_request(resource_group_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +202,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -210,7 +217,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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +226,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -274,7 +281,7 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) request = build_get_request( @@ -313,7 +320,7 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any + self, resource_group_name: str, workspace_name: str, retain_uc_data: Optional[bool] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -326,13 +333,14 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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, + retain_uc_data=retain_uc_data, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -361,7 +369,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } @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, retain_uc_data: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[None]: """Deletes the workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -369,6 +379,9 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str + :param retain_uc_data: Optional parameter to retain default unity catalog data. By default the + data will retained if Uc is enabled on the workspace. Default value is None. + :type retain_uc_data: bool :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -384,7 +397,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -393,6 +406,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, workspace_name=workspace_name, + retain_uc_data=retain_uc_data, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -438,7 +452,7 @@ def _create_or_update_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) @@ -594,7 +608,7 @@ def begin_create_or_update( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -657,7 +671,7 @@ def _update_initial( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Workspace]] = kwargs.pop("cls", None) @@ -815,7 +829,7 @@ def begin_update( _headers = case_insensitive_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-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) 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) @@ -875,7 +889,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) error_map = { @@ -948,7 +962,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/disable_encryption.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/disable_encryption.py index 5b2885f2c212..4d006f356b34 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/disable_encryption.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/disable_encryption.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/DisableEncryption.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/DisableEncryption.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/enable_encryption.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/enable_encryption.py index 5dcefd4874dd..0f3196ab76bb 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/enable_encryption.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/enable_encryption.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/EnableEncryption.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/EnableEncryption.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_endpoint_connections.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_endpoint_connections.py index 72771d1f6e64..20e7d18bd09b 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_endpoint_connections.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_endpoint_connections.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_link_resources.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_link_resources.py index f6c949cdd93a..cf829e33909f 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_link_resources.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/list_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/operations_list.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/operations_list.py index 8f4805d40a05..ad91980e79e1 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/operations_list.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/OperationsList.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/outbound_network_dependencies_endpoints_list.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/outbound_network_dependencies_endpoints_list.py index 9e31d4e14af5..64e48e026135 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/outbound_network_dependencies_endpoints_list.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/outbound_network_dependencies_endpoints_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/OutboundNetworkDependenciesEndpointsList.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/OutboundNetworkDependenciesEndpointsList.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/prepare_encryption.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/prepare_encryption.py index 4c3469c30827..abcd572c7e0e 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/prepare_encryption.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/prepare_encryption.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/PrepareEncryption.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/PrepareEncryption.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_delete.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_delete.py index 04977a28759f..1eeda23bf38c 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_delete.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/PrivateEndpointConnectionsDelete.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/PrivateEndpointConnectionsDelete.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_get.py index a575472ea6a9..2d31338941d3 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_get.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/PrivateEndpointConnectionsGet.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/PrivateEndpointConnectionsGet.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_update.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_update.py index b6bd920b70dc..dbf7f84a8e1d 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_update.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_endpoint_connections_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/PrivateEndpointConnectionsUpdate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/PrivateEndpointConnectionsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_link_resources_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_link_resources_get.py index 05e95ba4db48..9823fcb6f8bd 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/private_link_resources_get.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/private_link_resources_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/PrivateLinkResourcesGet.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/PrivateLinkResourcesGet.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create.py index 281c09558388..6bf6d4c2ecd1 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create.py @@ -34,12 +34,20 @@ def main(): workspace_name="myWorkspace", parameters={ "location": "westus", - "properties": {"managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG"}, + "properties": { + "accessConnector": { + "id": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/adbrg/providers/Microsoft.Databricks/accessConnectors/myAccessConnector", + "identityType": "SystemAssigned", + }, + "defaultCatalog": {"initialName": "", "initialType": "UnityCatalog"}, + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "privateDbfsAccess": "Enabled", + }, }, ).result() print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceCreate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceCreate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create_with_parameters.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create_with_parameters.py index 536e3d920eb5..f91b9cb149e5 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create_with_parameters.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_create_with_parameters.py @@ -35,6 +35,12 @@ def main(): parameters={ "location": "westus", "properties": { + "accessConnector": { + "id": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/adbrg/providers/Microsoft.Databricks/accessConnectors/myAccessConnector", + "identityType": "UserAssigned", + "userAssignedIdentityId": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity", + }, + "defaultCatalog": {"initialName": "", "initialType": "HiveMetastore"}, "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", "parameters": { "customPrivateSubnetName": {"value": "myPrivateSubnet"}, @@ -43,12 +49,13 @@ def main(): "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" }, }, + "privateDbfsAccess": "Enabled", }, }, ).result() print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceCreateWithParameters.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceCreateWithParameters.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete.py index bf7af1a64123..59debd2c1139 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceDelete.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete_retain_uc_data.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete_retain_uc_data.py new file mode 100644 index 000000000000..24e5defa883f --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_delete_retain_uc_data.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.databricks import AzureDatabricksManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-databricks +# USAGE + python workspace_delete_retain_uc_data.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 = AzureDatabricksManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.workspaces.begin_delete( + resource_group_name="rg", + workspace_name="myWorkspace", + ).result() + + +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceDeleteRetainUcData.json +if __name__ == "__main__": + main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_create_or_update.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_create_or_update.py new file mode 100644 index 000000000000..6aee63433159 --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_create_or_update.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.databricks import AzureDatabricksManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-databricks +# USAGE + python workspace_enhanced_security_compliance_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 = AzureDatabricksManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.workspaces.begin_create_or_update( + resource_group_name="rg", + workspace_name="myWorkspace", + parameters={ + "location": "eastus2", + "properties": { + "enhancedSecurityCompliance": { + "automaticClusterUpdate": {"value": "Enabled"}, + "complianceSecurityProfile": {"complianceStandards": ["PCI_DSS", "HIPAA"], "value": "Enabled"}, + "enhancedSecurityMonitoring": {"value": "Enabled"}, + }, + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceEnhancedSecurityComplianceCreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_get.py new file mode 100644 index 000000000000..54a28138e5f4 --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_enhanced_security_compliance_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.databricks import AzureDatabricksManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-databricks +# USAGE + python workspace_enhanced_security_compliance_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 = AzureDatabricksManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.workspaces.get( + resource_group_name="rg", + workspace_name="myWorkspace", + ) + print(response) + + +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceEnhancedSecurityComplianceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get.py index eeff767db884..45f956b365e3 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceGet.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get_parameters.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get_parameters.py index f5635ad9eb64..708455fff088 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get_parameters.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_get_parameters.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceGetParameters.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceGetParameters.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_create.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_create.py index 36786e299bb7..264eb51ba216 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_create.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_create.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceManagedDiskEncryptionCreate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceManagedDiskEncryptionCreate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_get.py index cdea6e0feb72..cd0073b68d35 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_get.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceManagedDiskEncryptionGet.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceManagedDiskEncryptionGet.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_update.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_update.py index 0477f5f6bb62..084babad0b4b 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_update.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_managed_disk_encryption_update.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceManagedDiskEncryptionUpdate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceManagedDiskEncryptionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_update.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_update.py index 936fa87f41a5..2e5b1be0ff84 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_update.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceUpdate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceUpdate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_get.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_get.py index ffe862a7571e..7623966305d5 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_get.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceVirtualNetPeeringGet.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceVirtualNetPeeringGet.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_list.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_list.py index b9b693f23db6..2a22e68bd605 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_list.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_net_peering_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceVirtualNetPeeringList.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceVirtualNetPeeringList.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_create_or_update.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_create_or_update.py index fb6e44baca00..c94900d930d4 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_create_or_update.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_create_or_update.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceVirtualNetworkPeeringCreateOrUpdate.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceVirtualNetworkPeeringCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_delete.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_delete.py index 299ae6938391..9acd1c219061 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_delete.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspace_virtual_network_peering_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspaceVirtualNetworkPeeringDelete.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspaceVirtualNetworkPeeringDelete.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_resource_group.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_resource_group.py index 148a2b69d43c..51f39362d117 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_resource_group.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspacesListByResourceGroup.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspacesListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_subscription.py b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_subscription.py index ba81b1058a95..996661ed32a2 100644 --- a/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_subscription.py +++ b/sdk/databricks/azure-mgmt-databricks/generated_samples/workspaces_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-02-01/examples/WorkspacesListBySubscription.json +# x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/preview/2024-02-01-preview/examples/WorkspacesListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/datafactory/azure-mgmt-datafactory/_meta.json b/sdk/datafactory/azure-mgmt-datafactory/_meta.json index c7135bd5e145..171c0247346e 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/_meta.json +++ b/sdk/datafactory/azure-mgmt-datafactory/_meta.json @@ -1,11 +1,11 @@ { - "commit": "d1eb3c20113d1018f25a8d97fdfa5f8bb5c659ea", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/datafactory/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/datafactory/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/datafactory/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py index 34ea7990c4b4..c47f66669f1b 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0" diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py index d2e400109586..8387fcc75d17 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py @@ -658,6 +658,10 @@ from ._models_py3 import SnowflakeLinkedService from ._models_py3 import SnowflakeSink from ._models_py3 import SnowflakeSource +from ._models_py3 import SnowflakeV2Dataset +from ._models_py3 import SnowflakeV2LinkedService +from ._models_py3 import SnowflakeV2Sink +from ._models_py3 import SnowflakeV2Source from ._models_py3 import SparkConfigurationParametrizationReference from ._models_py3 import SparkLinkedService from ._models_py3 import SparkObjectDataset @@ -742,6 +746,10 @@ from ._models_py3 import VerticaSource from ._models_py3 import VerticaTableDataset from ._models_py3 import WaitActivity +from ._models_py3 import WarehouseLinkedService +from ._models_py3 import WarehouseSink +from ._models_py3 import WarehouseSource +from ._models_py3 import WarehouseTableDataset from ._models_py3 import WebActivity from ._models_py3 import WebActivityAuthentication from ._models_py3 import WebAnonymousAuthentication @@ -848,7 +856,6 @@ from ._data_factory_management_client_enums import SalesforceSinkWriteBehavior from ._data_factory_management_client_enums import SalesforceSourceReadBehavior from ._data_factory_management_client_enums import SalesforceV2SinkWriteBehavior -from ._data_factory_management_client_enums import SalesforceV2SourceReadBehavior from ._data_factory_management_client_enums import SapCloudForCustomerSinkWriteBehavior from ._data_factory_management_client_enums import SapHanaAuthenticationType from ._data_factory_management_client_enums import SapHanaPartitionOption @@ -861,6 +868,7 @@ from ._data_factory_management_client_enums import ServiceNowAuthenticationType from ._data_factory_management_client_enums import ServicePrincipalCredentialType from ._data_factory_management_client_enums import SftpAuthenticationType +from ._data_factory_management_client_enums import SnowflakeAuthenticationType from ._data_factory_management_client_enums import SparkAuthenticationType from ._data_factory_management_client_enums import SparkConfigurationReferenceType from ._data_factory_management_client_enums import SparkJobReferenceType @@ -1545,6 +1553,10 @@ "SnowflakeLinkedService", "SnowflakeSink", "SnowflakeSource", + "SnowflakeV2Dataset", + "SnowflakeV2LinkedService", + "SnowflakeV2Sink", + "SnowflakeV2Source", "SparkConfigurationParametrizationReference", "SparkLinkedService", "SparkObjectDataset", @@ -1629,6 +1641,10 @@ "VerticaSource", "VerticaTableDataset", "WaitActivity", + "WarehouseLinkedService", + "WarehouseSink", + "WarehouseSource", + "WarehouseTableDataset", "WebActivity", "WebActivityAuthentication", "WebAnonymousAuthentication", @@ -1734,7 +1750,6 @@ "SalesforceSinkWriteBehavior", "SalesforceSourceReadBehavior", "SalesforceV2SinkWriteBehavior", - "SalesforceV2SourceReadBehavior", "SapCloudForCustomerSinkWriteBehavior", "SapHanaAuthenticationType", "SapHanaPartitionOption", @@ -1747,6 +1762,7 @@ "ServiceNowAuthenticationType", "ServicePrincipalCredentialType", "SftpAuthenticationType", + "SnowflakeAuthenticationType", "SparkAuthenticationType", "SparkConfigurationReferenceType", "SparkJobReferenceType", diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py index 70f0e4e6417e..7f01ed8b6fe7 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py @@ -728,13 +728,6 @@ class SalesforceV2SinkWriteBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta UPSERT = "Upsert" -class SalesforceV2SourceReadBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Salesforce read behavior for the operation.""" - - QUERY = "query" - QUERY_ALL = "queryAll" - - class SapCloudForCustomerSinkWriteBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The write behavior for the operation. Default is 'Insert'.""" @@ -841,6 +834,14 @@ class SftpAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MULTI_FACTOR = "MultiFactor" +class SnowflakeAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type used for authentication. Type: string.""" + + BASIC = "Basic" + KEY_PAIR = "KeyPair" + AAD_SERVICE_PRINCIPAL = "AADServicePrincipal" + + class SparkAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The authentication method used to access the Spark server.""" diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py index 17202de840f3..8e8fd5962f44 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py @@ -499,10 +499,10 @@ class LinkedService(_serialization.Model): SapEccLinkedService, SapHanaLinkedService, SapOdpLinkedService, SapOpenHubLinkedService, SapTableLinkedService, ServiceNowLinkedService, SftpServerLinkedService, SharePointOnlineListLinkedService, ShopifyLinkedService, SmartsheetLinkedService, - SnowflakeLinkedService, SparkLinkedService, SqlServerLinkedService, SquareLinkedService, - SybaseLinkedService, TeamDeskLinkedService, TeradataLinkedService, TwilioLinkedService, - VerticaLinkedService, WebLinkedService, XeroLinkedService, ZendeskLinkedService, - ZohoLinkedService + SnowflakeLinkedService, SnowflakeV2LinkedService, SparkLinkedService, SqlServerLinkedService, + SquareLinkedService, SybaseLinkedService, TeamDeskLinkedService, TeradataLinkedService, + TwilioLinkedService, VerticaLinkedService, WarehouseLinkedService, WebLinkedService, + XeroLinkedService, ZendeskLinkedService, ZohoLinkedService All required parameters must be populated in order to send to Azure. @@ -640,6 +640,7 @@ class LinkedService(_serialization.Model): "Shopify": "ShopifyLinkedService", "Smartsheet": "SmartsheetLinkedService", "Snowflake": "SnowflakeLinkedService", + "SnowflakeV2": "SnowflakeV2LinkedService", "Spark": "SparkLinkedService", "SqlServer": "SqlServerLinkedService", "Square": "SquareLinkedService", @@ -648,6 +649,7 @@ class LinkedService(_serialization.Model): "Teradata": "TeradataLinkedService", "Twilio": "TwilioLinkedService", "Vertica": "VerticaLinkedService", + "Warehouse": "WarehouseLinkedService", "Web": "WebLinkedService", "Xero": "XeroLinkedService", "Zendesk": "ZendeskLinkedService", @@ -873,9 +875,9 @@ class Dataset(_serialization.Model): SapCloudForCustomerResourceDataset, SapEccResourceDataset, SapHanaTableDataset, SapOdpResourceDataset, SapOpenHubTableDataset, SapTableResourceDataset, ServiceNowObjectDataset, SharePointOnlineListResourceDataset, ShopifyObjectDataset, - SnowflakeDataset, SparkObjectDataset, SqlServerTableDataset, SquareObjectDataset, - SybaseTableDataset, TeradataTableDataset, VerticaTableDataset, WebTableDataset, - XeroObjectDataset, XmlDataset, ZohoObjectDataset + SnowflakeDataset, SnowflakeV2Dataset, SparkObjectDataset, SqlServerTableDataset, + SquareObjectDataset, SybaseTableDataset, TeradataTableDataset, VerticaTableDataset, + WarehouseTableDataset, WebTableDataset, XeroObjectDataset, XmlDataset, ZohoObjectDataset All required parameters must be populated in order to send to Azure. @@ -1011,12 +1013,14 @@ class Dataset(_serialization.Model): "SharePointOnlineListResource": "SharePointOnlineListResourceDataset", "ShopifyObject": "ShopifyObjectDataset", "SnowflakeTable": "SnowflakeDataset", + "SnowflakeV2Table": "SnowflakeV2Dataset", "SparkObject": "SparkObjectDataset", "SqlServerTable": "SqlServerTableDataset", "SquareObject": "SquareObjectDataset", "SybaseTable": "SybaseTableDataset", "TeradataTable": "TeradataTableDataset", "VerticaTable": "VerticaTableDataset", + "WarehouseTable": "WarehouseTableDataset", "WebTable": "WebTableDataset", "XeroObject": "XeroObjectDataset", "Xml": "XmlDataset", @@ -1185,7 +1189,7 @@ class CopySource(_serialization.Model): MicrosoftAccessSource, MongoDbAtlasSource, MongoDbSource, MongoDbV2Source, ODataSource, Office365Source, OracleSource, OrcSource, ParquetSource, RelationalSource, RestSource, SalesforceServiceCloudSource, SalesforceServiceCloudV2Source, SharePointOnlineListSource, - SnowflakeSource, TabularSource, WebSource, XmlSource + SnowflakeSource, SnowflakeV2Source, TabularSource, WebSource, XmlSource All required parameters must be populated in order to send to Azure. @@ -1259,6 +1263,7 @@ class CopySource(_serialization.Model): "SalesforceServiceCloudV2Source": "SalesforceServiceCloudV2Source", "SharePointOnlineListSource": "SharePointOnlineListSource", "SnowflakeSource": "SnowflakeSource", + "SnowflakeV2Source": "SnowflakeV2Source", "TabularSource": "TabularSource", "WebSource": "WebSource", "XmlSource": "XmlSource", @@ -1316,7 +1321,7 @@ class TabularSource(CopySource): SapCloudForCustomerSource, SapEccSource, SapHanaSource, SapOdpSource, SapOpenHubSource, SapTableSource, ServiceNowSource, ShopifySource, SparkSource, SqlDWSource, SqlMISource, SqlServerSource, SqlSource, SquareSource, SybaseSource, TeradataSource, VerticaSource, - XeroSource, ZohoSource + WarehouseSource, XeroSource, ZohoSource All required parameters must be populated in order to send to Azure. @@ -1420,6 +1425,7 @@ class TabularSource(CopySource): "SybaseSource": "SybaseSource", "TeradataSource": "TeradataSource", "VerticaSource": "VerticaSource", + "WarehouseSource": "WarehouseSource", "XeroSource": "XeroSource", "ZohoSource": "ZohoSource", } @@ -4355,7 +4361,7 @@ class CopySink(_serialization.Model): JsonSink, LakeHouseTableSink, MicrosoftAccessSink, MongoDbAtlasSink, MongoDbV2Sink, OdbcSink, OracleSink, OrcSink, ParquetSink, RestSink, SalesforceServiceCloudSink, SalesforceServiceCloudV2Sink, SalesforceSink, SalesforceV2Sink, SapCloudForCustomerSink, - SnowflakeSink, SqlDWSink, SqlMISink, SqlServerSink, SqlSink + SnowflakeSink, SnowflakeV2Sink, SqlDWSink, SqlMISink, SqlServerSink, SqlSink, WarehouseSink All required parameters must be populated in order to send to Azure. @@ -4439,10 +4445,12 @@ class CopySink(_serialization.Model): "SalesforceV2Sink": "SalesforceV2Sink", "SapCloudForCustomerSink": "SapCloudForCustomerSink", "SnowflakeSink": "SnowflakeSink", + "SnowflakeV2Sink": "SnowflakeV2Sink", "SqlDWSink": "SqlDWSink", "SqlMISink": "SqlMISink", "SqlServerSink": "SqlServerSink", "SqlSink": "SqlSink", + "WarehouseSink": "WarehouseSink", } } @@ -9527,8 +9535,8 @@ class AzureFunctionActivity(ExecutionActivity): # pylint: disable=too-many-inst :vartype function_name: JSON :ivar headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :vartype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :vartype headers: dict[str, str] :ivar body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :vartype body: JSON @@ -9554,7 +9562,7 @@ class AzureFunctionActivity(ExecutionActivity): # pylint: disable=too-many-inst "policy": {"key": "policy", "type": "ActivityPolicy"}, "method": {"key": "typeProperties.method", "type": "str"}, "function_name": {"key": "typeProperties.functionName", "type": "object"}, - "headers": {"key": "typeProperties.headers", "type": "object"}, + "headers": {"key": "typeProperties.headers", "type": "{str}"}, "body": {"key": "typeProperties.body", "type": "object"}, } @@ -9572,7 +9580,7 @@ def __init__( user_properties: Optional[List["_models.UserProperty"]] = None, linked_service_name: Optional["_models.LinkedServiceReference"] = None, policy: Optional["_models.ActivityPolicy"] = None, - headers: Optional[JSON] = None, + headers: Optional[Dict[str, str]] = None, body: Optional[JSON] = None, **kwargs: Any ) -> None: @@ -9607,8 +9615,8 @@ def __init__( :paramtype function_name: JSON :keyword headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :paramtype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :paramtype headers: dict[str, str] :keyword body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :paramtype body: JSON @@ -52234,6 +52242,9 @@ class SalesforceServiceCloudV2LinkedService(LinkedService): # pylint: disable=t :ivar environment_url: The URL of Salesforce Service Cloud instance. For example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). :vartype environment_url: JSON + :ivar authentication_type: The authentication type to be used to connect to the Salesforce. + Currently, we only support OAuth2ClientCredentials, it is also the default value. + :vartype authentication_type: JSON :ivar client_id: The client Id for OAuth 2.0 Client Credentials Flow authentication of the Salesforce instance. Type: string (or Expression with resultType string). :vartype client_id: JSON @@ -52261,6 +52272,7 @@ class SalesforceServiceCloudV2LinkedService(LinkedService): # pylint: disable=t "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "environment_url": {"key": "typeProperties.environmentUrl", "type": "object"}, + "authentication_type": {"key": "typeProperties.authenticationType", "type": "object"}, "client_id": {"key": "typeProperties.clientId", "type": "object"}, "client_secret": {"key": "typeProperties.clientSecret", "type": "SecretBase"}, "api_version": {"key": "typeProperties.apiVersion", "type": "object"}, @@ -52276,6 +52288,7 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, environment_url: Optional[JSON] = None, + authentication_type: Optional[JSON] = None, client_id: Optional[JSON] = None, client_secret: Optional["_models.SecretBase"] = None, api_version: Optional[JSON] = None, @@ -52297,6 +52310,9 @@ def __init__( :keyword environment_url: The URL of Salesforce Service Cloud instance. For example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). :paramtype environment_url: JSON + :keyword authentication_type: The authentication type to be used to connect to the Salesforce. + Currently, we only support OAuth2ClientCredentials, it is also the default value. + :paramtype authentication_type: JSON :keyword client_id: The client Id for OAuth 2.0 Client Credentials Flow authentication of the Salesforce instance. Type: string (or Expression with resultType string). :paramtype client_id: JSON @@ -52321,6 +52337,7 @@ def __init__( ) self.type: str = "SalesforceServiceCloudV2" self.environment_url = environment_url + self.authentication_type = authentication_type self.client_id = client_id self.client_secret = client_secret self.api_version = api_version @@ -52593,9 +52610,9 @@ class SalesforceServiceCloudV2Source(CopySource): :vartype disable_metrics_collection: JSON :ivar soql_query: Database query. Type: string (or Expression with resultType string). :vartype soql_query: JSON - :ivar read_behavior: The read behavior for the operation. Default is query. Allowed values: - query/queryAll. Type: string (or Expression with resultType string). - :vartype read_behavior: JSON + :ivar include_deleted_objects: This property control whether query result contains Deleted + objects. Default is false. Type: boolean (or Expression with resultType boolean). + :vartype include_deleted_objects: JSON :ivar additional_columns: Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). :vartype additional_columns: JSON @@ -52613,7 +52630,7 @@ class SalesforceServiceCloudV2Source(CopySource): "max_concurrent_connections": {"key": "maxConcurrentConnections", "type": "object"}, "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, "soql_query": {"key": "SOQLQuery", "type": "object"}, - "read_behavior": {"key": "readBehavior", "type": "object"}, + "include_deleted_objects": {"key": "includeDeletedObjects", "type": "object"}, "additional_columns": {"key": "additionalColumns", "type": "object"}, } @@ -52626,7 +52643,7 @@ def __init__( max_concurrent_connections: Optional[JSON] = None, disable_metrics_collection: Optional[JSON] = None, soql_query: Optional[JSON] = None, - read_behavior: Optional[JSON] = None, + include_deleted_objects: Optional[JSON] = None, additional_columns: Optional[JSON] = None, **kwargs: Any ) -> None: @@ -52648,9 +52665,9 @@ def __init__( :paramtype disable_metrics_collection: JSON :keyword soql_query: Database query. Type: string (or Expression with resultType string). :paramtype soql_query: JSON - :keyword read_behavior: The read behavior for the operation. Default is query. Allowed values: - query/queryAll. Type: string (or Expression with resultType string). - :paramtype read_behavior: JSON + :keyword include_deleted_objects: This property control whether query result contains Deleted + objects. Default is false. Type: boolean (or Expression with resultType boolean). + :paramtype include_deleted_objects: JSON :keyword additional_columns: Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). :paramtype additional_columns: JSON @@ -52665,7 +52682,7 @@ def __init__( ) self.type: str = "SalesforceServiceCloudV2Source" self.soql_query = soql_query - self.read_behavior = read_behavior + self.include_deleted_objects = include_deleted_objects self.additional_columns = additional_columns @@ -52928,6 +52945,9 @@ class SalesforceV2LinkedService(LinkedService): # pylint: disable=too-many-inst :ivar environment_url: The URL of Salesforce instance. For example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). :vartype environment_url: JSON + :ivar authentication_type: The authentication type to be used to connect to the Salesforce. + Currently, we only support OAuth2ClientCredentials, it is also the default value. + :vartype authentication_type: JSON :ivar client_id: The client Id for OAuth 2.0 Client Credentials Flow authentication of the Salesforce instance. Type: string (or Expression with resultType string). :vartype client_id: JSON @@ -52955,6 +52975,7 @@ class SalesforceV2LinkedService(LinkedService): # pylint: disable=too-many-inst "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "environment_url": {"key": "typeProperties.environmentUrl", "type": "object"}, + "authentication_type": {"key": "typeProperties.authenticationType", "type": "object"}, "client_id": {"key": "typeProperties.clientId", "type": "object"}, "client_secret": {"key": "typeProperties.clientSecret", "type": "SecretBase"}, "api_version": {"key": "typeProperties.apiVersion", "type": "object"}, @@ -52970,6 +52991,7 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, environment_url: Optional[JSON] = None, + authentication_type: Optional[JSON] = None, client_id: Optional[JSON] = None, client_secret: Optional["_models.SecretBase"] = None, api_version: Optional[JSON] = None, @@ -52991,6 +53013,9 @@ def __init__( :keyword environment_url: The URL of Salesforce instance. For example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). :paramtype environment_url: JSON + :keyword authentication_type: The authentication type to be used to connect to the Salesforce. + Currently, we only support OAuth2ClientCredentials, it is also the default value. + :paramtype authentication_type: JSON :keyword client_id: The client Id for OAuth 2.0 Client Credentials Flow authentication of the Salesforce instance. Type: string (or Expression with resultType string). :paramtype client_id: JSON @@ -53015,6 +53040,7 @@ def __init__( ) self.type: str = "SalesforceV2" self.environment_url = environment_url + self.authentication_type = authentication_type self.client_id = client_id self.client_secret = client_secret self.api_version = api_version @@ -53293,9 +53319,9 @@ class SalesforceV2Source(TabularSource): :vartype additional_columns: JSON :ivar soql_query: Database query. Type: string (or Expression with resultType string). :vartype soql_query: JSON - :ivar read_behavior: The read behavior for the operation. Default is query. Allowed values: - query/queryAll. Type: string (or Expression with resultType string). - :vartype read_behavior: JSON + :ivar include_deleted_objects: This property control whether query result contains Deleted + objects. Default is false. Type: boolean (or Expression with resultType boolean). + :vartype include_deleted_objects: JSON """ _validation = { @@ -53312,7 +53338,7 @@ class SalesforceV2Source(TabularSource): "query_timeout": {"key": "queryTimeout", "type": "object"}, "additional_columns": {"key": "additionalColumns", "type": "object"}, "soql_query": {"key": "SOQLQuery", "type": "object"}, - "read_behavior": {"key": "readBehavior", "type": "object"}, + "include_deleted_objects": {"key": "includeDeletedObjects", "type": "object"}, } def __init__( @@ -53326,7 +53352,7 @@ def __init__( query_timeout: Optional[JSON] = None, additional_columns: Optional[JSON] = None, soql_query: Optional[JSON] = None, - read_behavior: Optional[JSON] = None, + include_deleted_objects: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -53353,9 +53379,9 @@ def __init__( :paramtype additional_columns: JSON :keyword soql_query: Database query. Type: string (or Expression with resultType string). :paramtype soql_query: JSON - :keyword read_behavior: The read behavior for the operation. Default is query. Allowed values: - query/queryAll. Type: string (or Expression with resultType string). - :paramtype read_behavior: JSON + :keyword include_deleted_objects: This property control whether query result contains Deleted + objects. Default is false. Type: boolean (or Expression with resultType boolean). + :paramtype include_deleted_objects: JSON """ super().__init__( additional_properties=additional_properties, @@ -53369,7 +53395,7 @@ def __init__( ) self.type: str = "SalesforceV2Source" self.soql_query = soql_query - self.read_behavior = read_behavior + self.include_deleted_objects = include_deleted_objects class SapBwCubeDataset(Dataset): @@ -59522,240 +59548,8 @@ def __init__( self.export_settings = export_settings -class SparkConfigurationParametrizationReference(_serialization.Model): - """Spark configuration reference. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Spark configuration reference type. Required. "SparkConfigurationReference" - :vartype type: str or ~azure.mgmt.datafactory.models.SparkConfigurationReferenceType - :ivar reference_name: Reference spark configuration name. Type: string (or Expression with - resultType string). Required. - :vartype reference_name: JSON - """ - - _validation = { - "type": {"required": True}, - "reference_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "reference_name": {"key": "referenceName", "type": "object"}, - } - - def __init__( - self, *, type: Union[str, "_models.SparkConfigurationReferenceType"], reference_name: JSON, **kwargs: Any - ) -> None: - """ - :keyword type: Spark configuration reference type. Required. "SparkConfigurationReference" - :paramtype type: str or ~azure.mgmt.datafactory.models.SparkConfigurationReferenceType - :keyword reference_name: Reference spark configuration name. Type: string (or Expression with - resultType string). Required. - :paramtype reference_name: JSON - """ - super().__init__(**kwargs) - self.type = type - self.reference_name = reference_name - - -class SparkLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes - """Spark Server linked service. - - All required parameters must be populated in order to send to Azure. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar type: Type of linked service. Required. - :vartype type: str - :ivar connect_via: The integration runtime reference. - :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference - :ivar description: Linked service description. - :vartype description: str - :ivar parameters: Parameters for linked service. - :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] - :ivar annotations: List of tags that can be used for describing the linked service. - :vartype annotations: list[JSON] - :ivar host: IP address or host name of the Spark server. Required. - :vartype host: JSON - :ivar port: The TCP port that the Spark server uses to listen for client connections. Required. - :vartype port: JSON - :ivar server_type: The type of Spark server. Known values are: "SharkServer", "SharkServer2", - and "SparkThriftServer". - :vartype server_type: str or ~azure.mgmt.datafactory.models.SparkServerType - :ivar thrift_transport_protocol: The transport protocol to use in the Thrift layer. Known - values are: "Binary", "SASL", and "HTTP ". - :vartype thrift_transport_protocol: str or - ~azure.mgmt.datafactory.models.SparkThriftTransportProtocol - :ivar authentication_type: The authentication method used to access the Spark server. Required. - Known values are: "Anonymous", "Username", "UsernameAndPassword", and - "WindowsAzureHDInsightService". - :vartype authentication_type: str or ~azure.mgmt.datafactory.models.SparkAuthenticationType - :ivar username: The user name that you use to access Spark Server. - :vartype username: JSON - :ivar password: The password corresponding to the user name that you provided in the Username - field. - :vartype password: ~azure.mgmt.datafactory.models.SecretBase - :ivar http_path: The partial URL corresponding to the Spark server. - :vartype http_path: JSON - :ivar enable_ssl: Specifies whether the connections to the server are encrypted using SSL. The - default value is false. - :vartype enable_ssl: JSON - :ivar trusted_cert_path: The full path of the .pem file containing trusted CA certificates for - verifying the server when connecting over SSL. This property can only be set when using SSL on - self-hosted IR. The default value is the cacerts.pem file installed with the IR. - :vartype trusted_cert_path: JSON - :ivar use_system_trust_store: Specifies whether to use a CA certificate from the system trust - store or from a specified PEM file. The default value is false. - :vartype use_system_trust_store: JSON - :ivar allow_host_name_cn_mismatch: Specifies whether to require a CA-issued SSL certificate - name to match the host name of the server when connecting over SSL. The default value is false. - :vartype allow_host_name_cn_mismatch: JSON - :ivar allow_self_signed_server_cert: Specifies whether to allow self-signed certificates from - the server. The default value is false. - :vartype allow_self_signed_server_cert: JSON - :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are - encrypted using the integration runtime credential manager. Type: string. - :vartype encrypted_credential: str - """ - - _validation = { - "type": {"required": True}, - "host": {"required": True}, - "port": {"required": True}, - "authentication_type": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "type": {"key": "type", "type": "str"}, - "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, - "description": {"key": "description", "type": "str"}, - "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, - "annotations": {"key": "annotations", "type": "[object]"}, - "host": {"key": "typeProperties.host", "type": "object"}, - "port": {"key": "typeProperties.port", "type": "object"}, - "server_type": {"key": "typeProperties.serverType", "type": "str"}, - "thrift_transport_protocol": {"key": "typeProperties.thriftTransportProtocol", "type": "str"}, - "authentication_type": {"key": "typeProperties.authenticationType", "type": "str"}, - "username": {"key": "typeProperties.username", "type": "object"}, - "password": {"key": "typeProperties.password", "type": "SecretBase"}, - "http_path": {"key": "typeProperties.httpPath", "type": "object"}, - "enable_ssl": {"key": "typeProperties.enableSsl", "type": "object"}, - "trusted_cert_path": {"key": "typeProperties.trustedCertPath", "type": "object"}, - "use_system_trust_store": {"key": "typeProperties.useSystemTrustStore", "type": "object"}, - "allow_host_name_cn_mismatch": {"key": "typeProperties.allowHostNameCNMismatch", "type": "object"}, - "allow_self_signed_server_cert": {"key": "typeProperties.allowSelfSignedServerCert", "type": "object"}, - "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, - } - - def __init__( - self, - *, - host: JSON, - port: JSON, - authentication_type: Union[str, "_models.SparkAuthenticationType"], - additional_properties: Optional[Dict[str, JSON]] = None, - connect_via: Optional["_models.IntegrationRuntimeReference"] = None, - description: Optional[str] = None, - parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, - annotations: Optional[List[JSON]] = None, - server_type: Optional[Union[str, "_models.SparkServerType"]] = None, - thrift_transport_protocol: Optional[Union[str, "_models.SparkThriftTransportProtocol"]] = None, - username: Optional[JSON] = None, - password: Optional["_models.SecretBase"] = None, - http_path: Optional[JSON] = None, - enable_ssl: Optional[JSON] = None, - trusted_cert_path: Optional[JSON] = None, - use_system_trust_store: Optional[JSON] = None, - allow_host_name_cn_mismatch: Optional[JSON] = None, - allow_self_signed_server_cert: Optional[JSON] = None, - encrypted_credential: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword connect_via: The integration runtime reference. - :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference - :keyword description: Linked service description. - :paramtype description: str - :keyword parameters: Parameters for linked service. - :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] - :keyword annotations: List of tags that can be used for describing the linked service. - :paramtype annotations: list[JSON] - :keyword host: IP address or host name of the Spark server. Required. - :paramtype host: JSON - :keyword port: The TCP port that the Spark server uses to listen for client connections. - Required. - :paramtype port: JSON - :keyword server_type: The type of Spark server. Known values are: "SharkServer", - "SharkServer2", and "SparkThriftServer". - :paramtype server_type: str or ~azure.mgmt.datafactory.models.SparkServerType - :keyword thrift_transport_protocol: The transport protocol to use in the Thrift layer. Known - values are: "Binary", "SASL", and "HTTP ". - :paramtype thrift_transport_protocol: str or - ~azure.mgmt.datafactory.models.SparkThriftTransportProtocol - :keyword authentication_type: The authentication method used to access the Spark server. - Required. Known values are: "Anonymous", "Username", "UsernameAndPassword", and - "WindowsAzureHDInsightService". - :paramtype authentication_type: str or ~azure.mgmt.datafactory.models.SparkAuthenticationType - :keyword username: The user name that you use to access Spark Server. - :paramtype username: JSON - :keyword password: The password corresponding to the user name that you provided in the - Username field. - :paramtype password: ~azure.mgmt.datafactory.models.SecretBase - :keyword http_path: The partial URL corresponding to the Spark server. - :paramtype http_path: JSON - :keyword enable_ssl: Specifies whether the connections to the server are encrypted using SSL. - The default value is false. - :paramtype enable_ssl: JSON - :keyword trusted_cert_path: The full path of the .pem file containing trusted CA certificates - for verifying the server when connecting over SSL. This property can only be set when using SSL - on self-hosted IR. The default value is the cacerts.pem file installed with the IR. - :paramtype trusted_cert_path: JSON - :keyword use_system_trust_store: Specifies whether to use a CA certificate from the system - trust store or from a specified PEM file. The default value is false. - :paramtype use_system_trust_store: JSON - :keyword allow_host_name_cn_mismatch: Specifies whether to require a CA-issued SSL certificate - name to match the host name of the server when connecting over SSL. The default value is false. - :paramtype allow_host_name_cn_mismatch: JSON - :keyword allow_self_signed_server_cert: Specifies whether to allow self-signed certificates - from the server. The default value is false. - :paramtype allow_self_signed_server_cert: JSON - :keyword encrypted_credential: The encrypted credential used for authentication. Credentials - are encrypted using the integration runtime credential manager. Type: string. - :paramtype encrypted_credential: str - """ - super().__init__( - additional_properties=additional_properties, - connect_via=connect_via, - description=description, - parameters=parameters, - annotations=annotations, - **kwargs - ) - self.type: str = "Spark" - self.host = host - self.port = port - self.server_type = server_type - self.thrift_transport_protocol = thrift_transport_protocol - self.authentication_type = authentication_type - self.username = username - self.password = password - self.http_path = http_path - self.enable_ssl = enable_ssl - self.trusted_cert_path = trusted_cert_path - self.use_system_trust_store = use_system_trust_store - self.allow_host_name_cn_mismatch = allow_host_name_cn_mismatch - self.allow_self_signed_server_cert = allow_self_signed_server_cert - self.encrypted_credential = encrypted_credential - - -class SparkObjectDataset(Dataset): # pylint: disable=too-many-instance-attributes - """Spark Server dataset. +class SnowflakeV2Dataset(Dataset): # pylint: disable=too-many-instance-attributes + """The snowflake dataset. All required parameters must be populated in order to send to Azure. @@ -59781,14 +59575,12 @@ class SparkObjectDataset(Dataset): # pylint: disable=too-many-instance-attribut :ivar folder: The folder that this Dataset is in. If not specified, Dataset will appear at the root level. :vartype folder: ~azure.mgmt.datafactory.models.DatasetFolder - :ivar table_name: This property will be retired. Please consider using schema + table - properties instead. - :vartype table_name: JSON - :ivar table: The table name of the Spark. Type: string (or Expression with resultType string). - :vartype table: JSON - :ivar schema_type_properties_schema: The schema name of the Spark. Type: string (or Expression - with resultType string). + :ivar schema_type_properties_schema: The schema name of the Snowflake database. Type: string + (or Expression with resultType string). :vartype schema_type_properties_schema: JSON + :ivar table: The table name of the Snowflake database. Type: string (or Expression with + resultType string). + :vartype table: JSON """ _validation = { @@ -59806,9 +59598,8 @@ class SparkObjectDataset(Dataset): # pylint: disable=too-many-instance-attribut "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "folder": {"key": "folder", "type": "DatasetFolder"}, - "table_name": {"key": "typeProperties.tableName", "type": "object"}, - "table": {"key": "typeProperties.table", "type": "object"}, "schema_type_properties_schema": {"key": "typeProperties.schema", "type": "object"}, + "table": {"key": "typeProperties.table", "type": "object"}, } def __init__( @@ -59822,8 +59613,733 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, folder: Optional["_models.DatasetFolder"] = None, - table_name: Optional[JSON] = None, - table: Optional[JSON] = None, + schema_type_properties_schema: Optional[JSON] = None, + table: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword description: Dataset description. + :paramtype description: str + :keyword structure: Columns that define the structure of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetDataElement. + :paramtype structure: JSON + :keyword schema: Columns that define the physical type schema of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetSchemaDataElement. + :paramtype schema: JSON + :keyword linked_service_name: Linked service reference. Required. + :paramtype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference + :keyword parameters: Parameters for dataset. + :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :keyword annotations: List of tags that can be used for describing the Dataset. + :paramtype annotations: list[JSON] + :keyword folder: The folder that this Dataset is in. If not specified, Dataset will appear at + the root level. + :paramtype folder: ~azure.mgmt.datafactory.models.DatasetFolder + :keyword schema_type_properties_schema: The schema name of the Snowflake database. Type: string + (or Expression with resultType string). + :paramtype schema_type_properties_schema: JSON + :keyword table: The table name of the Snowflake database. Type: string (or Expression with + resultType string). + :paramtype table: JSON + """ + super().__init__( + additional_properties=additional_properties, + description=description, + structure=structure, + schema=schema, + linked_service_name=linked_service_name, + parameters=parameters, + annotations=annotations, + folder=folder, + **kwargs + ) + self.type: str = "SnowflakeV2Table" + self.schema_type_properties_schema = schema_type_properties_schema + self.table = table + + +class SnowflakeV2LinkedService(LinkedService): # pylint: disable=too-many-instance-attributes + """Snowflake linked service. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Type of linked service. Required. + :vartype type: str + :ivar connect_via: The integration runtime reference. + :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar description: Linked service description. + :vartype description: str + :ivar parameters: Parameters for linked service. + :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :ivar annotations: List of tags that can be used for describing the linked service. + :vartype annotations: list[JSON] + :ivar account_identifier: The account identifier of your Snowflake account, e.g. + xy12345.east-us-2.azure. Required. + :vartype account_identifier: JSON + :ivar user: The name of the Snowflake user. + :vartype user: JSON + :ivar password: The Azure key vault secret reference of password in connection string. + :vartype password: ~azure.mgmt.datafactory.models.SecretBase + :ivar database: The name of the Snowflake database. Required. + :vartype database: JSON + :ivar warehouse: The name of the Snowflake warehouse. Required. + :vartype warehouse: JSON + :ivar authentication_type: The type used for authentication. Type: string. Known values are: + "Basic", "KeyPair", and "AADServicePrincipal". + :vartype authentication_type: str or ~azure.mgmt.datafactory.models.SnowflakeAuthenticationType + :ivar client_id: The client ID of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :vartype client_id: JSON + :ivar client_secret: The Azure key vault secret reference of client secret for + AADServicePrincipal authentication. + :vartype client_secret: ~azure.mgmt.datafactory.models.SecretBase + :ivar tenant_id: The tenant ID of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :vartype tenant_id: JSON + :ivar scope: The scope of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :vartype scope: JSON + :ivar private_key: The Azure key vault secret reference of privateKey for KeyPair auth. + :vartype private_key: ~azure.mgmt.datafactory.models.SecretBase + :ivar private_key_passphrase: The Azure key vault secret reference of private key password for + KeyPair auth with encrypted private key. + :vartype private_key_passphrase: ~azure.mgmt.datafactory.models.SecretBase + :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are + encrypted using the integration runtime credential manager. Type: string. + :vartype encrypted_credential: str + """ + + _validation = { + "type": {"required": True}, + "account_identifier": {"required": True}, + "database": {"required": True}, + "warehouse": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, + "description": {"key": "description", "type": "str"}, + "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, + "annotations": {"key": "annotations", "type": "[object]"}, + "account_identifier": {"key": "typeProperties.accountIdentifier", "type": "object"}, + "user": {"key": "typeProperties.user", "type": "object"}, + "password": {"key": "typeProperties.password", "type": "SecretBase"}, + "database": {"key": "typeProperties.database", "type": "object"}, + "warehouse": {"key": "typeProperties.warehouse", "type": "object"}, + "authentication_type": {"key": "typeProperties.authenticationType", "type": "str"}, + "client_id": {"key": "typeProperties.clientId", "type": "object"}, + "client_secret": {"key": "typeProperties.clientSecret", "type": "SecretBase"}, + "tenant_id": {"key": "typeProperties.tenantId", "type": "object"}, + "scope": {"key": "typeProperties.scope", "type": "object"}, + "private_key": {"key": "typeProperties.privateKey", "type": "SecretBase"}, + "private_key_passphrase": {"key": "typeProperties.privateKeyPassphrase", "type": "SecretBase"}, + "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + } + + def __init__( + self, + *, + account_identifier: JSON, + database: JSON, + warehouse: JSON, + additional_properties: Optional[Dict[str, JSON]] = None, + connect_via: Optional["_models.IntegrationRuntimeReference"] = None, + description: Optional[str] = None, + parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, + annotations: Optional[List[JSON]] = None, + user: Optional[JSON] = None, + password: Optional["_models.SecretBase"] = None, + authentication_type: Union[str, "_models.SnowflakeAuthenticationType"] = "Basic", + client_id: Optional[JSON] = None, + client_secret: Optional["_models.SecretBase"] = None, + tenant_id: Optional[JSON] = None, + scope: Optional[JSON] = None, + private_key: Optional["_models.SecretBase"] = None, + private_key_passphrase: Optional["_models.SecretBase"] = None, + encrypted_credential: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword connect_via: The integration runtime reference. + :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword description: Linked service description. + :paramtype description: str + :keyword parameters: Parameters for linked service. + :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :keyword annotations: List of tags that can be used for describing the linked service. + :paramtype annotations: list[JSON] + :keyword account_identifier: The account identifier of your Snowflake account, e.g. + xy12345.east-us-2.azure. Required. + :paramtype account_identifier: JSON + :keyword user: The name of the Snowflake user. + :paramtype user: JSON + :keyword password: The Azure key vault secret reference of password in connection string. + :paramtype password: ~azure.mgmt.datafactory.models.SecretBase + :keyword database: The name of the Snowflake database. Required. + :paramtype database: JSON + :keyword warehouse: The name of the Snowflake warehouse. Required. + :paramtype warehouse: JSON + :keyword authentication_type: The type used for authentication. Type: string. Known values are: + "Basic", "KeyPair", and "AADServicePrincipal". + :paramtype authentication_type: str or + ~azure.mgmt.datafactory.models.SnowflakeAuthenticationType + :keyword client_id: The client ID of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :paramtype client_id: JSON + :keyword client_secret: The Azure key vault secret reference of client secret for + AADServicePrincipal authentication. + :paramtype client_secret: ~azure.mgmt.datafactory.models.SecretBase + :keyword tenant_id: The tenant ID of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :paramtype tenant_id: JSON + :keyword scope: The scope of the application registered in Azure Active Directory for + AADServicePrincipal authentication. + :paramtype scope: JSON + :keyword private_key: The Azure key vault secret reference of privateKey for KeyPair auth. + :paramtype private_key: ~azure.mgmt.datafactory.models.SecretBase + :keyword private_key_passphrase: The Azure key vault secret reference of private key password + for KeyPair auth with encrypted private key. + :paramtype private_key_passphrase: ~azure.mgmt.datafactory.models.SecretBase + :keyword encrypted_credential: The encrypted credential used for authentication. Credentials + are encrypted using the integration runtime credential manager. Type: string. + :paramtype encrypted_credential: str + """ + super().__init__( + additional_properties=additional_properties, + connect_via=connect_via, + description=description, + parameters=parameters, + annotations=annotations, + **kwargs + ) + self.type: str = "SnowflakeV2" + self.account_identifier = account_identifier + self.user = user + self.password = password + self.database = database + self.warehouse = warehouse + self.authentication_type = authentication_type + self.client_id = client_id + self.client_secret = client_secret + self.tenant_id = tenant_id + self.scope = scope + self.private_key = private_key + self.private_key_passphrase = private_key_passphrase + self.encrypted_credential = encrypted_credential + + +class SnowflakeV2Sink(CopySink): + """A copy activity snowflake sink. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Copy sink type. Required. + :vartype type: str + :ivar write_batch_size: Write batch size. Type: integer (or Expression with resultType + integer), minimum: 0. + :vartype write_batch_size: JSON + :ivar write_batch_timeout: Write batch timeout. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype write_batch_timeout: JSON + :ivar sink_retry_count: Sink retry count. Type: integer (or Expression with resultType + integer). + :vartype sink_retry_count: JSON + :ivar sink_retry_wait: Sink retry wait. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype sink_retry_wait: JSON + :ivar max_concurrent_connections: The maximum concurrent connection count for the sink data + store. Type: integer (or Expression with resultType integer). + :vartype max_concurrent_connections: JSON + :ivar disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :vartype disable_metrics_collection: JSON + :ivar pre_copy_script: SQL pre-copy script. Type: string (or Expression with resultType + string). + :vartype pre_copy_script: JSON + :ivar import_settings: Snowflake import settings. + :vartype import_settings: ~azure.mgmt.datafactory.models.SnowflakeImportCopyCommand + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "write_batch_size": {"key": "writeBatchSize", "type": "object"}, + "write_batch_timeout": {"key": "writeBatchTimeout", "type": "object"}, + "sink_retry_count": {"key": "sinkRetryCount", "type": "object"}, + "sink_retry_wait": {"key": "sinkRetryWait", "type": "object"}, + "max_concurrent_connections": {"key": "maxConcurrentConnections", "type": "object"}, + "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, + "pre_copy_script": {"key": "preCopyScript", "type": "object"}, + "import_settings": {"key": "importSettings", "type": "SnowflakeImportCopyCommand"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, JSON]] = None, + write_batch_size: Optional[JSON] = None, + write_batch_timeout: Optional[JSON] = None, + sink_retry_count: Optional[JSON] = None, + sink_retry_wait: Optional[JSON] = None, + max_concurrent_connections: Optional[JSON] = None, + disable_metrics_collection: Optional[JSON] = None, + pre_copy_script: Optional[JSON] = None, + import_settings: Optional["_models.SnowflakeImportCopyCommand"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword write_batch_size: Write batch size. Type: integer (or Expression with resultType + integer), minimum: 0. + :paramtype write_batch_size: JSON + :keyword write_batch_timeout: Write batch timeout. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype write_batch_timeout: JSON + :keyword sink_retry_count: Sink retry count. Type: integer (or Expression with resultType + integer). + :paramtype sink_retry_count: JSON + :keyword sink_retry_wait: Sink retry wait. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype sink_retry_wait: JSON + :keyword max_concurrent_connections: The maximum concurrent connection count for the sink data + store. Type: integer (or Expression with resultType integer). + :paramtype max_concurrent_connections: JSON + :keyword disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :paramtype disable_metrics_collection: JSON + :keyword pre_copy_script: SQL pre-copy script. Type: string (or Expression with resultType + string). + :paramtype pre_copy_script: JSON + :keyword import_settings: Snowflake import settings. + :paramtype import_settings: ~azure.mgmt.datafactory.models.SnowflakeImportCopyCommand + """ + super().__init__( + additional_properties=additional_properties, + write_batch_size=write_batch_size, + write_batch_timeout=write_batch_timeout, + sink_retry_count=sink_retry_count, + sink_retry_wait=sink_retry_wait, + max_concurrent_connections=max_concurrent_connections, + disable_metrics_collection=disable_metrics_collection, + **kwargs + ) + self.type: str = "SnowflakeV2Sink" + self.pre_copy_script = pre_copy_script + self.import_settings = import_settings + + +class SnowflakeV2Source(CopySource): + """A copy activity snowflake source. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Copy source type. Required. + :vartype type: str + :ivar source_retry_count: Source retry count. Type: integer (or Expression with resultType + integer). + :vartype source_retry_count: JSON + :ivar source_retry_wait: Source retry wait. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype source_retry_wait: JSON + :ivar max_concurrent_connections: The maximum concurrent connection count for the source data + store. Type: integer (or Expression with resultType integer). + :vartype max_concurrent_connections: JSON + :ivar disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :vartype disable_metrics_collection: JSON + :ivar query: Snowflake Sql query. Type: string (or Expression with resultType string). + :vartype query: JSON + :ivar export_settings: Snowflake export settings. Required. + :vartype export_settings: ~azure.mgmt.datafactory.models.SnowflakeExportCopyCommand + """ + + _validation = { + "type": {"required": True}, + "export_settings": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "source_retry_count": {"key": "sourceRetryCount", "type": "object"}, + "source_retry_wait": {"key": "sourceRetryWait", "type": "object"}, + "max_concurrent_connections": {"key": "maxConcurrentConnections", "type": "object"}, + "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, + "query": {"key": "query", "type": "object"}, + "export_settings": {"key": "exportSettings", "type": "SnowflakeExportCopyCommand"}, + } + + def __init__( + self, + *, + export_settings: "_models.SnowflakeExportCopyCommand", + additional_properties: Optional[Dict[str, JSON]] = None, + source_retry_count: Optional[JSON] = None, + source_retry_wait: Optional[JSON] = None, + max_concurrent_connections: Optional[JSON] = None, + disable_metrics_collection: Optional[JSON] = None, + query: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword source_retry_count: Source retry count. Type: integer (or Expression with resultType + integer). + :paramtype source_retry_count: JSON + :keyword source_retry_wait: Source retry wait. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype source_retry_wait: JSON + :keyword max_concurrent_connections: The maximum concurrent connection count for the source + data store. Type: integer (or Expression with resultType integer). + :paramtype max_concurrent_connections: JSON + :keyword disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :paramtype disable_metrics_collection: JSON + :keyword query: Snowflake Sql query. Type: string (or Expression with resultType string). + :paramtype query: JSON + :keyword export_settings: Snowflake export settings. Required. + :paramtype export_settings: ~azure.mgmt.datafactory.models.SnowflakeExportCopyCommand + """ + super().__init__( + additional_properties=additional_properties, + source_retry_count=source_retry_count, + source_retry_wait=source_retry_wait, + max_concurrent_connections=max_concurrent_connections, + disable_metrics_collection=disable_metrics_collection, + **kwargs + ) + self.type: str = "SnowflakeV2Source" + self.query = query + self.export_settings = export_settings + + +class SparkConfigurationParametrizationReference(_serialization.Model): + """Spark configuration reference. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Spark configuration reference type. Required. "SparkConfigurationReference" + :vartype type: str or ~azure.mgmt.datafactory.models.SparkConfigurationReferenceType + :ivar reference_name: Reference spark configuration name. Type: string (or Expression with + resultType string). Required. + :vartype reference_name: JSON + """ + + _validation = { + "type": {"required": True}, + "reference_name": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "reference_name": {"key": "referenceName", "type": "object"}, + } + + def __init__( + self, *, type: Union[str, "_models.SparkConfigurationReferenceType"], reference_name: JSON, **kwargs: Any + ) -> None: + """ + :keyword type: Spark configuration reference type. Required. "SparkConfigurationReference" + :paramtype type: str or ~azure.mgmt.datafactory.models.SparkConfigurationReferenceType + :keyword reference_name: Reference spark configuration name. Type: string (or Expression with + resultType string). Required. + :paramtype reference_name: JSON + """ + super().__init__(**kwargs) + self.type = type + self.reference_name = reference_name + + +class SparkLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes + """Spark Server linked service. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Type of linked service. Required. + :vartype type: str + :ivar connect_via: The integration runtime reference. + :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar description: Linked service description. + :vartype description: str + :ivar parameters: Parameters for linked service. + :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :ivar annotations: List of tags that can be used for describing the linked service. + :vartype annotations: list[JSON] + :ivar host: IP address or host name of the Spark server. Required. + :vartype host: JSON + :ivar port: The TCP port that the Spark server uses to listen for client connections. Required. + :vartype port: JSON + :ivar server_type: The type of Spark server. Known values are: "SharkServer", "SharkServer2", + and "SparkThriftServer". + :vartype server_type: str or ~azure.mgmt.datafactory.models.SparkServerType + :ivar thrift_transport_protocol: The transport protocol to use in the Thrift layer. Known + values are: "Binary", "SASL", and "HTTP ". + :vartype thrift_transport_protocol: str or + ~azure.mgmt.datafactory.models.SparkThriftTransportProtocol + :ivar authentication_type: The authentication method used to access the Spark server. Required. + Known values are: "Anonymous", "Username", "UsernameAndPassword", and + "WindowsAzureHDInsightService". + :vartype authentication_type: str or ~azure.mgmt.datafactory.models.SparkAuthenticationType + :ivar username: The user name that you use to access Spark Server. + :vartype username: JSON + :ivar password: The password corresponding to the user name that you provided in the Username + field. + :vartype password: ~azure.mgmt.datafactory.models.SecretBase + :ivar http_path: The partial URL corresponding to the Spark server. + :vartype http_path: JSON + :ivar enable_ssl: Specifies whether the connections to the server are encrypted using SSL. The + default value is false. + :vartype enable_ssl: JSON + :ivar trusted_cert_path: The full path of the .pem file containing trusted CA certificates for + verifying the server when connecting over SSL. This property can only be set when using SSL on + self-hosted IR. The default value is the cacerts.pem file installed with the IR. + :vartype trusted_cert_path: JSON + :ivar use_system_trust_store: Specifies whether to use a CA certificate from the system trust + store or from a specified PEM file. The default value is false. + :vartype use_system_trust_store: JSON + :ivar allow_host_name_cn_mismatch: Specifies whether to require a CA-issued SSL certificate + name to match the host name of the server when connecting over SSL. The default value is false. + :vartype allow_host_name_cn_mismatch: JSON + :ivar allow_self_signed_server_cert: Specifies whether to allow self-signed certificates from + the server. The default value is false. + :vartype allow_self_signed_server_cert: JSON + :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are + encrypted using the integration runtime credential manager. Type: string. + :vartype encrypted_credential: str + """ + + _validation = { + "type": {"required": True}, + "host": {"required": True}, + "port": {"required": True}, + "authentication_type": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, + "description": {"key": "description", "type": "str"}, + "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, + "annotations": {"key": "annotations", "type": "[object]"}, + "host": {"key": "typeProperties.host", "type": "object"}, + "port": {"key": "typeProperties.port", "type": "object"}, + "server_type": {"key": "typeProperties.serverType", "type": "str"}, + "thrift_transport_protocol": {"key": "typeProperties.thriftTransportProtocol", "type": "str"}, + "authentication_type": {"key": "typeProperties.authenticationType", "type": "str"}, + "username": {"key": "typeProperties.username", "type": "object"}, + "password": {"key": "typeProperties.password", "type": "SecretBase"}, + "http_path": {"key": "typeProperties.httpPath", "type": "object"}, + "enable_ssl": {"key": "typeProperties.enableSsl", "type": "object"}, + "trusted_cert_path": {"key": "typeProperties.trustedCertPath", "type": "object"}, + "use_system_trust_store": {"key": "typeProperties.useSystemTrustStore", "type": "object"}, + "allow_host_name_cn_mismatch": {"key": "typeProperties.allowHostNameCNMismatch", "type": "object"}, + "allow_self_signed_server_cert": {"key": "typeProperties.allowSelfSignedServerCert", "type": "object"}, + "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + } + + def __init__( + self, + *, + host: JSON, + port: JSON, + authentication_type: Union[str, "_models.SparkAuthenticationType"], + additional_properties: Optional[Dict[str, JSON]] = None, + connect_via: Optional["_models.IntegrationRuntimeReference"] = None, + description: Optional[str] = None, + parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, + annotations: Optional[List[JSON]] = None, + server_type: Optional[Union[str, "_models.SparkServerType"]] = None, + thrift_transport_protocol: Optional[Union[str, "_models.SparkThriftTransportProtocol"]] = None, + username: Optional[JSON] = None, + password: Optional["_models.SecretBase"] = None, + http_path: Optional[JSON] = None, + enable_ssl: Optional[JSON] = None, + trusted_cert_path: Optional[JSON] = None, + use_system_trust_store: Optional[JSON] = None, + allow_host_name_cn_mismatch: Optional[JSON] = None, + allow_self_signed_server_cert: Optional[JSON] = None, + encrypted_credential: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword connect_via: The integration runtime reference. + :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword description: Linked service description. + :paramtype description: str + :keyword parameters: Parameters for linked service. + :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :keyword annotations: List of tags that can be used for describing the linked service. + :paramtype annotations: list[JSON] + :keyword host: IP address or host name of the Spark server. Required. + :paramtype host: JSON + :keyword port: The TCP port that the Spark server uses to listen for client connections. + Required. + :paramtype port: JSON + :keyword server_type: The type of Spark server. Known values are: "SharkServer", + "SharkServer2", and "SparkThriftServer". + :paramtype server_type: str or ~azure.mgmt.datafactory.models.SparkServerType + :keyword thrift_transport_protocol: The transport protocol to use in the Thrift layer. Known + values are: "Binary", "SASL", and "HTTP ". + :paramtype thrift_transport_protocol: str or + ~azure.mgmt.datafactory.models.SparkThriftTransportProtocol + :keyword authentication_type: The authentication method used to access the Spark server. + Required. Known values are: "Anonymous", "Username", "UsernameAndPassword", and + "WindowsAzureHDInsightService". + :paramtype authentication_type: str or ~azure.mgmt.datafactory.models.SparkAuthenticationType + :keyword username: The user name that you use to access Spark Server. + :paramtype username: JSON + :keyword password: The password corresponding to the user name that you provided in the + Username field. + :paramtype password: ~azure.mgmt.datafactory.models.SecretBase + :keyword http_path: The partial URL corresponding to the Spark server. + :paramtype http_path: JSON + :keyword enable_ssl: Specifies whether the connections to the server are encrypted using SSL. + The default value is false. + :paramtype enable_ssl: JSON + :keyword trusted_cert_path: The full path of the .pem file containing trusted CA certificates + for verifying the server when connecting over SSL. This property can only be set when using SSL + on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + :paramtype trusted_cert_path: JSON + :keyword use_system_trust_store: Specifies whether to use a CA certificate from the system + trust store or from a specified PEM file. The default value is false. + :paramtype use_system_trust_store: JSON + :keyword allow_host_name_cn_mismatch: Specifies whether to require a CA-issued SSL certificate + name to match the host name of the server when connecting over SSL. The default value is false. + :paramtype allow_host_name_cn_mismatch: JSON + :keyword allow_self_signed_server_cert: Specifies whether to allow self-signed certificates + from the server. The default value is false. + :paramtype allow_self_signed_server_cert: JSON + :keyword encrypted_credential: The encrypted credential used for authentication. Credentials + are encrypted using the integration runtime credential manager. Type: string. + :paramtype encrypted_credential: str + """ + super().__init__( + additional_properties=additional_properties, + connect_via=connect_via, + description=description, + parameters=parameters, + annotations=annotations, + **kwargs + ) + self.type: str = "Spark" + self.host = host + self.port = port + self.server_type = server_type + self.thrift_transport_protocol = thrift_transport_protocol + self.authentication_type = authentication_type + self.username = username + self.password = password + self.http_path = http_path + self.enable_ssl = enable_ssl + self.trusted_cert_path = trusted_cert_path + self.use_system_trust_store = use_system_trust_store + self.allow_host_name_cn_mismatch = allow_host_name_cn_mismatch + self.allow_self_signed_server_cert = allow_self_signed_server_cert + self.encrypted_credential = encrypted_credential + + +class SparkObjectDataset(Dataset): # pylint: disable=too-many-instance-attributes + """Spark Server dataset. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Type of dataset. Required. + :vartype type: str + :ivar description: Dataset description. + :vartype description: str + :ivar structure: Columns that define the structure of the dataset. Type: array (or Expression + with resultType array), itemType: DatasetDataElement. + :vartype structure: JSON + :ivar schema: Columns that define the physical type schema of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetSchemaDataElement. + :vartype schema: JSON + :ivar linked_service_name: Linked service reference. Required. + :vartype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference + :ivar parameters: Parameters for dataset. + :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :ivar annotations: List of tags that can be used for describing the Dataset. + :vartype annotations: list[JSON] + :ivar folder: The folder that this Dataset is in. If not specified, Dataset will appear at the + root level. + :vartype folder: ~azure.mgmt.datafactory.models.DatasetFolder + :ivar table_name: This property will be retired. Please consider using schema + table + properties instead. + :vartype table_name: JSON + :ivar table: The table name of the Spark. Type: string (or Expression with resultType string). + :vartype table: JSON + :ivar schema_type_properties_schema: The schema name of the Spark. Type: string (or Expression + with resultType string). + :vartype schema_type_properties_schema: JSON + """ + + _validation = { + "type": {"required": True}, + "linked_service_name": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "structure": {"key": "structure", "type": "object"}, + "schema": {"key": "schema", "type": "object"}, + "linked_service_name": {"key": "linkedServiceName", "type": "LinkedServiceReference"}, + "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, + "annotations": {"key": "annotations", "type": "[object]"}, + "folder": {"key": "folder", "type": "DatasetFolder"}, + "table_name": {"key": "typeProperties.tableName", "type": "object"}, + "table": {"key": "typeProperties.table", "type": "object"}, + "schema_type_properties_schema": {"key": "typeProperties.schema", "type": "object"}, + } + + def __init__( + self, + *, + linked_service_name: "_models.LinkedServiceReference", + additional_properties: Optional[Dict[str, JSON]] = None, + description: Optional[str] = None, + structure: Optional[JSON] = None, + schema: Optional[JSON] = None, + parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, + annotations: Optional[List[JSON]] = None, + folder: Optional["_models.DatasetFolder"] = None, + table_name: Optional[JSON] = None, + table: Optional[JSON] = None, schema_type_properties_schema: Optional[JSON] = None, **kwargs: Any ) -> None: @@ -66175,29 +66691,503 @@ class ValidationActivity(ControlActivity): # pylint: disable=too-many-instance- :vartype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] :ivar user_properties: Activity user properties. :vartype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] - :ivar timeout: Specifies the timeout for the activity to run. If there is no value specified, - it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or - Expression with resultType string), pattern: - ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). - :vartype timeout: JSON - :ivar sleep: A delay in seconds between validation attempts. If no value is specified, 10 - seconds will be used as the default. Type: integer (or Expression with resultType integer). - :vartype sleep: JSON - :ivar minimum_size: Can be used if dataset points to a file. The file must be greater than or - equal in size to the value specified. Type: integer (or Expression with resultType integer). - :vartype minimum_size: JSON - :ivar child_items: Can be used if dataset points to a folder. If set to true, the folder must - have at least one file. If set to false, the folder must be empty. Type: boolean (or Expression - with resultType boolean). - :vartype child_items: JSON - :ivar dataset: Validation activity dataset reference. Required. - :vartype dataset: ~azure.mgmt.datafactory.models.DatasetReference + :ivar timeout: Specifies the timeout for the activity to run. If there is no value specified, + it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or + Expression with resultType string), pattern: + ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype timeout: JSON + :ivar sleep: A delay in seconds between validation attempts. If no value is specified, 10 + seconds will be used as the default. Type: integer (or Expression with resultType integer). + :vartype sleep: JSON + :ivar minimum_size: Can be used if dataset points to a file. The file must be greater than or + equal in size to the value specified. Type: integer (or Expression with resultType integer). + :vartype minimum_size: JSON + :ivar child_items: Can be used if dataset points to a folder. If set to true, the folder must + have at least one file. If set to false, the folder must be empty. Type: boolean (or Expression + with resultType boolean). + :vartype child_items: JSON + :ivar dataset: Validation activity dataset reference. Required. + :vartype dataset: ~azure.mgmt.datafactory.models.DatasetReference + """ + + _validation = { + "name": {"required": True}, + "type": {"required": True}, + "dataset": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "on_inactive_mark_as": {"key": "onInactiveMarkAs", "type": "str"}, + "depends_on": {"key": "dependsOn", "type": "[ActivityDependency]"}, + "user_properties": {"key": "userProperties", "type": "[UserProperty]"}, + "timeout": {"key": "typeProperties.timeout", "type": "object"}, + "sleep": {"key": "typeProperties.sleep", "type": "object"}, + "minimum_size": {"key": "typeProperties.minimumSize", "type": "object"}, + "child_items": {"key": "typeProperties.childItems", "type": "object"}, + "dataset": {"key": "typeProperties.dataset", "type": "DatasetReference"}, + } + + def __init__( + self, + *, + name: str, + dataset: "_models.DatasetReference", + additional_properties: Optional[Dict[str, JSON]] = None, + description: Optional[str] = None, + state: Optional[Union[str, "_models.ActivityState"]] = None, + on_inactive_mark_as: Optional[Union[str, "_models.ActivityOnInactiveMarkAs"]] = None, + depends_on: Optional[List["_models.ActivityDependency"]] = None, + user_properties: Optional[List["_models.UserProperty"]] = None, + timeout: Optional[JSON] = None, + sleep: Optional[JSON] = None, + minimum_size: Optional[JSON] = None, + child_items: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword name: Activity name. Required. + :paramtype name: str + :keyword description: Activity description. + :paramtype description: str + :keyword state: Activity state. This is an optional property and if not provided, the state + will be Active by default. Known values are: "Active" and "Inactive". + :paramtype state: str or ~azure.mgmt.datafactory.models.ActivityState + :keyword on_inactive_mark_as: Status result of the activity when the state is set to Inactive. + This is an optional property and if not provided when the activity is inactive, the status will + be Succeeded by default. Known values are: "Succeeded", "Failed", and "Skipped". + :paramtype on_inactive_mark_as: str or ~azure.mgmt.datafactory.models.ActivityOnInactiveMarkAs + :keyword depends_on: Activity depends on condition. + :paramtype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] + :keyword user_properties: Activity user properties. + :paramtype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] + :keyword timeout: Specifies the timeout for the activity to run. If there is no value + specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string + (or Expression with resultType string), pattern: + ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype timeout: JSON + :keyword sleep: A delay in seconds between validation attempts. If no value is specified, 10 + seconds will be used as the default. Type: integer (or Expression with resultType integer). + :paramtype sleep: JSON + :keyword minimum_size: Can be used if dataset points to a file. The file must be greater than + or equal in size to the value specified. Type: integer (or Expression with resultType integer). + :paramtype minimum_size: JSON + :keyword child_items: Can be used if dataset points to a folder. If set to true, the folder + must have at least one file. If set to false, the folder must be empty. Type: boolean (or + Expression with resultType boolean). + :paramtype child_items: JSON + :keyword dataset: Validation activity dataset reference. Required. + :paramtype dataset: ~azure.mgmt.datafactory.models.DatasetReference + """ + super().__init__( + additional_properties=additional_properties, + name=name, + description=description, + state=state, + on_inactive_mark_as=on_inactive_mark_as, + depends_on=depends_on, + user_properties=user_properties, + **kwargs + ) + self.type: str = "Validation" + self.timeout = timeout + self.sleep = sleep + self.minimum_size = minimum_size + self.child_items = child_items + self.dataset = dataset + + +class VariableSpecification(_serialization.Model): + """Definition of a single variable for a Pipeline. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Variable type. Required. Known values are: "String", "Bool", and "Array". + :vartype type: str or ~azure.mgmt.datafactory.models.VariableType + :ivar default_value: Default value of variable. + :vartype default_value: JSON + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "default_value": {"key": "defaultValue", "type": "object"}, + } + + def __init__( + self, *, type: Union[str, "_models.VariableType"], default_value: Optional[JSON] = None, **kwargs: Any + ) -> None: + """ + :keyword type: Variable type. Required. Known values are: "String", "Bool", and "Array". + :paramtype type: str or ~azure.mgmt.datafactory.models.VariableType + :keyword default_value: Default value of variable. + :paramtype default_value: JSON + """ + super().__init__(**kwargs) + self.type = type + self.default_value = default_value + + +class VerticaLinkedService(LinkedService): + """Vertica linked service. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Type of linked service. Required. + :vartype type: str + :ivar connect_via: The integration runtime reference. + :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar description: Linked service description. + :vartype description: str + :ivar parameters: Parameters for linked service. + :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :ivar annotations: List of tags that can be used for describing the linked service. + :vartype annotations: list[JSON] + :ivar connection_string: An ODBC connection string. Type: string, SecureString or + AzureKeyVaultSecretReference. + :vartype connection_string: JSON + :ivar pwd: The Azure key vault secret reference of password in connection string. + :vartype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are + encrypted using the integration runtime credential manager. Type: string. + :vartype encrypted_credential: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, + "description": {"key": "description", "type": "str"}, + "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, + "annotations": {"key": "annotations", "type": "[object]"}, + "connection_string": {"key": "typeProperties.connectionString", "type": "object"}, + "pwd": {"key": "typeProperties.pwd", "type": "AzureKeyVaultSecretReference"}, + "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, JSON]] = None, + connect_via: Optional["_models.IntegrationRuntimeReference"] = None, + description: Optional[str] = None, + parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, + annotations: Optional[List[JSON]] = None, + connection_string: Optional[JSON] = None, + pwd: Optional["_models.AzureKeyVaultSecretReference"] = None, + encrypted_credential: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword connect_via: The integration runtime reference. + :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword description: Linked service description. + :paramtype description: str + :keyword parameters: Parameters for linked service. + :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :keyword annotations: List of tags that can be used for describing the linked service. + :paramtype annotations: list[JSON] + :keyword connection_string: An ODBC connection string. Type: string, SecureString or + AzureKeyVaultSecretReference. + :paramtype connection_string: JSON + :keyword pwd: The Azure key vault secret reference of password in connection string. + :paramtype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword encrypted_credential: The encrypted credential used for authentication. Credentials + are encrypted using the integration runtime credential manager. Type: string. + :paramtype encrypted_credential: str + """ + super().__init__( + additional_properties=additional_properties, + connect_via=connect_via, + description=description, + parameters=parameters, + annotations=annotations, + **kwargs + ) + self.type: str = "Vertica" + self.connection_string = connection_string + self.pwd = pwd + self.encrypted_credential = encrypted_credential + + +class VerticaSource(TabularSource): + """A copy activity Vertica source. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Copy source type. Required. + :vartype type: str + :ivar source_retry_count: Source retry count. Type: integer (or Expression with resultType + integer). + :vartype source_retry_count: JSON + :ivar source_retry_wait: Source retry wait. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype source_retry_wait: JSON + :ivar max_concurrent_connections: The maximum concurrent connection count for the source data + store. Type: integer (or Expression with resultType integer). + :vartype max_concurrent_connections: JSON + :ivar disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :vartype disable_metrics_collection: JSON + :ivar query_timeout: Query timeout. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype query_timeout: JSON + :ivar additional_columns: Specifies the additional columns to be added to source data. Type: + array of objects(AdditionalColumns) (or Expression with resultType array of objects). + :vartype additional_columns: JSON + :ivar query: A query to retrieve data from source. Type: string (or Expression with resultType + string). + :vartype query: JSON + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "source_retry_count": {"key": "sourceRetryCount", "type": "object"}, + "source_retry_wait": {"key": "sourceRetryWait", "type": "object"}, + "max_concurrent_connections": {"key": "maxConcurrentConnections", "type": "object"}, + "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, + "query_timeout": {"key": "queryTimeout", "type": "object"}, + "additional_columns": {"key": "additionalColumns", "type": "object"}, + "query": {"key": "query", "type": "object"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, JSON]] = None, + source_retry_count: Optional[JSON] = None, + source_retry_wait: Optional[JSON] = None, + max_concurrent_connections: Optional[JSON] = None, + disable_metrics_collection: Optional[JSON] = None, + query_timeout: Optional[JSON] = None, + additional_columns: Optional[JSON] = None, + query: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword source_retry_count: Source retry count. Type: integer (or Expression with resultType + integer). + :paramtype source_retry_count: JSON + :keyword source_retry_wait: Source retry wait. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype source_retry_wait: JSON + :keyword max_concurrent_connections: The maximum concurrent connection count for the source + data store. Type: integer (or Expression with resultType integer). + :paramtype max_concurrent_connections: JSON + :keyword disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :paramtype disable_metrics_collection: JSON + :keyword query_timeout: Query timeout. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype query_timeout: JSON + :keyword additional_columns: Specifies the additional columns to be added to source data. Type: + array of objects(AdditionalColumns) (or Expression with resultType array of objects). + :paramtype additional_columns: JSON + :keyword query: A query to retrieve data from source. Type: string (or Expression with + resultType string). + :paramtype query: JSON + """ + super().__init__( + additional_properties=additional_properties, + source_retry_count=source_retry_count, + source_retry_wait=source_retry_wait, + max_concurrent_connections=max_concurrent_connections, + disable_metrics_collection=disable_metrics_collection, + query_timeout=query_timeout, + additional_columns=additional_columns, + **kwargs + ) + self.type: str = "VerticaSource" + self.query = query + + +class VerticaTableDataset(Dataset): # pylint: disable=too-many-instance-attributes + """Vertica dataset. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Type of dataset. Required. + :vartype type: str + :ivar description: Dataset description. + :vartype description: str + :ivar structure: Columns that define the structure of the dataset. Type: array (or Expression + with resultType array), itemType: DatasetDataElement. + :vartype structure: JSON + :ivar schema: Columns that define the physical type schema of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetSchemaDataElement. + :vartype schema: JSON + :ivar linked_service_name: Linked service reference. Required. + :vartype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference + :ivar parameters: Parameters for dataset. + :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :ivar annotations: List of tags that can be used for describing the Dataset. + :vartype annotations: list[JSON] + :ivar folder: The folder that this Dataset is in. If not specified, Dataset will appear at the + root level. + :vartype folder: ~azure.mgmt.datafactory.models.DatasetFolder + :ivar table_name: This property will be retired. Please consider using schema + table + properties instead. + :vartype table_name: JSON + :ivar table: The table name of the Vertica. Type: string (or Expression with resultType + string). + :vartype table: JSON + :ivar schema_type_properties_schema: The schema name of the Vertica. Type: string (or + Expression with resultType string). + :vartype schema_type_properties_schema: JSON + """ + + _validation = { + "type": {"required": True}, + "linked_service_name": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "structure": {"key": "structure", "type": "object"}, + "schema": {"key": "schema", "type": "object"}, + "linked_service_name": {"key": "linkedServiceName", "type": "LinkedServiceReference"}, + "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, + "annotations": {"key": "annotations", "type": "[object]"}, + "folder": {"key": "folder", "type": "DatasetFolder"}, + "table_name": {"key": "typeProperties.tableName", "type": "object"}, + "table": {"key": "typeProperties.table", "type": "object"}, + "schema_type_properties_schema": {"key": "typeProperties.schema", "type": "object"}, + } + + def __init__( + self, + *, + linked_service_name: "_models.LinkedServiceReference", + additional_properties: Optional[Dict[str, JSON]] = None, + description: Optional[str] = None, + structure: Optional[JSON] = None, + schema: Optional[JSON] = None, + parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, + annotations: Optional[List[JSON]] = None, + folder: Optional["_models.DatasetFolder"] = None, + table_name: Optional[JSON] = None, + table: Optional[JSON] = None, + schema_type_properties_schema: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword description: Dataset description. + :paramtype description: str + :keyword structure: Columns that define the structure of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetDataElement. + :paramtype structure: JSON + :keyword schema: Columns that define the physical type schema of the dataset. Type: array (or + Expression with resultType array), itemType: DatasetSchemaDataElement. + :paramtype schema: JSON + :keyword linked_service_name: Linked service reference. Required. + :paramtype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference + :keyword parameters: Parameters for dataset. + :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] + :keyword annotations: List of tags that can be used for describing the Dataset. + :paramtype annotations: list[JSON] + :keyword folder: The folder that this Dataset is in. If not specified, Dataset will appear at + the root level. + :paramtype folder: ~azure.mgmt.datafactory.models.DatasetFolder + :keyword table_name: This property will be retired. Please consider using schema + table + properties instead. + :paramtype table_name: JSON + :keyword table: The table name of the Vertica. Type: string (or Expression with resultType + string). + :paramtype table: JSON + :keyword schema_type_properties_schema: The schema name of the Vertica. Type: string (or + Expression with resultType string). + :paramtype schema_type_properties_schema: JSON + """ + super().__init__( + additional_properties=additional_properties, + description=description, + structure=structure, + schema=schema, + linked_service_name=linked_service_name, + parameters=parameters, + annotations=annotations, + folder=folder, + **kwargs + ) + self.type: str = "VerticaTable" + self.table_name = table_name + self.table = table + self.schema_type_properties_schema = schema_type_properties_schema + + +class WaitActivity(ControlActivity): + """This activity suspends pipeline execution for the specified interval. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar name: Activity name. Required. + :vartype name: str + :ivar type: Type of activity. Required. + :vartype type: str + :ivar description: Activity description. + :vartype description: str + :ivar state: Activity state. This is an optional property and if not provided, the state will + be Active by default. Known values are: "Active" and "Inactive". + :vartype state: str or ~azure.mgmt.datafactory.models.ActivityState + :ivar on_inactive_mark_as: Status result of the activity when the state is set to Inactive. + This is an optional property and if not provided when the activity is inactive, the status will + be Succeeded by default. Known values are: "Succeeded", "Failed", and "Skipped". + :vartype on_inactive_mark_as: str or ~azure.mgmt.datafactory.models.ActivityOnInactiveMarkAs + :ivar depends_on: Activity depends on condition. + :vartype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] + :ivar user_properties: Activity user properties. + :vartype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] + :ivar wait_time_in_seconds: Duration in seconds. Type: integer (or Expression with resultType + integer). Required. + :vartype wait_time_in_seconds: JSON """ _validation = { "name": {"required": True}, "type": {"required": True}, - "dataset": {"required": True}, + "wait_time_in_seconds": {"required": True}, } _attribute_map = { @@ -66209,28 +67199,20 @@ class ValidationActivity(ControlActivity): # pylint: disable=too-many-instance- "on_inactive_mark_as": {"key": "onInactiveMarkAs", "type": "str"}, "depends_on": {"key": "dependsOn", "type": "[ActivityDependency]"}, "user_properties": {"key": "userProperties", "type": "[UserProperty]"}, - "timeout": {"key": "typeProperties.timeout", "type": "object"}, - "sleep": {"key": "typeProperties.sleep", "type": "object"}, - "minimum_size": {"key": "typeProperties.minimumSize", "type": "object"}, - "child_items": {"key": "typeProperties.childItems", "type": "object"}, - "dataset": {"key": "typeProperties.dataset", "type": "DatasetReference"}, + "wait_time_in_seconds": {"key": "typeProperties.waitTimeInSeconds", "type": "object"}, } def __init__( self, *, name: str, - dataset: "_models.DatasetReference", + wait_time_in_seconds: JSON, additional_properties: Optional[Dict[str, JSON]] = None, description: Optional[str] = None, state: Optional[Union[str, "_models.ActivityState"]] = None, on_inactive_mark_as: Optional[Union[str, "_models.ActivityOnInactiveMarkAs"]] = None, depends_on: Optional[List["_models.ActivityDependency"]] = None, user_properties: Optional[List["_models.UserProperty"]] = None, - timeout: Optional[JSON] = None, - sleep: Optional[JSON] = None, - minimum_size: Optional[JSON] = None, - child_items: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -66252,23 +67234,9 @@ def __init__( :paramtype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] :keyword user_properties: Activity user properties. :paramtype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] - :keyword timeout: Specifies the timeout for the activity to run. If there is no value - specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string - (or Expression with resultType string), pattern: - ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). - :paramtype timeout: JSON - :keyword sleep: A delay in seconds between validation attempts. If no value is specified, 10 - seconds will be used as the default. Type: integer (or Expression with resultType integer). - :paramtype sleep: JSON - :keyword minimum_size: Can be used if dataset points to a file. The file must be greater than - or equal in size to the value specified. Type: integer (or Expression with resultType integer). - :paramtype minimum_size: JSON - :keyword child_items: Can be used if dataset points to a folder. If set to true, the folder - must have at least one file. If set to false, the folder must be empty. Type: boolean (or - Expression with resultType boolean). - :paramtype child_items: JSON - :keyword dataset: Validation activity dataset reference. Required. - :paramtype dataset: ~azure.mgmt.datafactory.models.DatasetReference + :keyword wait_time_in_seconds: Duration in seconds. Type: integer (or Expression with + resultType integer). Required. + :paramtype wait_time_in_seconds: JSON """ super().__init__( additional_properties=additional_properties, @@ -66280,50 +67248,12 @@ def __init__( user_properties=user_properties, **kwargs ) - self.type: str = "Validation" - self.timeout = timeout - self.sleep = sleep - self.minimum_size = minimum_size - self.child_items = child_items - self.dataset = dataset - - -class VariableSpecification(_serialization.Model): - """Definition of a single variable for a Pipeline. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Variable type. Required. Known values are: "String", "Bool", and "Array". - :vartype type: str or ~azure.mgmt.datafactory.models.VariableType - :ivar default_value: Default value of variable. - :vartype default_value: JSON - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "default_value": {"key": "defaultValue", "type": "object"}, - } - - def __init__( - self, *, type: Union[str, "_models.VariableType"], default_value: Optional[JSON] = None, **kwargs: Any - ) -> None: - """ - :keyword type: Variable type. Required. Known values are: "String", "Bool", and "Array". - :paramtype type: str or ~azure.mgmt.datafactory.models.VariableType - :keyword default_value: Default value of variable. - :paramtype default_value: JSON - """ - super().__init__(**kwargs) - self.type = type - self.default_value = default_value + self.type: str = "Wait" + self.wait_time_in_seconds = wait_time_in_seconds -class VerticaLinkedService(LinkedService): - """Vertica linked service. +class WarehouseLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes + """Microsoft Fabric Warehouse linked service. All required parameters must be populated in order to send to Azure. @@ -66340,18 +67270,43 @@ class VerticaLinkedService(LinkedService): :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] :ivar annotations: List of tags that can be used for describing the linked service. :vartype annotations: list[JSON] - :ivar connection_string: An ODBC connection string. Type: string, SecureString or - AzureKeyVaultSecretReference. - :vartype connection_string: JSON - :ivar pwd: The Azure key vault secret reference of password in connection string. - :vartype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar artifact_id: The ID of Microsoft Fabric Warehouse artifact. Type: string (or Expression + with resultType string). Required. + :vartype artifact_id: JSON + :ivar endpoint: The endpoint of Microsoft Fabric Warehouse server. Type: string (or Expression + with resultType string). Required. + :vartype endpoint: JSON + :ivar workspace_id: The ID of Microsoft Fabric workspace. Type: string (or Expression with + resultType string). + :vartype workspace_id: JSON + :ivar service_principal_id: The ID of the application used to authenticate against Microsoft + Fabric Warehouse. Type: string (or Expression with resultType string). + :vartype service_principal_id: JSON + :ivar service_principal_key: The Key of the application used to authenticate against Microsoft + Fabric Warehouse. + :vartype service_principal_key: ~azure.mgmt.datafactory.models.SecretBase + :ivar tenant: The name or ID of the tenant to which the service principal belongs. Type: string + (or Expression with resultType string). + :vartype tenant: JSON :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :vartype encrypted_credential: str + :ivar service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :vartype service_principal_credential_type: JSON + :ivar service_principal_credential: The credential of the service principal object in Azure + Active Directory. If servicePrincipalCredentialType is 'ServicePrincipalKey', + servicePrincipalCredential can be SecureString or AzureKeyVaultSecretReference. If + servicePrincipalCredentialType is 'ServicePrincipalCert', servicePrincipalCredential can only + be AzureKeyVaultSecretReference. + :vartype service_principal_credential: ~azure.mgmt.datafactory.models.SecretBase """ _validation = { "type": {"required": True}, + "artifact_id": {"required": True}, + "endpoint": {"required": True}, } _attribute_map = { @@ -66361,22 +67316,34 @@ class VerticaLinkedService(LinkedService): "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, - "connection_string": {"key": "typeProperties.connectionString", "type": "object"}, - "pwd": {"key": "typeProperties.pwd", "type": "AzureKeyVaultSecretReference"}, + "artifact_id": {"key": "typeProperties.artifactId", "type": "object"}, + "endpoint": {"key": "typeProperties.endpoint", "type": "object"}, + "workspace_id": {"key": "typeProperties.workspaceId", "type": "object"}, + "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, + "service_principal_key": {"key": "typeProperties.servicePrincipalKey", "type": "SecretBase"}, + "tenant": {"key": "typeProperties.tenant", "type": "object"}, "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + "service_principal_credential_type": {"key": "typeProperties.servicePrincipalCredentialType", "type": "object"}, + "service_principal_credential": {"key": "typeProperties.servicePrincipalCredential", "type": "SecretBase"}, } def __init__( self, *, + artifact_id: JSON, + endpoint: JSON, additional_properties: Optional[Dict[str, JSON]] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, - connection_string: Optional[JSON] = None, - pwd: Optional["_models.AzureKeyVaultSecretReference"] = None, + workspace_id: Optional[JSON] = None, + service_principal_id: Optional[JSON] = None, + service_principal_key: Optional["_models.SecretBase"] = None, + tenant: Optional[JSON] = None, encrypted_credential: Optional[str] = None, + service_principal_credential_type: Optional[JSON] = None, + service_principal_credential: Optional["_models.SecretBase"] = None, **kwargs: Any ) -> None: """ @@ -66391,14 +67358,37 @@ def __init__( :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] :keyword annotations: List of tags that can be used for describing the linked service. :paramtype annotations: list[JSON] - :keyword connection_string: An ODBC connection string. Type: string, SecureString or - AzureKeyVaultSecretReference. - :paramtype connection_string: JSON - :keyword pwd: The Azure key vault secret reference of password in connection string. - :paramtype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword artifact_id: The ID of Microsoft Fabric Warehouse artifact. Type: string (or + Expression with resultType string). Required. + :paramtype artifact_id: JSON + :keyword endpoint: The endpoint of Microsoft Fabric Warehouse server. Type: string (or + Expression with resultType string). Required. + :paramtype endpoint: JSON + :keyword workspace_id: The ID of Microsoft Fabric workspace. Type: string (or Expression with + resultType string). + :paramtype workspace_id: JSON + :keyword service_principal_id: The ID of the application used to authenticate against Microsoft + Fabric Warehouse. Type: string (or Expression with resultType string). + :paramtype service_principal_id: JSON + :keyword service_principal_key: The Key of the application used to authenticate against + Microsoft Fabric Warehouse. + :paramtype service_principal_key: ~azure.mgmt.datafactory.models.SecretBase + :keyword tenant: The name or ID of the tenant to which the service principal belongs. Type: + string (or Expression with resultType string). + :paramtype tenant: JSON :keyword encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :paramtype encrypted_credential: str + :keyword service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :paramtype service_principal_credential_type: JSON + :keyword service_principal_credential: The credential of the service principal object in Azure + Active Directory. If servicePrincipalCredentialType is 'ServicePrincipalKey', + servicePrincipalCredential can be SecureString or AzureKeyVaultSecretReference. If + servicePrincipalCredentialType is 'ServicePrincipalCert', servicePrincipalCredential can only + be AzureKeyVaultSecretReference. + :paramtype service_principal_credential: ~azure.mgmt.datafactory.models.SecretBase """ super().__init__( additional_properties=additional_properties, @@ -66408,14 +67398,158 @@ def __init__( annotations=annotations, **kwargs ) - self.type: str = "Vertica" - self.connection_string = connection_string - self.pwd = pwd + self.type: str = "Warehouse" + self.artifact_id = artifact_id + self.endpoint = endpoint + self.workspace_id = workspace_id + self.service_principal_id = service_principal_id + self.service_principal_key = service_principal_key + self.tenant = tenant self.encrypted_credential = encrypted_credential + self.service_principal_credential_type = service_principal_credential_type + self.service_principal_credential = service_principal_credential -class VerticaSource(TabularSource): - """A copy activity Vertica source. +class WarehouseSink(CopySink): # pylint: disable=too-many-instance-attributes + """A copy activity Microsoft Fabric Warehouse sink. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, JSON] + :ivar type: Copy sink type. Required. + :vartype type: str + :ivar write_batch_size: Write batch size. Type: integer (or Expression with resultType + integer), minimum: 0. + :vartype write_batch_size: JSON + :ivar write_batch_timeout: Write batch timeout. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype write_batch_timeout: JSON + :ivar sink_retry_count: Sink retry count. Type: integer (or Expression with resultType + integer). + :vartype sink_retry_count: JSON + :ivar sink_retry_wait: Sink retry wait. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :vartype sink_retry_wait: JSON + :ivar max_concurrent_connections: The maximum concurrent connection count for the sink data + store. Type: integer (or Expression with resultType integer). + :vartype max_concurrent_connections: JSON + :ivar disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :vartype disable_metrics_collection: JSON + :ivar pre_copy_script: SQL pre-copy script. Type: string (or Expression with resultType + string). + :vartype pre_copy_script: JSON + :ivar allow_copy_command: Indicates to use Copy Command to copy data into SQL Data Warehouse. + Type: boolean (or Expression with resultType boolean). + :vartype allow_copy_command: JSON + :ivar copy_command_settings: Specifies Copy Command related settings when allowCopyCommand is + true. + :vartype copy_command_settings: ~azure.mgmt.datafactory.models.DWCopyCommandSettings + :ivar table_option: The option to handle sink table, such as autoCreate. For now only + 'autoCreate' value is supported. Type: string (or Expression with resultType string). + :vartype table_option: JSON + :ivar write_behavior: Write behavior when copying data into azure Microsoft Fabric Data + Warehouse. Type: DWWriteBehaviorEnum (or Expression with resultType DWWriteBehaviorEnum). + :vartype write_behavior: JSON + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "write_batch_size": {"key": "writeBatchSize", "type": "object"}, + "write_batch_timeout": {"key": "writeBatchTimeout", "type": "object"}, + "sink_retry_count": {"key": "sinkRetryCount", "type": "object"}, + "sink_retry_wait": {"key": "sinkRetryWait", "type": "object"}, + "max_concurrent_connections": {"key": "maxConcurrentConnections", "type": "object"}, + "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, + "pre_copy_script": {"key": "preCopyScript", "type": "object"}, + "allow_copy_command": {"key": "allowCopyCommand", "type": "object"}, + "copy_command_settings": {"key": "copyCommandSettings", "type": "DWCopyCommandSettings"}, + "table_option": {"key": "tableOption", "type": "object"}, + "write_behavior": {"key": "writeBehavior", "type": "object"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, JSON]] = None, + write_batch_size: Optional[JSON] = None, + write_batch_timeout: Optional[JSON] = None, + sink_retry_count: Optional[JSON] = None, + sink_retry_wait: Optional[JSON] = None, + max_concurrent_connections: Optional[JSON] = None, + disable_metrics_collection: Optional[JSON] = None, + pre_copy_script: Optional[JSON] = None, + allow_copy_command: Optional[JSON] = None, + copy_command_settings: Optional["_models.DWCopyCommandSettings"] = None, + table_option: Optional[JSON] = None, + write_behavior: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, JSON] + :keyword write_batch_size: Write batch size. Type: integer (or Expression with resultType + integer), minimum: 0. + :paramtype write_batch_size: JSON + :keyword write_batch_timeout: Write batch timeout. Type: string (or Expression with resultType + string), pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype write_batch_timeout: JSON + :keyword sink_retry_count: Sink retry count. Type: integer (or Expression with resultType + integer). + :paramtype sink_retry_count: JSON + :keyword sink_retry_wait: Sink retry wait. Type: string (or Expression with resultType string), + pattern: ((\d+).)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + :paramtype sink_retry_wait: JSON + :keyword max_concurrent_connections: The maximum concurrent connection count for the sink data + store. Type: integer (or Expression with resultType integer). + :paramtype max_concurrent_connections: JSON + :keyword disable_metrics_collection: If true, disable data store metrics collection. Default is + false. Type: boolean (or Expression with resultType boolean). + :paramtype disable_metrics_collection: JSON + :keyword pre_copy_script: SQL pre-copy script. Type: string (or Expression with resultType + string). + :paramtype pre_copy_script: JSON + :keyword allow_copy_command: Indicates to use Copy Command to copy data into SQL Data + Warehouse. Type: boolean (or Expression with resultType boolean). + :paramtype allow_copy_command: JSON + :keyword copy_command_settings: Specifies Copy Command related settings when allowCopyCommand + is true. + :paramtype copy_command_settings: ~azure.mgmt.datafactory.models.DWCopyCommandSettings + :keyword table_option: The option to handle sink table, such as autoCreate. For now only + 'autoCreate' value is supported. Type: string (or Expression with resultType string). + :paramtype table_option: JSON + :keyword write_behavior: Write behavior when copying data into azure Microsoft Fabric Data + Warehouse. Type: DWWriteBehaviorEnum (or Expression with resultType DWWriteBehaviorEnum). + :paramtype write_behavior: JSON + """ + super().__init__( + additional_properties=additional_properties, + write_batch_size=write_batch_size, + write_batch_timeout=write_batch_timeout, + sink_retry_count=sink_retry_count, + sink_retry_wait=sink_retry_wait, + max_concurrent_connections=max_concurrent_connections, + disable_metrics_collection=disable_metrics_collection, + **kwargs + ) + self.type: str = "WarehouseSink" + self.pre_copy_script = pre_copy_script + self.allow_copy_command = allow_copy_command + self.copy_command_settings = copy_command_settings + self.table_option = table_option + self.write_behavior = write_behavior + + +class WarehouseSource(TabularSource): # pylint: disable=too-many-instance-attributes + """A copy activity Microsoft Fabric Warehouse source. All required parameters must be populated in order to send to Azure. @@ -66442,9 +67576,27 @@ class VerticaSource(TabularSource): :ivar additional_columns: Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). :vartype additional_columns: JSON - :ivar query: A query to retrieve data from source. Type: string (or Expression with resultType - string). - :vartype query: JSON + :ivar sql_reader_query: Microsoft Fabric Warehouse reader query. Type: string (or Expression + with resultType string). + :vartype sql_reader_query: JSON + :ivar sql_reader_stored_procedure_name: Name of the stored procedure for a Microsoft Fabric + Warehouse source. This cannot be used at the same time as SqlReaderQuery. Type: string (or + Expression with resultType string). + :vartype sql_reader_stored_procedure_name: JSON + :ivar stored_procedure_parameters: Value and type setting for stored procedure parameters. + Example: "{Parameter1: {value: "1", type: "int"}}". Type: object (or Expression with resultType + object), itemType: StoredProcedureParameter. + :vartype stored_procedure_parameters: JSON + :ivar isolation_level: Specifies the transaction locking behavior for the Microsoft Fabric + Warehouse source. Allowed values: + ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is + ReadCommitted. Type: string (or Expression with resultType string). + :vartype isolation_level: JSON + :ivar partition_option: The partition mechanism that will be used for Sql read in parallel. + Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". + :vartype partition_option: JSON + :ivar partition_settings: The settings that will be leveraged for Sql source partitioning. + :vartype partition_settings: ~azure.mgmt.datafactory.models.SqlPartitionSettings """ _validation = { @@ -66460,7 +67612,12 @@ class VerticaSource(TabularSource): "disable_metrics_collection": {"key": "disableMetricsCollection", "type": "object"}, "query_timeout": {"key": "queryTimeout", "type": "object"}, "additional_columns": {"key": "additionalColumns", "type": "object"}, - "query": {"key": "query", "type": "object"}, + "sql_reader_query": {"key": "sqlReaderQuery", "type": "object"}, + "sql_reader_stored_procedure_name": {"key": "sqlReaderStoredProcedureName", "type": "object"}, + "stored_procedure_parameters": {"key": "storedProcedureParameters", "type": "object"}, + "isolation_level": {"key": "isolationLevel", "type": "object"}, + "partition_option": {"key": "partitionOption", "type": "object"}, + "partition_settings": {"key": "partitionSettings", "type": "SqlPartitionSettings"}, } def __init__( @@ -66473,7 +67630,12 @@ def __init__( disable_metrics_collection: Optional[JSON] = None, query_timeout: Optional[JSON] = None, additional_columns: Optional[JSON] = None, - query: Optional[JSON] = None, + sql_reader_query: Optional[JSON] = None, + sql_reader_stored_procedure_name: Optional[JSON] = None, + stored_procedure_parameters: Optional[JSON] = None, + isolation_level: Optional[JSON] = None, + partition_option: Optional[JSON] = None, + partition_settings: Optional["_models.SqlPartitionSettings"] = None, **kwargs: Any ) -> None: """ @@ -66498,9 +67660,27 @@ def __init__( :keyword additional_columns: Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). :paramtype additional_columns: JSON - :keyword query: A query to retrieve data from source. Type: string (or Expression with - resultType string). - :paramtype query: JSON + :keyword sql_reader_query: Microsoft Fabric Warehouse reader query. Type: string (or Expression + with resultType string). + :paramtype sql_reader_query: JSON + :keyword sql_reader_stored_procedure_name: Name of the stored procedure for a Microsoft Fabric + Warehouse source. This cannot be used at the same time as SqlReaderQuery. Type: string (or + Expression with resultType string). + :paramtype sql_reader_stored_procedure_name: JSON + :keyword stored_procedure_parameters: Value and type setting for stored procedure parameters. + Example: "{Parameter1: {value: "1", type: "int"}}". Type: object (or Expression with resultType + object), itemType: StoredProcedureParameter. + :paramtype stored_procedure_parameters: JSON + :keyword isolation_level: Specifies the transaction locking behavior for the Microsoft Fabric + Warehouse source. Allowed values: + ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is + ReadCommitted. Type: string (or Expression with resultType string). + :paramtype isolation_level: JSON + :keyword partition_option: The partition mechanism that will be used for Sql read in parallel. + Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". + :paramtype partition_option: JSON + :keyword partition_settings: The settings that will be leveraged for Sql source partitioning. + :paramtype partition_settings: ~azure.mgmt.datafactory.models.SqlPartitionSettings """ super().__init__( additional_properties=additional_properties, @@ -66512,12 +67692,17 @@ def __init__( additional_columns=additional_columns, **kwargs ) - self.type: str = "VerticaSource" - self.query = query + self.type: str = "WarehouseSource" + self.sql_reader_query = sql_reader_query + self.sql_reader_stored_procedure_name = sql_reader_stored_procedure_name + self.stored_procedure_parameters = stored_procedure_parameters + self.isolation_level = isolation_level + self.partition_option = partition_option + self.partition_settings = partition_settings -class VerticaTableDataset(Dataset): # pylint: disable=too-many-instance-attributes - """Vertica dataset. +class WarehouseTableDataset(Dataset): # pylint: disable=too-many-instance-attributes + """Microsoft Fabric Warehouse dataset. All required parameters must be populated in order to send to Azure. @@ -66543,15 +67728,12 @@ class VerticaTableDataset(Dataset): # pylint: disable=too-many-instance-attribu :ivar folder: The folder that this Dataset is in. If not specified, Dataset will appear at the root level. :vartype folder: ~azure.mgmt.datafactory.models.DatasetFolder - :ivar table_name: This property will be retired. Please consider using schema + table - properties instead. - :vartype table_name: JSON - :ivar table: The table name of the Vertica. Type: string (or Expression with resultType - string). - :vartype table: JSON - :ivar schema_type_properties_schema: The schema name of the Vertica. Type: string (or - Expression with resultType string). + :ivar schema_type_properties_schema: The schema name of the Microsoft Fabric Warehouse. Type: + string (or Expression with resultType string). :vartype schema_type_properties_schema: JSON + :ivar table: The table name of the Microsoft Fabric Warehouse. Type: string (or Expression with + resultType string). + :vartype table: JSON """ _validation = { @@ -66569,9 +67751,8 @@ class VerticaTableDataset(Dataset): # pylint: disable=too-many-instance-attribu "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "folder": {"key": "folder", "type": "DatasetFolder"}, - "table_name": {"key": "typeProperties.tableName", "type": "object"}, - "table": {"key": "typeProperties.table", "type": "object"}, "schema_type_properties_schema": {"key": "typeProperties.schema", "type": "object"}, + "table": {"key": "typeProperties.table", "type": "object"}, } def __init__( @@ -66585,9 +67766,8 @@ def __init__( parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, folder: Optional["_models.DatasetFolder"] = None, - table_name: Optional[JSON] = None, - table: Optional[JSON] = None, schema_type_properties_schema: Optional[JSON] = None, + table: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -66611,15 +67791,12 @@ def __init__( :keyword folder: The folder that this Dataset is in. If not specified, Dataset will appear at the root level. :paramtype folder: ~azure.mgmt.datafactory.models.DatasetFolder - :keyword table_name: This property will be retired. Please consider using schema + table - properties instead. - :paramtype table_name: JSON - :keyword table: The table name of the Vertica. Type: string (or Expression with resultType - string). - :paramtype table: JSON - :keyword schema_type_properties_schema: The schema name of the Vertica. Type: string (or - Expression with resultType string). + :keyword schema_type_properties_schema: The schema name of the Microsoft Fabric Warehouse. + Type: string (or Expression with resultType string). :paramtype schema_type_properties_schema: JSON + :keyword table: The table name of the Microsoft Fabric Warehouse. Type: string (or Expression + with resultType string). + :paramtype table: JSON """ super().__init__( additional_properties=additional_properties, @@ -66632,108 +67809,9 @@ def __init__( folder=folder, **kwargs ) - self.type: str = "VerticaTable" - self.table_name = table_name - self.table = table + self.type: str = "WarehouseTable" self.schema_type_properties_schema = schema_type_properties_schema - - -class WaitActivity(ControlActivity): - """This activity suspends pipeline execution for the specified interval. - - All required parameters must be populated in order to send to Azure. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar name: Activity name. Required. - :vartype name: str - :ivar type: Type of activity. Required. - :vartype type: str - :ivar description: Activity description. - :vartype description: str - :ivar state: Activity state. This is an optional property and if not provided, the state will - be Active by default. Known values are: "Active" and "Inactive". - :vartype state: str or ~azure.mgmt.datafactory.models.ActivityState - :ivar on_inactive_mark_as: Status result of the activity when the state is set to Inactive. - This is an optional property and if not provided when the activity is inactive, the status will - be Succeeded by default. Known values are: "Succeeded", "Failed", and "Skipped". - :vartype on_inactive_mark_as: str or ~azure.mgmt.datafactory.models.ActivityOnInactiveMarkAs - :ivar depends_on: Activity depends on condition. - :vartype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] - :ivar user_properties: Activity user properties. - :vartype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] - :ivar wait_time_in_seconds: Duration in seconds. Type: integer (or Expression with resultType - integer). Required. - :vartype wait_time_in_seconds: JSON - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - "wait_time_in_seconds": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "on_inactive_mark_as": {"key": "onInactiveMarkAs", "type": "str"}, - "depends_on": {"key": "dependsOn", "type": "[ActivityDependency]"}, - "user_properties": {"key": "userProperties", "type": "[UserProperty]"}, - "wait_time_in_seconds": {"key": "typeProperties.waitTimeInSeconds", "type": "object"}, - } - - def __init__( - self, - *, - name: str, - wait_time_in_seconds: JSON, - additional_properties: Optional[Dict[str, JSON]] = None, - description: Optional[str] = None, - state: Optional[Union[str, "_models.ActivityState"]] = None, - on_inactive_mark_as: Optional[Union[str, "_models.ActivityOnInactiveMarkAs"]] = None, - depends_on: Optional[List["_models.ActivityDependency"]] = None, - user_properties: Optional[List["_models.UserProperty"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword name: Activity name. Required. - :paramtype name: str - :keyword description: Activity description. - :paramtype description: str - :keyword state: Activity state. This is an optional property and if not provided, the state - will be Active by default. Known values are: "Active" and "Inactive". - :paramtype state: str or ~azure.mgmt.datafactory.models.ActivityState - :keyword on_inactive_mark_as: Status result of the activity when the state is set to Inactive. - This is an optional property and if not provided when the activity is inactive, the status will - be Succeeded by default. Known values are: "Succeeded", "Failed", and "Skipped". - :paramtype on_inactive_mark_as: str or ~azure.mgmt.datafactory.models.ActivityOnInactiveMarkAs - :keyword depends_on: Activity depends on condition. - :paramtype depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency] - :keyword user_properties: Activity user properties. - :paramtype user_properties: list[~azure.mgmt.datafactory.models.UserProperty] - :keyword wait_time_in_seconds: Duration in seconds. Type: integer (or Expression with - resultType integer). Required. - :paramtype wait_time_in_seconds: JSON - """ - super().__init__( - additional_properties=additional_properties, - name=name, - description=description, - state=state, - on_inactive_mark_as=on_inactive_mark_as, - depends_on=depends_on, - user_properties=user_properties, - **kwargs - ) - self.type: str = "Wait" - self.wait_time_in_seconds = wait_time_in_seconds + self.table = table class WebActivity(ExecutionActivity): # pylint: disable=too-many-instance-attributes @@ -66773,8 +67851,8 @@ class WebActivity(ExecutionActivity): # pylint: disable=too-many-instance-attri :vartype url: JSON :ivar headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :vartype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :vartype headers: dict[str, str] :ivar body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :vartype body: JSON @@ -66819,7 +67897,7 @@ class WebActivity(ExecutionActivity): # pylint: disable=too-many-instance-attri "policy": {"key": "policy", "type": "ActivityPolicy"}, "method": {"key": "typeProperties.method", "type": "str"}, "url": {"key": "typeProperties.url", "type": "object"}, - "headers": {"key": "typeProperties.headers", "type": "object"}, + "headers": {"key": "typeProperties.headers", "type": "{str}"}, "body": {"key": "typeProperties.body", "type": "object"}, "authentication": {"key": "typeProperties.authentication", "type": "WebActivityAuthentication"}, "disable_cert_validation": {"key": "typeProperties.disableCertValidation", "type": "bool"}, @@ -66844,7 +67922,7 @@ def __init__( user_properties: Optional[List["_models.UserProperty"]] = None, linked_service_name: Optional["_models.LinkedServiceReference"] = None, policy: Optional["_models.ActivityPolicy"] = None, - headers: Optional[JSON] = None, + headers: Optional[Dict[str, str]] = None, body: Optional[JSON] = None, authentication: Optional["_models.WebActivityAuthentication"] = None, disable_cert_validation: Optional[bool] = None, @@ -66886,8 +67964,8 @@ def __init__( :paramtype url: JSON :keyword headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :paramtype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :paramtype headers: dict[str, str] :keyword body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :paramtype body: JSON @@ -67228,8 +68306,8 @@ class WebHookActivity(ControlActivity): # pylint: disable=too-many-instance-att :vartype timeout: str :ivar headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :vartype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :vartype headers: dict[str, str] :ivar body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :vartype body: JSON @@ -67262,7 +68340,7 @@ class WebHookActivity(ControlActivity): # pylint: disable=too-many-instance-att "method": {"key": "typeProperties.method", "type": "str"}, "url": {"key": "typeProperties.url", "type": "object"}, "timeout": {"key": "typeProperties.timeout", "type": "str"}, - "headers": {"key": "typeProperties.headers", "type": "object"}, + "headers": {"key": "typeProperties.headers", "type": "{str}"}, "body": {"key": "typeProperties.body", "type": "object"}, "authentication": {"key": "typeProperties.authentication", "type": "WebActivityAuthentication"}, "report_status_on_call_back": {"key": "typeProperties.reportStatusOnCallBack", "type": "object"}, @@ -67282,7 +68360,7 @@ def __init__( user_properties: Optional[List["_models.UserProperty"]] = None, policy: Optional["_models.SecureInputOutputPolicy"] = None, timeout: Optional[str] = None, - headers: Optional[JSON] = None, + headers: Optional[Dict[str, str]] = None, body: Optional[JSON] = None, authentication: Optional["_models.WebActivityAuthentication"] = None, report_status_on_call_back: Optional[JSON] = None, @@ -67320,8 +68398,8 @@ def __init__( :paramtype timeout: str :keyword headers: Represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": - "application/json" }. Type: dictionary (or Expression with resultType dictionary). - :paramtype headers: JSON + "application/json" }. Type: string (or Expression with resultType string). + :paramtype headers: dict[str, str] :keyword body: Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). :paramtype body: JSON diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index 72a9c7e96f82..61788694266f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "commit": "15ba5b8a954afb74a6bb8902038835f0cddb9930", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/desktopvirtualization/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/desktopvirtualization/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py index a536063e4548..188200ab7838 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -29,14 +29,14 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :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-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-16-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(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-01-16-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py index 7098982a4ab5..0632d2c0abf8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py @@ -16,10 +16,15 @@ from ._configuration import DesktopVirtualizationMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + ActiveSessionHostConfigurationsOperations, + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -28,6 +33,11 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperationStatusOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperationStatusOperations, + SessionHostManagementsOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -71,23 +81,56 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_operation_status: + SessionHostManagementsOperationStatusOperations operations + :vartype session_host_managements_operation_status: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsOperationStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.operations.SessionHostConfigurationsOperations + :ivar session_host_configurations_operation_status: + SessionHostConfigurationsOperationStatusOperations operations + :vartype session_host_configurations_operation_status: + azure.mgmt.desktopvirtualization.operations.SessionHostConfigurationsOperationStatusOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageOperations :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-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-16-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. """ def __init__( @@ -128,10 +171,38 @@ def __init__( self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_operation_status = SessionHostManagementsOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations_operation_status = SessionHostConfigurationsOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py index cee48f65d70f..9ea30d0298c7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py @@ -29,14 +29,14 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :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-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-16-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(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-01-16-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py index 652ec8ef22ef..283a8effa2b3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py @@ -16,10 +16,15 @@ from .._serialization import Deserializer, Serializer from ._configuration import DesktopVirtualizationMgmtClientConfiguration from .operations import ( + ActiveSessionHostConfigurationsOperations, + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -28,6 +33,11 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperationStatusOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperationStatusOperations, + SessionHostManagementsOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -72,23 +82,56 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_operation_status: + SessionHostManagementsOperationStatusOperations operations + :vartype session_host_managements_operation_status: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsOperationStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostConfigurationsOperations + :ivar session_host_configurations_operation_status: + SessionHostConfigurationsOperationStatusOperations operations + :vartype session_host_configurations_operation_status: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostConfigurationsOperationStatusOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.aio.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.aio.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.aio.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageOperations :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-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-16-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. """ def __init__( @@ -129,10 +172,38 @@ def __init__( self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_operation_status = SessionHostManagementsOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations_operation_status = SessionHostConfigurationsOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py index 975df17adf61..471e5611cbc6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py @@ -18,10 +18,20 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_operation_status_operations import SessionHostManagementsOperationStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._session_host_configurations_operation_status_operations import SessionHostConfigurationsOperationStatusOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,10 +50,20 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsOperationStatusOperations", + "SessionHostConfigurationsOperations", + "SessionHostConfigurationsOperationStatusOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..77a0f5681e92 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,215 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._active_session_host_configurations_operations import ( + build_get_request, + build_list_by_host_pool_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ActiveSessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` 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_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :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.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :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.ActiveSessionHostConfigurationList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.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("ActiveSessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..643bce2e0e23 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py @@ -0,0 +1,230 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_attach_package_info_operations import build_import_method_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` 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 + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :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: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.import_method.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("AppAttachPackageList", 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) + + import_method.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/importAppAttachPackageInfo" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..c9f09d4abb6c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py @@ -0,0 +1,671 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_attach_package_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` 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_async + async def get( + self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + ) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :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.AppAttachPackage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_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 = 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("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppAttachPackage", pipeline_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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool + :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, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + 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) + + _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("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name and + host pool. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = 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, + filter=filter, + 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("AppAttachPackageList", 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.DesktopVirtualization/appAttachPackages" + } + + @distributed_trace + def list_by_subscription( + self, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, and resource group. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = 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, + filter=filter, + 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("AppAttachPackageList", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..bc0b13c90c3b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py @@ -0,0 +1,280 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._control_session_host_update_operations import build_post_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` 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 _post_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: Union[_models.HostPoolControlParameter, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(host_pool_control_parameter, (IOBase, bytes)): + _content = host_pool_control_parameter + else: + _json = self._serialize.body(host_pool_control_parameter, "HostPoolControlParameter") + + request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate" + } + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: _models.HostPoolControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. + Required. + :type host_pool_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolControlParameter + :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: + """ + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. + Required. + :type host_pool_control_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: Union[_models.HostPoolControlParameter, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. Is + either a HostPoolControlParameter type or a IO type. Required. + :type host_pool_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolControlParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._post_initial( # type: ignore + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_control_parameter=host_pool_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..b1cdd96e5964 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,284 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._initiate_session_host_update_operations import build_post_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` 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 _post_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO]] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate" + } + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :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: + """ + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._post_initial( # type: ignore + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + update_session_hosts_request_body=update_session_hosts_request_body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operation_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operation_status_operations.py new file mode 100644 index 000000000000..411bd40b179c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operation_status_operations.py @@ -0,0 +1,227 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._session_host_configurations_operation_status_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostConfigurationsOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations_operation_status` 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_async + async def get( + self, resource_group_name: str, host_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.SessionHostConfigurationOperationStatus: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param operation_id: The Guid of the operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostConfigurationOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus + :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.SessionHostConfigurationOperationStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfigurationOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses/{operationId}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + is_latest: Optional[bool] = None, + is_non_terminal: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SessionHostConfigurationOperationStatus"]: + """Get Operation status for SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param is_latest: Returns the most recent sessionHostConfiguration operation. Default value is + None. + :type is_latest: bool + :param is_non_terminal: Returns currently running operations. Ignored if 'isLatest' is true. + Default value is None. + :type is_non_terminal: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostConfigurationOperationStatus or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :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.SessionHostConfigurationOperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + is_latest=is_latest, + is_non_terminal=is_non_terminal, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationOperationStatusList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..78d53366f607 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py @@ -0,0 +1,724 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._session_host_configurations_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` 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 _create_or_update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO], + **kwargs: Any + ) -> _models.SessionHostConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :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 SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + async def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO]] = None, + **kwargs: Any + ) -> Optional[_models.SessionHostConfiguration]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostConfiguration]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :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 SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :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.SessionHostConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfigurationList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.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("SessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operation_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operation_status_operations.py new file mode 100644 index 000000000000..9aa8b18c7bed --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operation_status_operations.py @@ -0,0 +1,247 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._session_host_managements_operation_status_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_operation_status` 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_async + async def get( + self, resource_group_name: str, host_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.SessionHostManagementOperationStatus: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param operation_id: The Guid of the operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagementOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus + :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.SessionHostManagementOperationStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagementOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses/{operationId}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + is_latest: Optional[bool] = None, + type: Optional[str] = None, + is_non_terminal: Optional[bool] = None, + correlation_id: Optional[str] = None, + action: Optional[str] = None, + is_initiating_operation: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SessionHostManagementOperationStatus"]: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param is_latest: Returns the most recent sessionHostManagement operation. Default value is + None. + :type is_latest: bool + :param type: Filter based on the type of sessionHostManagement operation. Valid values are + 'InitiateSessionHostUpdate' and 'ValidateSessionHostUpdate'. Default value is None. + :type type: str + :param is_non_terminal: Returns currently running operations. Ignored if 'isLatest' is true. + Default value is None. + :type is_non_terminal: bool + :param correlation_id: CorrelationId of the sessionHostManagement operations to be returned. + Default value is None. + :type correlation_id: str + :param action: Action type for the Operation Status list to be filtered on. Valid actions are: + start | retry | pause | resume | cancel). Default value is None. + :type action: str + :param is_initiating_operation: Filter option to only return operations that initiated a + sessionHostManagement operation. Default value is None. + :type is_initiating_operation: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostManagementOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + :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.SessionHostManagementOperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + is_latest=is_latest, + type=type, + is_non_terminal=is_non_terminal, + correlation_id=correlation_id, + action=action, + is_initiating_operation=is_initiating_operation, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementOperationStatusList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..6ffa71fca775 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py @@ -0,0 +1,511 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._session_host_managements_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` 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_async + async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :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.SessionHostManagement] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :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: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SessionHostManagement", pipeline_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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :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: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :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.SessionHostManagementList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.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("SessionHostManagementList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py new file mode 100644 index 000000000000..f0acb393ac92 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._session_host_operations import build_retry_provisioning_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` 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_async + async def retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_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_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.retry_provisioning.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + retry_provisioning.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py index 7609aaaadd1d..29fececc69af 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py @@ -6,24 +6,55 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ActiveDirectoryInfoPatchProperties +from ._models_py3 import ActiveDirectoryInfoProperties +from ._models_py3 import ActiveSessionHostConfiguration +from ._models_py3 import ActiveSessionHostConfigurationList from ._models_py3 import AgentUpdatePatchProperties from ._models_py3 import AgentUpdateProperties +from ._models_py3 import AppAttachPackage +from ._models_py3 import AppAttachPackageInfoProperties +from ._models_py3 import AppAttachPackageList +from ._models_py3 import AppAttachPackagePatch +from ._models_py3 import AppAttachPackagePatchProperties +from ._models_py3 import AppAttachPackageProperties from ._models_py3 import Application from ._models_py3 import ApplicationGroup from ._models_py3 import ApplicationGroupList from ._models_py3 import ApplicationGroupPatch from ._models_py3 import ApplicationList from ._models_py3 import ApplicationPatch +from ._models_py3 import AzureActiveDirectoryInfoProperties +from ._models_py3 import BootDiagnosticsInfoPatchProperties +from ._models_py3 import BootDiagnosticsInfoProperties from ._models_py3 import CloudErrorProperties +from ._models_py3 import CustomInfoPatchProperties +from ._models_py3 import CustomInfoProperties from ._models_py3 import Desktop from ._models_py3 import DesktopList from ._models_py3 import DesktopPatch +from ._models_py3 import DiskInfoPatchProperties +from ._models_py3 import DiskInfoProperties +from ._models_py3 import DomainInfoPatchProperties +from ._models_py3 import DomainInfoProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import ExpandMsixImage from ._models_py3 import ExpandMsixImageList from ._models_py3 import HostPool +from ._models_py3 import HostPoolControlParameter from ._models_py3 import HostPoolList from ._models_py3 import HostPoolPatch +from ._models_py3 import HostPoolUpdateConfigurationPatchProperties +from ._models_py3 import HostPoolUpdateConfigurationProperties +from ._models_py3 import HostPoolUpdateFault from ._models_py3 import Identity +from ._models_py3 import ImageInfoPatchProperties +from ._models_py3 import ImageInfoProperties +from ._models_py3 import ImportPackageInfoRequest +from ._models_py3 import KeyVaultCredentialsPatchProperties +from ._models_py3 import KeyVaultCredentialsProperties from ._models_py3 import LogSpecification from ._models_py3 import MSIXImageURI from ._models_py3 import MSIXPackage @@ -31,8 +62,12 @@ from ._models_py3 import MSIXPackagePatch from ._models_py3 import MaintenanceWindowPatchProperties from ._models_py3 import MaintenanceWindowProperties +from ._models_py3 import MarketplaceInfoPatchProperties +from ._models_py3 import MarketplaceInfoProperties from ._models_py3 import MsixPackageApplications from ._models_py3 import MsixPackageDependencies +from ._models_py3 import NetworkInfoPatchProperties +from ._models_py3 import NetworkInfoProperties from ._models_py3 import OperationProperties from ._models_py3 import Plan from ._models_py3 import PrivateEndpoint @@ -64,40 +99,71 @@ from ._models_py3 import ScalingPlanPooledScheduleList from ._models_py3 import ScalingPlanPooledSchedulePatch from ._models_py3 import ScalingSchedule +from ._models_py3 import SecurityInfoPatchProperties +from ._models_py3 import SecurityInfoProperties from ._models_py3 import SendMessage from ._models_py3 import ServiceSpecification from ._models_py3 import SessionHost +from ._models_py3 import SessionHostConfiguration +from ._models_py3 import SessionHostConfigurationList +from ._models_py3 import SessionHostConfigurationOperationStatus +from ._models_py3 import SessionHostConfigurationOperationStatusList +from ._models_py3 import SessionHostConfigurationPatch from ._models_py3 import SessionHostHealthCheckFailureDetails from ._models_py3 import SessionHostHealthCheckReport from ._models_py3 import SessionHostList +from ._models_py3 import SessionHostManagement +from ._models_py3 import SessionHostManagementList +from ._models_py3 import SessionHostManagementOperationProgress +from ._models_py3 import SessionHostManagementOperationStatus +from ._models_py3 import SessionHostManagementOperationStatusList +from ._models_py3 import SessionHostManagementPatch +from ._models_py3 import SessionHostManagementProgressError from ._models_py3 import SessionHostPatch from ._models_py3 import Sku from ._models_py3 import StartMenuItem from ._models_py3 import StartMenuItemList from ._models_py3 import SystemData from ._models_py3 import Time +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateSessionHostsRequestBody from ._models_py3 import UserSession from ._models_py3 import UserSessionList from ._models_py3 import Workspace from ._models_py3 import WorkspaceList from ._models_py3 import WorkspacePatch +from ._desktop_virtualization_mgmt_client_enums import AppAttachPackageArchitectures from ._desktop_virtualization_mgmt_client_enums import ApplicationGroupType from ._desktop_virtualization_mgmt_client_enums import ApplicationType from ._desktop_virtualization_mgmt_client_enums import CommandLineSetting from ._desktop_virtualization_mgmt_client_enums import CreatedByType from ._desktop_virtualization_mgmt_client_enums import DayOfWeek +from ._desktop_virtualization_mgmt_client_enums import DirectUDP +from ._desktop_virtualization_mgmt_client_enums import DomainJoinType +from ._desktop_virtualization_mgmt_client_enums import FailHealthCheckOnStagingFailure +from ._desktop_virtualization_mgmt_client_enums import FaultType from ._desktop_virtualization_mgmt_client_enums import HealthCheckName from ._desktop_virtualization_mgmt_client_enums import HealthCheckResult from ._desktop_virtualization_mgmt_client_enums import HostPoolType +from ._desktop_virtualization_mgmt_client_enums import HostPoolUpdateAction from ._desktop_virtualization_mgmt_client_enums import HostpoolPublicNetworkAccess from ._desktop_virtualization_mgmt_client_enums import LoadBalancerType +from ._desktop_virtualization_mgmt_client_enums import ManagedPrivateUDP +from ._desktop_virtualization_mgmt_client_enums import ManagementType +from ._desktop_virtualization_mgmt_client_enums import OperationActionSHM +from ._desktop_virtualization_mgmt_client_enums import OperationTypeSHM +from ._desktop_virtualization_mgmt_client_enums import PackageTimestamped from ._desktop_virtualization_mgmt_client_enums import PersonalDesktopAssignmentType from ._desktop_virtualization_mgmt_client_enums import PreferredAppGroupType from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointConnectionProvisioningState from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointServiceConnectionStatus +from ._desktop_virtualization_mgmt_client_enums import ProvisioningState +from ._desktop_virtualization_mgmt_client_enums import ProvisioningStateSHC from ._desktop_virtualization_mgmt_client_enums import PublicNetworkAccess +from ._desktop_virtualization_mgmt_client_enums import PublicUDP from ._desktop_virtualization_mgmt_client_enums import RegistrationTokenOperation +from ._desktop_virtualization_mgmt_client_enums import RelayUDP from ._desktop_virtualization_mgmt_client_enums import RemoteApplicationType from ._desktop_virtualization_mgmt_client_enums import SSOSecretType from ._desktop_virtualization_mgmt_client_enums import ScalingHostPoolType @@ -111,30 +177,64 @@ from ._desktop_virtualization_mgmt_client_enums import StartupBehavior from ._desktop_virtualization_mgmt_client_enums import Status from ._desktop_virtualization_mgmt_client_enums import StopHostsWhen +from ._desktop_virtualization_mgmt_client_enums import Type from ._desktop_virtualization_mgmt_client_enums import UpdateState +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineDiskType +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineSecurityType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActiveDirectoryInfoPatchProperties", + "ActiveDirectoryInfoProperties", + "ActiveSessionHostConfiguration", + "ActiveSessionHostConfigurationList", "AgentUpdatePatchProperties", "AgentUpdateProperties", + "AppAttachPackage", + "AppAttachPackageInfoProperties", + "AppAttachPackageList", + "AppAttachPackagePatch", + "AppAttachPackagePatchProperties", + "AppAttachPackageProperties", "Application", "ApplicationGroup", "ApplicationGroupList", "ApplicationGroupPatch", "ApplicationList", "ApplicationPatch", + "AzureActiveDirectoryInfoProperties", + "BootDiagnosticsInfoPatchProperties", + "BootDiagnosticsInfoProperties", "CloudErrorProperties", + "CustomInfoPatchProperties", + "CustomInfoProperties", "Desktop", "DesktopList", "DesktopPatch", + "DiskInfoPatchProperties", + "DiskInfoProperties", + "DomainInfoPatchProperties", + "DomainInfoProperties", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "ExpandMsixImage", "ExpandMsixImageList", "HostPool", + "HostPoolControlParameter", "HostPoolList", "HostPoolPatch", + "HostPoolUpdateConfigurationPatchProperties", + "HostPoolUpdateConfigurationProperties", + "HostPoolUpdateFault", "Identity", + "ImageInfoPatchProperties", + "ImageInfoProperties", + "ImportPackageInfoRequest", + "KeyVaultCredentialsPatchProperties", + "KeyVaultCredentialsProperties", "LogSpecification", "MSIXImageURI", "MSIXPackage", @@ -142,8 +242,12 @@ "MSIXPackagePatch", "MaintenanceWindowPatchProperties", "MaintenanceWindowProperties", + "MarketplaceInfoPatchProperties", + "MarketplaceInfoProperties", "MsixPackageApplications", "MsixPackageDependencies", + "NetworkInfoPatchProperties", + "NetworkInfoProperties", "OperationProperties", "Plan", "PrivateEndpoint", @@ -175,39 +279,70 @@ "ScalingPlanPooledScheduleList", "ScalingPlanPooledSchedulePatch", "ScalingSchedule", + "SecurityInfoPatchProperties", + "SecurityInfoProperties", "SendMessage", "ServiceSpecification", "SessionHost", + "SessionHostConfiguration", + "SessionHostConfigurationList", + "SessionHostConfigurationOperationStatus", + "SessionHostConfigurationOperationStatusList", + "SessionHostConfigurationPatch", "SessionHostHealthCheckFailureDetails", "SessionHostHealthCheckReport", "SessionHostList", + "SessionHostManagement", + "SessionHostManagementList", + "SessionHostManagementOperationProgress", + "SessionHostManagementOperationStatus", + "SessionHostManagementOperationStatusList", + "SessionHostManagementPatch", + "SessionHostManagementProgressError", "SessionHostPatch", "Sku", "StartMenuItem", "StartMenuItemList", "SystemData", "Time", + "TrackedResource", + "UpdateSessionHostsRequestBody", "UserSession", "UserSessionList", "Workspace", "WorkspaceList", "WorkspacePatch", + "AppAttachPackageArchitectures", "ApplicationGroupType", "ApplicationType", "CommandLineSetting", "CreatedByType", "DayOfWeek", + "DirectUDP", + "DomainJoinType", + "FailHealthCheckOnStagingFailure", + "FaultType", "HealthCheckName", "HealthCheckResult", "HostPoolType", + "HostPoolUpdateAction", "HostpoolPublicNetworkAccess", "LoadBalancerType", + "ManagedPrivateUDP", + "ManagementType", + "OperationActionSHM", + "OperationTypeSHM", + "PackageTimestamped", "PersonalDesktopAssignmentType", "PreferredAppGroupType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", + "ProvisioningStateSHC", "PublicNetworkAccess", + "PublicUDP", "RegistrationTokenOperation", + "RelayUDP", "RemoteApplicationType", "SSOSecretType", "ScalingHostPoolType", @@ -221,7 +356,10 @@ "StartupBehavior", "Status", "StopHostsWhen", + "Type", "UpdateState", + "VirtualMachineDiskType", + "VirtualMachineSecurityType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py index 378b4904fcfd..55f7cf20ed53 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py @@ -10,6 +10,18 @@ from azure.core import CaseInsensitiveEnumMeta +class AppAttachPackageArchitectures(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible device architectures that an app attach package can be configured for.""" + + ARM = "ARM" + ARM64 = "ARM64" + X86 = "x86" + X64 = "x64" + NEUTRAL = "Neutral" + X86_A64 = "x86a64" + ALL = "ALL" + + class ApplicationGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of ApplicationGroup.""" @@ -56,6 +68,44 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUNDAY = "Sunday" +class DirectUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class DomainJoinType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of domain join done by the virtual machine.""" + + ACTIVE_DIRECTORY = "ActiveDirectory" + """Using microsoft active directory.""" + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + """Using microsoft azure active directory.""" + + +class FailHealthCheckOnStagingFailure(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Parameter indicating how the health check should behave if this package fails staging.""" + + UNHEALTHY = "Unhealthy" + NEEDS_ASSISTANCE = "NeedsAssistance" + DO_NOT_FAIL = "DoNotFail" + + +class FaultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hostpool update fault type.""" + + SERVICE_ERROR = "ServiceError" + """Fault caused by service error.""" + USER_ERROR = "UserError" + """Fault caused by user error.""" + + class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the name of the health check operation performed.""" @@ -151,6 +201,21 @@ class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: PersonalDesktopAssignmentType must be Direct.""" +class HostPoolUpdateAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action types for controlling hostpool update.""" + + START = "Start" + """Start the hostpool update.""" + PAUSE = "Pause" + """Pause the hostpool update.""" + CANCEL = "Cancel" + """Cancel the hostpool update.""" + RETRY = "Retry" + """Retry the hostpool update.""" + RESUME = "Resume" + """Resume the hostpool update.""" + + class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the load balancer.""" @@ -159,6 +224,51 @@ class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSISTENT = "Persistent" +class ManagedPrivateUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of management for this hostpool, Automated or Standard. The default value is + Automated. + """ + + AUTOMATED = "Automated" + STANDARD = "Standard" + + +class OperationActionSHM(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action type of the current sessionHostManagement operation.""" + + START = "Start" + RETRY = "Retry" + PAUSE = "Pause" + RESUME = "Resume" + CANCEL = "Cancel" + + +class OperationTypeSHM(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OperationTypeSHM.""" + + INITIATE_SESSION_HOST_UPDATE = "InitiateSessionHostUpdate" + VALIDATE_SESSION_HOST_UPDATE = "ValidateSessionHostUpdate" + + +class PackageTimestamped(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Is package timestamped so it can ignore the certificate expiry date.""" + + TIMESTAMPED = "Timestamped" + NOT_TIMESTAMPED = "NotTimestamped" + + class PersonalDesktopAssignmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PersonalDesktopAssignment type for HostPool.""" @@ -191,6 +301,24 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv REJECTED = "Rejected" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + PROVISIONING = "Provisioning" + FAILED = "Failed" + CANCELED = "Canceled" + + +class ProvisioningStateSHC(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Session Host Configuration.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. @@ -200,6 +328,18 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class PublicUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of resetting the token.""" @@ -208,6 +348,18 @@ class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATE = "Update" +class RelayUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RemoteApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of Application.""" @@ -353,6 +505,15 @@ class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of image session hosts use in the hostpool.""" + + MARKETPLACE = "Marketplace" + """Using default marketplace images offered by Azure Marketplace.""" + CUSTOM = "Custom" + """Using a custom image.""" + + class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Update state of a SessionHost.""" @@ -361,3 +522,26 @@ class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): STARTED = "Started" SUCCEEDED = "Succeeded" FAILED = "Failed" + + +class VirtualMachineDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The disk type used by virtual machine in hostpool session host.""" + + STANDARD_LRS = "Standard_LRS" + """Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access.""" + PREMIUM_LRS = "Premium_LRS" + """Premium SSD locally redundant storage. Best for production and performance sensitive workloads.""" + STANDARD_SSD_LRS = "StandardSSD_LRS" + """Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + #: applications and dev/test.""" + + +class VirtualMachineSecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The security type used by virtual machine in hostpool session host. Default is Standard.""" + + STANDARD = "Standard" + """Standard security protocol. No additional parameters""" + TRUSTED_LAUNCH = "TrustedLaunch" + """TrustedLaunch allows for secure boot adn vTPM""" + CONFIDENTIAL_VM = "ConfidentialVM" + """Confidential Virtual Machine security protocol""" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py index f410efbcb55b..45cc00c0cb14 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py @@ -23,6 +23,321 @@ from .. import models as _models +class ActiveDirectoryInfoPatchProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + :ivar domain_credentials: Credentials needed to create the virtual machine. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + } + + def __init__( + self, *, domain_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + + +class ActiveDirectoryInfoProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to Azure. + + :ivar domain_credentials: Credentials needed to create the virtual machine. Required. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar ou_path: The ou path. Required. + :vartype ou_path: str + :ivar domain_name: The domain a virtual machine connected to a hostpool will join. + :vartype domain_name: str + """ + + _validation = { + "domain_credentials": {"required": True}, + "ou_path": {"required": True}, + } + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsProperties"}, + "ou_path": {"key": "ouPath", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + } + + def __init__( + self, + *, + domain_credentials: "_models.KeyVaultCredentialsProperties", + ou_path: str, + domain_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. Required. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword ou_path: The ou path. Required. + :paramtype ou_path: str + :keyword domain_name: The domain a virtual machine connected to a hostpool will join. + :paramtype domain_name: str + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + self.ou_path = ou_path + self.domain_name = domain_name + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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 + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ActiveSessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a ActiveSessionHostConfiguration definition. This has all of the + sessionHostConfiguration properties except provisioningState. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"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"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.version = None + self.friendly_name = friendly_name + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class ActiveSessionHostConfigurationList(_serialization.Model): + """List of ActiveSessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ActiveSessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ActiveSessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ActiveSessionHostConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of ActiveSessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + class AgentUpdatePatchProperties(_serialization.Model): """The session host configuration for updating agent, monitoring agent, and stack component. @@ -127,14 +442,298 @@ def __init__( list[~azure.mgmt.desktopvirtualization.models.MaintenanceWindowProperties] """ super().__init__(**kwargs) - self.type = type - self.use_session_host_local_time = use_session_host_local_time - self.maintenance_window_time_zone = maintenance_window_time_zone - self.maintenance_windows = maintenance_windows + self.type = type + self.use_session_host_local_time = use_session_host_local_time + self.maintenance_window_time_zone = maintenance_window_time_zone + self.maintenance_windows = maintenance_windows + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AppAttachPackage(TrackedResource): + """Schema for App Attach Package 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 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar properties: Detailed properties for App Attach Package. Required. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": 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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AppAttachPackageProperties"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.AppAttachPackageProperties", + tags: Optional[Dict[str, str]] = 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 properties: Detailed properties for App Attach Package. Required. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.properties = properties + + +class AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Schema for Import Package Information properties. + + :ivar package_alias: Alias of App Attach Package. Assigned at import time. + :vartype package_alias: str + :ivar image_path: VHD/CIM image path on Network Share. + :vartype image_path: str + :ivar package_name: Package Name from appxmanifest.xml. + :vartype package_name: str + :ivar package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name and + Publisher name. + :vartype package_family_name: str + :ivar package_full_name: Package Full Name from appxmanifest.xml. + :vartype package_full_name: str + :ivar display_name: User friendly Name to be displayed in the portal. + :vartype display_name: str + :ivar package_relative_path: Relative Path to the package inside the image. + :vartype package_relative_path: str + :ivar is_regular_registration: Specifies how to register Package in feed. + :vartype is_regular_registration: bool + :ivar is_active: Make this version of the package the active one across the hostpool. + :vartype is_active: bool + :ivar package_dependencies: List of package dependencies. + :vartype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :ivar version: Package Version found in the appxmanifest.xml. + :vartype version: str + :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. + :vartype last_updated: ~datetime.datetime + :ivar package_applications: List of package applications. + :vartype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime + :ivar is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :vartype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + + _attribute_map = { + "package_alias": {"key": "packageAlias", "type": "str"}, + "image_path": {"key": "imagePath", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "package_family_name": {"key": "packageFamilyName", "type": "str"}, + "package_full_name": {"key": "packageFullName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "package_relative_path": {"key": "packageRelativePath", "type": "str"}, + "is_regular_registration": {"key": "isRegularRegistration", "type": "bool"}, + "is_active": {"key": "isActive", "type": "bool"}, + "package_dependencies": {"key": "packageDependencies", "type": "[MsixPackageDependencies]"}, + "version": {"key": "version", "type": "str"}, + "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, + "package_applications": {"key": "packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "certificateName", "type": "str"}, + "certificate_expiry": {"key": "certificateExpiry", "type": "iso-8601"}, + "is_package_timestamped": {"key": "isPackageTimestamped", "type": "str"}, + } + + def __init__( + self, + *, + package_alias: Optional[str] = None, + image_path: Optional[str] = None, + package_name: Optional[str] = None, + package_family_name: Optional[str] = None, + package_full_name: Optional[str] = None, + display_name: Optional[str] = None, + package_relative_path: Optional[str] = None, + is_regular_registration: Optional[bool] = None, + is_active: Optional[bool] = None, + package_dependencies: Optional[List["_models.MsixPackageDependencies"]] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, + is_package_timestamped: Optional[Union[str, "_models.PackageTimestamped"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword package_alias: Alias of App Attach Package. Assigned at import time. + :paramtype package_alias: str + :keyword image_path: VHD/CIM image path on Network Share. + :paramtype image_path: str + :keyword package_name: Package Name from appxmanifest.xml. + :paramtype package_name: str + :keyword package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :paramtype package_family_name: str + :keyword package_full_name: Package Full Name from appxmanifest.xml. + :paramtype package_full_name: str + :keyword display_name: User friendly Name to be displayed in the portal. + :paramtype display_name: str + :keyword package_relative_path: Relative Path to the package inside the image. + :paramtype package_relative_path: str + :keyword is_regular_registration: Specifies how to register Package in feed. + :paramtype is_regular_registration: bool + :keyword is_active: Make this version of the package the active one across the hostpool. + :paramtype is_active: bool + :keyword package_dependencies: List of package dependencies. + :paramtype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :keyword version: Package Version found in the appxmanifest.xml. + :paramtype version: str + :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. + :paramtype last_updated: ~datetime.datetime + :keyword package_applications: List of package applications. + :paramtype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime + :keyword is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :paramtype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + super().__init__(**kwargs) + self.package_alias = package_alias + self.image_path = image_path + self.package_name = package_name + self.package_family_name = package_family_name + self.package_full_name = package_full_name + self.display_name = display_name + self.package_relative_path = package_relative_path + self.is_regular_registration = is_regular_registration + self.is_active = is_active + self.package_dependencies = package_dependencies + self.version = version + self.last_updated = last_updated + self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry + self.is_package_timestamped = is_package_timestamped + + +class AppAttachPackageList(_serialization.Model): + """List of App Attach Package definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of App Attach Package definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppAttachPackage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AppAttachPackage"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of App Attach Package definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class AppAttachPackagePatch(Resource): + """Schema for patchable App Attach Package properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -146,6 +745,10 @@ class Resource(_serialization.Model): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar tags: tags to be updated. + :vartype tags: dict[str, str] + :ivar properties: Detailed properties for App Attach Package. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties """ _validation = { @@ -158,14 +761,141 @@ class Resource(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "AppAttachPackagePatchProperties"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AppAttachPackagePatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: Detailed properties for App Attach Package. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.tags = tags + self.properties = properties + + +class AppAttachPackagePatchProperties(_serialization.Model): + """Schema for patchable fields on an App Attach Package. + + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL of keyvault location to store certificate. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + + _attribute_map = { + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + } + + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL of keyvault location to store certificate. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + super().__init__(**kwargs) + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + + +class AppAttachPackageProperties(_serialization.Model): + """Schema for App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the App Attach Package. Known values are: + "Succeeded", "Provisioning", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.desktopvirtualization.models.ProvisioningState + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL of keyvault location to store certificate. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + } + + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL of keyvault location to store certificate. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure class Application(Resource): # pylint: disable=too-many-instance-attributes @@ -848,6 +1578,98 @@ def __init__( self.application_type = application_type +class AzureActiveDirectoryInfoProperties(_serialization.Model): + """Azure Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to Azure. + + :ivar mdm_provider_guid: The mdm guid. Required. + :vartype mdm_provider_guid: str + """ + + _validation = { + "mdm_provider_guid": {"required": True}, + } + + _attribute_map = { + "mdm_provider_guid": {"key": "mdmProviderGuid", "type": "str"}, + } + + def __init__(self, *, mdm_provider_guid: str, **kwargs: Any) -> None: + """ + :keyword mdm_provider_guid: The mdm guid. Required. + :paramtype mdm_provider_guid: str + """ + super().__init__(**kwargs) + self.mdm_provider_guid = mdm_provider_guid + + +class BootDiagnosticsInfoPatchProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + +class BootDiagnosticsInfoProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + class CloudErrorProperties(_serialization.Model): """Cloud error object properties. @@ -874,6 +1696,52 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message +class CustomInfoPatchProperties(_serialization.Model): + """Custom image information. + + :ivar resource_id: The resource id of the custom image. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class CustomInfoProperties(_serialization.Model): + """Custom image information. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: The resource id of the custom image. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + class Desktop(Resource): """Schema for Desktop properties. @@ -997,17 +1865,243 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] - :keyword description: Description of Desktop. - :paramtype description: str - :keyword friendly_name: Friendly name of Desktop. - :paramtype friendly_name: str + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of Desktop. + :paramtype description: str + :keyword friendly_name: Friendly name of Desktop. + :paramtype friendly_name: str + """ + super().__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + + +class DiskInfoPatchProperties(_serialization.Model): + """Disk information. + + :ivar type: The disk type used by virtual machine in hostpool session host. Known values are: + "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.VirtualMachineDiskType"]] = None, **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Known values + are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DiskInfoProperties(_serialization.Model): + """Disk information. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.VirtualMachineDiskType"], **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DomainInfoPatchProperties(_serialization.Model): + """Domain configurations of session hosts. + + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + + _attribute_map = { + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoPatchProperties"}, + } + + def __init__( + self, *, active_directory_info: Optional["_models.ActiveDirectoryInfoPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + super().__init__(**kwargs) + self.active_directory_info = active_directory_info + + +class DomainInfoProperties(_serialization.Model): + """Domain configurations of session hosts. + + All required parameters must be populated in order to send to Azure. + + :ivar join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :vartype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :ivar azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :vartype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + + _validation = { + "join_type": {"required": True}, + } + + _attribute_map = { + "join_type": {"key": "joinType", "type": "str"}, + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoProperties"}, + "azure_active_directory_info": { + "key": "azureActiveDirectoryInfo", + "type": "AzureActiveDirectoryInfoProperties", + }, + } + + def __init__( + self, + *, + join_type: Union[str, "_models.DomainJoinType"], + active_directory_info: Optional["_models.ActiveDirectoryInfoProperties"] = None, + azure_active_directory_info: Optional["_models.AzureActiveDirectoryInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :paramtype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :keyword azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :paramtype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + super().__init__(**kwargs) + self.join_type = join_type + self.active_directory_info = active_directory_info + self.azure_active_directory_info = azure_active_directory_info + + +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.desktopvirtualization.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.desktopvirtualization.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.desktopvirtualization.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.desktopvirtualization.models.ErrorDetail """ super().__init__(**kwargs) - self.tags = tags - self.description = description - self.friendly_name = friendly_name + self.error = error class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes @@ -1052,6 +2146,10 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :ivar package_applications: List of package applications. :vartype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime """ _validation = { @@ -1077,6 +2175,8 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes "version": {"key": "properties.version", "type": "str"}, "last_updated": {"key": "properties.lastUpdated", "type": "iso-8601"}, "package_applications": {"key": "properties.packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "properties.certificateName", "type": "str"}, + "certificate_expiry": {"key": "properties.certificateExpiry", "type": "iso-8601"}, } def __init__( @@ -1095,6 +2195,8 @@ def __init__( version: Optional[str] = None, last_updated: Optional[datetime.datetime] = None, package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ @@ -1127,6 +2229,10 @@ def __init__( :keyword package_applications: List of package applications. :paramtype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime """ super().__init__(**kwargs) self.package_alias = package_alias @@ -1142,6 +2248,8 @@ def __init__( self.version = version self.last_updated = last_updated self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry class ExpandMsixImageList(_serialization.Model): @@ -1245,8 +2353,13 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :ivar vm_template: VM template for sessionhosts configuration within hostpool. :vartype vm_template: str + :ivar management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :vartype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :ivar application_group_references: List of applicationGroup links. :vartype application_group_references: list[str] + :ivar app_attach_package_references: List of App Attach Package links. + :vartype app_attach_package_references: list[str] :ivar ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. :vartype ssoadfs_authority: str :ivar sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO @@ -1280,6 +2393,30 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many specified resource. :vartype private_endpoint_connections: list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection] + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _validation = { @@ -1293,6 +2430,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "host_pool_type": {"required": True}, "load_balancer_type": {"required": True}, "application_group_references": {"readonly": True}, + "app_attach_package_references": {"readonly": True}, "preferred_app_group_type": {"required": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -1323,7 +2461,9 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "validation_environment": {"key": "properties.validationEnvironment", "type": "bool"}, "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfo"}, "vm_template": {"key": "properties.vmTemplate", "type": "str"}, + "management_type": {"key": "properties.managementType", "type": "str"}, "application_group_references": {"key": "properties.applicationGroupReferences", "type": "[str]"}, + "app_attach_package_references": {"key": "properties.appAttachPackageReferences", "type": "[str]"}, "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, "sso_client_id": {"key": "properties.ssoClientId", "type": "str"}, "sso_client_secret_key_vault_path": {"key": "properties.ssoClientSecretKeyVaultPath", "type": "str"}, @@ -1337,6 +2477,10 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1361,6 +2505,7 @@ def __init__( # pylint: disable=too-many-locals validation_environment: Optional[bool] = None, registration_info: Optional["_models.RegistrationInfo"] = None, vm_template: Optional[str] = None, + management_type: Optional[Union[str, "_models.ManagementType"]] = None, ssoadfs_authority: Optional[str] = None, sso_client_id: Optional[str] = None, sso_client_secret_key_vault_path: Optional[str] = None, @@ -1368,6 +2513,10 @@ def __init__( # pylint: disable=too-many-locals start_vm_on_connect: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, agent_update: Optional["_models.AgentUpdateProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, **kwargs: Any ) -> None: """ @@ -1418,6 +2567,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :keyword vm_template: VM template for sessionhosts configuration within hostpool. :paramtype vm_template: str + :keyword management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :paramtype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. :paramtype ssoadfs_authority: str :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO @@ -1445,6 +2597,31 @@ def __init__( # pylint: disable=too-many-locals :keyword agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ super().__init__( location=location, @@ -1469,7 +2646,9 @@ def __init__( # pylint: disable=too-many-locals self.validation_environment = validation_environment self.registration_info = registration_info self.vm_template = vm_template + self.management_type = management_type self.application_group_references = None + self.app_attach_package_references = None self.ssoadfs_authority = ssoadfs_authority self.sso_client_id = sso_client_id self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path @@ -1480,6 +2659,49 @@ def __init__( # pylint: disable=too-many-locals self.public_network_access = public_network_access self.agent_update = agent_update self.private_endpoint_connections = None + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp + + +class HostPoolControlParameter(_serialization.Model): + """Represents properties for a hostpool update. + + All required parameters must be populated in order to send to Azure. + + :ivar action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :vartype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :ivar cancel_message: The cancel message sent to the user on the session host. This is can only + be specified if the action is 'Cancel'. + :vartype cancel_message: str + """ + + _validation = { + "action": {"required": True}, + "cancel_message": {"max_length": 260}, + } + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + "cancel_message": {"key": "cancelMessage", "type": "str"}, + } + + def __init__( + self, *, action: Union[str, "_models.HostPoolUpdateAction"], cancel_message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :paramtype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :keyword cancel_message: The cancel message sent to the user on the session host. This is can + only be specified if the action is 'Cancel'. + :paramtype cancel_message: str + """ + super().__init__(**kwargs) + self.action = action + self.cancel_message = cancel_message class HostPoolList(_serialization.Model): @@ -1575,6 +2797,30 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :ivar agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :vartype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _validation = { @@ -1606,9 +2852,13 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes "start_vm_on_connect": {"key": "properties.startVMOnConnect", "type": "bool"}, "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "agent_update": {"key": "properties.agentUpdate", "type": "AgentUpdatePatchProperties"}, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, tags: Optional[Dict[str, str]] = None, @@ -1630,6 +2880,10 @@ def __init__( start_vm_on_connect: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, agent_update: Optional["_models.AgentUpdatePatchProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, **kwargs: Any ) -> None: """ @@ -1683,6 +2937,31 @@ def __init__( :keyword agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ super().__init__(**kwargs) self.tags = tags @@ -1704,6 +2983,168 @@ def __init__( self.start_vm_on_connect = start_vm_on_connect self.public_network_access = public_network_access self.agent_update = agent_update + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp + + +class HostPoolUpdateConfigurationPatchProperties(_serialization.Model): + """The configurations of a hostpool update. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. + :vartype log_off_message: str + """ + + _validation = { + "max_vms_removed": {"minimum": 1}, + "log_off_message": {"max_length": 260}, + } + + _attribute_map = { + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, + } + + def __init__( + self, + *, + delete_original_vm: Optional[bool] = None, + max_vms_removed: Optional[int] = None, + log_off_delay_minutes: Optional[int] = None, + log_off_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. + :paramtype log_off_message: str + """ + super().__init__(**kwargs) + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message + + +class HostPoolUpdateConfigurationProperties(_serialization.Model): + """The configurations of a hostpool update. + + All required parameters must be populated in order to send to Azure. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :vartype log_off_message: str + """ + + _validation = { + "max_vms_removed": {"required": True, "minimum": 1}, + "log_off_delay_minutes": {"required": True}, + "log_off_message": {"max_length": 260}, + } + + _attribute_map = { + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, + } + + def __init__( + self, + *, + max_vms_removed: int, + log_off_delay_minutes: int, + delete_original_vm: Optional[bool] = None, + log_off_message: str = "", + **kwargs: Any + ) -> None: + """ + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :paramtype log_off_message: str + """ + super().__init__(**kwargs) + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message + + +class HostPoolUpdateFault(_serialization.Model): + """Hostpool update fault information. + + :ivar fault_type: Hostpool update fault type. Known values are: "ServiceError" and "UserError". + :vartype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :ivar fault_code: Hostpool update fault code. + :vartype fault_code: str + :ivar fault_text: Hostpool update fault text. + :vartype fault_text: str + :ivar fault_context: Hostpool update fault context. + :vartype fault_context: str + """ + + _attribute_map = { + "fault_type": {"key": "faultType", "type": "str"}, + "fault_code": {"key": "faultCode", "type": "str"}, + "fault_text": {"key": "faultText", "type": "str"}, + "fault_context": {"key": "faultContext", "type": "str"}, + } + + def __init__( + self, + *, + fault_type: Optional[Union[str, "_models.FaultType"]] = None, + fault_code: Optional[str] = None, + fault_text: Optional[str] = None, + fault_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword fault_type: Hostpool update fault type. Known values are: "ServiceError" and + "UserError". + :paramtype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :keyword fault_code: Hostpool update fault code. + :paramtype fault_code: str + :keyword fault_text: Hostpool update fault text. + :paramtype fault_text: str + :keyword fault_context: Hostpool update fault context. + :paramtype fault_context: str + """ + super().__init__(**kwargs) + self.fault_type = fault_type + self.fault_code = fault_code + self.fault_text = fault_text + self.fault_context = fault_context class Identity(_serialization.Model): @@ -1741,6 +3182,215 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs self.type = type +class ImageInfoPatchProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + :ivar type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoPatchProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoPatchProperties"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.Type"]] = None, + marketplace_info: Optional["_models.MarketplaceInfoPatchProperties"] = None, + custom_info: Optional["_models.CustomInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + super().__init__(**kwargs) + self.type = type + self.marketplace_info = marketplace_info + self.custom_info = custom_info + + +class ImageInfoProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + All required parameters must be populated in order to send to Azure. + + :ivar type: The type of image session hosts use in the hostpool. Required. Known values are: + "Marketplace" and "Custom". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoProperties"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.Type"], + marketplace_info: Optional["_models.MarketplaceInfoProperties"] = None, + custom_info: Optional["_models.CustomInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of image session hosts use in the hostpool. Required. Known values are: + "Marketplace" and "Custom". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + super().__init__(**kwargs) + self.type = type + self.marketplace_info = marketplace_info + self.custom_info = custom_info + + +class ImportPackageInfoRequest(_serialization.Model): + """Information to import app attach package. + + :ivar path: URI to Image. + :vartype path: str + :ivar package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :vartype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "package_architecture": {"key": "packageArchitecture", "type": "str"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + package_architecture: Optional[Union[str, "_models.AppAttachPackageArchitectures"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: URI to Image. + :paramtype path: str + :keyword package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :paramtype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + super().__init__(**kwargs) + self.path = path + self.package_architecture = package_architecture + + +class KeyVaultCredentialsPatchProperties(_serialization.Model): + """Credentials kept in the keyvault. + + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. + :vartype password_key_vault_secret_uri: str + """ + + _attribute_map = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, + *, + username_key_vault_secret_uri: Optional[str] = None, + password_key_vault_secret_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. + :paramtype password_key_vault_secret_uri: str + """ + super().__init__(**kwargs) + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri + + +class KeyVaultCredentialsProperties(_serialization.Model): + """Credentials kept in the keyvault. + + All required parameters must be populated in order to send to Azure. + + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. Required. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. Required. + :vartype password_key_vault_secret_uri: str + """ + + _validation = { + "username_key_vault_secret_uri": {"required": True}, + "password_key_vault_secret_uri": {"required": True}, + } + + _attribute_map = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, *, username_key_vault_secret_uri: str, password_key_vault_secret_uri: str, **kwargs: Any + ) -> None: + """ + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. Required. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. Required. + :paramtype password_key_vault_secret_uri: str + """ + super().__init__(**kwargs) + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri + + class LogSpecification(_serialization.Model): """Specifications of the Log for Azure Monitoring. @@ -1848,6 +3498,99 @@ def __init__( self.day_of_week = day_of_week +class MarketplaceInfoPatchProperties(_serialization.Model): + """Marketplace image information. + + :ivar offer: The offer of the image. + :vartype offer: str + :ivar publisher: The publisher of the image. + :vartype publisher: str + :ivar sku: The sku of the image. + :vartype sku: str + :ivar exact_version: The exact version of the image. + :vartype exact_version: str + """ + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__( + self, + *, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + exact_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword offer: The offer of the image. + :paramtype offer: str + :keyword publisher: The publisher of the image. + :paramtype publisher: str + :keyword sku: The sku of the image. + :paramtype sku: str + :keyword exact_version: The exact version of the image. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + +class MarketplaceInfoProperties(_serialization.Model): + """Marketplace image information. + + All required parameters must be populated in order to send to Azure. + + :ivar offer: The offer of the image. Required. + :vartype offer: str + :ivar publisher: The publisher of the image. Required. + :vartype publisher: str + :ivar sku: The sku of the image. Required. + :vartype sku: str + :ivar exact_version: The exact version of the image. Required. + :vartype exact_version: str + """ + + _validation = { + "offer": {"required": True}, + "publisher": {"required": True}, + "sku": {"required": True}, + "exact_version": {"required": True}, + } + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__(self, *, offer: str, publisher: str, sku: str, exact_version: str, **kwargs: Any) -> None: + """ + :keyword offer: The offer of the image. Required. + :paramtype offer: str + :keyword publisher: The publisher of the image. Required. + :paramtype publisher: str + :keyword sku: The sku of the image. Required. + :paramtype sku: str + :keyword exact_version: The exact version of the image. Required. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + class MSIXImageURI(_serialization.Model): """Represents URI referring to MSIX Image. @@ -2176,17 +3919,81 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword is_active: Set a version of the package to be active across hostpool. - :paramtype is_active: bool - :keyword is_regular_registration: Set Registration mode. Regular or Delayed. - :paramtype is_regular_registration: bool - :keyword display_name: Display name for MSIX Package. - :paramtype display_name: str + :keyword is_active: Set a version of the package to be active across hostpool. + :paramtype is_active: bool + :keyword is_regular_registration: Set Registration mode. Regular or Delayed. + :paramtype is_regular_registration: bool + :keyword display_name: Display name for MSIX Package. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.is_active = is_active + self.is_regular_registration = is_regular_registration + self.display_name = display_name + + +class NetworkInfoPatchProperties(_serialization.Model): + """Network information. + + :ivar subnet_id: The resource ID of the subnet. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the NSG. + :vartype security_group_id: str + """ + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__( + self, *, subnet_id: Optional[str] = None, security_group_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword subnet_id: The resource ID of the subnet. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the NSG. + :paramtype security_group_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.security_group_id = security_group_id + + +class NetworkInfoProperties(_serialization.Model): + """Network information. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: The resource ID of the subnet. Required. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the NSG. + :vartype security_group_id: str + """ + + _validation = { + "subnet_id": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__(self, *, subnet_id: str, security_group_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword subnet_id: The resource ID of the subnet. Required. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the NSG. + :paramtype security_group_id: str """ super().__init__(**kwargs) - self.is_active = is_active - self.is_regular_registration = is_regular_registration - self.display_name = display_name + self.subnet_id = subnet_id + self.security_group_id = security_group_id class OperationProperties(_serialization.Model): @@ -4556,6 +6363,88 @@ def __init__( self.off_peak_load_balancing_algorithm = off_peak_load_balancing_algorithm +class SecurityInfoPatchProperties(_serialization.Model): + """Security information. + + :ivar type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool + """ + super().__init__(**kwargs) + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + +class SecurityInfoProperties(_serialization.Model): + """Security information. + + :ivar type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool + """ + super().__init__(**kwargs) + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + class SendMessage(_serialization.Model): """Represents message sent to a UserSession. @@ -4655,6 +6544,11 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes :vartype last_update_time: ~datetime.datetime :ivar update_error_message: The error message. :vartype update_error_message: str + :ivar last_session_host_update_time: The last time update was completed. + :vartype last_session_host_update_time: ~datetime.datetime + :ivar session_host_configuration: SessionHostConfiguration version reference at the time the + update is initiated, in the format of date time. + :vartype session_host_configuration: str :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. :vartype session_host_health_check_results: list[~azure.mgmt.desktopvirtualization.models.SessionHostHealthCheckReport] @@ -4670,6 +6564,8 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "resource_id": {"readonly": True}, "status_timestamp": {"readonly": True}, "last_update_time": {"readonly": True}, + "last_session_host_update_time": {"readonly": True}, + "session_host_configuration": {"readonly": True}, "session_host_health_check_results": {"readonly": True}, } @@ -4687,82 +6583,559 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "resource_id": {"key": "properties.resourceId", "type": "str"}, "assigned_user": {"key": "properties.assignedUser", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "status_timestamp": {"key": "properties.statusTimestamp", "type": "iso-8601"}, - "os_version": {"key": "properties.osVersion", "type": "str"}, - "sx_s_stack_version": {"key": "properties.sxSStackVersion", "type": "str"}, - "update_state": {"key": "properties.updateState", "type": "str"}, - "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, - "update_error_message": {"key": "properties.updateErrorMessage", "type": "str"}, - "session_host_health_check_results": { - "key": "properties.sessionHostHealthCheckResults", - "type": "[SessionHostHealthCheckReport]", + "status": {"key": "properties.status", "type": "str"}, + "status_timestamp": {"key": "properties.statusTimestamp", "type": "iso-8601"}, + "os_version": {"key": "properties.osVersion", "type": "str"}, + "sx_s_stack_version": {"key": "properties.sxSStackVersion", "type": "str"}, + "update_state": {"key": "properties.updateState", "type": "str"}, + "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, + "update_error_message": {"key": "properties.updateErrorMessage", "type": "str"}, + "last_session_host_update_time": {"key": "properties.lastSessionHostUpdateTime", "type": "iso-8601"}, + "session_host_configuration": {"key": "properties.sessionHostConfiguration", "type": "str"}, + "session_host_health_check_results": { + "key": "properties.sessionHostHealthCheckResults", + "type": "[SessionHostHealthCheckReport]", + }, + } + + def __init__( + self, + *, + last_heart_beat: Optional[datetime.datetime] = None, + sessions: Optional[int] = None, + agent_version: Optional[str] = None, + allow_new_session: Optional[bool] = None, + assigned_user: Optional[str] = None, + friendly_name: Optional[str] = None, + status: Optional[Union[str, "_models.Status"]] = None, + os_version: Optional[str] = None, + sx_s_stack_version: Optional[str] = None, + update_state: Optional[Union[str, "_models.UpdateState"]] = None, + update_error_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_heart_beat: Last heart beat from SessionHost. + :paramtype last_heart_beat: ~datetime.datetime + :keyword sessions: Number of sessions on SessionHost. + :paramtype sessions: int + :keyword agent_version: Version of agent on SessionHost. + :paramtype agent_version: str + :keyword allow_new_session: Allow a new session. + :paramtype allow_new_session: bool + :keyword assigned_user: User assigned to SessionHost. + :paramtype assigned_user: str + :keyword friendly_name: Friendly name of SessionHost. + :paramtype friendly_name: str + :keyword status: Status for a SessionHost. Known values are: "Available", "Unavailable", + "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", + "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", and + "NeedsAssistance". + :paramtype status: str or ~azure.mgmt.desktopvirtualization.models.Status + :keyword os_version: The version of the OS on the session host. + :paramtype os_version: str + :keyword sx_s_stack_version: The version of the side by side stack on the session host. + :paramtype sx_s_stack_version: str + :keyword update_state: Update state of a SessionHost. Known values are: "Initial", "Pending", + "Started", "Succeeded", and "Failed". + :paramtype update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState + :keyword update_error_message: The error message. + :paramtype update_error_message: str + """ + super().__init__(**kwargs) + self.system_data = None + self.object_id = None + self.last_heart_beat = last_heart_beat + self.sessions = sessions + self.agent_version = agent_version + self.allow_new_session = allow_new_session + self.virtual_machine_id = None + self.resource_id = None + self.assigned_user = assigned_user + self.friendly_name = friendly_name + self.status = status + self.status_timestamp = None + self.os_version = os_version + self.sx_s_stack_version = sx_s_stack_version + self.update_state = update_state + self.last_update_time = None + self.update_error_message = update_error_message + self.last_session_host_update_time = None + self.session_host_configuration = None + self.session_host_health_check_results = None + + +class SessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfiguration definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: 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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar provisioning_state: Provisioning state of the Session Host Configuration. Known values + are: "Succeeded", "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.ProvisioningStateSHC + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "provisioning_state": {"readonly": True}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"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"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.version = None + self.friendly_name = friendly_name + self.provisioning_state = None + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class SessionHostConfigurationList(_serialization.Model): + """List of SessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostConfigurationOperationStatus(_serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Current defined values are . Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[SessionHostConfigurationOperationStatus]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.SessionHostConfigurationOperationStatus"]] = None, + error: Optional["_models.ErrorDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Current defined values are . Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class SessionHostConfigurationOperationStatusList(_serialization.Model): + """List of OperationStatus definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of OperationStatus definitions. + :vartype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostConfigurationOperationStatus]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SessionHostConfigurationOperationStatus"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of OperationStatus definitions. + :paramtype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostConfigurationPatch(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfigurationPatch definition. + + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. + :vartype vm_size_id: str + :ivar disk_info: Disk information. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :ivar domain_info: Domain configurations of session hosts. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties + """ + + _validation = { + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"max_length": 11}, + "custom_configuration_script_url": {"max_length": 260}, + } + + _attribute_map = { + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoPatchProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoPatchProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoPatchProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoPatchProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + "boot_diagnostics_info": { + "key": "properties.bootDiagnosticsInfo", + "type": "BootDiagnosticsInfoPatchProperties", }, } def __init__( self, *, - last_heart_beat: Optional[datetime.datetime] = None, - sessions: Optional[int] = None, - agent_version: Optional[str] = None, - allow_new_session: Optional[bool] = None, - assigned_user: Optional[str] = None, friendly_name: Optional[str] = None, - status: Optional[Union[str, "_models.Status"]] = None, - os_version: Optional[str] = None, - sx_s_stack_version: Optional[str] = None, - update_state: Optional[Union[str, "_models.UpdateState"]] = None, - update_error_message: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + vm_name_prefix: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + network_info: Optional["_models.NetworkInfoProperties"] = None, + vm_size_id: Optional[str] = None, + disk_info: Optional["_models.DiskInfoPatchProperties"] = None, + custom_configuration_script_url: Optional[str] = None, + image_info: Optional["_models.ImageInfoPatchProperties"] = None, + domain_info: Optional["_models.DomainInfoPatchProperties"] = None, + security_info: Optional["_models.SecurityInfoPatchProperties"] = None, + vm_admin_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoPatchProperties"] = None, **kwargs: Any ) -> None: """ - :keyword last_heart_beat: Last heart beat from SessionHost. - :paramtype last_heart_beat: ~datetime.datetime - :keyword sessions: Number of sessions on SessionHost. - :paramtype sessions: int - :keyword agent_version: Version of agent on SessionHost. - :paramtype agent_version: str - :keyword allow_new_session: Allow a new session. - :paramtype allow_new_session: bool - :keyword assigned_user: User assigned to SessionHost. - :paramtype assigned_user: str - :keyword friendly_name: Friendly name of SessionHost. + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. :paramtype friendly_name: str - :keyword status: Status for a SessionHost. Known values are: "Available", "Unavailable", - "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", - "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", and - "NeedsAssistance". - :paramtype status: str or ~azure.mgmt.desktopvirtualization.models.Status - :keyword os_version: The version of the OS on the session host. - :paramtype os_version: str - :keyword sx_s_stack_version: The version of the side by side stack on the session host. - :paramtype sx_s_stack_version: str - :keyword update_state: Update state of a SessionHost. Known values are: "Initial", "Pending", - "Started", "Succeeded", and "Failed". - :paramtype update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState - :keyword update_error_message: The error message. - :paramtype update_error_message: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :keyword domain_info: Domain configurations of session hosts. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties """ super().__init__(**kwargs) - self.system_data = None - self.object_id = None - self.last_heart_beat = last_heart_beat - self.sessions = sessions - self.agent_version = agent_version - self.allow_new_session = allow_new_session - self.virtual_machine_id = None - self.resource_id = None - self.assigned_user = assigned_user self.friendly_name = friendly_name - self.status = status - self.status_timestamp = None - self.os_version = os_version - self.sx_s_stack_version = sx_s_stack_version - self.update_state = update_state - self.last_update_time = None - self.update_error_message = update_error_message - self.session_host_health_check_results = None + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info class SessionHostHealthCheckFailureDetails(_serialization.Model): @@ -4870,6 +7243,431 @@ def __init__(self, *, value: Optional[List["_models.SessionHost"]] = None, **kwa self.next_link = None +class SessionHostManagement(ProxyResource): + """Represents a SessionHostManagement definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: 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: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. Required. + :vartype update: ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "scheduled_date_time_zone": {"required": True}, + "update": {"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"}, + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationProperties"}, + } + + def __init__( + self, *, scheduled_date_time_zone: str, update: "_models.HostPoolUpdateConfigurationProperties", **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. Required. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementList(_serialization.Model): + """List of SessionHostManagement definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostManagement definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostManagement]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostManagement"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostManagement definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostManagementOperationProgress(_serialization.Model): + """SessionHostManagement Operation Progress information. + + :ivar execution_start_time: Time that the sessionHostManagement operation was created. + :vartype execution_start_time: ~datetime.datetime + :ivar total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :vartype total_session_hosts: int + :ivar session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :vartype session_hosts_in_progress: int + :ivar session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :vartype session_hosts_completed: int + :ivar session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :vartype session_hosts_rollback_failed: int + """ + + _attribute_map = { + "execution_start_time": {"key": "executionStartTime", "type": "iso-8601"}, + "total_session_hosts": {"key": "totalSessionHosts", "type": "int"}, + "session_hosts_in_progress": {"key": "sessionHostsInProgress", "type": "int"}, + "session_hosts_completed": {"key": "sessionHostsCompleted", "type": "int"}, + "session_hosts_rollback_failed": {"key": "sessionHostsRollbackFailed", "type": "int"}, + } + + def __init__( + self, + *, + execution_start_time: Optional[datetime.datetime] = None, + total_session_hosts: Optional[int] = None, + session_hosts_in_progress: Optional[int] = None, + session_hosts_completed: Optional[int] = None, + session_hosts_rollback_failed: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_start_time: Time that the sessionHostManagement operation was created. + :paramtype execution_start_time: ~datetime.datetime + :keyword total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :paramtype total_session_hosts: int + :keyword session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :paramtype session_hosts_in_progress: int + :keyword session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :paramtype session_hosts_completed: int + :keyword session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :paramtype session_hosts_rollback_failed: int + """ + super().__init__(**kwargs) + self.execution_start_time = execution_start_time + self.total_session_hosts = total_session_hosts + self.session_hosts_in_progress = session_hosts_in_progress + self.session_hosts_completed = session_hosts_completed + self.session_hosts_rollback_failed = session_hosts_rollback_failed + + +class SessionHostManagementOperationStatus(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The current status of an async operation. + + 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 ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Current defined values are < Scheduled | UpdatingSessionHosts | + ValidatingSessionHostUpdate | Paused | Pausing | Cancelling | Resuming | Starting > | Succeeded + | Failed | Canceled. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :ivar correlation_id: The Log Analytics. + :vartype correlation_id: str + :ivar type: Type of sessionHostManagement operation. Known values are: + "InitiateSessionHostUpdate" and "ValidateSessionHostUpdate". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.OperationTypeSHM + :ivar action: Action type of the current sessionHostManagement operation. Known values are: + "Start", "Retry", "Pause", "Resume", and "Cancel". + :vartype action: str or ~azure.mgmt.desktopvirtualization.models.OperationActionSHM + :ivar progress: Progress information on the sessionHostManagement operation. + :vartype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :ivar scheduled_date_time: The timestamp that the update is scheduled for. + :vartype scheduled_date_time: ~datetime.datetime + :ivar session_host_management: SessionHostManagement properties used for the operation. + :vartype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :ivar parent_id: The resource ID of the operation that started this process. + :vartype parent_id: str + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + "action": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[SessionHostManagementOperationStatus]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + "correlation_id": {"key": "properties.correlationId", "type": "str"}, + "type": {"key": "properties.type", "type": "str"}, + "action": {"key": "properties.action", "type": "str"}, + "progress": {"key": "properties.progress", "type": "SessionHostManagementOperationProgress"}, + "scheduled_date_time": {"key": "properties.scheduledDateTime", "type": "iso-8601"}, + "session_host_management": {"key": "properties.sessionHostManagement", "type": "SessionHostManagement"}, + "parent_id": {"key": "properties.parentId", "type": "str"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.SessionHostManagementOperationStatus"]] = None, + error: Optional["_models.ErrorDetail"] = None, + correlation_id: Optional[str] = None, + type: Optional[Union[str, "_models.OperationTypeSHM"]] = None, + progress: Optional["_models.SessionHostManagementOperationProgress"] = None, + scheduled_date_time: Optional[datetime.datetime] = None, + session_host_management: Optional["_models.SessionHostManagement"] = None, + parent_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Current defined values are < Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling | Resuming | + Starting > | Succeeded | Failed | Canceled. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :keyword correlation_id: The Log Analytics. + :paramtype correlation_id: str + :keyword type: Type of sessionHostManagement operation. Known values are: + "InitiateSessionHostUpdate" and "ValidateSessionHostUpdate". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.OperationTypeSHM + :keyword progress: Progress information on the sessionHostManagement operation. + :paramtype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :keyword scheduled_date_time: The timestamp that the update is scheduled for. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword session_host_management: SessionHostManagement properties used for the operation. + :paramtype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :keyword parent_id: The resource ID of the operation that started this process. + :paramtype parent_id: str + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + self.correlation_id = correlation_id + self.type = type + self.action = None + self.progress = progress + self.scheduled_date_time = scheduled_date_time + self.session_host_management = session_host_management + self.parent_id = parent_id + + +class SessionHostManagementOperationStatusList(_serialization.Model): + """List of SessionHostManagementOperationStatus definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostManagementOperationStatus definitions. + :vartype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostManagementOperationStatus]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SessionHostManagementOperationStatus"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of SessionHostManagementOperationStatus definitions. + :paramtype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostManagementPatch(_serialization.Model): + """Represents a SessionHostManagementPatch definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _validation = { + "system_data": {"readonly": True}, + } + + _attribute_map = { + "system_data": {"key": "systemData", "type": "SystemData"}, + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementProgressError(_serialization.Model): + """SessionHostManagement operation fault information. + + :ivar fault_type: SessionHostManagement operation fault type. Known values are: "ServiceError" + and "UserError". + :vartype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :ivar fault_code: SessionHostManagement operation fault code. + :vartype fault_code: str + :ivar fault_text: SessionHostManagement operation fault text. + :vartype fault_text: str + :ivar fault_context: SessionHostManagement operation fault context. + :vartype fault_context: str + """ + + _attribute_map = { + "fault_type": {"key": "faultType", "type": "str"}, + "fault_code": {"key": "faultCode", "type": "str"}, + "fault_text": {"key": "faultText", "type": "str"}, + "fault_context": {"key": "faultContext", "type": "str"}, + } + + def __init__( + self, + *, + fault_type: Optional[Union[str, "_models.FaultType"]] = None, + fault_code: Optional[str] = None, + fault_text: Optional[str] = None, + fault_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword fault_type: SessionHostManagement operation fault type. Known values are: + "ServiceError" and "UserError". + :paramtype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :keyword fault_code: SessionHostManagement operation fault code. + :paramtype fault_code: str + :keyword fault_text: SessionHostManagement operation fault text. + :paramtype fault_text: str + :keyword fault_context: SessionHostManagement operation fault context. + :paramtype fault_context: str + """ + super().__init__(**kwargs) + self.fault_type = fault_type + self.fault_code = fault_code + self.fault_text = fault_text + self.fault_context = fault_context + + class SessionHostPatch(Resource): """SessionHost properties that can be patched. @@ -5127,6 +7925,53 @@ def __init__(self, *, hour: int, minute: int, **kwargs: Any) -> None: self.minute = minute +class UpdateSessionHostsRequestBody(_serialization.Model): + """Object containing the definition for properties to be used for a sessionHostUpdate operation. + + :ivar scheduled_date_time: The timestamp that the update validation is scheduled for. If none + is provided, the update will be executed immediately. + :vartype scheduled_date_time: ~datetime.datetime + :ivar scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :vartype scheduled_date_time_zone: str + :ivar update: settings for management information for the hostpool update operation. If none is + provided the update will use the settings saved in the sessionHostManagement object. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + "scheduled_date_time_zone": {"key": "scheduledDateTimeZone", "type": "str"}, + "update": {"key": "update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time: Optional[datetime.datetime] = None, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time: The timestamp that the update validation is scheduled for. If + none is provided, the update will be executed immediately. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :paramtype scheduled_date_time_zone: str + :keyword update: settings for management information for the hostpool update operation. If none + is provided the update will use the settings saved in the sessionHostManagement object. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + class UserSession(Resource): """Represents a UserSession definition. diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py index 975df17adf61..471e5611cbc6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py @@ -18,10 +18,20 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_operation_status_operations import SessionHostManagementsOperationStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._session_host_configurations_operation_status_operations import SessionHostConfigurationsOperationStatusOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,10 +50,20 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsOperationStatusOperations", + "SessionHostConfigurationsOperations", + "SessionHostConfigurationsOperationStatusOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..cb14102673ff --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,280 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_list_by_host_pool_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 ActiveSessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` 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( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :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.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :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.ActiveSessionHostConfigurationList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ActiveSessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..7e458b68308c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py @@ -0,0 +1,266 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_import_method_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/importAppAttachPackageInfo", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` 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 import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :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: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO], + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map = { + 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(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.import_method.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) + + import_method.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/importAppAttachPackageInfo" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..f0548c3fa357 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py @@ -0,0 +1,897 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, app_attach_package_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-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_or_update_request( + resource_group_name: str, app_attach_package_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-01-16-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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + app_attach_package_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, app_attach_package_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-01-16-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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # 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 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, filter: 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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request( + subscription_id: str, *, filter: 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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` 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(self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :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.AppAttachPackage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_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("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppAttachPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppAttachPackage", pipeline_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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool + :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, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + force=force, + 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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :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: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + 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) + + _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("AppAttachPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name and + host pool. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = 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, + filter=filter, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + } + + @distributed_trace + def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, and resource group. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = 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, + filter=filter, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py index e4da88807cbf..4a5b0041511f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,7 +116,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +151,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +196,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +236,7 @@ def build_list_by_subscription_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py index 53337c7d544a..21a86ba637dd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -200,7 +200,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..9bbb65e56c97 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py @@ -0,0 +1,319 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` 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 _post_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: Union[_models.HostPoolControlParameter, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(host_pool_control_parameter, (IOBase, bytes)): + _content = host_pool_control_parameter + else: + _json = self._serialize.body(host_pool_control_parameter, "HostPoolControlParameter") + + request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate" + } + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: _models.HostPoolControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. + Required. + :type host_pool_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolControlParameter + :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: + """ + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. + Required. + :type host_pool_control_parameter: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_control_parameter: Union[_models.HostPoolControlParameter, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_control_parameter: Object containing control action for hostpool update. Is + either a HostPoolControlParameter type or a IO type. Required. + :type host_pool_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolControlParameter 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 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._post_initial( # type: ignore + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_control_parameter=host_pool_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py index 6da4588b4dc1..018a14d92f35 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -125,7 +125,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py index a9a810f4e963..f959f28ce299 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -112,7 +112,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +147,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +189,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +232,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,7 +266,7 @@ def build_retrieve_registration_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..02b61fd767d4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,323 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` 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 _post_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO]] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate" + } + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :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: + """ + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody 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 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._post_initial( # type: ignore + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + update_session_hosts_request_body=update_session_hosts_request_body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py index 452128147281..fedf0726c78d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py @@ -43,7 +43,7 @@ def build_expand_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py index 3ad5108dc6ec..d4dd3dd171e8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -200,7 +200,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py index daa03136702e..3f1ccbb07f51 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py @@ -40,7 +40,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py index b6462f385c36..9d589bf25685 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py @@ -43,7 +43,7 @@ def build_list_by_workspace_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +80,7 @@ def build_get_by_workspace_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_delete_by_workspace_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +160,7 @@ def build_update_by_workspace_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -206,7 +206,7 @@ def build_list_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +249,7 @@ def build_get_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,7 +289,7 @@ def build_delete_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +329,7 @@ def build_update_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py index 7bbc918fb94c..375bb4d13d5d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py @@ -49,7 +49,7 @@ def build_list_by_workspace_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +95,7 @@ def build_list_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py index d4d7d34d218c..5577de85fe5c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py @@ -47,7 +47,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_create_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +130,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +170,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -216,7 +216,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py index f735b49cea2f..2b7bdae27ab1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py @@ -47,7 +47,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_create_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -130,7 +130,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +170,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -216,7 +216,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py index ae34ecab6c2f..df12fe0bbf2e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_create_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -112,7 +112,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +187,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +230,7 @@ def build_list_by_subscription_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,7 +271,7 @@ def build_list_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operation_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operation_status_operations.py new file mode 100644 index 000000000000..fcc64468dcd6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operation_status_operations.py @@ -0,0 +1,306 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses/{operationId}", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=36, min_length=36), + } + + _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_list_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + is_latest: Optional[bool] = None, + is_non_terminal: Optional[bool] = 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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if is_latest is not None: + _params["isLatest"] = _SERIALIZER.query("is_latest", is_latest, "bool") + if is_non_terminal is not None: + _params["isNonTerminal"] = _SERIALIZER.query("is_non_terminal", is_non_terminal, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostConfigurationsOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations_operation_status` 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( + self, resource_group_name: str, host_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.SessionHostConfigurationOperationStatus: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param operation_id: The Guid of the operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostConfigurationOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus + :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.SessionHostConfigurationOperationStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfigurationOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses/{operationId}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + is_latest: Optional[bool] = None, + is_non_terminal: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.SessionHostConfigurationOperationStatus"]: + """Get Operation status for SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param is_latest: Returns the most recent sessionHostConfiguration operation. Default value is + None. + :type is_latest: bool + :param is_non_terminal: Returns currently running operations. Ignored if 'isLatest' is true. + Default value is None. + :type is_non_terminal: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostConfigurationOperationStatus or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :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.SessionHostConfigurationOperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + is_latest=is_latest, + is_non_terminal=is_non_terminal, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationOperationStatusList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default/operationStatuses" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..bbf5c4354428 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py @@ -0,0 +1,856 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_update_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_get_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_list_by_host_pool_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` 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 _create_or_update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO], + **kwargs: Any + ) -> _models.SessionHostConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: 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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration 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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO]] = None, + **kwargs: Any + ) -> Optional[_models.SessionHostConfiguration]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostConfiguration]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: 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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch 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 SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @distributed_trace + def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :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.SessionHostConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfigurationList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operation_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operation_status_operations.py new file mode 100644 index 000000000000..5492c093d130 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operation_status_operations.py @@ -0,0 +1,338 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses/{operationId}", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=36, min_length=36), + } + + _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_list_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + is_latest: Optional[bool] = None, + type: Optional[str] = None, + is_non_terminal: Optional[bool] = None, + correlation_id: Optional[str] = None, + action: Optional[str] = None, + is_initiating_operation: Optional[bool] = 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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if is_latest is not None: + _params["isLatest"] = _SERIALIZER.query("is_latest", is_latest, "bool") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if is_non_terminal is not None: + _params["isNonTerminal"] = _SERIALIZER.query("is_non_terminal", is_non_terminal, "bool") + if correlation_id is not None: + _params["correlationId"] = _SERIALIZER.query("correlation_id", correlation_id, "str") + if action is not None: + _params["action"] = _SERIALIZER.query("action", action, "str") + if is_initiating_operation is not None: + _params["isInitiatingOperation"] = _SERIALIZER.query("is_initiating_operation", is_initiating_operation, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostManagementsOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_operation_status` 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( + self, resource_group_name: str, host_pool_name: str, operation_id: str, **kwargs: Any + ) -> _models.SessionHostManagementOperationStatus: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param operation_id: The Guid of the operation. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagementOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus + :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.SessionHostManagementOperationStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + operation_id=operation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagementOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses/{operationId}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + is_latest: Optional[bool] = None, + type: Optional[str] = None, + is_non_terminal: Optional[bool] = None, + correlation_id: Optional[str] = None, + action: Optional[str] = None, + is_initiating_operation: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.SessionHostManagementOperationStatus"]: + """Get Operation status for SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param is_latest: Returns the most recent sessionHostManagement operation. Default value is + None. + :type is_latest: bool + :param type: Filter based on the type of sessionHostManagement operation. Valid values are + 'InitiateSessionHostUpdate' and 'ValidateSessionHostUpdate'. Default value is None. + :type type: str + :param is_non_terminal: Returns currently running operations. Ignored if 'isLatest' is true. + Default value is None. + :type is_non_terminal: bool + :param correlation_id: CorrelationId of the sessionHostManagement operations to be returned. + Default value is None. + :type correlation_id: str + :param action: Action type for the Operation Status list to be filtered on. Valid actions are: + start | retry | pause | resume | cancel). Default value is None. + :type action: str + :param is_initiating_operation: Filter option to only return operations that initiated a + sessionHostManagement operation. Default value is None. + :type is_initiating_operation: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostManagementOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationStatus] + :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.SessionHostManagementOperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + is_latest=is_latest, + type=type, + is_non_terminal=is_non_terminal, + correlation_id=correlation_id, + action=action, + is_initiating_operation=is_initiating_operation, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementOperationStatusList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/operationStatuses" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..849309117cee --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py @@ -0,0 +1,646 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_update_request( + resource_group_name: str, host_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-01-16-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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_list_by_host_pool_request( + resource_group_name: str, host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + } + + _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 SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` 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(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :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.SessionHostManagement] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :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: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SessionHostManagement", pipeline_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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :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: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default" + } + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :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.SessionHostManagementList] = 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_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_host_pool.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_host_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py new file mode 100644 index 000000000000..b3a02c75a01a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_retry_provisioning_request( + resource_group_name: str, host_pool_name: str, session_host_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-01-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning", + ) # 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 + ), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + } + + _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 SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` 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 retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_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_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.retry_provisioning.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + retry_provisioning.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning" + } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py index 231e01d95a33..5179e0214500 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -171,7 +171,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py index a17065ac2cdc..972bc76be374 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py @@ -49,7 +49,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py index ba3683afd05d..2258de84d0be 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py @@ -51,7 +51,7 @@ def build_list_by_host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +229,7 @@ def build_disconnect_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -269,7 +269,7 @@ def build_send_message_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py index 8419c3184b09..983113329201 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py @@ -43,7 +43,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -112,7 +112,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +187,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +223,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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py new file mode 100644 index 000000000000..14cdfff42b4b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ActiveSessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..5b95bd3ddb6b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ActiveSessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py new file mode 100644 index 000000000000..8776089e6c47 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.create_or_update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + app_attach_package={ + "location": "southcentralus", + "properties": { + "failHealthCheckOnStagingFailure": "NeedsAssistance", + "hostPoolReferences": [], + "image": { + "certificateExpiry": "2023-01-02T17:18:19.1234567Z", + "certificateName": "certName", + "displayName": "displayname", + "imagePath": "imagepath", + "isActive": False, + "isRegularRegistration": False, + "lastUpdated": "2008-09-22T14:01:54.9571247Z", + "packageAlias": "msixpackagealias", + "packageApplications": [ + { + "appId": "AppId", + "appUserModelID": "AppUserModelId", + "description": "PackageApplicationDescription", + "friendlyName": "FriendlyName", + "iconImageName": "Iconimagename", + "rawIcon": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + "rawPng": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + } + ], + "packageDependencies": [ + { + "dependencyName": "MsixPackage_Dependency_Name", + "minVersion": "packageDep_version", + "publisher": "MsixPackage_Dependency_Publisher", + } + ], + "packageFamilyName": "MsixPackage_FamilyName", + "packageFullName": "MsixPackage_FullName", + "packageName": "MsixPackageName", + "packageRelativePath": "packagerelativepath", + "version": "packageversion", + }, + "keyVaultURL": "", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py new file mode 100644 index 000000000000..7fa971308dbc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.app_attach_package.delete( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py new file mode 100644 index 000000000000..fb2d3c2d9e1a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.get( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py new file mode 100644 index 000000000000..a59e5e0b0303 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_info_import_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package_info.import_method( + resource_group_name="resourceGroup1", + host_pool_name="hostpool1", + import_package_info_request={"packageArchitecture": "x64", "path": "imagepath"}, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackageInfo_Import_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py new file mode 100644 index 000000000000..14c8f0d47ad8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_list_by_resource_group.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.list_by_resource_group( + resource_group_name="resourceGroup1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py new file mode 100644 index 000000000000..31a8ff4aaf5f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_list_by_subscription.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py new file mode 100644 index 000000000000..dd7ac82c8b1a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/AppAttachPackage_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py index df2e652513a2..a19d017e586e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Application_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py index a2e10c776409..66c02ce5e2ce 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Application_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py index be2a3c46c31b..4d64d950dd88 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Application_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py index 080eea544cde..f3f7bfdb8c52 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py index 918ac61d8d8a..c131bd04c601 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py index d6e7f3238c77..266814f8f235 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py index 9f8854070fbc..72a5d162b556 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py index 9c8e6f484815..0d510ce4ce53 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py index ae3b69e90abc..360d5d6285a1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ApplicationGroup_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py index 2a069dded7b5..500d9e897891 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Application_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py index 2543ab83cc46..5b1d79a39af6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Application_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py index 6e434cde2579..e041d216cabe 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Desktop_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py index fbb4fc16947b..ea1100774807 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Desktop_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py index 58d8e8c495f6..e24422cadd3e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Desktop_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py index 7d583f1491dd..2c3bb896a51e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py @@ -43,16 +43,21 @@ def main(): }, "customRdpProperty": None, "description": "des1", + "directUDP": "Enabled", "friendlyName": "friendly", "hostPoolType": "Pooled", "loadBalancerType": "BreadthFirst", + "managedPrivateUDP": "Enabled", + "managementType": "Automated", "maxSessionLimit": 999999, "personalDesktopAssignmentType": "Automatic", "preferredAppGroupType": "Desktop", + "publicUDP": "Enabled", "registrationInfo": { "expirationTime": "2020-10-01T14:01:54.9571247Z", "registrationTokenOperation": "Update", }, + "relayUDP": "Enabled", "ssoClientId": "client", "ssoClientSecretKeyVaultPath": "https://keyvault/secret", "ssoSecretType": "SharedKey", @@ -66,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py index 30ef526635f4..7ed2ebaa9cdf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py index d774395db188..4b8042532da7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py index b9c61d910d28..4282acb6b1ba 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py index 5433bc9a1628..62f20265b80a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py index f2f8ecad8fa9..b12d9ccc7f27 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPool_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py index 82388e1af917..af9f420ae3c5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPools_RetrieveRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/HostPools_RetrieveRegistrationToken_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py index 4327c7d44dfe..103b47af0cdb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixImage_Expand_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixImage_Expand_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py index f2bdff869363..a34be143c9e9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixPackage_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py index ed4db6714575..cd41d72ed0f7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixPackage_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py index 4221df096b95..dc030ceb2248 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixPackage_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py index 76512ce69a8f..b936a893e1c8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixPackage_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py index a61bacfd4dc1..ab92d0d5f701 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/MsixPackage_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py index de7cd47c7ead..6a8dd8fbe42a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/OperationDescription_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/OperationDescription_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py index 347a812ff1f9..42afe27c9ac0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py index f11494a4626e..07c2c0b996b3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py index 78c12ba812f5..a630a9b46292 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_GetByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py index f484da865a1b..3b6d285ccffb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_GetByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py index 6bd2f22e9a6f..df8e5b906a2b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py index 23ff8d0eec94..4bd2bdfcf027 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py index 3be897a7f53c..4e3b47fb3480 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py index f190b60b4aff..af659bc96af5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py index 29fc40869770..4f11e1a2d9de 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateLinkResources_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py index a8834b07a4a9..b5dab23c2d1b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/PrivateLinkResources_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py index 5bd98f82ce20..c993e83c65e5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py @@ -74,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py index b94c9879a1cd..29d0d4654d36 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py index cdc193d77aa8..0570ed2d3752 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py index a4ccc4d2f3b1..c3fb99b64706 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py index 8bbc064b5d82..b38ecadb7e7a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py index 43d3223af985..9f379a154644 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py index 7c475a40da18..d96e57971a96 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py @@ -67,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPersonalSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py index 0d51d4e338d9..68cd00250b8f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPersonalSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py index 3a35b69d163f..07749291756f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPersonalSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py index b841cc3eb41b..cd327315d0a7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPersonalSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py index 9d36ca179a39..1dd141ce7093 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPersonalSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py index f87520f7b745..47b86c0d4303 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPooledSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py index b95b9669dac9..9cebb9363f49 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPooledSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py index f83d30ca7c76..ace2f3e11db8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPooledSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py index 41bb73ba98e6..c6e3fa7780f0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPooledSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py index eed711a358f3..e7160cf00344 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlanPooledSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py index 0b82204268e5..10306aac07a2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/ScalingPlan_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py new file mode 100644 index 000000000000..855664d87ad8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_configuration={ + "properties": { + "availabilityZones": [1, 3], + "bootDiagnosticsInfo": { + "enabled": True, + "storageUri": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageAccountName", + }, + "customConfigurationScriptUrl": "https://storageaccountname.blob.core.windows.net/blobcontainer/file", + "diskInfo": {"type": "Standard_LRS"}, + "domainInfo": { + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "domainName": "wvdarmtest1.net", + "ouPath": "OU=testOU,DC=domain,DC=Domain,DC=com", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "bdefabc0-95b4-48b3-b645-8a753a63c4fa"}, + "joinType": "ActiveDirectory", + }, + "friendlyName": "InitialConfiguration", + "imageInfo": { + "customInfo": { + "resourceId": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/images/imageName" + }, + "marketplaceInfo": { + "exactVersion": "2019.0.20190115", + "offer": "Windows-10", + "publisher": "MicrosoftWindowsDesktop", + "sku": "19h2-ent", + }, + "type": "Marketplace", + }, + "networkInfo": { + "securityGroupId": "/subscriptions/.../resourceGroups/.../provider s/Microsoft.Network/networkSecurityGroups/nsg1", + "subnetId": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/virtualNetworks/.../subnets/subnet1", + }, + "securityInfo": {"secureBootEnabled": True, "type": "TrustedLaunch", "vTpmEnabled": True}, + "vmAdminCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "vmLocation": "eastus2", + "vmNamePrefix": "westus2-vm", + "vmResourceGroup": "myResourceGroup", + "vmSizeId": "Standard_D2s_v3", + "vmTags": {"Department": "myDepartment", "Team": "myTeam"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurations_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py new file mode 100644 index 000000000000..1859c21a95c9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..876bf9f10295 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_get.py new file mode 100644 index 000000000000..8ea2eb1aa31e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_operation_status_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations_operation_status.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + operation_id="55582798-3f6e-4cda-9371-8723b27bd664", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurationsOperationStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_list.py new file mode 100644 index 000000000000..c89372e77910 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_operation_status_list.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_operation_status_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations_operation_status.list( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurationsOperationStatus_List.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py new file mode 100644 index 000000000000..92cb12fee8ac --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostConfigurations_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py index 946b4d9da293..85b9dfd02c8c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHost_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py index b1f7b32304e2..8fd51b39b1e1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHost_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py index 16559e7d470b..06a193a4d150 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHost_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py new file mode 100644 index 000000000000..695f4e073cfe --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_control_session_host_update_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.control_session_host_update.begin_post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + host_pool_control_parameter={"action": "Start", "cancelMessage": "Host pool update started"}, + ).result() + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_ControlSessionHostUpdate_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py new file mode 100644 index 000000000000..6abcc5fd12b1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_management={ + "properties": { + "scheduledDateTimeZone": "Alaskan Standard Time", + "update": { + "deleteOriginalVm": True, + "logOffDelayMinutes": 10, + "logOffMessage": "logging off for hostpool update", + "maxVmsRemoved": 4, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py new file mode 100644 index 000000000000..e2ce778616ce --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py new file mode 100644 index 000000000000..b0d3a4894ca1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_get.py new file mode 100644 index 000000000000..69f666a17b3a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_operation_status_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements_operation_status.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + operation_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagementsOperationStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_list.py new file mode 100644 index 000000000000..a9ce300f22b0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_operation_status_list.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_operation_status_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements_operation_status.list( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagementsOperationStatus_List.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py new file mode 100644 index 000000000000..3379ff6c60db --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py new file mode 100644 index 000000000000..d07c78330f2c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update_session_hosts_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.initiate_session_host_update.begin_post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ).result() + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHostManagements_UpdateSessionHosts_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py new file mode 100644 index 000000000000..ba506169c9e0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_retry_provisioning_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.session_host.retry_provisioning( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_name="sessionHost1.microsoft.com", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHost_RetryProvisioning_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py index da99b9081f12..d5571b812ec2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/SessionHost_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py index 58f79ef2c86e..b3b3c1502e5c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/StartMenuItem_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/StartMenuItem_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py index 00ca1c1fc6d8..08b92924f034 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py index fbe5371f406e..9f96eff774f5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Disconnect_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_Disconnect_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py index 469a091c203e..9f45805de978 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py index 47507e0c5cbf..7056128d623f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py index 4bbaf72a8502..10d3e265ac7d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py index c3bbd4fc1b59..f4bf6c25b21e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_SendMessage_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/UserSession_SendMessage_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py index cd9254a84892..fb05b275c7d9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py index 60a5346fd866..6a6609e1e886 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py index a2983f58eb4a..9eb1f185db61 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py index 3822f62ce5c9..f88535312a01 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py index 6a1aa43a6869..f5b5a6db7e8e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py index e2ad9c4fac4c..c9ac4b8df915 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-01-16-preview/examples/Workspace_Update.json if __name__ == "__main__": main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/LICENSE b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in new file mode 100644 index 000000000000..644150fb3a27 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/devopsinfrastructure/py.typed diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md new file mode 100644 index 000000000000..1aacb2061d1a --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-devopsinfrastructure +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.devopsinfrastructure import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json new file mode 100644 index 000000000000..552111973010 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/devopsinfrastructure/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/devopsinfrastructure/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py new file mode 100644 index 000000000000..44d9ee32acfc --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._managed_dev_ops_infrastructure import ManagedDevOpsInfrastructure +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ManagedDevOpsInfrastructure", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py new file mode 100644 index 000000000000..c203d8376c38 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ManagedDevOpsInfrastructureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ManagedDevOpsInfrastructure. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-12-13-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(ManagedDevOpsInfrastructureConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-12-13-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-devopsinfrastructure/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_managed_dev_ops_infrastructure.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_managed_dev_ops_infrastructure.py new file mode 100644 index 000000000000..31a846d07ff9 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_managed_dev_ops_infrastructure.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import ManagedDevOpsInfrastructureConfiguration +from ._serialization import Deserializer, Serializer +from .operations import Operations, PoolsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ManagedDevOpsInfrastructure: # pylint: disable=client-accepts-api-version-keyword + """ManagedDevOpsInfrastructure. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.devopsinfrastructure.operations.Operations + :ivar pools: PoolsOperations operations + :vartype pools: azure.mgmt.devopsinfrastructure.operations.PoolsOperations + :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-12-13-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ManagedDevOpsInfrastructureConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "ManagedDevOpsInfrastructure": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node
is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_vendor.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py new file mode 100644 index 000000000000..d8112a76583a --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._managed_dev_ops_infrastructure import ManagedDevOpsInfrastructure + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ManagedDevOpsInfrastructure", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py new file mode 100644 index 000000000000..8a2ca38dc8d9 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ManagedDevOpsInfrastructureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ManagedDevOpsInfrastructure. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-12-13-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(ManagedDevOpsInfrastructureConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-12-13-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-devopsinfrastructure/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_managed_dev_ops_infrastructure.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_managed_dev_ops_infrastructure.py new file mode 100644 index 000000000000..9e4515a5acaa --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_managed_dev_ops_infrastructure.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ManagedDevOpsInfrastructureConfiguration +from .operations import Operations, PoolsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ManagedDevOpsInfrastructure: # pylint: disable=client-accepts-api-version-keyword + """ManagedDevOpsInfrastructure. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.devopsinfrastructure.aio.operations.Operations + :ivar pools: PoolsOperations operations + :vartype pools: azure.mgmt.devopsinfrastructure.aio.operations.PoolsOperations + :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-12-13-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ManagedDevOpsInfrastructureConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ManagedDevOpsInfrastructure": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py new file mode 100644 index 000000000000..94cedad6355a --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._pools_operations import PoolsOperations + +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", + "PoolsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py new file mode 100644 index 000000000000..4f1fe8f0092d --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_operations.py @@ -0,0 +1,134 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devopsinfrastructure.aio.ManagedDevOpsInfrastructure`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devopsinfrastructure.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.DevOpsInfrastructure/operations"} diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_pools_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_pools_operations.py new file mode 100644 index 000000000000..0c47f870c0d9 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/operations/_pools_operations.py @@ -0,0 +1,856 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devopsinfrastructure.aio.ManagedDevOpsInfrastructure`'s + :attr:`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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + """List Pool resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.PoolListResult] = 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, + 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("PoolListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Pool"]: + """List Pool resources by resource group. + + :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 Pool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.PoolListResult] = 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, + 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("PoolListResult", 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.DevOpsInfrastructure/pools" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: + """Get a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pool or the result of cls(response) + :rtype: ~azure.mgmt.devopsinfrastructure.models.Pool + :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.Pool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_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 = 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("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> _models.Pool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Pool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: _models.Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Is either a Pool type or a IO type. Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + async def _update_initial( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> Optional[_models.Pool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PoolUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("Pool", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: _models.PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Pool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_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, + pool_name=pool_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_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, + pool_name=pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.py new file mode 100644 index 000000000000..c9e2ad444d44 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/__init__.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. +# -------------------------------------------------------------------------- + +from ._models_py3 import AgentProfile +from ._models_py3 import AzureDevOpsOrganizationProfile +from ._models_py3 import AzureDevOpsPermissionProfile +from ._models_py3 import DevOpsAzureSku +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import FabricProfile +from ._models_py3 import GitHubOrganization +from ._models_py3 import GitHubOrganizationProfile +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import NetworkProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Organization +from ._models_py3 import OrganizationProfile +from ._models_py3 import OsProfile +from ._models_py3 import Pool +from ._models_py3 import PoolImage +from ._models_py3 import PoolListResult +from ._models_py3 import PoolUpdate +from ._models_py3 import Resource +from ._models_py3 import SecretsManagementSettings +from ._models_py3 import Stateful +from ._models_py3 import StatelessAgentProfile +from ._models_py3 import StorageProfile +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VmssFabricProfile + +from ._managed_dev_ops_infrastructure_enums import ActionType +from ._managed_dev_ops_infrastructure_enums import AzureDevOpsPermissionType +from ._managed_dev_ops_infrastructure_enums import CreatedByType +from ._managed_dev_ops_infrastructure_enums import LogonType +from ._managed_dev_ops_infrastructure_enums import ManagedServiceIdentityType +from ._managed_dev_ops_infrastructure_enums import Origin +from ._managed_dev_ops_infrastructure_enums import OsDiskStorageAccountType +from ._managed_dev_ops_infrastructure_enums import ProvisioningState +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AgentProfile", + "AzureDevOpsOrganizationProfile", + "AzureDevOpsPermissionProfile", + "DevOpsAzureSku", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "FabricProfile", + "GitHubOrganization", + "GitHubOrganizationProfile", + "ManagedServiceIdentity", + "NetworkProfile", + "Operation", + "OperationDisplay", + "OperationListResult", + "Organization", + "OrganizationProfile", + "OsProfile", + "Pool", + "PoolImage", + "PoolListResult", + "PoolUpdate", + "Resource", + "SecretsManagementSettings", + "Stateful", + "StatelessAgentProfile", + "StorageProfile", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "VmssFabricProfile", + "ActionType", + "AzureDevOpsPermissionType", + "CreatedByType", + "LogonType", + "ManagedServiceIdentityType", + "Origin", + "OsDiskStorageAccountType", + "ProvisioningState", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_managed_dev_ops_infrastructure_enums.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_managed_dev_ops_infrastructure_enums.py new file mode 100644 index 000000000000..5ac9c1536322 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_managed_dev_ops_infrastructure_enums.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. +# -------------------------------------------------------------------------- + +from enum import Enum +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 AzureDevOpsPermissionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines who has admin permissions to the Azure DevOps pool.""" + + INHERIT = "Inherit" + """Pool will inherit permissions from the project or organization.""" + CREATOR_ONLY = "CreatorOnly" + """Only the pool creator will be an admin of the pool.""" + SPECIFIC_ACCOUNTS = "SpecificAccounts" + """Only the specified accounts will be admins of the pool.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class LogonType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines how the service should be run.""" + + SERVICE = "Service" + """Run as a service.""" + INTERACTIVE = "Interactive" + """Run in interactive mode.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + + +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 OsDiskStorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The storage account type of the OS disk.""" + + STANDARD = "Standard" + """Standard OS disk type.""" + PREMIUM = "Premium" + """Premium OS disk type.""" + STANDARD_SSD = "StandardSSD" + """Standard SSD OS disk type.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the current operation.""" + + SUCCEEDED = "Succeeded" + """Represents a succeeded operation.""" + FAILED = "Failed" + """Represents a failed operation.""" + CANCELED = "Canceled" + """Represents a canceled operation.""" + PROVISIONING = "Provisioning" + """Represents a pending operation.""" + UPDATING = "Updating" + """Represents a pending operation.""" + DELETING = "Deleting" + """Represents an operation under deletion.""" + ACCEPTED = "Accepted" + """Represents an accepted operation.""" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models_py3.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models_py3.py new file mode 100644 index 000000000000..735e40dadcd4 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_models_py3.py @@ -0,0 +1,1348 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AgentProfile(_serialization.Model): + """The agent profile of the machines in the pool. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + Stateful, StatelessAgentProfile + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for AgentProfile. Required. + :vartype kind: str + :ivar resource_predictions: Defines pool buffer. + :vartype resource_predictions: JSON + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "resource_predictions": {"key": "resourcePredictions", "type": "object"}, + } + + _subtype_map = {"kind": {"Stateful": "Stateful", "Stateless": "StatelessAgentProfile"}} + + def __init__(self, *, resource_predictions: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword resource_predictions: Defines pool buffer. + :paramtype resource_predictions: JSON + """ + super().__init__(**kwargs) + self.kind: Optional[str] = None + self.resource_predictions = resource_predictions + + +class OrganizationProfile(_serialization.Model): + """Defines the organization in which the pool will be used. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureDevOpsOrganizationProfile, GitHubOrganizationProfile + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for OrganizationProfile. Required. + :vartype kind: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + } + + _subtype_map = {"kind": {"AzureDevOps": "AzureDevOpsOrganizationProfile", "GitHub": "GitHubOrganizationProfile"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: Optional[str] = None + + +class AzureDevOpsOrganizationProfile(OrganizationProfile): + """Azure DevOps organization profile. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for OrganizationProfile. Required. + :vartype kind: str + :ivar organizations: The list of Azure DevOps organizations the pool should be present in. + Required. + :vartype organizations: list[~azure.mgmt.devopsinfrastructure.models.Organization] + :ivar permission_profile: The type of permission which determines which accounts are admins on + the Azure DevOps pool. + :vartype permission_profile: + ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionProfile + """ + + _validation = { + "kind": {"required": True}, + "organizations": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "organizations": {"key": "organizations", "type": "[Organization]"}, + "permission_profile": {"key": "permissionProfile", "type": "AzureDevOpsPermissionProfile"}, + } + + def __init__( + self, + *, + organizations: List["_models.Organization"], + permission_profile: Optional["_models.AzureDevOpsPermissionProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword organizations: The list of Azure DevOps organizations the pool should be present in. + Required. + :paramtype organizations: list[~azure.mgmt.devopsinfrastructure.models.Organization] + :keyword permission_profile: The type of permission which determines which accounts are admins + on the Azure DevOps pool. + :paramtype permission_profile: + ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionProfile + """ + super().__init__(**kwargs) + self.kind: str = "AzureDevOps" + self.organizations = organizations + self.permission_profile = permission_profile + + +class AzureDevOpsPermissionProfile(_serialization.Model): + """Defines the type of Azure DevOps pool permission. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Determines who has admin permissions to the Azure DevOps pool. Required. Known + values are: "Inherit", "CreatorOnly", and "SpecificAccounts". + :vartype kind: str or ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionType + :ivar users: User email addresses. + :vartype users: list[str] + :ivar groups: Group email addresses. + :vartype groups: list[str] + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "users": {"key": "users", "type": "[str]"}, + "groups": {"key": "groups", "type": "[str]"}, + } + + def __init__( + self, + *, + kind: Union[str, "_models.AzureDevOpsPermissionType"], + users: Optional[List[str]] = None, + groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: Determines who has admin permissions to the Azure DevOps pool. Required. Known + values are: "Inherit", "CreatorOnly", and "SpecificAccounts". + :paramtype kind: str or ~azure.mgmt.devopsinfrastructure.models.AzureDevOpsPermissionType + :keyword users: User email addresses. + :paramtype users: list[str] + :keyword groups: Group email addresses. + :paramtype groups: list[str] + """ + super().__init__(**kwargs) + self.kind = kind + self.users = users + self.groups = groups + + +class DevOpsAzureSku(_serialization.Model): + """The Azure SKU of the machines in the pool. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The Azure SKU name of the machines in the pool. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, **kwargs: Any) -> None: + """ + :keyword name: The Azure SKU name of the machines in the pool. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +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.devopsinfrastructure.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.devopsinfrastructure.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.devopsinfrastructure.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.devopsinfrastructure.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class FabricProfile(_serialization.Model): + """Defines the type of fabric the agent will run on. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + VmssFabricProfile + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for FabricProfile. Required. + :vartype kind: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + } + + _subtype_map = {"kind": {"Vmss": "VmssFabricProfile"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: Optional[str] = None + + +class GitHubOrganization(_serialization.Model): + """Defines a GitHub organization. + + All required parameters must be populated in order to send to Azure. + + :ivar url: The GitHub organization URL in which the pool should be created. Required. + :vartype url: str + :ivar repositories: Optional list of repositories in which the pool should be created. + :vartype repositories: list[str] + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "repositories": {"key": "repositories", "type": "[str]"}, + } + + def __init__(self, *, url: str, repositories: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword url: The GitHub organization URL in which the pool should be created. Required. + :paramtype url: str + :keyword repositories: Optional list of repositories in which the pool should be created. + :paramtype repositories: list[str] + """ + super().__init__(**kwargs) + self.url = url + self.repositories = repositories + + +class GitHubOrganizationProfile(OrganizationProfile): + """GitHub organization profile. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for OrganizationProfile. Required. + :vartype kind: str + :ivar organizations: The list of GitHub organizations/repositories the pool should be present + in. Required. + :vartype organizations: list[~azure.mgmt.devopsinfrastructure.models.GitHubOrganization] + """ + + _validation = { + "kind": {"required": True}, + "organizations": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "organizations": {"key": "organizations", "type": "[GitHubOrganization]"}, + } + + def __init__(self, *, organizations: List["_models.GitHubOrganization"], **kwargs: Any) -> None: + """ + :keyword organizations: The list of GitHub organizations/repositories the pool should be + present in. Required. + :paramtype organizations: list[~azure.mgmt.devopsinfrastructure.models.GitHubOrganization] + """ + super().__init__(**kwargs) + self.kind: str = "GitHub" + self.organizations = organizations + + +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 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". + :vartype type: str or ~azure.mgmt.devopsinfrastructure.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.devopsinfrastructure.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.devopsinfrastructure.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.devopsinfrastructure.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class NetworkProfile(_serialization.Model): + """The network profile of the machines in the pool. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: The subnet id on which to put all machines created in the pool. Required. + :vartype subnet_id: str + """ + + _validation = { + "subnet_id": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + } + + def __init__(self, *, subnet_id: str, **kwargs: Any) -> None: + """ + :keyword subnet_id: The subnet id on which to put all machines created in the pool. Required. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + + +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 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.devopsinfrastructure.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.devopsinfrastructure.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.devopsinfrastructure.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.devopsinfrastructure.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.devopsinfrastructure.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Organization(_serialization.Model): + """Defines an Azure DevOps organization. + + All required parameters must be populated in order to send to Azure. + + :ivar url: The Azure DevOps organization URL in which the pool should be created. Required. + :vartype url: str + :ivar projects: Optional list of projects in which the pool should be created. + :vartype projects: list[str] + :ivar parallelism: How many machines can be created at maximum in this organization out of the + maximumConcurrency of the pool. + :vartype parallelism: int + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "projects": {"key": "projects", "type": "[str]"}, + "parallelism": {"key": "parallelism", "type": "int"}, + } + + def __init__( + self, *, url: str, projects: Optional[List[str]] = None, parallelism: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword url: The Azure DevOps organization URL in which the pool should be created. Required. + :paramtype url: str + :keyword projects: Optional list of projects in which the pool should be created. + :paramtype projects: list[str] + :keyword parallelism: How many machines can be created at maximum in this organization out of + the maximumConcurrency of the pool. + :paramtype parallelism: int + """ + super().__init__(**kwargs) + self.url = url + self.projects = projects + self.parallelism = parallelism + + +class OsProfile(_serialization.Model): + """The OS profile of the machines in the pool. + + :ivar secrets_management_settings: The secret management settings of the machines in the pool. + :vartype secrets_management_settings: + ~azure.mgmt.devopsinfrastructure.models.SecretsManagementSettings + :ivar logon_type: Determines how the service should be run. By default, this will be set to + Service. Known values are: "Service" and "Interactive". + :vartype logon_type: str or ~azure.mgmt.devopsinfrastructure.models.LogonType + """ + + _attribute_map = { + "secrets_management_settings": {"key": "secretsManagementSettings", "type": "SecretsManagementSettings"}, + "logon_type": {"key": "logonType", "type": "str"}, + } + + def __init__( + self, + *, + secrets_management_settings: Optional["_models.SecretsManagementSettings"] = None, + logon_type: Optional[Union[str, "_models.LogonType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword secrets_management_settings: The secret management settings of the machines in the + pool. + :paramtype secrets_management_settings: + ~azure.mgmt.devopsinfrastructure.models.SecretsManagementSettings + :keyword logon_type: Determines how the service should be run. By default, this will be set to + Service. Known values are: "Service" and "Interactive". + :paramtype logon_type: str or ~azure.mgmt.devopsinfrastructure.models.LogonType + """ + super().__init__(**kwargs) + self.secrets_management_settings = secrets_management_settings + self.logon_type = logon_type + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.devopsinfrastructure.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.devopsinfrastructure.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Pool(TrackedResource): # pylint: disable=too-many-instance-attributes + """Concrete tracked resource types can be created by aliasing this type using a specific property + 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. + + :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.devopsinfrastructure.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: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity + :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.devopsinfrastructure.models.ProvisioningState + :ivar maximum_concurrency: Defines how many resources can there be created at any given time. + :vartype maximum_concurrency: int + :ivar organization_profile: Defines the organization in which the pool will be used. + :vartype organization_profile: ~azure.mgmt.devopsinfrastructure.models.OrganizationProfile + :ivar agent_profile: Defines how the machine will be handled once it executed a job. + :vartype agent_profile: ~azure.mgmt.devopsinfrastructure.models.AgentProfile + :ivar fabric_profile: Defines the type of fabric the agent will run on. + :vartype fabric_profile: ~azure.mgmt.devopsinfrastructure.models.FabricProfile + :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs + to. + :vartype dev_center_project_resource_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "maximum_concurrency": {"maximum": 10000, "minimum": 1}, + } + + _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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "maximum_concurrency": {"key": "properties.maximumConcurrency", "type": "int"}, + "organization_profile": {"key": "properties.organizationProfile", "type": "OrganizationProfile"}, + "agent_profile": {"key": "properties.agentProfile", "type": "AgentProfile"}, + "fabric_profile": {"key": "properties.fabricProfile", "type": "FabricProfile"}, + "dev_center_project_resource_id": {"key": "properties.devCenterProjectResourceId", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + maximum_concurrency: Optional[int] = None, + organization_profile: Optional["_models.OrganizationProfile"] = None, + agent_profile: Optional["_models.AgentProfile"] = None, + fabric_profile: Optional["_models.FabricProfile"] = None, + dev_center_project_resource_id: Optional[str] = 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: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity + :keyword provisioning_state: The status of the current operation. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.devopsinfrastructure.models.ProvisioningState + :keyword maximum_concurrency: Defines how many resources can there be created at any given + time. + :paramtype maximum_concurrency: int + :keyword organization_profile: Defines the organization in which the pool will be used. + :paramtype organization_profile: ~azure.mgmt.devopsinfrastructure.models.OrganizationProfile + :keyword agent_profile: Defines how the machine will be handled once it executed a job. + :paramtype agent_profile: ~azure.mgmt.devopsinfrastructure.models.AgentProfile + :keyword fabric_profile: Defines the type of fabric the agent will run on. + :paramtype fabric_profile: ~azure.mgmt.devopsinfrastructure.models.FabricProfile + :keyword dev_center_project_resource_id: The resource id of the DevCenter Project the pool + belongs to. + :paramtype dev_center_project_resource_id: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.provisioning_state = provisioning_state + self.maximum_concurrency = maximum_concurrency + self.organization_profile = organization_profile + self.agent_profile = agent_profile + self.fabric_profile = fabric_profile + self.dev_center_project_resource_id = dev_center_project_resource_id + + +class PoolImage(_serialization.Model): + """The VM image of the machines in the pool. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: The resource id of the image. Required. + :vartype resource_id: str + :ivar aliases: List of aliases to reference the image by. + :vartype aliases: list[str] + :ivar buffer: The percentage of the buffer to be allocated to this image. + :vartype buffer: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "aliases": {"key": "aliases", "type": "[str]"}, + "buffer": {"key": "buffer", "type": "str"}, + } + + def __init__( + self, *, resource_id: str, aliases: Optional[List[str]] = None, buffer: str = "*", **kwargs: Any + ) -> None: + """ + :keyword resource_id: The resource id of the image. Required. + :paramtype resource_id: str + :keyword aliases: List of aliases to reference the image by. + :paramtype aliases: list[str] + :keyword buffer: The percentage of the buffer to be allocated to this image. + :paramtype buffer: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.aliases = aliases + self.buffer = buffer + + +class PoolListResult(_serialization.Model): + """The response of a Pool list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Pool items on this page. Required. + :vartype value: list[~azure.mgmt.devopsinfrastructure.models.Pool] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Pool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Pool"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Pool items on this page. Required. + :paramtype value: list[~azure.mgmt.devopsinfrastructure.models.Pool] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PoolUpdate(_serialization.Model): + """The type used for update operations of the Pool. + + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar provisioning_state: The status of the current operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.devopsinfrastructure.models.ProvisioningState + :ivar maximum_concurrency: Defines how many resources can there be created at any given time. + :vartype maximum_concurrency: int + :ivar organization_profile: Defines the organization in which the pool will be used. + :vartype organization_profile: ~azure.mgmt.devopsinfrastructure.models.OrganizationProfile + :ivar agent_profile: Defines how the machine will be handled once it executed a job. + :vartype agent_profile: ~azure.mgmt.devopsinfrastructure.models.AgentProfile + :ivar fabric_profile: Defines the type of fabric the agent will run on. + :vartype fabric_profile: ~azure.mgmt.devopsinfrastructure.models.FabricProfile + :ivar dev_center_project_resource_id: The resource id of the DevCenter Project the pool belongs + to. + :vartype dev_center_project_resource_id: str + """ + + _validation = { + "maximum_concurrency": {"maximum": 10000, "minimum": 1}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "maximum_concurrency": {"key": "properties.maximumConcurrency", "type": "int"}, + "organization_profile": {"key": "properties.organizationProfile", "type": "OrganizationProfile"}, + "agent_profile": {"key": "properties.agentProfile", "type": "AgentProfile"}, + "fabric_profile": {"key": "properties.fabricProfile", "type": "FabricProfile"}, + "dev_center_project_resource_id": {"key": "properties.devCenterProjectResourceId", "type": "str"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + maximum_concurrency: Optional[int] = None, + organization_profile: Optional["_models.OrganizationProfile"] = None, + agent_profile: Optional["_models.AgentProfile"] = None, + fabric_profile: Optional["_models.FabricProfile"] = None, + dev_center_project_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.devopsinfrastructure.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The status of the current operation. Known values are: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.devopsinfrastructure.models.ProvisioningState + :keyword maximum_concurrency: Defines how many resources can there be created at any given + time. + :paramtype maximum_concurrency: int + :keyword organization_profile: Defines the organization in which the pool will be used. + :paramtype organization_profile: ~azure.mgmt.devopsinfrastructure.models.OrganizationProfile + :keyword agent_profile: Defines how the machine will be handled once it executed a job. + :paramtype agent_profile: ~azure.mgmt.devopsinfrastructure.models.AgentProfile + :keyword fabric_profile: Defines the type of fabric the agent will run on. + :paramtype fabric_profile: ~azure.mgmt.devopsinfrastructure.models.FabricProfile + :keyword dev_center_project_resource_id: The resource id of the DevCenter Project the pool + belongs to. + :paramtype dev_center_project_resource_id: str + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + self.provisioning_state = provisioning_state + self.maximum_concurrency = maximum_concurrency + self.organization_profile = organization_profile + self.agent_profile = agent_profile + self.fabric_profile = fabric_profile + self.dev_center_project_resource_id = dev_center_project_resource_id + + +class SecretsManagementSettings(_serialization.Model): + """The secret management settings of the machines in the pool. + + All required parameters must be populated in order to send to Azure. + + :ivar certificate_store_location: Where to store certificates on the machine. + :vartype certificate_store_location: str + :ivar observed_certificates: The list of certificates to install on all machines in the pool. + Required. + :vartype observed_certificates: list[str] + :ivar key_exportable: Defines if the key of the certificates should be exportable. Required. + :vartype key_exportable: bool + """ + + _validation = { + "observed_certificates": {"required": True}, + "key_exportable": {"required": True}, + } + + _attribute_map = { + "certificate_store_location": {"key": "certificateStoreLocation", "type": "str"}, + "observed_certificates": {"key": "observedCertificates", "type": "[str]"}, + "key_exportable": {"key": "keyExportable", "type": "bool"}, + } + + def __init__( + self, + *, + observed_certificates: List[str], + key_exportable: bool, + certificate_store_location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword certificate_store_location: Where to store certificates on the machine. + :paramtype certificate_store_location: str + :keyword observed_certificates: The list of certificates to install on all machines in the + pool. Required. + :paramtype observed_certificates: list[str] + :keyword key_exportable: Defines if the key of the certificates should be exportable. Required. + :paramtype key_exportable: bool + """ + super().__init__(**kwargs) + self.certificate_store_location = certificate_store_location + self.observed_certificates = observed_certificates + self.key_exportable = key_exportable + + +class Stateful(AgentProfile): + """Stateful profile meaning that the machines will be returned to the pool after running a job. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for AgentProfile. Required. + :vartype kind: str + :ivar resource_predictions: Defines pool buffer. + :vartype resource_predictions: JSON + :ivar max_agent_lifetime: How long should stateful machines be kept around. The maximum is one + week. Required. + :vartype max_agent_lifetime: str + """ + + _validation = { + "kind": {"required": True}, + "max_agent_lifetime": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "resource_predictions": {"key": "resourcePredictions", "type": "object"}, + "max_agent_lifetime": {"key": "maxAgentLifetime", "type": "str"}, + } + + def __init__(self, *, max_agent_lifetime: str, resource_predictions: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword resource_predictions: Defines pool buffer. + :paramtype resource_predictions: JSON + :keyword max_agent_lifetime: How long should stateful machines be kept around. The maximum is + one week. Required. + :paramtype max_agent_lifetime: str + """ + super().__init__(resource_predictions=resource_predictions, **kwargs) + self.kind: str = "Stateful" + self.max_agent_lifetime = max_agent_lifetime + + +class StatelessAgentProfile(AgentProfile): + """Stateless profile meaning that the machines will be cleaned up after running a job. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for AgentProfile. Required. + :vartype kind: str + :ivar resource_predictions: Defines pool buffer. + :vartype resource_predictions: JSON + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "resource_predictions": {"key": "resourcePredictions", "type": "object"}, + } + + def __init__(self, *, resource_predictions: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword resource_predictions: Defines pool buffer. + :paramtype resource_predictions: JSON + """ + super().__init__(resource_predictions=resource_predictions, **kwargs) + self.kind: str = "Stateless" + + +class StorageProfile(_serialization.Model): + """The storage profile of the VMSS. + + :ivar os_disk_storage_account_type: The Azure SKU name of the machines in the pool. Known + values are: "Standard", "Premium", and "StandardSSD". + :vartype os_disk_storage_account_type: str or + ~azure.mgmt.devopsinfrastructure.models.OsDiskStorageAccountType + """ + + _attribute_map = { + "os_disk_storage_account_type": {"key": "osDiskStorageAccountType", "type": "str"}, + } + + def __init__( + self, + *, + os_disk_storage_account_type: Optional[Union[str, "_models.OsDiskStorageAccountType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword os_disk_storage_account_type: The Azure SKU name of the machines in the pool. Known + values are: "Standard", "Premium", and "StandardSSD". + :paramtype os_disk_storage_account_type: str or + ~azure.mgmt.devopsinfrastructure.models.OsDiskStorageAccountType + """ + super().__init__(**kwargs) + self.os_disk_storage_account_type = os_disk_storage_account_type + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.devopsinfrastructure.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.devopsinfrastructure.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.devopsinfrastructure.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.devopsinfrastructure.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VmssFabricProfile(FabricProfile): + """The agents will run on Virtual Machine Scale Sets. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Discriminator property for FabricProfile. Required. + :vartype kind: str + :ivar sku: The Azure SKU of the machines in the pool. Required. + :vartype sku: ~azure.mgmt.devopsinfrastructure.models.DevOpsAzureSku + :ivar images: The VM images of the machines in the pool. Required. + :vartype images: list[~azure.mgmt.devopsinfrastructure.models.PoolImage] + :ivar os_profile: The OS profile of the machines in the pool. + :vartype os_profile: ~azure.mgmt.devopsinfrastructure.models.OsProfile + :ivar storage_profile: The storage profile of the machines in the pool. + :vartype storage_profile: ~azure.mgmt.devopsinfrastructure.models.StorageProfile + :ivar network_profile: The network profile of the machines in the pool. + :vartype network_profile: ~azure.mgmt.devopsinfrastructure.models.NetworkProfile + """ + + _validation = { + "kind": {"required": True}, + "sku": {"required": True}, + "images": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "sku": {"key": "sku", "type": "DevOpsAzureSku"}, + "images": {"key": "images", "type": "[PoolImage]"}, + "os_profile": {"key": "osProfile", "type": "OsProfile"}, + "storage_profile": {"key": "storageProfile", "type": "StorageProfile"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + } + + def __init__( + self, + *, + sku: "_models.DevOpsAzureSku", + images: List["_models.PoolImage"], + os_profile: Optional["_models.OsProfile"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The Azure SKU of the machines in the pool. Required. + :paramtype sku: ~azure.mgmt.devopsinfrastructure.models.DevOpsAzureSku + :keyword images: The VM images of the machines in the pool. Required. + :paramtype images: list[~azure.mgmt.devopsinfrastructure.models.PoolImage] + :keyword os_profile: The OS profile of the machines in the pool. + :paramtype os_profile: ~azure.mgmt.devopsinfrastructure.models.OsProfile + :keyword storage_profile: The storage profile of the machines in the pool. + :paramtype storage_profile: ~azure.mgmt.devopsinfrastructure.models.StorageProfile + :keyword network_profile: The network profile of the machines in the pool. + :paramtype network_profile: ~azure.mgmt.devopsinfrastructure.models.NetworkProfile + """ + super().__init__(**kwargs) + self.kind: str = "Vmss" + self.sku = sku + self.images = images + self.os_profile = os_profile + self.storage_profile = storage_profile + self.network_profile = network_profile diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py new file mode 100644 index 000000000000..94cedad6355a --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._pools_operations import PoolsOperations + +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", + "PoolsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py new file mode 100644 index 000000000000..bad87958db4e --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-12-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DevOpsInfrastructure/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devopsinfrastructure.ManagedDevOpsInfrastructure`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devopsinfrastructure.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.DevOpsInfrastructure/operations"} diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_pools_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_pools_operations.py new file mode 100644 index 000000000000..0c2f5949ab91 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/operations/_pools_operations.py @@ -0,0 +1,1036 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **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-12-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_by_resource_group_request(resource_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", "2023-12-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_get_request(resource_group_name: str, 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", "2023-12-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url("pool_name", pool_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_or_update_request( + resource_group_name: str, 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", "2023-12-13-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.DevOpsInfrastructure/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url("pool_name", pool_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(resource_group_name: str, 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", "2023-12-13-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.DevOpsInfrastructure/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url("pool_name", pool_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_group_name: str, 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", "2023-12-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}", + ) # 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 + ), + "poolName": _SERIALIZER.url("pool_name", pool_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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devopsinfrastructure.ManagedDevOpsInfrastructure`'s + :attr:`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_by_subscription(self, **kwargs: Any) -> Iterable["_models.Pool"]: + """List Pool resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Pool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.PoolListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PoolListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pool"]: + """List Pool resources by resource group. + + :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 Pool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.PoolListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("PoolListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" + } + + @distributed_trace + def get(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: + """Get a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pool or the result of cls(response) + :rtype: ~azure.mgmt.devopsinfrastructure.models.Pool + :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.Pool] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + pool_name=pool_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("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> _models.Pool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Pool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + pool_name=pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Pool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: _models.Pool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pool_name: str, + resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, pool_name: str, resource: Union[_models.Pool, IO], **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Create a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param resource: Resource create parameters. Is either a Pool type or a IO type. Required. + :type resource: ~azure.mgmt.devopsinfrastructure.models.Pool 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + def _update_initial( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> Optional[_models.Pool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Pool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PoolUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Pool", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: _models.PoolUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate + :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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pool_name: str, + properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, pool_name: str, properties: Union[_models.PoolUpdate, IO], **kwargs: Any + ) -> LROPoller[_models.Pool]: + """Update a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :param properties: The resource properties to be updated. Is either a PoolUpdate type or a IO + type. Required. + :type properties: ~azure.mgmt.devopsinfrastructure.models.PoolUpdate 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 Pool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devopsinfrastructure.models.Pool] + :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.Pool] = 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, + pool_name=pool_name, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Pool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, pool_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, + pool_name=pool_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pool_name: Name of the pool. It needs to be globally unique. Required. + :type pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + pool_name=pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" + } diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/py.typed b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py new file mode 100644 index 000000000000..5727fd861a03 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/create_or_update_pool.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python create_or_update_pool.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="a2e95d27-c161-4b61-bda4-11512c14c2c2", + ) + + response = client.pools.begin_create_or_update( + resource_group_name="rg", + pool_name="pool", + resource={ + "location": "eastus", + "properties": { + "agentProfile": {"kind": "Stateless"}, + "devCenterProjectResourceId": "/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES", + "fabricProfile": { + "images": [{"resourceId": "/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"}], + "kind": "Vmss", + "sku": {"name": "Standard_D4ads_v5"}, + }, + "maximumConcurrency": 10, + "organizationProfile": { + "kind": "AzureDevOps", + "organizations": [{"url": "https://mseng.visualstudio.com"}], + }, + "provisioningState": "Succeeded", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/CreateOrUpdatePool.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py new file mode 100644 index 000000000000..8d71770d7a78 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/delete_pool.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python delete_pool.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="a2e95d27-c161-4b61-bda4-11512c14c2c2", + ) + + client.pools.begin_delete( + resource_group_name="rg", + pool_name="pool", + ).result() + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/DeletePool.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py new file mode 100644 index 000000000000..9f40f7c9403d --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/get_pool.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python get_pool.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="a2e95d27-c161-4b61-bda4-11512c14c2c2", + ) + + response = client.pools.get( + resource_group_name="rg", + pool_name="pool", + ) + print(response) + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/GetPool.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py new file mode 100644 index 000000000000..c45bc7bd1bbe --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python list_operations.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/ListOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py new file mode 100644 index 000000000000..0d8511e2c9af --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python list_pools_by_subscription.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="a2e95d27-c161-4b61-bda4-11512c14c2c2", + ) + + response = client.pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/ListPoolsBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py new file mode 100644 index 000000000000..42f541597c16 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/generated_samples/list_pools_by_subscription_and_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devopsinfrastructure import ManagedDevOpsInfrastructure + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devopsinfrastructure +# USAGE + python list_pools_by_subscription_and_resource_group.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 = ManagedDevOpsInfrastructure( + credential=DefaultAzureCredential(), + subscription_id="a2e95d27-c161-4b61-bda4-11512c14c2c2", + ) + + response = client.pools.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2023-12-13-preview/examples/ListPoolsBySubscriptionAndResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml new file mode 100644 index 000000000000..445134ba6559 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-devopsinfrastructure" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py new file mode 100644 index 000000000000..45c7a1fe6296 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-devopsinfrastructure" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/devopsinfrastructure/ci.yml b/sdk/devopsinfrastructure/ci.yml new file mode 100644 index 000000000000..360746e870c5 --- /dev/null +++ b/sdk/devopsinfrastructure/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/devopsinfrastructure/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/devopsinfrastructure/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: devopsinfrastructure + TestProxy: true + Artifacts: + - name: azure-mgmt-devopsinfrastructure + safeName: azuremgmtdevopsinfrastructure diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/CHANGELOG.md b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/LICENSE b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/MANIFEST.in b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/MANIFEST.in new file mode 100644 index 000000000000..8c43e121467c --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/edgemarketplace/py.typed diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/README.md b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/README.md new file mode 100644 index 000000000000..920f70e8df83 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-edgemarketplace +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.edgemarketplace import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/_meta.json b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/_meta.json new file mode 100644 index 000000000000..0d2d6caf36a2 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/edgemarketplace/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/edgemarketplace/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/__init__.py new file mode 100644 index 000000000000..7a014fe1e114 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._edge_market_place_mgmt_client import EdgeMarketPlaceMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EdgeMarketPlaceMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_configuration.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_configuration.py new file mode 100644 index 000000000000..cb9fbc29bac8 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class EdgeMarketPlaceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for EdgeMarketPlaceMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-08-01". 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(EdgeMarketPlaceMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-08-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-edgemarketplace/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_edge_market_place_mgmt_client.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_edge_market_place_mgmt_client.py new file mode 100644 index 000000000000..890c02d2193d --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_edge_market_place_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import EdgeMarketPlaceMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import OffersOperations, Operations, PublishersOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class EdgeMarketPlaceMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """Edge marketplace extensions. + + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.edgemarketplace.operations.PublishersOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.edgemarketplace.operations.Operations + :ivar offers: OffersOperations operations + :vartype offers: azure.mgmt.edgemarketplace.operations.OffersOperations + :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-08-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = EdgeMarketPlaceMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.offers = OffersOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "EdgeMarketPlaceMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_patch.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_serialization.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_vendor.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_version.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/__init__.py new file mode 100644 index 000000000000..5fcdbcce9644 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._edge_market_place_mgmt_client import EdgeMarketPlaceMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EdgeMarketPlaceMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_configuration.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_configuration.py new file mode 100644 index 000000000000..44c7a33b7818 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EdgeMarketPlaceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for EdgeMarketPlaceMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-08-01". 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(EdgeMarketPlaceMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-08-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-edgemarketplace/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_edge_market_place_mgmt_client.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_edge_market_place_mgmt_client.py new file mode 100644 index 000000000000..3af5b01b7d61 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_edge_market_place_mgmt_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import EdgeMarketPlaceMgmtClientConfiguration +from .operations import OffersOperations, Operations, PublishersOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EdgeMarketPlaceMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """Edge marketplace extensions. + + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.edgemarketplace.aio.operations.PublishersOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.edgemarketplace.aio.operations.Operations + :ivar offers: OffersOperations operations + :vartype offers: azure.mgmt.edgemarketplace.aio.operations.OffersOperations + :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-08-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = EdgeMarketPlaceMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.offers = OffersOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "EdgeMarketPlaceMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_patch.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/__init__.py new file mode 100644 index 000000000000..3eb9153739e6 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._publishers_operations import PublishersOperations +from ._operations import Operations +from ._offers_operations import OffersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PublishersOperations", + "Operations", + "OffersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_offers_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_offers_operations.py new file mode 100644 index 000000000000..ba078a2c90b7 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_offers_operations.py @@ -0,0 +1,685 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._offers_operations import ( + build_generate_access_token_request, + build_get_access_token_request, + build_get_request, + build_list_by_subscription_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OffersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.aio.EdgeMarketPlaceMgmtClient`'s + :attr:`offers` 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_uri: str, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Offer"]: + """List Offer resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgemarketplace.models.Offer] + :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.OfferListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OfferListResult", 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.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers"} + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Offer"]: + """List Offer resources by subscription. + + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgemarketplace.models.Offer] + :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.OfferListResult] = 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, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + 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("OfferListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers" + } + + @distributed_trace_async + async def get(self, resource_uri: str, offer_id: str, **kwargs: Any) -> _models.Offer: + """Get a Offer. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Offer or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.Offer + :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.Offer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + offer_id=offer_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 = 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("Offer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}"} + + async def _generate_access_token_initial( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenRequest, IO], **kwargs: Any + ) -> Optional[_models.DiskAccessToken]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DiskAccessToken]] = 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, "AccessTokenRequest") + + request = build_generate_access_token_request( + resource_uri=resource_uri, + offer_id=offer_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_access_token_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DiskAccessToken", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_access_token_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken" + } + + @overload + async def begin_generate_access_token( + self, + resource_uri: str, + offer_id: str, + body: _models.AccessTokenRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenRequest + :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 DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_access_token( + self, resource_uri: str, offer_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_access_token( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenRequest, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Is either a AccessTokenRequest type or a IO + type. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :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.DiskAccessToken] = 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._generate_access_token_initial( + resource_uri=resource_uri, + offer_id=offer_id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiskAccessToken", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_access_token.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken" + } + + @overload + async def get_access_token( + self, + resource_uri: str, + offer_id: str, + body: _models.AccessTokenReadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenReadRequest + :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: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_access_token( + self, resource_uri: str, offer_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_access_token( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenReadRequest, IO], **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Is either a AccessTokenReadRequest type or a IO + type. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenReadRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DiskAccessToken] = 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, "AccessTokenReadRequest") + + request = build_get_access_token_request( + resource_uri=resource_uri, + offer_id=offer_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_access_token.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("DiskAccessToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_token.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken" + } diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_operations.py new file mode 100644 index 000000000000..d48f9bc06fab --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.aio.EdgeMarketPlaceMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgemarketplace.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.EdgeMarketplace/operations"} diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_patch.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_publishers_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_publishers_operations.py new file mode 100644 index 000000000000..d1fe762e4ca4 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/aio/operations/_publishers_operations.py @@ -0,0 +1,332 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._publishers_operations import ( + build_get_request, + build_list_by_subscription_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PublishersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.aio.EdgeMarketPlaceMgmtClient`'s + :attr:`publishers` 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_uri: str, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Publisher"]: + """List Publisher resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgemarketplace.models.Publisher] + :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.PublisherListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", 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.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers"} + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Publisher"]: + """List Publisher resources in subscription. + + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgemarketplace.models.Publisher] + :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.PublisherListResult] = 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, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + 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("PublisherListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/publishers" + } + + @distributed_trace_async + async def get(self, resource_uri: str, publisher_name: str, **kwargs: Any) -> _models.Publisher: + """Get a Publisher. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param publisher_name: Name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.Publisher + :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.Publisher] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + publisher_name=publisher_name, + 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 = 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("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}"} diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/__init__.py new file mode 100644 index 000000000000..c3ffcc2b866d --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/__init__.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AccessTokenReadRequest +from ._models_py3 import AccessTokenRequest +from ._models_py3 import DiskAccessToken +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import IconFileUris +from ._models_py3 import MarketplaceSku +from ._models_py3 import MarketplaceSkuVersion +from ._models_py3 import Offer +from ._models_py3 import OfferContent +from ._models_py3 import OfferListResult +from ._models_py3 import OfferProperties +from ._models_py3 import OfferPublisher +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import Publisher +from ._models_py3 import PublisherListResult +from ._models_py3 import PublisherProperties +from ._models_py3 import Resource +from ._models_py3 import SkuOperatingSystem +from ._models_py3 import SystemData +from ._models_py3 import TermsAndConditions + +from ._edge_market_place_mgmt_client_enums import ActionType +from ._edge_market_place_mgmt_client_enums import CreatedByType +from ._edge_market_place_mgmt_client_enums import OfferAvailability +from ._edge_market_place_mgmt_client_enums import OfferReleaseType +from ._edge_market_place_mgmt_client_enums import Origin +from ._edge_market_place_mgmt_client_enums import ResourceProvisioningState +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccessTokenReadRequest", + "AccessTokenRequest", + "DiskAccessToken", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "IconFileUris", + "MarketplaceSku", + "MarketplaceSkuVersion", + "Offer", + "OfferContent", + "OfferListResult", + "OfferProperties", + "OfferPublisher", + "Operation", + "OperationDisplay", + "OperationListResult", + "ProxyResource", + "Publisher", + "PublisherListResult", + "PublisherProperties", + "Resource", + "SkuOperatingSystem", + "SystemData", + "TermsAndConditions", + "ActionType", + "CreatedByType", + "OfferAvailability", + "OfferReleaseType", + "Origin", + "ResourceProvisioningState", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_edge_market_place_mgmt_client_enums.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_edge_market_place_mgmt_client_enums.py new file mode 100644 index 000000000000..b3dd9db9ee1c --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_edge_market_place_mgmt_client_enums.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class OfferAvailability(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Says if the offer is public/private.""" + + PRIVATE = "Private" + """The offer availability is private""" + PUBLIC = "Public" + """The offer availability is public""" + + +class OfferReleaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Offer release type.""" + + PREVIEW = "Preview" + """The offer in preview""" + GA = "GA" + """The offer in GA""" + + +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 ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource type.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_models_py3.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_models_py3.py new file mode 100644 index 000000000000..7f24bf15d29a --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_models_py3.py @@ -0,0 +1,1206 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class AccessTokenReadRequest(_serialization.Model): + """Access token request object. + + All required parameters must be populated in order to send to Azure. + + :ivar request_id: The name of the publisher. Required. + :vartype request_id: str + """ + + _validation = { + "request_id": {"required": True}, + } + + _attribute_map = { + "request_id": {"key": "requestId", "type": "str"}, + } + + def __init__(self, *, request_id: str, **kwargs: Any) -> None: + """ + :keyword request_id: The name of the publisher. Required. + :paramtype request_id: str + """ + super().__init__(**kwargs) + self.request_id = request_id + + +class AccessTokenRequest(_serialization.Model): + """Access token request object. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher_name: The name of the publisher. + :vartype publisher_name: str + :ivar edge_market_place_region: The region where the disk will be created. Required. + :vartype edge_market_place_region: str + :ivar ege_market_place_resource_id: The region where the disk will be created. + :vartype ege_market_place_resource_id: str + :ivar hyperv_generation: The hyperv version. + :vartype hyperv_generation: str + :ivar market_place_sku: The marketplace sku. + :vartype market_place_sku: str + :ivar market_place_sku_version: The marketplace sku version. + :vartype market_place_sku_version: str + :ivar device_sku: The device sku. + :vartype device_sku: str + :ivar device_version: The device sku version. + :vartype device_version: str + """ + + _validation = { + "edge_market_place_region": {"required": True}, + } + + _attribute_map = { + "publisher_name": {"key": "publisherName", "type": "str"}, + "edge_market_place_region": {"key": "edgeMarketPlaceRegion", "type": "str"}, + "ege_market_place_resource_id": {"key": "egeMarketPlaceResourceId", "type": "str"}, + "hyperv_generation": {"key": "hypervGeneration", "type": "str"}, + "market_place_sku": {"key": "marketPlaceSku", "type": "str"}, + "market_place_sku_version": {"key": "marketPlaceSkuVersion", "type": "str"}, + "device_sku": {"key": "deviceSku", "type": "str"}, + "device_version": {"key": "deviceVersion", "type": "str"}, + } + + def __init__( + self, + *, + edge_market_place_region: str, + publisher_name: Optional[str] = None, + ege_market_place_resource_id: Optional[str] = None, + hyperv_generation: Optional[str] = None, + market_place_sku: Optional[str] = None, + market_place_sku_version: Optional[str] = None, + device_sku: Optional[str] = None, + device_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_name: The name of the publisher. + :paramtype publisher_name: str + :keyword edge_market_place_region: The region where the disk will be created. Required. + :paramtype edge_market_place_region: str + :keyword ege_market_place_resource_id: The region where the disk will be created. + :paramtype ege_market_place_resource_id: str + :keyword hyperv_generation: The hyperv version. + :paramtype hyperv_generation: str + :keyword market_place_sku: The marketplace sku. + :paramtype market_place_sku: str + :keyword market_place_sku_version: The marketplace sku version. + :paramtype market_place_sku_version: str + :keyword device_sku: The device sku. + :paramtype device_sku: str + :keyword device_version: The device sku version. + :paramtype device_version: str + """ + super().__init__(**kwargs) + self.publisher_name = publisher_name + self.edge_market_place_region = edge_market_place_region + self.ege_market_place_resource_id = ege_market_place_resource_id + self.hyperv_generation = hyperv_generation + self.market_place_sku = market_place_sku + self.market_place_sku_version = market_place_sku_version + self.device_sku = device_sku + self.device_version = device_version + + +class DiskAccessToken(_serialization.Model): + """The disk access token. + + All required parameters must be populated in order to send to Azure. + + :ivar disk_id: The disk id. + :vartype disk_id: str + :ivar status: The access token creation status. + :vartype status: str + :ivar access_token: The access token. Required. + :vartype access_token: str + """ + + _validation = { + "access_token": {"required": True}, + } + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "access_token": {"key": "accessToken", "type": "str"}, + } + + def __init__( + self, *, access_token: str, disk_id: Optional[str] = None, status: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword disk_id: The disk id. + :paramtype disk_id: str + :keyword status: The access token creation status. + :paramtype status: str + :keyword access_token: The access token. Required. + :paramtype access_token: str + """ + super().__init__(**kwargs) + self.disk_id = disk_id + self.status = status + self.access_token = access_token + + +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.edgemarketplace.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.edgemarketplace.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.edgemarketplace.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.edgemarketplace.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class IconFileUris(_serialization.Model): + """Icon files. + + :ivar small: uri of small icon. + :vartype small: str + :ivar medium: uri of medium icon. + :vartype medium: str + :ivar wide: uri of wide icon. + :vartype wide: str + :ivar large: uri of large icon. + :vartype large: str + """ + + _attribute_map = { + "small": {"key": "small", "type": "str"}, + "medium": {"key": "medium", "type": "str"}, + "wide": {"key": "wide", "type": "str"}, + "large": {"key": "large", "type": "str"}, + } + + def __init__( + self, + *, + small: Optional[str] = None, + medium: Optional[str] = None, + wide: Optional[str] = None, + large: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword small: uri of small icon. + :paramtype small: str + :keyword medium: uri of medium icon. + :paramtype medium: str + :keyword wide: uri of wide icon. + :paramtype wide: str + :keyword large: uri of large icon. + :paramtype large: str + """ + super().__init__(**kwargs) + self.small = small + self.medium = medium + self.wide = wide + self.large = large + + +class MarketplaceSku(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The marketplace sku. + + All required parameters must be populated in order to send to Azure. + + :ivar catalog_plan_id: The catalog plan id. Required. + :vartype catalog_plan_id: str + :ivar marketplace_sku_id: The marketplace sku id. Required. + :vartype marketplace_sku_id: str + :ivar type: The type of marketplace sku. + :vartype type: str + :ivar display_name: The display name of marketplace sku. + :vartype display_name: str + :ivar summary: The summary. + :vartype summary: str + :ivar long_summary: The long summary. + :vartype long_summary: str + :ivar description: The description. + :vartype description: str + :ivar generation: The generation. + :vartype generation: str + :ivar display_rank: The display rank of the sku. + :vartype display_rank: int + :ivar operating_system: The operating system supported. + :vartype operating_system: ~azure.mgmt.edgemarketplace.models.SkuOperatingSystem + :ivar marketplace_sku_versions: The marketplace sku version. + :vartype marketplace_sku_versions: + list[~azure.mgmt.edgemarketplace.models.MarketplaceSkuVersion] + """ + + _validation = { + "catalog_plan_id": {"required": True}, + "marketplace_sku_id": {"required": True}, + } + + _attribute_map = { + "catalog_plan_id": {"key": "catalogPlanId", "type": "str"}, + "marketplace_sku_id": {"key": "marketplaceSkuId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "long_summary": {"key": "longSummary", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "generation": {"key": "generation", "type": "str"}, + "display_rank": {"key": "displayRank", "type": "int"}, + "operating_system": {"key": "operatingSystem", "type": "SkuOperatingSystem"}, + "marketplace_sku_versions": {"key": "marketplaceSkuVersions", "type": "[MarketplaceSkuVersion]"}, + } + + def __init__( + self, + *, + catalog_plan_id: str, + marketplace_sku_id: str, + type: Optional[str] = None, + display_name: Optional[str] = None, + summary: Optional[str] = None, + long_summary: Optional[str] = None, + description: Optional[str] = None, + generation: Optional[str] = None, + display_rank: Optional[int] = None, + operating_system: Optional["_models.SkuOperatingSystem"] = None, + marketplace_sku_versions: Optional[List["_models.MarketplaceSkuVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword catalog_plan_id: The catalog plan id. Required. + :paramtype catalog_plan_id: str + :keyword marketplace_sku_id: The marketplace sku id. Required. + :paramtype marketplace_sku_id: str + :keyword type: The type of marketplace sku. + :paramtype type: str + :keyword display_name: The display name of marketplace sku. + :paramtype display_name: str + :keyword summary: The summary. + :paramtype summary: str + :keyword long_summary: The long summary. + :paramtype long_summary: str + :keyword description: The description. + :paramtype description: str + :keyword generation: The generation. + :paramtype generation: str + :keyword display_rank: The display rank of the sku. + :paramtype display_rank: int + :keyword operating_system: The operating system supported. + :paramtype operating_system: ~azure.mgmt.edgemarketplace.models.SkuOperatingSystem + :keyword marketplace_sku_versions: The marketplace sku version. + :paramtype marketplace_sku_versions: + list[~azure.mgmt.edgemarketplace.models.MarketplaceSkuVersion] + """ + super().__init__(**kwargs) + self.catalog_plan_id = catalog_plan_id + self.marketplace_sku_id = marketplace_sku_id + self.type = type + self.display_name = display_name + self.summary = summary + self.long_summary = long_summary + self.description = description + self.generation = generation + self.display_rank = display_rank + self.operating_system = operating_system + self.marketplace_sku_versions = marketplace_sku_versions + + +class MarketplaceSkuVersion(_serialization.Model): + """The marketplace sku version. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of sku version. Required. + :vartype name: str + :ivar size_on_disk_in_mb: The size of the image. + :vartype size_on_disk_in_mb: int + :ivar minimum_download_size_in_mb: The size of the download. + :vartype minimum_download_size_in_mb: int + :ivar stage_name: The stage name. + :vartype stage_name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "size_on_disk_in_mb": {"key": "sizeOnDiskInMb", "type": "int"}, + "minimum_download_size_in_mb": {"key": "minimumDownloadSizeInMb", "type": "int"}, + "stage_name": {"key": "stageName", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + size_on_disk_in_mb: Optional[int] = None, + minimum_download_size_in_mb: Optional[int] = None, + stage_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of sku version. Required. + :paramtype name: str + :keyword size_on_disk_in_mb: The size of the image. + :paramtype size_on_disk_in_mb: int + :keyword minimum_download_size_in_mb: The size of the download. + :paramtype minimum_download_size_in_mb: int + :keyword stage_name: The stage name. + :paramtype stage_name: str + """ + super().__init__(**kwargs) + self.name = name + self.size_on_disk_in_mb = size_on_disk_in_mb + self.minimum_download_size_in_mb = minimum_download_size_in_mb + self.stage_name = stage_name + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.edgemarketplace.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + 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.edgemarketplace.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class Offer(ProxyResource): + """An offer. + + 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.edgemarketplace.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.edgemarketplace.models.OfferProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "OfferProperties"}, + } + + def __init__(self, *, properties: Optional["_models.OfferProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.edgemarketplace.models.OfferProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class OfferContent(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The offer content. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the offer. Required. + :vartype display_name: str + :ivar summary: The summary. + :vartype summary: str + :ivar long_summary: The long summary. + :vartype long_summary: str + :ivar description: The description. + :vartype description: str + :ivar offer_id: The offer id. Required. + :vartype offer_id: str + :ivar offer_type: The offer type. + :vartype offer_type: str + :ivar support_uri: The support uri. + :vartype support_uri: str + :ivar popularity: The popularity of the offer. + :vartype popularity: int + :ivar offer_publisher: The publisher of the offer. + :vartype offer_publisher: ~azure.mgmt.edgemarketplace.models.OfferPublisher + :ivar availability: The availability of the offer. Known values are: "Private" and "Public". + :vartype availability: str or ~azure.mgmt.edgemarketplace.models.OfferAvailability + :ivar release_type: The release type of the offer. Known values are: "Preview" and "GA". + :vartype release_type: str or ~azure.mgmt.edgemarketplace.models.OfferReleaseType + :ivar icon_file_uris: The icon files. + :vartype icon_file_uris: ~azure.mgmt.edgemarketplace.models.IconFileUris + :ivar terms_and_conditions: The terms and conditions. + :vartype terms_and_conditions: ~azure.mgmt.edgemarketplace.models.TermsAndConditions + :ivar category_ids: The category ids. + :vartype category_ids: list[str] + :ivar operating_systems: The operating systems. + :vartype operating_systems: list[str] + """ + + _validation = { + "display_name": {"required": True}, + "offer_id": {"required": True}, + } + + _attribute_map = { + "display_name": {"key": "displayName", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "long_summary": {"key": "longSummary", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "offer_id": {"key": "offerId", "type": "str"}, + "offer_type": {"key": "offerType", "type": "str"}, + "support_uri": {"key": "supportUri", "type": "str"}, + "popularity": {"key": "popularity", "type": "int"}, + "offer_publisher": {"key": "offerPublisher", "type": "OfferPublisher"}, + "availability": {"key": "availability", "type": "str"}, + "release_type": {"key": "releaseType", "type": "str"}, + "icon_file_uris": {"key": "iconFileUris", "type": "IconFileUris"}, + "terms_and_conditions": {"key": "termsAndConditions", "type": "TermsAndConditions"}, + "category_ids": {"key": "categoryIds", "type": "[str]"}, + "operating_systems": {"key": "operatingSystems", "type": "[str]"}, + } + + def __init__( + self, + *, + display_name: str, + offer_id: str, + summary: Optional[str] = None, + long_summary: Optional[str] = None, + description: Optional[str] = None, + offer_type: Optional[str] = None, + support_uri: Optional[str] = None, + popularity: Optional[int] = None, + offer_publisher: Optional["_models.OfferPublisher"] = None, + availability: Optional[Union[str, "_models.OfferAvailability"]] = None, + release_type: Optional[Union[str, "_models.OfferReleaseType"]] = None, + icon_file_uris: Optional["_models.IconFileUris"] = None, + terms_and_conditions: Optional["_models.TermsAndConditions"] = None, + category_ids: Optional[List[str]] = None, + operating_systems: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_name: The display name of the offer. Required. + :paramtype display_name: str + :keyword summary: The summary. + :paramtype summary: str + :keyword long_summary: The long summary. + :paramtype long_summary: str + :keyword description: The description. + :paramtype description: str + :keyword offer_id: The offer id. Required. + :paramtype offer_id: str + :keyword offer_type: The offer type. + :paramtype offer_type: str + :keyword support_uri: The support uri. + :paramtype support_uri: str + :keyword popularity: The popularity of the offer. + :paramtype popularity: int + :keyword offer_publisher: The publisher of the offer. + :paramtype offer_publisher: ~azure.mgmt.edgemarketplace.models.OfferPublisher + :keyword availability: The availability of the offer. Known values are: "Private" and "Public". + :paramtype availability: str or ~azure.mgmt.edgemarketplace.models.OfferAvailability + :keyword release_type: The release type of the offer. Known values are: "Preview" and "GA". + :paramtype release_type: str or ~azure.mgmt.edgemarketplace.models.OfferReleaseType + :keyword icon_file_uris: The icon files. + :paramtype icon_file_uris: ~azure.mgmt.edgemarketplace.models.IconFileUris + :keyword terms_and_conditions: The terms and conditions. + :paramtype terms_and_conditions: ~azure.mgmt.edgemarketplace.models.TermsAndConditions + :keyword category_ids: The category ids. + :paramtype category_ids: list[str] + :keyword operating_systems: The operating systems. + :paramtype operating_systems: list[str] + """ + super().__init__(**kwargs) + self.display_name = display_name + self.summary = summary + self.long_summary = long_summary + self.description = description + self.offer_id = offer_id + self.offer_type = offer_type + self.support_uri = support_uri + self.popularity = popularity + self.offer_publisher = offer_publisher + self.availability = availability + self.release_type = release_type + self.icon_file_uris = icon_file_uris + self.terms_and_conditions = terms_and_conditions + self.category_ids = category_ids + self.operating_systems = operating_systems + + +class OfferListResult(_serialization.Model): + """The response of a Offer list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Offer items on this page. Required. + :vartype value: list[~azure.mgmt.edgemarketplace.models.Offer] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Offer]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Offer"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Offer items on this page. Required. + :paramtype value: list[~azure.mgmt.edgemarketplace.models.Offer] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OfferProperties(_serialization.Model): + """The offer properties. + + All required parameters must be populated in order to send to Azure. + + :ivar content_version: The content version. + :vartype content_version: str + :ivar content_url: The content url. + :vartype content_url: str + :ivar offer_content: The offer content. Required. + :vartype offer_content: ~azure.mgmt.edgemarketplace.models.OfferContent + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.edgemarketplace.models.ResourceProvisioningState + :ivar marketplace_skus: The marketplace skus. + :vartype marketplace_skus: list[~azure.mgmt.edgemarketplace.models.MarketplaceSku] + """ + + _validation = { + "offer_content": {"required": True}, + } + + _attribute_map = { + "content_version": {"key": "contentVersion", "type": "str"}, + "content_url": {"key": "contentUrl", "type": "str"}, + "offer_content": {"key": "offerContent", "type": "OfferContent"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "marketplace_skus": {"key": "marketplaceSkus", "type": "[MarketplaceSku]"}, + } + + def __init__( + self, + *, + offer_content: "_models.OfferContent", + content_version: Optional[str] = None, + content_url: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = None, + marketplace_skus: Optional[List["_models.MarketplaceSku"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_version: The content version. + :paramtype content_version: str + :keyword content_url: The content url. + :paramtype content_url: str + :keyword offer_content: The offer content. Required. + :paramtype offer_content: ~azure.mgmt.edgemarketplace.models.OfferContent + :keyword provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.edgemarketplace.models.ResourceProvisioningState + :keyword marketplace_skus: The marketplace skus. + :paramtype marketplace_skus: list[~azure.mgmt.edgemarketplace.models.MarketplaceSku] + """ + super().__init__(**kwargs) + self.content_version = content_version + self.content_url = content_url + self.offer_content = offer_content + self.provisioning_state = provisioning_state + self.marketplace_skus = marketplace_skus + + +class OfferPublisher(_serialization.Model): + """The offer publisher. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher_id: The publisher Id. Required. + :vartype publisher_id: str + :ivar publisher_display_name: The publisher name. Required. + :vartype publisher_display_name: str + """ + + _validation = { + "publisher_id": {"required": True}, + "publisher_display_name": {"required": True}, + } + + _attribute_map = { + "publisher_id": {"key": "publisherId", "type": "str"}, + "publisher_display_name": {"key": "publisherDisplayName", "type": "str"}, + } + + def __init__(self, *, publisher_id: str, publisher_display_name: str, **kwargs: Any) -> None: + """ + :keyword publisher_id: The publisher Id. Required. + :paramtype publisher_id: str + :keyword publisher_display_name: The publisher name. Required. + :paramtype publisher_display_name: str + """ + super().__init__(**kwargs) + self.publisher_id = publisher_id + self.publisher_display_name = publisher_display_name + + +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 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.edgemarketplace.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.edgemarketplace.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.edgemarketplace.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.edgemarketplace.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.edgemarketplace.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Publisher(ProxyResource): + """A publisher who provides offers. + + 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.edgemarketplace.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.edgemarketplace.models.PublisherProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "PublisherProperties"}, + } + + def __init__(self, *, properties: Optional["_models.PublisherProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.edgemarketplace.models.PublisherProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class PublisherListResult(_serialization.Model): + """The response of a Publisher list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Publisher items on this page. Required. + :vartype value: list[~azure.mgmt.edgemarketplace.models.Publisher] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Publisher]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Publisher"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Publisher items on this page. Required. + :paramtype value: list[~azure.mgmt.edgemarketplace.models.Publisher] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PublisherProperties(_serialization.Model): + """Publisher properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The resource provisioning state. Required. Known values are: + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.edgemarketplace.models.ResourceProvisioningState + """ + + _validation = { + "provisioning_state": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, provisioning_state: Union[str, "_models.ResourceProvisioningState"], **kwargs: Any) -> None: + """ + :keyword provisioning_state: The resource provisioning state. Required. Known values are: + "Succeeded", "Failed", and "Canceled". + :paramtype provisioning_state: str or + ~azure.mgmt.edgemarketplace.models.ResourceProvisioningState + """ + super().__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class SkuOperatingSystem(_serialization.Model): + """The sku operating system. + + All required parameters must be populated in order to send to Azure. + + :ivar family: The family of the operating system. + :vartype family: str + :ivar type: The type of the operating system. + :vartype type: str + :ivar name: The name of the operating system. Required. + :vartype name: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "family": {"key": "family", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: str, family: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword family: The family of the operating system. + :paramtype family: str + :keyword type: The type of the operating system. + :paramtype type: str + :keyword name: The name of the operating system. Required. + :paramtype name: str + """ + super().__init__(**kwargs) + self.family = family + self.type = type + self.name = name + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.edgemarketplace.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.edgemarketplace.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.edgemarketplace.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.edgemarketplace.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TermsAndConditions(_serialization.Model): + """Terms and conditions. + + :ivar legal_terms_uri: The legal terms and conditions uri. + :vartype legal_terms_uri: str + :ivar legal_terms_type: The type of legal terms. + :vartype legal_terms_type: str + :ivar privacy_policy_uri: The privacy policy uri. + :vartype privacy_policy_uri: str + """ + + _attribute_map = { + "legal_terms_uri": {"key": "legalTermsUri", "type": "str"}, + "legal_terms_type": {"key": "legalTermsType", "type": "str"}, + "privacy_policy_uri": {"key": "privacyPolicyUri", "type": "str"}, + } + + def __init__( + self, + *, + legal_terms_uri: Optional[str] = None, + legal_terms_type: Optional[str] = None, + privacy_policy_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword legal_terms_uri: The legal terms and conditions uri. + :paramtype legal_terms_uri: str + :keyword legal_terms_type: The type of legal terms. + :paramtype legal_terms_type: str + :keyword privacy_policy_uri: The privacy policy uri. + :paramtype privacy_policy_uri: str + """ + super().__init__(**kwargs) + self.legal_terms_uri = legal_terms_uri + self.legal_terms_type = legal_terms_type + self.privacy_policy_uri = privacy_policy_uri diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_patch.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/__init__.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/__init__.py new file mode 100644 index 000000000000..3eb9153739e6 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._publishers_operations import PublishersOperations +from ._operations import Operations +from ._offers_operations import OffersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PublishersOperations", + "Operations", + "OffersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_offers_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_offers_operations.py new file mode 100644 index 000000000000..2ce63f3f7077 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_offers_operations.py @@ -0,0 +1,852 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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_uri: str, + *, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: 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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: 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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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_uri: str, offer_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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "offerId": _SERIALIZER.url("offer_id", offer_id, "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_generate_access_token_request(resource_uri: str, offer_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-08-01")) + 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", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "offerId": _SERIALIZER.url("offer_id", offer_id, "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_get_access_token_request(resource_uri: str, offer_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-08-01")) + 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", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "offerId": _SERIALIZER.url("offer_id", offer_id, "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 OffersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.EdgeMarketPlaceMgmtClient`'s + :attr:`offers` 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_uri: str, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Offer"]: + """List Offer resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgemarketplace.models.Offer] + :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.OfferListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OfferListResult", 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) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers"} + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Offer"]: + """List Offer resources by subscription. + + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgemarketplace.models.Offer] + :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.OfferListResult] = 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, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OfferListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers" + } + + @distributed_trace + def get(self, resource_uri: str, offer_id: str, **kwargs: Any) -> _models.Offer: + """Get a Offer. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Offer or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.Offer + :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.Offer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + offer_id=offer_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("Offer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}"} + + def _generate_access_token_initial( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenRequest, IO], **kwargs: Any + ) -> Optional[_models.DiskAccessToken]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DiskAccessToken]] = 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, "AccessTokenRequest") + + request = build_generate_access_token_request( + resource_uri=resource_uri, + offer_id=offer_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_access_token_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DiskAccessToken", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_access_token_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken" + } + + @overload + def begin_generate_access_token( + self, + resource_uri: str, + offer_id: str, + body: _models.AccessTokenRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenRequest + :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 DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_access_token( + self, resource_uri: str, offer_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_access_token( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenRequest, IO], **kwargs: Any + ) -> LROPoller[_models.DiskAccessToken]: + """A long-running resource action. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Is either a AccessTokenRequest type or a IO + type. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenRequest 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 DiskAccessToken or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgemarketplace.models.DiskAccessToken] + :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.DiskAccessToken] = 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._generate_access_token_initial( + resource_uri=resource_uri, + offer_id=offer_id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiskAccessToken", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_access_token.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken" + } + + @overload + def get_access_token( + self, + resource_uri: str, + offer_id: str, + body: _models.AccessTokenReadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenReadRequest + :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: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_access_token( + self, resource_uri: str, offer_id: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_access_token( + self, resource_uri: str, offer_id: str, body: Union[_models.AccessTokenReadRequest, IO], **kwargs: Any + ) -> _models.DiskAccessToken: + """get access token. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param offer_id: Id of the offer. Required. + :type offer_id: str + :param body: The content of the action request. Is either a AccessTokenReadRequest type or a IO + type. Required. + :type body: ~azure.mgmt.edgemarketplace.models.AccessTokenReadRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiskAccessToken or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.DiskAccessToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DiskAccessToken] = 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, "AccessTokenReadRequest") + + request = build_get_access_token_request( + resource_uri=resource_uri, + offer_id=offer_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_access_token.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("DiskAccessToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_token.metadata = { + "url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken" + } diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_operations.py new file mode 100644 index 000000000000..28be4251788e --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.EdgeMarketplace/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.EdgeMarketPlaceMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgemarketplace.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.EdgeMarketplace/operations"} diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_patch.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_publishers_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_publishers_operations.py new file mode 100644 index 000000000000..b0274cf3b2be --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/operations/_publishers_operations.py @@ -0,0 +1,441 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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_uri: str, + *, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: 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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: 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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/publishers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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_uri: str, publisher_name: 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-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str", pattern=r"^.*$"), + } + + _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 PublishersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgemarketplace.EdgeMarketPlaceMgmtClient`'s + :attr:`publishers` 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_uri: str, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Publisher"]: + """List Publisher resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgemarketplace.models.Publisher] + :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.PublisherListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", 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) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers"} + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + skip: int = 0, + maxpagesize: Optional[int] = None, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Publisher"]: + """List Publisher resources in subscription. + + :param top: The number of result items to return. Default value is None. + :type top: int + :param skip: The number of result items to skip. Default value is 0. + :type skip: int + :param maxpagesize: The maximum number of result items per page. Default value is None. + :type maxpagesize: int + :param filter: Filter the result list using the given expression. Default value is None. + :type filter: str + :param skip_token: Skip over when retrieving results. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgemarketplace.models.Publisher] + :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.PublisherListResult] = 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, + top=top, + skip=skip, + maxpagesize=maxpagesize, + filter=filter, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublisherListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/publishers" + } + + @distributed_trace + def get(self, resource_uri: str, publisher_name: str, **kwargs: Any) -> _models.Publisher: + """Get a Publisher. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param publisher_name: Name of the publisher. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.edgemarketplace.models.Publisher + :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.Publisher] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + publisher_name=publisher_name, + 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("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}"} diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/py.typed b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/azure/mgmt/edgemarketplace/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/generate_access_token.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/generate_access_token.py new file mode 100644 index 000000000000..320d291c6246 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/generate_access_token.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.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python generate_access_token.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.offers.begin_generate_access_token( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + offer_id="0001-com-ubuntu-pro-jammy", + body={ + "deviceSku": "edge", + "deviceVersion": "1.0.18062.1", + "edgeMarketPlaceRegion": "EastUS2Euap", + "egeMarketPlaceResourceId": "testid", + "hypervGeneration": "V2", + "marketPlaceSku": "2022-datacenter-azure-edition-core", + "marketPlaceSkuVersion": "20348.1129.221007", + "publisherName": "ubuntu", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/GenerateAccessToken.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_access_token.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_access_token.py new file mode 100644 index 000000000000..c6c680e65bad --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_access_token.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.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python get_access_token.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.offers.get_access_token( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + offer_id="0001-com-ubuntu-pro-jammy", + body={"requestId": "1.0.18062.1"}, + ) + print(response) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/GetAccessToken.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_offer.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_offer.py new file mode 100644 index 000000000000..c9d3d9e42abf --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_offer.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python get_offer.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.offers.get( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + offer_id="0001-com-ubuntu-pro-jammy", + ) + print(response) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/GetOffer.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_publisher.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_publisher.py new file mode 100644 index 000000000000..ab81c30422ba --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/get_publisher.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python get_publisher.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.publishers.get( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + publisher_name="canonical", + ) + print(response) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/GetPublisher.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers.py new file mode 100644 index 000000000000..8de427bfa497 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python list_offers.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.offers.list( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/ListOffers.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers_by_subscription.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers_by_subscription.py new file mode 100644 index 000000000000..651f6581a95d --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_offers_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python list_offers_by_subscription.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="4bed37fd-19a1-4d31-8b44-40267555bec5", + ) + + response = client.offers.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/ListOffersBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_operations.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_operations.py new file mode 100644 index 000000000000..12c97484e6ec --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python list_operations.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/ListOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers.py new file mode 100644 index 000000000000..f624cb7c1f5e --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python list_publishers.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.publishers.list( + resource_uri="subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/ListPublishers.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers_by_subscription.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers_by_subscription.py new file mode 100644 index 000000000000..e887c82c79fa --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/generated_samples/list_publishers_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.edgemarketplace import EdgeMarketPlaceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-edgemarketplace +# USAGE + python list_publishers_by_subscription.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 = EdgeMarketPlaceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="4bed37fd-19a1-4d31-8b44-40267555bec5", + ) + + response = client.publishers.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/stable/2023-08-01/examples/ListPublishersBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/sdk_packaging.toml b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/sdk_packaging.toml new file mode 100644 index 000000000000..e042915a3563 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-edgemarketplace" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/setup.py b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/setup.py new file mode 100644 index 000000000000..64118dee5b1f --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-edgemarketplace" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/edgemarketplace/ci.yml b/sdk/edgemarketplace/ci.yml new file mode 100644 index 000000000000..40bedf96b791 --- /dev/null +++ b/sdk/edgemarketplace/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/edgemarketplace/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/edgemarketplace/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: edgemarketplace + TestProxy: true + Artifacts: + - name: azure-mgmt-edgemarketplace + safeName: azuremgmtedgemarketplace diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json b/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json index 9be5bd944afa..9bc55dd5988d 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json +++ b/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json @@ -1,11 +1,14 @@ { - "commit": "ba733cb319d327bae00886c47975d624145834b0", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/edgeorder/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.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/edgeorder/resource-manager/readme.md" + "autorest_command": "autorest specification/edgeorder/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/edgeorder/resource-manager/readme.md", + "package-2022-05-preview": "2023-03-29 14:53:29 +0530 cc6daf536e5ae22f8bdead716079943d571ec44b Microsoft.EdgeOrder/preview/2022-05-01-preview/edgeorder.json", + "package-2021-12": "2021-11-11 11:13:03 +0530 34018925632ef75ef5416e3add65324e0a12489f Microsoft.EdgeOrder/stable/2021-12-01/edgeorder.json", + "package-2020-12-preview": "2021-10-12 09:02:43 +0530 d12092e83d16cca65e17974c3c5fcb3031fca447 Microsoft.EdgeOrder/preview/2020-12-01-preview/edgeorder.json" } \ No newline at end of file diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py index bd98f0c74a78..6f4daf192380 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = EdgeOrderManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(EdgeOrderManagementClient, self).__init__( @@ -114,7 +116,7 @@ def addresses(self): else: raise ValueError("API version {} does not have operation group 'addresses'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -128,7 +130,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def order_items(self): @@ -142,7 +144,7 @@ def order_items(self): else: raise ValueError("API version {} does not have operation group 'order_items'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def orders(self): @@ -156,7 +158,7 @@ def orders(self): else: raise ValueError("API version {} does not have operation group 'orders'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def products_and_configurations(self): @@ -170,7 +172,7 @@ def products_and_configurations(self): else: raise ValueError("API version {} does not have operation group 'products_and_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_operations_mixin.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_operations_mixin.py index eb12d2f833cc..7e28050310e0 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_operations_mixin.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py index 25467dfc00bb..a00658b1fc19 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py @@ -631,7 +631,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -664,8 +664,9 @@ 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)) @@ -743,6 +744,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,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 str(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) @@ -893,6 +894,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): @@ -905,9 +908,18 @@ 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) @@ -952,7 +964,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: @@ -1273,7 +1287,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1297,7 +1311,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py index fbc912c1611a..c9548fc97769 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = EdgeOrderManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(EdgeOrderManagementClient, self).__init__( @@ -114,7 +116,7 @@ def addresses(self): else: raise ValueError("API version {} does not have operation group 'addresses'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -128,7 +130,7 @@ def operations(self): else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def order_items(self): @@ -142,7 +144,7 @@ def order_items(self): else: raise ValueError("API version {} does not have operation group 'order_items'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def orders(self): @@ -156,7 +158,7 @@ def orders(self): else: raise ValueError("API version {} does not have operation group 'orders'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def products_and_configurations(self): @@ -170,7 +172,7 @@ def products_and_configurations(self): else: raise ValueError("API version {} does not have operation group 'products_and_configurations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_operations_mixin.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_operations_mixin.py index 5f6d25173fa2..d8b472b0e400 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_operations_mixin.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from .._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, AsyncIterable, IO, Optional, Union from azure.core.async_paging import AsyncItemPaged diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_configuration.py index 555ae3a0bb31..337a445758a4 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-12-01-preview"] = kwargs.pop("api_version", "2020-12-01-preview") + api_version: str = kwargs.pop("api_version", "2020-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_edge_order_management_client.py index 61722abc6e42..13d59cc7b147 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_edge_order_management_client.py @@ -50,7 +50,7 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_metadata.json b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_metadata.json index d0504ad2a65a..5d13214f2ba4 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_metadata.json +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_metadata.json @@ -107,8 +107,10 @@ "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"], \"azure.core.polling\": [\"LROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"], \"azure.core.polling\": [\"AsyncLROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"], \"azure.core.polling\": [\"LROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"], \"azure.core.polling\": [\"AsyncLROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", "operations": { "list_operations" : { "sync": { diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_vendor.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_vendor.py index 7f8e08518951..0eed71f1979f 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_vendor.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class EdgeOrderManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_version.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_version.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_configuration.py index bf2580b269e9..bfb346283856 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-12-01-preview"] = kwargs.pop("api_version", "2020-12-01-preview") + api_version: str = kwargs.pop("api_version", "2020-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_edge_order_management_client.py index abf5d0cdf469..dbf6dc2f40b2 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/_edge_order_management_client.py @@ -50,7 +50,7 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/operations/_edge_order_management_client_operations.py index 0f10a5bb5943..f030d186df4a 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/aio/operations/_edge_order_management_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -56,10 +56,6 @@ ) from .._vendor import EdgeOrderManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +63,12 @@ class EdgeOrderManagementClientOperationsMixin( EdgeOrderManagementClientMixinABC ): # pylint: disable=too-many-public-methods + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @distributed_trace def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """This method gets all the operations that are exposed for customer. @@ -80,8 +82,8 @@ def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_operations") or "2020-12-01-preview") ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -133,8 +135,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,8 +173,11 @@ def list_addresses_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_addresses_at_subscription_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -226,8 +232,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,8 +344,9 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -353,7 +361,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -404,8 +412,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,8 +515,8 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_configurations") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -522,7 +531,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -572,8 +581,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,8 +619,9 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families_metadata") or "2020-12-01-preview"), ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) @@ -664,8 +675,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -700,8 +712,9 @@ def list_order_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_subscription_level") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -755,8 +768,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,8 +818,11 @@ def list_order_items_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_order_items_at_subscription_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -861,8 +878,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,8 +921,11 @@ def list_addresses_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_addresses_at_resource_group_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -960,8 +981,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1007,8 +1029,8 @@ async def get_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_address_by_name") or "2020-12-01-preview") ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -1024,8 +1046,9 @@ async def get_address_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1064,8 +1087,9 @@ async def _create_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_create_address_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -1073,7 +1097,7 @@ async def _create_address_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -1093,8 +1117,9 @@ async def _create_address_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1238,8 +1263,8 @@ async def begin_create_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_address") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -1299,8 +1324,9 @@ async def _delete_address_by_name_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_address_by_name_initial") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1316,8 +1342,9 @@ async def _delete_address_by_name_initial( # pylint: disable=inconsistent-retur request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1362,8 +1389,9 @@ async def begin_delete_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_address_by_name") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1423,8 +1451,9 @@ async def _update_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_update_address_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -1432,7 +1461,7 @@ async def _update_address_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -1453,8 +1482,9 @@ async def _update_address_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1609,8 +1639,8 @@ async def begin_update_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_address") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -1678,8 +1708,9 @@ def list_order_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_resource_group_level") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -1734,8 +1765,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1781,8 +1813,8 @@ async def get_order_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_by_name") or "2020-12-01-preview") ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) @@ -1799,8 +1831,9 @@ async def get_order_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1856,8 +1889,11 @@ def list_order_items_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_order_items_at_resource_group_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -1914,8 +1950,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1965,8 +2002,9 @@ async def get_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("get_order_item_by_name") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -1983,8 +2021,9 @@ async def get_order_item_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2023,8 +2062,9 @@ async def _create_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_create_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -2032,7 +2072,7 @@ async def _create_order_item_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -2052,8 +2092,9 @@ async def _create_order_item_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2192,8 +2233,9 @@ async def begin_create_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_create_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -2253,8 +2295,9 @@ async def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_order_item_by_name_initial") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2270,8 +2313,9 @@ async def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-re request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2314,8 +2358,9 @@ async def begin_delete_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_order_item_by_name") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2375,8 +2420,9 @@ async def _update_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_update_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -2384,7 +2430,7 @@ async def _update_order_item_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -2405,8 +2451,9 @@ async def _update_order_item_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2555,8 +2602,9 @@ async def begin_update_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_update_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -2697,8 +2745,8 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("cancel_order_item") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2706,7 +2754,7 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -2726,8 +2774,9 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2762,8 +2811,9 @@ async def _return_order_item_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_return_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2771,7 +2821,7 @@ async def _return_order_item_initial( # pylint: disable=inconsistent-return-sta content_type = content_type or "application/json" _json = None _content = None - if isinstance(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") @@ -2791,8 +2841,9 @@ async def _return_order_item_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2917,8 +2968,9 @@ async def begin_return_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_return_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_edge_order_management_client_enums.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_edge_order_management_client_enums.py index 077ce6077a3a..17a757198351 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_edge_order_management_client_enums.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_edge_order_management_client_enums.py @@ -138,6 +138,8 @@ class LengthHeightUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Inch, applicable for West US.""" CM = "CM" """Centimeter.""" + IN_ENUM = "IN" + """Inch, applicable for West US.""" class LinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_models_py3.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_models_py3.py index 8b5beec7cf03..74a85a7364fc 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_models_py3.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/models/_models_py3.py @@ -1024,7 +1024,7 @@ class Dimensions(_serialization.Model): :ivar width: Width of the device. :vartype width: float :ivar length_height_unit: Unit for the dimensions of length, height and width. Known values - are: "IN" and "CM". + are: "IN", "CM", and "IN". :vartype length_height_unit: str or ~azure.mgmt.edgeorder.v2020_12_01_preview.models.LengthHeightUnit :ivar weight: Weight of the device. diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/operations/_edge_order_management_client_operations.py index 9f8fb6b4edd6..c882c1d6b470 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2020_12_01_preview/operations/_edge_order_management_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import EdgeOrderManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import EdgeOrderManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_operations_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,9 +64,7 @@ def build_list_addresses_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +73,7 @@ def build_list_addresses_at_subscription_level_request( "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") @@ -102,9 +94,7 @@ def build_list_product_families_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,7 +106,7 @@ def build_list_product_families_request( "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") @@ -139,9 +129,7 @@ def build_list_configurations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +141,7 @@ def build_list_configurations_request( "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") @@ -174,9 +162,7 @@ def build_list_product_families_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +173,7 @@ def build_list_product_families_metadata_request( "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") @@ -206,9 +192,7 @@ def build_list_order_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +201,7 @@ def build_list_order_at_subscription_level_request( "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") @@ -241,9 +225,7 @@ def build_list_order_items_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +234,7 @@ def build_list_order_items_at_subscription_level_request( "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") @@ -280,9 +262,7 @@ def build_list_addresses_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +277,7 @@ def build_list_addresses_at_resource_group_level_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,9 +298,7 @@ def build_get_address_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -338,7 +316,7 @@ def build_get_address_by_name_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") @@ -355,9 +333,7 @@ def build_create_address_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -376,7 +352,7 @@ def build_create_address_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") @@ -395,9 +371,7 @@ def build_delete_address_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -415,7 +389,7 @@ def build_delete_address_by_name_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") @@ -432,9 +406,7 @@ def build_update_address_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -453,7 +425,7 @@ def build_update_address_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") @@ -474,9 +446,7 @@ def build_list_order_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -491,7 +461,7 @@ def build_list_order_at_resource_group_level_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") @@ -510,9 +480,7 @@ def build_get_order_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -529,7 +497,7 @@ def build_get_order_by_name_request( "location": _SERIALIZER.url("location", location, "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") @@ -552,9 +520,7 @@ def build_list_order_items_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -569,7 +535,7 @@ def build_list_order_items_at_resource_group_level_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") @@ -592,9 +558,7 @@ def build_get_order_item_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -610,7 +574,7 @@ def build_get_order_item_by_name_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") @@ -629,9 +593,7 @@ def build_create_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -648,7 +610,7 @@ def build_create_order_item_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") @@ -667,9 +629,7 @@ def build_delete_order_item_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -685,7 +645,7 @@ def build_delete_order_item_by_name_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") @@ -707,9 +667,7 @@ def build_update_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -726,7 +684,7 @@ def build_update_order_item_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") @@ -747,9 +705,7 @@ def build_cancel_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -766,7 +722,7 @@ def build_cancel_order_item_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") @@ -785,9 +741,7 @@ def build_return_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -804,7 +758,7 @@ def build_return_order_item_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") @@ -820,6 +774,12 @@ def build_return_order_item_request( class EdgeOrderManagementClientOperationsMixin( EdgeOrderManagementClientMixinABC ): # pylint: disable=too-many-public-methods + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @distributed_trace def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: """This method gets all the operations that are exposed for customer. @@ -833,8 +793,8 @@ def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_operations") or "2020-12-01-preview") ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -886,8 +846,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -923,8 +884,11 @@ def list_addresses_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_addresses_at_subscription_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -979,8 +943,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1090,8 +1055,9 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -1106,7 +1072,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -1157,8 +1123,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1259,8 +1226,8 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_configurations") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -1275,7 +1242,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -1325,8 +1292,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1362,8 +1330,9 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families_metadata") or "2020-12-01-preview"), ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) @@ -1417,8 +1386,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1453,8 +1423,9 @@ def list_order_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_subscription_level") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -1508,8 +1479,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1557,8 +1529,11 @@ def list_order_items_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_order_items_at_subscription_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -1614,8 +1589,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1656,8 +1632,11 @@ def list_addresses_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_addresses_at_resource_group_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -1713,8 +1692,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1760,8 +1740,8 @@ def get_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_address_by_name") or "2020-12-01-preview") ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -1777,8 +1757,9 @@ def get_address_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1817,8 +1798,9 @@ def _create_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_create_address_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -1826,7 +1808,7 @@ def _create_address_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -1846,8 +1828,9 @@ def _create_address_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1991,8 +1974,8 @@ def begin_create_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_address") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -2052,8 +2035,9 @@ def _delete_address_by_name_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_address_by_name_initial") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2069,8 +2053,9 @@ def _delete_address_by_name_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2115,8 +2100,9 @@ def begin_delete_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_address_by_name") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2176,8 +2162,9 @@ def _update_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_update_address_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -2185,7 +2172,7 @@ def _update_address_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -2206,8 +2193,9 @@ def _update_address_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2362,8 +2350,8 @@ def begin_update_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_address") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -2431,8 +2419,9 @@ def list_order_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_resource_group_level") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -2487,8 +2476,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2534,8 +2524,8 @@ def get_order_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_by_name") or "2020-12-01-preview") ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) @@ -2552,8 +2542,9 @@ def get_order_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2609,8 +2600,11 @@ def list_order_items_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_order_items_at_resource_group_level") or "2020-12-01-preview" + ), ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -2667,8 +2661,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2718,8 +2713,9 @@ def get_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("get_order_item_by_name") or "2020-12-01-preview"), ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -2736,8 +2732,9 @@ def get_order_item_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2776,8 +2773,9 @@ def _create_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_create_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -2785,7 +2783,7 @@ def _create_order_item_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -2805,8 +2803,9 @@ def _create_order_item_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2945,8 +2944,9 @@ def begin_create_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_create_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -3006,8 +3006,9 @@ def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_order_item_by_name_initial") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3023,8 +3024,9 @@ def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-return-s 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3067,8 +3069,9 @@ def begin_delete_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_order_item_by_name") or "2020-12-01-preview"), ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -3128,8 +3131,9 @@ def _update_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_update_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -3137,7 +3141,7 @@ def _update_order_item_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -3158,8 +3162,9 @@ def _update_order_item_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3308,8 +3313,9 @@ def begin_update_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_update_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -3450,8 +3456,8 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("cancel_order_item") or "2020-12-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3459,7 +3465,7 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -3479,8 +3485,9 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3515,8 +3522,9 @@ def _return_order_item_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_return_order_item_initial") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3524,7 +3532,7 @@ def _return_order_item_initial( # pylint: disable=inconsistent-return-statement content_type = content_type or "application/json" _json = None _content = None - if isinstance(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") @@ -3544,8 +3552,9 @@ def _return_order_item_initial( # pylint: disable=inconsistent-return-statement 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3670,8 +3679,9 @@ def begin_return_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-12-01-preview") + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_return_order_item") or "2020-12-01-preview"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_configuration.py index 9842256d512b..55d4b04782f8 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", "2021-12-01") + api_version: str = kwargs.pop("api_version", "2021-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_edge_order_management_client.py index 30dbd3ca5bbf..64f08328ffa8 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_edge_order_management_client.py @@ -50,7 +50,7 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_metadata.json b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_metadata.json index afaa0d0192d4..cda892802e9e 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_metadata.json +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_metadata.json @@ -107,8 +107,10 @@ "operation_groups": { }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"], \"azure.core.polling\": [\"LROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"], \"azure.core.polling\": [\"AsyncLROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"], \"azure.core.polling\": [\"LROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"], \"azure.core.polling\": [\"AsyncLROPoller\"]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", "operations": { "list_operations" : { "sync": { diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_vendor.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_vendor.py index 7f8e08518951..0eed71f1979f 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_vendor.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import List, TYPE_CHECKING, cast +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest @@ -27,18 +27,6 @@ def _convert_request(request, files=None): 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) - - class EdgeOrderManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_version.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_version.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_configuration.py index cfdb96f35136..55b169788d98 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", "2021-12-01") + api_version: str = kwargs.pop("api_version", "2021-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_edge_order_management_client.py index 9275fbfdaacd..004de9a12837 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/_edge_order_management_client.py @@ -50,7 +50,7 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/operations/_edge_order_management_client_operations.py index 161c6f585578..85098f3bf6a1 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/aio/operations/_edge_order_management_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -56,10 +56,6 @@ ) from .._vendor import EdgeOrderManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +63,12 @@ class EdgeOrderManagementClientOperationsMixin( EdgeOrderManagementClientMixinABC ): # pylint: disable=too-many-public-methods + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @distributed_trace def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """This method gets all the operations that are exposed for customer. @@ -80,7 +82,9 @@ def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_operations") or "2021-12-01") + ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -131,8 +135,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,7 +173,10 @@ def list_addresses_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_addresses_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) error_map = { @@ -222,8 +230,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,7 +341,9 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_product_families") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -346,7 +357,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -397,8 +408,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,7 +510,9 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_configurations") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -512,7 +526,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -562,8 +576,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -599,7 +614,10 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families_metadata") or "2021-12-01"), + ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) error_map = { @@ -652,8 +670,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,7 +707,10 @@ def list_order_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) error_map = { @@ -741,8 +763,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +813,10 @@ def list_order_items_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_items_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) error_map = { @@ -845,8 +871,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -887,7 +914,10 @@ def list_addresses_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_addresses_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) error_map = { @@ -942,8 +972,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -989,7 +1020,9 @@ async def get_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_address_by_name") or "2021-12-01") + ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) request = build_get_address_by_name_request( @@ -1004,8 +1037,9 @@ async def get_address_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1044,14 +1078,16 @@ async def _create_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_create_address_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -1071,8 +1107,9 @@ async def _create_address_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1216,7 +1253,9 @@ async def begin_create_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_address") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1275,7 +1314,10 @@ async def _delete_address_by_name_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_address_by_name_initial") or "2021-12-01"), + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_address_by_name_request( @@ -1290,8 +1332,9 @@ async def _delete_address_by_name_initial( # pylint: disable=inconsistent-retur request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1336,7 +1379,9 @@ async def begin_delete_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_delete_address_by_name") or "2021-12-01") + ) 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) @@ -1395,14 +1440,16 @@ async def _update_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_update_address_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -1423,8 +1470,9 @@ async def _update_address_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1578,7 +1626,9 @@ async def begin_update_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_address") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1645,7 +1695,10 @@ def list_order_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) error_map = { @@ -1699,8 +1752,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1746,7 +1800,9 @@ async def get_order_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_by_name") or "2021-12-01") + ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) request = build_get_order_by_name_request( @@ -1762,8 +1818,9 @@ async def get_order_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1819,7 +1876,10 @@ def list_order_items_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_items_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) error_map = { @@ -1875,8 +1935,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1926,7 +1987,9 @@ async def get_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_item_by_name") or "2021-12-01") + ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) request = build_get_order_item_by_name_request( @@ -1942,8 +2005,9 @@ async def get_order_item_by_name( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1982,14 +2046,16 @@ async def _create_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_create_order_item_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -2009,8 +2075,9 @@ async def _create_order_item_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2148,7 +2215,9 @@ async def begin_create_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_order_item") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2207,7 +2276,10 @@ async def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-re _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_order_item_by_name_initial") or "2021-12-01"), + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_order_item_by_name_request( @@ -2222,8 +2294,9 @@ async def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-re request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2266,7 +2339,10 @@ async def begin_delete_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_order_item_by_name") or "2021-12-01"), + ) 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) @@ -2325,14 +2401,16 @@ async def _update_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_update_order_item_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -2353,8 +2431,9 @@ async def _update_order_item_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2503,7 +2582,9 @@ async def begin_update_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_order_item") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2642,14 +2723,16 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("cancel_order_item") or "2021-12-01") + ) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -2669,8 +2752,9 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2705,14 +2789,16 @@ async def _return_order_item_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_return_order_item_initial") or "2021-12-01") + ) 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(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") @@ -2732,8 +2818,9 @@ async def _return_order_item_initial( # pylint: disable=inconsistent-return-sta request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2858,7 +2945,9 @@ async def begin_return_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_return_order_item") or "2021-12-01") + ) 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) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_edge_order_management_client_enums.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_edge_order_management_client_enums.py index 08fee5827f42..492c44ae45bd 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_edge_order_management_client_enums.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_edge_order_management_client_enums.py @@ -149,6 +149,8 @@ class LengthHeightUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Inch, applicable for West US.""" CM = "CM" """Centimeter.""" + IN_ENUM = "IN" + """Inch, applicable for West US.""" class LinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_models_py3.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_models_py3.py index f71d4263aeda..8a458f472d42 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_models_py3.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/models/_models_py3.py @@ -1026,7 +1026,7 @@ class Dimensions(_serialization.Model): :ivar width: Width of the device. :vartype width: float :ivar length_height_unit: Unit for the dimensions of length, height and width. Known values - are: "IN" and "CM". + are: "IN", "CM", and "IN". :vartype length_height_unit: str or ~azure.mgmt.edgeorder.v2021_12_01.models.LengthHeightUnit :ivar weight: Weight of the device. :vartype weight: float diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/operations/_edge_order_management_client_operations.py index 0bbd3ea38795..b5bcc3d46510 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2021_12_01/operations/_edge_order_management_client_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import EdgeOrderManagementClientMixinABC, _convert_request, _format_url_section +from .._vendor import EdgeOrderManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ def build_list_operations_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +64,7 @@ def build_list_addresses_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +73,7 @@ def build_list_addresses_at_subscription_level_request( "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") @@ -98,7 +94,7 @@ def build_list_product_families_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -110,7 +106,7 @@ def build_list_product_families_request( "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") @@ -133,7 +129,7 @@ def build_list_configurations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,7 +141,7 @@ def build_list_configurations_request( "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") @@ -166,7 +162,7 @@ def build_list_product_families_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +173,7 @@ def build_list_product_families_metadata_request( "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") @@ -196,7 +192,7 @@ def build_list_order_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +201,7 @@ def build_list_order_at_subscription_level_request( "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") @@ -229,7 +225,7 @@ def build_list_order_items_at_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +234,7 @@ def build_list_order_items_at_subscription_level_request( "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") @@ -266,7 +262,7 @@ def build_list_addresses_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -281,7 +277,7 @@ def build_list_addresses_at_resource_group_level_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 +298,7 @@ def build_get_address_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -320,7 +316,7 @@ def build_get_address_by_name_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") @@ -337,7 +333,7 @@ def build_create_address_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -356,7 +352,7 @@ def build_create_address_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") @@ -375,7 +371,7 @@ def build_delete_address_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +389,7 @@ def build_delete_address_by_name_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") @@ -410,7 +406,7 @@ def build_update_address_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -429,7 +425,7 @@ def build_update_address_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") @@ -450,7 +446,7 @@ def build_list_order_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +461,7 @@ def build_list_order_at_resource_group_level_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") @@ -484,7 +480,7 @@ def build_get_order_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -501,7 +497,7 @@ def build_get_order_by_name_request( "location": _SERIALIZER.url("location", location, "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") @@ -524,7 +520,7 @@ def build_list_order_items_at_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -539,7 +535,7 @@ def build_list_order_items_at_resource_group_level_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") @@ -562,7 +558,7 @@ def build_get_order_item_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -578,7 +574,7 @@ def build_get_order_item_by_name_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") @@ -597,7 +593,7 @@ def build_create_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -614,7 +610,7 @@ def build_create_order_item_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") @@ -633,7 +629,7 @@ def build_delete_order_item_by_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -649,7 +645,7 @@ def build_delete_order_item_by_name_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") @@ -671,7 +667,7 @@ def build_update_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -688,7 +684,7 @@ def build_update_order_item_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") @@ -709,7 +705,7 @@ def build_cancel_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -726,7 +722,7 @@ def build_cancel_order_item_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") @@ -745,7 +741,7 @@ def build_return_order_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -762,7 +758,7 @@ def build_return_order_item_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") @@ -778,6 +774,12 @@ def build_return_order_item_request( class EdgeOrderManagementClientOperationsMixin( EdgeOrderManagementClientMixinABC ): # pylint: disable=too-many-public-methods + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @distributed_trace def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: """This method gets all the operations that are exposed for customer. @@ -790,7 +792,9 @@ def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_operations") or "2021-12-01") + ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -841,8 +845,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -877,7 +882,10 @@ def list_addresses_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_addresses_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) error_map = { @@ -931,8 +939,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1038,7 +1047,9 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_product_families") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -1052,7 +1063,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -1103,8 +1114,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1201,7 +1213,9 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("list_configurations") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -1215,7 +1229,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -1265,8 +1279,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1302,7 +1317,10 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_product_families_metadata") or "2021-12-01"), + ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) error_map = { @@ -1355,8 +1373,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1390,7 +1409,10 @@ def list_order_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) error_map = { @@ -1443,8 +1465,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1492,7 +1515,10 @@ def list_order_items_at_subscription_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_items_at_subscription_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) error_map = { @@ -1547,8 +1573,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1588,7 +1615,10 @@ def list_addresses_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_addresses_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) error_map = { @@ -1643,8 +1673,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1690,7 +1721,9 @@ def get_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_address_by_name") or "2021-12-01") + ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) request = build_get_address_by_name_request( @@ -1705,8 +1738,9 @@ def get_address_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1745,14 +1779,16 @@ def _create_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_create_address_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -1772,8 +1808,9 @@ def _create_address_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1914,7 +1951,9 @@ def begin_create_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_address") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1973,7 +2012,10 @@ def _delete_address_by_name_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_address_by_name_initial") or "2021-12-01"), + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_address_by_name_request( @@ -1988,8 +2030,9 @@ def _delete_address_by_name_initial( # pylint: disable=inconsistent-return-stat 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2034,7 +2077,9 @@ def begin_delete_address_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_delete_address_by_name") or "2021-12-01") + ) 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) @@ -2093,14 +2138,16 @@ def _update_address_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_update_address_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -2121,8 +2168,9 @@ def _update_address_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2273,7 +2321,9 @@ def begin_update_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_address") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2339,7 +2389,10 @@ def list_order_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) error_map = { @@ -2393,8 +2446,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2440,7 +2494,9 @@ def get_order_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_by_name") or "2021-12-01") + ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) request = build_get_order_by_name_request( @@ -2456,8 +2512,9 @@ def get_order_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2513,7 +2570,10 @@ def list_order_items_at_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_order_items_at_resource_group_level") or "2021-12-01"), + ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) error_map = { @@ -2569,8 +2629,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2620,7 +2681,9 @@ def get_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("get_order_item_by_name") or "2021-12-01") + ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) request = build_get_order_item_by_name_request( @@ -2636,8 +2699,9 @@ def get_order_item_by_name( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2676,14 +2740,16 @@ def _create_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_create_order_item_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -2703,8 +2769,9 @@ def _create_order_item_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2842,7 +2909,9 @@ def begin_create_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_create_order_item") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2901,7 +2970,10 @@ def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_order_item_by_name_initial") or "2021-12-01"), + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_order_item_by_name_request( @@ -2916,8 +2988,9 @@ def _delete_order_item_by_name_initial( # pylint: disable=inconsistent-return-s 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2960,7 +3033,10 @@ def begin_delete_order_item_by_name( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("begin_delete_order_item_by_name") or "2021-12-01"), + ) 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) @@ -3019,14 +3095,16 @@ def _update_order_item_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_update_order_item_initial") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -3047,8 +3125,9 @@ def _update_order_item_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3197,7 +3276,9 @@ def begin_update_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_update_order_item") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -3336,14 +3417,16 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("cancel_order_item") or "2021-12-01") + ) 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(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -3363,8 +3446,9 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3399,14 +3483,16 @@ def _return_order_item_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("_return_order_item_initial") or "2021-12-01") + ) 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(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") @@ -3426,8 +3512,9 @@ def _return_order_item_initial( # pylint: disable=inconsistent-return-statement 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -3552,7 +3639,9 @@ def begin_return_order_item( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("begin_return_order_item") or "2021-12-01") + ) 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) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_configuration.py index fb966bb503c3..39806b36444f 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") + api_version: str = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_edge_order_management_client.py index 0eb6f9ac818c..08e7440072f3 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_edge_order_management_client.py @@ -65,19 +65,27 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.addresses = AddressesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.addresses = AddressesOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) self.products_and_configurations = ProductsAndConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.order_items = OrderItemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" ) - self.order_items = OrderItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_vendor.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_vendor.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_version.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_version.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_configuration.py index e0a9854f2545..a24e91867ba2 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class EdgeOrderManagementClientConfiguration(Configuration): # pylint: disable= def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(EdgeOrderManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-05-01-preview"] = kwargs.pop("api_version", "2022-05-01-preview") + api_version: str = kwargs.pop("api_version", "2022-05-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_edge_order_management_client.py index ff9e58a74d43..a64fd6060642 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_edge_order_management_client.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/_edge_order_management_client.py @@ -66,19 +66,27 @@ def __init__( self._config = EdgeOrderManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.addresses = AddressesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.addresses = AddressesOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) self.products_and_configurations = ProductsAndConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.order_items = OrderItemsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" + ) + self.orders = OrdersOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" ) - self.order_items = OrderItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.orders = OrdersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_addresses_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_addresses_operations.py index 37f0c642648e..ca9dd20870b4 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_addresses_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_addresses_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -91,8 +88,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -148,8 +145,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,8 +194,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -254,8 +252,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -299,8 +298,8 @@ async def get(self, resource_group_name: str, address_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -316,8 +315,9 @@ async def get(self, resource_group_name: str, address_name: str, **kwargs: Any) 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,8 +356,8 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -365,7 +365,7 @@ async def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -385,8 +385,9 @@ async def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +534,8 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -594,8 +595,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -611,8 +612,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -622,8 +624,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" @@ -655,8 +661,8 @@ async def begin_delete(self, resource_group_name: str, address_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -716,8 +722,8 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -725,7 +731,7 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -746,8 +752,9 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -758,11 +765,15 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AddressResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -902,8 +913,8 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_operations.py index 26d739c9c702..c94143872d5c 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -70,8 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -123,8 +119,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_order_items_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_order_items_operations.py index edbd8fcb11fb..8348254d55a6 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_order_items_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_order_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,14 +38,10 @@ build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, - build_return_method_request, + build_return_request, build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +64,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -105,8 +102,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -163,8 +160,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,8 +217,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -278,8 +276,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,8 +329,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -348,8 +347,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,8 +388,8 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -397,7 +397,7 @@ async def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -417,8 +417,9 @@ async def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -560,8 +561,8 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -621,8 +622,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -638,8 +639,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,8 +651,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" @@ -680,8 +686,8 @@ async def begin_delete(self, resource_group_name: str, order_item_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -741,8 +747,8 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -750,7 +756,7 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -771,8 +777,9 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -783,11 +790,15 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OrderItemResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -921,8 +932,8 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -1063,8 +1074,8 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1072,7 +1083,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1092,8 +1103,9 @@ async def cancel( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1110,7 +1122,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel" } - async def _return_method_initial( # pylint: disable=inconsistent-return-statements + async def _return_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, order_item_name: str, @@ -1128,8 +1140,8 @@ async def _return_method_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1137,12 +1149,12 @@ async def _return_method_initial( # pylint: disable=inconsistent-return-stateme content_type = content_type or "application/json" _json = None _content = None - if isinstance(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") - request = build_return_method_request( + request = build_return_request( resource_group_name=resource_group_name, order_item_name=order_item_name, subscription_id=self._config.subscription_id, @@ -1150,15 +1162,16 @@ async def _return_method_initial( # pylint: disable=inconsistent-return-stateme content_type=content_type, json=_json, content=_content, - template_url=self._return_method_initial.metadata["url"], + template_url=self._return_initial.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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1168,10 +1181,14 @@ async def _return_method_initial( # pylint: disable=inconsistent-return-stateme 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _return_method_initial.metadata = { + _return_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return" } @@ -1283,8 +1300,8 @@ async def begin_return_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1292,7 +1309,7 @@ async def begin_return_method( 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._return_method_initial( # type: ignore + raw_result = await self._return_initial( # type: ignore resource_group_name=resource_group_name, order_item_name=order_item_name, return_order_item_details=return_order_item_details, diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_orders_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_orders_operations.py index e05f7359e933..c58c87a1e674 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_orders_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_orders_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -35,10 +34,6 @@ build_list_by_subscription_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -83,8 +79,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -139,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,8 +181,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) @@ -202,8 +199,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,8 +246,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -305,8 +303,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_products_and_configurations_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_products_and_configurations_operations.py index 8725ecb54353..ece180f49611 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_products_and_configurations_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/aio/operations/_products_and_configurations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -34,10 +34,6 @@ build_list_product_families_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_configurations( @@ -145,8 +142,8 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -161,7 +158,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -211,8 +208,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,8 +320,8 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -338,7 +336,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -389,8 +387,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -426,8 +425,8 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) @@ -481,8 +480,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_edge_order_management_client_enums.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_edge_order_management_client_enums.py index 4b162e190900..f6f1f4f3b1a3 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_edge_order_management_client_enums.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_edge_order_management_client_enums.py @@ -179,6 +179,8 @@ class LengthHeightUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Inch, applicable for West US.""" CM = "CM" """Centimeter.""" + IN_ENUM = "IN" + """Inch, applicable for West US.""" class LinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_models_py3.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_models_py3.py index e17f94798176..0a6ab27e8af3 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_models_py3.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/models/_models_py3.py @@ -1387,7 +1387,7 @@ class Dimensions(_serialization.Model): :ivar width: Width of the device. :vartype width: float :ivar length_height_unit: Unit for the dimensions of length, height and width. Known values - are: "IN" and "CM". + are: "IN", "CM", and "IN". :vartype length_height_unit: str or ~azure.mgmt.edgeorder.v2022_05_01_preview.models.LengthHeightUnit :ivar weight: Weight of the device. diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_addresses_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_addresses_operations.py index a5915d7e38e6..5cc3e4b6c471 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_addresses_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_addresses_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,9 +50,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_by_subscription_request( "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") @@ -94,9 +88,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +103,7 @@ def build_list_by_resource_group_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") @@ -132,9 +124,7 @@ def build_get_request(resource_group_name: str, address_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +142,7 @@ def build_get_request(resource_group_name: str, address_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,9 +159,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -190,7 +178,7 @@ def build_create_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") @@ -209,9 +197,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +215,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") @@ -246,9 +232,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -267,7 +251,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") @@ -300,6 +284,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -325,8 +310,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -382,8 +367,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,8 +416,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) @@ -488,8 +474,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -533,8 +520,8 @@ def get(self, resource_group_name: str, address_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -550,8 +537,9 @@ def get(self, resource_group_name: str, address_name: str, **kwargs: Any) -> _mo 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -590,8 +578,8 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -599,7 +587,7 @@ def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_resource, (IO, bytes)): + if isinstance(address_resource, (IOBase, bytes)): _content = address_resource else: _json = self._serialize.body(address_resource, "AddressResource") @@ -619,8 +607,9 @@ def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,8 +756,8 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) @@ -828,8 +817,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -845,8 +834,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -856,8 +846,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" @@ -889,8 +883,8 @@ def begin_delete(self, resource_group_name: str, address_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -950,8 +944,8 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AddressResource]] = kwargs.pop("cls", None) @@ -959,7 +953,7 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(address_update_parameter, (IO, bytes)): + if isinstance(address_update_parameter, (IOBase, bytes)): _content = address_update_parameter else: _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") @@ -980,8 +974,9 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -992,11 +987,15 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AddressResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1136,8 +1135,8 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_operations.py index ec18ed55f986..4e02bd3a1544 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,6 +73,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -94,8 +88,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -147,8 +141,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_order_items_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_order_items_operations.py index 497c8487e662..5cf137e8eed9 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_order_items_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_order_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,9 +51,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +60,7 @@ def build_list_by_subscription_request( "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") @@ -98,9 +92,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_list_by_resource_group_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") @@ -140,9 +132,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +148,7 @@ def build_get_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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,9 +167,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +184,7 @@ def build_create_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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") @@ -215,9 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +219,7 @@ def build_delete_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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") @@ -255,9 +241,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -274,7 +258,7 @@ def build_update_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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") @@ -295,9 +279,7 @@ def build_cancel_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -314,7 +296,7 @@ def build_cancel_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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") @@ -327,15 +309,13 @@ def build_cancel_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_return_method_request( +def build_return_request( resource_group_name: str, order_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: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -352,7 +332,7 @@ def build_return_method_request( "orderItemName": _SERIALIZER.url("order_item_name", order_item_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") @@ -383,6 +363,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -420,8 +401,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -478,8 +459,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,8 +516,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) @@ -593,8 +575,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,8 +628,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -663,8 +646,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,8 +687,8 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -712,7 +696,7 @@ def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_resource, (IO, bytes)): + if isinstance(order_item_resource, (IOBase, bytes)): _content = order_item_resource else: _json = self._serialize.body(order_item_resource, "OrderItemResource") @@ -732,8 +716,9 @@ def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -875,8 +860,8 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -936,8 +921,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -953,8 +938,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -964,8 +950,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" @@ -995,8 +985,8 @@ def begin_delete(self, resource_group_name: str, order_item_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1056,8 +1046,8 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.OrderItemResource]] = kwargs.pop("cls", None) @@ -1065,7 +1055,7 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(order_item_update_parameter, (IO, bytes)): + if isinstance(order_item_update_parameter, (IOBase, bytes)): _content = order_item_update_parameter else: _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") @@ -1086,8 +1076,9 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1098,11 +1089,15 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OrderItemResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1236,8 +1231,8 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) @@ -1378,8 +1373,8 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1387,7 +1382,7 @@ def cancel( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1407,8 +1402,9 @@ def cancel( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1425,7 +1421,7 @@ def cancel( # pylint: disable=inconsistent-return-statements "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel" } - def _return_method_initial( # pylint: disable=inconsistent-return-statements + def _return_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, order_item_name: str, @@ -1443,8 +1439,8 @@ def _return_method_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1452,12 +1448,12 @@ def _return_method_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(return_order_item_details, (IO, bytes)): + if isinstance(return_order_item_details, (IOBase, bytes)): _content = return_order_item_details else: _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") - request = build_return_method_request( + request = build_return_request( resource_group_name=resource_group_name, order_item_name=order_item_name, subscription_id=self._config.subscription_id, @@ -1465,15 +1461,16 @@ def _return_method_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._return_method_initial.metadata["url"], + template_url=self._return_initial.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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1483,10 +1480,14 @@ def _return_method_initial( # pylint: disable=inconsistent-return-statements 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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _return_method_initial.metadata = { + _return_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return" } @@ -1598,8 +1599,8 @@ def begin_return_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1607,7 +1608,7 @@ def begin_return_method( 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._return_method_initial( # type: ignore + raw_result = self._return_initial( # type: ignore resource_group_name=resource_group_name, order_item_name=order_item_name, return_order_item_details=return_order_item_details, diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_orders_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_orders_operations.py index e83600d3f071..ab1c0a857907 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_orders_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_orders_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +51,7 @@ def build_list_by_subscription_request( "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") @@ -79,9 +72,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +89,7 @@ def build_get_request( "orderName": _SERIALIZER.url("order_name", order_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") @@ -120,9 +111,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +126,7 @@ def build_list_by_resource_group_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") @@ -170,6 +159,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -192,8 +182,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -248,8 +238,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,8 +282,8 @@ def get(self, resource_group_name: str, location: str, order_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) @@ -309,8 +300,9 @@ def get(self, resource_group_name: str, location: str, order_name: str, **kwargs 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,8 +347,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) @@ -412,8 +404,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_products_and_configurations_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_products_and_configurations_operations.py index af5a3a6ed1ae..d2ced98639bb 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_products_and_configurations_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/v2022_05_01_preview/operations/_products_and_configurations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_configurations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61,7 +55,7 @@ def build_list_configurations_request( "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") @@ -82,9 +76,7 @@ def build_list_product_families_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,7 +88,7 @@ def build_list_product_families_request( "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") @@ -119,9 +111,7 @@ def build_list_product_families_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +122,7 @@ def build_list_product_families_metadata_request( "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") @@ -163,6 +153,7 @@ def __init__(self, *args, **kwargs): 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_configurations( @@ -248,8 +239,8 @@ def list_configurations( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) @@ -264,7 +255,7 @@ def list_configurations( content_type = content_type or "application/json" _json = None _content = None - if isinstance(configurations_request, (IO, bytes)): + if isinstance(configurations_request, (IOBase, bytes)): _content = configurations_request else: _json = self._serialize.body(configurations_request, "ConfigurationsRequest") @@ -314,8 +305,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,8 +417,8 @@ def list_product_families( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) @@ -441,7 +433,7 @@ def list_product_families( content_type = content_type or "application/json" _json = None _content = None - if isinstance(product_families_request, (IO, bytes)): + if isinstance(product_families_request, (IOBase, bytes)): _content = product_families_request else: _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") @@ -492,8 +484,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,8 +522,8 @@ def list_product_families_metadata( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") ) cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) @@ -584,8 +577,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py index cf8b1b5f3484..20f402345dab 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py @@ -29,12 +29,11 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.cancel_order_item( + client.cancel_order_item( order_item_name="TestOrderItemName3", resource_group_name="YourResourceGroupName", cancellation_reason={"reason": "Order cancelled"}, ) - print(response) # x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CancelOrderItem.json diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py index 15cd02b0371d..4a49ad10bc5e 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py @@ -29,11 +29,10 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.begin_delete_address_by_name( + client.begin_delete_address_by_name( address_name="TestAddressName1", resource_group_name="YourResourceGroupName", ).result() - print(response) # x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteAddressByName.json diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py index 9b29405633fa..807633f10719 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py @@ -29,11 +29,10 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.begin_delete_order_item_by_name( + client.begin_delete_order_item_by_name( order_item_name="TestOrderItemName3", resource_group_name="YourResourceGroupName", ).result() - print(response) # x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteOrderItemByName.json diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py index b22feffabc4b..66b55a1353fd 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py @@ -29,12 +29,11 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.begin_return_order_item( + client.begin_return_order_item( order_item_name="TestOrderName4", resource_group_name="YourResourceGroupName", return_order_item_details={"returnReason": "Order returned"}, ).result() - print(response) # x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ReturnOrderItem.json diff --git a/sdk/elastic/azure-mgmt-elastic/_meta.json b/sdk/elastic/azure-mgmt-elastic/_meta.json index 99a262400bd8..c50f4fff890d 100644 --- a/sdk/elastic/azure-mgmt-elastic/_meta.json +++ b/sdk/elastic/azure-mgmt-elastic/_meta.json @@ -1,11 +1,11 @@ { - "commit": "1f449b5a17448f05ce1cd914f8ed75a0b568d130", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/elastic/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.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/elastic/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/elastic/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py index 8273c3f2bcde..83f51ec96103 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py @@ -27,17 +27,16 @@ class MicrosoftElasticConfiguration(Configuration): # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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(MicrosoftElasticConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py index e931c84eb210..1e125662ee26 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py @@ -18,6 +18,8 @@ from .operations import ( AllTrafficFiltersOperations, AssociateTrafficFilterOperations, + BillingInfoOperations, + ConnectedPartnerResourcesOperations, CreateAndAssociateIPFilterOperations, CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, @@ -29,6 +31,7 @@ MonitorOperations, MonitoredResourcesOperations, MonitorsOperations, + OpenAIOperations, Operations, OrganizationsOperations, TagRulesOperations, @@ -59,6 +62,13 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype deployment_info: azure.mgmt.elastic.operations.DeploymentInfoOperations :ivar external_user: ExternalUserOperations operations :vartype external_user: azure.mgmt.elastic.operations.ExternalUserOperations + :ivar billing_info: BillingInfoOperations operations + :vartype billing_info: azure.mgmt.elastic.operations.BillingInfoOperations + :ivar connected_partner_resources: ConnectedPartnerResourcesOperations operations + :vartype connected_partner_resources: + azure.mgmt.elastic.operations.ConnectedPartnerResourcesOperations + :ivar open_ai: OpenAIOperations operations + :vartype open_ai: azure.mgmt.elastic.operations.OpenAIOperations :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: azure.mgmt.elastic.operations.TagRulesOperations :ivar vm_host: VMHostOperations operations @@ -96,12 +106,11 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype organizations: azure.mgmt.elastic.operations.OrganizationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -132,6 +141,11 @@ def __init__( ) self.deployment_info = DeploymentInfoOperations(self._client, self._config, self._serialize, self._deserialize) self.external_user = ExternalUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.billing_info = BillingInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.connected_partner_resources = ConnectedPartnerResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py index 73aef742777f..e5754a47ce68 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py index d692acb9479c..abdb6fdee3b9 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py @@ -27,17 +27,16 @@ class MicrosoftElasticConfiguration(Configuration): # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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(MicrosoftElasticConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py index 9af83af61936..85c9e3d4fd9a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py @@ -18,6 +18,8 @@ from .operations import ( AllTrafficFiltersOperations, AssociateTrafficFilterOperations, + BillingInfoOperations, + ConnectedPartnerResourcesOperations, CreateAndAssociateIPFilterOperations, CreateAndAssociatePLFilterOperations, DeploymentInfoOperations, @@ -29,6 +31,7 @@ MonitorOperations, MonitoredResourcesOperations, MonitorsOperations, + OpenAIOperations, Operations, OrganizationsOperations, TagRulesOperations, @@ -59,6 +62,13 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype deployment_info: azure.mgmt.elastic.aio.operations.DeploymentInfoOperations :ivar external_user: ExternalUserOperations operations :vartype external_user: azure.mgmt.elastic.aio.operations.ExternalUserOperations + :ivar billing_info: BillingInfoOperations operations + :vartype billing_info: azure.mgmt.elastic.aio.operations.BillingInfoOperations + :ivar connected_partner_resources: ConnectedPartnerResourcesOperations operations + :vartype connected_partner_resources: + azure.mgmt.elastic.aio.operations.ConnectedPartnerResourcesOperations + :ivar open_ai: OpenAIOperations operations + :vartype open_ai: azure.mgmt.elastic.aio.operations.OpenAIOperations :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: azure.mgmt.elastic.aio.operations.TagRulesOperations :ivar vm_host: VMHostOperations operations @@ -96,12 +106,11 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype organizations: azure.mgmt.elastic.aio.operations.OrganizationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -132,6 +141,11 @@ def __init__( ) self.deployment_info = DeploymentInfoOperations(self._client, self._config, self._serialize, self._deserialize) self.external_user = ExternalUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.billing_info = BillingInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.connected_partner_resources = ConnectedPartnerResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.open_ai = OpenAIOperations(self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py index e04a06140193..06b7c4021a03 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py @@ -12,6 +12,9 @@ from ._monitored_resources_operations import MonitoredResourcesOperations from ._deployment_info_operations import DeploymentInfoOperations from ._external_user_operations import ExternalUserOperations +from ._billing_info_operations import BillingInfoOperations +from ._connected_partner_resources_operations import ConnectedPartnerResourcesOperations +from ._open_ai_operations import OpenAIOperations from ._tag_rules_operations import TagRulesOperations from ._vm_host_operations import VMHostOperations from ._vm_ingestion_operations import VMIngestionOperations @@ -39,6 +42,9 @@ "MonitoredResourcesOperations", "DeploymentInfoOperations", "ExternalUserOperations", + "BillingInfoOperations", + "ConnectedPartnerResourcesOperations", + "OpenAIOperations", "TagRulesOperations", "VMHostOperations", "VMIngestionOperations", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py index 1531baef4334..82b1adda51e2 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py @@ -58,8 +58,8 @@ async def list( Get the list of all traffic filters for the account. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py index f40bfed1a937..690737668a15 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py @@ -111,8 +111,8 @@ async def begin_associate( Associate traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py new file mode 100644 index 000000000000..5d8cca92c15a --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_billing_info_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._billing_info_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BillingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s + :attr:`billing_info` 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_async + async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: + """Get marketplace and organization info mapped to the given monitor. + + Get marketplace and organization info mapped to the given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BillingInfoResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse + :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.BillingInfoResponse] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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 = 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BillingInfoResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py new file mode 100644 index 000000000000..6981abcc2ee0 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_connected_partner_resources_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connected_partner_resources_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectedPartnerResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s + :attr:`connected_partner_resources` 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, monitor_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConnectedPartnerResourcesListFormat"]: + """List of all active deployments that are associated with the marketplace subscription linked to + the given monitor. + + List of all active deployments that are associated with the marketplace subscription linked to + the given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedPartnerResourcesListFormat or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :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.ConnectedPartnerResourcesListResponse] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + 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("ConnectedPartnerResourcesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py index 681032d9ed38..f86ec6c471ab 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py @@ -122,8 +122,8 @@ async def begin_create( Create and Associate IP traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py index 46adcc10b04d..6ee41abd487c 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py @@ -125,8 +125,8 @@ async def begin_create( Create and Associate private link traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py index 656aa3b649f3..1b7cbc8d963d 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py @@ -58,8 +58,8 @@ async def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py index d4f699e9601b..eccf6d862086 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py @@ -58,8 +58,8 @@ async def delete( # pylint: disable=inconsistent-return-statements Detach and Delete traffic filter from the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py index 86c526788c2a..e0eddd5bb3d9 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py @@ -111,8 +111,8 @@ async def begin_update( Detach traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py index 2732c78deee9..91483dc62334 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -66,8 +67,8 @@ async def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -98,8 +99,8 @@ async def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -128,8 +129,8 @@ async def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -162,7 +163,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py index 6c666aa90711..ca0bb279030f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py @@ -58,8 +58,8 @@ async def list( Get the list of all associated traffic filters for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py index 244aad40ab59..583a7dac90a6 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -77,7 +78,7 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -135,8 +136,8 @@ async def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -172,8 +173,8 @@ async def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -207,8 +208,8 @@ async def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py index 8a5d4b92d330..02b70ca746b4 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py @@ -60,8 +60,8 @@ def list( List the resources currently being monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py index a676a7588601..4ca81777b85a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -157,8 +158,8 @@ def list_by_resource_group( List all monitors under the specified resource group. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :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 ElasticMonitorResource or the result of @@ -250,8 +251,8 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) Get the properties of a specific monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -336,7 +337,7 @@ async def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -402,8 +403,8 @@ async def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -440,8 +441,8 @@ async def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -476,8 +477,8 @@ async def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -565,8 +566,8 @@ async def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -595,8 +596,8 @@ async def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -623,8 +624,8 @@ async def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -657,7 +658,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -761,8 +762,8 @@ async def begin_delete(self, resource_group_name: str, monitor_name: str, **kwar Delete a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py new file mode 100644 index 000000000000..78f2de86c6c2 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_open_ai_operations.py @@ -0,0 +1,538 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._open_ai_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_status_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OpenAIOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s + :attr:`open_ai` 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, monitor_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OpenAIIntegrationRPModel"]: + """List OpenAI integration rule for a given monitor resource. + + List OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OpenAIIntegrationRPModel or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :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.OpenAIIntegrationRPModelListResponse] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + 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("OpenAIIntegrationRPModelListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Get OpenAI integration rule for a given monitor resource. + + Get OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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 = 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_models.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[Union[_models.OpenAIIntegrationRPModel, IO]] = None, + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Is either a OpenAIIntegrationRPModel type or a IO type. Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OpenAIIntegrationRPModel] = 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, "OpenAIIntegrationRPModel") + else: + _json = None + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> None: + """Delete OpenAI integration rule for a given monitor resource. + + Delete OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_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, + monitor_name=monitor_name, + integration_name=integration_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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @distributed_trace_async + async def get_status( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationStatusResponse: + """Get OpenAI integration status for a given integration. + + Get OpenAI integration status for a given integration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse + :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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_status.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OpenAIIntegrationStatusResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py index c0672c22373c..0a1576298278 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._organizations_operations import build_get_api_key_request +from ...operations._organizations_operations import ( + build_get_api_key_request, + build_get_elastic_to_azure_subscription_mapping_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +137,7 @@ async def get_api_key( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -176,3 +180,65 @@ async def get_api_key( return deserialized get_api_key.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getOrganizationApiKey"} + + @distributed_trace_async + async def get_elastic_to_azure_subscription_mapping( + self, **kwargs: Any + ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: + """Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + + Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElasticOrganizationToAzureSubscriptionMappingResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse + :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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) + + request = build_get_elastic_to_azure_subscription_mapping_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_elastic_to_azure_subscription_mapping.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ElasticOrganizationToAzureSubscriptionMappingResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_elastic_to_azure_subscription_mapping.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py index e8b5c5f9fd16..da60b1374803 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -68,8 +69,8 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -171,8 +172,8 @@ async def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -204,8 +205,8 @@ async def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -235,8 +236,8 @@ async def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -271,7 +272,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -328,8 +329,8 @@ async def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -451,8 +452,8 @@ async def begin_delete( Delete a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py index 0af6ea7fbeef..31c0e6e1538d 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py @@ -58,8 +58,8 @@ async def delete( # pylint: disable=inconsistent-return-statements Delete traffic filter from the account. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py index 98d985766d00..f7dec45994ab 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py @@ -58,8 +58,8 @@ async def details( List of upgradable versions for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py index 72b9d859f5ab..722890bbd2cc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -64,8 +65,8 @@ async def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -94,8 +95,8 @@ async def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -122,8 +123,8 @@ async def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -156,7 +157,7 @@ async def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py index d6fdd06c7769..f3e9b7a0d7db 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py @@ -58,8 +58,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> As List the vm resources currently being monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py index 5d3fef056051..2eb59c175db3 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py @@ -58,8 +58,8 @@ async def details( List the vm ingestion details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py index 21f1938cbe84..ed80a94f8086 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py @@ -6,7 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import BillingInfoResponse from ._models_py3 import CompanyInfo +from ._models_py3 import ConnectedPartnerResourceProperties +from ._models_py3 import ConnectedPartnerResourcesListFormat +from ._models_py3 import ConnectedPartnerResourcesListResponse from ._models_py3 import DeploymentInfoResponse from ._models_py3 import ElasticCloudDeployment from ._models_py3 import ElasticCloudUser @@ -14,6 +18,8 @@ from ._models_py3 import ElasticMonitorResourceListResponse from ._models_py3 import ElasticMonitorResourceUpdateParameters from ._models_py3 import ElasticMonitorUpgrade +from ._models_py3 import ElasticOrganizationToAzureSubscriptionMappingResponse +from ._models_py3 import ElasticOrganizationToAzureSubscriptionMappingResponseProperties from ._models_py3 import ElasticProperties from ._models_py3 import ElasticTrafficFilter from ._models_py3 import ElasticTrafficFilterResponse @@ -35,9 +41,16 @@ from ._models_py3 import MonitoringTagRules from ._models_py3 import MonitoringTagRulesListResponse from ._models_py3 import MonitoringTagRulesProperties +from ._models_py3 import OpenAIIntegrationProperties +from ._models_py3 import OpenAIIntegrationRPModel +from ._models_py3 import OpenAIIntegrationRPModelListResponse +from ._models_py3 import OpenAIIntegrationStatusResponse +from ._models_py3 import OpenAIIntegrationStatusResponseProperties from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import OperationResult +from ._models_py3 import PartnerBillingEntity +from ._models_py3 import PlanDetails from ._models_py3 import ResourceProviderDefaultErrorResponse from ._models_py3 import ResourceSku from ._models_py3 import SystemData @@ -66,7 +79,11 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "BillingInfoResponse", "CompanyInfo", + "ConnectedPartnerResourceProperties", + "ConnectedPartnerResourcesListFormat", + "ConnectedPartnerResourcesListResponse", "DeploymentInfoResponse", "ElasticCloudDeployment", "ElasticCloudUser", @@ -74,6 +91,8 @@ "ElasticMonitorResourceListResponse", "ElasticMonitorResourceUpdateParameters", "ElasticMonitorUpgrade", + "ElasticOrganizationToAzureSubscriptionMappingResponse", + "ElasticOrganizationToAzureSubscriptionMappingResponseProperties", "ElasticProperties", "ElasticTrafficFilter", "ElasticTrafficFilterResponse", @@ -95,9 +114,16 @@ "MonitoringTagRules", "MonitoringTagRulesListResponse", "MonitoringTagRulesProperties", + "OpenAIIntegrationProperties", + "OpenAIIntegrationRPModel", + "OpenAIIntegrationRPModelListResponse", + "OpenAIIntegrationStatusResponse", + "OpenAIIntegrationStatusResponseProperties", "OperationDisplay", "OperationListResult", "OperationResult", + "PartnerBillingEntity", + "PlanDetails", "ResourceProviderDefaultErrorResponse", "ResourceSku", "SystemData", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py index b012b217a9d5..09117cf9c893 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py @@ -17,6 +17,38 @@ from .. import models as _models +class BillingInfoResponse(_serialization.Model): + """Marketplace Subscription and Organization details to which resource gets billed into. + + :ivar marketplace_saas_info: Marketplace Subscription details. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :ivar partner_billing_entity: Partner Billing Entity details: Organization Info. + :vartype partner_billing_entity: ~azure.mgmt.elastic.models.PartnerBillingEntity + """ + + _attribute_map = { + "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, + "partner_billing_entity": {"key": "partnerBillingEntity", "type": "PartnerBillingEntity"}, + } + + def __init__( + self, + *, + marketplace_saas_info: Optional["_models.MarketplaceSaaSInfo"] = None, + partner_billing_entity: Optional["_models.PartnerBillingEntity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword marketplace_saas_info: Marketplace Subscription details. + :paramtype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :keyword partner_billing_entity: Partner Billing Entity details: Organization Info. + :paramtype partner_billing_entity: ~azure.mgmt.elastic.models.PartnerBillingEntity + """ + super().__init__(**kwargs) + self.marketplace_saas_info = marketplace_saas_info + self.partner_billing_entity = partner_billing_entity + + class CompanyInfo(_serialization.Model): """Company information of the user to be passed to partners. @@ -78,6 +110,107 @@ def __init__( self.country = country +class ConnectedPartnerResourceProperties(_serialization.Model): + """Connected Partner Resource Properties. + + :ivar partner_deployment_name: Elastic deployment name. + :vartype partner_deployment_name: str + :ivar partner_deployment_uri: Deployment URL of the elasticsearch in Elastic cloud deployment. + :vartype partner_deployment_uri: str + :ivar azure_resource_id: The azure resource Id of the deployment. + :vartype azure_resource_id: str + :ivar location: The location of the deployment. + :vartype location: str + """ + + _attribute_map = { + "partner_deployment_name": {"key": "partnerDeploymentName", "type": "str"}, + "partner_deployment_uri": {"key": "partnerDeploymentUri", "type": "str"}, + "azure_resource_id": {"key": "azureResourceId", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + partner_deployment_name: Optional[str] = None, + partner_deployment_uri: Optional[str] = None, + azure_resource_id: Optional[str] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword partner_deployment_name: Elastic deployment name. + :paramtype partner_deployment_name: str + :keyword partner_deployment_uri: Deployment URL of the elasticsearch in Elastic cloud + deployment. + :paramtype partner_deployment_uri: str + :keyword azure_resource_id: The azure resource Id of the deployment. + :paramtype azure_resource_id: str + :keyword location: The location of the deployment. + :paramtype location: str + """ + super().__init__(**kwargs) + self.partner_deployment_name = partner_deployment_name + self.partner_deployment_uri = partner_deployment_uri + self.azure_resource_id = azure_resource_id + self.location = location + + +class ConnectedPartnerResourcesListFormat(_serialization.Model): + """Connected Partner Resources List Format. + + :ivar properties: Connected Partner Resource Properties. + :vartype properties: ~azure.mgmt.elastic.models.ConnectedPartnerResourceProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ConnectedPartnerResourceProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ConnectedPartnerResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Connected Partner Resource Properties. + :paramtype properties: ~azure.mgmt.elastic.models.ConnectedPartnerResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConnectedPartnerResourcesListResponse(_serialization.Model): + """List of all active elastic deployments. + + :ivar value: Results of a list operation. + :vartype value: list[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ConnectedPartnerResourcesListFormat]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ConnectedPartnerResourcesListFormat"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class DeploymentInfoResponse(_serialization.Model): """The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. @@ -91,6 +224,9 @@ class DeploymentInfoResponse(_serialization.Model): :vartype memory_capacity: str :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. :vartype disk_capacity: str + :ivar elasticsearch_end_point: Elasticsearch endpoint in Elastic cloud deployment. This is + either the aliased_endpoint if available, or the service_url otherwise. + :vartype elasticsearch_end_point: str :ivar deployment_url: Deployment URL of the elasticsearch in Elastic cloud deployment. :vartype deployment_url: str :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. @@ -102,6 +238,7 @@ class DeploymentInfoResponse(_serialization.Model): "version": {"readonly": True}, "memory_capacity": {"readonly": True}, "disk_capacity": {"readonly": True}, + "elasticsearch_end_point": {"readonly": True}, "deployment_url": {"readonly": True}, "marketplace_saas_info": {"readonly": True}, } @@ -111,6 +248,7 @@ class DeploymentInfoResponse(_serialization.Model): "version": {"key": "version", "type": "str"}, "memory_capacity": {"key": "memoryCapacity", "type": "str"}, "disk_capacity": {"key": "diskCapacity", "type": "str"}, + "elasticsearch_end_point": {"key": "elasticsearchEndPoint", "type": "str"}, "deployment_url": {"key": "deploymentUrl", "type": "str"}, "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, } @@ -122,6 +260,7 @@ def __init__(self, **kwargs: Any) -> None: self.version = None self.memory_capacity = None self.disk_capacity = None + self.elasticsearch_end_point = None self.deployment_url = None self.marketplace_saas_info = None @@ -366,6 +505,89 @@ def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: self.version = version +class ElasticOrganizationToAzureSubscriptionMappingResponse(_serialization.Model): + """The Azure Subscription ID to which the Organization of the logged in user belongs and gets + billed into. + + :ivar properties: The properties of Azure Subscription ID to which the Organization of the + logged in user belongs and gets billed into. + :vartype properties: + ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ElasticOrganizationToAzureSubscriptionMappingResponseProperties"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: The properties of Azure Subscription ID to which the Organization of the + logged in user belongs and gets billed into. + :paramtype properties: + ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ElasticOrganizationToAzureSubscriptionMappingResponseProperties(_serialization.Model): + """The properties of Azure Subscription ID to which the Organization of the logged in user belongs + and gets billed into. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Organization belongs + and gets billed into. This is empty for a new user OR a user without an Elastic Organization. + :vartype billed_azure_subscription_id: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo + :ivar elastic_organization_id: The Elastic Organization Id. + :vartype elastic_organization_id: str + :ivar elastic_organization_name: The Elastic Organization Name. + :vartype elastic_organization_name: str + """ + + _validation = { + "marketplace_saas_info": {"readonly": True}, + } + + _attribute_map = { + "billed_azure_subscription_id": {"key": "billedAzureSubscriptionId", "type": "str"}, + "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, + "elastic_organization_id": {"key": "elasticOrganizationId", "type": "str"}, + "elastic_organization_name": {"key": "elasticOrganizationName", "type": "str"}, + } + + def __init__( + self, + *, + billed_azure_subscription_id: Optional[str] = None, + elastic_organization_id: Optional[str] = None, + elastic_organization_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword billed_azure_subscription_id: The Azure Subscription ID to which the Organization + belongs and gets billed into. This is empty for a new user OR a user without an Elastic + Organization. + :paramtype billed_azure_subscription_id: str + :keyword elastic_organization_id: The Elastic Organization Id. + :paramtype elastic_organization_id: str + :keyword elastic_organization_name: The Elastic Organization Name. + :paramtype elastic_organization_name: str + """ + super().__init__(**kwargs) + self.billed_azure_subscription_id = billed_azure_subscription_id + self.marketplace_saas_info = None + self.elastic_organization_id = elastic_organization_id + self.elastic_organization_name = elastic_organization_name + + class ElasticProperties(_serialization.Model): """Elastic Resource Properties. @@ -873,6 +1095,13 @@ class MarketplaceSaaSInfo(_serialization.Model): :vartype marketplace_name: str :ivar marketplace_resource_id: Marketplace Subscription Details: Resource URI. :vartype marketplace_resource_id: str + :ivar marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. + :vartype marketplace_status: str + :ivar billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace + Subscription belongs and gets billed into. + :vartype billed_azure_subscription_id: str + :ivar subscribed: Flag specifying if the Marketplace status is subscribed or not. + :vartype subscribed: bool """ _attribute_map = { @@ -882,6 +1111,9 @@ class MarketplaceSaaSInfo(_serialization.Model): }, "marketplace_name": {"key": "marketplaceName", "type": "str"}, "marketplace_resource_id": {"key": "marketplaceResourceId", "type": "str"}, + "marketplace_status": {"key": "marketplaceStatus", "type": "str"}, + "billed_azure_subscription_id": {"key": "billedAzureSubscriptionId", "type": "str"}, + "subscribed": {"key": "subscribed", "type": "bool"}, } def __init__( @@ -890,6 +1122,9 @@ def __init__( marketplace_subscription: Optional["_models.MarketplaceSaaSInfoMarketplaceSubscription"] = None, marketplace_name: Optional[str] = None, marketplace_resource_id: Optional[str] = None, + marketplace_status: Optional[str] = None, + billed_azure_subscription_id: Optional[str] = None, + subscribed: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -900,11 +1135,21 @@ def __init__( :paramtype marketplace_name: str :keyword marketplace_resource_id: Marketplace Subscription Details: Resource URI. :paramtype marketplace_resource_id: str + :keyword marketplace_status: Marketplace Subscription Details: SaaS Subscription Status. + :paramtype marketplace_status: str + :keyword billed_azure_subscription_id: The Azure Subscription ID to which the Marketplace + Subscription belongs and gets billed into. + :paramtype billed_azure_subscription_id: str + :keyword subscribed: Flag specifying if the Marketplace status is subscribed or not. + :paramtype subscribed: bool """ super().__init__(**kwargs) self.marketplace_subscription = marketplace_subscription self.marketplace_name = marketplace_name self.marketplace_resource_id = marketplace_resource_id + self.marketplace_status = marketplace_status + self.billed_azure_subscription_id = billed_azure_subscription_id + self.subscribed = subscribed class MarketplaceSaaSInfoMarketplaceSubscription(_serialization.Model): @@ -1115,7 +1360,7 @@ def __init__( self.log_rules = log_rules -class MonitorProperties(_serialization.Model): +class MonitorProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties specific to the monitor resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1131,8 +1376,19 @@ class MonitorProperties(_serialization.Model): :vartype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties :ivar user_info: User information. :vartype user_info: ~azure.mgmt.elastic.models.UserInfo + :ivar plan_details: Plan details of the monitor resource. + :vartype plan_details: ~azure.mgmt.elastic.models.PlanDetails :ivar version: Version of elastic of the monitor resource. :vartype version: str + :ivar subscription_state: State of the Azure Subscription containing the monitor resource. + :vartype subscription_state: str + :ivar saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS is + located. + :vartype saa_s_azure_subscription_status: str + :ivar source_campaign_name: Name of the marketing campaign. + :vartype source_campaign_name: str + :ivar source_campaign_id: A unique identifier associated with the campaign. + :vartype source_campaign_id: str :ivar liftr_resource_category: Known values are: "Unknown" and "MonitorLogs". :vartype liftr_resource_category: str or ~azure.mgmt.elastic.models.LiftrResourceCategories :ivar liftr_resource_preference: The priority of the resource. @@ -1151,7 +1407,12 @@ class MonitorProperties(_serialization.Model): "monitoring_status": {"key": "monitoringStatus", "type": "str"}, "elastic_properties": {"key": "elasticProperties", "type": "ElasticProperties"}, "user_info": {"key": "userInfo", "type": "UserInfo"}, + "plan_details": {"key": "planDetails", "type": "PlanDetails"}, "version": {"key": "version", "type": "str"}, + "subscription_state": {"key": "subscriptionState", "type": "str"}, + "saa_s_azure_subscription_status": {"key": "saaSAzureSubscriptionStatus", "type": "str"}, + "source_campaign_name": {"key": "sourceCampaignName", "type": "str"}, + "source_campaign_id": {"key": "sourceCampaignId", "type": "str"}, "liftr_resource_category": {"key": "liftrResourceCategory", "type": "str"}, "liftr_resource_preference": {"key": "liftrResourcePreference", "type": "int"}, "generate_api_key": {"key": "generateApiKey", "type": "bool"}, @@ -1164,7 +1425,12 @@ def __init__( monitoring_status: Optional[Union[str, "_models.MonitoringStatus"]] = None, elastic_properties: Optional["_models.ElasticProperties"] = None, user_info: Optional["_models.UserInfo"] = None, + plan_details: Optional["_models.PlanDetails"] = None, version: Optional[str] = None, + subscription_state: Optional[str] = None, + saa_s_azure_subscription_status: Optional[str] = None, + source_campaign_name: Optional[str] = None, + source_campaign_id: Optional[str] = None, generate_api_key: Optional[bool] = None, **kwargs: Any ) -> None: @@ -1180,8 +1446,19 @@ def __init__( :paramtype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties :keyword user_info: User information. :paramtype user_info: ~azure.mgmt.elastic.models.UserInfo + :keyword plan_details: Plan details of the monitor resource. + :paramtype plan_details: ~azure.mgmt.elastic.models.PlanDetails :keyword version: Version of elastic of the monitor resource. :paramtype version: str + :keyword subscription_state: State of the Azure Subscription containing the monitor resource. + :paramtype subscription_state: str + :keyword saa_s_azure_subscription_status: Status of Azure Subscription where Marketplace SaaS + is located. + :paramtype saa_s_azure_subscription_status: str + :keyword source_campaign_name: Name of the marketing campaign. + :paramtype source_campaign_name: str + :keyword source_campaign_id: A unique identifier associated with the campaign. + :paramtype source_campaign_id: str :keyword generate_api_key: Flag to determine if User API Key has to be generated and shared. :paramtype generate_api_key: bool """ @@ -1190,12 +1467,171 @@ def __init__( self.monitoring_status = monitoring_status self.elastic_properties = elastic_properties self.user_info = user_info + self.plan_details = plan_details self.version = version + self.subscription_state = subscription_state + self.saa_s_azure_subscription_status = saa_s_azure_subscription_status + self.source_campaign_name = source_campaign_name + self.source_campaign_id = source_campaign_id self.liftr_resource_category = None self.liftr_resource_preference = None self.generate_api_key = generate_api_key +class OpenAIIntegrationProperties(_serialization.Model): + """Open AI Integration details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar open_ai_resource_id: The resource id of Open AI resource. + :vartype open_ai_resource_id: str + :ivar open_ai_resource_endpoint: The API endpoint for Open AI resource. + :vartype open_ai_resource_endpoint: str + :ivar key: Value of API key for Open AI resource. + :vartype key: str + :ivar last_refresh_at: Last Update Timestamp for key updation. + :vartype last_refresh_at: ~datetime.datetime + """ + + _validation = { + "open_ai_resource_id": {"readonly": True}, + "open_ai_resource_endpoint": {"readonly": True}, + "last_refresh_at": {"readonly": True}, + } + + _attribute_map = { + "open_ai_resource_id": {"key": "openAIResourceId", "type": "str"}, + "open_ai_resource_endpoint": {"key": "openAIResourceEndpoint", "type": "str"}, + "key": {"key": "key", "type": "str"}, + "last_refresh_at": {"key": "lastRefreshAt", "type": "iso-8601"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: Value of API key for Open AI resource. + :paramtype key: str + """ + super().__init__(**kwargs) + self.open_ai_resource_id = None + self.open_ai_resource_endpoint = None + self.key = key + self.last_refresh_at = None + + +class OpenAIIntegrationRPModel(_serialization.Model): + """Capture properties of Open AI resource Integration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the integration. + :vartype name: str + :ivar id: The id of the integration. + :vartype id: str + :ivar type: The type of the integration. + :vartype type: str + :ivar properties: Open AI Integration details. + :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationProperties + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "OpenAIIntegrationProperties"}, + } + + def __init__(self, *, properties: Optional["_models.OpenAIIntegrationProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Open AI Integration details. + :paramtype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationProperties + """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.properties = properties + + +class OpenAIIntegrationRPModelListResponse(_serialization.Model): + """Response of a list operation. + + :ivar value: Results of a list operation. + :vartype value: list[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[OpenAIIntegrationRPModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.OpenAIIntegrationRPModel"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OpenAIIntegrationStatusResponse(_serialization.Model): + """Status of the OpenAI Integration. + + :ivar properties: Status of the OpenAI Integration. + :vartype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "OpenAIIntegrationStatusResponseProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.OpenAIIntegrationStatusResponseProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Status of the OpenAI Integration. + :paramtype properties: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponseProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class OpenAIIntegrationStatusResponseProperties(_serialization.Model): + """Status of the OpenAI Integration. + + :ivar status: Status of the OpenAI Integration. + :vartype status: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword status: Status of the OpenAI Integration. + :paramtype status: str + """ + super().__init__(**kwargs) + self.status = status + + class OperationDisplay(_serialization.Model): """The object that represents the operation. @@ -1316,6 +1752,98 @@ def __init__( self.origin = origin +class PartnerBillingEntity(_serialization.Model): + """Partner Billing details associated with the resource. + + :ivar id: The Elastic Organization Id. + :vartype id: str + :ivar name: The Elastic Organization Name. + :vartype name: str + :ivar partner_entity_uri: Link to the elastic organization page. + :vartype partner_entity_uri: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "partner_entity_uri": {"key": "partnerEntityUri", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + partner_entity_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The Elastic Organization Id. + :paramtype id: str + :keyword name: The Elastic Organization Name. + :paramtype name: str + :keyword partner_entity_uri: Link to the elastic organization page. + :paramtype partner_entity_uri: str + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.partner_entity_uri = partner_entity_uri + + +class PlanDetails(_serialization.Model): + """Plan details of the monitor resource. + + :ivar offer_id: Offer ID of the plan. + :vartype offer_id: str + :ivar publisher_id: Publisher ID of the plan. + :vartype publisher_id: str + :ivar term_id: Term ID of the plan. + :vartype term_id: str + :ivar plan_id: Plan ID. + :vartype plan_id: str + :ivar plan_name: Plan Name. + :vartype plan_name: str + """ + + _attribute_map = { + "offer_id": {"key": "offerID", "type": "str"}, + "publisher_id": {"key": "publisherID", "type": "str"}, + "term_id": {"key": "termID", "type": "str"}, + "plan_id": {"key": "planID", "type": "str"}, + "plan_name": {"key": "planName", "type": "str"}, + } + + def __init__( + self, + *, + offer_id: Optional[str] = None, + publisher_id: Optional[str] = None, + term_id: Optional[str] = None, + plan_id: Optional[str] = None, + plan_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword offer_id: Offer ID of the plan. + :paramtype offer_id: str + :keyword publisher_id: Publisher ID of the plan. + :paramtype publisher_id: str + :keyword term_id: Term ID of the plan. + :paramtype term_id: str + :keyword plan_id: Plan ID. + :paramtype plan_id: str + :keyword plan_name: Plan Name. + :paramtype plan_name: str + """ + super().__init__(**kwargs) + self.offer_id = offer_id + self.publisher_id = publisher_id + self.term_id = term_id + self.plan_id = plan_id + self.plan_name = plan_name + + class ResourceProviderDefaultErrorResponse(_serialization.Model): """RP default error response. diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py index e04a06140193..06b7c4021a03 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py @@ -12,6 +12,9 @@ from ._monitored_resources_operations import MonitoredResourcesOperations from ._deployment_info_operations import DeploymentInfoOperations from ._external_user_operations import ExternalUserOperations +from ._billing_info_operations import BillingInfoOperations +from ._connected_partner_resources_operations import ConnectedPartnerResourcesOperations +from ._open_ai_operations import OpenAIOperations from ._tag_rules_operations import TagRulesOperations from ._vm_host_operations import VMHostOperations from ._vm_ingestion_operations import VMIngestionOperations @@ -39,6 +42,9 @@ "MonitoredResourcesOperations", "DeploymentInfoOperations", "ExternalUserOperations", + "BillingInfoOperations", + "ConnectedPartnerResourcesOperations", + "OpenAIOperations", "TagRulesOperations", "VMHostOperations", "VMIngestionOperations", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py index 44f6f3f4ef83..432edf7bcf30 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -48,11 +48,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -88,8 +90,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m Get the list of all traffic filters for the account. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py index f4d6ca047c10..045c4243a383 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_associate_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,11 +57,13 @@ def build_associate_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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,8 +154,8 @@ def begin_associate( Associate traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py new file mode 100644 index 000000000000..16a450d935b2 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_billing_info_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, monitor_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BillingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.MicrosoftElastic`'s + :attr:`billing_info` 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(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.BillingInfoResponse: + """Get marketplace and organization info mapped to the given monitor. + + Get marketplace and organization info mapped to the given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BillingInfoResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.BillingInfoResponse + :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.BillingInfoResponse] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BillingInfoResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py new file mode 100644 index 000000000000..72417e173409 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_connected_partner_resources_operations.py @@ -0,0 +1,187 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, monitor_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConnectedPartnerResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.MicrosoftElastic`'s + :attr:`connected_partner_resources` 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, monitor_name: str, **kwargs: Any + ) -> Iterable["_models.ConnectedPartnerResourcesListFormat"]: + """List of all active deployments that are associated with the marketplace subscription linked to + the given monitor. + + List of all active deployments that are associated with the marketplace subscription linked to + the given monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedPartnerResourcesListFormat or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ConnectedPartnerResourcesListFormat] + :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.ConnectedPartnerResourcesListResponse] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectedPartnerResourcesListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py index 2e77e0738887..d4d87cd546d4 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_create_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,11 +58,13 @@ def build_create_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -166,8 +168,8 @@ def begin_create( Create and Associate IP traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py index 61010dd5b257..8844fcf50e6f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_create_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +59,13 @@ def build_create_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -172,8 +174,8 @@ def begin_create( Create and Associate private link traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py index c550079dba14..7faaae6e875b 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -48,11 +48,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -90,8 +92,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py index 141ac6d0a687..c90f1d3039a9 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,11 +55,13 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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,8 +101,8 @@ def delete( # pylint: disable=inconsistent-return-statements Detach and Delete traffic filter from the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py index 4bbac697a4cb..2588ee37e0eb 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,11 +57,13 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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,8 +154,8 @@ def begin_update( Detach traffic filter for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py index a64062bb7e85..d4728d0b0274 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_elastic_versions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(subscription_id: str, *, region: 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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_request(subscription_id: str, *, region: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py index 13aaee3c5836..22dc97d07def 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +41,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,11 +52,13 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -103,8 +106,8 @@ def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -135,8 +138,8 @@ def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -165,8 +168,8 @@ def create_or_update( Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -199,7 +202,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py index 8455ed2d8eea..881e6853dcf3 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -48,11 +48,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -88,8 +90,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m Get the list of all associated traffic filters for the given deployment. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py index c53c7ded4ea8..65cfb4da328c 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_upgrade_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,11 +54,13 @@ def build_upgrade_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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 +117,7 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -172,8 +175,8 @@ def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -209,8 +212,8 @@ def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -244,8 +247,8 @@ def begin_upgrade( Upgradable version for a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py index 81896222cd8c..fbb5d4166b1b 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +50,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -90,8 +92,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It List the resources currently being monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py index 58da5f864dae..54b85f022510 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request(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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,10 +77,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +97,7 @@ def build_get_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,11 +107,13 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -125,7 +130,7 @@ def build_create_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,11 +141,13 @@ def build_create_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -159,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,11 +177,13 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -193,7 +202,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,11 +212,13 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -331,8 +342,8 @@ def list_by_resource_group( List all monitors under the specified resource group. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :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 ElasticMonitorResource or the result of @@ -423,8 +434,8 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo Get the properties of a specific monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -509,7 +520,7 @@ def _create_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -575,8 +586,8 @@ def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -613,8 +624,8 @@ def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -649,8 +660,8 @@ def begin_create( Create a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -737,8 +748,8 @@ def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -767,8 +778,8 @@ def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -795,8 +806,8 @@ def update( Update a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -829,7 +840,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -933,8 +944,8 @@ def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: An Delete a monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py new file mode 100644 index 000000000000..908e066d0144 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_open_ai_operations.py @@ -0,0 +1,703 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, monitor_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_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_get_request( + resource_group_name: str, monitor_name: str, integration_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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_or_update_request( + resource_group_name: str, monitor_name: str, integration_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-01-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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, monitor_name: str, integration_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_status_request( + resource_group_name: str, monitor_name: str, integration_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "integrationName": _SERIALIZER.url("integration_name", integration_name, "str", pattern=r"^[a-z][a-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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class OpenAIOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.MicrosoftElastic`'s + :attr:`open_ai` 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, monitor_name: str, **kwargs: Any + ) -> Iterable["_models.OpenAIIntegrationRPModel"]: + """List OpenAI integration rule for a given monitor resource. + + List OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OpenAIIntegrationRPModel or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.OpenAIIntegrationRPModel] + :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.OpenAIIntegrationRPModelListResponse] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OpenAIIntegrationRPModelListResponse", 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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations" + } + + @distributed_trace + def get( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Get OpenAI integration rule for a given monitor resource. + + Get OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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.OpenAIIntegrationRPModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[_models.OpenAIIntegrationRPModel] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :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: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + monitor_name: str, + integration_name: str, + body: Optional[Union[_models.OpenAIIntegrationRPModel, IO]] = None, + **kwargs: Any + ) -> _models.OpenAIIntegrationRPModel: + """Create or update a OpenAI integration rule for a given monitor resource. + + Create or update a OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :param body: Is either a OpenAIIntegrationRPModel type or a IO type. Default value is None. + :type body: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationRPModel or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationRPModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OpenAIIntegrationRPModel] = 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, "OpenAIIntegrationRPModel") + else: + _json = None + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("OpenAIIntegrationRPModel", pipeline_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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> None: + """Delete OpenAI integration rule for a given monitor resource. + + Delete OpenAI integration rule for a given monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_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, + monitor_name=monitor_name, + integration_name=integration_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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}" + } + + @distributed_trace + def get_status( + self, resource_group_name: str, monitor_name: str, integration_name: str, **kwargs: Any + ) -> _models.OpenAIIntegrationStatusResponse: + """Get OpenAI integration status for a given integration. + + Get OpenAI integration status for a given integration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param integration_name: OpenAI Integration name. Required. + :type integration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenAIIntegrationStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.OpenAIIntegrationStatusResponse + :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.OpenAIIntegrationStatusResponse] = kwargs.pop("cls", None) + + request = build_get_status_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + integration_name=integration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_status.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OpenAIIntegrationStatusResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py index dbb633cae84e..b3cf206d85a1 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py @@ -40,7 +40,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py index def6b8bfb7c7..10e8d415d203 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +39,7 @@ def build_get_api_key_request(subscription_id: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50,7 +51,7 @@ def build_get_api_key_request(subscription_id: str, **kwargs: Any) -> HttpReques "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -63,6 +64,33 @@ def build_get_api_key_request(subscription_id: str, **kwargs: Any) -> HttpReques return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_elastic_to_azure_subscription_mapping_request(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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class OrganizationsOperations: """ .. warning:: @@ -165,7 +193,7 @@ def get_api_key( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -208,3 +236,65 @@ def get_api_key( return deserialized get_api_key.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getOrganizationApiKey"} + + @distributed_trace + def get_elastic_to_azure_subscription_mapping( + self, **kwargs: Any + ) -> _models.ElasticOrganizationToAzureSubscriptionMappingResponse: + """Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + + Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElasticOrganizationToAzureSubscriptionMappingResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse + :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.ElasticOrganizationToAzureSubscriptionMappingResponse] = kwargs.pop("cls", None) + + request = build_get_elastic_to_azure_subscription_mapping_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_elastic_to_azure_subscription_mapping.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ElasticOrganizationToAzureSubscriptionMappingResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_elastic_to_azure_subscription_mapping.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py index 909cb38d4eef..ca63211e996e 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +53,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -73,7 +76,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -84,12 +87,14 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_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") @@ -108,7 +113,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,12 +123,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_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") @@ -140,7 +147,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,12 +157,14 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_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") @@ -193,8 +202,8 @@ def list( List the tag rules for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -296,8 +305,8 @@ def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -329,8 +338,8 @@ def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -360,8 +369,8 @@ def create_or_update( Create or update a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -396,7 +405,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -453,8 +462,8 @@ def get( Get a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -576,8 +585,8 @@ def begin_delete( Delete a tag rule set for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py index 10906efde353..f42ad50f6b35 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,11 +55,13 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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,8 +101,8 @@ def delete( # pylint: disable=inconsistent-return-statements Delete traffic filter from the account. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py index 31b48571ba70..8a3b1ffdcdf2 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_details_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +50,13 @@ def build_details_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -90,8 +92,8 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> List of upgradable versions for a given monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py index 00c04f8cfaf2..fb7b96db199d 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py @@ -6,6 +6,7 @@ # 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 from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +41,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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,11 +52,13 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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,8 +104,8 @@ def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -131,8 +134,8 @@ def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -159,8 +162,8 @@ def update( # pylint: disable=inconsistent-return-statements Update the vm details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str @@ -193,7 +196,7 @@ def update( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py index e30b3b0be992..a0608c530195 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(resource_group_name: str, monitor_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +50,13 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -90,8 +92,8 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It List the vm resources currently being monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py index 25fe8184cbfb..8e93e299daaa 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_details_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-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +50,13 @@ def build_details_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "monitorName": _SERIALIZER.url("monitor_name", monitor_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") @@ -90,8 +92,8 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> List the vm ingestion details that will be monitored by the Elastic monitor resource. - :param resource_group_name: The name of the resource group to which the Elastic resource - belongs. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py index a42374ba3806..7d3175590f5c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AllTrafficFilters_list.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/AllTrafficFilters_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py index 4ebfacddd958..e05bb54d2103 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.associate_traffic_filter.begin_associate( + client.associate_traffic_filter.begin_associate( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociateTrafficFilter_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/AssociateTrafficFilter_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py index 7fa71659b4f9..cb3e0b0c7899 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociatedFiltersForDeployment_list.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/AssociatedFiltersForDeployment_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py new file mode 100644 index 000000000000..8369a5e094f3 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/billing_info_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python billing_info_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.billing_info.get( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + ) + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/BillingInfo_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.py new file mode 100644 index 000000000000..2779e93ef4f6 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/connected_partner_resources_list.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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python connected_partner_resources_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.connected_partner_resources.list( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/ConnectedPartnerResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py index f9f5471d191c..ee115e308d25 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DeploymentInfo_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/DeploymentInfo_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py index 37c3be96b736..a71aa082c39c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.detach_and_delete_traffic_filter.delete( + client.detach_and_delete_traffic_filter.delete( resource_group_name="myResourceGroup", monitor_name="myMonitor", ) - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachAndDeleteTrafficFilter_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/DetachAndDeleteTrafficFilter_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py index d1bc562e0155..de27e0b217f1 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.detach_traffic_filter.begin_update( + client.detach_traffic_filter.begin_update( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachTrafficFilters_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/DetachTrafficFilters_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py index d25c99d64273..14bb29581dd8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/elastic_versions_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/ElasticVersions_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/ElasticVersions_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py index cb2d81d0f7a2..8d1c822e6860 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/ExternalUserInfo.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/ExternalUserInfo.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py index 7c9f06f5823c..683ea8581d9c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.create_and_associate_ip_filter.begin_create( + client.create_and_associate_ip_filter.begin_create( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/IPTrafficFilter_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/IPTrafficFilter_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py index 03933d91bf37..cae386438b3c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.monitor.begin_upgrade( + client.monitor.begin_upgrade( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitor_Upgrade.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitor_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py index 34c42022dd53..6c61d5e77229 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/MonitoredResources_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/MonitoredResources_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py index 97bec945a017..fcb36ab99e0e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py index e618dbfeb7b3..8508c7bfe590 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.monitors.begin_delete( + client.monitors.begin_delete( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py index 2374996c0997..82ca4ed917b1 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Get.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py index 780a08c79273..8892681b3dc8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py index 4263efcf6b3c..6aa1d352aa7c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_ListByResourceGroup.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py index 45f443cf06b8..180ca65925f6 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Monitors_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.py new file mode 100644 index 000000000000..53730c609204 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_create_or_update.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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python open_ai_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.open_ai.create_or_update( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + integration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/OpenAI_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py new file mode 100644 index 000000000000..83820e26f865 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python open_ai_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.open_ai.delete( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + integration_name="default", + ) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/OpenAI_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.py new file mode 100644 index 000000000000..d33e01226733 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get.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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python open_ai_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.open_ai.get( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + integration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/OpenAI_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.py new file mode 100644 index 000000000000..f2b0989f557a --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_get_status.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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python open_ai_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.open_ai.get_status( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + integration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/OpenAI_GetStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.py new file mode 100644 index 000000000000..c2f27766f5e7 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/open_ai_list.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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python open_ai_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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.open_ai.list( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/OpenAI_List.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py index 789d816651c8..f58286117a8d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py index c890fc4eea4f..c739a18d1b3d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Organizations_GetApiKey.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Organizations_GetApiKey.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py new file mode 100644 index 000000000000..bb148685ec9a --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_elastic_to_azure_subscription_mapping.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python organizations_get_elastic_to_azure_subscription_mapping.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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.organizations.get_elastic_to_azure_subscription_mapping() + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/Organizations_GetElasticToAzureSubscriptionMapping.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py index 6fc1a55f2f98..9baac8b9480c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.create_and_associate_pl_filter.begin_create( + client.create_and_associate_pl_filter.begin_create( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/PrivateLinkTrafficFilters_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/PrivateLinkTrafficFilters_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py index f16175babc31..49ea3891ad19 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_CreateOrUpdate.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/TagRules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py index 07be4c529575..6ef68c6e7347 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.tag_rules.begin_delete( + client.tag_rules.begin_delete( resource_group_name="myResourceGroup", monitor_name="myMonitor", rule_set_name="default", ).result() - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/TagRules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py index ac3e4b327080..d55a33b3ee16 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Get.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/TagRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py index 4635af09ee15..7f037ad6fd54 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/TagRules_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py index 12d2890ec1b8..155628baceb7 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.traffic_filters.delete( + client.traffic_filters.delete( resource_group_name="myResourceGroup", monitor_name="myMonitor", ) - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TrafficFilters_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/TrafficFilters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py index 9760ac3fc9ad..e30d57f99251 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/UpgradableVersions_Details.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/UpgradableVersions_Details.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py index 46d2923474a9..b7830249e49d 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.vm_collection.update( + client.vm_collection.update( resource_group_name="myResourceGroup", monitor_name="myMonitor", ) - print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMCollection_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/VMCollection_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py index 377cd922c9c5..611f2d5202c2 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMHost_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/VMHost_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py index 88b44f9d902e..14f804237a1f 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMIngestion_Details.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2024-01-01-preview/examples/VMIngestion_Details.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json b/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json index e09bc1adcd23..7233a7cb58e9 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json +++ b/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json @@ -1,11 +1,11 @@ { - "commit": "09e36d3ffae7fa6428cef8c86f2ad7caf4704e2c", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/elasticsan/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/elasticsan/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/elasticsan/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/_meta.json b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/_meta.json index 639262301bed..c992d6c0c367 100644 --- a/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/_meta.json +++ b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/_meta.json @@ -1,11 +1,11 @@ { - "commit": "51a6e410cf9752dfdaad71f0f9778645d737d8c4", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hardwaresecuritymodules/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/hardwaresecuritymodules/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hardwaresecuritymodules/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/azure/mgmt/hardwaresecuritymodules/_version.py b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/azure/mgmt/hardwaresecuritymodules/_version.py index e5754a47ce68..dfa6ee022f15 100644 --- a/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/azure/mgmt/hardwaresecuritymodules/_version.py +++ b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/azure/mgmt/hardwaresecuritymodules/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0b2" diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/_meta.json b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/_meta.json index 10dc5f749454..bd88aeae0ddc 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/_meta.json +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "ec882de9043fe225777bbf5fd28ed5259b0949db", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md" } \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_configuration.py index 09e475d6cf9e..f62eb392a19b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_configuration.py @@ -29,14 +29,14 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-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(HDInsightContainersMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-06-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_hd_insight_containers_mgmt_client.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_hd_insight_containers_mgmt_client.py index 615dafbac692..508b497d0020 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_hd_insight_containers_mgmt_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/_hd_insight_containers_mgmt_client.py @@ -18,7 +18,9 @@ from .operations import ( AvailableClusterPoolVersionsOperations, AvailableClusterVersionsOperations, + ClusterAvailableUpgradesOperations, ClusterJobsOperations, + ClusterPoolAvailableUpgradesOperations, ClusterPoolsOperations, ClustersOperations, LocationsOperations, @@ -31,12 +33,18 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """HDInsight On Aks Management Client. + """HDInsight Containers Management Client. :ivar cluster_pools: ClusterPoolsOperations operations :vartype cluster_pools: azure.mgmt.hdinsightcontainers.operations.ClusterPoolsOperations + :ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations + :vartype cluster_pool_available_upgrades: + azure.mgmt.hdinsightcontainers.operations.ClusterPoolAvailableUpgradesOperations :ivar clusters: ClustersOperations operations :vartype clusters: azure.mgmt.hdinsightcontainers.operations.ClustersOperations + :ivar cluster_available_upgrades: ClusterAvailableUpgradesOperations operations + :vartype cluster_available_upgrades: + azure.mgmt.hdinsightcontainers.operations.ClusterAvailableUpgradesOperations :ivar cluster_jobs: ClusterJobsOperations operations :vartype cluster_jobs: azure.mgmt.hdinsightcontainers.operations.ClusterJobsOperations :ivar locations: LocationsOperations operations @@ -55,7 +63,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi :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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-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 @@ -79,7 +87,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.cluster_pools = ClusterPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_available_upgrades = ClusterAvailableUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.cluster_jobs = ClusterJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_configuration.py index 415d5705e755..4204f951ee49 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_configuration.py @@ -29,14 +29,14 @@ class HDInsightContainersMgmtClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-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(HDInsightContainersMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-06-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_hd_insight_containers_mgmt_client.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_hd_insight_containers_mgmt_client.py index 4f035e558401..bc3c66fb035c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_hd_insight_containers_mgmt_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/_hd_insight_containers_mgmt_client.py @@ -18,7 +18,9 @@ from .operations import ( AvailableClusterPoolVersionsOperations, AvailableClusterVersionsOperations, + ClusterAvailableUpgradesOperations, ClusterJobsOperations, + ClusterPoolAvailableUpgradesOperations, ClusterPoolsOperations, ClustersOperations, LocationsOperations, @@ -31,12 +33,18 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """HDInsight On Aks Management Client. + """HDInsight Containers Management Client. :ivar cluster_pools: ClusterPoolsOperations operations :vartype cluster_pools: azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolsOperations + :ivar cluster_pool_available_upgrades: ClusterPoolAvailableUpgradesOperations operations + :vartype cluster_pool_available_upgrades: + azure.mgmt.hdinsightcontainers.aio.operations.ClusterPoolAvailableUpgradesOperations :ivar clusters: ClustersOperations operations :vartype clusters: azure.mgmt.hdinsightcontainers.aio.operations.ClustersOperations + :ivar cluster_available_upgrades: ClusterAvailableUpgradesOperations operations + :vartype cluster_available_upgrades: + azure.mgmt.hdinsightcontainers.aio.operations.ClusterAvailableUpgradesOperations :ivar cluster_jobs: ClusterJobsOperations operations :vartype cluster_jobs: azure.mgmt.hdinsightcontainers.aio.operations.ClusterJobsOperations :ivar locations: LocationsOperations operations @@ -55,7 +63,7 @@ class HDInsightContainersMgmtClient: # pylint: disable=client-accepts-api-versi :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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-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 @@ -79,7 +87,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.cluster_pools = ClusterPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_pool_available_upgrades = ClusterPoolAvailableUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_available_upgrades = ClusterAvailableUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.cluster_jobs = ClusterJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/__init__.py index 3c44ccd0cd62..560926c82ae8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/__init__.py @@ -7,7 +7,9 @@ # -------------------------------------------------------------------------- from ._cluster_pools_operations import ClusterPoolsOperations +from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations from ._clusters_operations import ClustersOperations +from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations from ._cluster_jobs_operations import ClusterJobsOperations from ._locations_operations import LocationsOperations from ._operations import Operations @@ -20,7 +22,9 @@ __all__ = [ "ClusterPoolsOperations", + "ClusterPoolAvailableUpgradesOperations", "ClustersOperations", + "ClusterAvailableUpgradesOperations", "ClusterJobsOperations", "LocationsOperations", "Operations", diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_available_upgrades_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_available_upgrades_operations.py new file mode 100644 index 000000000000..15f5a9db0e65 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_available_upgrades_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cluster_available_upgrades_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ClusterAvailableUpgradesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s + :attr:`cluster_available_upgrades` 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, cluster_pool_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ClusterAvailableUpgrade"]: + """List a cluster available upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterAvailableUpgrade or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade] + :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.ClusterAvailableUpgradeList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_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) + + 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("ClusterAvailableUpgradeList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/availableUpgrades" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_jobs_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_jobs_operations.py index ea5fdaeac7bb..e8a200ea1615 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_jobs_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_jobs_operations.py @@ -299,7 +299,12 @@ def get_long_running_output(pipeline_response): @distributed_trace def list( - self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + filter: Optional[str] = None, + **kwargs: Any ) -> AsyncIterable["_models.ClusterJob"]: """Get jobs of HDInsight on AKS cluster. @@ -310,6 +315,9 @@ def list( :type cluster_pool_name: str :param cluster_name: The name of the HDInsight cluster. Required. :type cluster_name: str + :param filter: The system query option to filter job returned in the response. Allowed value is + 'jobName eq {jobName}' or 'jarName eq {jarName}'. Default value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterJob or the result of cls(response) :rtype: @@ -338,6 +346,7 @@ def prepare_request(next_link=None): cluster_pool_name=cluster_pool_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, + filter=filter, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pool_available_upgrades_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pool_available_upgrades_operations.py new file mode 100644 index 000000000000..d845e0ac48fb --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pool_available_upgrades_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cluster_pool_available_upgrades_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ClusterPoolAvailableUpgradesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsightcontainers.aio.HDInsightContainersMgmtClient`'s + :attr:`cluster_pool_available_upgrades` 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, cluster_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ClusterPoolAvailableUpgrade"]: + """List a cluster pool available upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterPoolAvailableUpgrade or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade] + :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.ClusterPoolAvailableUpgradeList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_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) + + 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("ClusterPoolAvailableUpgradeList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/availableUpgrades" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pools_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pools_operations.py index 2097150454bb..b81b9333595e 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pools_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_cluster_pools_operations.py @@ -38,6 +38,7 @@ build_list_by_resource_group_request, build_list_by_subscription_request, build_update_tags_request, + build_upgrade_request, ) T = TypeVar("T") @@ -623,7 +624,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) @@ -876,3 +877,234 @@ async def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools" } + + async def _upgrade_initial( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO], + **kwargs: Any + ) -> Optional[_models.ClusterPool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ClusterPool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cluster_pool_upgrade_request, (IOBase, bytes)): + _content = cluster_pool_upgrade_request + else: + _json = self._serialize.body(cluster_pool_upgrade_request, "ClusterPoolUpgrade") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ClusterPool", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgrade" + } + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: _models.ClusterPoolUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Required. + :type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade + :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 ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Required. + :type cluster_pool_upgrade_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Is either a ClusterPoolUpgrade + type or a IO type. Required. + :type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :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.ClusterPool] = 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._upgrade_initial( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_pool_upgrade_request=cluster_pool_upgrade_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ClusterPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgrade" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_clusters_operations.py index d8a2d4feb9f8..01aba74047da 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/aio/operations/_clusters_operations.py @@ -41,6 +41,7 @@ build_list_service_configs_request, build_resize_request, build_update_request, + build_upgrade_request, ) T = TypeVar("T") @@ -158,6 +159,248 @@ async def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters" } + async def _upgrade_initial( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: Union[_models.ClusterUpgrade, IO], + **kwargs: Any + ) -> Optional[_models.Cluster]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Cluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cluster_upgrade_request, (IOBase, bytes)): + _content = cluster_upgrade_request + else: + _json = self._serialize.body(cluster_upgrade_request, "ClusterUpgrade") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Cluster", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/upgrade" + } + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: _models.ClusterUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Required. + :type cluster_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgrade + :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 Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Required. + :type cluster_upgrade_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: Union[_models.ClusterUpgrade, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Is either a ClusterUpgrade type or a IO + type. Required. + :type cluster_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgrade or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :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.Cluster] = 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._upgrade_initial( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_name, + cluster_upgrade_request=cluster_upgrade_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/upgrade" + } + async def _resize_initial( self, resource_group_name: str, @@ -990,7 +1233,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/__init__.py index 39a26dba8fe7..9b80b38784d7 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/__init__.py @@ -12,8 +12,16 @@ from ._models_py3 import AutoscaleProfile from ._models_py3 import CatalogOptions from ._models_py3 import Cluster +from ._models_py3 import ClusterAKSPatchVersionUpgradeProperties +from ._models_py3 import ClusterAccessProfile +from ._models_py3 import ClusterAvailableUpgrade +from ._models_py3 import ClusterAvailableUpgradeAksPatchUpgradeProperties +from ._models_py3 import ClusterAvailableUpgradeHotfixUpgradeProperties +from ._models_py3 import ClusterAvailableUpgradeList +from ._models_py3 import ClusterAvailableUpgradeProperties from ._models_py3 import ClusterComponentsItem from ._models_py3 import ClusterConfigFile +from ._models_py3 import ClusterHotfixUpgradeProperties from ._models_py3 import ClusterInstanceViewProperties from ._models_py3 import ClusterInstanceViewPropertiesStatus from ._models_py3 import ClusterInstanceViewResult @@ -27,41 +35,63 @@ from ._models_py3 import ClusterLogAnalyticsApplicationLogs from ._models_py3 import ClusterLogAnalyticsProfile from ._models_py3 import ClusterPatch +from ._models_py3 import ClusterPatchProperties from ._models_py3 import ClusterPool +from ._models_py3 import ClusterPoolAKSPatchVersionUpgradeProperties +from ._models_py3 import ClusterPoolAvailableUpgrade +from ._models_py3 import ClusterPoolAvailableUpgradeAksPatchUpgradeProperties +from ._models_py3 import ClusterPoolAvailableUpgradeList +from ._models_py3 import ClusterPoolAvailableUpgradeNodeOsUpgradeProperties +from ._models_py3 import ClusterPoolAvailableUpgradeProperties from ._models_py3 import ClusterPoolComputeProfile from ._models_py3 import ClusterPoolListResult from ._models_py3 import ClusterPoolLogAnalyticsProfile from ._models_py3 import ClusterPoolNetworkProfile +from ._models_py3 import ClusterPoolNodeOsImageUpdateProperties from ._models_py3 import ClusterPoolProfile +from ._models_py3 import ClusterPoolResourceProperties from ._models_py3 import ClusterPoolResourcePropertiesAksClusterProfile from ._models_py3 import ClusterPoolResourcePropertiesClusterPoolProfile from ._models_py3 import ClusterPoolResourcePropertiesComputeProfile from ._models_py3 import ClusterPoolResourcePropertiesLogAnalyticsProfile from ._models_py3 import ClusterPoolResourcePropertiesNetworkProfile +from ._models_py3 import ClusterPoolUpgrade +from ._models_py3 import ClusterPoolUpgradeProperties from ._models_py3 import ClusterPoolVersion +from ._models_py3 import ClusterPoolVersionProperties from ._models_py3 import ClusterPoolVersionsListResult from ._models_py3 import ClusterProfile from ._models_py3 import ClusterPrometheusProfile +from ._models_py3 import ClusterRangerPluginProfile from ._models_py3 import ClusterResizeData +from ._models_py3 import ClusterResizeProperties +from ._models_py3 import ClusterResourceProperties from ._models_py3 import ClusterServiceConfig from ._models_py3 import ClusterServiceConfigsProfile +from ._models_py3 import ClusterUpgrade +from ._models_py3 import ClusterUpgradeProperties from ._models_py3 import ClusterVersion +from ._models_py3 import ClusterVersionProperties from ._models_py3 import ClusterVersionsListResult from ._models_py3 import ComparisonRule from ._models_py3 import ComputeProfile from ._models_py3 import ComputeResourceDefinition from ._models_py3 import ConnectivityProfile from ._models_py3 import ConnectivityProfileWeb +from ._models_py3 import DiskStorageProfile from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import FlinkCatalogOptions from ._models_py3 import FlinkHiveCatalogOption +from ._models_py3 import FlinkJobProfile from ._models_py3 import FlinkJobProperties from ._models_py3 import FlinkProfile from ._models_py3 import FlinkStorageProfile from ._models_py3 import HiveCatalogOption from ._models_py3 import IdentityProfile +from ._models_py3 import KafkaConnectivityEndpoints +from ._models_py3 import KafkaProfile from ._models_py3 import LoadBasedConfig from ._models_py3 import NameAvailabilityParameters from ._models_py3 import NameAvailabilityResult @@ -70,6 +100,11 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult from ._models_py3 import ProxyResource +from ._models_py3 import RangerAdminSpec +from ._models_py3 import RangerAdminSpecDatabase +from ._models_py3 import RangerAuditSpec +from ._models_py3 import RangerProfile +from ._models_py3 import RangerUsersyncSpec from ._models_py3 import Resource from ._models_py3 import ScalingRule from ._models_py3 import Schedule @@ -93,6 +128,7 @@ from ._models_py3 import TagsObject from ._models_py3 import TrackedResource from ._models_py3 import TrinoCoordinator +from ._models_py3 import TrinoDebugConfig from ._models_py3 import TrinoProfile from ._models_py3 import TrinoTelemetryConfig from ._models_py3 import TrinoUserPlugin @@ -105,15 +141,29 @@ from ._hd_insight_containers_mgmt_client_enums import Action from ._hd_insight_containers_mgmt_client_enums import ActionType from ._hd_insight_containers_mgmt_client_enums import AutoscaleType +from ._hd_insight_containers_mgmt_client_enums import ClusterAvailableUpgradeType +from ._hd_insight_containers_mgmt_client_enums import ClusterPoolAvailableUpgradeType +from ._hd_insight_containers_mgmt_client_enums import ClusterPoolUpgradeType +from ._hd_insight_containers_mgmt_client_enums import ClusterUpgradeType from ._hd_insight_containers_mgmt_client_enums import ComparisonOperator from ._hd_insight_containers_mgmt_client_enums import ContentEncoding from ._hd_insight_containers_mgmt_client_enums import CreatedByType +from ._hd_insight_containers_mgmt_client_enums import CurrentClusterAksVersionStatus +from ._hd_insight_containers_mgmt_client_enums import CurrentClusterPoolAksVersionStatus +from ._hd_insight_containers_mgmt_client_enums import DataDiskType +from ._hd_insight_containers_mgmt_client_enums import DbConnectionAuthenticationMode +from ._hd_insight_containers_mgmt_client_enums import DeploymentMode from ._hd_insight_containers_mgmt_client_enums import JobType from ._hd_insight_containers_mgmt_client_enums import KeyVaultObjectType +from ._hd_insight_containers_mgmt_client_enums import MetastoreDbConnectionAuthenticationMode from ._hd_insight_containers_mgmt_client_enums import Origin +from ._hd_insight_containers_mgmt_client_enums import OutboundType from ._hd_insight_containers_mgmt_client_enums import ProvisioningStatus +from ._hd_insight_containers_mgmt_client_enums import RangerUsersyncMode from ._hd_insight_containers_mgmt_client_enums import ScaleActionType from ._hd_insight_containers_mgmt_client_enums import ScheduleDay +from ._hd_insight_containers_mgmt_client_enums import Severity +from ._hd_insight_containers_mgmt_client_enums import UpgradeMode from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -125,8 +175,16 @@ "AutoscaleProfile", "CatalogOptions", "Cluster", + "ClusterAKSPatchVersionUpgradeProperties", + "ClusterAccessProfile", + "ClusterAvailableUpgrade", + "ClusterAvailableUpgradeAksPatchUpgradeProperties", + "ClusterAvailableUpgradeHotfixUpgradeProperties", + "ClusterAvailableUpgradeList", + "ClusterAvailableUpgradeProperties", "ClusterComponentsItem", "ClusterConfigFile", + "ClusterHotfixUpgradeProperties", "ClusterInstanceViewProperties", "ClusterInstanceViewPropertiesStatus", "ClusterInstanceViewResult", @@ -140,41 +198,63 @@ "ClusterLogAnalyticsApplicationLogs", "ClusterLogAnalyticsProfile", "ClusterPatch", + "ClusterPatchProperties", "ClusterPool", + "ClusterPoolAKSPatchVersionUpgradeProperties", + "ClusterPoolAvailableUpgrade", + "ClusterPoolAvailableUpgradeAksPatchUpgradeProperties", + "ClusterPoolAvailableUpgradeList", + "ClusterPoolAvailableUpgradeNodeOsUpgradeProperties", + "ClusterPoolAvailableUpgradeProperties", "ClusterPoolComputeProfile", "ClusterPoolListResult", "ClusterPoolLogAnalyticsProfile", "ClusterPoolNetworkProfile", + "ClusterPoolNodeOsImageUpdateProperties", "ClusterPoolProfile", + "ClusterPoolResourceProperties", "ClusterPoolResourcePropertiesAksClusterProfile", "ClusterPoolResourcePropertiesClusterPoolProfile", "ClusterPoolResourcePropertiesComputeProfile", "ClusterPoolResourcePropertiesLogAnalyticsProfile", "ClusterPoolResourcePropertiesNetworkProfile", + "ClusterPoolUpgrade", + "ClusterPoolUpgradeProperties", "ClusterPoolVersion", + "ClusterPoolVersionProperties", "ClusterPoolVersionsListResult", "ClusterProfile", "ClusterPrometheusProfile", + "ClusterRangerPluginProfile", "ClusterResizeData", + "ClusterResizeProperties", + "ClusterResourceProperties", "ClusterServiceConfig", "ClusterServiceConfigsProfile", + "ClusterUpgrade", + "ClusterUpgradeProperties", "ClusterVersion", + "ClusterVersionProperties", "ClusterVersionsListResult", "ComparisonRule", "ComputeProfile", "ComputeResourceDefinition", "ConnectivityProfile", "ConnectivityProfileWeb", + "DiskStorageProfile", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "FlinkCatalogOptions", "FlinkHiveCatalogOption", + "FlinkJobProfile", "FlinkJobProperties", "FlinkProfile", "FlinkStorageProfile", "HiveCatalogOption", "IdentityProfile", + "KafkaConnectivityEndpoints", + "KafkaProfile", "LoadBasedConfig", "NameAvailabilityParameters", "NameAvailabilityResult", @@ -183,6 +263,11 @@ "OperationDisplay", "OperationListResult", "ProxyResource", + "RangerAdminSpec", + "RangerAdminSpecDatabase", + "RangerAuditSpec", + "RangerProfile", + "RangerUsersyncSpec", "Resource", "ScalingRule", "Schedule", @@ -206,6 +291,7 @@ "TagsObject", "TrackedResource", "TrinoCoordinator", + "TrinoDebugConfig", "TrinoProfile", "TrinoTelemetryConfig", "TrinoUserPlugin", @@ -217,15 +303,29 @@ "Action", "ActionType", "AutoscaleType", + "ClusterAvailableUpgradeType", + "ClusterPoolAvailableUpgradeType", + "ClusterPoolUpgradeType", + "ClusterUpgradeType", "ComparisonOperator", "ContentEncoding", "CreatedByType", + "CurrentClusterAksVersionStatus", + "CurrentClusterPoolAksVersionStatus", + "DataDiskType", + "DbConnectionAuthenticationMode", + "DeploymentMode", "JobType", "KeyVaultObjectType", + "MetastoreDbConnectionAuthenticationMode", "Origin", + "OutboundType", "ProvisioningStatus", + "RangerUsersyncMode", "ScaleActionType", "ScheduleDay", + "Severity", + "UpgradeMode", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_hd_insight_containers_mgmt_client_enums.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_hd_insight_containers_mgmt_client_enums.py index cd4fd682c917..e48704219cba 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_hd_insight_containers_mgmt_client_enums.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_hd_insight_containers_mgmt_client_enums.py @@ -25,6 +25,8 @@ class Action(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAVEPOINT = "SAVEPOINT" LIST_SAVEPOINT = "LIST_SAVEPOINT" DELETE = "DELETE" + LAST_STATE_UPDATE = "LAST_STATE_UPDATE" + RE_LAUNCH = "RE_LAUNCH" class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -40,6 +42,34 @@ class AutoscaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LOAD_BASED = "LoadBased" +class ClusterAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of upgrade.""" + + AKS_PATCH_UPGRADE = "AKSPatchUpgrade" + HOTFIX_UPGRADE = "HotfixUpgrade" + + +class ClusterPoolAvailableUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of upgrade.""" + + AKS_PATCH_UPGRADE = "AKSPatchUpgrade" + NODE_OS_UPGRADE = "NodeOsUpgrade" + + +class ClusterPoolUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of upgrade.""" + + AKS_PATCH_UPGRADE = "AKSPatchUpgrade" + NODE_OS_UPGRADE = "NodeOsUpgrade" + + +class ClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of upgrade.""" + + AKS_PATCH_UPGRADE = "AKSPatchUpgrade" + HOTFIX_UPGRADE = "HotfixUpgrade" + + class ComparisonOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The comparison operator.""" @@ -68,6 +98,51 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class CurrentClusterAksVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current AKS version's status: whether it is deprecated or supported.""" + + DEPRECATED = "Deprecated" + SUPPORTED = "Supported" + + +class CurrentClusterPoolAksVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current AKS version's status: whether it is deprecated or supported.""" + + DEPRECATED = "Deprecated" + SUPPORTED = "Supported" + + +class DataDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Managed Disk Type.""" + + STANDARD_HDD_LRS = "Standard_HDD_LRS" + STANDARD_SSD_LRS = "Standard_SSD_LRS" + STANDARD_SSD_ZRS = "Standard_SSD_ZRS" + PREMIUM_SSD_LRS = "Premium_SSD_LRS" + PREMIUM_SSD_ZRS = "Premium_SSD_ZRS" + PREMIUM_SSD_V2_LRS = "Premium_SSD_v2_LRS" + + +class DbConnectionAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The authentication mode to connect to your Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + """ + + SQL_AUTH = "SqlAuth" + """The password-based authentication to connect to your Hive metastore database.""" + IDENTITY_AUTH = "IdentityAuth" + """The managed-identity-based authentication to connect to your Hive metastore database.""" + + +class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A string property that indicates the deployment mode of Flink cluster. It can have one of the + following enum values => Application, Session. Default value is Session. + """ + + APPLICATION = "Application" + SESSION = "Session" + + class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of cluster job.""" @@ -82,6 +157,17 @@ class KeyVaultObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CERTIFICATE = "Certificate" +class MetastoreDbConnectionAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The authentication mode to connect to your Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + """ + + SQL_AUTH = "SqlAuth" + """The password-based authentication to connect to your Hive metastore database.""" + IDENTITY_AUTH = "IdentityAuth" + """The managed-identity-based authentication to connect to your Hive metastore database.""" + + 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". @@ -92,6 +178,17 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This can only be set at cluster pool creation time and cannot be changed later.""" + + LOAD_BALANCER = "loadBalancer" + """The load balancer is used for egress through an AKS assigned public IP. This supports + #: Kubernetes services of type 'loadBalancer'.""" + USER_DEFINED_ROUTING = "userDefinedRouting" + """Egress paths must be defined by the user. This is an advanced scenario and requires proper + #: network configuration.""" + + class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the resource.""" @@ -101,6 +198,13 @@ class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" +class RangerUsersyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """User & groups can be synced automatically or via a static list that's refreshed.""" + + STATIC = "static" + AUTOMATIC = "automatic" + + class ScaleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The action type.""" @@ -118,3 +222,22 @@ class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): THURSDAY = "Thursday" FRIDAY = "Friday" SATURDAY = "Saturday" + + +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of this upgrade.""" + + LOW = "low" + MEDIUM = "medium" + HIGH = "high" + CRITICAL = "critical" + + +class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A string property that indicates the upgrade mode to be performed on the Flink job. It can have + one of the following enum values => STATELESS_UPDATE, UPDATE, LAST_STATE_UPDATE. + """ + + STATELESS_UPDATE = "STATELESS_UPDATE" + UPDATE = "UPDATE" + LAST_STATE_UPDATE = "LAST_STATE_UPDATE" diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_models_py3.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_models_py3.py index 260c4f07d8d6..9d5e23d78da5 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_models_py3.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/models/_models_py3.py @@ -375,7 +375,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes +class Cluster(TrackedResource): """The cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -397,19 +397,8 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", - "Succeeded", "Canceled", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.hdinsightcontainers.models.ProvisioningStatus - :ivar cluster_type: The type of cluster. - :vartype cluster_type: str - :ivar deployment_id: A unique id generated by the RP to identify the resource. - :vartype deployment_id: str - :ivar compute_profile: The compute profile. - :vartype compute_profile: ~azure.mgmt.hdinsightcontainers.models.ComputeProfile - :ivar cluster_profile: Cluster profile. - :vartype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterProfile - :ivar status: Business status of the resource. - :vartype status: str + :ivar properties: Gets or sets the properties. Define cluster specific properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterResourceProperties """ _validation = { @@ -418,10 +407,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "cluster_type": {"pattern": r"^[a-zA-Z][a-zA-Z0-9]{0,31}$"}, - "deployment_id": {"readonly": True}, - "status": {"readonly": True}, } _attribute_map = { @@ -431,12 +416,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_type": {"key": "properties.clusterType", "type": "str"}, - "deployment_id": {"key": "properties.deploymentId", "type": "str"}, - "compute_profile": {"key": "properties.computeProfile", "type": "ComputeProfile"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "ClusterProfile"}, - "status": {"key": "properties.status", "type": "str"}, + "properties": {"key": "properties", "type": "ClusterResourceProperties"}, } def __init__( @@ -444,9 +424,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - cluster_type: Optional[str] = None, - compute_profile: Optional["_models.ComputeProfile"] = None, - cluster_profile: Optional["_models.ClusterProfile"] = None, + properties: Optional["_models.ClusterResourceProperties"] = None, **kwargs: Any ) -> None: """ @@ -454,20 +432,427 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword cluster_type: The type of cluster. - :paramtype cluster_type: str - :keyword compute_profile: The compute profile. - :paramtype compute_profile: ~azure.mgmt.hdinsightcontainers.models.ComputeProfile - :keyword cluster_profile: Cluster profile. - :paramtype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterProfile + :keyword properties: Gets or sets the properties. Define cluster specific properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterResourceProperties """ super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None - self.cluster_type = cluster_type - self.deployment_id = None - self.compute_profile = compute_profile - self.cluster_profile = cluster_profile - self.status = None + self.properties = properties + + +class ClusterAccessProfile(_serialization.Model): + """Cluster access profile. + + 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 enable_internal_ingress: Whether to create cluster using private IP instead of public IP. + This property must be set at create time. Required. + :vartype enable_internal_ingress: bool + :ivar private_link_service_id: Private link service resource ID. Only when + enableInternalIngress is true, this property will be returned. + :vartype private_link_service_id: str + """ + + _validation = { + "enable_internal_ingress": {"required": True}, + "private_link_service_id": {"readonly": True}, + } + + _attribute_map = { + "enable_internal_ingress": {"key": "enableInternalIngress", "type": "bool"}, + "private_link_service_id": {"key": "privateLinkServiceId", "type": "str"}, + } + + def __init__(self, *, enable_internal_ingress: bool, **kwargs: Any) -> None: + """ + :keyword enable_internal_ingress: Whether to create cluster using private IP instead of public + IP. This property must be set at create time. Required. + :paramtype enable_internal_ingress: bool + """ + super().__init__(**kwargs) + self.enable_internal_ingress = enable_internal_ingress + self.private_link_service_id = None + + +class ClusterUpgradeProperties(_serialization.Model): + """Properties of upgrading cluster. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClusterAKSPatchVersionUpgradeProperties, ClusterHotfixUpgradeProperties + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + _subtype_map = { + "upgrade_type": { + "AKSPatchUpgrade": "ClusterAKSPatchVersionUpgradeProperties", + "HotfixUpgrade": "ClusterHotfixUpgradeProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: Optional[str] = None + + +class ClusterAKSPatchVersionUpgradeProperties(ClusterUpgradeProperties): + """Properties of upgrading cluster's AKS patch version. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: str = "AKSPatchUpgrade" + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.hdinsightcontainers.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class ClusterAvailableUpgrade(ProxyResource): + """Cluster available upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.hdinsightcontainers.models.SystemData + :ivar properties: Gets or sets the properties. Define cluster upgrade specific properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgradeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ClusterAvailableUpgradeProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ClusterAvailableUpgradeProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Gets or sets the properties. Define cluster upgrade specific properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgradeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ClusterAvailableUpgradeProperties(_serialization.Model): + """Cluster available upgrade properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClusterAvailableUpgradeAksPatchUpgradeProperties, + ClusterAvailableUpgradeHotfixUpgradeProperties + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + _subtype_map = { + "upgrade_type": { + "AKSPatchUpgrade": "ClusterAvailableUpgradeAksPatchUpgradeProperties", + "HotfixUpgrade": "ClusterAvailableUpgradeHotfixUpgradeProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: Optional[str] = None + + +class ClusterAvailableUpgradeAksPatchUpgradeProperties(ClusterAvailableUpgradeProperties): + """Cluster available AKS patch version upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgradeType + :ivar current_version: Current node pool version. + :vartype current_version: str + :ivar current_version_status: Current AKS version's status: whether it is deprecated or + supported. Known values are: "Deprecated" and "Supported". + :vartype current_version_status: str or + ~azure.mgmt.hdinsightcontainers.models.CurrentClusterAksVersionStatus + :ivar latest_version: Latest available version, which should be equal to AKS control plane + version if it's not deprecated. + :vartype latest_version: str + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "current_version": {"key": "currentVersion", "type": "str"}, + "current_version_status": {"key": "currentVersionStatus", "type": "str"}, + "latest_version": {"key": "latestVersion", "type": "str"}, + } + + def __init__( + self, + *, + current_version: Optional[str] = None, + current_version_status: Optional[Union[str, "_models.CurrentClusterAksVersionStatus"]] = None, + latest_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword current_version: Current node pool version. + :paramtype current_version: str + :keyword current_version_status: Current AKS version's status: whether it is deprecated or + supported. Known values are: "Deprecated" and "Supported". + :paramtype current_version_status: str or + ~azure.mgmt.hdinsightcontainers.models.CurrentClusterAksVersionStatus + :keyword latest_version: Latest available version, which should be equal to AKS control plane + version if it's not deprecated. + :paramtype latest_version: str + """ + super().__init__(**kwargs) + self.upgrade_type: str = "AKSPatchUpgrade" + self.current_version = current_version + self.current_version_status = current_version_status + self.latest_version = latest_version + + +class ClusterAvailableUpgradeHotfixUpgradeProperties( + ClusterAvailableUpgradeProperties +): # pylint: disable=too-many-instance-attributes + """Cluster available hotfix version upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgradeType + :ivar description: Hotfix version upgrade description. + :vartype description: str + :ivar source_oss_version: Source OSS version of current cluster component. + :vartype source_oss_version: str + :ivar source_cluster_version: Source cluster version of current cluster component. + :vartype source_cluster_version: str + :ivar source_build_number: Source build number of current cluster component. + :vartype source_build_number: str + :ivar target_oss_version: Target OSS version of component to be upgraded. + :vartype target_oss_version: str + :ivar target_cluster_version: Target cluster version of component to be upgraded. + :vartype target_cluster_version: str + :ivar target_build_number: Target build number of component to be upgraded. + :vartype target_build_number: str + :ivar component_name: Name of component to be upgraded. + :vartype component_name: str + :ivar severity: Severity of this upgrade. Known values are: "low", "medium", "high", and + "critical". + :vartype severity: str or ~azure.mgmt.hdinsightcontainers.models.Severity + :ivar extended_properties: Extended properties of current available upgrade version. + :vartype extended_properties: str + :ivar created_time: Created time of current available upgrade version. + :vartype created_time: ~datetime.datetime + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "source_oss_version": {"key": "sourceOssVersion", "type": "str"}, + "source_cluster_version": {"key": "sourceClusterVersion", "type": "str"}, + "source_build_number": {"key": "sourceBuildNumber", "type": "str"}, + "target_oss_version": {"key": "targetOssVersion", "type": "str"}, + "target_cluster_version": {"key": "targetClusterVersion", "type": "str"}, + "target_build_number": {"key": "targetBuildNumber", "type": "str"}, + "component_name": {"key": "componentName", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "extended_properties": {"key": "extendedProperties", "type": "str"}, + "created_time": {"key": "createdTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + source_oss_version: Optional[str] = None, + source_cluster_version: Optional[str] = None, + source_build_number: Optional[str] = None, + target_oss_version: Optional[str] = None, + target_cluster_version: Optional[str] = None, + target_build_number: Optional[str] = None, + component_name: Optional[str] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, + extended_properties: Optional[str] = None, + created_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Hotfix version upgrade description. + :paramtype description: str + :keyword source_oss_version: Source OSS version of current cluster component. + :paramtype source_oss_version: str + :keyword source_cluster_version: Source cluster version of current cluster component. + :paramtype source_cluster_version: str + :keyword source_build_number: Source build number of current cluster component. + :paramtype source_build_number: str + :keyword target_oss_version: Target OSS version of component to be upgraded. + :paramtype target_oss_version: str + :keyword target_cluster_version: Target cluster version of component to be upgraded. + :paramtype target_cluster_version: str + :keyword target_build_number: Target build number of component to be upgraded. + :paramtype target_build_number: str + :keyword component_name: Name of component to be upgraded. + :paramtype component_name: str + :keyword severity: Severity of this upgrade. Known values are: "low", "medium", "high", and + "critical". + :paramtype severity: str or ~azure.mgmt.hdinsightcontainers.models.Severity + :keyword extended_properties: Extended properties of current available upgrade version. + :paramtype extended_properties: str + :keyword created_time: Created time of current available upgrade version. + :paramtype created_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.upgrade_type: str = "HotfixUpgrade" + self.description = description + self.source_oss_version = source_oss_version + self.source_cluster_version = source_cluster_version + self.source_build_number = source_build_number + self.target_oss_version = target_oss_version + self.target_cluster_version = target_cluster_version + self.target_build_number = target_build_number + self.component_name = component_name + self.severity = severity + self.extended_properties = extended_properties + self.created_time = created_time + + +class ClusterAvailableUpgradeList(_serialization.Model): + """Collection of cluster available upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of Cluster available upgrade. Required. + :vartype value: list[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade] + :ivar next_link: The URL of next result page. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ClusterAvailableUpgrade]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ClusterAvailableUpgrade"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of Cluster available upgrade. Required. + :paramtype value: list[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade] + :keyword next_link: The URL of next result page. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link class ClusterComponentsItem(_serialization.Model): @@ -563,6 +948,63 @@ def __init__( self.values = values +class ClusterHotfixUpgradeProperties(ClusterUpgradeProperties): + """Properties of upgrading cluster's hotfix. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "HotfixUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeType + :ivar target_oss_version: Target OSS version of component to be upgraded. + :vartype target_oss_version: str + :ivar target_cluster_version: Target cluster version of component to be upgraded. + :vartype target_cluster_version: str + :ivar target_build_number: Target build number of component to be upgraded. + :vartype target_build_number: str + :ivar component_name: Name of component to be upgraded. + :vartype component_name: str + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "target_oss_version": {"key": "targetOssVersion", "type": "str"}, + "target_cluster_version": {"key": "targetClusterVersion", "type": "str"}, + "target_build_number": {"key": "targetBuildNumber", "type": "str"}, + "component_name": {"key": "componentName", "type": "str"}, + } + + def __init__( + self, + *, + target_oss_version: Optional[str] = None, + target_cluster_version: Optional[str] = None, + target_build_number: Optional[str] = None, + component_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_oss_version: Target OSS version of component to be upgraded. + :paramtype target_oss_version: str + :keyword target_cluster_version: Target cluster version of component to be upgraded. + :paramtype target_cluster_version: str + :keyword target_build_number: Target build number of component to be upgraded. + :paramtype target_build_number: str + :keyword component_name: Name of component to be upgraded. + :paramtype component_name: str + """ + super().__init__(**kwargs) + self.upgrade_type: str = "HotfixUpgrade" + self.target_oss_version = target_oss_version + self.target_cluster_version = target_cluster_version + self.target_build_number = target_build_number + self.component_name = component_name + + class ClusterInstanceViewProperties(_serialization.Model): """Cluster Instance View Properties. @@ -570,7 +1012,7 @@ class ClusterInstanceViewProperties(_serialization.Model): :ivar status: Status of the instance view. Required. :vartype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus - :ivar service_statuses: List of statuses of relevant services that make up the HDInsight on aks + :ivar service_statuses: List of statuses of relevant services that make up the HDInsight on AKS cluster to surface to the customer. Required. :vartype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] """ @@ -596,7 +1038,7 @@ def __init__( :keyword status: Status of the instance view. Required. :paramtype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus :keyword service_statuses: List of statuses of relevant services that make up the HDInsight on - aks cluster to surface to the customer. Required. + AKS cluster to surface to the customer. Required. :paramtype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] """ super().__init__(**kwargs) @@ -688,46 +1130,31 @@ class ClusterInstanceViewResult(_serialization.Model): :ivar name: Name of the instance view. Required. :vartype name: str - :ivar status: Status of the instance view. Required. - :vartype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus - :ivar service_statuses: List of statuses of relevant services that make up the HDInsight on aks - cluster to surface to the customer. Required. - :vartype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] + :ivar properties: Properties of the instance view. Required. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewResultProperties """ _validation = { "name": {"required": True}, - "status": {"required": True}, - "service_statuses": {"required": True}, + "properties": {"required": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, - "status": {"key": "properties.status", "type": "ClusterInstanceViewPropertiesStatus"}, - "service_statuses": {"key": "properties.serviceStatuses", "type": "[ServiceStatus]"}, + "properties": {"key": "properties", "type": "ClusterInstanceViewResultProperties"}, } - def __init__( - self, - *, - name: str, - status: "_models.ClusterInstanceViewPropertiesStatus", - service_statuses: List["_models.ServiceStatus"], - **kwargs: Any - ) -> None: + def __init__(self, *, name: str, properties: "_models.ClusterInstanceViewResultProperties", **kwargs: Any) -> None: """ :keyword name: Name of the instance view. Required. :paramtype name: str - :keyword status: Status of the instance view. Required. - :paramtype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus - :keyword service_statuses: List of statuses of relevant services that make up the HDInsight on - aks cluster to surface to the customer. Required. - :paramtype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] + :keyword properties: Properties of the instance view. Required. + :paramtype properties: + ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewResultProperties """ super().__init__(**kwargs) self.name = name - self.status = status - self.service_statuses = service_statuses + self.properties = properties class ClusterInstanceViewResultProperties(ClusterInstanceViewProperties): @@ -737,7 +1164,7 @@ class ClusterInstanceViewResultProperties(ClusterInstanceViewProperties): :ivar status: Status of the instance view. Required. :vartype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus - :ivar service_statuses: List of statuses of relevant services that make up the HDInsight on aks + :ivar service_statuses: List of statuses of relevant services that make up the HDInsight on AKS cluster to surface to the customer. Required. :vartype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] """ @@ -763,7 +1190,7 @@ def __init__( :keyword status: Status of the instance view. Required. :paramtype status: ~azure.mgmt.hdinsightcontainers.models.ClusterInstanceViewPropertiesStatus :keyword service_statuses: List of statuses of relevant services that make up the HDInsight on - aks cluster to surface to the customer. Required. + AKS cluster to surface to the customer. Required. :paramtype service_statuses: list[~azure.mgmt.hdinsightcontainers.models.ServiceStatus] """ super().__init__(status=status, service_statuses=service_statuses, **kwargs) @@ -799,44 +1226,6 @@ def __init__(self, *, value: Optional[List["_models.ClusterInstanceViewResult"]] self.next_link = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/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.hdinsightcontainers.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - class ClusterJob(ProxyResource): """Cluster job. @@ -1049,9 +1438,61 @@ def __init__( self.metrics_enabled = metrics_enabled -class ClusterPatch(TrackedResource): +class ClusterPatch(_serialization.Model): """The patch for a cluster. + :ivar properties: Define cluster patch specific properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPatchProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ClusterPatchProperties"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ClusterPatchProperties"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Define cluster patch specific properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPatchProperties + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.tags = tags + + +class ClusterPatchProperties(_serialization.Model): + """Cluster resource patch data. + + :ivar cluster_profile: Cluster resource patch properties. + :vartype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.UpdatableClusterProfile + """ + + _attribute_map = { + "cluster_profile": {"key": "clusterProfile", "type": "UpdatableClusterProfile"}, + } + + def __init__(self, *, cluster_profile: Optional["_models.UpdatableClusterProfile"] = None, **kwargs: Any) -> None: + """ + :keyword cluster_profile: Cluster resource patch properties. + :paramtype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.UpdatableClusterProfile + """ + super().__init__(**kwargs) + self.cluster_profile = cluster_profile + + +class ClusterPool(TrackedResource): + """Cluster pool. + 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. @@ -1071,8 +1512,8 @@ class ClusterPatch(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar cluster_profile: Cluster resource patch properties. - :vartype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.UpdatableClusterProfile + :ivar properties: Gets or sets the properties. Define cluster pool specific properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourceProperties """ _validation = { @@ -1090,7 +1531,7 @@ class ClusterPatch(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "cluster_profile": {"key": "properties.clusterProfile", "type": "UpdatableClusterProfile"}, + "properties": {"key": "properties", "type": "ClusterPoolResourceProperties"}, } def __init__( @@ -1098,7 +1539,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - cluster_profile: Optional["_models.UpdatableClusterProfile"] = None, + properties: Optional["_models.ClusterPoolResourceProperties"] = None, **kwargs: Any ) -> None: """ @@ -1106,20 +1547,112 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword cluster_profile: Cluster resource patch properties. - :paramtype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.UpdatableClusterProfile + :keyword properties: Gets or sets the properties. Define cluster pool specific properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourceProperties """ super().__init__(tags=tags, location=location, **kwargs) - self.cluster_profile = cluster_profile + self.properties = properties -class ClusterPool(TrackedResource): # pylint: disable=too-many-instance-attributes - """Cluster pool. +class ClusterPoolUpgradeProperties(_serialization.Model): + """Properties of upgrading cluster pool. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClusterPoolAKSPatchVersionUpgradeProperties, ClusterPoolNodeOsImageUpdateProperties + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + _subtype_map = { + "upgrade_type": { + "AKSPatchUpgrade": "ClusterPoolAKSPatchVersionUpgradeProperties", + "NodeOsUpgrade": "ClusterPoolNodeOsImageUpdateProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: Optional[str] = None - Variables are only populated by the server, and will be ignored when sending a request. + +class ClusterPoolAKSPatchVersionUpgradeProperties(ClusterPoolUpgradeProperties): + """Properties of upgrading cluster pool's AKS patch version. All required parameters must be populated in order to send to Azure. + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeType + :ivar upgrade_cluster_pool: whether upgrade cluster pool or not. If it's true, + upgradeAllClusterNodes should be false. + :vartype upgrade_cluster_pool: bool + :ivar upgrade_all_cluster_nodes: whether upgrade all clusters' nodes. If it's true, + upgradeClusterPool should be false. + :vartype upgrade_all_cluster_nodes: bool + :ivar target_aks_version: Target AKS version. When it's not set, latest version will be used. + When upgradeClusterPool is true and upgradeAllClusterNodes is false, target version should be + greater or equal to current version. When upgradeClusterPool is false and + upgradeAllClusterNodes is true, target version should be equal to AKS version of cluster pool. + :vartype target_aks_version: str + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "upgrade_cluster_pool": {"key": "upgradeClusterPool", "type": "bool"}, + "upgrade_all_cluster_nodes": {"key": "upgradeAllClusterNodes", "type": "bool"}, + "target_aks_version": {"key": "targetAksVersion", "type": "str"}, + } + + def __init__( + self, + *, + upgrade_cluster_pool: bool = False, + upgrade_all_cluster_nodes: bool = False, + target_aks_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword upgrade_cluster_pool: whether upgrade cluster pool or not. If it's true, + upgradeAllClusterNodes should be false. + :paramtype upgrade_cluster_pool: bool + :keyword upgrade_all_cluster_nodes: whether upgrade all clusters' nodes. If it's true, + upgradeClusterPool should be false. + :paramtype upgrade_all_cluster_nodes: bool + :keyword target_aks_version: Target AKS version. When it's not set, latest version will be + used. When upgradeClusterPool is true and upgradeAllClusterNodes is false, target version + should be greater or equal to current version. When upgradeClusterPool is false and + upgradeAllClusterNodes is true, target version should be equal to AKS version of cluster pool. + :paramtype target_aks_version: str + """ + super().__init__(**kwargs) + self.upgrade_type: str = "AKSPatchUpgrade" + self.upgrade_cluster_pool = upgrade_cluster_pool + self.upgrade_all_cluster_nodes = upgrade_all_cluster_nodes + self.target_aks_version = target_aks_version + + +class ClusterPoolAvailableUpgrade(ProxyResource): + """Cluster pool available upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str @@ -1131,134 +1664,194 @@ class ClusterPool(TrackedResource): # pylint: disable=too-many-instance-attribu :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.hdinsightcontainers.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 provisioning_state: Provisioning state of the resource. Known values are: "Accepted", - "Succeeded", "Canceled", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.hdinsightcontainers.models.ProvisioningStatus - :ivar deployment_id: A unique id generated by the RP to identify the resource. - :vartype deployment_id: str - :ivar managed_resource_group_name: A resource group created by RP, to hold the resources - created by RP on-behalf of customers. It will also be used to generate - aksManagedResourceGroupName by pattern: MC\ *{managedResourceGroupName}*\ - {clusterPoolName}_{region}. Please make sure it meets resource group name restriction. - :vartype managed_resource_group_name: str - :ivar aks_managed_resource_group_name: A resource group created by AKS, to hold the - infrastructure resources created by AKS on-behalf of customers. It is generated by cluster pool - name and managed resource group name by pattern: MC\ *{managedResourceGroupName}*\ - {clusterPoolName}_{region}. - :vartype aks_managed_resource_group_name: str - :ivar cluster_pool_profile: CLuster pool profile. - :vartype cluster_pool_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesClusterPoolProfile - :ivar compute_profile: CLuster pool compute profile. - :vartype compute_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesComputeProfile - :ivar aks_cluster_profile: Properties of underlying AKS cluster. - :vartype aks_cluster_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesAksClusterProfile - :ivar network_profile: Cluster pool network profile. - :vartype network_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesNetworkProfile - :ivar log_analytics_profile: Cluster pool log analytics profile to enable OMS agent for AKS - cluster. - :vartype log_analytics_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesLogAnalyticsProfile - :ivar status: Business status of the resource. - :vartype status: str + :ivar properties: Gets or sets the properties. Define cluster pool upgrade specific properties. + :vartype properties: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgradeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ClusterPoolAvailableUpgradeProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ClusterPoolAvailableUpgradeProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Gets or sets the properties. Define cluster pool upgrade specific + properties. + :paramtype properties: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgradeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ClusterPoolAvailableUpgradeProperties(_serialization.Model): + """Cluster pool available upgrade properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClusterPoolAvailableUpgradeAksPatchUpgradeProperties, + ClusterPoolAvailableUpgradeNodeOsUpgradeProperties + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + _subtype_map = { + "upgrade_type": { + "AKSPatchUpgrade": "ClusterPoolAvailableUpgradeAksPatchUpgradeProperties", + "NodeOsUpgrade": "ClusterPoolAvailableUpgradeNodeOsUpgradeProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: Optional[str] = None + + +class ClusterPoolAvailableUpgradeAksPatchUpgradeProperties(ClusterPoolAvailableUpgradeProperties): + """Cluster pool available AKS patch version upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgradeType + :ivar current_version: Current AKS version. + :vartype current_version: str + :ivar current_version_status: Current AKS version's status: whether it is deprecated or + supported. Known values are: "Deprecated" and "Supported". + :vartype current_version_status: str or + ~azure.mgmt.hdinsightcontainers.models.CurrentClusterPoolAksVersionStatus + :ivar latest_version: Latest AKS patch version. + :vartype latest_version: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "deployment_id": {"readonly": True}, - "managed_resource_group_name": {"max_length": 40, "min_length": 1}, - "aks_managed_resource_group_name": {"readonly": True}, - "aks_cluster_profile": {"readonly": True}, - "status": {"readonly": True}, + "upgrade_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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "deployment_id": {"key": "properties.deploymentId", "type": "str"}, - "managed_resource_group_name": {"key": "properties.managedResourceGroupName", "type": "str"}, - "aks_managed_resource_group_name": {"key": "properties.aksManagedResourceGroupName", "type": "str"}, - "cluster_pool_profile": { - "key": "properties.clusterPoolProfile", - "type": "ClusterPoolResourcePropertiesClusterPoolProfile", - }, - "compute_profile": {"key": "properties.computeProfile", "type": "ClusterPoolResourcePropertiesComputeProfile"}, - "aks_cluster_profile": { - "key": "properties.aksClusterProfile", - "type": "ClusterPoolResourcePropertiesAksClusterProfile", - }, - "network_profile": {"key": "properties.networkProfile", "type": "ClusterPoolResourcePropertiesNetworkProfile"}, - "log_analytics_profile": { - "key": "properties.logAnalyticsProfile", - "type": "ClusterPoolResourcePropertiesLogAnalyticsProfile", - }, - "status": {"key": "properties.status", "type": "str"}, + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "current_version": {"key": "currentVersion", "type": "str"}, + "current_version_status": {"key": "currentVersionStatus", "type": "str"}, + "latest_version": {"key": "latestVersion", "type": "str"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - managed_resource_group_name: Optional[str] = None, - cluster_pool_profile: Optional["_models.ClusterPoolResourcePropertiesClusterPoolProfile"] = None, - compute_profile: Optional["_models.ClusterPoolResourcePropertiesComputeProfile"] = None, - network_profile: Optional["_models.ClusterPoolResourcePropertiesNetworkProfile"] = None, - log_analytics_profile: Optional["_models.ClusterPoolResourcePropertiesLogAnalyticsProfile"] = None, + current_version: Optional[str] = None, + current_version_status: Optional[Union[str, "_models.CurrentClusterPoolAksVersionStatus"]] = None, + latest_version: Optional[str] = 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 managed_resource_group_name: A resource group created by RP, to hold the resources - created by RP on-behalf of customers. It will also be used to generate - aksManagedResourceGroupName by pattern: MC\ *{managedResourceGroupName}*\ - {clusterPoolName}_{region}. Please make sure it meets resource group name restriction. - :paramtype managed_resource_group_name: str - :keyword cluster_pool_profile: CLuster pool profile. - :paramtype cluster_pool_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesClusterPoolProfile - :keyword compute_profile: CLuster pool compute profile. - :paramtype compute_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesComputeProfile - :keyword network_profile: Cluster pool network profile. - :paramtype network_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesNetworkProfile - :keyword log_analytics_profile: Cluster pool log analytics profile to enable OMS agent for AKS - cluster. - :paramtype log_analytics_profile: - ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesLogAnalyticsProfile + :keyword current_version: Current AKS version. + :paramtype current_version: str + :keyword current_version_status: Current AKS version's status: whether it is deprecated or + supported. Known values are: "Deprecated" and "Supported". + :paramtype current_version_status: str or + ~azure.mgmt.hdinsightcontainers.models.CurrentClusterPoolAksVersionStatus + :keyword latest_version: Latest AKS patch version. + :paramtype latest_version: str """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None - self.deployment_id = None - self.managed_resource_group_name = managed_resource_group_name - self.aks_managed_resource_group_name = None - self.cluster_pool_profile = cluster_pool_profile - self.compute_profile = compute_profile - self.aks_cluster_profile = None - self.network_profile = network_profile - self.log_analytics_profile = log_analytics_profile - self.status = None + super().__init__(**kwargs) + self.upgrade_type: str = "AKSPatchUpgrade" + self.current_version = current_version + self.current_version_status = current_version_status + self.latest_version = latest_version + + +class ClusterPoolAvailableUpgradeList(_serialization.Model): + """collection of cluster pool available upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of cluster pool available upgrade. Required. + :vartype value: list[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade] + :ivar next_link: The Url of next result page. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ClusterPoolAvailableUpgrade]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ClusterPoolAvailableUpgrade"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of cluster pool available upgrade. Required. + :paramtype value: list[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade] + :keyword next_link: The Url of next result page. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ClusterPoolAvailableUpgradeNodeOsUpgradeProperties(ClusterPoolAvailableUpgradeProperties): + """Cluster pool available node OS update. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgradeType + :ivar latest_version: The latest node OS version. + :vartype latest_version: str + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + "latest_version": {"key": "latestVersion", "type": "str"}, + } + + def __init__(self, *, latest_version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword latest_version: The latest node OS version. + :paramtype latest_version: str + """ + super().__init__(**kwargs) + self.upgrade_type: str = "NodeOsUpgrade" + self.latest_version = latest_version class ClusterPoolComputeProfile(_serialization.Model): @@ -1363,6 +1956,18 @@ class ClusterPoolNetworkProfile(_serialization.Model): :ivar subnet_id: Cluster pool subnet resource id. Required. :vartype subnet_id: str + :ivar outbound_type: This can only be set at cluster pool creation time and cannot be changed + later. Known values are: "loadBalancer" and "userDefinedRouting". + :vartype outbound_type: str or ~azure.mgmt.hdinsightcontainers.models.OutboundType + :ivar enable_private_api_server: ClusterPool is based on AKS cluster. AKS cluster exposes the + API server to public internet by default. If you set this property to true, a private AKS + cluster will be created, and it will use private apiserver, which is not exposed to public + internet. + :vartype enable_private_api_server: bool + :ivar api_server_authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. + 137.117.106.88/29. This feature is not compatible with private AKS clusters. So you cannot set + enablePrivateApiServer to true and apiServerAuthorizedIpRanges at the same time. + :vartype api_server_authorized_ip_ranges: list[str] """ _validation = { @@ -1371,15 +1976,65 @@ class ClusterPoolNetworkProfile(_serialization.Model): _attribute_map = { "subnet_id": {"key": "subnetId", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "enable_private_api_server": {"key": "enablePrivateApiServer", "type": "bool"}, + "api_server_authorized_ip_ranges": {"key": "apiServerAuthorizedIpRanges", "type": "[str]"}, } - def __init__(self, *, subnet_id: str, **kwargs: Any) -> None: + def __init__( + self, + *, + subnet_id: str, + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", + enable_private_api_server: Optional[bool] = None, + api_server_authorized_ip_ranges: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword subnet_id: Cluster pool subnet resource id. Required. :paramtype subnet_id: str + :keyword outbound_type: This can only be set at cluster pool creation time and cannot be + changed later. Known values are: "loadBalancer" and "userDefinedRouting". + :paramtype outbound_type: str or ~azure.mgmt.hdinsightcontainers.models.OutboundType + :keyword enable_private_api_server: ClusterPool is based on AKS cluster. AKS cluster exposes + the API server to public internet by default. If you set this property to true, a private AKS + cluster will be created, and it will use private apiserver, which is not exposed to public + internet. + :paramtype enable_private_api_server: bool + :keyword api_server_authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. + 137.117.106.88/29. This feature is not compatible with private AKS clusters. So you cannot set + enablePrivateApiServer to true and apiServerAuthorizedIpRanges at the same time. + :paramtype api_server_authorized_ip_ranges: list[str] """ super().__init__(**kwargs) self.subnet_id = subnet_id + self.outbound_type = outbound_type + self.enable_private_api_server = enable_private_api_server + self.api_server_authorized_ip_ranges = api_server_authorized_ip_ranges + + +class ClusterPoolNodeOsImageUpdateProperties(ClusterPoolUpgradeProperties): + """Properties of upgrading cluster pool's AKS patch version. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_type: Type of upgrade. Required. Known values are: "AKSPatchUpgrade" and + "NodeOsUpgrade". + :vartype upgrade_type: str or ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeType + """ + + _validation = { + "upgrade_type": {"required": True}, + } + + _attribute_map = { + "upgrade_type": {"key": "upgradeType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upgrade_type: str = "NodeOsUpgrade" class ClusterPoolProfile(_serialization.Model): @@ -1408,6 +2063,120 @@ def __init__(self, *, cluster_pool_version: str, **kwargs: Any) -> None: self.cluster_pool_version = cluster_pool_version +class ClusterPoolResourceProperties(_serialization.Model): + """Cluster pool resource 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 provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.hdinsightcontainers.models.ProvisioningStatus + :ivar deployment_id: A unique id generated by the RP to identify the resource. + :vartype deployment_id: str + :ivar managed_resource_group_name: A resource group created by RP, to hold the resources + created by RP on-behalf of customers. It will also be used to generate + aksManagedResourceGroupName by pattern: MC\ *{managedResourceGroupName}*\ + {clusterPoolName}_{region}. Please make sure it meets resource group name restriction. + :vartype managed_resource_group_name: str + :ivar aks_managed_resource_group_name: A resource group created by AKS, to hold the + infrastructure resources created by AKS on-behalf of customers. It is generated by cluster pool + name and managed resource group name by pattern: MC\ *{managedResourceGroupName}*\ + {clusterPoolName}_{region}. + :vartype aks_managed_resource_group_name: str + :ivar cluster_pool_profile: CLuster pool profile. + :vartype cluster_pool_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesClusterPoolProfile + :ivar compute_profile: CLuster pool compute profile. Required. + :vartype compute_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesComputeProfile + :ivar aks_cluster_profile: Properties of underlying AKS cluster. + :vartype aks_cluster_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesAksClusterProfile + :ivar network_profile: Cluster pool network profile. + :vartype network_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesNetworkProfile + :ivar log_analytics_profile: Cluster pool log analytics profile to enable OMS agent for AKS + cluster. + :vartype log_analytics_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesLogAnalyticsProfile + :ivar status: Business status of the resource. + :vartype status: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_id": {"readonly": True}, + "managed_resource_group_name": {"max_length": 40, "min_length": 1}, + "aks_managed_resource_group_name": {"readonly": True}, + "compute_profile": {"required": True}, + "aks_cluster_profile": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_id": {"key": "deploymentId", "type": "str"}, + "managed_resource_group_name": {"key": "managedResourceGroupName", "type": "str"}, + "aks_managed_resource_group_name": {"key": "aksManagedResourceGroupName", "type": "str"}, + "cluster_pool_profile": { + "key": "clusterPoolProfile", + "type": "ClusterPoolResourcePropertiesClusterPoolProfile", + }, + "compute_profile": {"key": "computeProfile", "type": "ClusterPoolResourcePropertiesComputeProfile"}, + "aks_cluster_profile": {"key": "aksClusterProfile", "type": "ClusterPoolResourcePropertiesAksClusterProfile"}, + "network_profile": {"key": "networkProfile", "type": "ClusterPoolResourcePropertiesNetworkProfile"}, + "log_analytics_profile": { + "key": "logAnalyticsProfile", + "type": "ClusterPoolResourcePropertiesLogAnalyticsProfile", + }, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + compute_profile: "_models.ClusterPoolResourcePropertiesComputeProfile", + managed_resource_group_name: Optional[str] = None, + cluster_pool_profile: Optional["_models.ClusterPoolResourcePropertiesClusterPoolProfile"] = None, + network_profile: Optional["_models.ClusterPoolResourcePropertiesNetworkProfile"] = None, + log_analytics_profile: Optional["_models.ClusterPoolResourcePropertiesLogAnalyticsProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword managed_resource_group_name: A resource group created by RP, to hold the resources + created by RP on-behalf of customers. It will also be used to generate + aksManagedResourceGroupName by pattern: MC\ *{managedResourceGroupName}*\ + {clusterPoolName}_{region}. Please make sure it meets resource group name restriction. + :paramtype managed_resource_group_name: str + :keyword cluster_pool_profile: CLuster pool profile. + :paramtype cluster_pool_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesClusterPoolProfile + :keyword compute_profile: CLuster pool compute profile. Required. + :paramtype compute_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesComputeProfile + :keyword network_profile: Cluster pool network profile. + :paramtype network_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesNetworkProfile + :keyword log_analytics_profile: Cluster pool log analytics profile to enable OMS agent for AKS + cluster. + :paramtype log_analytics_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterPoolResourcePropertiesLogAnalyticsProfile + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.deployment_id = None + self.managed_resource_group_name = managed_resource_group_name + self.aks_managed_resource_group_name = None + self.cluster_pool_profile = cluster_pool_profile + self.compute_profile = compute_profile + self.aks_cluster_profile = None + self.network_profile = network_profile + self.log_analytics_profile = log_analytics_profile + self.status = None + + class ClusterPoolResourcePropertiesAksClusterProfile(AksClusterProfile): """Properties of underlying AKS cluster. @@ -1538,37 +2307,104 @@ class ClusterPoolResourcePropertiesLogAnalyticsProfile(ClusterPoolLogAnalyticsPr def __init__(self, *, enabled: bool, workspace_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword enabled: True if log analytics is enabled for cluster pool, otherwise false. Required. - :paramtype enabled: bool - :keyword workspace_id: Log analytics workspace to associate with the OMS agent. - :paramtype workspace_id: str + :keyword enabled: True if log analytics is enabled for cluster pool, otherwise false. Required. + :paramtype enabled: bool + :keyword workspace_id: Log analytics workspace to associate with the OMS agent. + :paramtype workspace_id: str + """ + super().__init__(enabled=enabled, workspace_id=workspace_id, **kwargs) + + +class ClusterPoolResourcePropertiesNetworkProfile(ClusterPoolNetworkProfile): + """Cluster pool network profile. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: Cluster pool subnet resource id. Required. + :vartype subnet_id: str + :ivar outbound_type: This can only be set at cluster pool creation time and cannot be changed + later. Known values are: "loadBalancer" and "userDefinedRouting". + :vartype outbound_type: str or ~azure.mgmt.hdinsightcontainers.models.OutboundType + :ivar enable_private_api_server: ClusterPool is based on AKS cluster. AKS cluster exposes the + API server to public internet by default. If you set this property to true, a private AKS + cluster will be created, and it will use private apiserver, which is not exposed to public + internet. + :vartype enable_private_api_server: bool + :ivar api_server_authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. + 137.117.106.88/29. This feature is not compatible with private AKS clusters. So you cannot set + enablePrivateApiServer to true and apiServerAuthorizedIpRanges at the same time. + :vartype api_server_authorized_ip_ranges: list[str] + """ + + _validation = { + "subnet_id": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "enable_private_api_server": {"key": "enablePrivateApiServer", "type": "bool"}, + "api_server_authorized_ip_ranges": {"key": "apiServerAuthorizedIpRanges", "type": "[str]"}, + } + + def __init__( + self, + *, + subnet_id: str, + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", + enable_private_api_server: Optional[bool] = None, + api_server_authorized_ip_ranges: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subnet_id: Cluster pool subnet resource id. Required. + :paramtype subnet_id: str + :keyword outbound_type: This can only be set at cluster pool creation time and cannot be + changed later. Known values are: "loadBalancer" and "userDefinedRouting". + :paramtype outbound_type: str or ~azure.mgmt.hdinsightcontainers.models.OutboundType + :keyword enable_private_api_server: ClusterPool is based on AKS cluster. AKS cluster exposes + the API server to public internet by default. If you set this property to true, a private AKS + cluster will be created, and it will use private apiserver, which is not exposed to public + internet. + :paramtype enable_private_api_server: bool + :keyword api_server_authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. + 137.117.106.88/29. This feature is not compatible with private AKS clusters. So you cannot set + enablePrivateApiServer to true and apiServerAuthorizedIpRanges at the same time. + :paramtype api_server_authorized_ip_ranges: list[str] """ - super().__init__(enabled=enabled, workspace_id=workspace_id, **kwargs) + super().__init__( + subnet_id=subnet_id, + outbound_type=outbound_type, + enable_private_api_server=enable_private_api_server, + api_server_authorized_ip_ranges=api_server_authorized_ip_ranges, + **kwargs + ) -class ClusterPoolResourcePropertiesNetworkProfile(ClusterPoolNetworkProfile): - """Cluster pool network profile. +class ClusterPoolUpgrade(_serialization.Model): + """Cluster Pool Upgrade. All required parameters must be populated in order to send to Azure. - :ivar subnet_id: Cluster pool subnet resource id. Required. - :vartype subnet_id: str + :ivar properties: Properties of upgrading cluster pool. Required. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeProperties """ _validation = { - "subnet_id": {"required": True}, + "properties": {"required": True}, } _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, + "properties": {"key": "properties", "type": "ClusterPoolUpgradeProperties"}, } - def __init__(self, *, subnet_id: str, **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.ClusterPoolUpgradeProperties", **kwargs: Any) -> None: """ - :keyword subnet_id: Cluster pool subnet resource id. Required. - :paramtype subnet_id: str + :keyword properties: Properties of upgrading cluster pool. Required. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgradeProperties """ - super().__init__(subnet_id=subnet_id, **kwargs) + super().__init__(**kwargs) + self.properties = properties class ClusterPoolVersion(ProxyResource): @@ -1587,12 +2423,8 @@ class ClusterPoolVersion(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.hdinsightcontainers.models.SystemData - :ivar cluster_pool_version: Cluster pool version is a 2-part version. - :vartype cluster_pool_version: str - :ivar aks_version: AKS version. - :vartype aks_version: str - :ivar is_preview: Indicate if this version is in preview or not. - :vartype is_preview: bool + :ivar properties: Cluster pool version properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolVersionProperties """ _validation = { @@ -1600,7 +2432,6 @@ class ClusterPoolVersion(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "cluster_pool_version": {"pattern": r"^(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})$"}, } _attribute_map = { @@ -1608,9 +2439,37 @@ class ClusterPoolVersion(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "cluster_pool_version": {"key": "properties.clusterPoolVersion", "type": "str"}, - "aks_version": {"key": "properties.aksVersion", "type": "str"}, - "is_preview": {"key": "properties.isPreview", "type": "bool"}, + "properties": {"key": "properties", "type": "ClusterPoolVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ClusterPoolVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Cluster pool version properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ClusterPoolVersionProperties(_serialization.Model): + """Cluster pool version properties. + + :ivar cluster_pool_version: Cluster pool version is a 2-part version. + :vartype cluster_pool_version: str + :ivar aks_version: AKS version. + :vartype aks_version: str + :ivar is_preview: Indicate if this version is in preview or not. + :vartype is_preview: bool + """ + + _validation = { + "cluster_pool_version": {"pattern": r"^(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})$"}, + } + + _attribute_map = { + "cluster_pool_version": {"key": "clusterPoolVersion", "type": "str"}, + "aks_version": {"key": "aksVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -1678,7 +2537,8 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance :vartype oss_version: str :ivar components: Component list of this cluster type and version. :vartype components: list[~azure.mgmt.hdinsightcontainers.models.ClusterComponentsItem] - :ivar identity_profile: Identity Profile with details of an MSI. Required. + :ivar identity_profile: This property is required by Trino, Spark and Flink cluster but is + optional for Kafka cluster. :vartype identity_profile: ~azure.mgmt.hdinsightcontainers.models.IdentityProfile :ivar authorization_profile: Authorization profile with details of AAD user Ids and group Ids authorized for data plane access. Required. @@ -1690,6 +2550,8 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance list[~azure.mgmt.hdinsightcontainers.models.ClusterServiceConfigsProfile] :ivar connectivity_profile: Cluster connectivity profile. :vartype connectivity_profile: ~azure.mgmt.hdinsightcontainers.models.ConnectivityProfile + :ivar cluster_access_profile: Cluster access profile. + :vartype cluster_access_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterAccessProfile :ivar log_analytics_profile: Cluster log analytics profile to enable or disable OMS agent for cluster. :vartype log_analytics_profile: @@ -1701,8 +2563,11 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance :ivar autoscale_profile: This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with Autoscale. :vartype autoscale_profile: ~azure.mgmt.hdinsightcontainers.models.AutoscaleProfile - :ivar kafka_profile: Kafka cluster profile. - :vartype kafka_profile: dict[str, any] + :ivar ranger_plugin_profile: Cluster Ranger plugin profile. + :vartype ranger_plugin_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterRangerPluginProfile + :ivar kafka_profile: The Kafka cluster profile. + :vartype kafka_profile: ~azure.mgmt.hdinsightcontainers.models.KafkaProfile :ivar trino_profile: Trino Cluster profile. :vartype trino_profile: ~azure.mgmt.hdinsightcontainers.models.TrinoProfile :ivar llap_profile: LLAP cluster profile. @@ -1711,6 +2576,8 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance :vartype flink_profile: ~azure.mgmt.hdinsightcontainers.models.FlinkProfile :ivar spark_profile: The spark cluster profile. :vartype spark_profile: ~azure.mgmt.hdinsightcontainers.models.SparkProfile + :ivar ranger_profile: The ranger cluster profile. + :vartype ranger_profile: ~azure.mgmt.hdinsightcontainers.models.RangerProfile :ivar stub_profile: Stub cluster profile. :vartype stub_profile: dict[str, any] :ivar script_action_profiles: The script action profile list. @@ -1728,7 +2595,6 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance "pattern": r"^(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})$", }, "components": {"readonly": True}, - "identity_profile": {"required": True}, "authorization_profile": {"required": True}, "connectivity_profile": {"readonly": True}, } @@ -1742,15 +2608,18 @@ class ClusterProfile(_serialization.Model): # pylint: disable=too-many-instance "secrets_profile": {"key": "secretsProfile", "type": "SecretsProfile"}, "service_configs_profiles": {"key": "serviceConfigsProfiles", "type": "[ClusterServiceConfigsProfile]"}, "connectivity_profile": {"key": "connectivityProfile", "type": "ConnectivityProfile"}, + "cluster_access_profile": {"key": "clusterAccessProfile", "type": "ClusterAccessProfile"}, "log_analytics_profile": {"key": "logAnalyticsProfile", "type": "ClusterLogAnalyticsProfile"}, "prometheus_profile": {"key": "prometheusProfile", "type": "ClusterPrometheusProfile"}, "ssh_profile": {"key": "sshProfile", "type": "SshProfile"}, "autoscale_profile": {"key": "autoscaleProfile", "type": "AutoscaleProfile"}, - "kafka_profile": {"key": "kafkaProfile", "type": "{object}"}, + "ranger_plugin_profile": {"key": "rangerPluginProfile", "type": "ClusterRangerPluginProfile"}, + "kafka_profile": {"key": "kafkaProfile", "type": "KafkaProfile"}, "trino_profile": {"key": "trinoProfile", "type": "TrinoProfile"}, "llap_profile": {"key": "llapProfile", "type": "{object}"}, "flink_profile": {"key": "flinkProfile", "type": "FlinkProfile"}, "spark_profile": {"key": "sparkProfile", "type": "SparkProfile"}, + "ranger_profile": {"key": "rangerProfile", "type": "RangerProfile"}, "stub_profile": {"key": "stubProfile", "type": "{object}"}, "script_action_profiles": {"key": "scriptActionProfiles", "type": "[ScriptActionProfile]"}, } @@ -1760,19 +2629,22 @@ def __init__( *, cluster_version: str, oss_version: str, - identity_profile: "_models.IdentityProfile", authorization_profile: "_models.AuthorizationProfile", + identity_profile: Optional["_models.IdentityProfile"] = None, secrets_profile: Optional["_models.SecretsProfile"] = None, service_configs_profiles: Optional[List["_models.ClusterServiceConfigsProfile"]] = None, + cluster_access_profile: Optional["_models.ClusterAccessProfile"] = None, log_analytics_profile: Optional["_models.ClusterLogAnalyticsProfile"] = None, prometheus_profile: Optional["_models.ClusterPrometheusProfile"] = None, ssh_profile: Optional["_models.SshProfile"] = None, autoscale_profile: Optional["_models.AutoscaleProfile"] = None, - kafka_profile: Optional[Dict[str, Any]] = None, + ranger_plugin_profile: Optional["_models.ClusterRangerPluginProfile"] = None, + kafka_profile: Optional["_models.KafkaProfile"] = None, trino_profile: Optional["_models.TrinoProfile"] = None, llap_profile: Optional[Dict[str, Any]] = None, flink_profile: Optional["_models.FlinkProfile"] = None, spark_profile: Optional["_models.SparkProfile"] = None, + ranger_profile: Optional["_models.RangerProfile"] = None, stub_profile: Optional[Dict[str, Any]] = None, script_action_profiles: Optional[List["_models.ScriptActionProfile"]] = None, **kwargs: Any @@ -1782,7 +2654,8 @@ def __init__( :paramtype cluster_version: str :keyword oss_version: Version with three part. Required. :paramtype oss_version: str - :keyword identity_profile: Identity Profile with details of an MSI. Required. + :keyword identity_profile: This property is required by Trino, Spark and Flink cluster but is + optional for Kafka cluster. :paramtype identity_profile: ~azure.mgmt.hdinsightcontainers.models.IdentityProfile :keyword authorization_profile: Authorization profile with details of AAD user Ids and group Ids authorized for data plane access. Required. @@ -1792,6 +2665,8 @@ def __init__( :keyword service_configs_profiles: The service configs profiles. :paramtype service_configs_profiles: list[~azure.mgmt.hdinsightcontainers.models.ClusterServiceConfigsProfile] + :keyword cluster_access_profile: Cluster access profile. + :paramtype cluster_access_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterAccessProfile :keyword log_analytics_profile: Cluster log analytics profile to enable or disable OMS agent for cluster. :paramtype log_analytics_profile: @@ -1803,8 +2678,11 @@ def __init__( :keyword autoscale_profile: This is the Autoscale profile for the cluster. This will allow customer to create cluster enabled with Autoscale. :paramtype autoscale_profile: ~azure.mgmt.hdinsightcontainers.models.AutoscaleProfile - :keyword kafka_profile: Kafka cluster profile. - :paramtype kafka_profile: dict[str, any] + :keyword ranger_plugin_profile: Cluster Ranger plugin profile. + :paramtype ranger_plugin_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterRangerPluginProfile + :keyword kafka_profile: The Kafka cluster profile. + :paramtype kafka_profile: ~azure.mgmt.hdinsightcontainers.models.KafkaProfile :keyword trino_profile: Trino Cluster profile. :paramtype trino_profile: ~azure.mgmt.hdinsightcontainers.models.TrinoProfile :keyword llap_profile: LLAP cluster profile. @@ -1813,6 +2691,8 @@ def __init__( :paramtype flink_profile: ~azure.mgmt.hdinsightcontainers.models.FlinkProfile :keyword spark_profile: The spark cluster profile. :paramtype spark_profile: ~azure.mgmt.hdinsightcontainers.models.SparkProfile + :keyword ranger_profile: The ranger cluster profile. + :paramtype ranger_profile: ~azure.mgmt.hdinsightcontainers.models.RangerProfile :keyword stub_profile: Stub cluster profile. :paramtype stub_profile: dict[str, any] :keyword script_action_profiles: The script action profile list. @@ -1828,15 +2708,18 @@ def __init__( self.secrets_profile = secrets_profile self.service_configs_profiles = service_configs_profiles self.connectivity_profile = None + self.cluster_access_profile = cluster_access_profile self.log_analytics_profile = log_analytics_profile self.prometheus_profile = prometheus_profile self.ssh_profile = ssh_profile self.autoscale_profile = autoscale_profile + self.ranger_plugin_profile = ranger_plugin_profile self.kafka_profile = kafka_profile self.trino_profile = trino_profile self.llap_profile = llap_profile self.flink_profile = flink_profile self.spark_profile = spark_profile + self.ranger_profile = ranger_profile self.stub_profile = stub_profile self.script_action_profiles = script_action_profiles @@ -1867,6 +2750,32 @@ def __init__(self, *, enabled: bool = False, **kwargs: Any) -> None: self.enabled = enabled +class ClusterRangerPluginProfile(_serialization.Model): + """Cluster Ranger plugin profile. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Enable Ranger for cluster or not. Required. + :vartype enabled: bool + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: bool = False, **kwargs: Any) -> None: + """ + :keyword enabled: Enable Ranger for cluster or not. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + class ClusterResizeData(TrackedResource): """The parameters for resizing a cluster. @@ -1889,8 +2798,8 @@ class ClusterResizeData(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar target_worker_node_count: Target node count of worker node. - :vartype target_worker_node_count: int + :ivar properties: Sets the properties. Define cluster resize specific properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterResizeProperties """ _validation = { @@ -1908,7 +2817,7 @@ class ClusterResizeData(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "target_worker_node_count": {"key": "properties.targetWorkerNodeCount", "type": "int"}, + "properties": {"key": "properties", "type": "ClusterResizeProperties"}, } def __init__( @@ -1916,7 +2825,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - target_worker_node_count: Optional[int] = None, + properties: Optional["_models.ClusterResizeProperties"] = None, **kwargs: Any ) -> None: """ @@ -1924,13 +2833,104 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword target_worker_node_count: Target node count of worker node. - :paramtype target_worker_node_count: int + :keyword properties: Sets the properties. Define cluster resize specific properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterResizeProperties """ super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ClusterResizeProperties(_serialization.Model): + """The properties for resizing a cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar target_worker_node_count: Target node count of worker node. Required. + :vartype target_worker_node_count: int + """ + + _validation = { + "target_worker_node_count": {"required": True}, + } + + _attribute_map = { + "target_worker_node_count": {"key": "targetWorkerNodeCount", "type": "int"}, + } + + def __init__(self, *, target_worker_node_count: int, **kwargs: Any) -> None: + """ + :keyword target_worker_node_count: Target node count of worker node. Required. + :paramtype target_worker_node_count: int + """ + super().__init__(**kwargs) self.target_worker_node_count = target_worker_node_count +class ClusterResourceProperties(_serialization.Model): + """Cluster resource 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 provisioning_state: Provisioning state of the resource. Known values are: "Accepted", + "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.hdinsightcontainers.models.ProvisioningStatus + :ivar cluster_type: The type of cluster. Required. + :vartype cluster_type: str + :ivar deployment_id: A unique id generated by the RP to identify the resource. + :vartype deployment_id: str + :ivar compute_profile: The compute profile. Required. + :vartype compute_profile: ~azure.mgmt.hdinsightcontainers.models.ComputeProfile + :ivar cluster_profile: Cluster profile. Required. + :vartype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterProfile + :ivar status: Business status of the resource. + :vartype status: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "cluster_type": {"required": True, "pattern": r"^[a-zA-Z][a-zA-Z0-9]{0,31}$"}, + "deployment_id": {"readonly": True}, + "compute_profile": {"required": True}, + "cluster_profile": {"required": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "cluster_type": {"key": "clusterType", "type": "str"}, + "deployment_id": {"key": "deploymentId", "type": "str"}, + "compute_profile": {"key": "computeProfile", "type": "ComputeProfile"}, + "cluster_profile": {"key": "clusterProfile", "type": "ClusterProfile"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + cluster_type: str, + compute_profile: "_models.ComputeProfile", + cluster_profile: "_models.ClusterProfile", + **kwargs: Any + ) -> None: + """ + :keyword cluster_type: The type of cluster. Required. + :paramtype cluster_type: str + :keyword compute_profile: The compute profile. Required. + :paramtype compute_profile: ~azure.mgmt.hdinsightcontainers.models.ComputeProfile + :keyword cluster_profile: Cluster profile. Required. + :paramtype cluster_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterProfile + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.cluster_type = cluster_type + self.deployment_id = None + self.compute_profile = compute_profile + self.cluster_profile = cluster_profile + self.status = None + + class ClusterServiceConfig(_serialization.Model): """Cluster configs per component. @@ -1997,6 +2997,32 @@ def __init__(self, *, service_name: str, configs: List["_models.ClusterServiceCo self.configs = configs +class ClusterUpgrade(_serialization.Model): + """Cluster Upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Properties of upgrading cluster. Required. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeProperties + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "ClusterUpgradeProperties"}, + } + + def __init__(self, *, properties: "_models.ClusterUpgradeProperties", **kwargs: Any) -> None: + """ + :keyword properties: Properties of upgrading cluster. Required. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgradeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + class ClusterVersion(ProxyResource): """Available cluster version. @@ -2013,6 +3039,39 @@ class ClusterVersion(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.hdinsightcontainers.models.SystemData + :ivar properties: Cluster version properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "ClusterVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ClusterVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Cluster version properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ClusterVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ClusterVersionProperties(_serialization.Model): + """Cluster version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar cluster_type: The type of cluster. :vartype cluster_type: str :ivar cluster_version: Version with three part. @@ -2029,10 +3088,6 @@ class ClusterVersion(ProxyResource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "cluster_type": {"pattern": r"^[a-zA-Z][a-zA-Z0-9]{0,31}$"}, "cluster_version": {"pattern": r"^(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})$"}, "oss_version": {"pattern": r"^(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})\.(0|[1-9][0-9]{0,18})$"}, @@ -2040,16 +3095,12 @@ class ClusterVersion(ProxyResource): } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "cluster_type": {"key": "properties.clusterType", "type": "str"}, - "cluster_version": {"key": "properties.clusterVersion", "type": "str"}, - "oss_version": {"key": "properties.ossVersion", "type": "str"}, - "cluster_pool_version": {"key": "properties.clusterPoolVersion", "type": "str"}, - "is_preview": {"key": "properties.isPreview", "type": "bool"}, - "components": {"key": "properties.components", "type": "[ClusterComponentsItem]"}, + "cluster_type": {"key": "clusterType", "type": "str"}, + "cluster_version": {"key": "clusterVersion", "type": "str"}, + "oss_version": {"key": "ossVersion", "type": "str"}, + "cluster_pool_version": {"key": "clusterPoolVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "components": {"key": "components", "type": "[ClusterComponentsItem]"}, } def __init__( @@ -2253,6 +3304,9 @@ class WebConnectivityEndpoint(_serialization.Model): :ivar fqdn: Web connectivity endpoint. Required. :vartype fqdn: str + :ivar private_fqdn: Private web connectivity endpoint. This property will only be returned when + enableInternalIngress is true. + :vartype private_fqdn: str """ _validation = { @@ -2261,15 +3315,20 @@ class WebConnectivityEndpoint(_serialization.Model): _attribute_map = { "fqdn": {"key": "fqdn", "type": "str"}, + "private_fqdn": {"key": "privateFqdn", "type": "str"}, } - def __init__(self, *, fqdn: str, **kwargs: Any) -> None: + def __init__(self, *, fqdn: str, private_fqdn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword fqdn: Web connectivity endpoint. Required. :paramtype fqdn: str + :keyword private_fqdn: Private web connectivity endpoint. This property will only be returned + when enableInternalIngress is true. + :paramtype private_fqdn: str """ super().__init__(**kwargs) self.fqdn = fqdn + self.private_fqdn = private_fqdn class ConnectivityProfileWeb(WebConnectivityEndpoint): @@ -2279,6 +3338,9 @@ class ConnectivityProfileWeb(WebConnectivityEndpoint): :ivar fqdn: Web connectivity endpoint. Required. :vartype fqdn: str + :ivar private_fqdn: Private web connectivity endpoint. This property will only be returned when + enableInternalIngress is true. + :vartype private_fqdn: str """ _validation = { @@ -2287,14 +3349,59 @@ class ConnectivityProfileWeb(WebConnectivityEndpoint): _attribute_map = { "fqdn": {"key": "fqdn", "type": "str"}, + "private_fqdn": {"key": "privateFqdn", "type": "str"}, } - def __init__(self, *, fqdn: str, **kwargs: Any) -> None: + def __init__(self, *, fqdn: str, private_fqdn: Optional[str] = None, **kwargs: Any) -> None: """ :keyword fqdn: Web connectivity endpoint. Required. :paramtype fqdn: str + :keyword private_fqdn: Private web connectivity endpoint. This property will only be returned + when enableInternalIngress is true. + :paramtype private_fqdn: str + """ + super().__init__(fqdn=fqdn, private_fqdn=private_fqdn, **kwargs) + + +class DiskStorageProfile(_serialization.Model): + """Kafka disk storage profile. + + All required parameters must be populated in order to send to Azure. + + :ivar data_disk_size: Managed Disk size in GB. The maximum supported disk size for Standard and + Premium HDD/SSD is 32TB, except for Premium SSD v2, which supports up to 64TB. Required. + :vartype data_disk_size: int + :ivar data_disk_type: Managed Disk Type. Required. Known values are: "Standard_HDD_LRS", + "Standard_SSD_LRS", "Standard_SSD_ZRS", "Premium_SSD_LRS", "Premium_SSD_ZRS", and + "Premium_SSD_v2_LRS". + :vartype data_disk_type: str or ~azure.mgmt.hdinsightcontainers.models.DataDiskType + """ + + _validation = { + "data_disk_size": {"required": True}, + "data_disk_type": {"required": True}, + } + + _attribute_map = { + "data_disk_size": {"key": "dataDiskSize", "type": "int"}, + "data_disk_type": {"key": "dataDiskType", "type": "str"}, + } + + def __init__( + self, *, data_disk_size: int, data_disk_type: Union[str, "_models.DataDiskType"], **kwargs: Any + ) -> None: """ - super().__init__(fqdn=fqdn, **kwargs) + :keyword data_disk_size: Managed Disk size in GB. The maximum supported disk size for Standard + and Premium HDD/SSD is 32TB, except for Premium SSD v2, which supports up to 64TB. Required. + :paramtype data_disk_size: int + :keyword data_disk_type: Managed Disk Type. Required. Known values are: "Standard_HDD_LRS", + "Standard_SSD_LRS", "Standard_SSD_ZRS", "Premium_SSD_LRS", "Premium_SSD_ZRS", and + "Premium_SSD_v2_LRS". + :paramtype data_disk_type: str or ~azure.mgmt.hdinsightcontainers.models.DataDiskType + """ + super().__init__(**kwargs) + self.data_disk_size = data_disk_size + self.data_disk_type = data_disk_type class ErrorAdditionalInfo(_serialization.Model): @@ -2414,22 +3521,30 @@ class FlinkHiveCatalogOption(_serialization.Model): All required parameters must be populated in order to send to Azure. + :ivar metastore_db_connection_authentication_mode: The authentication mode to connect to your + Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :vartype metastore_db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.MetastoreDbConnectionAuthenticationMode :ivar metastore_db_connection_password_secret: Secret reference name from - secretsProfile.secrets containing password for database connection. Required. + secretsProfile.secrets containing password for database connection. :vartype metastore_db_connection_password_secret: str :ivar metastore_db_connection_url: Connection string for hive metastore database. Required. :vartype metastore_db_connection_url: str - :ivar metastore_db_connection_user_name: User name for database connection. Required. + :ivar metastore_db_connection_user_name: User name for database connection. :vartype metastore_db_connection_user_name: str """ _validation = { - "metastore_db_connection_password_secret": {"required": True}, "metastore_db_connection_url": {"required": True}, - "metastore_db_connection_user_name": {"required": True}, } _attribute_map = { + "metastore_db_connection_authentication_mode": { + "key": "metastoreDbConnectionAuthenticationMode", + "type": "str", + }, "metastore_db_connection_password_secret": {"key": "metastoreDbConnectionPasswordSecret", "type": "str"}, "metastore_db_connection_url": {"key": "metastoreDbConnectionURL", "type": "str"}, "metastore_db_connection_user_name": {"key": "metastoreDbConnectionUserName", "type": "str"}, @@ -2438,24 +3553,118 @@ class FlinkHiveCatalogOption(_serialization.Model): def __init__( self, *, - metastore_db_connection_password_secret: str, metastore_db_connection_url: str, - metastore_db_connection_user_name: str, + metastore_db_connection_authentication_mode: Optional[ + Union[str, "_models.MetastoreDbConnectionAuthenticationMode"] + ] = None, + metastore_db_connection_password_secret: Optional[str] = None, + metastore_db_connection_user_name: Optional[str] = None, **kwargs: Any ) -> None: """ + :keyword metastore_db_connection_authentication_mode: The authentication mode to connect to + your Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :paramtype metastore_db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.MetastoreDbConnectionAuthenticationMode :keyword metastore_db_connection_password_secret: Secret reference name from - secretsProfile.secrets containing password for database connection. Required. + secretsProfile.secrets containing password for database connection. :paramtype metastore_db_connection_password_secret: str :keyword metastore_db_connection_url: Connection string for hive metastore database. Required. :paramtype metastore_db_connection_url: str - :keyword metastore_db_connection_user_name: User name for database connection. Required. + :keyword metastore_db_connection_user_name: User name for database connection. :paramtype metastore_db_connection_user_name: str """ super().__init__(**kwargs) - self.metastore_db_connection_password_secret = metastore_db_connection_password_secret - self.metastore_db_connection_url = metastore_db_connection_url - self.metastore_db_connection_user_name = metastore_db_connection_user_name + self.metastore_db_connection_authentication_mode = metastore_db_connection_authentication_mode + self.metastore_db_connection_password_secret = metastore_db_connection_password_secret + self.metastore_db_connection_url = metastore_db_connection_url + self.metastore_db_connection_user_name = metastore_db_connection_user_name + + +class FlinkJobProfile(_serialization.Model): + """Job specifications for flink clusters in application deployment mode. The specification is + immutable even if job properties are changed by calling the RunJob API, please use the ListJob + API to get the latest job information. + + All required parameters must be populated in order to send to Azure. + + :ivar job_jar_directory: A string property that specifies the directory where the job JAR is + located. Required. + :vartype job_jar_directory: str + :ivar jar_name: A string property that represents the name of the job JAR. Required. + :vartype jar_name: str + :ivar entry_class: A string property that specifies the entry class for the Flink job. If not + specified, the entry point is auto-detected from the flink job jar package. + :vartype entry_class: str + :ivar args: A string property representing additional JVM arguments for the Flink job. It + should be space separated value. + :vartype args: str + :ivar save_point_name: A string property that represents the name of the savepoint for the + Flink job. + :vartype save_point_name: str + :ivar upgrade_mode: A string property that indicates the upgrade mode to be performed on the + Flink job. It can have one of the following enum values => STATELESS_UPDATE, UPDATE, + LAST_STATE_UPDATE. Required. Known values are: "STATELESS_UPDATE", "UPDATE", and + "LAST_STATE_UPDATE". + :vartype upgrade_mode: str or ~azure.mgmt.hdinsightcontainers.models.UpgradeMode + """ + + _validation = { + "job_jar_directory": {"required": True}, + "jar_name": {"required": True}, + "upgrade_mode": {"required": True}, + } + + _attribute_map = { + "job_jar_directory": {"key": "jobJarDirectory", "type": "str"}, + "jar_name": {"key": "jarName", "type": "str"}, + "entry_class": {"key": "entryClass", "type": "str"}, + "args": {"key": "args", "type": "str"}, + "save_point_name": {"key": "savePointName", "type": "str"}, + "upgrade_mode": {"key": "upgradeMode", "type": "str"}, + } + + def __init__( + self, + *, + job_jar_directory: str, + jar_name: str, + upgrade_mode: Union[str, "_models.UpgradeMode"], + entry_class: Optional[str] = None, + args: Optional[str] = None, + save_point_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword job_jar_directory: A string property that specifies the directory where the job JAR is + located. Required. + :paramtype job_jar_directory: str + :keyword jar_name: A string property that represents the name of the job JAR. Required. + :paramtype jar_name: str + :keyword entry_class: A string property that specifies the entry class for the Flink job. If + not specified, the entry point is auto-detected from the flink job jar package. + :paramtype entry_class: str + :keyword args: A string property representing additional JVM arguments for the Flink job. It + should be space separated value. + :paramtype args: str + :keyword save_point_name: A string property that represents the name of the savepoint for the + Flink job. + :paramtype save_point_name: str + :keyword upgrade_mode: A string property that indicates the upgrade mode to be performed on the + Flink job. It can have one of the following enum values => STATELESS_UPDATE, UPDATE, + LAST_STATE_UPDATE. Required. Known values are: "STATELESS_UPDATE", "UPDATE", and + "LAST_STATE_UPDATE". + :paramtype upgrade_mode: str or ~azure.mgmt.hdinsightcontainers.models.UpgradeMode + """ + super().__init__(**kwargs) + self.job_jar_directory = job_jar_directory + self.jar_name = jar_name + self.entry_class = entry_class + self.args = args + self.save_point_name = save_point_name + self.upgrade_mode = upgrade_mode class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-instance-attributes @@ -2467,7 +3676,9 @@ class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-inst :ivar job_type: Type of cluster job. Required. "FlinkJob" :vartype job_type: str or ~azure.mgmt.hdinsightcontainers.models.JobType - :ivar job_name: Name of job. Required. + :ivar run_id: Run id of job. + :vartype run_id: str + :ivar job_name: Name of job. :vartype job_name: str :ivar job_jar_directory: A string property that specifies the directory where the job JAR is located. @@ -2485,7 +3696,8 @@ class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-inst :ivar action: A string property that indicates the action to be performed on the Flink job. It can have one of the following enum values => NEW, UPDATE, STATELESS_UPDATE, STOP, START, CANCEL, SAVEPOINT, LIST_SAVEPOINT, or DELETE. Known values are: "NEW", "UPDATE", - "STATELESS_UPDATE", "STOP", "START", "CANCEL", "SAVEPOINT", "LIST_SAVEPOINT", and "DELETE". + "STATELESS_UPDATE", "STOP", "START", "CANCEL", "SAVEPOINT", "LIST_SAVEPOINT", "DELETE", + "LAST_STATE_UPDATE", and "RE_LAUNCH". :vartype action: str or ~azure.mgmt.hdinsightcontainers.models.Action :ivar flink_configuration: Additional properties used to configure Flink jobs. It allows users to set properties such as parallelism and jobSavePointDirectory. It accepts additional @@ -2505,7 +3717,6 @@ class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-inst _validation = { "job_type": {"required": True}, - "job_name": {"required": True}, "job_id": {"readonly": True}, "status": {"readonly": True}, "job_output": {"readonly": True}, @@ -2515,6 +3726,7 @@ class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-inst _attribute_map = { "job_type": {"key": "jobType", "type": "str"}, + "run_id": {"key": "runId", "type": "str"}, "job_name": {"key": "jobName", "type": "str"}, "job_jar_directory": {"key": "jobJarDirectory", "type": "str"}, "jar_name": {"key": "jarName", "type": "str"}, @@ -2533,7 +3745,8 @@ class FlinkJobProperties(ClusterJobProperties): # pylint: disable=too-many-inst def __init__( self, *, - job_name: str, + run_id: Optional[str] = None, + job_name: Optional[str] = None, job_jar_directory: Optional[str] = None, jar_name: Optional[str] = None, entry_class: Optional[str] = None, @@ -2544,7 +3757,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword job_name: Name of job. Required. + :keyword run_id: Run id of job. + :paramtype run_id: str + :keyword job_name: Name of job. :paramtype job_name: str :keyword job_jar_directory: A string property that specifies the directory where the job JAR is located. @@ -2562,7 +3777,8 @@ def __init__( :keyword action: A string property that indicates the action to be performed on the Flink job. It can have one of the following enum values => NEW, UPDATE, STATELESS_UPDATE, STOP, START, CANCEL, SAVEPOINT, LIST_SAVEPOINT, or DELETE. Known values are: "NEW", "UPDATE", - "STATELESS_UPDATE", "STOP", "START", "CANCEL", "SAVEPOINT", "LIST_SAVEPOINT", and "DELETE". + "STATELESS_UPDATE", "STOP", "START", "CANCEL", "SAVEPOINT", "LIST_SAVEPOINT", "DELETE", + "LAST_STATE_UPDATE", and "RE_LAUNCH". :paramtype action: str or ~azure.mgmt.hdinsightcontainers.models.Action :keyword flink_configuration: Additional properties used to configure Flink jobs. It allows users to set properties such as parallelism and jobSavePointDirectory. It accepts additional @@ -2571,6 +3787,7 @@ def __init__( """ super().__init__(**kwargs) self.job_type: str = "FlinkJob" + self.run_id = run_id self.job_name = job_name self.job_jar_directory = job_jar_directory self.jar_name = jar_name @@ -2603,6 +3820,14 @@ class FlinkProfile(_serialization.Model): :vartype task_manager: ~azure.mgmt.hdinsightcontainers.models.ComputeResourceDefinition :ivar catalog_options: Flink cluster catalog options. :vartype catalog_options: ~azure.mgmt.hdinsightcontainers.models.FlinkCatalogOptions + :ivar deployment_mode: A string property that indicates the deployment mode of Flink cluster. + It can have one of the following enum values => Application, Session. Default value is Session. + Known values are: "Application" and "Session". + :vartype deployment_mode: str or ~azure.mgmt.hdinsightcontainers.models.DeploymentMode + :ivar job_spec: Job specifications for flink clusters in application deployment mode. The + specification is immutable even if job properties are changed by calling the RunJob API, please + use the ListJob API to get the latest job information. + :vartype job_spec: ~azure.mgmt.hdinsightcontainers.models.FlinkJobProfile """ _validation = { @@ -2618,6 +3843,8 @@ class FlinkProfile(_serialization.Model): "history_server": {"key": "historyServer", "type": "ComputeResourceDefinition"}, "task_manager": {"key": "taskManager", "type": "ComputeResourceDefinition"}, "catalog_options": {"key": "catalogOptions", "type": "FlinkCatalogOptions"}, + "deployment_mode": {"key": "deploymentMode", "type": "str"}, + "job_spec": {"key": "jobSpec", "type": "FlinkJobProfile"}, } def __init__( @@ -2629,6 +3856,8 @@ def __init__( num_replicas: Optional[int] = None, history_server: Optional["_models.ComputeResourceDefinition"] = None, catalog_options: Optional["_models.FlinkCatalogOptions"] = None, + deployment_mode: Optional[Union[str, "_models.DeploymentMode"]] = None, + job_spec: Optional["_models.FlinkJobProfile"] = None, **kwargs: Any ) -> None: """ @@ -2644,6 +3873,14 @@ def __init__( :paramtype task_manager: ~azure.mgmt.hdinsightcontainers.models.ComputeResourceDefinition :keyword catalog_options: Flink cluster catalog options. :paramtype catalog_options: ~azure.mgmt.hdinsightcontainers.models.FlinkCatalogOptions + :keyword deployment_mode: A string property that indicates the deployment mode of Flink + cluster. It can have one of the following enum values => Application, Session. Default value is + Session. Known values are: "Application" and "Session". + :paramtype deployment_mode: str or ~azure.mgmt.hdinsightcontainers.models.DeploymentMode + :keyword job_spec: Job specifications for flink clusters in application deployment mode. The + specification is immutable even if job properties are changed by calling the RunJob API, please + use the ListJob API to get the latest job information. + :paramtype job_spec: ~azure.mgmt.hdinsightcontainers.models.FlinkJobProfile """ super().__init__(**kwargs) self.storage = storage @@ -2652,6 +3889,8 @@ def __init__( self.history_server = history_server self.task_manager = task_manager self.catalog_options = catalog_options + self.deployment_mode = deployment_mode + self.job_spec = job_spec class FlinkStorageProfile(_serialization.Model): @@ -2667,7 +3906,7 @@ class FlinkStorageProfile(_serialization.Model): """ _validation = { - "storage_uri": {"required": True, "pattern": r"^(\w{4,5})://(.*)@(.*).\b(blob|dfs)\b\.core\.windows\.net$"}, + "storage_uri": {"required": True, "pattern": r"^(\w{4,5})://(.*)@(.*).\b(blob|dfs)\b.*$"}, } _attribute_map = { @@ -2695,12 +3934,18 @@ class HiveCatalogOption(_serialization.Model): :ivar catalog_name: Name of trino catalog which should use specified hive metastore. Required. :vartype catalog_name: str + :ivar metastore_db_connection_authentication_mode: The authentication mode to connect to your + Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :vartype metastore_db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.MetastoreDbConnectionAuthenticationMode :ivar metastore_db_connection_password_secret: Secret reference name from - secretsProfile.secrets containing password for database connection. Required. + secretsProfile.secrets containing password for database connection. :vartype metastore_db_connection_password_secret: str :ivar metastore_db_connection_url: Connection string for hive metastore database. Required. :vartype metastore_db_connection_url: str - :ivar metastore_db_connection_user_name: User name for database connection. Required. + :ivar metastore_db_connection_user_name: User name for database connection. :vartype metastore_db_connection_user_name: str :ivar metastore_warehouse_dir: Metastore root directory URI, format: abfs[s]://@:code:``.dfs.core.windows.net/:code:``. More details: @@ -2711,14 +3956,16 @@ class HiveCatalogOption(_serialization.Model): _validation = { "catalog_name": {"required": True, "min_length": 1}, - "metastore_db_connection_password_secret": {"required": True}, "metastore_db_connection_url": {"required": True}, - "metastore_db_connection_user_name": {"required": True}, "metastore_warehouse_dir": {"required": True}, } _attribute_map = { "catalog_name": {"key": "catalogName", "type": "str"}, + "metastore_db_connection_authentication_mode": { + "key": "metastoreDbConnectionAuthenticationMode", + "type": "str", + }, "metastore_db_connection_password_secret": {"key": "metastoreDbConnectionPasswordSecret", "type": "str"}, "metastore_db_connection_url": {"key": "metastoreDbConnectionURL", "type": "str"}, "metastore_db_connection_user_name": {"key": "metastoreDbConnectionUserName", "type": "str"}, @@ -2729,22 +3976,31 @@ def __init__( self, *, catalog_name: str, - metastore_db_connection_password_secret: str, metastore_db_connection_url: str, - metastore_db_connection_user_name: str, metastore_warehouse_dir: str, + metastore_db_connection_authentication_mode: Optional[ + Union[str, "_models.MetastoreDbConnectionAuthenticationMode"] + ] = None, + metastore_db_connection_password_secret: Optional[str] = None, + metastore_db_connection_user_name: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword catalog_name: Name of trino catalog which should use specified hive metastore. Required. :paramtype catalog_name: str + :keyword metastore_db_connection_authentication_mode: The authentication mode to connect to + your Hive metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :paramtype metastore_db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.MetastoreDbConnectionAuthenticationMode :keyword metastore_db_connection_password_secret: Secret reference name from - secretsProfile.secrets containing password for database connection. Required. + secretsProfile.secrets containing password for database connection. :paramtype metastore_db_connection_password_secret: str :keyword metastore_db_connection_url: Connection string for hive metastore database. Required. :paramtype metastore_db_connection_url: str - :keyword metastore_db_connection_user_name: User name for database connection. Required. + :keyword metastore_db_connection_user_name: User name for database connection. :paramtype metastore_db_connection_user_name: str :keyword metastore_warehouse_dir: Metastore root directory URI, format: abfs[s]://@:code:``.dfs.core.windows.net/:code:``. More details: @@ -2754,12 +4010,114 @@ def __init__( """ super().__init__(**kwargs) self.catalog_name = catalog_name + self.metastore_db_connection_authentication_mode = metastore_db_connection_authentication_mode self.metastore_db_connection_password_secret = metastore_db_connection_password_secret self.metastore_db_connection_url = metastore_db_connection_url self.metastore_db_connection_user_name = metastore_db_connection_user_name self.metastore_warehouse_dir = metastore_warehouse_dir +class KafkaConnectivityEndpoints(_serialization.Model): + """Kafka bootstrap server and broker related connectivity endpoints. + + :ivar bootstrap_server_endpoint: bootstrap server connectivity endpoint. + :vartype bootstrap_server_endpoint: str + :ivar broker_endpoints: Kafka broker endpoint list. + :vartype broker_endpoints: list[str] + """ + + _attribute_map = { + "bootstrap_server_endpoint": {"key": "bootstrapServerEndpoint", "type": "str"}, + "broker_endpoints": {"key": "brokerEndpoints", "type": "[str]"}, + } + + def __init__( + self, + *, + bootstrap_server_endpoint: Optional[str] = None, + broker_endpoints: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword bootstrap_server_endpoint: bootstrap server connectivity endpoint. + :paramtype bootstrap_server_endpoint: str + :keyword broker_endpoints: Kafka broker endpoint list. + :paramtype broker_endpoints: list[str] + """ + super().__init__(**kwargs) + self.bootstrap_server_endpoint = bootstrap_server_endpoint + self.broker_endpoints = broker_endpoints + + +class KafkaProfile(_serialization.Model): + """The Kafka cluster profile. + + 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 enable_k_raft: Expose Kafka cluster in KRaft mode. + :vartype enable_k_raft: bool + :ivar enable_public_endpoints: Expose worker nodes as public endpoints. + :vartype enable_public_endpoints: bool + :ivar remote_storage_uri: Fully qualified path of Azure Storage container used for Tiered + Storage. + :vartype remote_storage_uri: str + :ivar disk_storage: Kafka disk storage profile. Required. + :vartype disk_storage: ~azure.mgmt.hdinsightcontainers.models.DiskStorageProfile + :ivar cluster_identity: Identity of the internal service components inside the Kafka cluster. + :vartype cluster_identity: ~azure.mgmt.hdinsightcontainers.models.IdentityProfile + :ivar connectivity_endpoints: Kafka bootstrap server and brokers related connectivity + endpoints. + :vartype connectivity_endpoints: + ~azure.mgmt.hdinsightcontainers.models.KafkaConnectivityEndpoints + """ + + _validation = { + "remote_storage_uri": {"pattern": r"^(https?|abfss?):\/\/[^/]+(?:\/|$)"}, + "disk_storage": {"required": True}, + "cluster_identity": {"readonly": True}, + "connectivity_endpoints": {"readonly": True}, + } + + _attribute_map = { + "enable_k_raft": {"key": "enableKRaft", "type": "bool"}, + "enable_public_endpoints": {"key": "enablePublicEndpoints", "type": "bool"}, + "remote_storage_uri": {"key": "remoteStorageUri", "type": "str"}, + "disk_storage": {"key": "diskStorage", "type": "DiskStorageProfile"}, + "cluster_identity": {"key": "clusterIdentity", "type": "IdentityProfile"}, + "connectivity_endpoints": {"key": "connectivityEndpoints", "type": "KafkaConnectivityEndpoints"}, + } + + def __init__( + self, + *, + disk_storage: "_models.DiskStorageProfile", + enable_k_raft: bool = True, + enable_public_endpoints: bool = False, + remote_storage_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_k_raft: Expose Kafka cluster in KRaft mode. + :paramtype enable_k_raft: bool + :keyword enable_public_endpoints: Expose worker nodes as public endpoints. + :paramtype enable_public_endpoints: bool + :keyword remote_storage_uri: Fully qualified path of Azure Storage container used for Tiered + Storage. + :paramtype remote_storage_uri: str + :keyword disk_storage: Kafka disk storage profile. Required. + :paramtype disk_storage: ~azure.mgmt.hdinsightcontainers.models.DiskStorageProfile + """ + super().__init__(**kwargs) + self.enable_k_raft = enable_k_raft + self.enable_public_endpoints = enable_public_endpoints + self.remote_storage_uri = remote_storage_uri + self.disk_storage = disk_storage + self.cluster_identity = None + self.connectivity_endpoints = None + + class LoadBasedConfig(_serialization.Model): """Profile of load based Autoscale. @@ -3063,6 +4421,231 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class RangerAdminSpec(_serialization.Model): + """Specification for the Ranger Admin service. + + All required parameters must be populated in order to send to Azure. + + :ivar admins: List of usernames that should be marked as ranger admins. These usernames should + match the user principal name (UPN) of the respective AAD users. Required. + :vartype admins: list[str] + :ivar database: Required. + :vartype database: ~azure.mgmt.hdinsightcontainers.models.RangerAdminSpecDatabase + """ + + _validation = { + "admins": {"required": True}, + "database": {"required": True}, + } + + _attribute_map = { + "admins": {"key": "admins", "type": "[str]"}, + "database": {"key": "database", "type": "RangerAdminSpecDatabase"}, + } + + def __init__(self, *, admins: List[str], database: "_models.RangerAdminSpecDatabase", **kwargs: Any) -> None: + """ + :keyword admins: List of usernames that should be marked as ranger admins. These usernames + should match the user principal name (UPN) of the respective AAD users. Required. + :paramtype admins: list[str] + :keyword database: Required. + :paramtype database: ~azure.mgmt.hdinsightcontainers.models.RangerAdminSpecDatabase + """ + super().__init__(**kwargs) + self.admins = admins + self.database = database + + +class RangerAdminSpecDatabase(_serialization.Model): + """RangerAdminSpecDatabase. + + All required parameters must be populated in order to send to Azure. + + :ivar host: The database URL. Required. + :vartype host: str + :ivar name: The database name. Required. + :vartype name: str + :ivar password_secret_ref: Reference for the database password. + :vartype password_secret_ref: str + :ivar username: The name of the database user. + :vartype username: str + """ + + _validation = { + "host": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "host": {"key": "host", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, + "username": {"key": "username", "type": "str"}, + } + + def __init__( + self, + *, + host: str, + name: str, + password_secret_ref: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword host: The database URL. Required. + :paramtype host: str + :keyword name: The database name. Required. + :paramtype name: str + :keyword password_secret_ref: Reference for the database password. + :paramtype password_secret_ref: str + :keyword username: The name of the database user. + :paramtype username: str + """ + super().__init__(**kwargs) + self.host = host + self.name = name + self.password_secret_ref = password_secret_ref + self.username = username + + +class RangerAuditSpec(_serialization.Model): + """Properties required to describe audit log storage. + + :ivar storage_account: Azure storage location of the blobs. MSI should have read/write access + to this Storage account. + :vartype storage_account: str + """ + + _validation = { + "storage_account": {"min_length": 1, "pattern": r"^(https)|(abfss)://.*$"}, + } + + _attribute_map = { + "storage_account": {"key": "storageAccount", "type": "str"}, + } + + def __init__(self, *, storage_account: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_account: Azure storage location of the blobs. MSI should have read/write + access to this Storage account. + :paramtype storage_account: str + """ + super().__init__(**kwargs) + self.storage_account = storage_account + + +class RangerProfile(_serialization.Model): + """The ranger cluster profile. + + All required parameters must be populated in order to send to Azure. + + :ivar ranger_admin: Specification for the Ranger Admin service. Required. + :vartype ranger_admin: ~azure.mgmt.hdinsightcontainers.models.RangerAdminSpec + :ivar ranger_audit: Properties required to describe audit log storage. + :vartype ranger_audit: ~azure.mgmt.hdinsightcontainers.models.RangerAuditSpec + :ivar ranger_usersync: Specification for the Ranger Usersync service. Required. + :vartype ranger_usersync: ~azure.mgmt.hdinsightcontainers.models.RangerUsersyncSpec + """ + + _validation = { + "ranger_admin": {"required": True}, + "ranger_usersync": {"required": True}, + } + + _attribute_map = { + "ranger_admin": {"key": "rangerAdmin", "type": "RangerAdminSpec"}, + "ranger_audit": {"key": "rangerAudit", "type": "RangerAuditSpec"}, + "ranger_usersync": {"key": "rangerUsersync", "type": "RangerUsersyncSpec"}, + } + + def __init__( + self, + *, + ranger_admin: "_models.RangerAdminSpec", + ranger_usersync: "_models.RangerUsersyncSpec", + ranger_audit: Optional["_models.RangerAuditSpec"] = None, + **kwargs: Any + ) -> None: + """ + :keyword ranger_admin: Specification for the Ranger Admin service. Required. + :paramtype ranger_admin: ~azure.mgmt.hdinsightcontainers.models.RangerAdminSpec + :keyword ranger_audit: Properties required to describe audit log storage. + :paramtype ranger_audit: ~azure.mgmt.hdinsightcontainers.models.RangerAuditSpec + :keyword ranger_usersync: Specification for the Ranger Usersync service. Required. + :paramtype ranger_usersync: ~azure.mgmt.hdinsightcontainers.models.RangerUsersyncSpec + """ + super().__init__(**kwargs) + self.ranger_admin = ranger_admin + self.ranger_audit = ranger_audit + self.ranger_usersync = ranger_usersync + + +class RangerUsersyncSpec(_serialization.Model): + """Specification for the Ranger Usersync service. + + :ivar enabled: Denotes whether usersync service should be enabled. + :vartype enabled: bool + :ivar groups: List of groups that should be synced. These group names should match the object + id of the respective AAD groups. + :vartype groups: list[str] + :ivar mode: User & groups can be synced automatically or via a static list that's refreshed. + Known values are: "static" and "automatic". + :vartype mode: str or ~azure.mgmt.hdinsightcontainers.models.RangerUsersyncMode + :ivar user_mapping_location: Azure storage location of a mapping file that lists user & group + associations. + :vartype user_mapping_location: str + :ivar users: List of user names that should be synced. These usernames should match the User + principal name of the respective AAD users. + :vartype users: list[str] + """ + + _validation = { + "user_mapping_location": {"min_length": 1, "pattern": r"^(https)|(abfss)://.*$"}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "groups": {"key": "groups", "type": "[str]"}, + "mode": {"key": "mode", "type": "str"}, + "user_mapping_location": {"key": "userMappingLocation", "type": "str"}, + "users": {"key": "users", "type": "[str]"}, + } + + def __init__( + self, + *, + enabled: bool = True, + groups: Optional[List[str]] = None, + mode: Union[str, "_models.RangerUsersyncMode"] = "automatic", + user_mapping_location: Optional[str] = None, + users: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Denotes whether usersync service should be enabled. + :paramtype enabled: bool + :keyword groups: List of groups that should be synced. These group names should match the + object id of the respective AAD groups. + :paramtype groups: list[str] + :keyword mode: User & groups can be synced automatically or via a static list that's refreshed. + Known values are: "static" and "automatic". + :paramtype mode: str or ~azure.mgmt.hdinsightcontainers.models.RangerUsersyncMode + :keyword user_mapping_location: Azure storage location of a mapping file that lists user & + group associations. + :paramtype user_mapping_location: str + :keyword users: List of user names that should be synced. These usernames should match the User + principal name of the respective AAD users. + :paramtype users: list[str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.groups = groups + self.mode = mode + self.user_mapping_location = user_mapping_location + self.users = users + + class ScalingRule(_serialization.Model): """The scaling rule. @@ -3260,7 +4843,7 @@ class ScriptActionProfile(_serialization.Model): _validation = { "type": {"required": True}, "name": {"required": True}, - "url": {"required": True, "pattern": r"^(https)|(http)|(abfss)|(abfs)|(wasbs)|(wasb)://.*$"}, + "url": {"required": True, "pattern": r"^(https)|(http)://.*$"}, "services": {"required": True}, } @@ -3554,77 +5137,21 @@ def __init__(self, *, value: str, description: Optional[str] = None, **kwargs: A class ServiceConfigResult(_serialization.Model): """Cluster instance service config. - :ivar service_name: Service Config Name. - :vartype service_name: str - :ivar file_name: File Name. - :vartype file_name: str - :ivar content: Content in the service config file. - :vartype content: str - :ivar component_name: Component Name. - :vartype component_name: str - :ivar type: Config type. - :vartype type: str - :ivar path: Config file path. - :vartype path: str - :ivar custom_keys: The custom keys. - :vartype custom_keys: dict[str, str] - :ivar default_keys: The default keys. - :vartype default_keys: dict[str, - ~azure.mgmt.hdinsightcontainers.models.ServiceConfigListResultValueEntity] + :ivar properties: Cluster instance service config properties. + :vartype properties: ~azure.mgmt.hdinsightcontainers.models.ServiceConfigResultProperties """ _attribute_map = { - "service_name": {"key": "properties.serviceName", "type": "str"}, - "file_name": {"key": "properties.fileName", "type": "str"}, - "content": {"key": "properties.content", "type": "str"}, - "component_name": {"key": "properties.componentName", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "path": {"key": "properties.path", "type": "str"}, - "custom_keys": {"key": "properties.customKeys", "type": "{str}"}, - "default_keys": {"key": "properties.defaultKeys", "type": "{ServiceConfigListResultValueEntity}"}, + "properties": {"key": "properties", "type": "ServiceConfigResultProperties"}, } - def __init__( - self, - *, - service_name: Optional[str] = None, - file_name: Optional[str] = None, - content: Optional[str] = None, - component_name: Optional[str] = None, - type: Optional[str] = None, - path: Optional[str] = None, - custom_keys: Optional[Dict[str, str]] = None, - default_keys: Optional[Dict[str, "_models.ServiceConfigListResultValueEntity"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ServiceConfigResultProperties"] = None, **kwargs: Any) -> None: """ - :keyword service_name: Service Config Name. - :paramtype service_name: str - :keyword file_name: File Name. - :paramtype file_name: str - :keyword content: Content in the service config file. - :paramtype content: str - :keyword component_name: Component Name. - :paramtype component_name: str - :keyword type: Config type. - :paramtype type: str - :keyword path: Config file path. - :paramtype path: str - :keyword custom_keys: The custom keys. - :paramtype custom_keys: dict[str, str] - :keyword default_keys: The default keys. - :paramtype default_keys: dict[str, - ~azure.mgmt.hdinsightcontainers.models.ServiceConfigListResultValueEntity] + :keyword properties: Cluster instance service config properties. + :paramtype properties: ~azure.mgmt.hdinsightcontainers.models.ServiceConfigResultProperties """ super().__init__(**kwargs) - self.service_name = service_name - self.file_name = file_name - self.content = content - self.component_name = component_name - self.type = type - self.path = path - self.custom_keys = custom_keys - self.default_keys = default_keys + self.properties = properties class ServiceConfigResultProperties(ServiceConfigListResultProperties): @@ -3714,7 +5241,7 @@ def __init__( class ServiceStatus(_serialization.Model): - """Describes the status of a service of a HDInsight on aks cluster. + """Describes the status of a service of a HDInsight on AKS cluster. All required parameters must be populated in order to send to Azure. @@ -3763,12 +5290,17 @@ class SparkMetastoreSpec(_serialization.Model): :vartype db_server_host: str :ivar db_name: The database name. Required. :vartype db_name: str - :ivar db_user_name: The database user name. Required. + :ivar db_connection_authentication_mode: The authentication mode to connect to your Hive + metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :vartype db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.DbConnectionAuthenticationMode + :ivar db_user_name: The database user name. :vartype db_user_name: str :ivar db_password_secret_name: The secret name which contains the database user password. - Required. :vartype db_password_secret_name: str - :ivar key_vault_id: The key vault resource id. Required. + :ivar key_vault_id: The key vault resource id. :vartype key_vault_id: str :ivar thrift_url: The thrift url. :vartype thrift_url: str @@ -3777,14 +5309,12 @@ class SparkMetastoreSpec(_serialization.Model): _validation = { "db_server_host": {"required": True}, "db_name": {"required": True}, - "db_user_name": {"required": True}, - "db_password_secret_name": {"required": True}, - "key_vault_id": {"required": True}, } _attribute_map = { "db_server_host": {"key": "dbServerHost", "type": "str"}, "db_name": {"key": "dbName", "type": "str"}, + "db_connection_authentication_mode": {"key": "dbConnectionAuthenticationMode", "type": "str"}, "db_user_name": {"key": "dbUserName", "type": "str"}, "db_password_secret_name": {"key": "dbPasswordSecretName", "type": "str"}, "key_vault_id": {"key": "keyVaultId", "type": "str"}, @@ -3796,9 +5326,10 @@ def __init__( *, db_server_host: str, db_name: str, - db_user_name: str, - db_password_secret_name: str, - key_vault_id: str, + db_connection_authentication_mode: Union[str, "_models.DbConnectionAuthenticationMode"] = "IdentityAuth", + db_user_name: Optional[str] = None, + db_password_secret_name: Optional[str] = None, + key_vault_id: Optional[str] = None, thrift_url: Optional[str] = None, **kwargs: Any ) -> None: @@ -3807,12 +5338,17 @@ def __init__( :paramtype db_server_host: str :keyword db_name: The database name. Required. :paramtype db_name: str - :keyword db_user_name: The database user name. Required. + :keyword db_connection_authentication_mode: The authentication mode to connect to your Hive + metastore database. More details: + https://learn.microsoft.com/en-us/azure/azure-sql/database/logins-create-manage?view=azuresql#authentication-and-authorization. + Known values are: "SqlAuth" and "IdentityAuth". + :paramtype db_connection_authentication_mode: str or + ~azure.mgmt.hdinsightcontainers.models.DbConnectionAuthenticationMode + :keyword db_user_name: The database user name. :paramtype db_user_name: str :keyword db_password_secret_name: The secret name which contains the database user password. - Required. :paramtype db_password_secret_name: str - :keyword key_vault_id: The key vault resource id. Required. + :keyword key_vault_id: The key vault resource id. :paramtype key_vault_id: str :keyword thrift_url: The thrift url. :paramtype thrift_url: str @@ -3820,6 +5356,7 @@ def __init__( super().__init__(**kwargs) self.db_server_host = db_server_host self.db_name = db_name + self.db_connection_authentication_mode = db_connection_authentication_mode self.db_user_name = db_user_name self.db_password_secret_name = db_password_secret_name self.key_vault_id = key_vault_id @@ -3918,6 +5455,9 @@ class SshConnectivityEndpoint(_serialization.Model): :ivar endpoint: SSH connectivity endpoint. Required. :vartype endpoint: str + :ivar private_ssh_endpoint: Private SSH connectivity endpoint. This property will only be + returned when enableInternalIngress is true. + :vartype private_ssh_endpoint: str """ _validation = { @@ -3926,15 +5466,20 @@ class SshConnectivityEndpoint(_serialization.Model): _attribute_map = { "endpoint": {"key": "endpoint", "type": "str"}, + "private_ssh_endpoint": {"key": "privateSshEndpoint", "type": "str"}, } - def __init__(self, *, endpoint: str, **kwargs: Any) -> None: + def __init__(self, *, endpoint: str, private_ssh_endpoint: Optional[str] = None, **kwargs: Any) -> None: """ :keyword endpoint: SSH connectivity endpoint. Required. :paramtype endpoint: str + :keyword private_ssh_endpoint: Private SSH connectivity endpoint. This property will only be + returned when enableInternalIngress is true. + :paramtype private_ssh_endpoint: str """ super().__init__(**kwargs) self.endpoint = endpoint + self.private_ssh_endpoint = private_ssh_endpoint class SshProfile(_serialization.Model): @@ -4059,37 +5604,56 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N class TrinoCoordinator(_serialization.Model): """Trino Coordinator. + :ivar debug: Trino debug configuration. + :vartype debug: ~azure.mgmt.hdinsightcontainers.models.TrinoDebugConfig :ivar high_availability_enabled: The flag that if enable coordinator HA, uses multiple coordinator replicas with auto failover, one per each head node. Default: true. :vartype high_availability_enabled: bool - :ivar enable: The flag that if enable debug or not. - :vartype enable: bool - :ivar port: The debug port. - :vartype port: int - :ivar suspend: The flag that if suspend debug or not. - :vartype suspend: bool """ _attribute_map = { + "debug": {"key": "debug", "type": "TrinoDebugConfig"}, "high_availability_enabled": {"key": "highAvailabilityEnabled", "type": "bool"}, - "enable": {"key": "debug.enable", "type": "bool"}, - "port": {"key": "debug.port", "type": "int"}, - "suspend": {"key": "debug.suspend", "type": "bool"}, } def __init__( self, *, + debug: Optional["_models.TrinoDebugConfig"] = None, high_availability_enabled: bool = True, - enable: bool = False, - port: int = 8008, - suspend: bool = False, **kwargs: Any ) -> None: """ + :keyword debug: Trino debug configuration. + :paramtype debug: ~azure.mgmt.hdinsightcontainers.models.TrinoDebugConfig :keyword high_availability_enabled: The flag that if enable coordinator HA, uses multiple coordinator replicas with auto failover, one per each head node. Default: true. :paramtype high_availability_enabled: bool + """ + super().__init__(**kwargs) + self.debug = debug + self.high_availability_enabled = high_availability_enabled + + +class TrinoDebugConfig(_serialization.Model): + """Trino debug configuration. + + :ivar enable: The flag that if enable debug or not. + :vartype enable: bool + :ivar port: The debug port. + :vartype port: int + :ivar suspend: The flag that if suspend debug or not. + :vartype suspend: bool + """ + + _attribute_map = { + "enable": {"key": "enable", "type": "bool"}, + "port": {"key": "port", "type": "int"}, + "suspend": {"key": "suspend", "type": "bool"}, + } + + def __init__(self, *, enable: bool = False, port: int = 8008, suspend: bool = False, **kwargs: Any) -> None: + """ :keyword enable: The flag that if enable debug or not. :paramtype enable: bool :keyword port: The debug port. @@ -4098,7 +5662,6 @@ def __init__( :paramtype suspend: bool """ super().__init__(**kwargs) - self.high_availability_enabled = high_availability_enabled self.enable = enable self.port = port self.suspend = suspend @@ -4298,33 +5861,21 @@ def __init__(self, *, storage: Optional["_models.TrinoTelemetryConfig"] = None, class TrinoWorker(_serialization.Model): """Trino worker. - :ivar enable: The flag that if enable debug or not. - :vartype enable: bool - :ivar port: The debug port. - :vartype port: int - :ivar suspend: The flag that if suspend debug or not. - :vartype suspend: bool + :ivar debug: Trino debug configuration. + :vartype debug: ~azure.mgmt.hdinsightcontainers.models.TrinoDebugConfig """ _attribute_map = { - "enable": {"key": "debug.enable", "type": "bool"}, - "port": {"key": "debug.port", "type": "int"}, - "suspend": {"key": "debug.suspend", "type": "bool"}, + "debug": {"key": "debug", "type": "TrinoDebugConfig"}, } - def __init__(self, *, enable: bool = False, port: int = 8008, suspend: bool = False, **kwargs: Any) -> None: + def __init__(self, *, debug: Optional["_models.TrinoDebugConfig"] = None, **kwargs: Any) -> None: """ - :keyword enable: The flag that if enable debug or not. - :paramtype enable: bool - :keyword port: The debug port. - :paramtype port: int - :keyword suspend: The flag that if suspend debug or not. - :paramtype suspend: bool + :keyword debug: Trino debug configuration. + :paramtype debug: ~azure.mgmt.hdinsightcontainers.models.TrinoDebugConfig """ super().__init__(**kwargs) - self.enable = enable - self.port = port - self.suspend = suspend + self.debug = debug class UpdatableClusterProfile(_serialization.Model): @@ -4347,6 +5898,11 @@ class UpdatableClusterProfile(_serialization.Model): ~azure.mgmt.hdinsightcontainers.models.ClusterLogAnalyticsProfile :ivar prometheus_profile: Cluster Prometheus profile. :vartype prometheus_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterPrometheusProfile + :ivar ranger_plugin_profile: Cluster Ranger plugin profile. + :vartype ranger_plugin_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterRangerPluginProfile + :ivar ranger_profile: The ranger cluster profile. + :vartype ranger_profile: ~azure.mgmt.hdinsightcontainers.models.RangerProfile :ivar script_action_profiles: The script action profile list. :vartype script_action_profiles: list[~azure.mgmt.hdinsightcontainers.models.ScriptActionProfile] @@ -4359,6 +5915,8 @@ class UpdatableClusterProfile(_serialization.Model): "authorization_profile": {"key": "authorizationProfile", "type": "AuthorizationProfile"}, "log_analytics_profile": {"key": "logAnalyticsProfile", "type": "ClusterLogAnalyticsProfile"}, "prometheus_profile": {"key": "prometheusProfile", "type": "ClusterPrometheusProfile"}, + "ranger_plugin_profile": {"key": "rangerPluginProfile", "type": "ClusterRangerPluginProfile"}, + "ranger_profile": {"key": "rangerProfile", "type": "RangerProfile"}, "script_action_profiles": {"key": "scriptActionProfiles", "type": "[ScriptActionProfile]"}, } @@ -4371,6 +5929,8 @@ def __init__( authorization_profile: Optional["_models.AuthorizationProfile"] = None, log_analytics_profile: Optional["_models.ClusterLogAnalyticsProfile"] = None, prometheus_profile: Optional["_models.ClusterPrometheusProfile"] = None, + ranger_plugin_profile: Optional["_models.ClusterRangerPluginProfile"] = None, + ranger_profile: Optional["_models.RangerProfile"] = None, script_action_profiles: Optional[List["_models.ScriptActionProfile"]] = None, **kwargs: Any ) -> None: @@ -4392,6 +5952,11 @@ def __init__( ~azure.mgmt.hdinsightcontainers.models.ClusterLogAnalyticsProfile :keyword prometheus_profile: Cluster Prometheus profile. :paramtype prometheus_profile: ~azure.mgmt.hdinsightcontainers.models.ClusterPrometheusProfile + :keyword ranger_plugin_profile: Cluster Ranger plugin profile. + :paramtype ranger_plugin_profile: + ~azure.mgmt.hdinsightcontainers.models.ClusterRangerPluginProfile + :keyword ranger_profile: The ranger cluster profile. + :paramtype ranger_profile: ~azure.mgmt.hdinsightcontainers.models.RangerProfile :keyword script_action_profiles: The script action profile list. :paramtype script_action_profiles: list[~azure.mgmt.hdinsightcontainers.models.ScriptActionProfile] @@ -4403,4 +5968,6 @@ def __init__( self.authorization_profile = authorization_profile self.log_analytics_profile = log_analytics_profile self.prometheus_profile = prometheus_profile + self.ranger_plugin_profile = ranger_plugin_profile + self.ranger_profile = ranger_profile self.script_action_profiles = script_action_profiles diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/__init__.py index 3c44ccd0cd62..560926c82ae8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/__init__.py @@ -7,7 +7,9 @@ # -------------------------------------------------------------------------- from ._cluster_pools_operations import ClusterPoolsOperations +from ._cluster_pool_available_upgrades_operations import ClusterPoolAvailableUpgradesOperations from ._clusters_operations import ClustersOperations +from ._cluster_available_upgrades_operations import ClusterAvailableUpgradesOperations from ._cluster_jobs_operations import ClusterJobsOperations from ._locations_operations import LocationsOperations from ._operations import Operations @@ -20,7 +22,9 @@ __all__ = [ "ClusterPoolsOperations", + "ClusterPoolAvailableUpgradesOperations", "ClustersOperations", + "ClusterAvailableUpgradesOperations", "ClusterJobsOperations", "LocationsOperations", "Operations", diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_pool_versions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_pool_versions_operations.py index 8b97e3fd797a..f21aff16f27f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_pool_versions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_pool_versions_operations.py @@ -40,7 +40,7 @@ def build_list_by_location_request(location: 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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_versions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_versions_operations.py index 9d88656286d3..8317e62202fd 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_versions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_available_cluster_versions_operations.py @@ -40,7 +40,7 @@ def build_list_by_location_request(location: 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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_available_upgrades_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_available_upgrades_operations.py new file mode 100644 index 000000000000..be9f007dd1bb --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_available_upgrades_operations.py @@ -0,0 +1,187 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, cluster_pool_name: str, cluster_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/availableUpgrades", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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) + + +class ClusterAvailableUpgradesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s + :attr:`cluster_available_upgrades` 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, cluster_pool_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.ClusterAvailableUpgrade"]: + """List a cluster available upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterAvailableUpgrade or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterAvailableUpgrade] + :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.ClusterAvailableUpgradeList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ClusterAvailableUpgradeList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/availableUpgrades" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_jobs_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_jobs_operations.py index d9e790018af2..4f20abdc5df2 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_jobs_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_jobs_operations.py @@ -45,7 +45,7 @@ def build_run_job_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -77,12 +77,18 @@ def build_run_job_request( def build_list_request( - resource_group_name: str, cluster_pool_name: str, cluster_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + subscription_id: str, + *, + filter: 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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,6 +109,8 @@ def build_list_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -369,7 +377,12 @@ def get_long_running_output(pipeline_response): @distributed_trace def list( - self, resource_group_name: str, cluster_pool_name: str, cluster_name: str, **kwargs: Any + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + filter: Optional[str] = None, + **kwargs: Any ) -> Iterable["_models.ClusterJob"]: """Get jobs of HDInsight on AKS cluster. @@ -380,6 +393,9 @@ def list( :type cluster_pool_name: str :param cluster_name: The name of the HDInsight cluster. Required. :type cluster_name: str + :param filter: The system query option to filter job returned in the response. Allowed value is + 'jobName eq {jobName}' or 'jarName eq {jarName}'. Default value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterJob or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterJob] @@ -407,6 +423,7 @@ def prepare_request(next_link=None): cluster_pool_name=cluster_pool_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, + filter=filter, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pool_available_upgrades_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pool_available_upgrades_operations.py new file mode 100644 index 000000000000..3c76a7c42dfc --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pool_available_upgrades_operations.py @@ -0,0 +1,183 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, cluster_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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/availableUpgrades", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_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) + + +class ClusterPoolAvailableUpgradesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsightcontainers.HDInsightContainersMgmtClient`'s + :attr:`cluster_pool_available_upgrades` 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, cluster_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ClusterPoolAvailableUpgrade"]: + """List a cluster pool available upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterPoolAvailableUpgrade or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsightcontainers.models.ClusterPoolAvailableUpgrade] + :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.ClusterPoolAvailableUpgradeList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ClusterPoolAvailableUpgradeList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/availableUpgrades" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pools_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pools_operations.py index ea7f04028dcc..eb4a76fff452 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pools_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_cluster_pools_operations.py @@ -45,7 +45,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -114,7 +114,7 @@ def build_update_tags_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +150,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +181,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +205,7 @@ def build_list_by_resource_group_request(resource_group_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,6 +231,42 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_upgrade_request( + resource_group_name: str, cluster_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", "2023-11-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.HDInsight/clusterpools/{clusterPoolName}/upgrade", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ClusterPoolsOperations: """ .. warning:: @@ -808,7 +844,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) @@ -1057,3 +1093,234 @@ def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools" } + + def _upgrade_initial( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO], + **kwargs: Any + ) -> Optional[_models.ClusterPool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ClusterPool]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cluster_pool_upgrade_request, (IOBase, bytes)): + _content = cluster_pool_upgrade_request + else: + _json = self._serialize.body(cluster_pool_upgrade_request, "ClusterPoolUpgrade") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ClusterPool", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgrade" + } + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: _models.ClusterPoolUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Required. + :type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade + :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 ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Required. + :type cluster_pool_upgrade_request: 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 ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_pool_upgrade_request: Union[_models.ClusterPoolUpgrade, IO], + **kwargs: Any + ) -> LROPoller[_models.ClusterPool]: + """Upgrade a cluster pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_pool_upgrade_request: Upgrade a cluster pool. Is either a ClusterPoolUpgrade + type or a IO type. Required. + :type cluster_pool_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterPoolUpgrade + 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 ClusterPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.ClusterPool] + :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.ClusterPool] = 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._upgrade_initial( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_pool_upgrade_request=cluster_pool_upgrade_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ClusterPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/upgrade" + } diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_clusters_operations.py index cf53997ee112..341d42cbc2ec 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_clusters_operations.py @@ -45,7 +45,7 @@ def build_list_by_cluster_pool_name_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,13 +72,50 @@ def build_list_by_cluster_pool_name_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_upgrade_request( + resource_group_name: str, cluster_pool_name: str, cluster_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-11-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.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/upgrade", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "clusterPoolName": _SERIALIZER.url("cluster_pool_name", cluster_pool_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_resize_request( resource_group_name: str, cluster_pool_name: str, cluster_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -115,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +186,7 @@ def build_create_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +223,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -223,7 +260,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +294,7 @@ def build_list_service_configs_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -291,7 +328,7 @@ def build_list_instance_views_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -325,7 +362,7 @@ def build_get_instance_view_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -464,6 +501,245 @@ def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters" } + def _upgrade_initial( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: Union[_models.ClusterUpgrade, IO], + **kwargs: Any + ) -> Optional[_models.Cluster]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Cluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cluster_upgrade_request, (IOBase, bytes)): + _content = cluster_upgrade_request + else: + _json = self._serialize.body(cluster_upgrade_request, "ClusterUpgrade") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Cluster", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/upgrade" + } + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: _models.ClusterUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Required. + :type cluster_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgrade + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Required. + :type cluster_upgrade_request: 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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_upgrade( + self, + resource_group_name: str, + cluster_pool_name: str, + cluster_name: str, + cluster_upgrade_request: Union[_models.ClusterUpgrade, IO], + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Upgrade a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_pool_name: The name of the cluster pool. Required. + :type cluster_pool_name: str + :param cluster_name: The name of the HDInsight cluster. Required. + :type cluster_name: str + :param cluster_upgrade_request: Upgrade a cluster. Is either a ClusterUpgrade type or a IO + type. Required. + :type cluster_upgrade_request: ~azure.mgmt.hdinsightcontainers.models.ClusterUpgrade 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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsightcontainers.models.Cluster] + :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.Cluster] = 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._upgrade_initial( + resource_group_name=resource_group_name, + cluster_pool_name=cluster_pool_name, + cluster_name=cluster_name, + cluster_upgrade_request=cluster_upgrade_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}/upgrade" + } + def _resize_initial( self, resource_group_name: str, @@ -1285,7 +1561,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_locations_operations.py index 63ab515d1e0b..3b5a2da0c212 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_locations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_locations_operations.py @@ -39,7 +39,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_operations.py index 8936cca4e18a..857717ab5fea 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/azure/mgmt/hdinsightcontainers/operations/_operations.py @@ -40,7 +40,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-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_autoscale_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_autoscale_cluster.py index cd500842bd61..e0331ee76ae2 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_autoscale_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_autoscale_cluster.py @@ -71,24 +71,29 @@ def main(): "timeZone": "Cen. Australia Standard Time", }, }, - "clusterVersion": "1.0.1", + "clusterVersion": "1.0.6", "identityProfile": { "msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34", "msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441", "msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi", }, - "kafkaProfile": {}, - "ossVersion": "2.4.1", + "ossVersion": "0.410.0", "sshProfile": {"count": 2}, + "trinoProfile": {}, + }, + "clusterType": "Trino", + "computeProfile": { + "nodes": [ + {"count": 2, "type": "Head", "vmSize": "Standard_E8as_v5"}, + {"count": 3, "type": "Worker", "vmSize": "Standard_E8as_v5"}, + ] }, - "clusterType": "kafka", - "computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]}, }, }, ).result() print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateAutoscaleCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateAutoscaleCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool.py index 637b5bf1bd6f..d738147e13d1 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateClusterPool.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPool.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_private_aks.py similarity index 54% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py rename to sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_private_aks.py index ff629cb9cc02..3a5d15b45901 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_private_aks.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.scvmm import SCVMM +from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-scvmm + pip install azure-mgmt-hdinsightcontainers # USAGE - python update_virtual_machine.py + python create_cluster_pool_with_private_aks.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, @@ -24,35 +24,29 @@ def main(): - client = SCVMM( + client = HDInsightContainersMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", ) - response = client.virtual_machines.begin_update( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - body={ + response = client.cluster_pools.begin_create_or_update( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_pool={ + "location": "West US 2", "properties": { - "hardwareProfile": {"cpuCount": 4, "memoryMB": 4096}, + "clusterPoolProfile": {"clusterPoolVersion": "1.2"}, + "computeProfile": {"vmSize": "Standard_D3_v2"}, "networkProfile": { - "networkInterfaces": [ - { - "ipv4AddressType": "Dynamic", - "ipv6AddressType": "Dynamic", - "macAddressType": "Static", - "name": "test", - } - ] + "enablePrivateApiServer": True, + "subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", }, - "storageProfile": {"disks": [{"diskSizeGB": 10, "name": "test"}]}, }, - "tags": {"tag1": "value1", "tag2": "value2"}, }, ).result() print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachine.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithPrivateAks.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_udr_aks.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_udr_aks.py new file mode 100644 index 000000000000..2e4fc3c974bd --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_cluster_pool_with_udr_aks.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python create_cluster_pool_with_udr_aks.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.cluster_pools.begin_create_or_update( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_pool={ + "location": "West US 2", + "properties": { + "clusterPoolProfile": {"clusterPoolVersion": "1.2"}, + "computeProfile": {"vmSize": "Standard_D3_v2"}, + "networkProfile": { + "outboundType": "userDefinedRouting", + "subnetId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateClusterPoolWithUDRAks.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_ranger_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_ranger_cluster.py new file mode 100644 index 000000000000..9fca1c120fe5 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_ranger_cluster.py @@ -0,0 +1,77 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python create_ranger_cluster.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.clusters.begin_create( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + hd_insight_cluster={ + "location": "West US 2", + "properties": { + "clusterProfile": { + "authorizationProfile": {"userIds": ["testuser1", "testuser2"]}, + "clusterVersion": "0.0.1", + "identityProfile": { + "msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34", + "msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441", + "msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi", + }, + "ossVersion": "2.2.3", + "rangerProfile": { + "rangerAdmin": { + "admins": ["testuser1@contoso.com", "testuser2@contoso.com"], + "database": { + "host": "testsqlserver.database.windows.net", + "name": "testdb", + "passwordSecretRef": "https://testkv.vault.azure.net/secrets/mysecret/5df6584d9c25418c8d900240aa6c3452", + "username": "admin", + }, + }, + "rangerAudit": {"storageAccount": "https://teststorage.blob.core.windows.net/testblob"}, + "rangerUsersync": { + "enabled": True, + "groups": ["0a53828f-36c9-44c3-be3d-99a7fce977ad", "13be6971-79db-4f33-9d41-b25589ca25ac"], + "mode": "automatic", + "users": ["testuser1@contoso.com", "testuser2@contoso.com"], + }, + }, + }, + "clusterType": "ranger", + "computeProfile": {"nodes": [{"count": 2, "type": "head", "vmSize": "Standard_D3_v2"}]}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateRangerCluster.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster.py index 05c601b44b80..f8b7154dba64 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster.py @@ -93,6 +93,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/CreateSparkCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateSparkCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster_with_internal_ingress.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster_with_internal_ingress.py new file mode 100644 index 000000000000..7c55b08e7fd8 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/create_spark_cluster_with_internal_ingress.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python create_spark_cluster_with_internal_ingress.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.clusters.begin_create( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + hd_insight_cluster={ + "location": "West US 2", + "properties": { + "clusterProfile": { + "authorizationProfile": {"userIds": ["testuser1", "testuser2"]}, + "clusterAccessProfile": {"enableInternalIngress": True}, + "clusterVersion": "0.0.1", + "identityProfile": { + "msiClientId": "de91f1d8-767f-460a-ac11-3cf103f74b34", + "msiObjectId": "40491351-c240-4042-91e0-f644a1d2b441", + "msiResourceId": "/subscriptions/subid/resourceGroups/hiloResourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-msi", + }, + "ossVersion": "2.2.3", + "serviceConfigsProfiles": [ + { + "configs": [ + { + "component": "spark-config", + "files": [ + { + "fileName": "spark-defaults.conf", + "values": {"spark.eventLog.enabled": "true"}, + } + ], + } + ], + "serviceName": "spark-service", + }, + { + "configs": [ + { + "component": "yarn-config", + "files": [ + { + "fileName": "core-site.xml", + "values": { + "fs.defaultFS": "wasb://testcontainer@teststorage.dfs.core.windows.net/", + "storage.container": "testcontainer", + "storage.key": "test key", + "storage.name": "teststorage", + "storage.protocol": "wasb", + }, + }, + {"fileName": "yarn-site.xml", "values": {"yarn.webapp.ui2.enable": "false"}}, + ], + } + ], + "serviceName": "yarn-service", + }, + ], + "sparkProfile": {}, + "sshProfile": {"count": 2}, + }, + "clusterType": "spark", + "computeProfile": {"nodes": [{"count": 4, "type": "worker", "vmSize": "Standard_D3_v2"}]}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/CreateSparkClusterWithInternalIngress.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster.py index a697bb541602..195dd1ba9bf0 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster_pool.py index 8fe0f8ed31b7..be84a02b7c79 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster_pool.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/delete_cluster_pool.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/DeleteClusterPool.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/DeleteClusterPool.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster.py index 68d881372b07..8034582c236d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_instance_view.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_instance_view.py index a78dbc9997fd..45d740d65e7d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_instance_view.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_instance_view.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterInstanceView.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterInstanceView.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_pool.py index 5c41cfea1cdf..6adb3a259dd9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_pool.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_cluster_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetClusterPool.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetClusterPool.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_operations.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_operations.py index d317bdb16171..04408233f36c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/get_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/GetOperations.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_pool_versions.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_pool_versions.py index 8295889c67e2..aec3bc181b51 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_pool_versions.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_pool_versions.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterPoolVersions.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterPoolVersions.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_versions.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_versions.py index db58bfbd1eb0..cec30f2f69f0 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_versions.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_available_cluster_versions.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListAvailableClusterVersions.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListAvailableClusterVersions.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_available_upgrades.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_available_upgrades.py new file mode 100644 index 000000000000..e17e695425d8 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_available_upgrades.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python list_cluster_available_upgrades.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.cluster_available_upgrades.list( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterAvailableUpgrades.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_instance_views.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_instance_views.py index f69197b066f8..7b44313ef7d8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_instance_views.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_instance_views.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterInstanceViews.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterInstanceViews.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_jobs.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_jobs.py index 906fcb6af36b..de0dc0c5858f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_jobs.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_jobs.py @@ -26,7 +26,7 @@ def main(): client = HDInsightContainersMgmtClient( credential=DefaultAzureCredential(), - subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cluster_jobs.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterJobs.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterJobs.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pool_available_upgrades.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pool_available_upgrades.py new file mode 100644 index 000000000000..031c98f38172 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pool_available_upgrades.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python list_cluster_pool_available_upgrades.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.cluster_pool_available_upgrades.list( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolAvailableUpgrades.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools.py index 7fb85f4f0e1b..0b9c63ee889f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPools.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPools.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools_subscription.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools_subscription.py index c0a71acd68f6..4c43880c3975 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools_subscription.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_pools_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterPoolsSubscription.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterPoolsSubscription.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_service_configs.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_service_configs.py index df3131ebd7a6..eab4988064a5 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_service_configs.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_cluster_service_configs.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClusterServiceConfigs.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClusterServiceConfigs.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_clusters_by_cluster_pool_name.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_clusters_by_cluster_pool_name.py index 52a60c9c27d8..f0a92b7ee6a0 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_clusters_by_cluster_pool_name.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/list_clusters_by_cluster_pool_name.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ListClustersByClusterPoolName.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ListClustersByClusterPoolName.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/locations_name_availability.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/locations_name_availability.py index bef0252f1b02..9ab2bb530eb0 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/locations_name_availability.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/locations_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/LocationsNameAvailability.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/LocationsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster.py index b7d00c61d5e3..b5b7abf4ad69 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster.py @@ -34,7 +34,6 @@ def main(): cluster_pool_name="clusterpool1", cluster_name="cluster1", cluster_patch_request={ - "location": "West US 2", "properties": { "clusterProfile": { "authorizationProfile": {"userIds": ["Testuser1", "Testuser2"]}, @@ -102,12 +101,12 @@ def main(): ], "sshProfile": {"count": 2}, } - }, + } }, ).result() print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster_pool.py index 1fe46d99dcd6..2b3a6b891132 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster_pool.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_cluster_pool.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/PatchClusterPool.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchClusterPool.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_ranger_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_ranger_cluster.py new file mode 100644 index 000000000000..a6ad723f4f22 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/patch_ranger_cluster.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python patch_ranger_cluster.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.clusters.begin_update( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + cluster_patch_request={ + "properties": { + "clusterProfile": { + "rangerProfile": { + "rangerAdmin": { + "admins": ["testuser1@contoso.com", "testuser2@contoso.com"], + "database": { + "host": "testsqlserver.database.windows.net", + "name": "testdb", + "passwordSecretRef": "https://testkv.vault.azure.net/secrets/mysecret/5df6584d9c25418c8d900240aa6c3452", + "username": "admin", + }, + }, + "rangerAudit": {"storageAccount": "https://teststorage.blob.core.windows.net/testblob"}, + "rangerUsersync": { + "enabled": True, + "groups": ["0a53828f-36c9-44c3-be3d-99a7fce977ad", "13be6971-79db-4f33-9d41-b25589ca25ac"], + "mode": "automatic", + "users": ["testuser1@contoso.com", "testuser2@contoso.com"], + }, + } + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/PatchRangerCluster.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/resize_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/resize_cluster.py index 3c474b9d2f2b..724bb3269ab3 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/resize_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/resize_cluster.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/ResizeCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/ResizeCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/run_cluster_job.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/run_cluster_job.py index 38dc5edaa31b..05f1aa74c1f3 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/run_cluster_job.py +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/run_cluster_job.py @@ -26,7 +26,7 @@ def main(): client = HDInsightContainersMgmtClient( credential=DefaultAzureCredential(), - subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cluster_jobs.begin_run_job( @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-06-01-preview/examples/RunClusterJob.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/RunClusterJob.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster.py new file mode 100644 index 000000000000..0c2bdc97b9b9 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python upgrade_aks_patch_version_for_cluster.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.clusters.begin_upgrade( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + cluster_upgrade_request={"properties": {"upgradeType": "AKSPatchUpgrade"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForCluster.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster_pool.py new file mode 100644 index 000000000000..486406bfcf1d --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_aks_patch_version_for_cluster_pool.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python upgrade_aks_patch_version_for_cluster_pool.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.cluster_pools.begin_upgrade( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_pool_upgrade_request={ + "properties": { + "upgradeAllClusterNodes": False, + "upgradeClusterPool": True, + "upgradeType": "AKSPatchUpgrade", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeAKSPatchVersionForClusterPool.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_hotfix_for_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_hotfix_for_cluster.py new file mode 100644 index 000000000000..cefd249589d2 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_hotfix_for_cluster.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python upgrade_hotfix_for_cluster.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.clusters.begin_upgrade( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_name="cluster1", + cluster_upgrade_request={ + "properties": { + "componentName": "historyserver", + "targetBuildNumber": "3", + "targetClusterVersion": "1.0.6", + "targetOssVersion": "1.16.0", + "upgradeType": "HotfixUpgrade", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeHotfixForCluster.json +if __name__ == "__main__": + main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_node_os_for_cluster_pool.py b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_node_os_for_cluster_pool.py new file mode 100644 index 000000000000..ad222dfaeb78 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/generated_samples/upgrade_node_os_for_cluster_pool.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.hdinsightcontainers import HDInsightContainersMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hdinsightcontainers +# USAGE + python upgrade_node_os_for_cluster_pool.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 = HDInsightContainersMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="10e32bab-26da-4cc4-a441-52b318f824e6", + ) + + response = client.cluster_pools.begin_upgrade( + resource_group_name="hiloResourcegroup", + cluster_pool_name="clusterpool1", + cluster_pool_upgrade_request={"properties": {"upgradeType": "NodeOsUpgrade"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/preview/2023-11-01-preview/examples/UpgradeNodeOsForClusterPool.json +if __name__ == "__main__": + main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json index eae54078f6e4..84af900453ca 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json @@ -1,11 +1,11 @@ { - "commit": "583e15ceb4cf23dc23b2300bd352f16d781e69ac", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/healthcareapis/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/healthcareapis/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/healthcareapis/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py index 7954d874ed74..a5a15654575b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py @@ -29,14 +29,14 @@ class HealthcareApisManagementClientConfiguration(Configuration): # pylint: dis :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-12-01". 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(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2023-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py index 4a8ce2e6ecac..5a229c00ee35 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py @@ -77,7 +77,7 @@ class HealthcareApisManagementClient: # pylint: disable=client-accepts-api-vers :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-12-01". 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 diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py index 2b126a1d5db1..d90cefecc637 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py @@ -29,14 +29,14 @@ class HealthcareApisManagementClientConfiguration(Configuration): # pylint: dis :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-12-01". 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(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2023-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py index 30fe4f4e484d..66bf4e0609d3 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py @@ -77,7 +77,7 @@ class HealthcareApisManagementClient: # pylint: disable=client-accepts-api-vers :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-12-01". 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 diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py index 5a42ffa36a7c..714893330d8d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py @@ -75,6 +75,8 @@ from ._models_py3 import ServicesProperties from ._models_py3 import ServicesResource from ._models_py3 import ServicesResourceIdentity +from ._models_py3 import SmartIdentityProviderApplication +from ._models_py3 import SmartIdentityProviderConfiguration from ._models_py3 import SystemData from ._models_py3 import TaggedResource from ._models_py3 import UserAssignedIdentity @@ -98,6 +100,7 @@ from ._healthcare_apis_management_client_enums import ServiceEventState from ._healthcare_apis_management_client_enums import ServiceManagedIdentityType from ._healthcare_apis_management_client_enums import ServiceNameUnavailabilityReason +from ._healthcare_apis_management_client_enums import SmartDataActions from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -172,6 +175,8 @@ "ServicesProperties", "ServicesResource", "ServicesResourceIdentity", + "SmartIdentityProviderApplication", + "SmartIdentityProviderConfiguration", "SystemData", "TaggedResource", "UserAssignedIdentity", @@ -194,6 +199,7 @@ "ServiceEventState", "ServiceManagedIdentityType", "ServiceNameUnavailabilityReason", + "SmartDataActions", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py index 30eeb9c2aebf..00ca5a20af9e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py @@ -138,3 +138,9 @@ class ServiceNameUnavailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMe INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" + + +class SmartDataActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Data Actions that can be enabled for a Smart Identity Provider Application.""" + + READ = "Read" diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py index 33d81dfa5f53..b1ea12000eda 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py @@ -882,12 +882,17 @@ class FhirServiceAuthenticationConfiguration(_serialization.Model): :vartype audience: str :ivar smart_proxy_enabled: If the SMART on FHIR proxy is enabled. :vartype smart_proxy_enabled: bool + :ivar smart_identity_providers: The array of identity provider configurations for SMART on FHIR + authentication. + :vartype smart_identity_providers: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderConfiguration] """ _attribute_map = { "authority": {"key": "authority", "type": "str"}, "audience": {"key": "audience", "type": "str"}, "smart_proxy_enabled": {"key": "smartProxyEnabled", "type": "bool"}, + "smart_identity_providers": {"key": "smartIdentityProviders", "type": "[SmartIdentityProviderConfiguration]"}, } def __init__( @@ -896,6 +901,7 @@ def __init__( authority: Optional[str] = None, audience: Optional[str] = None, smart_proxy_enabled: Optional[bool] = None, + smart_identity_providers: Optional[List["_models.SmartIdentityProviderConfiguration"]] = None, **kwargs: Any ) -> None: """ @@ -905,11 +911,16 @@ def __init__( :paramtype audience: str :keyword smart_proxy_enabled: If the SMART on FHIR proxy is enabled. :paramtype smart_proxy_enabled: bool + :keyword smart_identity_providers: The array of identity provider configurations for SMART on + FHIR authentication. + :paramtype smart_identity_providers: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderConfiguration] """ super().__init__(**kwargs) self.authority = authority self.audience = audience self.smart_proxy_enabled = smart_proxy_enabled + self.smart_identity_providers = smart_identity_providers class FhirServiceCollection(_serialization.Model): @@ -3226,6 +3237,89 @@ def __init__( self.type = type +class SmartIdentityProviderApplication(_serialization.Model): + """An Application configured in the Identity Provider used to access FHIR resources. + + :ivar client_id: The application client id defined in the identity provider. This value will be + used to validate bearer tokens against the given authority. + :vartype client_id: str + :ivar audience: The audience that will be used to validate bearer tokens against the given + authority. + :vartype audience: str + :ivar allowed_data_actions: The actions that are permitted to be performed on FHIR resources + for the application. + :vartype allowed_data_actions: list[str or ~azure.mgmt.healthcareapis.models.SmartDataActions] + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "allowed_data_actions": {"key": "allowedDataActions", "type": "[str]"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + audience: Optional[str] = None, + allowed_data_actions: Optional[List[Union[str, "_models.SmartDataActions"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: The application client id defined in the identity provider. This value will + be used to validate bearer tokens against the given authority. + :paramtype client_id: str + :keyword audience: The audience that will be used to validate bearer tokens against the given + authority. + :paramtype audience: str + :keyword allowed_data_actions: The actions that are permitted to be performed on FHIR resources + for the application. + :paramtype allowed_data_actions: list[str or + ~azure.mgmt.healthcareapis.models.SmartDataActions] + """ + super().__init__(**kwargs) + self.client_id = client_id + self.audience = audience + self.allowed_data_actions = allowed_data_actions + + +class SmartIdentityProviderConfiguration(_serialization.Model): + """An object to configure an identity provider for use with SMART on FHIR authentication. + + :ivar authority: The identity provider token authority also known as the token issuing + authority. + :vartype authority: str + :ivar applications: The array of identity provider applications for SMART on FHIR + authentication. + :vartype applications: list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderApplication] + """ + + _attribute_map = { + "authority": {"key": "authority", "type": "str"}, + "applications": {"key": "applications", "type": "[SmartIdentityProviderApplication]"}, + } + + def __init__( + self, + *, + authority: Optional[str] = None, + applications: Optional[List["_models.SmartIdentityProviderApplication"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword authority: The identity provider token authority also known as the token issuing + authority. + :paramtype authority: str + :keyword applications: The array of identity provider applications for SMART on FHIR + authentication. + :paramtype applications: + list[~azure.mgmt.healthcareapis.models.SmartIdentityProviderApplication] + """ + super().__init__(**kwargs) + self.authority = authority + self.applications = applications + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py index f8cad4f60958..b44a8124d219 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py @@ -45,7 +45,7 @@ def build_list_by_workspace_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +153,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,7 +192,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py index 6102a7e65334..0a3d61a55bba 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py @@ -42,7 +42,7 @@ def build_list_by_iot_connector_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py index 3c0cac3f16bf..d43a4369d2ea 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py @@ -45,7 +45,7 @@ def build_list_by_workspace_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py index 1305f8aa4471..9c827d2c9bc0 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py @@ -48,7 +48,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -139,7 +139,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py index f2f2064079f2..321508adb808 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py @@ -45,7 +45,7 @@ def build_list_by_workspace_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +153,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -192,7 +192,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py index df1c80682d8a..2eae3670df82 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py @@ -38,7 +38,7 @@ def build_get_request(location_name: str, operation_result_id: 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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py index e31a60ae709e..c95ad1389bfc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py @@ -40,7 +40,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py index 504d7a64d342..93e4a25d6ef8 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py @@ -45,7 +45,7 @@ def build_list_by_service_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +165,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py index 9e241da99f54..ea9559c9f355 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py @@ -40,7 +40,7 @@ def build_list_by_service_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py index 990fdf2cc5ff..1e226de4c01b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py @@ -43,7 +43,7 @@ def build_get_request(resource_group_name: str, resource_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -112,7 +112,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +148,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +179,7 @@ def build_list_request(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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +203,7 @@ def build_list_by_resource_group_request(resource_group_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +233,7 @@ def build_check_name_availability_request(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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py index 47eec0e0abca..a48ed46c1c06 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_endpoint_connections_operations.py @@ -45,7 +45,7 @@ def build_list_by_workspace_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +165,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py index da2b038e5979..eae5e1f08873 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspace_private_link_resources_operations.py @@ -42,7 +42,7 @@ def build_list_by_workspace_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py index 686f9e78356b..b971044b22dc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py @@ -43,7 +43,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +132,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +168,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -204,7 +204,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-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py index 5028980ee3f9..85efb456431f 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/check_name_availability_post.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/CheckNameAvailabilityPost.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/CheckNameAvailabilityPost.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py index 46e14e13bdca..8c1fc68f8521 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/dicomservices/DicomServices_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py index adc7394bf2e2..7972ef028b8d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/dicomservices/DicomServices_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py index 109d0165f75d..417f60029c4d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/dicomservices/DicomServices_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py index 12c7341750f2..3b6b5541fbe1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/dicomservices/DicomServices_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py index a5397ee5ba8c..2d1f40772a84 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/dicomservices/dicom_services_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/dicomservices/DicomServices_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/dicomservices/DicomServices_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py index fa81fc96e81c..b2beedb14a20 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_create.py @@ -47,6 +47,18 @@ def main(): "authenticationConfiguration": { "audience": "https://azurehealthcareapis.com", "authority": "https://login.microsoftonline.com/abfde7b2-df0f-47e6-aabf-2462b07508dc", + "smartIdentityProviders": [ + { + "applications": [ + { + "allowedDataActions": ["Read"], + "audience": "22222222-2222-2222-2222-222222222222", + "clientId": "22222222-2222-2222-2222-222222222222", + } + ], + "authority": "https://login.b2clogin.com/11111111-1111-1111-1111-111111111111/v2.0", + } + ], "smartProxyEnabled": True, }, "corsConfiguration": { @@ -75,6 +87,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/fhirservices/FhirServices_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py index eae5bc9832a6..b5b6a611519d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/fhirservices/FhirServices_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py index 349a4de61d8e..bace7a26bb95 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/fhirservices/FhirServices_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py index 6471e18ec5d6..d7d69125374c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/fhirservices/FhirServices_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py index 1f0026a8c597..2a71c28d878a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/fhirservices/fhir_services_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/fhirservices/FhirServices_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/fhirservices/FhirServices_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py index b3d42bf80db0..53157499ad88 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_create.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py index 249acfb29b42..c2596d4e7709 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py index c1e9999e84d4..b572e5f12d7b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_create.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_fhirdestination_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py index 62f875a3c22c..0a2fd2119513 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_fhirdestination_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py index b3baec72475f..d9fec91ba7ae 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_fhirdestination_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py index f96ca3557a03..cbe4d6fe83a1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_fhirdestination_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_fhirdestination_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_fhirdestination_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py index 1911825cb8ab..5d0ee4510054 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py index bd9db60d035a..c8ec4271b845 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_List.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_List.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py index 19869dfc0d28..ebb0974c1f07 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/iotconnectors/iotconnector_patch.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/iotconnectors/iotconnector_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/iotconnectors/iotconnector_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py index 8870ab264427..b3fbe81bc3ab 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resource_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/PrivateLinkResourceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/PrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py index 1c0d748a1336..aa2b31e5d4ce 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/private_link_resources_list_by_service.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/PrivateLinkResourcesListByService.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/PrivateLinkResourcesListByService.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py index 47e9655d61a3..7767c6caa8c9 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create.py @@ -67,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreate.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py index ae0ad4ccbe61..6309735d8392 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_in_data_sovereign_region_with_cmk_enabled.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreateInDataSovereignRegionWithCmkEnabled.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceCreateInDataSovereignRegionWithCmkEnabled.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py index db99f1c8d575..adde071f4d42 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_minimum.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreateMinimum.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceCreateMinimum.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py index 5ac228219d52..61a75bbb66a6 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_create_private_endpoint_connection.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceCreatePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceCreatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py index e7019f2f69eb..a7be157c36a8 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceDelete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py index a6bbcc69778e..2565f5987e7b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_delete_private_endpoint_connection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py index d35cf7a85bc6..cb0a491a3bfb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py index 8dad68ce88dc..e00e35ee4e16 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_in_data_sovereign_region_with_cmk_enabled.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGetInDataSovereignRegionWithCmkEnabled.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceGetInDataSovereignRegionWithCmkEnabled.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py index c00a72bb1a42..df1217393a9e 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceGetPrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py index d15ae2ccbff9..534bad163d2a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceList.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceList.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py index 06e2f93e9ae8..327b5b026563 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceListByResourceGroup.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py index 260cdc171fbf..1e0933b0d501 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_list_private_endpoint_connections.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServiceListPrivateEndpointConnections.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServiceListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py index 34ef8bc723ea..f15135b1b768 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/legacy/service_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/legacy/ServicePatch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/legacy/ServicePatch.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py index 788ad2c78dc8..5b5404ff20ae 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operation_results_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/OperationResultsGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/OperationResultsGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py index 5393940867ce..fe3782f4d58d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/OperationsList.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py index 2dfacb8a9ca7..28a62a9314e9 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/private_link_resources_list_by_workspace.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/PrivateLinkResourcesListByWorkspace.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/PrivateLinkResourcesListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py index fa21fdb0d146..7f605ab7bdc2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_create_private_endpoint_connection.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceCreatePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/WorkspaceCreatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py index 5d725c809c8c..02bf3bd8061c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_delete_private_endpoint_connection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/WorkspaceDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py index da200b61557b..b90b4af58010 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceGetPrivateEndpointConnection.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/WorkspaceGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py index b655aaa6fbbc..17b484bde428 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_list_private_endpoint_connections.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspaceListPrivateEndpointConnections.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/WorkspaceListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py index 6d9ec01a114e..d6769d6b94fc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/privatelink/workspace_private_link_resource_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/privatelink/WorkspacePrivateLinkResourceGet.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/privatelink/WorkspacePrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py index 02e2e700f1b7..af0c7a073921 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Create.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_Create.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py index ea2288d3a3fa..f995e8407d69 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Delete.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_Delete.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py index 23c856cafa8c..19843a758f60 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Get.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_Get.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py index 80d6a37e82bb..fe3106760386 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_ListByResourceGroup.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py index 9ab7e4a44160..16e9d438f8bc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_ListBySubscription.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py index 68d06e30917d..ca9b9373fb9b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/generated_samples/workspaces/workspaces_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-11-01/examples/workspaces/Workspaces_Patch.json +# x-ms-original-file: specification/healthcareapis/resource-manager/Microsoft.HealthcareApis/stable/2023-12-01/examples/workspaces/Workspaces_Patch.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json index f1c1d487cbc8..36432493b1d4 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json @@ -1,11 +1,11 @@ { - "commit": "51a6e410cf9752dfdaad71f0f9778645d737d8c4", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hybridaks/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/hybridaks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hybridaks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_version.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_version.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/_meta.json b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/_meta.json index 5471d349ae25..0003a1cc5765 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/_meta.json +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7d6c14d986a67dca3451d7d92d8f6b9416d61fbf", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.1", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hybridkubernetes/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/hybridkubernetes/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hybridkubernetes/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/__init__.py index 3a398ff7b07a..e9d07f36a337 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_configuration.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_configuration.py index 898b0baad741..175d7bef734c 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_configuration.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class ConnectedKubernetesClientConfiguration(Configuration): # pylint: disable= :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 "2021-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". 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(ConnectedKubernetesClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01") # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", "2024-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-hybridkubernetes/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_connected_kubernetes_client.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_connected_kubernetes_client.py index b451f54fe3c7..ad87886f5319 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_connected_kubernetes_client.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_connected_kubernetes_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import ConnectedKubernetesClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ConnectedClusterOperations, Operations @@ -35,7 +35,7 @@ class ConnectedKubernetesClient: # pylint: disable=client-accepts-api-version-k :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 "2021-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". 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 @@ -52,9 +52,9 @@ def __init__( self._config = ConnectedKubernetesClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -85,15 +85,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> ConnectedKubernetesClient + def __enter__(self) -> "ConnectedKubernetesClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_serialization.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_serialization.py index 7c1dedb5133d..4bae2292227b 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_serialization.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} 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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,26 +645,26 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore 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) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _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)) @@ -659,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +699,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -718,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -726,10 +752,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 str(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) @@ -780,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +869,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -866,6 +892,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): @@ -878,9 +906,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) @@ -925,7 +958,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: @@ -1001,10 +1036,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1416,7 +1452,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1480,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1579,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1601,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1783,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1834,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1846,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1862,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1877,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1907,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1922,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1937,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1960,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1996,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_vendor.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_vendor.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_version.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_version.py index 58920e6942de..e5754a47ce68 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_version.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/__init__.py index 7ca2908904e5..0701ffdd4aee 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_configuration.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_configuration.py index c8eb9acfecc9..3fb3ad772b9c 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_configuration.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class ConnectedKubernetesClientConfiguration(Configuration): # pylint: disable= :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 "2021-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". 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(ConnectedKubernetesClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01") # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", "2024-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_connected_kubernetes_client.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_connected_kubernetes_client.py index 72b473e4c0df..3a388fa36cf6 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_connected_kubernetes_client.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/_connected_kubernetes_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ConnectedKubernetesClientConfiguration from .operations import ConnectedClusterOperations, Operations @@ -36,7 +36,7 @@ class ConnectedKubernetesClient: # pylint: disable=client-accepts-api-version-k :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 "2021-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". 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 @@ -53,9 +53,9 @@ def __init__( self._config = ConnectedKubernetesClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -93,5 +93,5 @@ async def __aenter__(self) -> "ConnectedKubernetesClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/__init__.py index 795e9a8dbdf4..5520b186cda4 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_connected_cluster_operations.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_connected_cluster_operations.py index ab65adaa253d..c056dec75e5d 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_connected_cluster_operations.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_connected_cluster_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +82,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + 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.ConnectedCluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connected_cluster, (IO, bytes)): + if isinstance(connected_cluster, (IOBase, bytes)): _content = connected_cluster else: _json = self._serialize.body(connected_cluster, "ConnectedCluster") @@ -113,10 +107,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,11 +128,13 @@ async def _create_initial( deserialized = self._deserialize("ConnectedCluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload async def begin_create( @@ -237,8 +234,8 @@ async def begin_create( :type resource_group_name: str :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str - :param connected_cluster: Parameters supplied to Create a Connected Cluster. Is either a model - type or a IO type. Required. + :param connected_cluster: Parameters supplied to Create a Connected Cluster. Is either a + ConnectedCluster type or a IO type. Required. :type connected_cluster: ~azure.mgmt.hybridkubernetes.models.ConnectedCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -260,16 +257,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.ConnectedCluster] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, connected_cluster=connected_cluster, @@ -289,10 +284,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -304,9 +299,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload async def update( @@ -386,7 +383,7 @@ async def update( :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str :param connected_cluster_patch: Parameters supplied to update Connected Cluster. Is either a - model type or a IO type. Required. + ConnectedClusterPatch type or a IO type. Required. :type connected_cluster_patch: ~azure.mgmt.hybridkubernetes.models.ConnectedClusterPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -407,16 +404,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + 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.ConnectedCluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connected_cluster_patch, (IO, bytes)): + if isinstance(connected_cluster_patch, (IOBase, bytes)): _content = connected_cluster_patch else: _json = self._serialize.body(connected_cluster_patch, "ConnectedClusterPatch") @@ -434,10 +429,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,7 +450,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @distributed_trace_async async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ConnectedCluster: @@ -484,10 +482,8 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedCluster] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -499,10 +495,11 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,7 +516,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -535,10 +534,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -550,10 +547,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,7 +564,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -594,13 +594,11 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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 = kwargs.pop("continuation_token", None) # type: Optional[str] + 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, @@ -618,9 +616,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -632,9 +630,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload async def list_cluster_user_credential( @@ -716,8 +716,8 @@ async def list_cluster_user_credential( :type resource_group_name: str :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str - :param properties: ListClusterUserCredential properties. Is either a model type or a IO type. - Required. + :param properties: ListClusterUserCredential properties. Is either a + ListClusterUserCredentialProperties type or a IO type. Required. :type properties: ~azure.mgmt.hybridkubernetes.models.ListClusterUserCredentialProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -738,16 +738,14 @@ async def list_cluster_user_credential( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + 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.CredentialResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "ListClusterUserCredentialProperties") @@ -765,10 +763,11 @@ async def list_cluster_user_credential( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -785,7 +784,9 @@ async def list_cluster_user_credential( return deserialized - list_cluster_user_credential.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential"} # type: ignore + list_cluster_user_credential.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential" + } @distributed_trace def list_by_resource_group( @@ -807,10 +808,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedClusterList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedClusterList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -832,7 +831,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -848,7 +847,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -856,14 +855,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConnectedClusterList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -876,7 +876,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ConnectedCluster"]: @@ -893,10 +895,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connecte _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedClusterList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedClusterList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -917,7 +917,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -933,7 +933,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -941,14 +941,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ConnectedClusterList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -961,4 +962,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters" + } diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_operations.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_operations.py index 8bcf78346481..edbae0177b64 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_operations.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +64,8 @@ def get(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +85,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +101,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,14 +109,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +130,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get.metadata = {"url": "/providers/Microsoft.Kubernetes/operations"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Kubernetes/operations"} diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py index 7ac13e29c39e..5ed49f9742c5 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import AadProfile +from ._models_py3 import ArcAgentProfile from ._models_py3 import ConnectedCluster from ._models_py3 import ConnectedClusterIdentity from ._models_py3 import ConnectedClusterList @@ -25,16 +27,22 @@ from ._models_py3 import TrackedResource from ._connected_kubernetes_client_enums import AuthenticationMethod +from ._connected_kubernetes_client_enums import AutoUpgradeOptions +from ._connected_kubernetes_client_enums import AzureHybridBenefit +from ._connected_kubernetes_client_enums import ConnectedClusterKind from ._connected_kubernetes_client_enums import ConnectivityStatus from ._connected_kubernetes_client_enums import CreatedByType from ._connected_kubernetes_client_enums import LastModifiedByType +from ._connected_kubernetes_client_enums import PrivateLinkState from ._connected_kubernetes_client_enums import ProvisioningState from ._connected_kubernetes_client_enums import ResourceIdentityType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AadProfile", + "ArcAgentProfile", "ConnectedCluster", "ConnectedClusterIdentity", "ConnectedClusterList", @@ -53,9 +61,13 @@ "SystemData", "TrackedResource", "AuthenticationMethod", + "AutoUpgradeOptions", + "AzureHybridBenefit", + "ConnectedClusterKind", "ConnectivityStatus", "CreatedByType", "LastModifiedByType", + "PrivateLinkState", "ProvisioningState", "ResourceIdentityType", ] diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py index d167a2ec259f..94f00dda6428 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py @@ -17,6 +17,29 @@ class AuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): AAD = "AAD" +class AutoUpgradeOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether the Arc agents on the be upgraded automatically to the latest version. + Defaults to Enabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class AzureHybridBenefit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether Azure Hybrid Benefit is opted in.""" + + TRUE = "True" + FALSE = "False" + NOT_APPLICABLE = "NotApplicable" + + +class ConnectedClusterKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the kind of Arc connected cluster based on host infrastructure.""" + + PROVISIONED_CLUSTER = "ProvisionedCluster" + + class ConnectivityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the connectivity status of the connected cluster.""" @@ -44,6 +67,13 @@ class LastModifiedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class PrivateLinkState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property which describes the state of private link on a connected cluster resource.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current deployment state of connectedClusters.""" diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py index 3f569b0dc045..245d5ddecf2e 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py @@ -8,20 +8,91 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AadProfile(_serialization.Model): + """AAD Profile specifies attributes for Azure Active Directory integration. + + :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :vartype enable_azure_rbac: bool + :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :vartype admin_group_object_i_ds: list[str] + :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :vartype tenant_id: str + """ + + _attribute_map = { + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "tenant_id": {"key": "tenantID", "type": "str"}, + } + + def __init__( + self, + *, + enable_azure_rbac: Optional[bool] = None, + admin_group_object_i_ds: Optional[List[str]] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :paramtype enable_azure_rbac: bool + :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :paramtype admin_group_object_i_ds: list[str] + :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.enable_azure_rbac = enable_azure_rbac + self.admin_group_object_i_ds = admin_group_object_i_ds + self.tenant_id = tenant_id + + +class ArcAgentProfile(_serialization.Model): + """Defines the Arc Agent properties for the clusters. + + :ivar desired_agent_version: Version of the Arc agents to be installed on the cluster resource. + :vartype desired_agent_version: str + :ivar agent_auto_upgrade: Indicates whether the Arc agents on the be upgraded automatically to + the latest version. Defaults to Enabled. Known values are: "Enabled" and "Disabled". + :vartype agent_auto_upgrade: str or ~azure.mgmt.hybridkubernetes.models.AutoUpgradeOptions + """ + + _attribute_map = { + "desired_agent_version": {"key": "desiredAgentVersion", "type": "str"}, + "agent_auto_upgrade": {"key": "agentAutoUpgrade", "type": "str"}, + } + + def __init__( + self, + *, + desired_agent_version: Optional[str] = None, + agent_auto_upgrade: Union[str, "_models.AutoUpgradeOptions"] = "Enabled", + **kwargs: Any + ) -> None: + """ + :keyword desired_agent_version: Version of the Arc agents to be installed on the cluster + resource. + :paramtype desired_agent_version: str + :keyword agent_auto_upgrade: Indicates whether the Arc agents on the be upgraded automatically + to the latest version. Defaults to Enabled. Known values are: "Enabled" and "Disabled". + :paramtype agent_auto_upgrade: str or ~azure.mgmt.hybridkubernetes.models.AutoUpgradeOptions + """ + super().__init__(**kwargs) + self.desired_agent_version = desired_agent_version + self.agent_auto_upgrade = agent_auto_upgrade class Resource(_serialization.Model): @@ -51,7 +122,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -60,7 +131,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -95,7 +167,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -128,6 +200,8 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at :vartype location: str :ivar identity: The identity of the connected cluster. Required. :vartype identity: ~azure.mgmt.hybridkubernetes.models.ConnectedClusterIdentity + :ivar kind: The kind of connected cluster. "ProvisionedCluster" + :vartype kind: str or ~azure.mgmt.hybridkubernetes.models.ConnectedClusterKind :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.hybridkubernetes.models.SystemData :ivar agent_public_key_certificate: Base64 encoded public certificate used by the agent to do @@ -146,6 +220,8 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at :vartype provisioning_state: str or ~azure.mgmt.hybridkubernetes.models.ProvisioningState :ivar distribution: The Kubernetes distribution running on this connected cluster. :vartype distribution: str + :ivar distribution_version: The Kubernetes distribution version on this connected cluster. + :vartype distribution_version: str :ivar infrastructure: The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. :vartype infrastructure: str @@ -160,6 +236,21 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at :ivar connectivity_status: Represents the connectivity status of the connected cluster. Known values are: "Connecting", "Connected", "Offline", and "Expired". :vartype connectivity_status: str or ~azure.mgmt.hybridkubernetes.models.ConnectivityStatus + :ivar private_link_state: Property which describes the state of private link on a connected + cluster resource. Known values are: "Enabled" and "Disabled". + :vartype private_link_state: str or ~azure.mgmt.hybridkubernetes.models.PrivateLinkState + :ivar private_link_scope_resource_id: The resource id of the private link scope this connected + cluster is assigned to, if any. + :vartype private_link_scope_resource_id: str + :ivar azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :vartype azure_hybrid_benefit: str or ~azure.mgmt.hybridkubernetes.models.AzureHybridBenefit + :ivar aad_profile: AAD profile for the connected cluster. + :vartype aad_profile: ~azure.mgmt.hybridkubernetes.models.AadProfile + :ivar arc_agent_profile: Arc agentry configuration for the provisioned cluster. + :vartype arc_agent_profile: ~azure.mgmt.hybridkubernetes.models.ArcAgentProfile + :ivar miscellaneous_properties: More properties related to the Connected Cluster. + :vartype miscellaneous_properties: dict[str, str] """ _validation = { @@ -178,6 +269,7 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at "managed_identity_certificate_expiration_time": {"readonly": True}, "last_connectivity_time": {"readonly": True}, "connectivity_status": {"readonly": True}, + "miscellaneous_properties": {"readonly": True}, } _attribute_map = { @@ -187,6 +279,7 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "identity": {"key": "identity", "type": "ConnectedClusterIdentity"}, + "kind": {"key": "kind", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "agent_public_key_certificate": {"key": "properties.agentPublicKeyCertificate", "type": "str"}, "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, @@ -195,6 +288,7 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at "agent_version": {"key": "properties.agentVersion", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "distribution": {"key": "properties.distribution", "type": "str"}, + "distribution_version": {"key": "properties.distributionVersion", "type": "str"}, "infrastructure": {"key": "properties.infrastructure", "type": "str"}, "offering": {"key": "properties.offering", "type": "str"}, "managed_identity_certificate_expiration_time": { @@ -203,20 +297,33 @@ class ConnectedCluster(TrackedResource): # pylint: disable=too-many-instance-at }, "last_connectivity_time": {"key": "properties.lastConnectivityTime", "type": "iso-8601"}, "connectivity_status": {"key": "properties.connectivityStatus", "type": "str"}, + "private_link_state": {"key": "properties.privateLinkState", "type": "str"}, + "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, + "azure_hybrid_benefit": {"key": "properties.azureHybridBenefit", "type": "str"}, + "aad_profile": {"key": "properties.aadProfile", "type": "AadProfile"}, + "arc_agent_profile": {"key": "properties.arcAgentProfile", "type": "ArcAgentProfile"}, + "miscellaneous_properties": {"key": "properties.miscellaneousProperties", "type": "{str}"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, identity: "_models.ConnectedClusterIdentity", agent_public_key_certificate: str, tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "_models.ConnectedClusterKind"]] = None, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, distribution: Optional[str] = None, + distribution_version: Optional[str] = None, infrastructure: Optional[str] = None, - **kwargs - ): + private_link_state: Union[str, "_models.PrivateLinkState"] = "Disabled", + private_link_scope_resource_id: Optional[str] = None, + azure_hybrid_benefit: Optional[Union[str, "_models.AzureHybridBenefit"]] = None, + aad_profile: Optional["_models.AadProfile"] = None, + arc_agent_profile: Optional["_models.ArcAgentProfile"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -224,6 +331,8 @@ def __init__( :paramtype location: str :keyword identity: The identity of the connected cluster. Required. :paramtype identity: ~azure.mgmt.hybridkubernetes.models.ConnectedClusterIdentity + :keyword kind: The kind of connected cluster. "ProvisionedCluster" + :paramtype kind: str or ~azure.mgmt.hybridkubernetes.models.ConnectedClusterKind :keyword agent_public_key_certificate: Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. Required. :paramtype agent_public_key_certificate: str @@ -232,12 +341,28 @@ def __init__( :paramtype provisioning_state: str or ~azure.mgmt.hybridkubernetes.models.ProvisioningState :keyword distribution: The Kubernetes distribution running on this connected cluster. :paramtype distribution: str + :keyword distribution_version: The Kubernetes distribution version on this connected cluster. + :paramtype distribution_version: str :keyword infrastructure: The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. :paramtype infrastructure: str + :keyword private_link_state: Property which describes the state of private link on a connected + cluster resource. Known values are: "Enabled" and "Disabled". + :paramtype private_link_state: str or ~azure.mgmt.hybridkubernetes.models.PrivateLinkState + :keyword private_link_scope_resource_id: The resource id of the private link scope this + connected cluster is assigned to, if any. + :paramtype private_link_scope_resource_id: str + :keyword azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :paramtype azure_hybrid_benefit: str or ~azure.mgmt.hybridkubernetes.models.AzureHybridBenefit + :keyword aad_profile: AAD profile for the connected cluster. + :paramtype aad_profile: ~azure.mgmt.hybridkubernetes.models.AadProfile + :keyword arc_agent_profile: Arc agentry configuration for the provisioned cluster. + :paramtype arc_agent_profile: ~azure.mgmt.hybridkubernetes.models.ArcAgentProfile """ super().__init__(tags=tags, location=location, **kwargs) self.identity = identity + self.kind = kind self.system_data = None self.agent_public_key_certificate = agent_public_key_certificate self.kubernetes_version = None @@ -246,11 +371,18 @@ def __init__( self.agent_version = None self.provisioning_state = provisioning_state self.distribution = distribution + self.distribution_version = distribution_version self.infrastructure = infrastructure self.offering = None self.managed_identity_certificate_expiration_time = None self.last_connectivity_time = None self.connectivity_status = None + self.private_link_state = private_link_state + self.private_link_scope_resource_id = private_link_scope_resource_id + self.azure_hybrid_benefit = azure_hybrid_benefit + self.aad_profile = aad_profile + self.arc_agent_profile = arc_agent_profile + self.miscellaneous_properties = None class ConnectedClusterIdentity(_serialization.Model): @@ -284,7 +416,7 @@ class ConnectedClusterIdentity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.ResourceIdentityType"] = "SystemAssigned", **kwargs): + def __init__(self, *, type: Union[str, "_models.ResourceIdentityType"] = "SystemAssigned", **kwargs: Any) -> None: """ :keyword type: The type of identity used for the connected cluster. The type 'SystemAssigned, includes a system created identity. The type 'None' means no identity is assigned to the @@ -312,8 +444,12 @@ class ConnectedClusterList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ConnectedCluster"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ConnectedCluster"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of connected clusters. :paramtype value: list[~azure.mgmt.hybridkubernetes.models.ConnectedCluster] @@ -330,27 +466,49 @@ class ConnectedClusterPatch(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar properties: Describes the connected cluster resource properties that can be updated - during PATCH operation. - :vartype properties: JSON + :ivar distribution: Represents the distribution of the connected cluster. + :vartype distribution: str + :ivar distribution_version: Represents the Kubernetes distribution version on this connected + cluster. + :vartype distribution_version: str + :ivar azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :vartype azure_hybrid_benefit: str or ~azure.mgmt.hybridkubernetes.models.AzureHybridBenefit """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "object"}, + "distribution": {"key": "properties.distribution", "type": "str"}, + "distribution_version": {"key": "properties.distributionVersion", "type": "str"}, + "azure_hybrid_benefit": {"key": "properties.azureHybridBenefit", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, properties: Optional[JSON] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + distribution: Optional[str] = None, + distribution_version: Optional[str] = None, + azure_hybrid_benefit: Optional[Union[str, "_models.AzureHybridBenefit"]] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword properties: Describes the connected cluster resource properties that can be updated - during PATCH operation. - :paramtype properties: JSON + :keyword distribution: Represents the distribution of the connected cluster. + :paramtype distribution: str + :keyword distribution_version: Represents the Kubernetes distribution version on this connected + cluster. + :paramtype distribution_version: str + :keyword azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :paramtype azure_hybrid_benefit: str or ~azure.mgmt.hybridkubernetes.models.AzureHybridBenefit """ super().__init__(**kwargs) self.tags = tags - self.properties = properties + self.distribution = distribution + self.distribution_version = distribution_version + self.azure_hybrid_benefit = azure_hybrid_benefit class CredentialResult(_serialization.Model): @@ -374,7 +532,7 @@ class CredentialResult(_serialization.Model): "value": {"key": "value", "type": "bytearray"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -403,7 +561,7 @@ class CredentialResults(_serialization.Model): "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.hybrid_connection_config = None @@ -431,7 +589,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -471,7 +629,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -482,7 +640,8 @@ def __init__(self, **kwargs): 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.). + """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.hybridkubernetes.models.ErrorDetail @@ -492,7 +651,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.hybridkubernetes.models.ErrorDetail @@ -530,7 +689,7 @@ class HybridConnectionConfig(_serialization.Model): "token": {"key": "token", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.expiration_time = None @@ -563,8 +722,8 @@ class ListClusterUserCredentialProperties(_serialization.Model): } def __init__( - self, *, authentication_method: Union[str, "_models.AuthenticationMethod"], client_proxy: bool, **kwargs - ): + self, *, authentication_method: Union[str, "_models.AuthenticationMethod"], client_proxy: bool, **kwargs: Any + ) -> None: """ :keyword authentication_method: The mode of client authentication. Required. Known values are: "Token" and "AAD". @@ -600,7 +759,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -634,8 +793,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.connectedClusters. :paramtype provider: str @@ -673,7 +832,7 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link to fetch the next page of connected cluster API operations. :paramtype next_link: str @@ -720,8 +879,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.LastModifiedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/__init__.py index 795e9a8dbdf4..5520b186cda4 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py index be6b6731b036..1cc2610b2cd1 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,8 +45,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +62,7 @@ def build_create_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,8 +81,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_update_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +115,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +131,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +164,7 @@ def build_delete_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,8 +181,8 @@ def build_list_cluster_user_credential_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +198,7 @@ def build_list_cluster_user_credential_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +215,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +230,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,7 +245,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 = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -260,7 +256,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 = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,16 +304,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + 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.ConnectedCluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connected_cluster, (IO, bytes)): + if isinstance(connected_cluster, (IOBase, bytes)): _content = connected_cluster else: _json = self._serialize.body(connected_cluster, "ConnectedCluster") @@ -335,10 +329,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,11 +350,13 @@ def _create_initial( deserialized = self._deserialize("ConnectedCluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload def begin_create( @@ -457,8 +454,8 @@ def begin_create( :type resource_group_name: str :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str - :param connected_cluster: Parameters supplied to Create a Connected Cluster. Is either a model - type or a IO type. Required. + :param connected_cluster: Parameters supplied to Create a Connected Cluster. Is either a + ConnectedCluster type or a IO type. Required. :type connected_cluster: ~azure.mgmt.hybridkubernetes.models.ConnectedCluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -479,16 +476,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.ConnectedCluster] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, connected_cluster=connected_cluster, @@ -508,9 +503,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -522,9 +517,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload def update( @@ -604,7 +601,7 @@ def update( :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str :param connected_cluster_patch: Parameters supplied to update Connected Cluster. Is either a - model type or a IO type. Required. + ConnectedClusterPatch type or a IO type. Required. :type connected_cluster_patch: ~azure.mgmt.hybridkubernetes.models.ConnectedClusterPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -625,16 +622,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + 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.ConnectedCluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connected_cluster_patch, (IO, bytes)): + if isinstance(connected_cluster_patch, (IOBase, bytes)): _content = connected_cluster_patch else: _json = self._serialize.body(connected_cluster_patch, "ConnectedClusterPatch") @@ -652,10 +647,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +668,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @distributed_trace def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ConnectedCluster: @@ -702,10 +700,8 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedCluster] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedCluster] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -717,10 +713,11 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -737,7 +734,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any @@ -753,10 +752,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -768,10 +765,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -784,7 +782,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -812,13 +812,11 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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 = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -836,9 +834,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -850,9 +848,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}" + } @overload def list_cluster_user_credential( @@ -934,8 +934,8 @@ def list_cluster_user_credential( :type resource_group_name: str :param cluster_name: The name of the Kubernetes cluster on which get is called. Required. :type cluster_name: str - :param properties: ListClusterUserCredential properties. Is either a model type or a IO type. - Required. + :param properties: ListClusterUserCredential properties. Is either a + ListClusterUserCredentialProperties type or a IO type. Required. :type properties: ~azure.mgmt.hybridkubernetes.models.ListClusterUserCredentialProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -956,16 +956,14 @@ def list_cluster_user_credential( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + 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.CredentialResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "ListClusterUserCredentialProperties") @@ -983,10 +981,11 @@ def list_cluster_user_credential( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1003,7 +1002,9 @@ def list_cluster_user_credential( return deserialized - list_cluster_user_credential.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential"} # type: ignore + list_cluster_user_credential.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ConnectedCluster"]: @@ -1022,10 +1023,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedClusterList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedClusterList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1047,7 +1046,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1063,7 +1062,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1071,14 +1070,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConnectedClusterList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1091,7 +1091,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedCluster"]: @@ -1107,10 +1109,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedClus _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectedClusterList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectedClusterList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1131,7 +1131,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1147,7 +1147,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1155,14 +1155,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ConnectedClusterList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1175,4 +1176,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters" + } diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_operations.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_operations.py index 75a3fede395e..bc164cd043b6 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_operations.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: Literal["2021-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +86,8 @@ def get(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,4 +152,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get.metadata = {"url": "/providers/Microsoft.Kubernetes/operations"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Kubernetes/operations"} diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_csp_token.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_csp_token.py new file mode 100644 index 000000000000..5fa07381e91e --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_csp_token.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python connected_clusters_list_cluster_credential_result_csp_token.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.list_cluster_user_credential( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + properties={"authenticationMethod": "Token", "clientProxy": True}, + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/ConnectedClustersListClusterCredentialResultCSPToken.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_cspaad.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_cspaad.py new file mode 100644 index 000000000000..1bac1ea9829d --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_cspaad.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python connected_clusters_list_cluster_credential_result_cspaad.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.list_cluster_user_credential( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + properties={"authenticationMethod": "AAD", "clientProxy": True}, + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/ConnectedClustersListClusterCredentialResultCSPAAD.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hp_token.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hp_token.py new file mode 100644 index 000000000000..2148d15377a3 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hp_token.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python connected_clusters_list_cluster_credential_result_hp_token.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.list_cluster_user_credential( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + properties={"authenticationMethod": "Token", "clientProxy": False}, + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/ConnectedClustersListClusterCredentialResultHPToken.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hpaad.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hpaad.py new file mode 100644 index 000000000000..78cd1ca6813a --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/connected_clusters_list_cluster_credential_result_hpaad.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python connected_clusters_list_cluster_credential_result_hpaad.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.list_cluster_user_credential( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + properties={"authenticationMethod": "AAD", "clientProxy": False}, + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/ConnectedClustersListClusterCredentialResultHPAAD.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_example.py new file mode 100644 index 000000000000..15bc93d4f981 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_example.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python create_cluster_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.begin_create( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + connected_cluster={ + "identity": {"type": "SystemAssigned"}, + "location": "East US", + "properties": { + "agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO", + "azureHybridBenefit": "NotApplicable", + "distribution": "AKS", + "distributionVersion": "1.0", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/CreateClusterExample.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_kind_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_kind_example.py new file mode 100644 index 000000000000..81235471836b --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_kind_example.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python create_cluster_kind_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.begin_create( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + connected_cluster={ + "identity": {"type": "SystemAssigned"}, + "kind": "ProvisionedCluster", + "location": "East US", + "properties": { + "aadProfile": { + "adminGroupObjectIDs": ["56f988bf-86f1-41af-91ab-2d7cd011db47"], + "enableAzureRBAC": True, + "tenantID": "82f988bf-86f1-41af-91ab-2d7cd011db47", + }, + "agentPublicKeyCertificate": "", + "arcAgentProfile": {"agentAutoUpgrade": "Enabled", "desiredAgentVersion": "0.1.0"}, + "azureHybridBenefit": "NotApplicable", + "distribution": "AKS", + "distributionVersion": "1.0", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/CreateCluster_KindExample.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_private_link_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_private_link_example.py new file mode 100644 index 000000000000..3a77be1b8811 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/create_cluster_private_link_example.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python create_cluster_private_link_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.begin_create( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + connected_cluster={ + "identity": {"type": "SystemAssigned"}, + "location": "East US", + "properties": { + "agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO", + "azureHybridBenefit": "NotApplicable", + "distribution": "AKS", + "distributionVersion": "1.0", + "privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName", + "privateLinkState": "Enabled", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/CreateClusterPrivateLinkExample.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/delete_cluster_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/delete_cluster_example.py index 3e95217dff8d..9ca2924a62d1 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/delete_cluster_example.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/delete_cluster_example.py @@ -29,13 +29,12 @@ def main(): subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", ) - response = client.connected_cluster.begin_delete( + client.connected_cluster.begin_delete( resource_group_name="k8sc-rg", cluster_name="testCluster", ).result() - print(response) -# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2021-10-01/examples/DeleteClusterExample.json +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/DeleteClusterExample.json if __name__ == "__main__": main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_cluster_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_cluster_example.py index 26a5ee3ccf14..981ef6850e01 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_cluster_example.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_cluster_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2021-10-01/examples/GetClusterExample.json +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/GetClusterExample.json if __name__ == "__main__": main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_resource_group_example.py similarity index 92% rename from sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_example.py rename to sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_resource_group_example.py index 33688be960b4..561ae5e292aa 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_example.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_resource_group_example.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridkubernetes # USAGE - python get_clusters_example.py + python get_clusters_by_resource_group_example.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, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2021-10-01/examples/GetClustersByResourceGroupExample.json +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/GetClustersByResourceGroupExample.json if __name__ == "__main__": main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_subscription_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_subscription_example.py new file mode 100644 index 000000000000..5627126720e5 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_clusters_by_subscription_example.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python get_clusters_by_subscription_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/GetClustersBySubscriptionExample.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_provisioned_cluster_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_provisioned_cluster_example.py new file mode 100644 index 000000000000..17c15021bb60 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/get_provisioned_cluster_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python get_provisioned_cluster_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.get( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/GetProvisionedClusterExample.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/list_connected_cluster_operations_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/list_connected_cluster_operations_example.py index fc58779ad542..92377cb8883f 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/list_connected_cluster_operations_example.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/list_connected_cluster_operations_example.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2021-10-01/examples/ListConnectedClusterOperationsExample.json +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/ListConnectedClusterOperationsExample.json if __name__ == "__main__": main() diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/update_cluster_example.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/update_cluster_example.py new file mode 100644 index 000000000000..b3daf7772f56 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/generated_samples/update_cluster_example.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.hybridkubernetes import ConnectedKubernetesClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridkubernetes +# USAGE + python update_cluster_example.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 = ConnectedKubernetesClient( + credential=DefaultAzureCredential(), + subscription_id="1bfbb5d0-917e-4346-9026-1d3b344417f5", + ) + + response = client.connected_cluster.update( + resource_group_name="k8sc-rg", + cluster_name="testCluster", + connected_cluster_patch={ + "properties": {"azureHybridBenefit": "NotApplicable", "distribution": "AKS", "distributionVersion": "1.0"}, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/stable/2024-01-01/examples/UpdateClusterExample.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json index f4f9290aab9b..2224637cf932 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c7daa3d35baaaabece0dbc6f731eadbe426973b9", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.12", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "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 --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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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 a128695e54fd..1b232c33b62a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py @@ -29,14 +29,14 @@ class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-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-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py index 690ca6db66e4..04973c133be1 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 @@ -18,6 +18,7 @@ from .operations import ( BatchDeploymentsOperations, BatchEndpointsOperations, + CapacityReservationGroupsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, @@ -26,9 +27,23 @@ DataContainersOperations, DataVersionsOperations, DatastoresOperations, + EndpointDeploymentOperations, + EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, + FeaturesOperations, + FeaturesetContainersOperations, + FeaturesetVersionsOperations, + FeaturestoreEntityContainersOperations, + FeaturestoreEntityVersionsOperations, + InferenceEndpointsOperations, + InferenceGroupsOperations, + InferencePoolsOperations, JobsOperations, + LabelingJobsOperations, + ManagedNetworkProvisionsOperations, + ManagedNetworkSettingsRuleOperations, + MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -43,12 +58,14 @@ RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, + RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, + ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, @@ -64,10 +81,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 +90,9 @@ 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 capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.machinelearningservices.operations.CapacityReservationGroupsOperations :ivar registry_code_containers: RegistryCodeContainersOperations operations :vartype registry_code_containers: azure.mgmt.machinelearningservices.operations.RegistryCodeContainersOperations @@ -104,12 +111,18 @@ 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 :ivar registry_environment_versions: RegistryEnvironmentVersionsOperations operations :vartype registry_environment_versions: azure.mgmt.machinelearningservices.operations.RegistryEnvironmentVersionsOperations + :ivar marketplace_subscriptions: MarketplaceSubscriptionsOperations operations + :vartype marketplace_subscriptions: + azure.mgmt.machinelearningservices.operations.MarketplaceSubscriptionsOperations :ivar registry_model_containers: RegistryModelContainersOperations operations :vartype registry_model_containers: azure.mgmt.machinelearningservices.operations.RegistryModelContainersOperations @@ -146,8 +159,33 @@ 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 labeling_jobs: LabelingJobsOperations operations + :vartype labeling_jobs: azure.mgmt.machinelearningservices.operations.LabelingJobsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.operations.ModelContainersOperations @@ -161,19 +199,46 @@ 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 endpoint_deployment: EndpointDeploymentOperations operations + :vartype endpoint_deployment: + azure.mgmt.machinelearningservices.operations.EndpointDeploymentOperations + :ivar endpoint: EndpointOperations operations + :vartype endpoint: azure.mgmt.machinelearningservices.operations.EndpointOperations + :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-01-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. @@ -195,21 +260,13 @@ def __init__( 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.capacity_reservation_groups = CapacityReservationGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) self.registry_code_containers = RegistryCodeContainersOperations( @@ -230,12 +287,18 @@ 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 ) self.registry_environment_versions = RegistryEnvironmentVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.marketplace_subscriptions = MarketplaceSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.registry_model_containers = RegistryModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -263,7 +326,28 @@ 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.labeling_jobs = LabelingJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -275,10 +359,34 @@ 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.endpoint_deployment = EndpointDeploymentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint = EndpointOperations(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: """Runs the network request through the client's chained policies. 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 842ae727fbbc..4bae2292227b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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 2eda20789583..e5754a47ce68 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.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 f012a758393b..760fe95a4107 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 @@ -29,14 +29,14 @@ class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-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-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py index 0240f80e8769..d5d4a760b156 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 @@ -18,6 +18,7 @@ from .operations import ( BatchDeploymentsOperations, BatchEndpointsOperations, + CapacityReservationGroupsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, @@ -26,9 +27,23 @@ DataContainersOperations, DataVersionsOperations, DatastoresOperations, + EndpointDeploymentOperations, + EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, + FeaturesOperations, + FeaturesetContainersOperations, + FeaturesetVersionsOperations, + FeaturestoreEntityContainersOperations, + FeaturestoreEntityVersionsOperations, + InferenceEndpointsOperations, + InferenceGroupsOperations, + InferencePoolsOperations, JobsOperations, + LabelingJobsOperations, + ManagedNetworkProvisionsOperations, + ManagedNetworkSettingsRuleOperations, + MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -43,12 +58,14 @@ RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, + RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, + ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, @@ -64,10 +81,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 +90,9 @@ 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 capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.machinelearningservices.aio.operations.CapacityReservationGroupsOperations :ivar registry_code_containers: RegistryCodeContainersOperations operations :vartype registry_code_containers: azure.mgmt.machinelearningservices.aio.operations.RegistryCodeContainersOperations @@ -104,12 +111,18 @@ 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 :ivar registry_environment_versions: RegistryEnvironmentVersionsOperations operations :vartype registry_environment_versions: azure.mgmt.machinelearningservices.aio.operations.RegistryEnvironmentVersionsOperations + :ivar marketplace_subscriptions: MarketplaceSubscriptionsOperations operations + :vartype marketplace_subscriptions: + azure.mgmt.machinelearningservices.aio.operations.MarketplaceSubscriptionsOperations :ivar registry_model_containers: RegistryModelContainersOperations operations :vartype registry_model_containers: azure.mgmt.machinelearningservices.aio.operations.RegistryModelContainersOperations @@ -148,8 +161,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 labeling_jobs: LabelingJobsOperations operations + :vartype labeling_jobs: + azure.mgmt.machinelearningservices.aio.operations.LabelingJobsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.aio.operations.ModelContainersOperations @@ -164,19 +203,46 @@ 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 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 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-01-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. @@ -198,21 +264,13 @@ def __init__( 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.capacity_reservation_groups = CapacityReservationGroupsOperations( self._client, self._config, self._serialize, self._deserialize ) self.registry_code_containers = RegistryCodeContainersOperations( @@ -233,12 +291,18 @@ 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 ) self.registry_environment_versions = RegistryEnvironmentVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.marketplace_subscriptions = MarketplaceSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.registry_model_containers = RegistryModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -266,7 +330,28 @@ 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.labeling_jobs = LabelingJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -278,10 +363,34 @@ 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.endpoint_deployment = EndpointDeploymentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint = EndpointOperations(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]: """Runs the network request through the client's chained policies. 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 4967e3af6930..d4a852d78ded 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,23 +6,21 @@ # 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 ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations 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 ._marketplace_subscriptions_operations import MarketplaceSubscriptionsOperations from ._registry_model_containers_operations import RegistryModelContainersOperations from ._registry_model_versions_operations import RegistryModelVersionsOperations from ._batch_endpoints_operations import BatchEndpointsOperations @@ -36,37 +34,54 @@ 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 ._labeling_jobs_operations import LabelingJobsOperations from ._model_containers_operations import ModelContainersOperations from ._model_versions_operations import ModelVersionsOperations from ._online_endpoints_operations import OnlineEndpointsOperations from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations +from ._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 ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +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", + "CapacityReservationGroupsOperations", "RegistryCodeContainersOperations", "RegistryCodeVersionsOperations", "RegistryComponentContainersOperations", "RegistryComponentVersionsOperations", "RegistryDataContainersOperations", "RegistryDataVersionsOperations", + "RegistryDataReferencesOperations", "RegistryEnvironmentContainersOperations", "RegistryEnvironmentVersionsOperations", + "MarketplaceSubscriptionsOperations", "RegistryModelContainersOperations", "RegistryModelVersionsOperations", "BatchEndpointsOperations", @@ -80,14 +95,33 @@ "DatastoresOperations", "EnvironmentContainersOperations", "EnvironmentVersionsOperations", + "FeaturesetContainersOperations", + "FeaturesOperations", + "FeaturesetVersionsOperations", + "FeaturestoreEntityContainersOperations", + "FeaturestoreEntityVersionsOperations", + "InferencePoolsOperations", + "InferenceEndpointsOperations", + "InferenceGroupsOperations", "JobsOperations", + "LabelingJobsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "ServerlessEndpointsOperations", "RegistriesOperations", "WorkspaceFeaturesOperations", + "Operations", + "WorkspacesOperations", + "WorkspaceConnectionsOperations", + "EndpointDeploymentOperations", + "EndpointOperations", + "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/_capacity_reservation_groups_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capacity_reservation_groups_operations.py new file mode 100644 index 000000000000..cdd358cb6f1c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capacity_reservation_groups_operations.py @@ -0,0 +1,683 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._capacity_reservation_groups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscription_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`capacity_reservation_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_by_subscription( + self, skip: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.CapacityReservationGroup"]: + """List CapacityReservationGroups by subscription. + + List CapacityReservationGroups by subscription. + + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CapacityReservationGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] + :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.CapacityReservationGroupTrackedResourceArmPaginatedResult] = 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( + "CapacityReservationGroupTrackedResourceArmPaginatedResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups" + } + + @distributed_trace + def list( + self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.CapacityReservationGroup"]: + """Lists CapacityReservationGroups. + + Lists CapacityReservationGroups. + + :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 CapacityReservationGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] + :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.CapacityReservationGroupTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "CapacityReservationGroupTrackedResourceArmPaginatedResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, group_id: str, **kwargs: Any + ) -> None: + """Delete CapacityReservationGroup. + + Delete CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + group_id=group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, group_id: str, **kwargs: Any) -> _models.CapacityReservationGroup: + """Get CapacityReservationGroup. + + Get CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :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.CapacityReservationGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + group_id=group_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) + + _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("CapacityReservationGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}" + } + + @overload + async def update( + self, + resource_group_name: str, + group_id: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + group_id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + group_id: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CapacityReservationGroup] = 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, + group_id=group_id, + 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) + + _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("CapacityReservationGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + group_id: str, + body: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :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: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + group_id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, group_id: str, body: Union[_models.CapacityReservationGroup, IO], **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Is either a CapacityReservationGroup + type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CapacityReservationGroup] = 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, "CapacityReservationGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CapacityReservationGroup", pipeline_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/capacityReserverationGroups/{groupId}" + } 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 cf86e6d15801..d51b465be6e8 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -35,6 +37,7 @@ build_delete_request, build_get_request, build_list_request, + build_publish_request, ) T = TypeVar("T") @@ -498,6 +501,255 @@ async def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" } + async def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/publish" + } + @overload async def create_or_get_start_pending_upload( self, 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 5910c2b49220..0a78f29a7be0 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -34,6 +36,7 @@ build_delete_request, build_get_request, build_list_request, + build_publish_request, ) T = TypeVar("T") @@ -69,6 +72,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ComponentVersion"]: """List component versions. @@ -91,6 +95,8 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param stage: Component stage. Default value is None. + :type stage: 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: @@ -123,6 +129,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -492,3 +499,252 @@ async def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" } + + async def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}/publish" + } 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 fff3c389b06b..6d8b97bd6740 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,13 +34,18 @@ 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, ) @@ -48,7 +53,7 @@ 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. @@ -866,6 +871,155 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" } + @overload + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: List[_models.CustomService], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: Union[List[_models.CustomService], IO], + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Is either a [CustomService] type or a IO + type. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.update_custom_services.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) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices" + } + @distributed_trace def list_nodes( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -1031,6 +1185,164 @@ async def list_keys( "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. + + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: IO, + *, + 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 + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_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], + **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. Is + either a [ComputeInstanceDataMount] type or a IO type. Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_data_mounts.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) + + if cls: + return cls(pipeline_response, None, {}) + + update_data_mounts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts" + } + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any ) -> None: @@ -1384,3 +1696,452 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_restart.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" } + + @overload + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.IdleShutdownSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.IdleShutdownSetting, IO], + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Is either a IdleShutdownSetting type or a IO type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.update_idle_shutdown_setting.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + update_idle_shutdown_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting" + } + + @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 + :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 = { + 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, + template_url=self.get_allowed_resize_sizes.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("VirtualMachineSizeListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_allowed_resize_sizes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize" + } + + async def _resize_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, "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, + template_url=self._resize_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resize_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO], + **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 type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + 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_resize.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize" + } 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 875689bd263c..cadcaeb43e18 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -34,6 +36,7 @@ build_delete_request, build_get_request, build_list_request, + build_publish_request, ) T = TypeVar("T") @@ -70,6 +73,7 @@ def list( skip: Optional[str] = None, tags: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.DataVersionBase"]: """List data versions in the data container. @@ -99,6 +103,8 @@ 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 + :param stage: data stage. Default value is None. + :type stage: str :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: @@ -132,6 +138,7 @@ def prepare_request(next_link=None): skip=skip, tags=tags, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -501,3 +508,252 @@ async def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" } + + async def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}/publish" + } 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 000000000000..a9ea030360ea --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_deployment_operations.py @@ -0,0 +1,750 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._endpoint_deployment_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_in_workspace_request, + build_get_request, + build_list_request, +) + +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", and "managedOnlineEndpoint". 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.get_in_workspace.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( + "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) + + get_in_workspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_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, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + 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], + **kwargs: Any + ) -> Optional[_models.EndpointDeploymentResourcePropertiesBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointDeploymentResourcePropertiesBasicResource]] = 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, + 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) + + _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]: + map_error(status_code=response.status_code, 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("EndpointDeploymentResourcePropertiesBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + 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, + *, + 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 + :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 + 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } 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 000000000000..fade020d8b20 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_operations.py @@ -0,0 +1,823 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._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, +) + +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, + skip: 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", and "managedOnlineEndpoint". 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO], + **kwargs: Any + ) -> Optional[_models.EndpointResourcePropertiesBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointResourcePropertiesBasicResource]] = 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, + 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) + + _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]: + map_error(status_code=response.status_code, 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("EndpointResourcePropertiesBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + 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, + *, + 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 + :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 + 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :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.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, + 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("EndpointKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys" + } + + @distributed_trace + def get_models( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AccountModel"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountModel or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.AccountModel] + :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 = { + 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, + template_url=self.get_models.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("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) + + get_models.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + *, + 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 + :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: 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.regenerate_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("AccountApiKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey" + } 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 031930c06fc8..91b683cf247f 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -34,6 +36,7 @@ build_delete_request, build_get_request, build_list_request, + build_publish_request, ) T = TypeVar("T") @@ -69,6 +72,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.EnvironmentVersion"]: """List versions. @@ -91,6 +95,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 + :param stage: Stage for including/excluding (for example) archived entities. Takes priority + over listViewType. Default value is None. + :type stage: str :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: @@ -123,6 +130,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -492,3 +500,252 @@ async def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" } + + async def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}/publish" + } 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 000000000000..713179b1c8e1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_features_operations.py @@ -0,0 +1,269 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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._features_operations import build_get_request, build_list_request + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Feature or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Feature + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features/{featureName}" + } 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 000000000000..da0306692f1d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_containers_operations.py @@ -0,0 +1,649 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._featureset_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturesetContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :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.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, + template_url=self.get_entity.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("FeaturesetContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO], + **kwargs: Any + ) -> _models.FeaturesetContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } 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 000000000000..b2ebbb208325 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_versions_operations.py @@ -0,0 +1,945 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._featureset_versions_operations import ( + build_backfill_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturesetVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO], + **kwargs: Any + ) -> _models.FeaturesetVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + async def _backfill_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO], + **kwargs: Any + ) -> Optional[_models.FeaturesetVersionBackfillResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.FeaturesetVersionBackfillResponse]] = 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, + template_url=self._backfill_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _backfill_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}/backfill" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backfill.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}/backfill" + } 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 000000000000..1a68f75af25d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_containers_operations.py @@ -0,0 +1,650 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._featurestore_entity_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturestoreEntityContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :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.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, + template_url=self.get_entity.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("FeaturestoreEntityContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO], + **kwargs: Any + ) -> _models.FeaturestoreEntityContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } 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 000000000000..65885ab1ab71 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_versions_operations.py @@ -0,0 +1,681 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._featurestore_entity_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturestoreEntityVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO], + **kwargs: Any + ) -> _models.FeaturestoreEntityVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } 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 000000000000..5362314bef4a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_endpoints_operations.py @@ -0,0 +1,832 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._inference_endpoints_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_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, + pool_name=pool_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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + pool_name=pool_name, + endpoint_name=endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferenceEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> Optional[_models.InferenceEndpoint]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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[Optional[_models.InferenceEndpoint]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceEndpoint", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + 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], + **kwargs: Any + ) -> _models.InferenceEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } 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 000000000000..710faa1e64b6 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_groups_operations.py @@ -0,0 +1,1123 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._inference_groups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_status_request, + build_list_request, + build_list_skus_request, + build_update_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, pool_name: str, group_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, + pool_name=pool_name, + group_name=group_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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + pool_name=pool_name, + group_name=group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferenceGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + **kwargs: Any + ) -> Optional[_models.InferenceGroup]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.InferenceGroup]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceGroup", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 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. + :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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + 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], + **kwargs: Any + ) -> _models.InferenceGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceGroup", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferenceGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GroupStatus + :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.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, + template_url=self.get_status.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("GroupStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/getStatus" + } + + @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 + :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] + :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 = { + 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, + template_url=self.list_skus.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("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) + + list_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/skus" + } 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 000000000000..d8c192f0e3c8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_pools_operations.py @@ -0,0 +1,1083 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._inference_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_status_request, + build_list_request, + build_list_skus_request, + build_update_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, inference_pool_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, + inference_pool_name=inference_pool_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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + inference_pool_name=inference_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferencePool or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferencePool + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> Optional[_models.InferencePool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.InferencePool]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferencePool", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO], + **kwargs: Any + ) -> _models.InferencePool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferencePool", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferencePool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @distributed_trace_async + async def get_status( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> _models.PoolStatus: + """Retrieve inference pool status. + + Retrieve inference pool 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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PoolStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.PoolStatus + :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.PoolStatus] = kwargs.pop("cls", None) + + request = build_get_status_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, + template_url=self.get_status.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("PoolStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}/getStatus" + } + + @distributed_trace + def list_skus( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SkuResource"]: + """List Inference Pool Skus. + + List Inference Pool 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 inference_pool_name: Inference Group name. Required. + :type inference_pool_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 + :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] + :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 = { + 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, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + 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) + + 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("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) + + list_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}/skus" + } 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 8196b0804d30..99af36608dfa 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 @@ -37,6 +37,7 @@ build_delete_request, build_get_request, build_list_request, + build_update_request, ) T = TypeVar("T") @@ -71,6 +72,10 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + properties: Optional[str] = None, + asset_name: Optional[str] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -91,6 +96,15 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param properties: Comma-separated list of property names (and optionally values). Example: + prop1,prop2=value2. Default value is None. + :type properties: str + :param asset_name: Asset name the job's named output is registered with. Default value is None. + :type asset_name: str + :param scheduled: Indicator whether the job is scheduled job. Default value is None. + :type scheduled: bool + :param schedule_id: The scheduled id for listing the job triggered from. Default value is None. + :type schedule_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: @@ -122,6 +136,10 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + properties=properties, + asset_name=asset_name, + scheduled=scheduled, + schedule_id=schedule_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -375,6 +393,165 @@ async def get(self, resource_group_name: str, workspace_name: str, id: str, **kw "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" } + @overload + async def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.PartialJobBasePartialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialJobBasePartialResource + :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: + """ + + @overload + async def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobBase or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.JobBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.PartialJobBasePartialResource, IO], + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Is either a + PartialJobBasePartialResource type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialJobBasePartialResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobBase or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.JobBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.JobBase] = 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, "PartialJobBasePartialResource") + + request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.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("JobBase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" + } + @overload async def create_or_update( self, @@ -387,8 +564,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. @@ -420,8 +599,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. @@ -446,8 +627,10 @@ async def create_or_update( self, resource_group_name: str, workspace_name: str, id: str, body: Union[_models.JobBase, IO], **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. diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py new file mode 100644 index 000000000000..32bb9cf7a148 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py @@ -0,0 +1,1027 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._labeling_jobs_operations import ( + build_create_or_update_request, + build_delete_request, + build_export_labels_request, + build_get_request, + build_list_request, + build_pause_request, + build_resume_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LabelingJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`labeling_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.LabelingJob"]: + """Lists labeling jobs in the workspace. + + Lists labeling jobs in the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param top: Number of labeling jobs to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabelingJob or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelingJobResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LabelingJobResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Delete a labeling job. + + Delete a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> _models.LabelingJob: + """Gets a labeling job by name/id. + + Gets a labeling job by name/id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJob or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + 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 = 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("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> _models.LabelingJob: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.LabelingJob] = 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, "LabelingJob") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.LabelingJob, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Is either a LabelingJob type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.LabelingJob] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJob", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + async def _export_labels_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> Optional[_models.ExportSummary]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ExportSummary]] = 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, "ExportSummary") + + request = build_export_labels_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_labels_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ExportSummary", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_labels_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @overload + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.ExportSummary, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Is either a ExportSummary type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ExportSummary] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_labels_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExportSummary", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_labels.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @distributed_trace_async + async def pause( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> _models.LabelingJobProperties: + """Pause a labeling job. + + Pause a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJobProperties or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties + :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.LabelingJobProperties] = kwargs.pop("cls", None) + + request = build_pause_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.pause.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("LabelingJobProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + pause.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause" + } + + async def _resume_initial( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> Optional[_models.LabelingJobProperties]: + 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[Optional[_models.LabelingJobProperties]] = kwargs.pop("cls", None) + + request = build_resume_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._resume_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("LabelingJobProperties", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _resume_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } + + @distributed_trace_async + async def begin_resume( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJobProperties]: + """Resume a labeling job (asynchronous). + + Resume a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJobProperties or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJobProperties] + :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.LabelingJobProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJobProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_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 000000000000..c925e1e999d2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_provisions_operations.py @@ -0,0 +1,299 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._managed_network_provisions_operations import build_provision_managed_network_request + +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]] = None, + **kwargs: Any + ) -> Optional[_models.ManagedNetworkProvisionStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ManagedNetworkProvisionStatus]] = 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, + template_url=self._provision_managed_network_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _provision_managed_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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] = 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 + :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 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]] = 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 type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_provision_managed_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork" + } 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 000000000000..46cfb3f2e11b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,609 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_network_settings_rule_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, rule_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, + rule_name=rule_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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + rule_name=rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRuleBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO], + **kwargs: Any + ) -> Optional[_models.OutboundRuleBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OutboundRuleBasicResource]] = 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, + 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) + + _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]: + map_error(status_code=response.status_code, 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("OutboundRuleBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OutboundRuleBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } 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 000000000000..52dcae58e0db --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_marketplace_subscriptions_operations.py @@ -0,0 +1,619 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._marketplace_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MarketplaceSubscription or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO], + **kwargs: Any + ) -> _models.MarketplaceSubscription: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{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 8d601cec0072..bcfcec05e46b 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -34,6 +36,8 @@ build_delete_request, build_get_request, build_list_request, + build_package_request, + build_publish_request, ) T = TypeVar("T") @@ -75,6 +79,7 @@ def list( properties: Optional[str] = None, feed: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ModelVersion"]: """List model versions. @@ -111,6 +116,8 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param stage: Model stage. Default value is None. + :type stage: str :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: @@ -149,6 +156,7 @@ def prepare_request(next_link=None): properties=properties, feed=feed, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -518,3 +526,516 @@ async def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" } + + async def _package_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> Optional[_models.PackageResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageResponse]] = 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, "PackageRequest") + + request = build_package_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, + template_url=self._package_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PackageResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/package" + } + + @overload + async def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.PackageRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest + :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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Is either a PackageRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :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.PackageResponse] = 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._package_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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PackageResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/package" + } + + async def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/publish" + } 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 3edc6c4bb6de..b04a2f715594 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 @@ -53,20 +53,22 @@ 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. + 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) + :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 = { 401: ClientAuthenticationError, @@ -107,7 +109,7 @@ def prepare_request(next_link=None): 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 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 7a7f0546597b..81f0b683eea2 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 @@ -63,12 +63,14 @@ 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 @@ -153,19 +155,86 @@ async def get_next(next_link=None): "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 + :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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + @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) @@ -228,23 +297,26 @@ 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 @@ -260,23 +332,26 @@ async def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + body: IO, *, 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -292,22 +367,25 @@ 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], **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 + :param body: PrivateEndpointConnection object. Is either a PrivateEndpointConnection type or a + IO type. Required. + :type body: ~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 @@ -334,10 +412,10 @@ 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( resource_group_name=resource_group_name, @@ -377,68 +455,3 @@ async def create_or_update( 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } 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 3e0bfcb8b50c..43f983dd2b56 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 @@ -6,8 +6,10 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,7 +21,7 @@ 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.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -50,22 +52,43 @@ 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: """ + _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) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -74,42 +97,63 @@ async def list( } 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 + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources" 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 07bb1a688545..432f1b8555a7 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 @@ -70,6 +70,7 @@ def list( order_by: Optional[str] = None, top: Optional[int] = None, skip: Optional[str] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ComponentVersion"]: """List versions. @@ -90,6 +91,8 @@ def list( :type top: int :param skip: Continuation token for pagination. Default value is None. :type skip: str + :param stage: Component stage. Default value is None. + :type stage: 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: @@ -121,6 +124,7 @@ def prepare_request(next_link=None): order_by=order_by, top=top, skip=skip, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, 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 000000000000..b978e6c999f3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_references_operations.py @@ -0,0 +1,224 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._registry_data_references_operations import build_get_blob_reference_sas_request + +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 value. + + Get blob reference SAS Uri value. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri value. + + Get blob reference SAS Uri value. + + :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 + :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: 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], + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri value. + + Get blob reference SAS Uri value. + + :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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.get_blob_reference_sas.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("GetBlobReferenceSASResponseDto", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_blob_reference_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/datareferences/{name}/versions/{version}" + } 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 10560e9f5fdb..9529caa41ef1 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 @@ -71,6 +71,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.EnvironmentVersion"]: """List versions. @@ -94,6 +95,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 + :param stage: Stage for including/excluding (for example) archived entities. Takes priority + over listViewType. Default value is None. + :type stage: str :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: @@ -126,6 +130,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, 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 512c6ba1df76..30b748212e41 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 @@ -37,6 +37,7 @@ build_delete_request, build_get_request, build_list_request, + build_package_request, ) T = TypeVar("T") @@ -682,6 +683,273 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" } + async def _package_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> Optional[_models.PackageResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageResponse]] = 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, "PackageRequest") + + request = build_package_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._package_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PackageResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/package" + } + + @overload + async def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: _models.PackageRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest + :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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Is either a PackageRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :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.PackageResponse] = 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._package_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PackageResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/package" + } + @overload async def create_or_get_start_pending_upload( self, 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 56e5acb58804..408464e68aad 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 @@ -36,6 +36,7 @@ build_delete_request, build_get_request, build_list_request, + build_trigger_request, ) T = TypeVar("T") @@ -609,3 +610,162 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" } + + @overload + async def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.TriggerOnceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Required. + :type body: ~azure.mgmt.machinelearningservices.models.TriggerOnceRequest + :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: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.TriggerOnceRequest, IO], + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Is either a TriggerOnceRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.TriggerOnceRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.TriggerRunSubmissionDto] = 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, "TriggerOnceRequest") + + request = build_trigger_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, + template_url=self.trigger.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("TriggerRunSubmissionDto", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}/trigger" + } 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 000000000000..fcf061f2df0c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_serverless_endpoints_operations.py @@ -0,0 +1,1270 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._serverless_endpoints_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_get_status_request, + build_list_keys_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerlessEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> Optional[_models.ServerlessEndpoint]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ServerlessEndpoint]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ServerlessEndpoint", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO], + **kwargs: Any + ) -> _models.ServerlessEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @distributed_trace_async + async def get_status( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.ServerlessEndpointStatus: + """Status of the model backing the Serverless Endpoint. + + Status of the model backing the 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerlessEndpointStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointStatus + :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.ServerlessEndpointStatus] = kwargs.pop("cls", None) + + request = build_get_status_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_status.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("ServerlessEndpointStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/getStatus" + } + + @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 + :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 = { + 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, + 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("EndpointAuthKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/listKeys" + } + + async def _regenerate_keys_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO], + **kwargs: Any + ) -> Optional[_models.EndpointAuthKeys]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointAuthKeys]] = 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, + template_url=self._regenerate_keys_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _regenerate_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/regenerateKeys" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + 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. + :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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/regenerateKeys" + } 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 1c796d31405b..1269685febf6 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -34,6 +36,9 @@ build_delete_request, build_get_request, build_list_request, + build_list_secrets_request, + build_test_connection_request, + build_update_request, ) T = TypeVar("T") @@ -59,28 +64,452 @@ 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 + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" + } + + @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 + :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, + 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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + aoai_models_to_deploy: Optional[str] = None, + **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 + :param aoai_models_to_deploy: query parameter for which AOAI mode should be deployed. Default + value is None. + :type aoai_models_to_deploy: 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 = { + 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, + aoai_models_to_deploy=aoai_models_to_deploy, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + } + + @overload + async 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 + :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 update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO] = 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 + :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 update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionUpdateParameter, IO]] = 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 type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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 + + 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, + template_url=self.update.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("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.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, - 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". @@ -97,22 +526,25 @@ async def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: IO, + body: Optional[IO] = 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -128,21 +560,23 @@ async def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO], + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO]] = 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: + :param body: The object for creating or updating a new workspace connection. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -170,10 +604,13 @@ 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, "WorkspaceConnectionPropertiesV2BasicResource") + else: + _json = None request = build_create_request( resource_group_name=resource_group_name, @@ -215,18 +652,28 @@ async def create( } @distributed_trace_async - async def get( - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + async def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + aoai_models_to_deploy: Optional[str] = None, + **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 + :param aoai_models_to_deploy: query parameter for which AOAI mode should be deployed. Default + value is None. + :type aoai_models_to_deploy: 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 @@ -246,13 +693,14 @@ async 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, + aoai_models_to_deploy=aoai_models_to_deploy, api_version=api_version, - template_url=self.get.metadata["url"], + template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) @@ -278,28 +726,18 @@ async def get( return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + async def _test_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO]] = None, + **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -308,19 +746,34 @@ async 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)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_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_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, + template_url=self._test_connection_initial.metadata["url"], headers=_headers, params=_params, ) @@ -334,121 +787,187 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + _test_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection" } - @distributed_trace - def list( + @overload + async 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 - ) -> AsyncIterable["_models.WorkspaceConnectionPropertiesV2BasicResource"]: - """list. + ) -> 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: 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 + :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 :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] + :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[_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 + async def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[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 + :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: + """ - 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_async + async def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. - 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) + Test machine learning workspaces connections under the specified workspace. - async 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 type. Default value is None. + :type body: + ~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 + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = await 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, 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( # type: ignore + 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) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - return AsyncItemPaged(get_next, extract_data) + 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 - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" + begin_test_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection" } 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 1195fbbbd75b..2e850026f1ce 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 @@ -71,20 +71,36 @@ 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 get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: - """Gets the properties of the specified machine learning workspace. + @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. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. Required. - :type workspace_name: str + 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 :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 + :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, @@ -93,50 +109,178 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any } 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, + 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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" + } + + @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 + :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.Workspace] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkspaceListResult] = 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) + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + 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, + 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) - 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) + 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 - deserialized = self._deserialize("Workspace", pipeline_response) + 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) - if cls: - return cls(pipeline_response, deserialized, {}) + async def get_next(next_link=None): + request = prepare_request(next_link) - return deserialized + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - get.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) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" } - async def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> Optional[_models.Workspace]: + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -145,30 +289,19 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) 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)) - 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") + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_create_or_update_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, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -182,117 +315,38 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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) - 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")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, response_headers) - return deserialized - - _create_or_update_initial.metadata = { + _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" } - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - workspace_name: str, - parameters: _models.Workspace, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Workspace]: - """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. - :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 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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - workspace_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Workspace]: - """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. - :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 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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + 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: 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 + :param force_to_purge: Flag to indicate delete is a purge request. Default value is False. + :type force_to_purge: bool :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -301,28 +355,24 @@ async def begin_create_or_update( :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: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :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 {}) + _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)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workspace] = kwargs.pop("cls", 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._create_or_update_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + force_to_purge=force_to_purge, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -330,14 +380,14 @@ async def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) 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: @@ -351,13 +401,26 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { + begin_delete.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: + @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: 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -370,14 +433,14 @@ 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[_models.Workspace] = kwargs.pop("cls", None) - request = build_delete_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._delete_initial.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -389,81 +452,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + 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 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 + deserialized = self._deserialize("Workspace", pipeline_response) - begin_delete.metadata = { + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" } @@ -471,7 +474,7 @@ async def _update_initial( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.Workspace]: error_map = { @@ -492,10 +495,10 @@ async def _update_initial( 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( resource_group_name=resource_group_name, @@ -542,20 +545,22 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: _models.WorkspaceUpdateParameters, + body: _models.WorkspaceUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_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 @@ -579,20 +584,22 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: IO, + body: IO, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -616,19 +623,21 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO], **kwargs: Any ) -> AsyncLROPoller[_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 + :param body: 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 + :type body: ~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 @@ -659,7 +668,7 @@ async def begin_update( 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, @@ -694,104 +703,243 @@ def get_long_running_output(pipeline_response): "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. + async def _create_or_update_initial( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO], **kwargs: Any + ) -> Optional[_models.Workspace]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "Workspace") + + 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) + + _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]: + map_error(status_code=response.status_code, 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("Workspace", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: _models.Workspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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 skip: Continuation token for pagination. Default value is None. - :type skip: 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 :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) + :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: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] + ~azure.core.polling.AsyncLROPoller[~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 {}) + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. - def prepare_request(next_link=None): - if not next_link: + Creates or updates a workspace with the specified parameters. - 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) + :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 + :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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :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_async + async def begin_create_or_update( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. - 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) + Creates or updates a workspace with the specified parameters. - async 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 body: The parameters for creating or updating a machine learning workspace. Is either a + Workspace type or a IO type. Required. + :type body: ~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. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~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 {}) - _stream = False - pipeline_response: PipelineResponse = await 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[_models.Workspace] = 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, + 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) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Workspace", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - return AsyncItemPaged(get_next, extract_data) + 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 - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" } 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]] = None, **kwargs: Any ) -> Optional[_models.DiagnoseResponseResult]: error_map = { @@ -812,11 +960,11 @@ async def _diagnose_initial( 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 @@ -870,7 +1018,7 @@ 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,10 +1030,10 @@ 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 @@ -909,7 +1057,7 @@ async def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[IO] = None, + body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any @@ -921,10 +1069,10 @@ 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -948,7 +1096,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]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.DiagnoseResponseResult]: """Diagnose workspace setup issue. @@ -958,11 +1106,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 + :param body: 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 + :type body: ~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 @@ -993,7 +1141,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, @@ -1037,10 +1185,13 @@ 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) @@ -1096,9 +1247,24 @@ async def list_keys( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys" } - async def _resync_keys_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace_async + async def list_notebook_access_token( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: + ) -> _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 + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1111,14 +1277,14 @@ async def _resync_keys_initial( # pylint: disable=inconsistent-return-statement _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"], + template_url=self.list_notebook_access_token.metadata["url"], headers=_headers, params=_params, ) @@ -1132,103 +1298,107 @@ async def _resync_keys_initial( # pylint: disable=inconsistent-return-statement 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) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _resync_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" + return deserialized + + list_notebook_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" } @distributed_trace_async - async def begin_resync_keys( + async def list_notebook_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. + ) -> _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 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] + :return: ListNotebookKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult :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) - 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) + 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, + template_url=self.list_notebook_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 + _stream = False + pipeline_response: PipelineResponse = await 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_notebook_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" } - @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. + @distributed_trace_async + async 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 + 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 :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] + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1237,81 +1407,65 @@ def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Asy } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListStorageAccountKeysResult] = 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 + 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) - 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - _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 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) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged(get_next, extract_data) + return deserialized - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" + list_storage_account_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys" } @distributed_trace_async - async def list_notebook_access_token( + async def list_outbound_network_dependencies_endpoints( 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 = { @@ -1326,14 +1480,14 @@ async 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"], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -1352,15 +1506,15 @@ 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("ExternalFQDNResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_notebook_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" + list_outbound_network_dependencies_endpoints.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" } async def _prepare_notebook_initial( @@ -1405,11 +1559,16 @@ async def _prepare_notebook_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("NotebookResourceInfo", 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, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1421,12 +1580,14 @@ async def _prepare_notebook_initial( async def begin_prepare_notebook( self, resource_group_name: str, workspace_name: str, **kwargs: Any ) -> AsyncLROPoller[_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. @@ -1489,87 +1650,9 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook" } - @distributed_trace_async - async 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 = 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("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_async - async def list_notebook_keys( + async def _resync_keys_initial( # pylint: disable=inconsistent-return-statements 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: - """ + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1582,14 +1665,14 @@ 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[None] = 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"], + template_url=self._resync_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1603,87 +1686,91 @@ async def list_notebook_keys( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = 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, {}) - - return deserialized + return cls(pipeline_response, None, response_headers) - list_notebook_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" + _resync_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" } @distributed_trace_async - async def list_outbound_network_dependencies_endpoints( + async def begin_resync_keys( 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[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 + :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: """ - 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 = 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("ExternalFQDNResponse", pipeline_response) + 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) - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - return deserialized + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_outbound_network_dependencies_endpoints.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" + begin_resync_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" } 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 339c533836e3..bfe2df8fb079 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,33 @@ # 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 AccountModel 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 @@ -33,6 +40,7 @@ from ._models_py3 import AssetJobOutput from ._models_py3 import AssetReferenceBase from ._models_py3 import AssignedUser +from ._models_py3 import AutoDeleteSetting from ._models_py3 import AutoForecastHorizon from ._models_py3 import AutoMLJob from ._models_py3 import AutoMLVertical @@ -42,28 +50,49 @@ from ._models_py3 import AutoSeasonality from ._models_py3 import AutoTargetLags from ._models_py3 import AutoTargetRollingWindowSize +from ._models_py3 import AutologgerSettings from ._models_py3 import AzureBlobDatastore from ._models_py3 import AzureDataLakeGen1Datastore from ._models_py3 import AzureDataLakeGen2Datastore +from ._models_py3 import AzureDatastore +from ._models_py3 import AzureDevOpsWebhook from ._models_py3 import AzureFileDatastore +from ._models_py3 import AzureMLBatchInferencingServer +from ._models_py3 import AzureMLOnlineInferencingServer +from ._models_py3 import AzureOpenAiFineTuning +from ._models_py3 import AzureOpenAiHyperParameters from ._models_py3 import BanditPolicy +from ._models_py3 import BaseEnvironmentId +from ._models_py3 import BaseEnvironmentSource 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 CallRateLimit +from ._models_py3 import CapacityConfig +from ._models_py3 import CapacityReservationGroup +from ._models_py3 import CapacityReservationGroupProperties +from ._models_py3 import CapacityReservationGroupTrackedResourceArmPaginatedResult +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 +from ._models_py3 import ClassificationModelPerformanceMetricThreshold from ._models_py3 import ClassificationTrainingSettings from ._models_py3 import ClusterUpdateParameters +from ._models_py3 import CocoExportSummary from ._models_py3 import CodeConfiguration from ._models_py3 import CodeContainer from ._models_py3 import CodeContainerProperties @@ -71,9 +100,13 @@ 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 +from ._models_py3 import ComponentConfiguration from ._models_py3 import ComponentContainer from ._models_py3 import ComponentContainerProperties from ._models_py3 import ComponentContainerResourceArmPaginatedResult @@ -83,6 +116,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,40 +128,62 @@ 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 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 CsvExportSummary from ._models_py3 import CustomForecastHorizon +from ._models_py3 import CustomInferencingServer +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 DataImport +from ._models_py3 import DataImportSource 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 +from ._models_py3 import DatabaseSource from ._models_py3 import Databricks from ._models_py3 import DatabricksComputeSecrets from ._models_py3 import DatabricksComputeSecretsProperties from ._models_py3 import DatabricksProperties from ._models_py3 import DatabricksSchema +from ._models_py3 import DatasetExportSummary from ._models_py3 import Datastore from ._models_py3 import DatastoreCredentials from ._models_py3 import DatastoreProperties @@ -136,7 +192,9 @@ from ._models_py3 import DefaultScaleSettings from ._models_py3 import DeploymentLogs from ._models_py3 import DeploymentLogsRequest +from ._models_py3 import DeploymentModel 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 +202,25 @@ 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 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 @@ -165,21 +234,60 @@ from ._models_py3 import ErrorResponse from ._models_py3 import EstimatedVMPrice from ._models_py3 import EstimatedVMPrices +from ._models_py3 import ExportSummary from ._models_py3 import ExternalFQDNResponse from ._models_py3 import FQDNEndpoint from ._models_py3 import FQDNEndpointDetail 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 FileSystemSource +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 GenerationSafetyQualityMetricThreshold +from ._models_py3 import GenerationSafetyQualityMonitoringSignal +from ._models_py3 import GenerationTokenUsageMetricThreshold +from ._models_py3 import GenerationTokenUsageSignal +from ._models_py3 import GetBlobReferenceForConsumptionDto +from ._models_py3 import GetBlobReferenceSASRequestDto +from ._models_py3 import GetBlobReferenceSASResponseDto from ._models_py3 import GridSamplingAlgorithm +from ._models_py3 import GroupStatus from ._models_py3 import HDInsight from ._models_py3 import HDInsightProperties from ._models_py3 import HDInsightSchema +from ._models_py3 import HdfsDatastore from ._models_py3 import IdAssetReference from ._models_py3 import IdentityConfiguration from ._models_py3 import IdentityForCmk @@ -201,9 +309,22 @@ from ._models_py3 import ImageObjectDetectionBase from ._models_py3 import ImageSweepSettings from ._models_py3 import ImageVertical +from ._models_py3 import ImportDataAction +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 InferencingServer from ._models_py3 import InstanceTypeSchema from ._models_py3 import InstanceTypeSchemaResources +from ._models_py3 import IntellectualProperty from ._models_py3 import JobBase from ._models_py3 import JobBaseProperties from ._models_py3 import JobBaseResourceArmPaginatedResult @@ -213,10 +334,28 @@ from ._models_py3 import JobResourceConfiguration from ._models_py3 import JobScheduleAction from ._models_py3 import JobService +from ._models_py3 import JupyterKernelConfig +from ._models_py3 import KerberosCredentials +from ._models_py3 import KerberosKeytabCredentials +from ._models_py3 import KerberosKeytabSecrets +from ._models_py3 import KerberosPasswordCredentials +from ._models_py3 import KerberosPasswordSecrets +from ._models_py3 import 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 LabelCategory +from ._models_py3 import LabelClass +from ._models_py3 import LabelingDataConfiguration +from ._models_py3 import LabelingJob +from ._models_py3 import LabelingJobImageProperties +from ._models_py3 import LabelingJobInstructions +from ._models_py3 import LabelingJobMediaProperties +from ._models_py3 import LabelingJobProperties +from ._models_py3 import LabelingJobResourceArmPaginatedResult +from ._models_py3 import LabelingJobTextProperties +from ._models_py3 import LakeHouseArtifact from ._models_py3 import ListAmlUserFeatureResult from ._models_py3 import ListNotebookKeysResult from ._models_py3 import ListStorageAccountKeysResult @@ -224,24 +363,65 @@ from ._models_py3 import ListWorkspaceKeysResult from ._models_py3 import ListWorkspaceQuotas from ._models_py3 import LiteralJobInput +from ._models_py3 import MLAssistConfiguration +from ._models_py3 import MLAssistConfigurationDisabled +from ._models_py3 import MLAssistConfigurationEnabled from ._models_py3 import MLFlowModelJobInput from ._models_py3 import MLFlowModelJobOutput from ._models_py3 import MLTableData 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 ModelConfiguration from ._models_py3 import ModelContainer from ._models_py3 import ModelContainerProperties from ._models_py3 import ModelContainerResourceArmPaginatedResult +from ._models_py3 import ModelDeprecationInfo +from ._models_py3 import ModelPackageInput +from ._models_py3 import ModelPerformanceMetricThresholdBase +from ._models_py3 import ModelPerformanceSignal +from ._models_py3 import ModelSettings +from ._models_py3 import ModelSku 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 MonitoringDataSegment +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 MonitoringWorkspaceConnection from ._models_py3 import Mpi from ._models_py3 import NCrossValidations +from ._models_py3 import NlpFixedParameters +from ._models_py3 import NlpParameterSubspace +from ._models_py3 import NlpSweepSettings from ._models_py3 import NlpVertical from ._models_py3 import NlpVerticalFeaturizationSettings from ._models_py3 import NlpVerticalLimitSettings @@ -252,24 +432,51 @@ 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 from ._models_py3 import OnlineEndpoint from ._models_py3 import OnlineEndpointProperties from ._models_py3 import OnlineEndpointTrackedResourceArmPaginatedResult +from ._models_py3 import OnlineInferenceConfiguration 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 PackageInputPathBase +from ._models_py3 import PackageInputPathId +from ._models_py3 import PackageInputPathUrl +from ._models_py3 import PackageInputPathVersion +from ._models_py3 import PackageRequest +from ._models_py3 import PackageResponse from ._models_py3 import PaginatedComputeResourcesList from ._models_py3 import PartialBatchDeployment from ._models_py3 import PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties +from ._models_py3 import PartialJobBase +from ._models_py3 import PartialJobBasePartialResource from ._models_py3 import PartialManagedServiceIdentity from ._models_py3 import PartialMinimalTrackedResource from ._models_py3 import PartialMinimalTrackedResourceWithIdentity from ._models_py3 import PartialMinimalTrackedResourceWithSku +from ._models_py3 import PartialMinimalTrackedResourceWithSkuAndIdentity +from ._models_py3 import PartialNotificationSetting from ._models_py3 import PartialRegistryPartialTrackedResource from ._models_py3 import PartialSku from ._models_py3 import Password @@ -278,22 +485,35 @@ from ._models_py3 import PendingUploadResponseDto from ._models_py3 import PersonalComputeInstanceSettings from ._models_py3 import PipelineJob +from ._models_py3 import PoolEnvironmentConfiguration +from ._models_py3 import PoolModelConfiguration +from ._models_py3 import PoolStatus +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 ProgressMetrics +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 RandomSamplingAlgorithm +from ._models_py3 import Ray 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 @@ -302,15 +522,22 @@ from ._models_py3 import RegistryRegionArmDetails from ._models_py3 import RegistryTrackedResourceArmPaginatedResult from ._models_py3 import Regression +from ._models_py3 import RegressionModelPerformanceMetricThreshold from ._models_py3 import RegressionTrainingSettings +from ._models_py3 import RequestConfiguration +from ._models_py3 import RequestLogging +from ._models_py3 import RequestMatchPattern +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 @@ -325,9 +552,21 @@ from ._models_py3 import ScriptReference from ._models_py3 import ScriptsToExecute from ._models_py3 import Seasonality +from ._models_py3 import SecretConfiguration +from ._models_py3 import ServerlessComputeSettings +from ._models_py3 import ServerlessEndpoint +from ._models_py3 import ServerlessEndpointCapacityReservation +from ._models_py3 import ServerlessEndpointProperties +from ._models_py3 import ServerlessEndpointStatus +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,8 +574,17 @@ 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 StatusMessage from ._models_py3 import StorageAccountDetails from ._models_py3 import SweepJob from ._models_py3 import SweepJobLimits @@ -346,6 +594,9 @@ from ._models_py3 import SystemCreatedStorageAccount from ._models_py3 import SystemData from ._models_py3 import SystemService +from ._models_py3 import TableFixedParameters +from ._models_py3 import TableParameterSubspace +from ._models_py3 import TableSweepSettings from ._models_py3 import TableVertical from ._models_py3 import TableVerticalFeaturizationSettings from ._models_py3 import TableVerticalLimitSettings @@ -356,11 +607,16 @@ from ._models_py3 import TextClassification from ._models_py3 import TextClassificationMultilabel from ._models_py3 import TextNer +from ._models_py3 import ThrottlingRule 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 from ._models_py3 import TriggerBase +from ._models_py3 import TriggerOnceRequest +from ._models_py3 import TriggerRunSubmissionDto +from ._models_py3 import TritonInferencingServer from ._models_py3 import TritonModelJobInput from ._models_py3 import TritonModelJobOutput from ._models_py3 import TruncationSelectionPolicy @@ -391,27 +647,44 @@ 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 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 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 AutoDeleteCondition 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 BaseEnvironmentSourceType +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 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 ClassificationModelPerformanceMetric 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,78 +692,143 @@ 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 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 DataImportSourceType +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 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 ExportFormatType +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 ForecastHorizonMode from ._machine_learning_services_mgmt_client_enums import ForecastingModels from ._machine_learning_services_mgmt_client_enums import ForecastingPrimaryMetrics +from ._machine_learning_services_mgmt_client_enums import GenerationSafetyQualityMetric +from ._machine_learning_services_mgmt_client_enums import GenerationTokenUsageMetric from ._machine_learning_services_mgmt_client_enums import Goal from ._machine_learning_services_mgmt_client_enums import IdentityConfigurationType +from ._machine_learning_services_mgmt_client_enums import ImageAnnotationType from ._machine_learning_services_mgmt_client_enums import ImageType +from ._machine_learning_services_mgmt_client_enums import IncrementalDataRefresh +from ._machine_learning_services_mgmt_client_enums import InferencingServerType from ._machine_learning_services_mgmt_client_enums import InputDeliveryMode +from ._machine_learning_services_mgmt_client_enums import InputPathType 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 JobProvisioningState 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 LogTrainingMetrics +from ._machine_learning_services_mgmt_client_enums import LogValidationLoss from ._machine_learning_services_mgmt_client_enums import LogVerbosity +from ._machine_learning_services_mgmt_client_enums import MLAssistConfigurationType +from ._machine_learning_services_mgmt_client_enums import MLFlowAutologgerState +from ._machine_learning_services_mgmt_client_enums import ManagedNetworkStatus 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 MediaType +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 MonitoringModelType +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 MultiSelect from ._machine_learning_services_mgmt_client_enums import NCrossValidationsMode from ._machine_learning_services_mgmt_client_enums import Network +from ._machine_learning_services_mgmt_client_enums import NlpLearningRateScheduler from ._machine_learning_services_mgmt_client_enums import NodeState from ._machine_learning_services_mgmt_client_enums import NodesValueType +from ._machine_learning_services_mgmt_client_enums import 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 PackageBuildState +from ._machine_learning_services_mgmt_client_enums import PackageInputDeliveryMode +from ._machine_learning_services_mgmt_client_enums import PackageInputType +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 ProtectionLevel 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 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 RegressionModelPerformanceMetric 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 @@ -498,23 +836,31 @@ from ._machine_learning_services_mgmt_client_enums import ScheduleProvisioningState from ._machine_learning_services_mgmt_client_enums import ScheduleProvisioningStatus from ._machine_learning_services_mgmt_client_enums import ScheduleStatus +from ._machine_learning_services_mgmt_client_enums import ScheduleType 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 StatusMessageLevel from ._machine_learning_services_mgmt_client_enums import StochasticOptimizer from ._machine_learning_services_mgmt_client_enums import StorageAccountType from ._machine_learning_services_mgmt_client_enums import TargetAggregationFunction from ._machine_learning_services_mgmt_client_enums import TargetLagsMode from ._machine_learning_services_mgmt_client_enums import TargetRollingWindowSizeMode from ._machine_learning_services_mgmt_client_enums import TaskType +from ._machine_learning_services_mgmt_client_enums import TextAnnotationType +from ._machine_learning_services_mgmt_client_enums import TrainingMode from ._machine_learning_services_mgmt_client_enums import TriggerType from ._machine_learning_services_mgmt_client_enums import UnderlyingResourceAction from ._machine_learning_services_mgmt_client_enums import UnitOfMeasure @@ -523,35 +869,42 @@ 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", + "AccountModel", "AcrDetails", + "ActualCapacityInfo", "AksComputeSecrets", "AksComputeSecretsProperties", "AksNetworkingConfiguration", + "AllFeatures", "AllNodes", "AmlCompute", "AmlComputeNodeInformation", "AmlComputeNodesInformation", "AmlComputeProperties", "AmlComputeSchema", - "AmlOperation", - "AmlOperationDisplay", - "AmlOperationListResult", "AmlToken", + "AmlTokenComputeIdentity", "AmlUserFeature", + "AnonymousAccessCredential", + "ApiKeyAuthWorkspaceConnectionProperties", "ArmResourceId", "AssetBase", "AssetContainer", @@ -559,6 +912,7 @@ "AssetJobOutput", "AssetReferenceBase", "AssignedUser", + "AutoDeleteSetting", "AutoForecastHorizon", "AutoMLJob", "AutoMLVertical", @@ -568,28 +922,49 @@ "AutoSeasonality", "AutoTargetLags", "AutoTargetRollingWindowSize", + "AutologgerSettings", "AzureBlobDatastore", "AzureDataLakeGen1Datastore", "AzureDataLakeGen2Datastore", + "AzureDatastore", + "AzureDevOpsWebhook", "AzureFileDatastore", + "AzureMLBatchInferencingServer", + "AzureMLOnlineInferencingServer", + "AzureOpenAiFineTuning", + "AzureOpenAiHyperParameters", "BanditPolicy", + "BaseEnvironmentId", + "BaseEnvironmentSource", "BatchDeployment", + "BatchDeploymentConfiguration", "BatchDeploymentProperties", "BatchDeploymentTrackedResourceArmPaginatedResult", "BatchEndpoint", "BatchEndpointDefaults", "BatchEndpointProperties", "BatchEndpointTrackedResourceArmPaginatedResult", + "BatchPipelineComponentDeploymentConfiguration", "BatchRetrySettings", "BayesianSamplingAlgorithm", "BindOptions", "BlobReferenceForConsumptionDto", "BuildContext", + "CallRateLimit", + "CapacityConfig", + "CapacityReservationGroup", + "CapacityReservationGroupProperties", + "CapacityReservationGroupTrackedResourceArmPaginatedResult", + "CategoricalDataDriftMetricThreshold", + "CategoricalDataQualityMetricThreshold", + "CategoricalPredictionDriftMetricThreshold", "CertificateDatastoreCredentials", "CertificateDatastoreSecrets", "Classification", + "ClassificationModelPerformanceMetricThreshold", "ClassificationTrainingSettings", "ClusterUpdateParameters", + "CocoExportSummary", "CodeConfiguration", "CodeContainer", "CodeContainerProperties", @@ -597,9 +972,13 @@ "CodeVersion", "CodeVersionProperties", "CodeVersionResourceArmPaginatedResult", + "CognitiveServiceEndpointDeploymentResourceProperties", + "CognitiveServicesSku", + "Collection", "ColumnTransformer", "CommandJob", "CommandJobLimits", + "ComponentConfiguration", "ComponentContainer", "ComponentContainerProperties", "ComponentContainerResourceArmPaginatedResult", @@ -609,6 +988,7 @@ "Compute", "ComputeInstance", "ComputeInstanceApplication", + "ComputeInstanceAutologgerSettings", "ComputeInstanceConnectivityEndpoints", "ComputeInstanceContainer", "ComputeInstanceCreatedBy", @@ -620,40 +1000,62 @@ "ComputeInstanceSchema", "ComputeInstanceSshSettings", "ComputeInstanceVersion", + "ComputeRecurrenceSchedule", "ComputeResource", "ComputeResourceSchema", + "ComputeRuntimeDto", "ComputeSchedules", "ComputeSecrets", "ComputeStartStopSchedule", "ContainerResourceRequirements", "ContainerResourceSettings", + "ContentSafetyEndpointDeploymentResourceProperties", + "ContentSafetyEndpointResourceProperties", "CosmosDbSettings", + "CreateMonitorAction", "Cron", "CronTrigger", + "CsvExportSummary", "CustomForecastHorizon", + "CustomInferencingServer", + "CustomKeys", + "CustomKeysWorkspaceConnectionProperties", + "CustomMetricThreshold", + "CustomModelFineTuning", "CustomModelJobInput", "CustomModelJobOutput", + "CustomMonitoringSignal", "CustomNCrossValidations", "CustomSeasonality", "CustomService", "CustomTargetLags", "CustomTargetRollingWindowSize", + "DataCollector", "DataContainer", "DataContainerProperties", "DataContainerResourceArmPaginatedResult", + "DataDriftMetricThresholdBase", + "DataDriftMonitoringSignal", "DataFactory", + "DataImport", + "DataImportSource", "DataLakeAnalytics", "DataLakeAnalyticsSchema", "DataLakeAnalyticsSchemaProperties", "DataPathAssetReference", + "DataQualityMetricThresholdBase", + "DataQualityMonitoringSignal", + "DataReferenceCredential", "DataVersionBase", "DataVersionBaseProperties", "DataVersionBaseResourceArmPaginatedResult", + "DatabaseSource", "Databricks", "DatabricksComputeSecrets", "DatabricksComputeSecretsProperties", "DatabricksProperties", "DatabricksSchema", + "DatasetExportSummary", "Datastore", "DatastoreCredentials", "DatastoreProperties", @@ -662,7 +1064,9 @@ "DefaultScaleSettings", "DeploymentLogs", "DeploymentLogsRequest", + "DeploymentModel", "DeploymentResourceConfiguration", + "DestinationAsset", "DiagnoseRequestProperties", "DiagnoseResponseResult", "DiagnoseResponseResultValue", @@ -670,14 +1074,25 @@ "DiagnoseWorkspaceParameters", "DistributionConfiguration", "Docker", + "DockerCredential", "EarlyTerminationPolicy", - "EncryptionKeyVaultProperties", + "EncryptionKeyVaultUpdateProperties", "EncryptionProperty", + "EncryptionUpdateProperties", "Endpoint", "EndpointAuthKeys", "EndpointAuthToken", + "EndpointDeploymentModel", "EndpointDeploymentPropertiesBase", + "EndpointDeploymentResourceProperties", + "EndpointDeploymentResourcePropertiesBasicResource", + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", + "EndpointKeys", + "EndpointModels", "EndpointPropertiesBase", + "EndpointResourceProperties", + "EndpointResourcePropertiesBasicResource", + "EndpointResourcePropertiesBasicResourceArmPaginatedResult", "EndpointScheduleAction", "EnvironmentContainer", "EnvironmentContainerProperties", @@ -691,21 +1106,60 @@ "ErrorResponse", "EstimatedVMPrice", "EstimatedVMPrices", + "ExportSummary", "ExternalFQDNResponse", "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", + "FileSystemSource", + "FineTuningJob", + "FineTuningVertical", + "FixedInputData", "FlavorData", "ForecastHorizon", "Forecasting", "ForecastingSettings", "ForecastingTrainingSettings", + "FqdnOutboundRule", + "GenerationSafetyQualityMetricThreshold", + "GenerationSafetyQualityMonitoringSignal", + "GenerationTokenUsageMetricThreshold", + "GenerationTokenUsageSignal", + "GetBlobReferenceForConsumptionDto", + "GetBlobReferenceSASRequestDto", + "GetBlobReferenceSASResponseDto", "GridSamplingAlgorithm", + "GroupStatus", "HDInsight", "HDInsightProperties", "HDInsightSchema", + "HdfsDatastore", "IdAssetReference", "IdentityConfiguration", "IdentityForCmk", @@ -727,9 +1181,22 @@ "ImageObjectDetectionBase", "ImageSweepSettings", "ImageVertical", + "ImportDataAction", + "IndexColumn", "InferenceContainerProperties", + "InferenceEndpoint", + "InferenceEndpointProperties", + "InferenceEndpointTrackedResourceArmPaginatedResult", + "InferenceGroup", + "InferenceGroupProperties", + "InferenceGroupTrackedResourceArmPaginatedResult", + "InferencePool", + "InferencePoolProperties", + "InferencePoolTrackedResourceArmPaginatedResult", + "InferencingServer", "InstanceTypeSchema", "InstanceTypeSchemaResources", + "IntellectualProperty", "JobBase", "JobBaseProperties", "JobBaseResourceArmPaginatedResult", @@ -739,10 +1206,28 @@ "JobResourceConfiguration", "JobScheduleAction", "JobService", + "JupyterKernelConfig", + "KerberosCredentials", + "KerberosKeytabCredentials", + "KerberosKeytabSecrets", + "KerberosPasswordCredentials", + "KerberosPasswordSecrets", + "KeyVaultProperties", "Kubernetes", "KubernetesOnlineDeployment", "KubernetesProperties", "KubernetesSchema", + "LabelCategory", + "LabelClass", + "LabelingDataConfiguration", + "LabelingJob", + "LabelingJobImageProperties", + "LabelingJobInstructions", + "LabelingJobMediaProperties", + "LabelingJobProperties", + "LabelingJobResourceArmPaginatedResult", + "LabelingJobTextProperties", + "LakeHouseArtifact", "ListAmlUserFeatureResult", "ListNotebookKeysResult", "ListStorageAccountKeysResult", @@ -750,24 +1235,65 @@ "ListWorkspaceKeysResult", "ListWorkspaceQuotas", "LiteralJobInput", + "MLAssistConfiguration", + "MLAssistConfigurationDisabled", + "MLAssistConfigurationEnabled", "MLFlowModelJobInput", "MLFlowModelJobOutput", "MLTableData", "MLTableJobInput", "MLTableJobOutput", + "ManagedComputeIdentity", "ManagedIdentity", "ManagedIdentityAuthTypeWorkspaceConnectionProperties", + "ManagedIdentityCredential", + "ManagedNetworkProvisionOptions", + "ManagedNetworkProvisionStatus", + "ManagedNetworkSettings", "ManagedOnlineDeployment", + "ManagedOnlineEndpointDeploymentResourceProperties", + "ManagedOnlineEndpointResourceProperties", + "ManagedResourceGroupAssignedIdentities", + "ManagedResourceGroupSettings", "ManagedServiceIdentity", + "MarketplacePlan", + "MarketplaceSubscription", + "MarketplaceSubscriptionProperties", + "MarketplaceSubscriptionResourceArmPaginatedResult", + "MaterializationComputeResource", + "MaterializationSettings", "MedianStoppingPolicy", + "ModelConfiguration", "ModelContainer", "ModelContainerProperties", "ModelContainerResourceArmPaginatedResult", + "ModelDeprecationInfo", + "ModelPackageInput", + "ModelPerformanceMetricThresholdBase", + "ModelPerformanceSignal", + "ModelSettings", + "ModelSku", "ModelVersion", "ModelVersionProperties", "ModelVersionResourceArmPaginatedResult", + "MonitorComputeConfigurationBase", + "MonitorComputeIdentityBase", + "MonitorDefinition", + "MonitorEmailNotificationSettings", + "MonitorNotificationSettings", + "MonitorServerlessSparkCompute", + "MonitoringDataSegment", + "MonitoringFeatureFilterBase", + "MonitoringInputDataBase", + "MonitoringSignalBase", + "MonitoringTarget", + "MonitoringThreshold", + "MonitoringWorkspaceConnection", "Mpi", "NCrossValidations", + "NlpFixedParameters", + "NlpParameterSubspace", + "NlpSweepSettings", "NlpVertical", "NlpVerticalFeaturizationSettings", "NlpVerticalLimitSettings", @@ -778,24 +1304,51 @@ "NotebookAccessTokenResult", "NotebookPreparationError", "NotebookResourceInfo", + "NotificationSetting", + "NumericalDataDriftMetricThreshold", + "NumericalDataQualityMetricThreshold", + "NumericalPredictionDriftMetricThreshold", + "OAuth2AuthTypeWorkspaceConnectionProperties", "Objective", + "OneLakeArtifact", + "OneLakeDatastore", "OnlineDeployment", "OnlineDeploymentProperties", "OnlineDeploymentTrackedResourceArmPaginatedResult", "OnlineEndpoint", "OnlineEndpointProperties", "OnlineEndpointTrackedResourceArmPaginatedResult", + "OnlineInferenceConfiguration", "OnlineRequestSettings", "OnlineScaleSettings", + "OpenAIEndpointDeploymentResourceProperties", + "OpenAIEndpointResourceProperties", + "Operation", + "OperationDisplay", + "OperationListResult", + "OsPatchingStatus", + "OutboundRule", + "OutboundRuleBasicResource", + "OutboundRuleListResult", "OutputPathAssetReference", "PATAuthTypeWorkspaceConnectionProperties", + "PackageInputPathBase", + "PackageInputPathId", + "PackageInputPathUrl", + "PackageInputPathVersion", + "PackageRequest", + "PackageResponse", "PaginatedComputeResourcesList", "PartialBatchDeployment", "PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties", + "PartialJobBase", + "PartialJobBasePartialResource", "PartialManagedServiceIdentity", "PartialMinimalTrackedResource", "PartialMinimalTrackedResourceWithIdentity", "PartialMinimalTrackedResourceWithSku", + "PartialMinimalTrackedResourceWithSkuAndIdentity", + "PartialNotificationSetting", "PartialRegistryPartialTrackedResource", "PartialSku", "Password", @@ -804,22 +1357,35 @@ "PendingUploadResponseDto", "PersonalComputeInstanceSettings", "PipelineJob", + "PoolEnvironmentConfiguration", + "PoolModelConfiguration", + "PoolStatus", + "PredictionDriftMetricThresholdBase", + "PredictionDriftMonitoringSignal", "PrivateEndpoint", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", + "PrivateEndpointDestination", + "PrivateEndpointOutboundRule", "PrivateEndpointResource", "PrivateLinkResource", "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", "ProbeSettings", + "ProgressMetrics", + "PropertiesBase", + "ProxyResource", "PyTorch", + "QueueSettings", "QuotaBaseProperties", "QuotaUpdateParameters", "RandomSamplingAlgorithm", + "Ray", "Recurrence", "RecurrenceSchedule", "RecurrenceTrigger", "RegenerateEndpointKeysRequest", + "RegenerateServiceAccountKeyContent", "Registry", "RegistryListCredentialsResult", "RegistryPartialManagedServiceIdentity", @@ -828,15 +1394,22 @@ "RegistryRegionArmDetails", "RegistryTrackedResourceArmPaginatedResult", "Regression", + "RegressionModelPerformanceMetricThreshold", "RegressionTrainingSettings", + "RequestConfiguration", + "RequestLogging", + "RequestMatchPattern", + "ResizeSchema", "Resource", "ResourceBase", "ResourceConfiguration", "ResourceId", "ResourceName", "ResourceQuota", + "RollingInputData", "Route", "SASAuthTypeWorkspaceConnectionProperties", + "SASCredential", "SASCredentialDto", "SamplingAlgorithm", "SasDatastoreCredentials", @@ -851,9 +1424,21 @@ "ScriptReference", "ScriptsToExecute", "Seasonality", + "SecretConfiguration", + "ServerlessComputeSettings", + "ServerlessEndpoint", + "ServerlessEndpointCapacityReservation", + "ServerlessEndpointProperties", + "ServerlessEndpointStatus", + "ServerlessEndpointTrackedResourceArmPaginatedResult", + "ServerlessInferenceEndpoint", + "ServerlessOffer", "ServiceManagedResourcesSettings", + "ServicePrincipalAuthTypeWorkspaceConnectionProperties", "ServicePrincipalDatastoreCredentials", "ServicePrincipalDatastoreSecrets", + "ServiceTagDestination", + "ServiceTagOutboundRule", "SetupScripts", "SharedPrivateLinkResource", "Sku", @@ -861,8 +1446,17 @@ "SkuResource", "SkuResourceArmPaginatedResult", "SkuSetting", + "SparkJob", + "SparkJobEntry", + "SparkJobPythonEntry", + "SparkJobScalaEntry", + "SparkResourceConfiguration", + "SpeechEndpointDeploymentResourceProperties", + "SpeechEndpointResourceProperties", "SslConfiguration", "StackEnsembleSettings", + "StaticInputData", + "StatusMessage", "StorageAccountDetails", "SweepJob", "SweepJobLimits", @@ -872,6 +1466,9 @@ "SystemCreatedStorageAccount", "SystemData", "SystemService", + "TableFixedParameters", + "TableParameterSubspace", + "TableSweepSettings", "TableVertical", "TableVerticalFeaturizationSettings", "TableVerticalLimitSettings", @@ -882,11 +1479,16 @@ "TextClassification", "TextClassificationMultilabel", "TextNer", + "ThrottlingRule", "TmpfsOptions", + "TopNFeaturesByAttribution", "TrackedResource", "TrainingSettings", "TrialComponent", "TriggerBase", + "TriggerOnceRequest", + "TriggerRunSubmissionDto", + "TritonInferencingServer", "TritonModelJobInput", "TritonModelJobOutput", "TruncationSelectionPolicy", @@ -917,26 +1519,43 @@ "VirtualMachineSshCredentials", "VolumeDefinition", "VolumeOptions", + "Webhook", "Workspace", + "WorkspaceConnectionAccessKey", + "WorkspaceConnectionApiKey", "WorkspaceConnectionManagedIdentity", + "WorkspaceConnectionOAuth2", "WorkspaceConnectionPersonalAccessToken", "WorkspaceConnectionPropertiesV2", "WorkspaceConnectionPropertiesV2BasicResource", "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", + "WorkspaceConnectionServicePrincipal", "WorkspaceConnectionSharedAccessSignature", + "WorkspaceConnectionUpdateParameter", "WorkspaceConnectionUsernamePassword", + "WorkspaceHubConfig", "WorkspaceListResult", + "WorkspacePrivateEndpointResource", "WorkspaceUpdateParameters", + "ActionType", "AllocationState", "ApplicationSharingPolicy", "AssetProvisioningState", + "AuthMode", + "AutoDeleteCondition", "AutoRebuildSetting", "Autosave", + "BaseEnvironmentSourceType", + "BatchDeploymentConfigurationType", "BatchLoggingLevel", "BatchOutputAction", "BillingCurrency", "BlockedTransformers", "Caching", + "CategoricalDataDriftMetric", + "CategoricalDataQualityMetric", + "CategoricalPredictionDriftMetric", + "ClassificationModelPerformanceMetric", "ClassificationModels", "ClassificationMultilabelPrimaryMetrics", "ClassificationPrimaryMetrics", @@ -944,78 +1563,143 @@ "ComputeInstanceAuthorizationType", "ComputeInstanceState", "ComputePowerAction", + "ComputeRecurrenceFrequency", + "ComputeTriggerType", "ComputeType", + "ComputeWeekDay", "ConnectionAuthType", "ConnectionCategory", + "ConnectionGroup", "ContainerType", "CreatedByType", "CredentialsType", + "DataAvailabilityStatus", + "DataCollectionMode", + "DataImportSourceType", + "DataReferenceCredentialType", "DataType", "DatastoreType", + "DefaultResourceProvisioningState", + "DeploymentModelVersionUpgradeOption", "DeploymentProvisioningState", "DiagnoseResultLevel", "DistributionType", "EarlyTerminationPolicyType", "EgressPublicNetworkAccessType", + "EmailNotificationEnableType", "EncryptionStatus", "EndpointAuthMode", "EndpointComputeType", "EndpointProvisioningState", "EndpointServiceConnectionStatus", + "EndpointType", "EnvironmentType", "EnvironmentVariableType", + "ExportFormatType", + "FeatureAttributionMetric", + "FeatureDataType", + "FeatureImportanceMode", "FeatureLags", "FeaturizationMode", + "FineTuningTaskType", "ForecastHorizonMode", "ForecastingModels", "ForecastingPrimaryMetrics", + "GenerationSafetyQualityMetric", + "GenerationTokenUsageMetric", "Goal", "IdentityConfigurationType", + "ImageAnnotationType", "ImageType", + "IncrementalDataRefresh", + "InferencingServerType", "InputDeliveryMode", + "InputPathType", "InstanceSegmentationPrimaryMetrics", + "IsolationMode", "JobInputType", "JobLimitsType", "JobOutputType", + "JobProvisioningState", "JobStatus", + "JobTier", "JobType", "KeyType", "LearningRateScheduler", "ListViewType", "LoadBalancerType", + "LogTrainingMetrics", + "LogValidationLoss", "LogVerbosity", + "MLAssistConfigurationType", + "MLFlowAutologgerState", + "ManagedNetworkStatus", "ManagedServiceIdentityType", + "MarketplaceSubscriptionProvisioningState", + "MarketplaceSubscriptionStatus", + "MaterializationStoreType", + "MediaType", + "MlflowAutologger", + "ModelLifecycleStatus", + "ModelProvider", "ModelSize", + "ModelTaskType", + "MonitorComputeIdentityType", + "MonitorComputeType", + "MonitoringFeatureDataType", + "MonitoringFeatureFilterType", + "MonitoringInputDataType", + "MonitoringModelType", + "MonitoringNotificationType", + "MonitoringSignalType", "MountAction", + "MountMode", "MountState", + "MultiSelect", "NCrossValidationsMode", "Network", + "NlpLearningRateScheduler", "NodeState", "NodesValueType", + "NumericalDataDriftMetric", + "NumericalDataQualityMetric", + "NumericalPredictionDriftMetric", "ObjectDetectionPrimaryMetrics", + "OneLakeArtifactType", "OperatingSystemType", "OperationName", "OperationStatus", "OperationTrigger", "OrderString", + "Origin", "OsType", "OutputDeliveryMode", + "PackageBuildState", + "PackageInputDeliveryMode", + "PackageInputType", + "PatchStatus", "PendingUploadCredentialType", "PendingUploadType", + "PoolProvisioningState", "PrivateEndpointConnectionProvisioningState", - "PrivateEndpointServiceConnectionStatus", + "ProtectionLevel", "Protocol", "ProvisioningState", "ProvisioningStatus", - "PublicNetworkAccess", "PublicNetworkAccessType", "QuotaUnit", "RandomSamplingAlgorithmRule", "RecurrenceFrequency", "ReferenceType", + "RegressionModelPerformanceMetric", "RegressionModels", "RegressionPrimaryMetrics", "RemoteLoginPortPublicAccess", + "RollingRateType", + "RuleAction", + "RuleCategory", + "RuleStatus", + "RuleType", "SamplingAlgorithmType", "ScaleType", "ScheduleActionType", @@ -1023,23 +1707,31 @@ "ScheduleProvisioningState", "ScheduleProvisioningStatus", "ScheduleStatus", + "ScheduleType", "SeasonalityMode", "SecretsType", + "ServerlessEndpointState", + "ServerlessInferenceEndpointAuthMode", + "ServiceAccountKeyName", "ServiceDataAccessAuthIdentity", "ShortSeriesHandlingConfiguration", "SkuScaleType", "SkuTier", "SourceType", + "SparkJobEntryType", "SshPublicAccess", "SslConfigStatus", "StackMetaLearnerType", "Status", + "StatusMessageLevel", "StochasticOptimizer", "StorageAccountType", "TargetAggregationFunction", "TargetLagsMode", "TargetRollingWindowSizeMode", "TaskType", + "TextAnnotationType", + "TrainingMode", "TriggerType", "UnderlyingResourceAction", "UnitOfMeasure", @@ -1048,9 +1740,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 a32b5b391440..5b2457888bea 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 @@ -43,6 +49,19 @@ class AssetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class AuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine endpoint authentication mode.""" + + AAD = "AAD" + + +class AutoDeleteCondition(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutoDeleteCondition.""" + + CREATED_GREATER_THAN = "CreatedGreaterThan" + LAST_ACCESSED_GREATER_THAN = "LastAccessedGreaterThan" + + class AutoRebuildSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutoRebuild setting for the derived image.""" @@ -58,6 +77,19 @@ class Autosave(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOTE = "Remote" +class BaseEnvironmentSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Base environment type.""" + + ENVIRONMENT_ASSET = "EnvironmentAsset" + + +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. @@ -119,6 +151,50 @@ class Caching(str, Enum, metaclass=CaseInsensitiveEnumMeta): READ_WRITE = "ReadWrite" +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 ClassificationModelPerformanceMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ClassificationModelPerformanceMetric.""" + + ACCURACY = "Accuracy" + """Calculates the accuracy of the model predictions.""" + PRECISION = "Precision" + """Calculates the precision of the model predictions.""" + RECALL = "Recall" + """Calculates the recall of the model predictions.""" + + class ClassificationModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum for all classification models supported by AutoML.""" @@ -166,7 +242,7 @@ class ClassificationModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: 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”\ + #: 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.""" @@ -247,6 +323,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 +337,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 +380,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 +407,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,13 +422,123 @@ 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" + 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" + 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" + + +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): - """ContainerType.""" + """The type of container to retrieve logs from.""" STORAGE_INITIALIZER = "StorageInitializer" + """The container used to download models and score script.""" INFERENCE_SERVER = "InferenceServer" + """The container used to serve user's request.""" + MODEL_DATA_COLLECTOR = "ModelDataCollector" + """The container used to collect payload and custom logging when mdc is enabled.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -323,6 +558,40 @@ class CredentialsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" SAS = "Sas" SERVICE_PRINCIPAL = "ServicePrincipal" + KERBEROS_KEYTAB = "KerberosKeytab" + KERBEROS_PASSWORD = "KerberosPassword" + + +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 DataImportSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the type of data.""" + + DATABASE = "database" + FILE_SYSTEM = "file_system" + + +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): @@ -332,6 +601,8 @@ class DatastoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_DATA_LAKE_GEN1 = "AzureDataLakeGen1" AZURE_DATA_LAKE_GEN2 = "AzureDataLakeGen2" AZURE_FILE = "AzureFile" + HDFS = "Hdfs" + ONE_LAKE = "OneLake" class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -342,6 +613,26 @@ class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MLTABLE = "mltable" +class DefaultResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DefaultResourceProvisioningState.""" + + NOT_STARTED = "NotStarted" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + CANCELED = "Canceled" + + +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.""" @@ -368,6 +659,7 @@ class DistributionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PY_TORCH = "PyTorch" TENSOR_FLOW = "TensorFlow" MPI = "Mpi" + RAY = "Ray" class EarlyTerminationPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -387,6 +679,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 +728,17 @@ 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" class EnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -443,6 +754,43 @@ class EnvironmentVariableType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LOCAL = "local" +class ExportFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The format of exported labels.""" + + DATASET = "Dataset" + COCO = "Coco" + CSV = "CSV" + + +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 +811,22 @@ 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 ForecastHorizonMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine forecast horizon selection mode.""" @@ -537,7 +901,7 @@ class ForecastingModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: 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” + #: 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.""" @@ -567,6 +931,28 @@ class ForecastingPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Error (MAE) of (time) series with different scales.""" +class GenerationSafetyQualityMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Generation safety quality metric enum.""" + + ACCEPTABLE_GROUNDEDNESS_SCORE_PER_INSTANCE = "AcceptableGroundednessScorePerInstance" + AGGREGATED_GROUNDEDNESS_PASS_RATE = "AggregatedGroundednessPassRate" + ACCEPTABLE_COHERENCE_SCORE_PER_INSTANCE = "AcceptableCoherenceScorePerInstance" + AGGREGATED_COHERENCE_PASS_RATE = "AggregatedCoherencePassRate" + ACCEPTABLE_FLUENCY_SCORE_PER_INSTANCE = "AcceptableFluencyScorePerInstance" + AGGREGATED_FLUENCY_PASS_RATE = "AggregatedFluencyPassRate" + ACCEPTABLE_SIMILARITY_SCORE_PER_INSTANCE = "AcceptableSimilarityScorePerInstance" + AGGREGATED_SIMILARITY_PASS_RATE = "AggregatedSimilarityPassRate" + ACCEPTABLE_RELEVANCE_SCORE_PER_INSTANCE = "AcceptableRelevanceScorePerInstance" + AGGREGATED_RELEVANCE_PASS_RATE = "AggregatedRelevancePassRate" + + +class GenerationTokenUsageMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Generation token statistics metric enum.""" + + TOTAL_TOKEN_COUNT = "TotalTokenCount" + TOTAL_TOKEN_COUNT_PER_GROUP = "TotalTokenCountPerGroup" + + class Goal(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines supported metric goals for hyperparameter tuning.""" @@ -582,15 +968,39 @@ class IdentityConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_IDENTITY = "UserIdentity" +class ImageAnnotationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Annotation type of image data.""" + + CLASSIFICATION = "Classification" + BOUNDING_BOX = "BoundingBox" + INSTANCE_SEGMENTATION = "InstanceSegmentation" + + class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the image. Possible values are: docker - For docker images. azureml - For AzureML - images. + Environment images (custom and curated). """ DOCKER = "docker" AZUREML = "azureml" +class IncrementalDataRefresh(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether IncrementalDataRefresh is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class InferencingServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Inferencing server type for various targets.""" + + AZURE_ML_ONLINE = "AzureMLOnline" + AZURE_ML_BATCH = "AzureMLBatch" + TRITON = "Triton" + CUSTOM = "Custom" + + class InputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine the input data delivery mode.""" @@ -602,6 +1012,14 @@ class InputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): EVAL_DOWNLOAD = "EvalDownload" +class InputPathType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Input path type for package inputs.""" + + URL = "Url" + PATH_ID = "PathId" + PATH_VERSION = "PathVersion" + + class InstanceSegmentationPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Primary metrics for InstanceSegmentation tasks.""" @@ -610,6 +1028,14 @@ class InstanceSegmentationPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnu #: 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): """Enum to determine the Job Input Type.""" @@ -640,6 +1066,15 @@ class JobOutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRITON_MODEL = "triton_model" +class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the job provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + + class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of a job.""" @@ -676,6 +1111,18 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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""" + SCHEDULED = "Scheduled" + """The job is in a scheduled state. Job is not in any active state.""" + + +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): @@ -683,8 +1130,11 @@ class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO_ML = "AutoML" COMMAND = "Command" + LABELING = "Labeling" SWEEP = "Sweep" PIPELINE = "Pipeline" + SPARK = "Spark" + FINE_TUNING = "FineTuning" class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -720,6 +1170,24 @@ class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL_LOAD_BALANCER = "InternalLoadBalancer" +class LogTrainingMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogTrainingMetrics.""" + + ENABLE = "Enable" + """Enable compute and log training metrics.""" + DISABLE = "Disable" + """Disable compute and log training metrics.""" + + +class LogValidationLoss(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogValidationLoss.""" + + ENABLE = "Enable" + """Enable compute and log validation metrics.""" + DISABLE = "Disable" + """Disable compute and log validation metrics.""" + + class LogVerbosity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum for setting log verbosity.""" @@ -737,6 +1205,13 @@ 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 ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -748,6 +1223,92 @@ 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.""" + + PENDING_FULFILLMENT_START = "PendingFulfillmentStart" + """The Marketplace Subscription is being fulfilled.""" + 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 MediaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Media type of data asset.""" + + IMAGE = "Image" + TEXT = "Text" + + +class MLAssistConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MLAssistConfigurationType.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class MlflowAutologger(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether mlflow autologger is enabled for notebooks.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class MLFlowAutologgerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the state of mlflow autologger.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class 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 +1324,104 @@ class ModelSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Extra large size.""" +class ModelTaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Model task type enum.""" + + CLASSIFICATION = "Classification" + REGRESSION = "Regression" + QUESTION_ANSWERING = "QuestionAnswering" + + +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 MonitoringModelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringModelType.""" + + CLASSIFICATION = "Classification" + """A model trained for classification tasks.""" + REGRESSION = "Regression" + """A model trained for regressions tasks.""" + + +class MonitoringNotificationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringNotificationType.""" + + AML_NOTIFICATION = "AmlNotification" + """Enables email notifications through AML notifications.""" + AZURE_MONITOR = "AzureMonitor" + """Enables notifications through Azure Monitor by posting metrics to the workspace's Azure Monitor + #: instance.""" + + +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.""" + MODEL_PERFORMANCE = "ModelPerformance" + """Tracks model performance based on ground truth data.""" + GENERATION_SAFETY_QUALITY = "GenerationSafetyQuality" + """Tracks the safety and quality of generated content.""" + GENERATION_TOKEN_STATISTICS = "GenerationTokenStatistics" + """Tracks the token usage of generative endpoints.""" + + class MountAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Mount Action.""" @@ -770,6 +1429,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.""" @@ -781,6 +1447,13 @@ class MountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNMOUNTED = "Unmounted" +class MultiSelect(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether multiSelect is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class NCrossValidationsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines how N-Cross validations value is determined.""" @@ -798,6 +1471,25 @@ class Network(str, Enum, metaclass=CaseInsensitiveEnumMeta): HOST = "Host" +class NlpLearningRateScheduler(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of learning rate schedulers that aligns with those supported by HF.""" + + NONE = "None" + """No learning rate schedule.""" + LINEAR = "Linear" + """Linear warmup and decay.""" + COSINE = "Cosine" + """Linear warmup then cosine decay.""" + COSINE_WITH_RESTARTS = "CosineWithRestarts" + """Linear warmup, cosine decay, then restart to initial LR.""" + POLYNOMIAL = "Polynomial" + """Increase linearly then polynomially decay.""" + CONSTANT = "Constant" + """Constant learning rate.""" + CONSTANT_WITH_WARMUP = "ConstantWithWarmup" + """Linear warmup followed by constant value.""" + + class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted. @@ -815,6 +1507,44 @@ class NodesValueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The enumerated types for the nodes value.""" ALL = "All" + CUSTOM = "Custom" + + +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): @@ -825,6 +1555,12 @@ class ObjectDetectionPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta #: 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): """The type of operating system.""" @@ -839,6 +1575,7 @@ class OperationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): START = "Start" STOP = "Stop" RESTART = "Restart" + RESIZE = "Resize" REIMAGE = "Reimage" DELETE = "Delete" @@ -852,6 +1589,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 +1611,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 +1633,40 @@ class OutputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): READ_WRITE_MOUNT = "ReadWriteMount" UPLOAD = "Upload" + DIRECT = "Direct" + + +class PackageBuildState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Package build state returned in package response.""" + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class PackageInputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mounting type of the model or the inputs.""" + + COPY = "Copy" + DOWNLOAD = "Download" + + +class PackageInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the inputs.""" + + URI_FILE = "UriFile" + URI_FOLDER = "UriFolder" + + +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,6 +1682,17 @@ class PendingUploadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): TEMPORARY_BLOB_REFERENCE = "TemporaryBlobReference" +class PoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of pool related resources provisioning.""" + + CREATING = "Creating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + CANCELED = "Canceled" + + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state.""" @@ -909,14 +1702,13 @@ class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsens FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private endpoint connection status.""" +class ProtectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protection level associated with the Intellectual Property.""" - PENDING = "Pending" - APPROVED = "Approved" - REJECTED = "Rejected" - DISCONNECTED = "Disconnected" - TIMEOUT = "Timeout" + ALL = "All" + """All means Intellectual Property is fully protected.""" + NONE = "None" + """None means it is not an Intellectual Property.""" class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -928,8 +1720,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 +1741,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.""" @@ -999,6 +1784,17 @@ class ReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OUTPUT_PATH = "OutputPath" +class RegressionModelPerformanceMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RegressionModelPerformanceMetric.""" + + MEAN_ABSOLUTE_ERROR = "MeanAbsoluteError" + """The Mean Absolute Error (MAE) metric.""" + ROOT_MEAN_SQUARED_ERROR = "RootMeanSquaredError" + """The Root Mean Squared Error (RMSE) metric.""" + MEAN_SQUARED_ERROR = "MeanSquaredError" + """The Mean Squared Error (MSE) metric.""" + + class RegressionModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum for all Regression models supported by AutoML.""" @@ -1029,7 +1825,7 @@ class RegressionModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: 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”\ + #: 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.""" @@ -1073,6 +1869,46 @@ 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" + + +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 +1929,8 @@ class ScheduleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CREATE_JOB = "CreateJob" INVOKE_BATCH_ENDPOINT = "InvokeBatchEndpoint" + IMPORT_DATA = "ImportData" + CREATE_MONITOR = "CreateMonitor" class ScheduleListViewType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1129,6 +1967,17 @@ class ScheduleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class ScheduleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ScheduleType.""" + + COMPUTE_START_STOP = "ComputeStartStop" + CREATE_JOB = "CreateJob" + INVOKE_BATCH_ENDPOINT = "InvokeBatchEndpoint" + IMPORT_DATA = "ImportData" + CREATE_MONITOR = "CreateMonitor" + FEATURE_STORE_MATERIALIZATION = "FeatureStoreMaterialization" + + class SeasonalityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Forecasting seasonality mode.""" @@ -1145,6 +1994,36 @@ class SecretsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CERTIFICATE = "Certificate" SAS = "Sas" SERVICE_PRINCIPAL = "ServicePrincipal" + KERBEROS_PASSWORD = "KerberosPassword" + KERBEROS_KEYTAB = "KerberosKeytab" + + +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" + AAD = "AAD" + + +class ServiceAccountKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ServiceAccountKeyName.""" + + KEY1 = "Key1" + KEY2 = "Key2" class ServiceDataAccessAuthIdentity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1202,6 +2081,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 @@ -1256,6 +2142,14 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): OPERATION_NOT_ENABLED_FOR_REGION = "OperationNotEnabledForRegion" +class StatusMessageLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """StatusMessageLevel.""" + + ERROR = "Error" + INFORMATION = "Information" + WARNING = "Warning" + + class StochasticOptimizer(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Stochastic optimizer for image models.""" @@ -1349,6 +2243,24 @@ class TaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: occurrences of entities such as people, locations, organizations, and more.""" +class TextAnnotationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Annotation type of text data.""" + + CLASSIFICATION = "Classification" + NAMED_ENTITY_RECOGNITION = "NamedEntityRecognition" + + +class TrainingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Training mode dictates whether to use distributed training or not.""" + + AUTO = "Auto" + """Auto mode""" + DISTRIBUTED = "Distributed" + """Distributed training mode""" + NON_DISTRIBUTED = "NonDistributed" + """Non distributed training mode""" + + class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TriggerType.""" @@ -1397,12 +2309,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 +2340,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 736189ee6853..5c11bdd09b97 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py @@ -24,17 +24,555 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class WorkspaceConnectionPropertiesV2(_serialization.Model): + """WorkspaceConnectionPropertiesV2. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + 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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + """ + + _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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + } + + _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, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + self.category = category + self.created_by_workspace_arm_id = None + self.expiry_time = expiry_time + self.group = None + self.is_shared_to_all = is_shared_to_all + self.metadata = metadata + self.shared_user_list = shared_user_list + self.target = target + + +class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + """ + + _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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "AAD" + + +class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionAccessKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **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): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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 = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "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": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionSharedAccessSignature"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + credentials: Optional["_models.WorkspaceConnectionSharedAccessSignature"] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "AccountKey" + self.credentials = credentials + + class DatastoreCredentials(_serialization.Model): """Base definition for datastore credentials. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccountKeyDatastoreCredentials, CertificateDatastoreCredentials, NoneDatastoreCredentials, - SasDatastoreCredentials, ServicePrincipalDatastoreCredentials + AccountKeyDatastoreCredentials, CertificateDatastoreCredentials, KerberosKeytabCredentials, + KerberosPasswordCredentials, NoneDatastoreCredentials, SasDatastoreCredentials, + ServicePrincipalDatastoreCredentials All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ @@ -50,6 +588,8 @@ class DatastoreCredentials(_serialization.Model): "credentials_type": { "AccountKey": "AccountKeyDatastoreCredentials", "Certificate": "CertificateDatastoreCredentials", + "KerberosKeytab": "KerberosKeytabCredentials", + "KerberosPassword": "KerberosPasswordCredentials", "None": "NoneDatastoreCredentials", "Sas": "SasDatastoreCredentials", "ServicePrincipal": "ServicePrincipalDatastoreCredentials", @@ -68,7 +608,8 @@ class AccountKeyDatastoreCredentials(DatastoreCredentials): All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType :ivar secrets: [Required] Storage account secrets. Required. :vartype secrets: ~azure.mgmt.machinelearningservices.models.AccountKeyDatastoreSecrets @@ -98,13 +639,14 @@ class DatastoreSecrets(_serialization.Model): """Base definition for datastore secrets. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccountKeyDatastoreSecrets, CertificateDatastoreSecrets, SasDatastoreSecrets, - ServicePrincipalDatastoreSecrets + AccountKeyDatastoreSecrets, CertificateDatastoreSecrets, KerberosKeytabSecrets, + KerberosPasswordSecrets, SasDatastoreSecrets, ServicePrincipalDatastoreSecrets All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType """ @@ -120,6 +662,8 @@ class DatastoreSecrets(_serialization.Model): "secrets_type": { "AccountKey": "AccountKeyDatastoreSecrets", "Certificate": "CertificateDatastoreSecrets", + "KerberosKeytab": "KerberosKeytabSecrets", + "KerberosPassword": "KerberosPasswordSecrets", "Sas": "SasDatastoreSecrets", "ServicePrincipal": "ServicePrincipalDatastoreSecrets", } @@ -137,7 +681,8 @@ class AccountKeyDatastoreSecrets(DatastoreSecrets): All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType :ivar key: Storage account key. :vartype key: str @@ -162,54 +707,276 @@ def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: self.key = key -class AcrDetails(_serialization.Model): - """Details of ACR account to be used for the Registry. +class DeploymentModel(_serialization.Model): + """Properties of Cognitive Services account deployment model. - :ivar system_created_acr_account: Details of system created ACR account to be used for the - Registry. - :vartype system_created_acr_account: - ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount - :ivar user_created_acr_account: Details of user created ACR account to be used for the - Registry. - :vartype user_created_acr_account: - ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format: Deployment model format. + :vartype format: str + :ivar name: Deployment model name. + :vartype name: str + :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 + :ivar source: Optional. Deployment model source ARM resource ID. + :vartype source: str + :ivar call_rate_limit: The call rate limit Cognitive Services account. + :vartype call_rate_limit: ~azure.mgmt.machinelearningservices.models.CallRateLimit """ + _validation = { + "call_rate_limit": {"readonly": True}, + } + _attribute_map = { - "system_created_acr_account": {"key": "systemCreatedAcrAccount", "type": "SystemCreatedAcrAccount"}, - "user_created_acr_account": {"key": "userCreatedAcrAccount", "type": "UserCreatedAcrAccount"}, + "format": {"key": "format", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "call_rate_limit": {"key": "callRateLimit", "type": "CallRateLimit"}, } def __init__( self, *, - system_created_acr_account: Optional["_models.SystemCreatedAcrAccount"] = None, - user_created_acr_account: Optional["_models.UserCreatedAcrAccount"] = None, + format: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + source: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword system_created_acr_account: Details of system created ACR account to be used for the - Registry. - :paramtype system_created_acr_account: - ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount - :keyword user_created_acr_account: Details of user created ACR account to be used for the - Registry. - :paramtype user_created_acr_account: - ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + :keyword format: Deployment model format. + :paramtype format: str + :keyword name: Deployment model name. + :paramtype name: str + :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 + :keyword source: Optional. Deployment model source ARM resource ID. + :paramtype source: str """ super().__init__(**kwargs) - self.system_created_acr_account = system_created_acr_account - self.user_created_acr_account = user_created_acr_account + self.format = format + self.name = name + self.version = version + self.source = source + self.call_rate_limit = None -class AKSSchema(_serialization.Model): - """AKSSchema. +class AccountModel(DeploymentModel): # pylint: disable=too-many-instance-attributes + """Cognitive Services account Model. - :ivar properties: AKS properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.AKSSchemaProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format: Deployment model format. + :vartype format: str + :ivar name: Deployment model name. + :vartype name: str + :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 + :ivar source: Optional. Deployment model source ARM resource ID. + :vartype source: str + :ivar call_rate_limit: The call rate limit Cognitive Services account. + :vartype call_rate_limit: ~azure.mgmt.machinelearningservices.models.CallRateLimit + :ivar base_model: Base Model Identifier. + :vartype base_model: ~azure.mgmt.machinelearningservices.models.DeploymentModel + :ivar is_default_version: If the model is default version. + :vartype is_default_version: bool + :ivar skus: The list of Model Sku. + :vartype skus: list[~azure.mgmt.machinelearningservices.models.ModelSku] + :ivar max_capacity: The max capacity. + :vartype max_capacity: int + :ivar capabilities: The capabilities. + :vartype capabilities: dict[str, str] + :ivar finetune_capabilities: The capabilities for finetune models. + :vartype finetune_capabilities: dict[str, str] + :ivar deprecation: Cognitive Services account ModelDeprecationInfo. + :vartype deprecation: ~azure.mgmt.machinelearningservices.models.ModelDeprecationInfo + :ivar lifecycle_status: Model lifecycle status. Known values are: "GenerallyAvailable" and + "Preview". + :vartype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData """ - _attribute_map = { + _validation = { + "call_rate_limit": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "format": {"key": "format", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "call_rate_limit": {"key": "callRateLimit", "type": "CallRateLimit"}, + "base_model": {"key": "baseModel", "type": "DeploymentModel"}, + "is_default_version": {"key": "isDefaultVersion", "type": "bool"}, + "skus": {"key": "skus", "type": "[ModelSku]"}, + "max_capacity": {"key": "maxCapacity", "type": "int"}, + "capabilities": {"key": "capabilities", "type": "{str}"}, + "finetune_capabilities": {"key": "finetuneCapabilities", "type": "{str}"}, + "deprecation": {"key": "deprecation", "type": "ModelDeprecationInfo"}, + "lifecycle_status": {"key": "lifecycleStatus", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__( + self, + *, + format: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + source: Optional[str] = None, + base_model: Optional["_models.DeploymentModel"] = None, + is_default_version: Optional[bool] = None, + skus: Optional[List["_models.ModelSku"]] = None, + max_capacity: Optional[int] = None, + capabilities: Optional[Dict[str, str]] = None, + finetune_capabilities: Optional[Dict[str, str]] = None, + deprecation: Optional["_models.ModelDeprecationInfo"] = None, + lifecycle_status: Optional[Union[str, "_models.ModelLifecycleStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword format: Deployment model format. + :paramtype format: str + :keyword name: Deployment model name. + :paramtype name: str + :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 + :keyword source: Optional. Deployment model source ARM resource ID. + :paramtype source: str + :keyword base_model: Base Model Identifier. + :paramtype base_model: ~azure.mgmt.machinelearningservices.models.DeploymentModel + :keyword is_default_version: If the model is default version. + :paramtype is_default_version: bool + :keyword skus: The list of Model Sku. + :paramtype skus: list[~azure.mgmt.machinelearningservices.models.ModelSku] + :keyword max_capacity: The max capacity. + :paramtype max_capacity: int + :keyword capabilities: The capabilities. + :paramtype capabilities: dict[str, str] + :keyword finetune_capabilities: The capabilities for finetune models. + :paramtype finetune_capabilities: dict[str, str] + :keyword deprecation: Cognitive Services account ModelDeprecationInfo. + :paramtype deprecation: ~azure.mgmt.machinelearningservices.models.ModelDeprecationInfo + :keyword lifecycle_status: Model lifecycle status. Known values are: "GenerallyAvailable" and + "Preview". + :paramtype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + """ + super().__init__(format=format, name=name, version=version, source=source, **kwargs) + self.base_model = base_model + self.is_default_version = is_default_version + self.skus = skus + self.max_capacity = max_capacity + self.capabilities = capabilities + self.finetune_capabilities = finetune_capabilities + self.deprecation = deprecation + self.lifecycle_status = lifecycle_status + self.system_data = None + + +class AcrDetails(_serialization.Model): + """Details of ACR account to be used for the Registry. + + :ivar system_created_acr_account: Details of system created ACR account to be used for the + Registry. + :vartype system_created_acr_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount + :ivar user_created_acr_account: Details of user created ACR account to be used for the + Registry. + :vartype user_created_acr_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + """ + + _attribute_map = { + "system_created_acr_account": {"key": "systemCreatedAcrAccount", "type": "SystemCreatedAcrAccount"}, + "user_created_acr_account": {"key": "userCreatedAcrAccount", "type": "UserCreatedAcrAccount"}, + } + + def __init__( + self, + *, + system_created_acr_account: Optional["_models.SystemCreatedAcrAccount"] = None, + user_created_acr_account: Optional["_models.UserCreatedAcrAccount"] = None, + **kwargs: Any + ) -> None: + """ + :keyword system_created_acr_account: Details of system created ACR account to be used for the + Registry. + :paramtype system_created_acr_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount + :keyword user_created_acr_account: Details of user created ACR account to be used for the + Registry. + :paramtype user_created_acr_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + """ + super().__init__(**kwargs) + self.system_created_acr_account = system_created_acr_account + self.user_created_acr_account = user_created_acr_account + + +class 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. + + :ivar properties: AKS properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.AKSSchemaProperties + """ + + _attribute_map = { "properties": {"key": "properties", "type": "AKSSchemaProperties"}, } @@ -728,6 +1495,69 @@ def __init__( self.load_balancer_subnet = load_balancer_subnet +class MonitoringFeatureFilterBase(_serialization.Model): + """MonitoringFeatureFilterBase. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AllFeatures, FeatureSubset, TopNFeaturesByAttribution + + All required parameters must be populated in order to send to Azure. + + :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 = { + "filter_type": {"required": True}, + } + + _attribute_map = { + "filter_type": {"key": "filterType", "type": "str"}, + } + + _subtype_map = { + "filter_type": { + "AllFeatures": "AllFeatures", + "FeatureSubset": "FeatureSubset", + "TopNByAttribution": "TopNFeaturesByAttribution", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.filter_type: Optional[str] = None + + +class AllFeatures(MonitoringFeatureFilterBase): + """AllFeatures. + + All required parameters must be populated in order to send to Azure. + + :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 = { + "filter_type": {"required": True}, + } + + _attribute_map = { + "filter_type": {"key": "filterType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.filter_type: str = "AllFeatures" + + class Nodes(_serialization.Model): """Abstract Nodes definition. @@ -736,7 +1566,8 @@ class Nodes(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. Known values are: "All" + and "Custom". :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType """ @@ -761,7 +1592,8 @@ class AllNodes(Nodes): All required parameters must be populated in order to send to Azure. - :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. Known values are: "All" + and "Custom". :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType """ @@ -1147,112 +1979,6 @@ 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. @@ -1310,6 +2036,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 Azure. + + :ivar compute_identity_type: [Required] Monitor compute identity type enum. 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 Azure. + + :ivar compute_identity_type: [Required] Monitor compute identity type enum. 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,30 +2132,238 @@ def __init__( self.description = description -class ArmResourceId(_serialization.Model): - """ARM ResourceId of a resource. +class DataReferenceCredential(_serialization.Model): + """DataReferenceCredential base class. - :ivar resource_id: Arm ResourceId is in the format - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" - or - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". - :vartype resource_id: str + 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 Azure. + + :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 = { - "resource_id": {"key": "resourceId", "type": "str"}, + "credential_type": {"key": "credentialType", "type": "str"}, } - 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}" - or - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id + _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 Azure. + + :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): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionApiKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: Api key object for workspace connection credential. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **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}" + or + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Arm ResourceId is in the format + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" + or + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id class ResourceBase(_serialization.Model): @@ -1423,9 +2414,13 @@ class AssetBase(ResourceBase): :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). + :ivar auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :vartype is_archived: bool """ @@ -1433,6 +2428,7 @@ class AssetBase(ResourceBase): "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, } @@ -1443,6 +2439,7 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, is_anonymous: bool = False, is_archived: bool = False, **kwargs: Any @@ -1454,12 +2451,17 @@ def __init__( :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). + :keyword auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :paramtype is_archived: bool """ super().__init__(description=description, properties=properties, tags=tags, **kwargs) + self.auto_delete_setting = auto_delete_setting self.is_anonymous = is_anonymous self.is_archived = is_archived @@ -1530,6 +2532,8 @@ class AssetJobInput(_serialization.Model): :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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: [Required] Input Asset URI. Required. :vartype uri: str """ @@ -1540,53 +2544,92 @@ class AssetJobInput(_serialization.Model): _attribute_map = { "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } def __init__( - self, *, uri: str, mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, **kwargs: Any + self, + *, + uri: str, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = None, + **kwargs: Any ) -> None: """ :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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: [Required] Input Asset URI. Required. :paramtype uri: str """ super().__init__(**kwargs) self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri class AssetJobOutput(_serialization.Model): """Asset output type. - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: Output Asset URI. :vartype uri: str """ _attribute_map = { + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } def __init__( self, *, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: Output Asset URI. :paramtype uri: str """ super().__init__(**kwargs) + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -1658,6 +2701,40 @@ def __init__(self, *, object_id: str, tenant_id: str, **kwargs: Any) -> None: self.tenant_id = tenant_id +class AutoDeleteSetting(_serialization.Model): + """AutoDeleteSetting. + + :ivar condition: When to check if an asset is expired. Known values are: "CreatedGreaterThan" + and "LastAccessedGreaterThan". + :vartype condition: str or ~azure.mgmt.machinelearningservices.models.AutoDeleteCondition + :ivar value: Expiration condition value. + :vartype value: str + """ + + _attribute_map = { + "condition": {"key": "condition", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + condition: Optional[Union[str, "_models.AutoDeleteCondition"]] = None, + value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword condition: When to check if an asset is expired. Known values are: + "CreatedGreaterThan" and "LastAccessedGreaterThan". + :paramtype condition: str or ~azure.mgmt.machinelearningservices.models.AutoDeleteCondition + :keyword value: Expiration condition value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.condition = condition + self.value = value + + class ForecastHorizon(_serialization.Model): """The desired maximum forecast horizon in units of time-series frequency. @@ -1711,11 +2788,41 @@ def __init__(self, **kwargs: Any) -> None: self.mode: str = "Auto" +class AutologgerSettings(_serialization.Model): + """Settings for Autologger. + + All required parameters must be populated in order to send to Azure. + + :ivar mlflow_autologger: [Required] Indicates whether mlflow autologger is enabled. Required. + Known values are: "Enabled" and "Disabled". + :vartype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MLFlowAutologgerState + """ + + _validation = { + "mlflow_autologger": {"required": True}, + } + + _attribute_map = { + "mlflow_autologger": {"key": "mlflowAutologger", "type": "str"}, + } + + def __init__(self, *, mlflow_autologger: Union[str, "_models.MLFlowAutologgerState"], **kwargs: Any) -> None: + """ + :keyword mlflow_autologger: [Required] Indicates whether mlflow autologger is enabled. + Required. Known values are: "Enabled" and "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MLFlowAutologgerState + """ + super().__init__(**kwargs) + self.mlflow_autologger = mlflow_autologger + + class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attributes """Base definition for a job. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AutoMLJob, CommandJob, PipelineJob, SweepJob + AutoMLJob, CommandJob, FineTuningJob, LabelingJobProperties, PipelineJob, SparkJob, SweepJob Variables are only populated by the server, and will be ignored when sending a request. @@ -1743,14 +2850,19 @@ class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attr :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus """ @@ -1770,12 +2882,22 @@ 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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, "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", + "Labeling": "LabelingJobProperties", + "Pipeline": "PipelineJob", + "Spark": "SparkJob", + "Sweep": "SweepJob", + } } def __init__( @@ -1790,6 +2912,8 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = None, services: Optional[Dict[str, "_models.JobService"]] = None, **kwargs: Any ) -> None: @@ -1815,6 +2939,11 @@ 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :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 +2956,8 @@ def __init__( self.identity = identity self.is_archived = is_archived self.job_type: Optional[str] = None + self.notification_setting = notification_setting + self.secrets_configuration = secrets_configuration self.services = services self.status = None @@ -1862,14 +2993,19 @@ class AutoMLJob(JobBaseProperties): # pylint: disable=too-many-instance-attribu :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus :ivar environment_id: The ARM resource ID of the Environment specification for the job. This is optional value to provide, if not provided, AutoML will default this to Production @@ -1879,6 +3015,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 +3041,14 @@ 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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, "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 +3066,13 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = 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 +3098,11 @@ 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :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 +3114,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 +3132,8 @@ def __init__( experiment_name=experiment_name, identity=identity, is_archived=is_archived, + notification_setting=notification_setting, + secrets_configuration=secrets_configuration, services=services, **kwargs ) @@ -1988,6 +3141,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 @@ -2351,7 +3505,8 @@ class DatastoreProperties(ResourceBase): """Base definition for datastore contents configuration. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBlobDatastore, AzureDataLakeGen1Datastore, AzureDataLakeGen2Datastore, AzureFileDatastore + AzureBlobDatastore, AzureDataLakeGen1Datastore, AzureDataLakeGen2Datastore, AzureFileDatastore, + HdfsDatastore, OneLakeDatastore Variables are only populated by the server, and will be ignored when sending a request. @@ -2366,8 +3521,10 @@ 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", "Hdfs", and "OneLake". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. :vartype is_default: bool @@ -2385,6 +3542,7 @@ class DatastoreProperties(ResourceBase): "tags": {"key": "tags", "type": "{str}"}, "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, "is_default": {"key": "isDefault", "type": "bool"}, } @@ -2394,6 +3552,8 @@ class DatastoreProperties(ResourceBase): "AzureDataLakeGen1": "AzureDataLakeGen1Datastore", "AzureDataLakeGen2": "AzureDataLakeGen2Datastore", "AzureFile": "AzureFileDatastore", + "Hdfs": "HdfsDatastore", + "OneLake": "OneLakeDatastore", } } @@ -2404,6 +3564,7 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = None, **kwargs: Any ) -> None: """ @@ -2415,14 +3576,46 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty """ super().__init__(description=description, properties=properties, tags=tags, **kwargs) self.credentials = credentials self.datastore_type: Optional[str] = None + self.intellectual_property = intellectual_property self.is_default = None -class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes +class AzureDatastore(_serialization.Model): + """Base definition for Azure datastore contents configuration. + + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str + """ + + _attribute_map = { + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + } + + def __init__( + self, *, resource_group: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs: 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. @@ -2438,11 +3631,17 @@ class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-insta :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", "Hdfs", and "OneLake". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty :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. @@ -2470,7 +3669,10 @@ class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-insta "tags": {"key": "tags", "type": "{str}"}, "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, "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 +3687,9 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 +3706,13 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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,16 +3727,33 @@ 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, + intellectual_property=intellectual_property, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureBlob" + self.intellectual_property = intellectual_property + 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): # pylint: disable=too-many-instance-attributes """Azure Data Lake Gen1 datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2540,11 +3769,17 @@ 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", "Hdfs", and "OneLake". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty :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". @@ -2567,7 +3802,10 @@ class AzureDataLakeGen1Datastore(DatastoreProperties): "tags": {"key": "tags", "type": "{str}"}, "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, "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 +3818,9 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 +3833,13 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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,13 +3848,30 @@ 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, + intellectual_property=intellectual_property, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureDataLakeGen1" + self.intellectual_property = intellectual_property + 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. @@ -2622,11 +3887,17 @@ 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", "Hdfs", and "OneLake". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty :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. @@ -2656,7 +3927,10 @@ class AzureDataLakeGen2Datastore(DatastoreProperties): # pylint: disable=too-ma "tags": {"key": "tags", "type": "{str}"}, "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, "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 +3947,9 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 +3964,13 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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,46 +3985,135 @@ 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, + intellectual_property=intellectual_property, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureDataLakeGen2" + self.intellectual_property = intellectual_property + self.is_default = None self.account_name = account_name self.endpoint = endpoint self.filesystem = filesystem self.protocol = protocol self.service_data_access_auth_identity = service_data_access_auth_identity + self.resource_group = resource_group + self.subscription_id = subscription_id -class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes - """Azure File datastore configuration. +class Webhook(_serialization.Model): + """Webhook base. - 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: + AzureDevOpsWebhook All required parameters must be populated in order to send to Azure. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar credentials: [Required] Account credentials. Required. - :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials - :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", 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 - datastore. - :vartype is_default: bool - :ivar account_name: [Required] Storage account name. Required. - :vartype account_name: str - :ivar endpoint: Azure cloud endpoint for the storage account. - :vartype endpoint: str - :ivar file_share_name: [Required] The name of the Azure file share that the datastore points - to. Required. - :vartype file_share_name: str - :ivar protocol: Protocol used to communicate with the storage account. - :vartype protocol: str - :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate + :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. + + All required parameters must be populated in order to send to Azure. + + :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. + + :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", "Hdfs", and "OneLake". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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. + :vartype endpoint: str + :ivar file_share_name: [Required] The name of the Azure file share that the datastore points + to. Required. + :vartype file_share_name: str + :ivar protocol: Protocol used to communicate with the storage account. + :vartype protocol: 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 @@ -2761,7 +4134,10 @@ class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-insta "tags": {"key": "tags", "type": "{str}"}, "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, "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 +4154,9 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 +4171,13 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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 +4193,318 @@ 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, + intellectual_property=intellectual_property, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureFile" + self.intellectual_property = intellectual_property + 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 InferencingServer(_serialization.Model): + """InferencingServer. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureMLBatchInferencingServer, AzureMLOnlineInferencingServer, CustomInferencingServer, + TritonInferencingServer + + All required parameters must be populated in order to send to Azure. + + :ivar server_type: [Required] Inferencing server type for various targets. Required. Known + values are: "AzureMLOnline", "AzureMLBatch", "Triton", and "Custom". + :vartype server_type: str or ~azure.mgmt.machinelearningservices.models.InferencingServerType + """ + + _validation = { + "server_type": {"required": True}, + } + + _attribute_map = { + "server_type": {"key": "serverType", "type": "str"}, + } + + _subtype_map = { + "server_type": { + "AzureMLBatch": "AzureMLBatchInferencingServer", + "AzureMLOnline": "AzureMLOnlineInferencingServer", + "Custom": "CustomInferencingServer", + "Triton": "TritonInferencingServer", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.server_type: Optional[str] = None + + +class AzureMLBatchInferencingServer(InferencingServer): + """Azure ML batch inferencing server configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar server_type: [Required] Inferencing server type for various targets. Required. Known + values are: "AzureMLOnline", "AzureMLBatch", "Triton", and "Custom". + :vartype server_type: str or ~azure.mgmt.machinelearningservices.models.InferencingServerType + :ivar code_configuration: Code configuration for AML batch inferencing server. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + """ + + _validation = { + "server_type": {"required": True}, + } + + _attribute_map = { + "server_type": {"key": "serverType", "type": "str"}, + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + } + + def __init__(self, *, code_configuration: Optional["_models.CodeConfiguration"] = None, **kwargs: Any) -> None: + """ + :keyword code_configuration: Code configuration for AML batch inferencing server. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + """ + super().__init__(**kwargs) + self.server_type: str = "AzureMLBatch" + self.code_configuration = code_configuration + + +class AzureMLOnlineInferencingServer(InferencingServer): + """Azure ML online inferencing configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar server_type: [Required] Inferencing server type for various targets. Required. Known + values are: "AzureMLOnline", "AzureMLBatch", "Triton", and "Custom". + :vartype server_type: str or ~azure.mgmt.machinelearningservices.models.InferencingServerType + :ivar code_configuration: Code configuration for AML inferencing server. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + """ + + _validation = { + "server_type": {"required": True}, + } + + _attribute_map = { + "server_type": {"key": "serverType", "type": "str"}, + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + } + + def __init__(self, *, code_configuration: Optional["_models.CodeConfiguration"] = None, **kwargs: Any) -> None: + """ + :keyword code_configuration: Code configuration for AML inferencing server. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + """ + super().__init__(**kwargs) + self.server_type: str = "AzureMLOnline" + self.code_configuration = code_configuration + + +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 Azure. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :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": "MLFlowModelJobInput"}, + "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.MLFlowModelJobInput", + 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.MLFlowModelJobInput + :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 Azure. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :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": "MLFlowModelJobInput"}, + "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.MLFlowModelJobInput", + 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.MLFlowModelJobInput + :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): @@ -2922,6 +4613,69 @@ def __init__( self.slack_factor = slack_factor +class BaseEnvironmentSource(_serialization.Model): + """BaseEnvironmentSource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BaseEnvironmentId + + All required parameters must be populated in order to send to Azure. + + :ivar base_environment_source_type: [Required] Base environment type. Required. + "EnvironmentAsset" + :vartype base_environment_source_type: str or + ~azure.mgmt.machinelearningservices.models.BaseEnvironmentSourceType + """ + + _validation = { + "base_environment_source_type": {"required": True}, + } + + _attribute_map = { + "base_environment_source_type": {"key": "baseEnvironmentSourceType", "type": "str"}, + } + + _subtype_map = {"base_environment_source_type": {"EnvironmentAsset": "BaseEnvironmentId"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_environment_source_type: Optional[str] = None + + +class BaseEnvironmentId(BaseEnvironmentSource): + """Base environment type. + + All required parameters must be populated in order to send to Azure. + + :ivar base_environment_source_type: [Required] Base environment type. Required. + "EnvironmentAsset" + :vartype base_environment_source_type: str or + ~azure.mgmt.machinelearningservices.models.BaseEnvironmentSourceType + :ivar resource_id: [Required] Resource id accepting ArmId or AzureMlId. Required. + :vartype resource_id: str + """ + + _validation = { + "base_environment_source_type": {"required": True}, + "resource_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "base_environment_source_type": {"key": "baseEnvironmentSourceType", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: [Required] Resource id accepting ArmId or AzureMlId. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.base_environment_source_type: str = "EnvironmentAsset" + self.resource_id = resource_id + + class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -3105,15 +4859,47 @@ def __init__( self.sku = sku -class EndpointDeploymentPropertiesBase(_serialization.Model): - """Base definition for endpoint deployment. +class BatchDeploymentConfiguration(_serialization.Model): + """Properties relevant to different deployment types. - :ivar code_configuration: Code configuration for the endpoint deployment. - :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :ivar description: Description of the endpoint deployment. + 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 Azure. + + :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. + + :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. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -3144,8 +4930,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -3169,8 +4955,8 @@ class BatchDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: di :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -3178,6 +4964,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 +5013,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 +5035,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, @@ -3261,8 +5052,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -3270,6 +5061,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 +5104,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 @@ -3644,6 +5439,64 @@ def __init__( self.value = value +class BatchPipelineComponentDeploymentConfiguration(BatchDeploymentConfiguration): + """Properties for a Batch Pipeline Component Deployment. + + All required parameters must be populated in order to send to Azure. + + :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 = { + "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, + *, + 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. @@ -3735,7 +5588,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 @@ -3872,1424 +5725,1542 @@ def __init__(self, *, context_uri: str, dockerfile_path: str = "Dockerfile", **k self.dockerfile_path = dockerfile_path -class CertificateDatastoreCredentials(DatastoreCredentials): - """Certificate datastore credentials configuration. - - All required parameters must be populated in order to send to Azure. +class CallRateLimit(_serialization.Model): + """The call rate limit Cognitive Services account. - :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 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: + :vartype rules: list[~azure.mgmt.machinelearningservices.models.ThrottlingRule] """ - _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"}, + "count": {"key": "count", "type": "float"}, + "renewal_period": {"key": "renewalPeriod", "type": "float"}, + "rules": {"key": "rules", "type": "[ThrottlingRule]"}, } def __init__( self, *, - client_id: str, - secrets: "_models.CertificateDatastoreSecrets", - tenant_id: str, - thumbprint: str, - authority_url: Optional[str] = None, - resource_url: Optional[str] = None, + count: Optional[float] = None, + renewal_period: Optional[float] = None, + rules: Optional[List["_models.ThrottlingRule"]] = 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.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 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: + :paramtype rules: list[~azure.mgmt.machinelearningservices.models.ThrottlingRule] """ 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.count = count + self.renewal_period = renewal_period + self.rules = rules -class CertificateDatastoreSecrets(DatastoreSecrets): - """Datastore certificate secrets. - All required parameters must be populated in order to send to Azure. +class CapacityConfig(_serialization.Model): + """The capacity configuration. - :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 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] """ - _validation = { - "secrets_type": {"required": True}, - } - _attribute_map = { - "secrets_type": {"key": "secretsType", "type": "str"}, - "certificate": {"key": "certificate", "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, *, certificate: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + 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 certificate: Service principal certificate. - :paramtype certificate: 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.secrets_type: str = "Certificate" - self.certificate = certificate + self.minimum = minimum + self.maximum = maximum + self.step = step + self.default = default + self.allowed_values = allowed_values -class TableVertical(_serialization.Model): - """Abstract class for AutoML tasks that use table dataset as input - such as - Classification/Regression/Forecasting. +class CapacityReservationGroup(TrackedResource): + """CapacityReservationGroup. - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.CapacityReservationGroupProperties + :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 = { - "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"}, + "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": "CapacityReservationGroupProperties"}, + "sku": {"key": "sku", "type": "Sku"}, } 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, + location: str, + properties: "_models.CapacityReservationGroupProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = 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 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.CapacityReservationGroupProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - 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 + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.properties = properties + self.sku = sku -class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Classification task in AutoML Table vertical. +class CapacityReservationGroupProperties(_serialization.Model): + """CapacityReservationGroupProperties. All required parameters must be populated in order to send to Azure. - :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 + :ivar offer: Offer used by this capacity reservation group. + :vartype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + :ivar reserved_capacity: [Required] Specifies the amount of capacity to reserve. Required. + :vartype reserved_capacity: int """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, + "reserved_capacity": {"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"}, + "offer": {"key": "offer", "type": "ServerlessOffer"}, + "reserved_capacity": {"key": "reservedCapacity", "type": "int"}, } 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 + self, *, reserved_capacity: int, offer: Optional["_models.ServerlessOffer"] = 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 offer: Offer used by this capacity reservation group. + :paramtype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + :keyword reserved_capacity: [Required] Specifies the amount of capacity to reserve. Required. + :paramtype reserved_capacity: int """ - 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.offer = offer + self.reserved_capacity = reserved_capacity -class TrainingSettings(_serialization.Model): - """Training related configuration. +class CapacityReservationGroupTrackedResourceArmPaginatedResult(_serialization.Model): + """A paginated list of CapacityReservationGroup entities. - :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 next_link: The link to the next page of CapacityReservationGroup objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type CapacityReservationGroup. + :vartype value: list[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] """ _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"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[CapacityReservationGroup]"}, } 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, + next_link: Optional[str] = None, + value: Optional[List["_models.CapacityReservationGroup"]] = 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 next_link: The link to the next page of CapacityReservationGroup objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type CapacityReservationGroup. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] """ 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 + self.next_link = next_link + self.value = value -class ClassificationTrainingSettings(TrainingSettings): - """Classification Training related configuration. +class DataDriftMetricThresholdBase(_serialization.Model): + """DataDriftMetricThresholdBase. - :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] + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CategoricalDataDriftMetricThreshold, NumericalDataDriftMetricThreshold + + All required parameters must be populated in order to send to Azure. + + :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 = { - "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]"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + } + + _subtype_map = { + "data_type": { + "Categorical": "CategoricalDataDriftMetricThreshold", + "Numerical": "NumericalDataDriftMetricThreshold", + } + } + + def __init__(self, *, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any) -> None: + """ + :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.data_type: Optional[str] = None + self.threshold = threshold + + +class CategoricalDataDriftMetricThreshold(DataDriftMetricThresholdBase): + """CategoricalDataDriftMetricThreshold. + + All required parameters must be populated in order to send to Azure. + + :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 = { + "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, - allowed_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, - blocked_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = 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 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] + :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__( - 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__(threshold=threshold, **kwargs) + self.data_type: str = "Categorical" + self.metric = metric -class ClusterUpdateParameters(_serialization.Model): - """AmlCompute update parameters. +class DataQualityMetricThresholdBase(_serialization.Model): + """DataQualityMetricThresholdBase. - :ivar properties: Properties of ClusterUpdate. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CategoricalDataQualityMetricThreshold, NumericalDataQualityMetricThreshold + + All required parameters must be populated in order to send to Azure. + + :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. - :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. - :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): + """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 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_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 Azure. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar 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 """ + _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 = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CodeContainer]"}, + "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. - :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", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :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): # pylint: disable=too-many-instance-attributes + """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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :ivar test_data: Test data input. + :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation + 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"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "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, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + 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 - """ - 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 - - -class CodeVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of CodeVersion entities. - - :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] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CodeVersion]"}, - } - - def __init__( - 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 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] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ColumnTransformer(_serialization.Model): - """Column transformer parameters. - - :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 = { - "fields": {"key": "fields", "type": "[str]"}, - "parameters": {"key": "parameters", "type": "object"}, - } - - def __init__(self, *, fields: Optional[List[str]] = None, parameters: Optional[JSON] = 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 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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :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 search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :keyword test_data: Test data input. + :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation + 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__(**kwargs) - self.fields = fields - self.parameters = parameters - + self.cv_split_column_names = cv_split_column_names + self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name -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. +class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Classification task in AutoML Table vertical. 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 + :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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :ivar test_data: Test data input. + :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation + 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 = { - "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}, + "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"}, - "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"}, + "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"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "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, *, - 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, + 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, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + 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 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 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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :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 search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :keyword test_data: Test data input. + :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation + 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__( - 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, + fixed_parameters=fixed_parameters, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + 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 = "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.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.fixed_parameters = fixed_parameters + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name -class JobLimits(_serialization.Model): - """JobLimits. +class ModelPerformanceMetricThresholdBase(_serialization.Model): + """ModelPerformanceMetricThresholdBase. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CommandJobLimits, SweepJobLimits + ClassificationModelPerformanceMetricThreshold, RegressionModelPerformanceMetricThreshold 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 model_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Classification" and "Regression". + :vartype model_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringModelType + :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 = { - "job_limits_type": {"required": True}, + "model_type": {"required": True}, } _attribute_map = { - "job_limits_type": {"key": "jobLimitsType", "type": "str"}, - "timeout": {"key": "timeout", "type": "duration"}, + "model_type": {"key": "modelType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } - _subtype_map = {"job_limits_type": {"Command": "CommandJobLimits", "Sweep": "SweepJobLimits"}} + _subtype_map = { + "model_type": { + "Classification": "ClassificationModelPerformanceMetricThreshold", + "Regression": "RegressionModelPerformanceMetricThreshold", + } + } - def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + def __init__(self, *, threshold: Optional["_models.MonitoringThreshold"] = 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 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.job_limits_type: Optional[str] = None - self.timeout = timeout + self.model_type: Optional[str] = None + self.threshold = threshold -class CommandJobLimits(JobLimits): - """Command Job limit class. +class ClassificationModelPerformanceMetricThreshold(ModelPerformanceMetricThresholdBase): + """ClassificationModelPerformanceMetricThreshold. 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 model_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Classification" and "Regression". + :vartype model_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringModelType + :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 classification model performance to calculate. Required. Known + values are: "Accuracy", "Precision", and "Recall". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationModelPerformanceMetric """ _validation = { - "job_limits_type": {"required": True}, + "model_type": {"required": True}, + "metric": {"required": True}, } _attribute_map = { - "job_limits_type": {"key": "jobLimitsType", "type": "str"}, - "timeout": {"key": "timeout", "type": "duration"}, + "model_type": {"key": "modelType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } - def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + metric: Union[str, "_models.ClassificationModelPerformanceMetric"], + threshold: Optional["_models.MonitoringThreshold"] = 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 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 classification model performance to calculate. Required. Known + values are: "Accuracy", "Precision", and "Recall". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationModelPerformanceMetric """ - super().__init__(timeout=timeout, **kwargs) - self.job_limits_type: str = "Command" - - -class ComponentContainer(Resource): - """Azure Resource Manager resource envelope. + super().__init__(threshold=threshold, **kwargs) + self.model_type: str = "Classification" + self.metric = metric - 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 TrainingSettings(_serialization.Model): + """Training related 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 properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComponentContainerProperties + :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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode """ - _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"}, + "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"}, + "training_mode": {"key": "trainingMode", "type": "str"}, } - def __init__(self, *, properties: "_models.ComponentContainerProperties", **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, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentContainerProperties + :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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode """ super().__init__(**kwargs) - self.properties = properties - - -class ComponentContainerProperties(AssetContainer): - """Component container definition. - - - .. raw:: html + 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 + self.training_mode = training_mode - . - Variables are only populated by the server, and will be ignored when sending a request. +class ClassificationTrainingSettings(TrainingSettings): + """Classification Training related configuration. - :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 + :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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :ivar allowed_training_algorithms: Allowed models for classification task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] + :ivar blocked_training_algorithms: Blocked models for classification task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] """ - _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"}, + "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"}, + "training_mode": {"key": "trainingMode", "type": "str"}, + "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, + "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "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, + 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, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, **kwargs: 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 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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :keyword allowed_training_algorithms: Allowed models for classification task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] + :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, is_archived=is_archived, **kwargs) - self.provisioning_state = None + 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, + training_mode=training_mode, + **kwargs + ) + self.allowed_training_algorithms = allowed_training_algorithms + self.blocked_training_algorithms = blocked_training_algorithms -class ComponentContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ComponentContainer entities. +class ClusterUpdateParameters(_serialization.Model): + """AmlCompute update parameters. - :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] + :ivar properties: Properties of ClusterUpdate. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ComponentContainer]"}, + "properties": {"key": "properties.properties", "type": "ScaleSettingsInformation"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ComponentContainer"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ScaleSettingsInformation"] = None, **kwargs: Any) -> None: """ - :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] + :keyword properties: Properties of ClusterUpdate. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.properties = properties -class ComponentVersion(Resource): - """Azure Resource Manager resource envelope. +class ExportSummary(_serialization.Model): + """ExportSummary. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CsvExportSummary, CocoExportSummary, DatasetExportSummary Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar 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.ComponentVersionProperties + :ivar end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, } _attribute_map = { - "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": "ComponentVersionProperties"}, + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, } - def __init__(self, *, properties: "_models.ComponentVersionProperties", **kwargs: Any) -> None: - """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties - """ + _subtype_map = { + "format": {"CSV": "CsvExportSummary", "Coco": "CocoExportSummary", "Dataset": "DatasetExportSummary"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.properties = properties + self.end_date_time = None + self.exported_row_count = None + self.format: Optional[str] = None + self.labeling_job_id = None + self.start_date_time = None -class ComponentVersionProperties(AssetBase): - """Definition of a component version: defines resources that span component types. +class CocoExportSummary(ExportSummary): + """CocoExportSummary. 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. + All required parameters must be populated in order to send to Azure. + + :ivar end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar container_name: The container name to which the labels will be exported. + :vartype container_name: str + :ivar snapshot_path: The output path where the labels will be exported. + :vartype snapshot_path: str + """ + + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "container_name": {"readonly": True}, + "snapshot_path": {"readonly": True}, + } + + _attribute_map = { + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "container_name": {"key": "containerName", "type": "str"}, + "snapshot_path": {"key": "snapshotPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.format: str = "Coco" + self.container_name = None + self.snapshot_path = None + + +class CodeConfiguration(_serialization.Model): + """Configuration for a scoring code asset. + + All required parameters must be populated in order to send to Azure. + + :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 = { + "scoring_script": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "code_id": {"key": "codeId", "type": "str"}, + "scoring_script": {"key": "scoringScript", "type": "str"}, + } + + def __init__(self, *, scoring_script: str, code_id: Optional[str] = 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 + """ + super().__init__(**kwargs) + self.code_id = code_id + self.scoring_script = scoring_script + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + 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 + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +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. + + :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 + """ + + _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": "CodeContainerProperties"}, + } + + def __init__(self, *, properties: "_models.CodeContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeContainerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CodeContainerProperties(AssetContainer): + """Container for code asset 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_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. - - - .. raw:: html - - . - :vartype component_spec: JSON - :ivar provisioning_state: Provisioning state for the component version. Known values are: + :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 """ _validation = { + "latest_version": {"readonly": True}, + "next_version": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -5297,9 +7268,9 @@ class ComponentVersionProperties(AssetBase): "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"}, + "latest_version": {"key": "latestVersion", "type": "str"}, + "next_version": {"key": "nextVersion", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, } @@ -5309,9 +7280,7 @@ def __init__( 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: """ @@ -5321,845 +7290,720 @@ def __init__( :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__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, - **kwargs - ) - self.component_spec = component_spec + super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) self.provisioning_state = None -class ComponentVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ComponentVersion entities. +class CodeContainerResourceArmPaginatedResult(_serialization.Model): + """A paginated list of CodeContainer 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 CodeContainer 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 CodeContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] """ _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ComponentVersion]"}, + "value": {"key": "value", "type": "[CodeContainer]"}, } 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.CodeContainer"]] = 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 CodeContainer 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 CodeContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] """ super().__init__(**kwargs) self.next_link = next_link self.value = value -class ComputeInstanceSchema(_serialization.Model): - """Properties(top level) of ComputeInstance. +class CodeVersion(ProxyResource): + """Azure Resource Manager resource envelope. - :ivar properties: Properties of ComputeInstance. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.CodeVersionProperties """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, + "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"}, } - def __init__(self, *, properties: Optional["_models.ComputeInstanceProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.CodeVersionProperties", **kwargs: Any) -> None: """ - :keyword properties: Properties of ComputeInstance. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeVersionProperties """ super().__init__(**kwargs) self.properties = properties -class ComputeInstance(Compute, ComputeInstanceSchema): # pylint: disable=too-many-instance-attributes - """An Azure Machine Learning compute instance. +class CodeVersionProperties(AssetBase): + """Code asset version details. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar properties: Properties of 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. + :ivar description: The asset description text. :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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :vartype is_archived: bool + :ivar code_uri: Uri where code is located. + :vartype code_uri: str + :ivar provisioning_state: Provisioning state for the code version. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { - "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": "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"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "code_uri": {"key": "codeUri", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( 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, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + code_uri: Optional[str] = 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. + :keyword description: The asset description text. :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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :paramtype is_archived: bool + :keyword code_uri: Uri where code is located. + :paramtype code_uri: str """ super().__init__( - compute_location=compute_location, description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, properties=properties, + tags=tags, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, **kwargs ) - self.properties = properties - self.compute_type: str = "ComputeInstance" - self.compute_location = compute_location + self.code_uri = code_uri 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. +class CodeVersionResourceArmPaginatedResult(_serialization.Model): + """A paginated list of CodeVersion entities. - :ivar display_name: Name of the ComputeInstance application. - :vartype display_name: str - :ivar endpoint_uri: Application' endpoint URI. - :vartype endpoint_uri: str + :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] """ _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[CodeVersion]"}, } def __init__( - self, *, display_name: Optional[str] = None, endpoint_uri: Optional[str] = None, **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.CodeVersion"]] = 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 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] """ super().__init__(**kwargs) - self.display_name = display_name - self.endpoint_uri = endpoint_uri + self.next_link = next_link + self.value = value -class ComputeInstanceConnectivityEndpoints(_serialization.Model): - """Defines all connectivity endpoints and properties for an ComputeInstance. +class CognitiveServiceEndpointDeploymentResourceProperties(_serialization.Model): + """CognitiveServiceEndpointDeploymentResourceProperties. - 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 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 + :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 = { - "public_ip_address": {"readonly": True}, - "private_ip_address": {"readonly": True}, + "model": {"required": True}, } _attribute_map = { - "public_ip_address": {"key": "publicIpAddress", "type": "str"}, - "private_ip_address": {"key": "privateIpAddress", "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, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + 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 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.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"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.user_name = None - self.user_org_id = None - self.user_id = None - - -class ComputeInstanceDataDisk(_serialization.Model): - """Defines an Aml Instance DataDisk. - - :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 - """ - - _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"}, + "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, *, - 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", + 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 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 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.caching = caching - self.disk_size_gb = disk_size_gb - self.lun = lun - self.storage_account_type = storage_account_type + self.client_id = client_id + self.data_collection_mode = data_collection_mode + self.data_id = data_id + self.sampling_rate = sampling_rate -class ComputeInstanceDataMount(_serialization.Model): - """Defines an Aml Instance DataMount. +class ColumnTransformer(_serialization.Model): + """Column transformer parameters. - :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 + :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 = { - "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"}, + "fields": {"key": "fields", "type": "[str]"}, + "parameters": {"key": "parameters", "type": "object"}, } - 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, - 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: + def __init__(self, *, fields: Optional[List[str]] = None, parameters: Optional[JSON] = 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 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.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 - - -class ComputeInstanceEnvironmentInfo(_serialization.Model): - """Environment information. - - :ivar name: name of environment. - :vartype name: str - :ivar version: version of environment. - :vartype version: str - """ + self.fields = fields + self.parameters = parameters - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: name of environment. - :paramtype name: str - :keyword version: version of environment. - :paramtype version: str - """ - super().__init__(**kwargs) - self.name = name - self.version = version +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. -class ComputeInstanceLastOperation(_serialization.Model): - """The last operation on ComputeInstance. + All required parameters must be populated in order to send to Azure. - :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 + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar autologger_settings: Distribution configuration of the job. If set, this should be one of + Mpi, Tensorflow, PyTorch, or null. + :vartype autologger_settings: ~azure.mgmt.machinelearningservices.models.AutologgerSettings + :ivar code_id: ARM resource ID of the code asset. + :vartype code_id: str + :ivar command: [Required] The command to execute on startup of the job. eg. "python train.py". + Required. + :vartype command: str + :ivar distribution: Distribution configuration of the job. If set, this should be one of Mpi, + Tensorflow, PyTorch, Ray, 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 """ - _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"}, + _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}, } - 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: - """ - :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 + _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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "autologger_settings": {"key": "autologgerSettings", "type": "AutologgerSettings"}, + "code_id": {"key": "codeId", "type": "str"}, + "command": {"key": "command", "type": "str"}, + "distribution": {"key": "distribution", "type": "DistributionConfiguration"}, + "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__( # pylint: disable=too-many-locals + 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = None, + services: Optional[Dict[str, "_models.JobService"]] = None, + autologger_settings: Optional["_models.AutologgerSettings"] = None, + code_id: Optional[str] = None, + distribution: Optional["_models.DistributionConfiguration"] = None, + environment_variables: Optional[Dict[str, str]] = None, + 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: """ - super().__init__(**kwargs) - self.operation_name = operation_name - self.operation_time = operation_time - self.operation_status = operation_status - self.operation_trigger = operation_trigger + :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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword autologger_settings: Distribution configuration of the job. If set, this should be one + of Mpi, Tensorflow, PyTorch, or null. + :paramtype autologger_settings: ~azure.mgmt.machinelearningservices.models.AutologgerSettings + :keyword code_id: ARM resource ID of the code asset. + :paramtype code_id: str + :keyword command: [Required] The command to execute on startup of the job. eg. "python + train.py". Required. + :paramtype command: str + :keyword distribution: Distribution configuration of the job. If set, this should be one of + Mpi, Tensorflow, PyTorch, Ray, 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__( + 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, + secrets_configuration=secrets_configuration, + services=services, + **kwargs + ) + self.job_type: str = "Command" + self.autologger_settings = autologger_settings + 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 ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Compute Instance properties. +class JobLimits(_serialization.Model): + """JobLimits. - 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: + CommandJobLimits, SweepJobLimits - :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 + 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 """ _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}, + "job_limits_type": {"required": 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"}, + "job_limits_type": {"key": "jobLimitsType", "type": "str"}, + "timeout": {"key": "timeout", "type": "duration"}, } - 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, - **kwargs: Any - ) -> None: + _subtype_map = {"job_limits_type": {"Command": "CommandJobLimits", "Sweep": "SweepJobLimits"}} + + def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **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 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.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 + self.job_limits_type: Optional[str] = None + self.timeout = timeout -class ComputeInstanceSshSettings(_serialization.Model): - """Specifies policy and settings for SSH access. +class CommandJobLimits(JobLimits): + """Command Job limit class. - 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 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 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 = { - "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"}, + "job_limits_type": {"required": True}, } - def __init__( - self, - *, - ssh_public_access: Union[str, "_models.SshPublicAccess"] = "Disabled", - admin_public_key: Optional[str] = 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"}, + "job_limits_type": {"key": "jobLimitsType", "type": "str"}, + "timeout": {"key": "timeout", "type": "duration"}, } - def __init__(self, *, runtime: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: """ - :keyword runtime: Runtime of compute instance. - :paramtype runtime: 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.runtime = runtime + super().__init__(timeout=timeout, **kwargs) + self.job_limits_type: str = "Command" -class ComputeResourceSchema(_serialization.Model): - """ComputeResourceSchema. +class ComponentConfiguration(_serialization.Model): + """Used for sweep over component. - :ivar properties: Compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.Compute + :ivar pipeline_settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :vartype pipeline_settings: JSON """ _attribute_map = { - "properties": {"key": "properties", "type": "Compute"}, + "pipeline_settings": {"key": "pipelineSettings", "type": "object"}, } - def __init__(self, *, properties: Optional["_models.Compute"] = None, **kwargs: Any) -> None: + def __init__(self, *, pipeline_settings: Optional[JSON] = None, **kwargs: Any) -> None: """ - :keyword properties: Compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.Compute + :keyword pipeline_settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :paramtype pipeline_settings: JSON """ super().__init__(**kwargs) - self.properties = properties + self.pipeline_settings = pipeline_settings -class ComputeResource(Resource, ComputeResourceSchema): - """Machine Learning compute object wrapped into ARM resource envelope. +class ComponentContainer(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 Azure. + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -6171,14 +8015,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.ComponentContainerProperties """ _validation = { @@ -6186,1068 +8024,1230 @@ 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": "ComponentContainerProperties"}, } - 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.ComponentContainerProperties", **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.ComponentContainerProperties """ - 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 ComponentContainerProperties(AssetContainer): + """Component container definition. - :ivar compute_start_stop: The list of compute start stop schedules to be applied. - :vartype compute_start_stop: - list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] + + .. raw:: html + + . + + 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 component container. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ + _validation = { + "latest_version": {"readonly": True}, + "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "compute_start_stop": {"key": "computeStartStop", "type": "[ComputeStartStopSchedule]"}, + "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, *, compute_start_stop: Optional[List["_models.ComputeStartStopSchedule"]] = None, **kwargs: Any + 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 compute_start_stop: The list of compute start stop schedules to be applied. - :paramtype compute_start_stop: - list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] - """ + :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 ComponentContainerResourceArmPaginatedResult(_serialization.Model): + """A paginated list of ComponentContainer entities. + + :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] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ComponentContainer]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ComponentContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :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.compute_start_stop = compute_start_stop + self.next_link = next_link + self.value = value -class ComputeStartStopSchedule(_serialization.Model): - """Compute start stop schedule properties. +class ComponentVersion(ProxyResource): + """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: A system assigned id for the schedule. + 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 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 + :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.ComponentVersionProperties """ _validation = { "id": {"readonly": True}, - "provisioning_status": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": 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"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ComponentVersionProperties"}, } - 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, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.ComponentVersionProperties", **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 properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties """ 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 + self.properties = properties -class ContainerResourceRequirements(_serialization.Model): - """Resource requirements for each container instance within an online deployment. +class ComponentVersionProperties(AssetBase): + """Definition of a component version: defines resources that span component types. - :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 + 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Stage in the component lifecycle. + :vartype stage: str """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "container_resource_limits": {"key": "containerResourceLimits", "type": "ContainerResourceSettings"}, - "container_resource_requests": {"key": "containerResourceRequests", "type": "ContainerResourceSettings"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "component_spec": {"key": "componentSpec", "type": "object"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, } def __init__( self, *, - container_resource_limits: Optional["_models.ContainerResourceSettings"] = None, - container_resource_requests: Optional["_models.ContainerResourceSettings"] = None, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + component_spec: Optional[JSON] = None, + stage: Optional[str] = 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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :paramtype is_archived: bool + :keyword component_spec: Defines Component definition details. + + + .. raw:: html + + . + :paramtype component_spec: JSON + :keyword stage: Stage in the component lifecycle. + :paramtype stage: str """ - super().__init__(**kwargs) - self.container_resource_limits = container_resource_limits - self.container_resource_requests = container_resource_requests + super().__init__( + description=description, + properties=properties, + tags=tags, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.component_spec = component_spec + self.provisioning_state = None + self.stage = stage -class ContainerResourceSettings(_serialization.Model): - """ContainerResourceSettings. +class ComponentVersionResourceArmPaginatedResult(_serialization.Model): + """A paginated list of ComponentVersion entities. - :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 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 = { - "cpu": {"key": "cpu", "type": "str"}, - "gpu": {"key": "gpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ComponentVersion]"}, } def __init__( - self, *, cpu: Optional[str] = None, gpu: Optional[str] = None, memory: Optional[str] = None, **kwargs: Any + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ComponentVersion"]] = 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 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.cpu = cpu - self.gpu = gpu - self.memory = memory + self.next_link = next_link + self.value = value -class CosmosDbSettings(_serialization.Model): - """CosmosDbSettings. +class ComputeInstanceSchema(_serialization.Model): + """Properties(top level) of ComputeInstance. - :ivar collections_throughput: The throughput of the collections in cosmosdb database. - :vartype collections_throughput: int + :ivar properties: Properties of ComputeInstance. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties """ _attribute_map = { - "collections_throughput": {"key": "collectionsThroughput", "type": "int"}, + "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, } - def __init__(self, *, collections_throughput: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.ComputeInstanceProperties"] = None, **kwargs: Any) -> None: """ - :keyword collections_throughput: The throughput of the collections in cosmosdb database. - :paramtype collections_throughput: int + :keyword properties: Properties of ComputeInstance. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties """ super().__init__(**kwargs) - self.collections_throughput = collections_throughput + self.properties = properties -class Cron(_serialization.Model): - """The workflow trigger cron for ComputeStartStop schedule type. +class ComputeInstance(Compute, ComputeInstanceSchema): # pylint: disable=too-many-instance-attributes + """An Azure Machine Learning compute instance. - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Properties of 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 - """ - super().__init__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) - self.trigger_type: str = "Cron" - self.expression = expression - - -class CustomForecastHorizon(ForecastHorizon): - """The desired maximum forecast horizon in units of time-series frequency. - - All required parameters must be populated in order to send to Azure. - - :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 = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, - } - - def __init__(self, *, value: int, **kwargs: Any) -> None: - """ - :keyword value: [Required] Forecast horizon value. Required. - :paramtype value: int + :keyword mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. Known + values are: "Enabled" and "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MlflowAutologger """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.value = value + self.mlflow_autologger = mlflow_autologger -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 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 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 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 = { - "job_input_type": {"required": True}, + "public_ip_address": {"readonly": True}, + "private_ip_address": {"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", - } + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "privateIpAddress", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: Description for the input. - :paramtype description: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.description = description - self.job_input_type: Optional[str] = None + self.public_ip_address = None + self.private_ip_address = None -class CustomModelJobInput(AssetJobInput, JobInput): - """CustomModelJobInput. +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 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 + :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}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "services": {"readonly": 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"}, + "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. +class ComputeInstanceDataDisk(_serialization.Model): + """Defines an Aml Instance DataDisk. - All required parameters must be populated in order to send to Azure. - - :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 - """ - - _validation = { - "job_output_type": {"required": True}, - } + :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 + """ _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 = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, + "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"}, } - 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. - :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}. :vartype id: str @@ -7259,8 +9259,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,2731 +9274,2785 @@ 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. - - :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 - """ +class ComputeRuntimeDto(_serialization.Model): + """ComputeRuntimeDto. - _validation = { - "latest_version": {"readonly": True}, - "next_version": {"readonly": True}, - "data_type": {"required": True}, - } + :ivar spark_runtime_version: + :vartype spark_runtime_version: str + """ _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. - Variables are only populated by the server, and will be ignored when sending a request. +class ContainerResourceSettings(_serialization.Model): + """ContainerResourceSettings. - All required parameters must be populated in order to send to Azure. - - :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.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 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 """ - _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": "DataLakeAnalyticsSchemaProperties"}, - "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"}, + "cpu": {"key": "cpu", "type": "str"}, + "gpu": {"key": "gpu", "type": "str"}, + "memory": {"key": "memory", "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 + self, *, cpu: Optional[str] = None, gpu: Optional[str] = None, memory: 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 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__( - 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 - 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 DataLakeAnalyticsSchemaProperties(_serialization.Model): - """DataLakeAnalyticsSchemaProperties. - - :ivar data_lake_store_account_name: DataLake Store Account Name. - :vartype data_lake_store_account_name: str - """ + super().__init__(**kwargs) + self.cpu = cpu + self.gpu = gpu + self.memory = memory - _attribute_map = { - "data_lake_store_account_name": {"key": "dataLakeStoreAccountName", "type": "str"}, - } - def __init__(self, *, data_lake_store_account_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword data_lake_store_account_name: DataLake Store Account Name. - :paramtype data_lake_store_account_name: str - """ - super().__init__(**kwargs) - self.data_lake_store_account_name = data_lake_store_account_name +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 -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 Azure. - :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 + :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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str """ _validation = { - "reference_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9._]"}, } _attribute_map = { - "reference_type": {"key": "referenceType", "type": "str"}, - "datastore_id": {"key": "datastoreId", "type": "str"}, - "path": {"key": "path", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__(self, *, datastore_id: Optional[str] = None, path: Optional[str] = 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 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 failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ super().__init__(**kwargs) - self.reference_type: str = "DataPath" - self.datastore_id = datastore_id - self.path = path + self.failure_reason = failure_reason + self.provisioning_state = None + self.type: Optional[str] = None -class Datastore(Resource): - """Azure Resource Manager resource envelope. +class ContentSafetyEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): + """ContentSafetyEndpointDeploymentResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. :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 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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9._]"}, + "model": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "DatastoreProperties"}, + "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: "_models.DatastoreProperties", **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 properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatastoreProperties + :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.properties = properties + 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 DatastoreResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Datastore entities. +class EndpointResourceProperties(_serialization.Model): + """EndpointResourceProperties. - :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] + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContentSafetyEndpointResourceProperties, OpenAIEndpointResourceProperties, + SpeechEndpointResourceProperties, 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 Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", and "managedOnlineEndpoint". + :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 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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState """ + _validation = { + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Datastore]"}, + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + _subtype_map = { + "endpoint_type": { + "Azure.ContentSafety": "ContentSafetyEndpointResourceProperties", + "Azure.OpenAI": "OpenAIEndpointResourceProperties", + "Azure.Speech": "SpeechEndpointResourceProperties", + "managedOnlineEndpoint": "ManagedOnlineEndpointResourceProperties", + } } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.Datastore"]] = None, **kwargs: Any + self, + *, + associated_resource_id: Optional[str] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + name: Optional[str] = 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 associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :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 name: Name of the endpoint. + :paramtype name: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.associated_resource_id = associated_resource_id + self.endpoint_type: Optional[str] = None + self.endpoint_uri = endpoint_uri + self.failure_reason = failure_reason + self.name = name + self.provisioning_state = None -class DataVersionBase(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. + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", and "managedOnlineEndpoint". + :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 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.DataVersionBaseProperties + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState """ _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"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "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, *, properties: "_models.DataVersionBaseProperties", **kwargs: Any) -> None: - """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataVersionBaseProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class DataVersionBaseProperties(AssetBase): - """Data version base definition. - - 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 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 - """ - - _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"}, - } - - _subtype_map = { - "data_type": {"mltable": "MLTableData", "uri_file": "UriFileDataVersion", "uri_folder": "UriFolderDataVersion"} + "provisioning_state": {"key": "provisioningState", "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, + associated_resource_id: Optional[str] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + 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 data_uri: [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. Required. - :paramtype data_uri: str + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :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 name: Name of the endpoint. + :paramtype name: str """ super().__init__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, + associated_resource_id=associated_resource_id, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + name=name, **kwargs ) - self.data_type: Optional[str] = None - self.data_uri = data_uri + self.endpoint_type: str = "Azure.ContentSafety" -class DataVersionBaseResourceArmPaginatedResult(_serialization.Model): - """A paginated list of DataVersionBase entities. +class CosmosDbSettings(_serialization.Model): + """CosmosDbSettings. - :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 collections_throughput: + :vartype collections_throughput: int """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DataVersionBase]"}, + "collections_throughput": {"key": "collectionsThroughput", "type": "int"}, } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataVersionBase"]] = 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 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 collections_throughput: + :paramtype collections_throughput: int """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.collections_throughput = collections_throughput -class OnlineScaleSettings(_serialization.Model): - """Online deployment scaling configuration. +class ScheduleActionBase(_serialization.Model): + """ScheduleActionBase. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DefaultScaleSettings, TargetUtilizationScaleSettings + JobScheduleAction, CreateMonitorAction, ImportDataAction, EndpointScheduleAction All required parameters must be populated in order to send to Azure. - :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 action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", "ImportData", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType """ _validation = { - "scale_type": {"required": True}, + "action_type": {"required": True}, } _attribute_map = { - "scale_type": {"key": "scaleType", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, } _subtype_map = { - "scale_type": {"Default": "DefaultScaleSettings", "TargetUtilization": "TargetUtilizationScaleSettings"} + "action_type": { + "CreateJob": "JobScheduleAction", + "CreateMonitor": "CreateMonitorAction", + "ImportData": "ImportDataAction", + "InvokeBatchEndpoint": "EndpointScheduleAction", + } } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.scale_type: Optional[str] = None + self.action_type: Optional[str] = None -class DefaultScaleSettings(OnlineScaleSettings): - """DefaultScaleSettings. +class CreateMonitorAction(ScheduleActionBase): + """CreateMonitorAction. All required parameters must be populated in order to send to Azure. - :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 action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", "ImportData", 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 = { - "scale_type": {"required": True}, - } - - _attribute_map = { - "scale_type": {"key": "scaleType", "type": "str"}, + "action_type": {"required": True}, + "monitor_definition": {"required": True}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.scale_type: str = "Default" - - -class DeploymentLogs(_serialization.Model): - """DeploymentLogs. - - :ivar content: The retrieved online deployment logs. - :vartype content: str - """ - _attribute_map = { - "content": {"key": "content", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + "monitor_definition": {"key": "monitorDefinition", "type": "MonitorDefinition"}, } - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, monitor_definition: "_models.MonitorDefinition", **kwargs: Any) -> None: """ - :keyword content: The retrieved online deployment logs. - :paramtype content: str + :keyword monitor_definition: [Required] Defines the monitor. Required. + :paramtype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition """ super().__init__(**kwargs) - self.content = content + self.action_type: str = "CreateMonitor" + self.monitor_definition = monitor_definition -class DeploymentLogsRequest(_serialization.Model): - """DeploymentLogsRequest. +class Cron(_serialization.Model): + """The workflow trigger cron for ComputeStartStop schedule type. - :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 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 = { - "container_type": {"key": "containerType", "type": "str"}, - "tail": {"key": "tail", "type": "int"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "expression": {"key": "expression", "type": "str"}, } def __init__( self, *, - container_type: Optional[Union[str, "_models.ContainerType"]] = None, - tail: Optional[int] = None, + start_time: Optional[str] = None, + time_zone: str = "UTC", + expression: Optional[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 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.container_type = container_type - self.tail = tail + self.start_time = start_time + self.time_zone = time_zone + self.expression = expression -class ResourceConfiguration(_serialization.Model): - """ResourceConfiguration. +class TriggerBase(_serialization.Model): + """TriggerBase. - :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] - """ + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CronTrigger, RecurrenceTrigger - _attribute_map = { - "instance_count": {"key": "instanceCount", "type": "int"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "properties": {"key": "properties", "type": "{object}"}, - } + All required parameters must be populated in order to send to Azure. - def __init__( - self, - *, - instance_count: int = 1, - instance_type: Optional[str] = None, - properties: Optional[Dict[str, JSON]] = 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] + :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 = { + "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"}, + } + + _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 + ) -> 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.instance_count = instance_count - self.instance_type = instance_type - self.properties = properties + self.end_time = end_time + self.start_time = start_time + self.time_zone = time_zone + self.trigger_type: Optional[str] = None -class DeploymentResourceConfiguration(ResourceConfiguration): - """DeploymentResourceConfiguration. +class CronTrigger(TriggerBase): + """CronTrigger. - :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 Azure. + + :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 = { + "trigger_type": {"required": True}, + "expression": {"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}"}, + "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, *, - instance_count: int = 1, - instance_type: Optional[str] = None, - properties: Optional[Dict[str, JSON]] = None, + expression: str, + end_time: Optional[str] = None, + start_time: Optional[str] = None, + time_zone: str = "UTC", **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 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__(instance_count=instance_count, instance_type=instance_type, properties=properties, **kwargs) + super().__init__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) + self.trigger_type: str = "Cron" + self.expression = expression -class DiagnoseRequestProperties(_serialization.Model): - """DiagnoseRequestProperties. +class CsvExportSummary(ExportSummary): + """CsvExportSummary. - :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] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar container_name: The container name to which the labels will be exported. + :vartype container_name: str + :ivar snapshot_path: The output path where the labels will be exported. + :vartype snapshot_path: str """ + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "container_name": {"readonly": True}, + "snapshot_path": {"readonly": True}, + } + _attribute_map = { - "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}"}, + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "container_name": {"key": "containerName", "type": "str"}, + "snapshot_path": {"key": "snapshotPath", "type": "str"}, } - def __init__( - self, - *, - 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, - **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] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ 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 + self.format: str = "CSV" + self.container_name = None + self.snapshot_path = None -class DiagnoseResponseResult(_serialization.Model): - """DiagnoseResponseResult. +class CustomForecastHorizon(ForecastHorizon): + """The desired maximum forecast horizon in units of time-series frequency. - :ivar value: - :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue + All required parameters must be populated in order to send to Azure. + + :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 = { - "value": {"key": "value", "type": "DiagnoseResponseResultValue"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__(self, *, value: Optional["_models.DiagnoseResponseResultValue"] = None, **kwargs: Any) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :keyword value: - :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue + :keyword value: [Required] Forecast horizon value. Required. + :paramtype value: int """ super().__init__(**kwargs) + self.mode: str = "Custom" self.value = value -class DiagnoseResponseResultValue(_serialization.Model): - """DiagnoseResponseResultValue. +class CustomInferencingServer(InferencingServer): + """Custom inference server configurations. - :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 Azure. + + :ivar server_type: [Required] Inferencing server type for various targets. Required. Known + values are: "AzureMLOnline", "AzureMLBatch", "Triton", and "Custom". + :vartype server_type: str or ~azure.mgmt.machinelearningservices.models.InferencingServerType + :ivar inference_configuration: Inference configuration for custom inferencing. + :vartype inference_configuration: + ~azure.mgmt.machinelearningservices.models.OnlineInferenceConfiguration """ + _validation = { + "server_type": {"required": True}, + } + _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]"}, + "server_type": {"key": "serverType", "type": "str"}, + "inference_configuration": {"key": "inferenceConfiguration", "type": "OnlineInferenceConfiguration"}, } 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, - **kwargs: Any + self, *, inference_configuration: Optional["_models.OnlineInferenceConfiguration"] = 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 inference_configuration: Inference configuration for custom inferencing. + :paramtype inference_configuration: + ~azure.mgmt.machinelearningservices.models.OnlineInferenceConfiguration """ 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 - + self.server_type: str = "Custom" + self.inference_configuration = inference_configuration -class DiagnoseResult(_serialization.Model): - """Result of Diagnose. - Variables are only populated by the server, and will be ignored when sending a request. +class CustomKeys(_serialization.Model): + """Custom Keys credential object. - :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 + :ivar keys: Dictionary of :code:``. + :vartype keys: dict[str, str] """ - _validation = { - "code": {"readonly": True}, - "level": {"readonly": True}, - "message": {"readonly": True}, - } - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "keys": {"key": "keys", "type": "{str}"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, keys: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword keys: Dictionary of :code:``. + :paramtype keys: dict[str, str] + """ super().__init__(**kwargs) - self.code = None - self.level = None - self.message = None + self.keys = keys -class DiagnoseWorkspaceParameters(_serialization.Model): - """Parameters to diagnose a workspace. +class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """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 value: Value of Parameters. - :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties + 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 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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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 = { - "value": {"key": "value", "type": "DiagnoseRequestProperties"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "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": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "CustomKeys"}, } - def __init__(self, *, value: Optional["_models.DiagnoseRequestProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + credentials: Optional["_models.CustomKeys"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Value of Parameters. - :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: Custom Keys credential object. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ - super().__init__(**kwargs) - self.value = value - + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "CustomKeys" + self.credentials = credentials -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 CustomMetricThreshold(_serialization.Model): + """CustomMetricThreshold. All required parameters must be populated in order to send to Azure. - :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 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 = { - "distribution_type": {"required": True}, + "metric": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, + "metric": {"key": "metric", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } - _subtype_map = {"distribution_type": {"Mpi": "Mpi", "PyTorch": "PyTorch", "TensorFlow": "TensorFlow"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, metric: str, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any + ) -> None: + """ + :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__(**kwargs) - self.distribution_type: Optional[str] = None + self.metric = metric + self.threshold = threshold -class Docker(_serialization.Model): - """Docker container configuration. +class CustomModelFineTuning(FineTuningVertical): + """CustomModelFineTuning. - :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 + All required parameters must be populated in order to send to Azure. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :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 = { - "additional_properties": {"key": "", "type": "{object}"}, - "privileged": {"key": "privileged", "type": "bool"}, + "model": {"key": "model", "type": "MLFlowModelJobInput"}, + "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, *, - additional_properties: Optional[Dict[str, Any]] = None, - privileged: Optional[bool] = None, + model: "_models.MLFlowModelJobInput", + 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 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 model: [Required] Input model for fine tuning. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :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.additional_properties = additional_properties - self.privileged = privileged + 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 JobInput(_serialization.Model): + """Command job definition. -class EncryptionKeyVaultProperties(_serialization.Model): - """EncryptionKeyVaultProperties. + 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 Azure. - :ivar key_vault_arm_id: The ArmId of the keyVault where the customer owned encryption key is - present. Required. - :vartype key_vault_arm_id: str - :ivar key_identifier: Key vault uri to access the encryption key. Required. - :vartype key_identifier: str - :ivar identity_client_id: For future use - The client id of the identity which will be used to - access key vault. - :vartype identity_client_id: str + :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 = { - "key_vault_arm_id": {"required": True}, - "key_identifier": {"required": True}, + "job_input_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"}, + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, } - def __init__( - self, *, key_vault_arm_id: str, key_identifier: str, identity_client_id: Optional[str] = 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 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 description: Description for the input. + :paramtype description: 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.description = description + self.job_input_type: Optional[str] = None -class EncryptionProperty(_serialization.Model): - """EncryptionProperty. +class CustomModelJobInput(AssetJobInput, JobInput): + """CustomModelJobInput. All required parameters must be populated in order to send to Azure. - :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 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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str """ _validation = { - "status": {"required": True}, - "key_vault_properties": {"required": True}, + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, - "identity": {"key": "identity", "type": "IdentityForCmk"}, - "key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultProperties"}, + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, } def __init__( self, *, - status: Union[str, "_models.EncryptionStatus"], - key_vault_properties: "_models.EncryptionKeyVaultProperties", - identity: Optional["_models.IdentityForCmk"] = None, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str """ - super().__init__(**kwargs) - self.status = status - self.identity = identity - self.key_vault_properties = key_vault_properties - - -class Endpoint(_serialization.Model): - """Describes the endpoint configuration for the container. + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "custom_model" + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri - :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 + +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 + + All required parameters must be populated in order to send to Azure. + + :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 = { + "job_output_type": {"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"}, + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, } - def __init__( - self, - *, - protocol: Union[str, "_models.Protocol"] = "tcp", - name: Optional[str] = None, - target: Optional[int] = None, - published: Optional[int] = None, - host_ip: Optional[str] = None, - **kwargs: Any - ) -> None: + _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, *, description: Optional[str] = None, **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 description: Description for the output. + :paramtype description: str """ super().__init__(**kwargs) - self.protocol = protocol - self.name = name - self.target = target - self.published = published - self.host_ip = host_ip + self.description = description + self.job_output_type: Optional[str] = None -class EndpointAuthKeys(_serialization.Model): - """Keys for endpoint authentication. +class CustomModelJobOutput(AssetJobOutput, JobOutput): + """CustomModelJobOutput. - :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 Azure. + + :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 asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str + :ivar uri: Output Asset URI. + :vartype uri: str """ + _validation = { + "job_output_type": {"required": True}, + } + _attribute_map = { - "primary_key": {"key": "primaryKey", "type": "str"}, - "secondary_key": {"key": "secondaryKey", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, } def __init__( - self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = None, **kwargs: Any + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = None, + uri: 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 + :keyword description: Description for the output. + :paramtype description: str + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: Output Asset URI. + :paramtype uri: str """ - super().__init__(**kwargs) - self.primary_key = primary_key - self.secondary_key = secondary_key + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) + self.description = description + self.job_output_type: str = "custom_model" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri -class EndpointAuthToken(_serialization.Model): - """Service Token. +class MonitoringSignalBase(_serialization.Model): + """MonitoringSignalBase. - :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 + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CustomMonitoringSignal, DataDriftMonitoringSignal, DataQualityMonitoringSignal, + FeatureAttributionDriftMonitoringSignal, GenerationSafetyQualityMonitoringSignal, + GenerationTokenUsageSignal, ModelPerformanceSignal, PredictionDriftMonitoringSignal + + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType """ + _validation = { + "signal_type": {"required": True}, + } + _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"}, + "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", + "GenerationSafetyQuality": "GenerationSafetyQualityMonitoringSignal", + "GenerationTokenStatistics": "GenerationTokenUsageSignal", + "ModelPerformance": "ModelPerformanceSignal", + "PredictionDrift": "PredictionDriftMonitoringSignal", + } } def __init__( self, *, - access_token: Optional[str] = None, - expiry_time_utc: int = 0, - refresh_after_time_utc: int = 0, - token_type: Optional[str] = None, + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = 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 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.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.notification_types = notification_types + self.properties = properties + self.signal_type: Optional[str] = None -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 CustomMonitoringSignal(MonitoringSignalBase): + """CustomMonitoringSignal. All required parameters must be populated in order to send to Azure. - :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 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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar component_id: [Required] ARM resource ID of the component resource 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] + :ivar workspace_connection: A list of metrics to calculate and their associated thresholds. + :vartype workspace_connection: + ~azure.mgmt.machinelearningservices.models.MonitoringWorkspaceConnection """ _validation = { - "action_type": {"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 = { - "action_type": {"key": "actionType", "type": "str"}, + "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]"}, + "workspace_connection": {"key": "workspaceConnection", "type": "MonitoringWorkspaceConnection"}, } - _subtype_map = {"action_type": {"CreateJob": "JobScheduleAction", "InvokeBatchEndpoint": "EndpointScheduleAction"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.action_type: Optional[str] = None + def __init__( + self, + *, + 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, + workspace_connection: Optional["_models.MonitoringWorkspaceConnection"] = 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 component_id: [Required] ARM resource ID of the component resource 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] + :keyword workspace_connection: A list of metrics to calculate and their associated thresholds. + :paramtype workspace_connection: + ~azure.mgmt.machinelearningservices.models.MonitoringWorkspaceConnection + """ + 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 + self.workspace_connection = workspace_connection -class EndpointScheduleAction(ScheduleActionBase): - """EndpointScheduleAction. +class CustomNCrossValidations(NCrossValidations): + """N-Cross validations are specified by user. All required parameters must be populated in order to send to Azure. - :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. - - - .. raw:: html - - . Required. - :vartype endpoint_invocation_definition: JSON + :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 = { - "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. + :keyword value: [Required] N-Cross validations value. Required. + :paramtype value: int + """ + super().__init__(**kwargs) + self.mode: str = "Custom" + self.value = value - .. 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(Resource): - """Azure Resource Manager resource envelope. - - Variables are only populated by the server, and will be ignored when sending a request. +class CustomSeasonality(Seasonality): + """CustomSeasonality. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "mode": {"required": True}, + "value": {"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"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__(self, *, properties: "_models.EnvironmentContainerProperties", **kwargs: Any) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :keyword value: [Required] Seasonality value. Required. + :paramtype value: int """ super().__init__(**kwargs) - self.properties = properties - + self.mode: str = "Custom" + self.value = value -class EnvironmentContainerProperties(AssetContainer): - """Container for environment specification versions. - Variables are only populated by the server, and will be ignored when sending a request. +class CustomService(_serialization.Model): + """Specifies the custom service configuration. - :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 + :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 """ - _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"}, + "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, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: bool = False, + 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 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 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__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + 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.kernel = kernel -class EnvironmentContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of EnvironmentContainer entities. +class CustomTargetLags(TargetLags): + """CustomTargetLags. - :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] + All required parameters must be populated in order to send to Azure. + + :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 = { + "mode": {"required": True}, + "values": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EnvironmentContainer]"}, + "mode": {"key": "mode", "type": "str"}, + "values": {"key": "values", "type": "[int]"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.EnvironmentContainer"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, values: List[int], **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] + :keyword values: [Required] Set target lags values. Required. + :paramtype values: list[int] """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.mode: str = "Custom" + self.values = values -class EnvironmentVariable(_serialization.Model): - """Environment Variables for the container. +class CustomTargetRollingWindowSize(TargetRollingWindowSize): + """CustomTargetRollingWindowSize. - :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 Azure. + + :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 = { + "mode": {"required": True}, + "value": {"required": True}, + } + _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__( - self, - *, - additional_properties: Optional[Dict[str, Any]] = None, - type: Union[str, "_models.EnvironmentVariableType"] = "local", - value: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: int, **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 + :keyword value: [Required] TargetRollingWindowSize value. Required. + :paramtype value: int """ super().__init__(**kwargs) - self.additional_properties = additional_properties - self.type = type + self.mode: str = "Custom" self.value = value -class EnvironmentVersion(Resource): - """Azure Resource Manager resource envelope. +class DataImportSource(_serialization.Model): + """DataImportSource. - 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: + DatabaseSource, FileSystemSource All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :ivar connection: Workspace connection for data import source storage. + :vartype connection: str + :ivar source_type: [Required] Specifies the type of data. Required. Known values are: + "database" and "file_system". + :vartype source_type: str or ~azure.mgmt.machinelearningservices.models.DataImportSourceType """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "source_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": "EnvironmentVersionProperties"}, + "connection": {"key": "connection", "type": "str"}, + "source_type": {"key": "sourceType", "type": "str"}, } - def __init__(self, *, properties: "_models.EnvironmentVersionProperties", **kwargs: Any) -> None: + _subtype_map = {"source_type": {"database": "DatabaseSource", "file_system": "FileSystemSource"}} + + def __init__(self, *, connection: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :keyword connection: Workspace connection for data import source storage. + :paramtype connection: str """ 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 + self.connection = connection + self.source_type: Optional[str] = None - . 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 DatabaseSource(DataImportSource): + """DatabaseSource. - .. raw:: html + All required parameters must be populated in order to send to Azure. - . - :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 + :ivar connection: Workspace connection for data import source storage. + :vartype connection: str + :ivar source_type: [Required] Specifies the type of data. Required. Known values are: + "database" and "file_system". + :vartype source_type: str or ~azure.mgmt.machinelearningservices.models.DataImportSourceType + :ivar query: SQL Query statement for data import Database source. + :vartype query: str + :ivar stored_procedure: SQL StoredProcedure on data import Database source. + :vartype stored_procedure: str + :ivar stored_procedure_params: SQL StoredProcedure parameters. + :vartype stored_procedure_params: list[dict[str, str]] + :ivar table_name: Name of the table on data import Database source. + :vartype table_name: str """ _validation = { - "environment_type": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "source_type": {"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"}, - "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"}, + "connection": {"key": "connection", "type": "str"}, + "source_type": {"key": "sourceType", "type": "str"}, + "query": {"key": "query", "type": "str"}, + "stored_procedure": {"key": "storedProcedure", "type": "str"}, + "stored_procedure_params": {"key": "storedProcedureParams", "type": "[{str}]"}, + "table_name": {"key": "tableName", "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, + connection: Optional[str] = None, + query: Optional[str] = None, + stored_procedure: Optional[str] = None, + stored_procedure_params: Optional[List[Dict[str, str]]] = None, + table_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 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 + :keyword connection: Workspace connection for data import source storage. + :paramtype connection: str + :keyword query: SQL Query statement for data import Database source. + :paramtype query: str + :keyword stored_procedure: SQL StoredProcedure on data import Database source. + :paramtype stored_procedure: str + :keyword stored_procedure_params: SQL StoredProcedure parameters. + :paramtype stored_procedure_params: list[dict[str, str]] + :keyword table_name: Name of the table on data import Database source. + :paramtype table_name: str + """ + super().__init__(connection=connection, **kwargs) + self.source_type: str = "database" + self.query = query + self.stored_procedure = stored_procedure + self.stored_procedure_params = stored_procedure_params + self.table_name = table_name -class EnvironmentVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of EnvironmentVersion entities. +class DatabricksSchema(_serialization.Model): + """DatabricksSchema. - :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 properties: Properties of Databricks. + :vartype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EnvironmentVersion]"}, + "properties": {"key": "properties", "type": "DatabricksProperties"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.EnvironmentVersion"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.DatabricksProperties"] = 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 properties: Properties of Databricks. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.properties = properties -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. +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. - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON + All required parameters must be populated in order to send to Azure. + + :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 = { - "type": {"readonly": True}, - "info": {"readonly": 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 = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } + "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, **kwargs: Any) -> None: - """ """ + 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.type = None - self.info = None + self.databricks_access_token = databricks_access_token -class ErrorDetail(_serialization.Model): - """The error detail. +class DatabricksComputeSecrets(ComputeSecrets, DatabricksComputeSecretsProperties): + """Secrets related to a Machine Learning compute based on Databricks. - 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: 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 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 = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, + "compute_type": {"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]"}, + "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, + "compute_type": {"key": "computeType", "type": "str"}, } - 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, *, 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 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.). +class DatabricksProperties(_serialization.Model): + """Properties of Databricks. - :ivar error: The error object. - :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :ivar databricks_access_token: Databricks access token. + :vartype databricks_access_token: str + :ivar workspace_url: Workspace Url. + :vartype workspace_url: str """ _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, + "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, + "workspace_url": {"key": "workspaceUrl", "type": "str"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + def __init__( + self, *, databricks_access_token: Optional[str] = None, workspace_url: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :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.error = error + self.databricks_access_token = databricks_access_token + self.workspace_url = workspace_url -class EstimatedVMPrice(_serialization.Model): - """The estimated price info for using a VM of a particular OS type, tier, etc. +class DataCollector(_serialization.Model): + """DataCollector. All required parameters must be populated in order to send to Azure. - :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 + :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 = { - "retail_price": {"required": True}, - "os_type": {"required": True}, - "vm_tier": {"required": True}, + "collections": {"required": True}, } _attribute_map = { - "retail_price": {"key": "retailPrice", "type": "float"}, - "os_type": {"key": "osType", "type": "str"}, - "vm_tier": {"key": "vmTier", "type": "str"}, + "collections": {"key": "collections", "type": "{Collection}"}, + "request_logging": {"key": "requestLogging", "type": "RequestLogging"}, + "rolling_rate": {"key": "rollingRate", "type": "str"}, } def __init__( self, *, - retail_price: float, - os_type: Union[str, "_models.VMPriceOSType"], - vm_tier: Union[str, "_models.VMTier"], + collections: Dict[str, "_models.Collection"], + request_logging: Optional["_models.RequestLogging"] = None, + rolling_rate: Optional[Union[str, "_models.RollingRateType"]] = None, **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 - + :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. -class EstimatedVMPrices(_serialization.Model): - """The estimated price info for using a VM. + 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 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] + :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.DataContainerProperties """ _validation = { - "billing_currency": {"required": True}, - "unit_of_measure": {"required": True}, - "values": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "billing_currency": {"key": "billingCurrency", "type": "str"}, - "unit_of_measure": {"key": "unitOfMeasure", "type": "str"}, - "values": {"key": "values", "type": "[EstimatedVMPrice]"}, + "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"}, } - def __init__( - self, - *, - billing_currency: Union[str, "_models.BillingCurrency"], - unit_of_measure: Union[str, "_models.UnitOfMeasure"], - values: List["_models.EstimatedVMPrice"], - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.DataContainerProperties", **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 properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataContainerProperties """ super().__init__(**kwargs) - self.billing_currency = billing_currency - self.unit_of_measure = unit_of_measure - self.values = values + self.properties = properties -class ExternalFQDNResponse(_serialization.Model): - """ExternalFQDNResponse. +class DataContainerProperties(AssetContainer): + """Container for data asset versions. - :ivar value: - :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar 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 """ + _validation = { + "latest_version": {"readonly": True}, + "next_version": {"readonly": True}, + "data_type": {"required": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[FQDNEndpoints]"}, + "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"}, } - def __init__(self, *, value: Optional[List["_models.FQDNEndpoints"]] = None, **kwargs: Any) -> None: + 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: """ - :keyword value: - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :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 """ - super().__init__(**kwargs) - self.value = value + super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.data_type = data_type -class FeaturizationSettings(_serialization.Model): - """Featurization Configuration. +class DataContainerResourceArmPaginatedResult(_serialization.Model): + """A paginated list of DataContainer entities. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + :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] """ _attribute_map = { - "dataset_language": {"key": "datasetLanguage", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[DataContainer]"}, } - def __init__(self, *, dataset_language: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataContainer"]] = None, **kwargs: Any + ) -> None: """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :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] """ super().__init__(**kwargs) - self.dataset_language = dataset_language + self.next_link = next_link + self.value = value -class FlavorData(_serialization.Model): - """FlavorData. +class DataDriftMonitoringSignal(MonitoringSignalBase): + """DataDriftMonitoringSignal. - :ivar data: Model flavor-specific data. - :vartype data: dict[str, str] + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar data_segment: The data segment used for scoping on a subset of the data population. + :vartype data_segment: ~azure.mgmt.machinelearningservices.models.MonitoringDataSegment + :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 = { - "data": {"key": "data", "type": "{str}"}, + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "data_segment": {"key": "dataSegment", "type": "MonitoringDataSegment"}, + "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, *, data: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword data: Model flavor-specific data. - :paramtype data: dict[str, str] + def __init__( + self, + *, + 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, + data_segment: Optional["_models.MonitoringDataSegment"] = 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: """ - super().__init__(**kwargs) - self.data = data + :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 data_segment: The data segment used for scoping on a subset of the data population. + :paramtype data_segment: ~azure.mgmt.machinelearningservices.models.MonitoringDataSegment + :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.data_segment = data_segment + 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 Forecasting(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Forecasting task in AutoML Table vertical. +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. - :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 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 = { - "task_type": {"required": True}, - "training_data": {"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 = { - "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"}, + "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, *, - 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, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = 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 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__( - 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, + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, **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 + self.compute_type: str = "DataFactory" -class ForecastingSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Forecasting specific parameters. +class DataVersionBaseProperties(AssetBase): + """Data version base definition. - :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 + 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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar stage: Stage in the data lifecycle assigned to this data asset. + :vartype stage: str """ + _validation = { + "data_type": {"required": True}, + "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _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"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "data_type": {"key": "dataType", "type": "str"}, + "data_uri": {"key": "dataUri", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "stage": {"key": "stage", "type": "str"}, + } + + _subtype_map = { + "data_type": {"mltable": "MLTableData", "uri_file": "UriFileDataVersion", "uri_folder": "UriFolderDataVersion"} } 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, + data_uri: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + stage: 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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword stage: Stage in the data lifecycle assigned to this data asset. + :paramtype stage: 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 + super().__init__( + description=description, + properties=properties, + tags=tags, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.data_type: Optional[str] = None + self.data_uri = data_uri + self.intellectual_property = intellectual_property + self.stage = stage -class ForecastingTrainingSettings(TrainingSettings): - """Forecasting Training related configuration. +class DataImport(DataVersionBaseProperties): # pylint: disable=too-many-instance-attributes + """DataImport. - :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] + 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar stage: Stage in the data lifecycle assigned to this data asset. + :vartype stage: str + :ivar asset_name: Name of the asset for data import job to create. + :vartype asset_name: str + :ivar source: Source data of the asset to import from. + :vartype source: ~azure.mgmt.machinelearningservices.models.DataImportSource """ + _validation = { + "data_type": {"required": True}, + "data_uri": {"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]"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "data_type": {"key": "dataType", "type": "str"}, + "data_uri": {"key": "dataUri", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "stage": {"key": "stage", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "source": {"key": "source", "type": "DataImportSource"}, } 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, + data_uri: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + stage: Optional[str] = None, + asset_name: Optional[str] = None, + source: Optional["_models.DataImportSource"] = 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 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword stage: Stage in the data lifecycle assigned to this data asset. + :paramtype stage: str + :keyword asset_name: Name of the asset for data import job to create. + :paramtype asset_name: str + :keyword source: Source data of the asset to import from. + :paramtype source: ~azure.mgmt.machinelearningservices.models.DataImportSource """ 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, + description=description, + properties=properties, + tags=tags, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, + data_uri=data_uri, + intellectual_property=intellectual_property, + stage=stage, **kwargs ) - self.allowed_training_algorithms = allowed_training_algorithms - self.blocked_training_algorithms = blocked_training_algorithms + self.data_type: str = "uri_folder" + self.asset_name = asset_name + self.source = source -class FQDNEndpoint(_serialization.Model): - """FQDNEndpoint. +class DataLakeAnalyticsSchema(_serialization.Model): + """DataLakeAnalyticsSchema. - :ivar domain_name: - :vartype domain_name: str - :ivar endpoint_details: - :vartype endpoint_details: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + :ivar properties: + :vartype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties """ _attribute_map = { - "domain_name": {"key": "domainName", "type": "str"}, - "endpoint_details": {"key": "endpointDetails", "type": "[FQDNEndpointDetail]"}, + "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, } def __init__( - self, - *, - domain_name: Optional[str] = None, - endpoint_details: Optional[List["_models.FQDNEndpointDetail"]] = None, - **kwargs: Any + self, *, properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, **kwargs: Any ) -> None: """ - :keyword domain_name: - :paramtype domain_name: str - :keyword endpoint_details: - :paramtype endpoint_details: - list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + :keyword properties: + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties """ super().__init__(**kwargs) - self.domain_name = domain_name - self.endpoint_details = endpoint_details - - -class FQDNEndpointDetail(_serialization.Model): - """FQDNEndpointDetail. - - :ivar port: - :vartype port: int - """ + self.properties = properties - _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 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. -class FQDNEndpoints(_serialization.Model): - """FQDNEndpoints. + All required parameters must be populated in order to send to Azure. :ivar properties: - :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "FQDNEndpointsProperties"}, - } - - def __init__(self, *, properties: Optional["_models.FQDNEndpointsProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class FQDNEndpointsProperties(_serialization.Model): - """FQDNEndpointsProperties. - - :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 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. - - :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 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 Azure. - - :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 + :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.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 = { @@ -10005,7 +12065,7 @@ class HDInsight(Compute, HDInsightSchema): # pylint: disable=too-many-instance- } _attribute_map = { - "properties": {"key": "properties", "type": "HDInsightProperties"}, + "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, "compute_type": {"key": "computeType", "type": "str"}, "compute_location": {"key": "computeLocation", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, @@ -10021,7 +12081,7 @@ class HDInsight(Compute, HDInsightSchema): # pylint: disable=too-many-instance- def __init__( self, *, - properties: Optional["_models.HDInsightProperties"] = None, + properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, compute_location: Optional[str] = None, description: Optional[str] = None, resource_id: Optional[str] = None, @@ -10029,8 +12089,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword properties: HDInsight compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :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. @@ -10050,7 +12111,7 @@ def __init__( **kwargs ) self.properties = properties - self.compute_type: str = "HDInsight" + self.compute_type: str = "DataLakeAnalytics" self.compute_location = compute_location self.provisioning_state = None self.description = description @@ -10062,2541 +12123,7663 @@ def __init__( self.disable_local_auth = disable_local_auth -class HDInsightProperties(_serialization.Model): - """HDInsight compute properties. +class DataLakeAnalyticsSchemaProperties(_serialization.Model): + """DataLakeAnalyticsSchemaProperties. - :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 + :ivar data_lake_store_account_name: DataLake Store Account Name. + :vartype data_lake_store_account_name: str """ _attribute_map = { - "ssh_port": {"key": "sshPort", "type": "int"}, - "address": {"key": "address", "type": "str"}, - "administrator_account": {"key": "administratorAccount", "type": "VirtualMachineSshCredentials"}, + "data_lake_store_account_name": {"key": "dataLakeStoreAccountName", "type": "str"}, } - def __init__( - self, - *, - ssh_port: Optional[int] = None, - address: Optional[str] = None, - administrator_account: Optional["_models.VirtualMachineSshCredentials"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, data_lake_store_account_name: Optional[str] = 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 data_lake_store_account_name: DataLake Store Account Name. + :paramtype data_lake_store_account_name: str """ super().__init__(**kwargs) - self.ssh_port = ssh_port - self.address = address - self.administrator_account = administrator_account + self.data_lake_store_account_name = data_lake_store_account_name -class IdAssetReference(AssetReferenceBase): - """Reference to an asset via its ARM resource ID. +class DataPathAssetReference(AssetReferenceBase): + """Reference to an asset via its path in a datastore. All required parameters must be populated in order to send to Azure. :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 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 = { "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"}, + "datastore_id": {"key": "datastoreId", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__(self, *, asset_id: str, **kwargs: Any) -> None: + def __init__(self, *, datastore_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword asset_id: [Required] ARM resource ID of the asset. Required. - :paramtype asset_id: str + :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.reference_type: str = "Id" - self.asset_id = asset_id + self.reference_type: str = "DataPath" + self.datastore_id = datastore_id + self.path = path -class IdentityForCmk(_serialization.Model): - """Identity that will be used to access key vault for encryption at rest. +class DataQualityMonitoringSignal(MonitoringSignalBase): + """DataQualityMonitoringSignal. - :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 + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :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 = { + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "production_data": {"required": True}, + "reference_data": {"required": True}, + } + _attribute_map = { - "user_assigned_identity": {"key": "userAssignedIdentity", "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": "[DataQualityMetricThresholdBase]"}, + "production_data": {"key": "productionData", "type": "MonitoringInputDataBase"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = 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 + 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: """ - super().__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity + :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 DatasetExportSummary(ExportSummary): + """DatasetExportSummary. + Variables are only populated by the server, and will be ignored when sending a request. -class IdleShutdownSetting(_serialization.Model): - """Stops compute instance after user defined period of inactivity. + All required parameters must be populated in order to send to Azure. - :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 + :ivar end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar labeled_asset_name: The unique name of the labeled data asset. + :vartype labeled_asset_name: str """ + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "labeled_asset_name": {"readonly": True}, + } + _attribute_map = { - "idle_time_before_shutdown": {"key": "idleTimeBeforeShutdown", "type": "str"}, + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "labeled_asset_name": {"key": "labeledAssetName", "type": "str"}, } - def __init__(self, *, 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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.idle_time_before_shutdown = idle_time_before_shutdown + self.format: str = "Dataset" + self.labeled_asset_name = None -class Image(_serialization.Model): - """Describes the Image Specifications. +class Datastore(ProxyResource): + """Azure Resource Manager resource envelope. - :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 - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "type": {"key": "type", "type": "str"}, - "reference": {"key": "reference", "type": "str"}, - } + All required parameters must be populated in order to send to Azure. - def __init__( - self, - *, - additional_properties: Optional[Dict[str, Any]] = None, - type: Union[str, "_models.ImageType"] = "docker", - reference: Optional[str] = None, - **kwargs: Any - ) -> None: + :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.DatastoreProperties + """ + + _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": "DatastoreProperties"}, + } + + def __init__(self, *, properties: "_models.DatastoreProperties", **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 properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatastoreProperties """ super().__init__(**kwargs) - self.additional_properties = additional_properties - self.type = type - self.reference = reference - + self.properties = properties -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 Azure. +class DatastoreResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Datastore entities. - :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 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] """ - _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"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Datastore]"}, } 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 + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Datastore"]] = 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 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.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size + self.next_link = next_link + self.value = value -class ImageClassificationBase(ImageVertical): - """ImageClassificationBase. +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 Azure. - :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 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 """ _validation = { - "limit_settings": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"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]"}, + "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, *, properties: "_models.DataVersionBaseProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataVersionBaseProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DataVersionBaseResourceArmPaginatedResult(_serialization.Model): + """A paginated list of DataVersionBase entities. + + :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 = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[DataVersionBase]"}, } 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 + self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataVersionBase"]] = 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 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__( - 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.next_link = next_link + self.value = value -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 OnlineScaleSettings(_serialization.Model): + """Online deployment scaling configuration. + + 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 Azure. - :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 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 = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + "scale_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"}, - "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"}, + "scale_type": {"key": "scaleType", "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 + _subtype_map = { + "scale_type": {"Default": "DefaultScaleSettings", "TargetUtilization": "TargetUtilizationScaleSettings"} + } + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.scale_type: Optional[str] = None -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'. + +class DefaultScaleSettings(OnlineScaleSettings): + """DefaultScaleSettings. All required parameters must be populated in order to send to Azure. - :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 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 = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + "scale_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"}, - "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"}, + "scale_type": {"key": "scaleType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.scale_type: str = "Default" + + +class DeploymentLogs(_serialization.Model): + """DeploymentLogs. + + :ivar content: The retrieved online deployment logs. + :vartype content: str + """ + + _attribute_map = { + "content": {"key": "content", "type": "str"}, + } + + def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword content: The retrieved online deployment logs. + :paramtype content: str + """ + super().__init__(**kwargs) + self.content = content + + +class DeploymentLogsRequest(_serialization.Model): + """DeploymentLogsRequest. + + :ivar container_type: The type of container to retrieve logs from. Known values are: + "StorageInitializer", "InferenceServer", and "ModelDataCollector". + :vartype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType + :ivar tail: The maximum number of lines to tail. + :vartype tail: int + """ + + _attribute_map = { + "container_type": {"key": "containerType", "type": "str"}, + "tail": {"key": "tail", "type": "int"}, } 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, + container_type: Optional[Union[str, "_models.ContainerType"]] = None, + tail: Optional[int] = 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 container_type: The type of container to retrieve logs from. Known values are: + "StorageInitializer", "InferenceServer", and "ModelDataCollector". + :paramtype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType + :keyword tail: The maximum number of lines to tail. + :paramtype tail: int """ - 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.container_type = container_type + self.tail = tail -class ImageObjectDetectionBase(ImageVertical): - """ImageObjectDetectionBase. - All required parameters must be populated in order to send to Azure. +class ResourceConfiguration(_serialization.Model): + """ResourceConfiguration. - :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 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 locations: Locations where the job can run. + :vartype locations: list[str] + :ivar max_instance_count: Optional max allowed number of instances or nodes to be used by the + compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :vartype max_instance_count: int + :ivar properties: Additional properties bag. + :vartype properties: dict[str, JSON] """ - _validation = { - "limit_settings": {"required": True}, + _attribute_map = { + "instance_count": {"key": "instanceCount", "type": "int"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "locations": {"key": "locations", "type": "[str]"}, + "max_instance_count": {"key": "maxInstanceCount", "type": "int"}, + "properties": {"key": "properties", "type": "{object}"}, } + def __init__( + self, + *, + instance_count: int = 1, + instance_type: Optional[str] = None, + locations: Optional[List[str]] = None, + max_instance_count: Optional[int] = None, + properties: Optional[Dict[str, JSON]] = 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 locations: Locations where the job can run. + :paramtype locations: list[str] + :keyword max_instance_count: Optional max allowed number of instances or nodes to be used by + the compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :paramtype max_instance_count: int + :keyword properties: Additional properties bag. + :paramtype properties: dict[str, JSON] + """ + super().__init__(**kwargs) + self.instance_count = instance_count + self.instance_type = instance_type + self.locations = locations + self.max_instance_count = max_instance_count + self.properties = properties + + +class DeploymentResourceConfiguration(ResourceConfiguration): + """DeploymentResourceConfiguration. + + :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 locations: Locations where the job can run. + :vartype locations: list[str] + :ivar max_instance_count: Optional max allowed number of instances or nodes to be used by the + compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :vartype max_instance_count: int + :ivar properties: Additional properties bag. + :vartype properties: dict[str, JSON] + """ + _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]"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "locations": {"key": "locations", "type": "[str]"}, + "max_instance_count": {"key": "maxInstanceCount", "type": "int"}, + "properties": {"key": "properties", "type": "{object}"}, } 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, + instance_count: int = 1, + instance_type: Optional[str] = None, + locations: Optional[List[str]] = None, + max_instance_count: Optional[int] = None, + properties: Optional[Dict[str, JSON]] = 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 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 locations: Locations where the job can run. + :paramtype locations: list[str] + :keyword max_instance_count: Optional max allowed number of instances or nodes to be used by + the compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :paramtype max_instance_count: int + :keyword properties: Additional properties bag. + :paramtype properties: dict[str, JSON] """ super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, + instance_count=instance_count, + instance_type=instance_type, + locations=locations, + max_instance_count=max_instance_count, + properties=properties, **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 Azure. +class DestinationAsset(_serialization.Model): + """Publishing destination registry asset information. - :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 + :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 """ - _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"}, + "destination_name": {"key": "destinationName", "type": "str"}, + "destination_version": {"key": "destinationVersion", "type": "str"}, + "registry_name": {"key": "registryName", "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, + destination_name: Optional[str] = None, + destination_version: Optional[str] = None, + registry_name: 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.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 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__( - 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.destination_name = destination_name + self.destination_version = destination_version + self.registry_name = registry_name -class ImageLimitSettings(_serialization.Model): - """Limit settings for the AutoML job. +class DiagnoseRequestProperties(_serialization.Model): + """DiagnoseRequestProperties. - :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 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] """ _attribute_map = { - "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, - "max_trials": {"key": "maxTrials", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "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, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any + 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 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 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.max_concurrent_trials = max_concurrent_trials - self.max_trials = max_trials - self.timeout = timeout + 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 ImageMetadata(_serialization.Model): - """Returns metadata about the operating system image for this compute instance. +class DiagnoseResponseResult(_serialization.Model): + """DiagnoseResponseResult. - :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 value: + :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue """ _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"}, + "value": {"key": "value", "type": "DiagnoseResponseResultValue"}, + } + + def __init__(self, *, value: Optional["_models.DiagnoseResponseResultValue"] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue + """ + super().__init__(**kwargs) + self.value = value + + +class DiagnoseResponseResultValue(_serialization.Model): + """DiagnoseResponseResultValue. + + :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] + """ + + _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]"}, } def __init__( self, *, - current_image_version: Optional[str] = None, - latest_image_version: Optional[str] = None, - is_latest_os_image_version: Optional[bool] = 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 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 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.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.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 ImageModelDistributionSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. +class DiagnoseResult(_serialization.Model): + """Result of Diagnose. - :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 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 = { + "code": {"readonly": True}, + "level": {"readonly": True}, + "message": {"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"}, + "code": {"key": "code", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "message": {"key": "message", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + 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: + :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties + """ + + _attribute_map = { + "value": {"key": "value", "type": "DiagnoseRequestProperties"}, + } + + def __init__(self, *, value: Optional["_models.DiagnoseRequestProperties"] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties + """ + super().__init__(**kwargs) + self.value = value + + +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, Ray, TensorFlow + + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", "Mpi", and "Ray". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + """ + + _validation = { + "distribution_type": {"required": True}, + } + + _attribute_map = { + "distribution_type": {"key": "distributionType", "type": "str"}, + } + + _subtype_map = {"distribution_type": {"Mpi": "Mpi", "PyTorch": "PyTorch", "Ray": "Ray", "TensorFlow": "TensorFlow"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.distribution_type: Optional[str] = None + + +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 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"}, + } + + 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, + additional_properties: Optional[Dict[str, Any]] = None, + privileged: Optional[bool] = 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 additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword privileged: Indicate whether container shall run in privileged or non-privileged mode. + :paramtype privileged: bool """ super().__init__(**kwargs) - self.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.additional_properties = additional_properties + self.privileged = privileged -class ImageModelDistributionSettingsClassification( - ImageModelDistributionSettings -): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. +class DockerCredential(DataReferenceCredential): + """Credential for docker with username and password. - :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. + All required parameters must be populated in order to send to Azure. - :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 + :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 = { + "credential_type": {"required": 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"}, - "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"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "user_name": {"key": "userName", "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: + def __init__(self, *, password: Optional[str] = None, user_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 password: DockerCredential user password. + :paramtype password: str + :keyword user_name: DockerCredential user name. + :paramtype user_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.credential_type: str = "DockerCredentials" + self.password = password + self.user_name = user_name -class ImageModelDistributionSettingsObjectDetection( - ImageModelDistributionSettings -): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. +class EncryptionKeyVaultUpdateProperties(_serialization.Model): + """EncryptionKeyVaultUpdateProperties. - :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. + All required parameters must be populated in order to send to Azure. - :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 key_identifier: Required. + :vartype key_identifier: str """ + _validation = { + "key_identifier": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _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"}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + 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 Azure. + + :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, *, - 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, + 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 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 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__( - 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.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 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 EncryptionUpdateProperties(_serialization.Model): + """EncryptionUpdateProperties. - :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 + All required parameters must be populated in order to send to Azure. + + :ivar key_vault_properties: Required. + :vartype key_vault_properties: + ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultUpdateProperties """ + _validation = { + "key_vault_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"}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultUpdateProperties"}, } - def __init__( # pylint: disable=too-many-locals + 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, *, - 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, + 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 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 protocol: Protocol over which communication will happen over this endpoint. Known + values are: "tcp", "udp", and "http". + :paramtype protocol: str or ~azure.mgmt.machinelearningservices.models.Protocol + :keyword name: Name of the Endpoint. + :paramtype name: str + :keyword target: Application port inside the container. + :paramtype target: int + :keyword published: Port over which the application is exposed from container. + :paramtype published: int + :keyword host_ip: Host IP over which the application is exposed from the container. + :paramtype host_ip: str """ super().__init__(**kwargs) - self.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.protocol = protocol + self.name = name + self.target = target + self.published = published + self.host_ip = host_ip -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 EndpointAuthKeys(_serialization.Model): + """Keys for endpoint authentication. - :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 + :ivar primary_key: The primary key. + :vartype primary_key: str + :ivar secondary_key: The secondary key. + :vartype secondary_key: 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"}, - "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"}, + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "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, - 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 + def __init__( + self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = 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 primary_key: The primary key. + :paramtype primary_key: str + :keyword secondary_key: The secondary key. + :paramtype secondary_key: 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, - **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.primary_key = primary_key + self.secondary_key = secondary_key -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 EndpointAuthToken(_serialization.Model): + """Service Token. - :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. + :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 = { + "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, + *, + 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 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__(**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 EndpointDeploymentModel(_serialization.Model): + """EndpointDeploymentModel. + + :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 + """ + + _attribute_map = { + "format": {"key": "format", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + format: Optional[str] = None, + name: Optional[str] = None, + source: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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__(**kwargs) + self.format = format + self.name = name + self.source = source + self.version = version + + +class EndpointDeploymentResourcePropertiesBasicResource(Resource): + """EndpointDeploymentResourcePropertiesBasicResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties + """ + + _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": "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): + """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, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class EndpointKeys(_serialization.Model): + """EndpointKeys. + + :ivar keys: Dictionary of Keys for the endpoint. + :vartype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + """ + + _attribute_map = { + "keys": {"key": "keys", "type": "AccountApiKeys"}, + } + + def __init__(self, *, keys: Optional["_models.AccountApiKeys"] = None, **kwargs: Any) -> None: + """ + :keyword keys: Dictionary of Keys for the endpoint. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + """ + super().__init__(**kwargs) + self.keys = keys + + +class EndpointModels(_serialization.Model): + """EndpointModels. + + :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.AccountModel] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[AccountModel]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.AccountModel"]] = 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.AccountModel] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class EndpointResourcePropertiesBasicResource(Resource): + """EndpointResourcePropertiesBasicResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar 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 = { + "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__(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): + """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, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.EndpointResourcePropertiesBasicResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class EndpointScheduleAction(ScheduleActionBase): + """EndpointScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", "ImportData", 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 = { + "action_type": {"key": "actionType", "type": "str"}, + "endpoint_invocation_definition": {"key": "endpointInvocationDefinition", "type": "object"}, + } + + 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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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, + *, + 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 EnvironmentContainerResourceArmPaginatedResult(_serialization.Model): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if environment is an + Intellectual Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "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"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "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, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = 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, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if environment is an + Intellectual Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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, + auto_delete_setting=auto_delete_setting, + 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.intellectual_property = intellectual_property + self.os_type = os_type + self.provisioning_state = None + self.stage = stage + + +class EnvironmentVersionResourceArmPaginatedResult(_serialization.Model): + """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 Azure. + + :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 Azure. + + :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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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 Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :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 Azure. + + :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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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): # pylint: disable=too-many-instance-attributes + """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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "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, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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, + auto_delete_setting=auto_delete_setting, + 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): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.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): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "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, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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, + auto_delete_setting=auto_delete_setting, + 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): + """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 Azure. + + :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 FileSystemSource(DataImportSource): + """FileSystemSource. + + All required parameters must be populated in order to send to Azure. + + :ivar connection: Workspace connection for data import source storage. + :vartype connection: str + :ivar source_type: [Required] Specifies the type of data. Required. Known values are: + "database" and "file_system". + :vartype source_type: str or ~azure.mgmt.machinelearningservices.models.DataImportSourceType + :ivar path: Path on data import FileSystem source. + :vartype path: str + """ + + _validation = { + "source_type": {"required": True}, + } + + _attribute_map = { + "connection": {"key": "connection", "type": "str"}, + "source_type": {"key": "sourceType", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, connection: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword connection: Workspace connection for data import source storage. + :paramtype connection: str + :keyword path: Path on data import FileSystem source. + :paramtype path: str + """ + super().__init__(connection=connection, **kwargs) + self.source_type: str = "file_system" + self.path = path + + +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 Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar 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] + """ + + _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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "fine_tuning_details": {"key": "fineTuningDetails", "type": "FineTuningVertical"}, + "outputs": {"key": "outputs", "type": "{JobOutput}"}, + } + + 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, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = None, + services: Optional[Dict[str, "_models.JobService"]] = 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :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] + """ + 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, + secrets_configuration=secrets_configuration, + services=services, + **kwargs + ) + self.job_type: str = "FineTuning" + self.fine_tuning_details = fine_tuning_details + self.outputs = outputs + + +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 Azure. + + :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 Azure. + + :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 Azure. + + :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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :ivar test_data: Test data input. + :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation + 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"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "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, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + 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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :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 search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :keyword test_data: Test data input. + :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation + 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, + fixed_parameters=fixed_parameters, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + 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.fixed_parameters = fixed_parameters + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + 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 features_unknown_at_forecast_time: The feature columns that are available for training + but unknown at the time of forecast/inference. + If features_unknown_at_forecast_time is not set, it is assumed that all the feature columns in + the dataset are known at inference time. + :vartype features_unknown_at_forecast_time: list[str] + :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"}, + "features_unknown_at_forecast_time": {"key": "featuresUnknownAtForecastTime", "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, + features_unknown_at_forecast_time: Optional[List[str]] = 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 features_unknown_at_forecast_time: The feature columns that are available for training + but unknown at the time of forecast/inference. + If features_unknown_at_forecast_time is not set, it is assumed that all the feature columns in + the dataset are known at inference time. + :paramtype features_unknown_at_forecast_time: list[str] + :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.features_unknown_at_forecast_time = features_unknown_at_forecast_time + 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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :ivar allowed_training_algorithms: Allowed models for forecasting task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :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"}, + "training_mode": {"key": "trainingMode", "type": "str"}, + "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, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, + **kwargs: 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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :keyword allowed_training_algorithms: Allowed models for forecasting task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :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, + training_mode=training_mode, + **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 + + All required parameters must be populated in order to send to Azure. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :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 = { + "type": {"required": True}, + } + + _attribute_map = { + "category": {"key": "category", "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", and "UserDefined". + :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.status = status + self.type: Optional[str] = None + + +class FqdnOutboundRule(OutboundRule): + """FQDN Outbound Rule for the managed network of a machine learning workspace. + + All required parameters must be populated in order to send to Azure. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :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 = { + "type": {"required": True}, + } + + _attribute_map = { + "category": {"key": "category", "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", and "UserDefined". + :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 GenerationSafetyQualityMetricThreshold(_serialization.Model): + """Generation safety quality metric threshold definition. + + All required parameters must be populated in order to send to Azure. + + :ivar metric: [Required] Gets or sets the feature attribution metric to calculate. Required. + Known values are: "AcceptableGroundednessScorePerInstance", "AggregatedGroundednessPassRate", + "AcceptableCoherenceScorePerInstance", "AggregatedCoherencePassRate", + "AcceptableFluencyScorePerInstance", "AggregatedFluencyPassRate", + "AcceptableSimilarityScorePerInstance", "AggregatedSimilarityPassRate", + "AcceptableRelevanceScorePerInstance", and "AggregatedRelevancePassRate". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.GenerationSafetyQualityMetric + :ivar threshold: Gets or sets 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.GenerationSafetyQualityMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any + ) -> None: + """ + :keyword metric: [Required] Gets or sets the feature attribution metric to calculate. Required. + Known values are: "AcceptableGroundednessScorePerInstance", "AggregatedGroundednessPassRate", + "AcceptableCoherenceScorePerInstance", "AggregatedCoherencePassRate", + "AcceptableFluencyScorePerInstance", "AggregatedFluencyPassRate", + "AcceptableSimilarityScorePerInstance", "AggregatedSimilarityPassRate", + "AcceptableRelevanceScorePerInstance", and "AggregatedRelevancePassRate". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.GenerationSafetyQualityMetric + :keyword threshold: Gets or sets 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 GenerationSafetyQualityMonitoringSignal(MonitoringSignalBase): + """Generation safety quality monitoring signal definition. + + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar metric_thresholds: [Required] Gets or sets the metrics to calculate and the corresponding + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.GenerationSafetyQualityMetricThreshold] + :ivar production_data: Gets or sets the production data for computing metrics. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar sampling_rate: [Required] The sample rate of the production data, should be greater than + 0 and at most 1. Required. + :vartype sampling_rate: float + :ivar workspace_connection_id: Gets or sets the workspace connection ID used to connect to the + content generation endpoint. + :vartype workspace_connection_id: str + """ + + _validation = { + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "sampling_rate": {"required": True}, + } + + _attribute_map = { + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[GenerationSafetyQualityMetricThreshold]"}, + "production_data": {"key": "productionData", "type": "[MonitoringInputDataBase]"}, + "sampling_rate": {"key": "samplingRate", "type": "float"}, + "workspace_connection_id": {"key": "workspaceConnectionId", "type": "str"}, + } + + def __init__( + self, + *, + metric_thresholds: List["_models.GenerationSafetyQualityMetricThreshold"], + sampling_rate: float, + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + production_data: Optional[List["_models.MonitoringInputDataBase"]] = None, + workspace_connection_id: Optional[str] = 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 metric_thresholds: [Required] Gets or sets the metrics to calculate and the + corresponding thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.GenerationSafetyQualityMetricThreshold] + :keyword production_data: Gets or sets the production data for computing metrics. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword sampling_rate: [Required] The sample rate of the production data, should be greater + than 0 and at most 1. Required. + :paramtype sampling_rate: float + :keyword workspace_connection_id: Gets or sets the workspace connection ID used to connect to + the content generation endpoint. + :paramtype workspace_connection_id: str + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "GenerationSafetyQuality" + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.sampling_rate = sampling_rate + self.workspace_connection_id = workspace_connection_id + + +class GenerationTokenUsageMetricThreshold(_serialization.Model): + """Generation token statistics metric threshold definition. + + All required parameters must be populated in order to send to Azure. + + :ivar metric: [Required] Gets or sets the feature attribution metric to calculate. Required. + Known values are: "TotalTokenCount" and "TotalTokenCountPerGroup". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.GenerationTokenUsageMetric + :ivar threshold: Gets or sets 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.GenerationTokenUsageMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any + ) -> None: + """ + :keyword metric: [Required] Gets or sets the feature attribution metric to calculate. Required. + Known values are: "TotalTokenCount" and "TotalTokenCountPerGroup". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.GenerationTokenUsageMetric + :keyword threshold: Gets or sets 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 GenerationTokenUsageSignal(MonitoringSignalBase): + """Generation token usage signal definition. + + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar metric_thresholds: [Required] Gets or sets the metrics to calculate and the corresponding + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.GenerationTokenUsageMetricThreshold] + :ivar production_data: Gets or sets the production data for computing metrics. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar sampling_rate: [Required] The sample rate of the production data, should be greater than + 0 and at most 1. Required. + :vartype sampling_rate: float + """ + + _validation = { + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "sampling_rate": {"required": True}, + } + + _attribute_map = { + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[GenerationTokenUsageMetricThreshold]"}, + "production_data": {"key": "productionData", "type": "[MonitoringInputDataBase]"}, + "sampling_rate": {"key": "samplingRate", "type": "float"}, + } + + def __init__( + self, + *, + metric_thresholds: List["_models.GenerationTokenUsageMetricThreshold"], + sampling_rate: float, + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + production_data: Optional[List["_models.MonitoringInputDataBase"]] = 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 metric_thresholds: [Required] Gets or sets the metrics to calculate and the + corresponding thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.GenerationTokenUsageMetricThreshold] + :keyword production_data: Gets or sets the production data for computing metrics. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword sampling_rate: [Required] The sample rate of the production data, should be greater + than 0 and at most 1. Required. + :paramtype sampling_rate: float + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "GenerationTokenStatistics" + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.sampling_rate = sampling_rate + + +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 Azure. + + :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 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 bonus_extra_capacity: Gets or sets capacity used from the pool's reserved capacity. + :vartype bonus_extra_capacity: int + :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"}, + "bonus_extra_capacity": {"key": "bonusExtraCapacity", "type": "int"}, + "endpoint_count": {"key": "endpointCount", "type": "int"}, + "requested_capacity": {"key": "requestedCapacity", "type": "int"}, + } + + def __init__( + self, + *, + actual_capacity_info: Optional["_models.ActualCapacityInfo"] = None, + bonus_extra_capacity: int = 0, + 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 bonus_extra_capacity: Gets or sets capacity used from the pool's reserved capacity. + :paramtype bonus_extra_capacity: int + :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.bonus_extra_capacity = bonus_extra_capacity + self.endpoint_count = endpoint_count + self.requested_capacity = requested_capacity + + +class HdfsDatastore(DatastoreProperties): + """HdfsDatastore. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar credentials: [Required] Account credentials. Required. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", "Hdfs", and "OneLake". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar is_default: Readonly property to indicate if datastore is the workspace default + datastore. + :vartype is_default: bool + :ivar hdfs_server_certificate: The TLS cert of the HDFS server. Needs to be a base64 encoded + string. Required if "Https" protocol is selected. + :vartype hdfs_server_certificate: str + :ivar name_node_address: [Required] IP Address or DNS HostName. Required. + :vartype name_node_address: str + :ivar protocol: Protocol used to communicate with the storage account (Https/Http). + :vartype protocol: str + """ + + _validation = { + "credentials": {"required": True}, + "datastore_type": {"required": True}, + "is_default": {"readonly": True}, + "name_node_address": {"required": True, "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"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "is_default": {"key": "isDefault", "type": "bool"}, + "hdfs_server_certificate": {"key": "hdfsServerCertificate", "type": "str"}, + "name_node_address": {"key": "nameNodeAddress", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + } + + def __init__( + self, + *, + credentials: "_models.DatastoreCredentials", + name_node_address: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + hdfs_server_certificate: Optional[str] = None, + protocol: str = "http", + **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 intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword hdfs_server_certificate: The TLS cert of the HDFS server. Needs to be a base64 encoded + string. Required if "Https" protocol is selected. + :paramtype hdfs_server_certificate: str + :keyword name_node_address: [Required] IP Address or DNS HostName. Required. + :paramtype name_node_address: str + :keyword protocol: Protocol used to communicate with the storage account (Https/Http). + :paramtype protocol: str + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + credentials=credentials, + intellectual_property=intellectual_property, + **kwargs + ) + self.datastore_type: str = "Hdfs" + self.hdfs_server_certificate = hdfs_server_certificate + self.name_node_address = name_node_address + self.protocol = protocol + + +class HDInsightSchema(_serialization.Model): + """HDInsightSchema. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 Azure. + + :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 + """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 + """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 @@ -12677,6 +19860,14 @@ class ImageModelSettingsObjectDetection(ImageModelSettings): # pylint: disable= 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 log_training_metrics: Enable computing and logging training metrics. Known values are: + "Enable" and "Disable". + :vartype log_training_metrics: str or + ~azure.mgmt.machinelearningservices.models.LogTrainingMetrics + :ivar log_validation_loss: Enable computing and logging validation loss. Known values are: + "Enable" and "Disable". + :vartype log_validation_loss: str or + ~azure.mgmt.machinelearningservices.models.LogValidationLoss :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. @@ -12721,1514 +19912,7636 @@ class ImageModelSettingsObjectDetection(ImageModelSettings): # pylint: disable= """ _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"}, + "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"}, + "log_training_metrics": {"key": "logTrainingMetrics", "type": "str"}, + "log_validation_loss": {"key": "logValidationLoss", "type": "str"}, + "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, + log_training_metrics: Optional[Union[str, "_models.LogTrainingMetrics"]] = None, + log_validation_loss: Optional[Union[str, "_models.LogValidationLoss"]] = 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 log_training_metrics: Enable computing and logging training metrics. Known values are: + "Enable" and "Disable". + :paramtype log_training_metrics: str or + ~azure.mgmt.machinelearningservices.models.LogTrainingMetrics + :keyword log_validation_loss: Enable computing and logging validation loss. Known values are: + "Enable" and "Disable". + :paramtype log_validation_loss: str or + ~azure.mgmt.machinelearningservices.models.LogValidationLoss + :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.log_training_metrics = log_training_metrics + self.log_validation_loss = log_validation_loss + 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 Azure. + + :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 Azure. + + :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 ImportDataAction(ScheduleActionBase): + """ImportDataAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", "ImportData", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar data_import_definition: [Required] Defines Schedule action definition details. Required. + :vartype data_import_definition: ~azure.mgmt.machinelearningservices.models.DataImport + """ + + _validation = { + "action_type": {"required": True}, + "data_import_definition": {"required": True}, + } + + _attribute_map = { + "action_type": {"key": "actionType", "type": "str"}, + "data_import_definition": {"key": "dataImportDefinition", "type": "DataImport"}, + } + + def __init__(self, *, data_import_definition: "_models.DataImport", **kwargs: Any) -> None: + """ + :keyword data_import_definition: [Required] Defines Schedule action definition details. + Required. + :paramtype data_import_definition: ~azure.mgmt.machinelearningservices.models.DataImport + """ + super().__init__(**kwargs) + self.action_type: str = "ImportData" + self.data_import_definition = data_import_definition + + +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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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: dict[str, str] + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + } + + def __init__( + self, *, description: Optional[str] = None, properties: Optional[Dict[str, str]] = 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: dict[str, str] + """ + 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 Azure. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :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_id: [Required] Group within the same pool with which this endpoint needs to be + associated with. Required. + :vartype group_id: 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 + """ + + _validation = { + "auth_mode": {"required": True}, + "endpoint_uri": {"readonly": True}, + "group_id": {"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": "{str}"}, + "auth_mode": {"key": "authMode", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + auth_mode: Union[str, "_models.AuthMode"], + group_id: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = 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: dict[str, str] + :keyword auth_mode: [Required] Authentication mode for the endpoint. Required. "AAD" + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.AuthMode + :keyword group_id: [Required] Group within the same pool with which this endpoint needs to be + associated with. Required. + :paramtype group_id: str + """ + super().__init__(description=description, properties=properties, **kwargs) + self.auth_mode = auth_mode + self.endpoint_uri = None + self.group_id = group_id + self.provisioning_state = None + + +class InferenceEndpointTrackedResourceArmPaginatedResult(_serialization.Model): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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: dict[str, str] + :ivar bonus_extra_capacity: Capacity to be used from the pool's reserved capacity. + optional. + :vartype bonus_extra_capacity: int + :ivar metadata: Metadata for the inference group. + :vartype metadata: str + :ivar priority: Priority of the group within the + N:Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20240101Preview.Pools.InferencePools. + :vartype priority: int + :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 + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "bonus_extra_capacity": {"key": "bonusExtraCapacity", "type": "int"}, + "metadata": {"key": "metadata", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + bonus_extra_capacity: int = 0, + metadata: Optional[str] = None, + priority: int = 0, + **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: dict[str, str] + :keyword bonus_extra_capacity: Capacity to be used from the pool's reserved capacity. + optional. + :paramtype bonus_extra_capacity: int + :keyword metadata: Metadata for the inference group. + :paramtype metadata: str + :keyword priority: Priority of the group within the + N:Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20240101Preview.Pools.InferencePools. + :paramtype priority: int + """ + super().__init__(description=description, properties=properties, **kwargs) + self.bonus_extra_capacity = bonus_extra_capacity + self.metadata = metadata + self.priority = priority + self.provisioning_state = None + + +class InferenceGroupTrackedResourceArmPaginatedResult(_serialization.Model): + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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. + + All required parameters must be populated in order to send to Azure. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar code_configuration: Code configuration for the inference pool. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :ivar environment_configuration: EnvironmentConfiguration for the inference pool. + :vartype environment_configuration: + ~azure.mgmt.machinelearningservices.models.PoolEnvironmentConfiguration + :ivar model_configuration: ModelConfiguration for the inference pool. + :vartype model_configuration: ~azure.mgmt.machinelearningservices.models.PoolModelConfiguration + :ivar node_sku_type: [Required] Compute instance type. Required. + :vartype node_sku_type: str + :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 request_configuration: Request configuration for the inference pool. + :vartype request_configuration: ~azure.mgmt.machinelearningservices.models.RequestConfiguration + """ + + _validation = { + "node_sku_type": {"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": "{str}"}, + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + "environment_configuration": {"key": "environmentConfiguration", "type": "PoolEnvironmentConfiguration"}, + "model_configuration": {"key": "modelConfiguration", "type": "PoolModelConfiguration"}, + "node_sku_type": {"key": "nodeSkuType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "request_configuration": {"key": "requestConfiguration", "type": "RequestConfiguration"}, + } + + def __init__( + self, + *, + node_sku_type: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + code_configuration: Optional["_models.CodeConfiguration"] = None, + environment_configuration: Optional["_models.PoolEnvironmentConfiguration"] = None, + model_configuration: Optional["_models.PoolModelConfiguration"] = 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: dict[str, str] + :keyword code_configuration: Code configuration for the inference pool. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :keyword environment_configuration: EnvironmentConfiguration for the inference pool. + :paramtype environment_configuration: + ~azure.mgmt.machinelearningservices.models.PoolEnvironmentConfiguration + :keyword model_configuration: ModelConfiguration for the inference pool. + :paramtype model_configuration: + ~azure.mgmt.machinelearningservices.models.PoolModelConfiguration + :keyword node_sku_type: [Required] Compute instance type. Required. + :paramtype node_sku_type: str + :keyword request_configuration: Request configuration for the inference pool. + :paramtype request_configuration: + ~azure.mgmt.machinelearningservices.models.RequestConfiguration + """ + super().__init__(description=description, properties=properties, **kwargs) + self.code_configuration = code_configuration + self.environment_configuration = environment_configuration + self.model_configuration = model_configuration + self.node_sku_type = node_sku_type + self.provisioning_state = None + self.request_configuration = request_configuration + + +class InferencePoolTrackedResourceArmPaginatedResult(_serialization.Model): + """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 IntellectualProperty(_serialization.Model): + """Intellectual Property details for a resource. + + All required parameters must be populated in order to send to Azure. + + :ivar protection_level: Protection level of the Intellectual Property. Known values are: "All" + and "None". + :vartype protection_level: str or ~azure.mgmt.machinelearningservices.models.ProtectionLevel + :ivar publisher: [Required] Publisher of the Intellectual Property. Must be the same as + Registry publisher name. Required. + :vartype publisher: str + """ + + _validation = { + "publisher": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "protection_level": {"key": "protectionLevel", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + } + + def __init__( + self, *, publisher: str, protection_level: Optional[Union[str, "_models.ProtectionLevel"]] = None, **kwargs: Any + ) -> None: + """ + :keyword protection_level: Protection level of the Intellectual Property. Known values are: + "All" and "None". + :paramtype protection_level: str or ~azure.mgmt.machinelearningservices.models.ProtectionLevel + :keyword publisher: [Required] Publisher of the Intellectual Property. Must be the same as + Registry publisher name. Required. + :paramtype publisher: str + """ + super().__init__(**kwargs) + self.protection_level = protection_level + self.publisher = publisher + + +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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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 locations: Locations where the job can run. + :vartype locations: list[str] + :ivar max_instance_count: Optional max allowed number of instances or nodes to be used by the + compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :vartype max_instance_count: int + :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"}, + "locations": {"key": "locations", "type": "[str]"}, + "max_instance_count": {"key": "maxInstanceCount", "type": "int"}, + "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, + locations: Optional[List[str]] = None, + max_instance_count: Optional[int] = 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 locations: Locations where the job can run. + :paramtype locations: list[str] + :keyword max_instance_count: Optional max allowed number of instances or nodes to be used by + the compute target. + For use with elastic training, currently supported by PyTorch distribution type only. + :paramtype max_instance_count: int + :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, + locations=locations, + max_instance_count=max_instance_count, + properties=properties, + **kwargs + ) + self.docker_args = docker_args + self.shm_size = shm_size + + +class JobScheduleAction(ScheduleActionBase): + """JobScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", "ImportData", 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 set by user. + :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 set by user. + :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 KerberosCredentials(_serialization.Model): + """KerberosCredentials. + + All required parameters must be populated in order to send to Azure. + + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str + """ + + _validation = { + "kerberos_kdc_address": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, + } + + def __init__( + self, *, kerberos_kdc_address: str, kerberos_principal: str, kerberos_realm: str, **kwargs: Any + ) -> None: + """ + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str + """ + super().__init__(**kwargs) + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm + + +class KerberosKeytabCredentials(KerberosCredentials, DatastoreCredentials): + """KerberosKeytabCredentials. + + All required parameters must be populated in order to send to Azure. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str + :ivar secrets: [Required] Keytab secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.KerberosKeytabSecrets + """ + + _validation = { + "credentials_type": {"required": True}, + "kerberos_kdc_address": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "secrets": {"required": True}, + } + + _attribute_map = { + "credentials_type": {"key": "credentialsType", "type": "str"}, + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, + "secrets": {"key": "secrets", "type": "KerberosKeytabSecrets"}, + } + + def __init__( + self, + *, + kerberos_kdc_address: str, + kerberos_principal: str, + kerberos_realm: str, + secrets: "_models.KerberosKeytabSecrets", + **kwargs: Any + ) -> None: + """ + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str + :keyword secrets: [Required] Keytab secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.KerberosKeytabSecrets + """ + super().__init__( + kerberos_kdc_address=kerberos_kdc_address, + kerberos_principal=kerberos_principal, + kerberos_realm=kerberos_realm, + **kwargs + ) + self.credentials_type: str = "KerberosKeytab" + self.secrets = secrets + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm + + +class KerberosKeytabSecrets(DatastoreSecrets): + """KerberosKeytabSecrets. + + All required parameters must be populated in order to send to Azure. + + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar kerberos_keytab: Kerberos keytab secret. + :vartype kerberos_keytab: str + """ + + _validation = { + "secrets_type": {"required": True}, + } + + _attribute_map = { + "secrets_type": {"key": "secretsType", "type": "str"}, + "kerberos_keytab": {"key": "kerberosKeytab", "type": "str"}, + } + + def __init__(self, *, kerberos_keytab: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword kerberos_keytab: Kerberos keytab secret. + :paramtype kerberos_keytab: str + """ + super().__init__(**kwargs) + self.secrets_type: str = "KerberosKeytab" + self.kerberos_keytab = kerberos_keytab + + +class KerberosPasswordCredentials(KerberosCredentials, DatastoreCredentials): + """KerberosPasswordCredentials. + + All required parameters must be populated in order to send to Azure. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str + :ivar secrets: [Required] Kerberos password secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.KerberosPasswordSecrets + """ + + _validation = { + "credentials_type": {"required": True}, + "kerberos_kdc_address": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "secrets": {"required": True}, + } + + _attribute_map = { + "credentials_type": {"key": "credentialsType", "type": "str"}, + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, + "secrets": {"key": "secrets", "type": "KerberosPasswordSecrets"}, + } + + def __init__( + self, + *, + kerberos_kdc_address: str, + kerberos_principal: str, + kerberos_realm: str, + secrets: "_models.KerberosPasswordSecrets", + **kwargs: Any + ) -> None: + """ + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str + :keyword secrets: [Required] Kerberos password secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.KerberosPasswordSecrets + """ + super().__init__( + kerberos_kdc_address=kerberos_kdc_address, + kerberos_principal=kerberos_principal, + kerberos_realm=kerberos_realm, + **kwargs + ) + self.credentials_type: str = "KerberosPassword" + self.secrets = secrets + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm + + +class KerberosPasswordSecrets(DatastoreSecrets): + """KerberosPasswordSecrets. + + All required parameters must be populated in order to send to Azure. + + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar kerberos_password: Kerberos password secret. + :vartype kerberos_password: str + """ + + _validation = { + "secrets_type": {"required": True}, + } + + _attribute_map = { + "secrets_type": {"key": "secretsType", "type": "str"}, + "kerberos_password": {"key": "kerberosPassword", "type": "str"}, + } + + def __init__(self, *, kerberos_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword kerberos_password: Kerberos password secret. + :paramtype kerberos_password: str + """ + super().__init__(**kwargs) + self.secrets_type: str = "KerberosPassword" + self.kerberos_password = kerberos_password + + +class KeyVaultProperties(_serialization.Model): + """Customer Key vault properties. + + All required parameters must be populated in order to send to Azure. + + :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 Azure. + + :ivar properties: Properties of Kubernetes. + :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", + "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", "HDInsight", "Databricks", + "DataLakeAnalytics", and "SynapseSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType + :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 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 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 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 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 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 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 LabelCategory(_serialization.Model): + """Label category definition. + + :ivar classes: Dictionary of label classes in this category. + :vartype classes: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + :ivar display_name: Display name of the label category. + :vartype display_name: str + :ivar multi_select: Indicates whether it is allowed to select multiple classes in this + category. Known values are: "Enabled" and "Disabled". + :vartype multi_select: str or ~azure.mgmt.machinelearningservices.models.MultiSelect + """ + + _attribute_map = { + "classes": {"key": "classes", "type": "{LabelClass}"}, + "display_name": {"key": "displayName", "type": "str"}, + "multi_select": {"key": "multiSelect", "type": "str"}, + } + + def __init__( + self, + *, + classes: Optional[Dict[str, "_models.LabelClass"]] = None, + display_name: Optional[str] = None, + multi_select: Optional[Union[str, "_models.MultiSelect"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword classes: Dictionary of label classes in this category. + :paramtype classes: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + :keyword display_name: Display name of the label category. + :paramtype display_name: str + :keyword multi_select: Indicates whether it is allowed to select multiple classes in this + category. Known values are: "Enabled" and "Disabled". + :paramtype multi_select: str or ~azure.mgmt.machinelearningservices.models.MultiSelect + """ + super().__init__(**kwargs) + self.classes = classes + self.display_name = display_name + self.multi_select = multi_select + + +class LabelClass(_serialization.Model): + """Label class definition. + + :ivar display_name: Display name of the label class. + :vartype display_name: str + :ivar subclasses: Dictionary of subclasses of the label class. + :vartype subclasses: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + """ + + _attribute_map = { + "display_name": {"key": "displayName", "type": "str"}, + "subclasses": {"key": "subclasses", "type": "{LabelClass}"}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + subclasses: Optional[Dict[str, "_models.LabelClass"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_name: Display name of the label class. + :paramtype display_name: str + :keyword subclasses: Dictionary of subclasses of the label class. + :paramtype subclasses: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + """ + super().__init__(**kwargs) + self.display_name = display_name + self.subclasses = subclasses + + +class LabelingDataConfiguration(_serialization.Model): + """Labeling data configuration definition. + + :ivar data_id: Resource Id of the data asset to perform labeling. + :vartype data_id: str + :ivar incremental_data_refresh: Indicates whether to enable incremental data refresh. Known + values are: "Enabled" and "Disabled". + :vartype incremental_data_refresh: str or + ~azure.mgmt.machinelearningservices.models.IncrementalDataRefresh + """ + + _attribute_map = { + "data_id": {"key": "dataId", "type": "str"}, + "incremental_data_refresh": {"key": "incrementalDataRefresh", "type": "str"}, + } + + def __init__( + self, + *, + data_id: Optional[str] = None, + incremental_data_refresh: Optional[Union[str, "_models.IncrementalDataRefresh"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_id: Resource Id of the data asset to perform labeling. + :paramtype data_id: str + :keyword incremental_data_refresh: Indicates whether to enable incremental data refresh. Known + values are: "Enabled" and "Disabled". + :paramtype incremental_data_refresh: str or + ~azure.mgmt.machinelearningservices.models.IncrementalDataRefresh + """ + super().__init__(**kwargs) + self.data_id = data_id + self.incremental_data_refresh = incremental_data_refresh + + +class LabelingJob(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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties + """ + + _validation = { + "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": "LabelingJobProperties"}, + } + + def __init__(self, *, properties: "_models.LabelingJobProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class LabelingJobMediaProperties(_serialization.Model): + """Properties of a labeling job. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LabelingJobImageProperties, LabelingJobTextProperties + + All required parameters must be populated in order to send to Azure. + + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType + """ + + _validation = { + "media_type": {"required": True}, + } + + _attribute_map = { + "media_type": {"key": "mediaType", "type": "str"}, + } + + _subtype_map = {"media_type": {"Image": "LabelingJobImageProperties", "Text": "LabelingJobTextProperties"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.media_type: Optional[str] = None + + +class LabelingJobImageProperties(LabelingJobMediaProperties): + """Properties of a labeling job for image data. + + All required parameters must be populated in order to send to Azure. + + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType + :ivar annotation_type: Annotation type of image labeling job. Known values are: + "Classification", "BoundingBox", and "InstanceSegmentation". + :vartype annotation_type: str or ~azure.mgmt.machinelearningservices.models.ImageAnnotationType + """ + + _validation = { + "media_type": {"required": True}, + } + + _attribute_map = { + "media_type": {"key": "mediaType", "type": "str"}, + "annotation_type": {"key": "annotationType", "type": "str"}, + } + + def __init__( + self, *, annotation_type: Optional[Union[str, "_models.ImageAnnotationType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword annotation_type: Annotation type of image labeling job. Known values are: + "Classification", "BoundingBox", and "InstanceSegmentation". + :paramtype annotation_type: str or + ~azure.mgmt.machinelearningservices.models.ImageAnnotationType + """ + super().__init__(**kwargs) + self.media_type: str = "Image" + self.annotation_type = annotation_type + + +class LabelingJobInstructions(_serialization.Model): + """Instructions for labeling job. + + :ivar uri: The link to a page with detailed labeling instructions for labelers. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword uri: The link to a page with detailed labeling instructions for labelers. + :paramtype uri: str + """ + super().__init__(**kwargs) + self.uri = uri + + +class LabelingJobProperties(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Labeling job definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar created_date_time: Created time of the job in UTC timezone. + :vartype created_date_time: ~datetime.datetime + :ivar data_configuration: Configuration of data used in the job. + :vartype data_configuration: + ~azure.mgmt.machinelearningservices.models.LabelingDataConfiguration + :ivar job_instructions: Labeling instructions of the job. + :vartype job_instructions: ~azure.mgmt.machinelearningservices.models.LabelingJobInstructions + :ivar label_categories: Label categories of the job. + :vartype label_categories: dict[str, ~azure.mgmt.machinelearningservices.models.LabelCategory] + :ivar labeling_job_media_properties: Media type specific properties in the job. + :vartype labeling_job_media_properties: + ~azure.mgmt.machinelearningservices.models.LabelingJobMediaProperties + :ivar ml_assist_configuration: Configuration of MLAssist feature in the job. + :vartype ml_assist_configuration: + ~azure.mgmt.machinelearningservices.models.MLAssistConfiguration + :ivar progress_metrics: Progress metrics of the job. + :vartype progress_metrics: ~azure.mgmt.machinelearningservices.models.ProgressMetrics + :ivar project_id: Internal id of the job(Previously called project). + :vartype project_id: str + :ivar provisioning_state: Specifies the labeling job provisioning state. Known values are: + "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.JobProvisioningState + :ivar status_messages: Status messages of the job. + :vartype status_messages: list[~azure.mgmt.machinelearningservices.models.StatusMessage] + """ + + _validation = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "created_date_time": {"readonly": True}, + "progress_metrics": {"readonly": True}, + "project_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status_messages": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "component_id": {"key": "componentId", "type": "str"}, + "compute_id": {"key": "computeId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "experiment_name": {"key": "experimentName", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityConfiguration"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "job_type": {"key": "jobType", "type": "str"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, + "data_configuration": {"key": "dataConfiguration", "type": "LabelingDataConfiguration"}, + "job_instructions": {"key": "jobInstructions", "type": "LabelingJobInstructions"}, + "label_categories": {"key": "labelCategories", "type": "{LabelCategory}"}, + "labeling_job_media_properties": {"key": "labelingJobMediaProperties", "type": "LabelingJobMediaProperties"}, + "ml_assist_configuration": {"key": "mlAssistConfiguration", "type": "MLAssistConfiguration"}, + "progress_metrics": {"key": "progressMetrics", "type": "ProgressMetrics"}, + "project_id": {"key": "projectId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "status_messages": {"key": "statusMessages", "type": "[StatusMessage]"}, + } + + def __init__( # pylint: disable=too-many-locals + 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = None, + services: Optional[Dict[str, "_models.JobService"]] = None, + data_configuration: Optional["_models.LabelingDataConfiguration"] = None, + job_instructions: Optional["_models.LabelingJobInstructions"] = None, + label_categories: Optional[Dict[str, "_models.LabelCategory"]] = None, + labeling_job_media_properties: Optional["_models.LabelingJobMediaProperties"] = None, + ml_assist_configuration: Optional["_models.MLAssistConfiguration"] = None, + **kwargs: 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword data_configuration: Configuration of data used in the job. + :paramtype data_configuration: + ~azure.mgmt.machinelearningservices.models.LabelingDataConfiguration + :keyword job_instructions: Labeling instructions of the job. + :paramtype job_instructions: ~azure.mgmt.machinelearningservices.models.LabelingJobInstructions + :keyword label_categories: Label categories of the job. + :paramtype label_categories: dict[str, + ~azure.mgmt.machinelearningservices.models.LabelCategory] + :keyword labeling_job_media_properties: Media type specific properties in the job. + :paramtype labeling_job_media_properties: + ~azure.mgmt.machinelearningservices.models.LabelingJobMediaProperties + :keyword ml_assist_configuration: Configuration of MLAssist feature in the job. + :paramtype ml_assist_configuration: + ~azure.mgmt.machinelearningservices.models.MLAssistConfiguration + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + component_id=component_id, + compute_id=compute_id, + display_name=display_name, + experiment_name=experiment_name, + identity=identity, + is_archived=is_archived, + notification_setting=notification_setting, + secrets_configuration=secrets_configuration, + services=services, + **kwargs + ) + self.job_type: str = "Labeling" + self.created_date_time = None + self.data_configuration = data_configuration + self.job_instructions = job_instructions + self.label_categories = label_categories + self.labeling_job_media_properties = labeling_job_media_properties + self.ml_assist_configuration = ml_assist_configuration + self.progress_metrics = None + self.project_id = None + self.provisioning_state = None + self.status_messages = None + + +class LabelingJobResourceArmPaginatedResult(_serialization.Model): + """A paginated list of LabelingJob entities. + + :ivar next_link: The link to the next page of LabelingJob objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type LabelingJob. + :vartype value: list[~azure.mgmt.machinelearningservices.models.LabelingJob] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[LabelingJob]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.LabelingJob"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of LabelingJob objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type LabelingJob. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.LabelingJob] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class LabelingJobTextProperties(LabelingJobMediaProperties): + """Properties of a labeling job for text data. + + All required parameters must be populated in order to send to Azure. + + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType + :ivar annotation_type: Annotation type of text labeling job. Known values are: "Classification" + and "NamedEntityRecognition". + :vartype annotation_type: str or ~azure.mgmt.machinelearningservices.models.TextAnnotationType + """ + + _validation = { + "media_type": {"required": True}, + } + + _attribute_map = { + "media_type": {"key": "mediaType", "type": "str"}, + "annotation_type": {"key": "annotationType", "type": "str"}, + } + + def __init__( + self, *, annotation_type: Optional[Union[str, "_models.TextAnnotationType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword annotation_type: Annotation type of text labeling job. Known values are: + "Classification" and "NamedEntityRecognition". + :paramtype annotation_type: str or + ~azure.mgmt.machinelearningservices.models.TextAnnotationType + """ + super().__init__(**kwargs) + self.media_type: str = "Text" + self.annotation_type = annotation_type + + +class 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 Azure. + + :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 Azure. + + :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 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 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 Azure. + + :ivar compute_identity_type: [Required] Monitor compute identity type enum. Required. Known + values are: "AmlToken" and "ManagedIdentity". + :vartype compute_identity_type: str or + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :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: Managed service identity (system assigned and/or user assigned identities). + :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 Azure. + + :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): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionManagedIdentity"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **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 Azure. + + :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 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 = { + "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, + *, + 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 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.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 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 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 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): + """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. + + :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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: 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"}, + } + + def __init__(self, *, failure_reason: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + """ + super().__init__(failure_reason=failure_reason, **kwargs) + self.type: str = "managedOnlineEndpoint" + + +class ManagedOnlineEndpointResourceProperties(EndpointResourceProperties): + """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 Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", and "managedOnlineEndpoint". + :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 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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + """ + + _validation = { + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + name: Optional[str] = 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 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 name: Name of the endpoint. + :paramtype name: str + """ + super().__init__( + associated_resource_id=associated_resource_id, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + name=name, + **kwargs + ) + self.endpoint_type: str = "managedOnlineEndpoint" + + +class ManagedResourceGroupAssignedIdentities(_serialization.Model): + """Details for managed resource group assigned identities. + + :ivar principal_id: Identity principal Id. + :vartype principal_id: str + """ + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + } + + def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword principal_id: Identity principal Id. + :paramtype principal_id: str + """ + super().__init__(**kwargs) + self.principal_id = principal_id + + +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 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". + :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] + """ + + _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}. + 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 Offer ID of the Marketplace Plan. + :vartype offer_id: str + :ivar plan_id: The Plan ID of the Marketplace Plan. + :vartype plan_id: str + :ivar publisher_id: The Publisher ID 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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.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 Azure. + + :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: "PendingFulfillmentStart", "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): + """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 Azure. + + :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 MLAssistConfiguration(_serialization.Model): + """Labeling MLAssist configuration definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + MLAssistConfigurationDisabled, MLAssistConfigurationEnabled + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + """ + + _validation = { + "ml_assist": {"required": True}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + } + + _subtype_map = { + "ml_assist": {"Disabled": "MLAssistConfigurationDisabled", "Enabled": "MLAssistConfigurationEnabled"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ml_assist: Optional[str] = None + + +class MLAssistConfigurationDisabled(MLAssistConfiguration): + """Labeling MLAssist configuration definition when MLAssist is disabled. + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + """ + + _validation = { + "ml_assist": {"required": True}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ml_assist: str = "Disabled" + + +class MLAssistConfigurationEnabled(MLAssistConfiguration): + """Labeling MLAssist configuration definition when MLAssist is enabled. + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + :ivar inferencing_compute_binding: [Required] AML compute binding used in inferencing. + Required. + :vartype inferencing_compute_binding: str + :ivar training_compute_binding: [Required] AML compute binding used in training. Required. + :vartype training_compute_binding: str + """ + + _validation = { + "ml_assist": {"required": True}, + "inferencing_compute_binding": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "training_compute_binding": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + "inferencing_compute_binding": {"key": "inferencingComputeBinding", "type": "str"}, + "training_compute_binding": {"key": "trainingComputeBinding", "type": "str"}, + } + + def __init__(self, *, inferencing_compute_binding: str, training_compute_binding: str, **kwargs: Any) -> None: + """ + :keyword inferencing_compute_binding: [Required] AML compute binding used in inferencing. + Required. + :paramtype inferencing_compute_binding: str + :keyword training_compute_binding: [Required] AML compute binding used in training. Required. + :paramtype training_compute_binding: str + """ + super().__init__(**kwargs) + self.ml_assist: str = "Enabled" + self.inferencing_compute_binding = inferencing_compute_binding + self.training_compute_binding = training_compute_binding + + +class MLFlowModelJobInput(AssetJobInput, JobInput): + """MLFlowModelJobInput. + + 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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str + :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"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "mlflow_model" + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri + + +class MLFlowModelJobOutput(AssetJobOutput, JobOutput): + """MLFlowModelJobOutput. + + All required parameters must be populated in order to send to Azure. + + :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 asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str + :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"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: Output Asset URI. + :paramtype uri: str + """ + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) + self.description = description + self.job_output_type: str = "mlflow_model" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri + + +class MLTableData(DataVersionBaseProperties): # pylint: disable=too-many-instance-attributes + """MLTable data definition. + + 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar stage: Stage in the data lifecycle assigned to this data asset. + :vartype stage: 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}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "data_type": {"key": "dataType", "type": "str"}, + "data_uri": {"key": "dataUri", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "stage": {"key": "stage", "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, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + stage: Optional[str] = None, + 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword stage: Stage in the data lifecycle assigned to this data asset. + :paramtype stage: 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, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, + data_uri=data_uri, + intellectual_property=intellectual_property, + stage=stage, + **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 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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str + :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"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "mltable" + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri + + +class MLTableJobOutput(AssetJobOutput, JobOutput): + """MLTableJobOutput. + + All required parameters must be populated in order to send to Azure. + + :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 asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str + :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"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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 asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str + :keyword uri: Output Asset URI. + :paramtype uri: str + """ + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) + self.description = description + self.job_output_type: str = "mltable" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting + self.mode = mode + self.path_on_compute = path_on_compute + self.uri = uri + + +class ModelConfiguration(_serialization.Model): + """Model configuration options. + + :ivar mode: Input delivery mode for the model. Known values are: "Copy" and "Download". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.PackageInputDeliveryMode + :ivar mount_path: Relative mounting path of the model in the target image. + :vartype mount_path: str + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "mount_path": {"key": "mountPath", "type": "str"}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "_models.PackageInputDeliveryMode"]] = None, + mount_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: Input delivery mode for the model. Known values are: "Copy" and "Download". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.PackageInputDeliveryMode + :keyword mount_path: Relative mounting path of the model in the target image. + :paramtype mount_path: str + """ + super().__init__(**kwargs) + self.mode = mode + self.mount_path = mount_path + + +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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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 ModelDeprecationInfo(_serialization.Model): + """Cognitive Services account ModelDeprecationInfo. + + :ivar fine_tune: The datetime of deprecation of the fineTune Model. + :vartype fine_tune: str + :ivar inference: The datetime of deprecation of the inference Model. + :vartype inference: str + """ + + _attribute_map = { + "fine_tune": {"key": "fineTune", "type": "str"}, + "inference": {"key": "inference", "type": "str"}, + } + + def __init__(self, *, fine_tune: Optional[str] = None, inference: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword fine_tune: The datetime of deprecation of the fineTune Model. + :paramtype fine_tune: str + :keyword inference: The datetime of deprecation of the inference Model. + :paramtype inference: str + """ + super().__init__(**kwargs) + self.fine_tune = fine_tune + self.inference = inference + + +class ModelPackageInput(_serialization.Model): + """Model package input options. + + All required parameters must be populated in order to send to Azure. + + :ivar input_type: [Required] Type of the input included in the target image. Required. Known + values are: "UriFile" and "UriFolder". + :vartype input_type: str or ~azure.mgmt.machinelearningservices.models.PackageInputType + :ivar mode: Input delivery mode of the input. Known values are: "Copy" and "Download". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.PackageInputDeliveryMode + :ivar mount_path: Relative mount path of the input in the target image. + :vartype mount_path: str + :ivar path: [Required] Location of the input. Required. + :vartype path: ~azure.mgmt.machinelearningservices.models.PackageInputPathBase + """ + + _validation = { + "input_type": {"required": True}, + "path": {"required": True}, + } + + _attribute_map = { + "input_type": {"key": "inputType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "mount_path": {"key": "mountPath", "type": "str"}, + "path": {"key": "path", "type": "PackageInputPathBase"}, + } + + def __init__( + self, + *, + input_type: Union[str, "_models.PackageInputType"], + path: "_models.PackageInputPathBase", + mode: Optional[Union[str, "_models.PackageInputDeliveryMode"]] = None, + mount_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword input_type: [Required] Type of the input included in the target image. Required. Known + values are: "UriFile" and "UriFolder". + :paramtype input_type: str or ~azure.mgmt.machinelearningservices.models.PackageInputType + :keyword mode: Input delivery mode of the input. Known values are: "Copy" and "Download". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.PackageInputDeliveryMode + :keyword mount_path: Relative mount path of the input in the target image. + :paramtype mount_path: str + :keyword path: [Required] Location of the input. Required. + :paramtype path: ~azure.mgmt.machinelearningservices.models.PackageInputPathBase + """ + super().__init__(**kwargs) + self.input_type = input_type + self.mode = mode + self.mount_path = mount_path + self.path = path + + +class ModelPerformanceSignal(MonitoringSignalBase): + """Model performance signal definition. + + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar data_segment: The data segment. + :vartype data_segment: ~azure.mgmt.machinelearningservices.models.MonitoringDataSegment + :ivar metric_threshold: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_threshold: + ~azure.mgmt.machinelearningservices.models.ModelPerformanceMetricThresholdBase + :ivar production_data: [Required] The data produced by the production service which performance + will be calculated for. Required. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar reference_data: [Required] The reference data used as the basis to calculate model + performance. Required. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + + _validation = { + "signal_type": {"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"}, + "data_segment": {"key": "dataSegment", "type": "MonitoringDataSegment"}, + "metric_threshold": {"key": "metricThreshold", "type": "ModelPerformanceMetricThresholdBase"}, + "production_data": {"key": "productionData", "type": "[MonitoringInputDataBase]"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, + } + + def __init__( + self, + *, + metric_threshold: "_models.ModelPerformanceMetricThresholdBase", + production_data: List["_models.MonitoringInputDataBase"], + reference_data: "_models.MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + data_segment: Optional["_models.MonitoringDataSegment"] = 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 data_segment: The data segment. + :paramtype data_segment: ~azure.mgmt.machinelearningservices.models.MonitoringDataSegment + :keyword metric_threshold: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_threshold: + ~azure.mgmt.machinelearningservices.models.ModelPerformanceMetricThresholdBase + :keyword production_data: [Required] The data produced by the production service which + performance will be calculated for. Required. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword reference_data: [Required] The reference data used as the basis to calculate model + performance. Required. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "ModelPerformance" + self.data_segment = data_segment + self.metric_threshold = metric_threshold + self.production_data = production_data + self.reference_data = reference_data + + +class ModelSettings(_serialization.Model): + """ModelSettings. + + All required parameters must be populated in order to send to Azure. + + :ivar model_id: [Required]. 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]. Required. + :paramtype model_id: str + """ + super().__init__(**kwargs) + self.model_id = model_id + + +class ModelSku(_serialization.Model): + """Describes an available Cognitive Services Model SKU. + + :ivar name: The name of the model SKU. + :vartype name: str + :ivar usage_name: The usage name of the model SKU. + :vartype usage_name: str + :ivar deprecation_date: The datetime of deprecation of the model SKU. + :vartype deprecation_date: ~datetime.datetime + :ivar capacity: The capacity configuration. + :vartype capacity: ~azure.mgmt.machinelearningservices.models.CapacityConfig + :ivar rate_limits: The list of rateLimit. + :vartype rate_limits: list[~azure.mgmt.machinelearningservices.models.CallRateLimit] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "usage_name": {"key": "usageName", "type": "str"}, + "deprecation_date": {"key": "deprecationDate", "type": "iso-8601"}, + "capacity": {"key": "capacity", "type": "CapacityConfig"}, + "rate_limits": {"key": "rateLimits", "type": "[CallRateLimit]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + usage_name: Optional[str] = None, + deprecation_date: Optional[datetime.datetime] = None, + capacity: Optional["_models.CapacityConfig"] = None, + rate_limits: Optional[List["_models.CallRateLimit"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the model SKU. + :paramtype name: str + :keyword usage_name: The usage name of the model SKU. + :paramtype usage_name: str + :keyword deprecation_date: The datetime of deprecation of the model SKU. + :paramtype deprecation_date: ~datetime.datetime + :keyword capacity: The capacity configuration. + :paramtype capacity: ~azure.mgmt.machinelearningservices.models.CapacityConfig + :keyword rate_limits: The list of rateLimit. + :paramtype rate_limits: list[~azure.mgmt.machinelearningservices.models.CallRateLimit] + """ + super().__init__(**kwargs) + self.name = name + self.usage_name = usage_name + self.deprecation_date = deprecation_date + self.capacity = capacity + self.rate_limits = rate_limits + + +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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :vartype is_archived: bool + :ivar flavors: Mapping of model flavors to their properties. + :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :ivar intellectual_property: Intellectual Property details. Used if model is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "flavors": {"key": "flavors", "type": "{FlavorData}"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "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, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, + is_anonymous: bool = False, + is_archived: bool = False, + flavors: Optional[Dict[str, "_models.FlavorData"]] = None, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. + :paramtype is_archived: bool + :keyword flavors: Mapping of model flavors to their properties. + :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :keyword intellectual_property: Intellectual Property details. Used if model is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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__( + description=description, + properties=properties, + tags=tags, + auto_delete_setting=auto_delete_setting, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.flavors = flavors + self.intellectual_property = intellectual_property + 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 Azure. + + :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 Azure. + + :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 ARM resource ID of either the model or deployment targeted by this + 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 ARM resource ID of either the model or deployment targeted by + this 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: This is 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: This is the email recipient list which has a limitation of 499 characters in + total. + :paramtype emails: list[str] + """ + super().__init__(**kwargs) + self.emails = emails + + +class MonitoringDataSegment(_serialization.Model): + """MonitoringDataSegment. + + :ivar feature: The feature to segment the data on. + :vartype feature: str + :ivar values: Filters for only the specified values of the given segmented feature. + :vartype values: list[str] + """ + + _attribute_map = { + "feature": {"key": "feature", "type": "str"}, + "values": {"key": "values", "type": "[str]"}, + } + + def __init__(self, *, feature: Optional[str] = None, values: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword feature: The feature to segment the data on. + :paramtype feature: str + :keyword values: Filters for only the specified values of the given segmented feature. + :paramtype values: list[str] + """ + super().__init__(**kwargs) + self.feature = feature + self.values = values + + +class MonitoringTarget(_serialization.Model): + """Monitoring target definition. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_id: The ARM resource ID of either the deployment targeted by this monitor. + :vartype deployment_id: str + :ivar model_id: The ARM resource ID of either the model targeted by this monitor. + :vartype model_id: str + :ivar task_type: [Required] The machine learning task type of the model. Required. Known values + are: "Classification", "Regression", and "QuestionAnswering". + :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: The ARM resource ID of either the deployment targeted by this monitor. + :paramtype deployment_id: str + :keyword model_id: The ARM resource ID of either the model targeted by this monitor. + :paramtype model_id: str + :keyword task_type: [Required] The machine learning task type of the model. Required. Known + values are: "Classification", "Regression", and "QuestionAnswering". + :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__( # pylint: disable=too-many-locals + 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 MonitoringWorkspaceConnection(_serialization.Model): + """Monitoring workspace connection definition. + + :ivar environment_variables: The properties of a workspace service connection to store as + environment variables in the submitted jobs. + Key is workspace connection property path, name is environment variable key. + :vartype environment_variables: dict[str, str] + :ivar secrets: The properties of a workspace service connection to store as secrets in the + submitted jobs. + Key is workspace connection property path, name is secret key. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "secrets": {"key": "secrets", "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, + environment_variables: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = 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]. + :keyword environment_variables: The properties of a workspace service connection to store as + environment variables in the submitted jobs. + Key is workspace connection property path, name is environment variable key. + :paramtype environment_variables: dict[str, str] + :keyword secrets: The properties of a workspace service connection to store as secrets in the + submitted jobs. + Key is workspace connection property path, name is secret key. + :paramtype secrets: dict[str, str] + """ + super().__init__(**kwargs) + self.environment_variables = environment_variables + self.secrets = secrets + + +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 Azure. + + :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 Azure. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", "Mpi", and "Ray". + :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 NlpFixedParameters(_serialization.Model): + """Fixed training parameters that won't be swept over during AutoML NLP training. + + :ivar gradient_accumulation_steps: Number of steps to accumulate gradients over before running + a backward pass. + :vartype gradient_accumulation_steps: int + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: float + :ivar learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. Known values are: "None", "Linear", "Cosine", "CosineWithRestarts", "Polynomial", + "Constant", and "ConstantWithWarmup". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.NlpLearningRateScheduler + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar number_of_epochs: Number of training epochs. + :vartype number_of_epochs: int + :ivar training_batch_size: The batch size for the training procedure. + :vartype training_batch_size: int + :ivar validation_batch_size: The batch size to be used during evaluation. + :vartype validation_batch_size: int + :ivar warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :vartype warmup_ratio: float + :ivar weight_decay: The weight decay for the training procedure. + :vartype weight_decay: float + """ + + _attribute_map = { + "gradient_accumulation_steps": {"key": "gradientAccumulationSteps", "type": "int"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, + "warmup_ratio": {"key": "warmupRatio", "type": "float"}, + "weight_decay": {"key": "weightDecay", "type": "float"}, + } + + def __init__( + self, + *, + gradient_accumulation_steps: Optional[int] = None, + learning_rate: Optional[float] = None, + learning_rate_scheduler: Optional[Union[str, "_models.NlpLearningRateScheduler"]] = None, + model_name: Optional[str] = None, + number_of_epochs: Optional[int] = None, + training_batch_size: Optional[int] = None, + validation_batch_size: Optional[int] = None, + warmup_ratio: Optional[float] = None, + weight_decay: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword gradient_accumulation_steps: Number of steps to accumulate gradients over before + running a backward pass. + :paramtype gradient_accumulation_steps: int + :keyword learning_rate: The learning rate for the training procedure. :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". + :keyword learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. Known values are: "None", "Linear", "Cosine", "CosineWithRestarts", "Polynomial", + "Constant", and "ConstantWithWarmup". :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.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. + ~azure.mgmt.machinelearningservices.models.NlpLearningRateScheduler + :keyword model_name: The name of the model to train. :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. + :keyword number_of_epochs: Number of training epochs. :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. + :keyword training_batch_size: The batch size for the training procedure. :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :keyword validation_batch_size: The batch size to be used during evaluation. :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]. + :keyword warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :paramtype warmup_ratio: float + :keyword weight_decay: The weight decay for the training procedure. :paramtype weight_decay: float - :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 + super().__init__(**kwargs) + self.gradient_accumulation_steps = gradient_accumulation_steps + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.number_of_epochs = number_of_epochs + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_ratio = warmup_ratio + self.weight_decay = weight_decay -class 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. +class NlpParameterSubspace(_serialization.Model): + """Stringified search spaces for each parameter. See below examples. + + :ivar gradient_accumulation_steps: Number of steps to accumulate gradients over before running + a backward pass. + :vartype gradient_accumulation_steps: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: str + :ivar learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. + :vartype learning_rate_scheduler: str + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar number_of_epochs: Number of training epochs. + :vartype number_of_epochs: str + :ivar training_batch_size: The batch size for the training procedure. + :vartype training_batch_size: str + :ivar validation_batch_size: The batch size to be used during evaluation. + :vartype validation_batch_size: str + :ivar warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :vartype warmup_ratio: str + :ivar weight_decay: The weight decay for the training procedure. + :vartype weight_decay: str + """ + + _attribute_map = { + "gradient_accumulation_steps": {"key": "gradientAccumulationSteps", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, + "warmup_ratio": {"key": "warmupRatio", "type": "str"}, + "weight_decay": {"key": "weightDecay", "type": "str"}, + } + + def __init__( + self, + *, + gradient_accumulation_steps: Optional[str] = None, + learning_rate: Optional[str] = None, + learning_rate_scheduler: Optional[str] = None, + model_name: Optional[str] = None, + number_of_epochs: Optional[str] = None, + training_batch_size: Optional[str] = None, + validation_batch_size: Optional[str] = None, + warmup_ratio: Optional[str] = None, + weight_decay: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword gradient_accumulation_steps: Number of steps to accumulate gradients over before + running a backward pass. + :paramtype gradient_accumulation_steps: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. + :paramtype learning_rate_scheduler: str + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword number_of_epochs: Number of training epochs. + :paramtype number_of_epochs: str + :keyword training_batch_size: The batch size for the training procedure. + :paramtype training_batch_size: str + :keyword validation_batch_size: The batch size to be used during evaluation. + :paramtype validation_batch_size: str + :keyword warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :paramtype warmup_ratio: str + :keyword weight_decay: The weight decay for the training procedure. + :paramtype weight_decay: str + """ + super().__init__(**kwargs) + self.gradient_accumulation_steps = gradient_accumulation_steps + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.number_of_epochs = number_of_epochs + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_ratio = warmup_ratio + self.weight_decay = weight_decay + + +class NlpSweepSettings(_serialization.Model): + """Model sweeping and hyperparameter tuning related settings. All required parameters must be populated in order to send to Azure. - :ivar 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 early_termination: Type of early termination policy for the sweeping job. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :vartype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + "sampling_algorithm": {"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"}, + "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 for the sweeping job. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :paramtype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + super().__init__(**kwargs) + self.early_termination = early_termination + self.sampling_algorithm = sampling_algorithm + + +class NlpVertical(_serialization.Model): + """Abstract class for NLP related AutoML tasks. + NLP - Natural Language Processing. + + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + """ + + _attribute_map = { + "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, + "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "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, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, + limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, - 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 featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings :keyword search_space: Search space for sampling different combinations of models and their hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :keyword primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ - super().__init__( - 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, + super().__init__(**kwargs) + self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters + self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings + self.validation_data = validation_data + + +class NlpVerticalFeaturizationSettings(FeaturizationSettings): + """NlpVerticalFeaturizationSettings. + + :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__(dataset_language=dataset_language, **kwargs) + + +class NlpVerticalLimitSettings(_serialization.Model): + """Job execution constraints. + + :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_nodes: Maximum nodes to use for the experiment. + :vartype max_nodes: int + :ivar max_trials: Number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta + :ivar trial_timeout: Timeout for individual HD trials. + :vartype trial_timeout: ~datetime.timedelta + """ + + _attribute_map = { + "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, + "max_nodes": {"key": "maxNodes", "type": "int"}, + "max_trials": {"key": "maxTrials", "type": "int"}, + "timeout": {"key": "timeout", "type": "duration"}, + "trial_timeout": {"key": "trialTimeout", "type": "duration"}, + } + + def __init__( + self, + *, + max_concurrent_trials: int = 1, + max_nodes: int = 1, + max_trials: int = 1, + timeout: datetime.timedelta = "P7D", + trial_timeout: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_nodes: Maximum nodes to use for the experiment. + :paramtype max_nodes: int + :keyword max_trials: Number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta + :keyword trial_timeout: Timeout for individual HD trials. + :paramtype trial_timeout: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.max_concurrent_trials = max_concurrent_trials + self.max_nodes = max_nodes + self.max_trials = max_trials + self.timeout = timeout + self.trial_timeout = trial_timeout + + +class NodeStateCounts(_serialization.Model): + """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): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + """ + + _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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + """ + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, **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. - :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", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :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 Azure. + + :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. +class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): + """NumericalDataQualityMetricThreshold. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :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}, - } - - _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": {"required": True}, + "metric": {"required": True}, } - def __init__(self, *, properties: "_models.JobBaseProperties", **kwargs: Any) -> None: + _attribute_map = { + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, + } + + 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 Azure. + + :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): + """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 Azure. + + :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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "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, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = 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", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :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, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **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. - :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): # pylint: disable=too-many-instance-attributes + """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 Azure. + + :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", "Hdfs", and "OneLake". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar intellectual_property: Intellectual Property details. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "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, + intellectual_property: Optional["_models.IntellectualProperty"] = 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 intellectual_property: Intellectual Property details. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :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, + intellectual_property=intellectual_property, + **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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.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): + """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. - :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}. + :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. - :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 + :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__( - 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 - """ + 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 - _validation = { - "endpoint_compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - } + +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 = { - "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", - }, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OnlineEndpoint]"}, } 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, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.OnlineEndpoint"]] = 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 - :keyword container_resource_requirements: The resource requirements for the container (cpu and - memory). - :paramtype container_resource_requirements: - ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + :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__( - 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.next_link = next_link + self.value = value -class KubernetesProperties(_serialization.Model): - """Kubernetes properties. +class OnlineInferenceConfiguration(_serialization.Model): + """Online inference configuration options. - :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] + :ivar configurations: Additional configurations. + :vartype configurations: dict[str, str] + :ivar entry_script: Entry script or command to invoke. + :vartype entry_script: str + :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 = { - "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}"}, + "configurations": {"key": "configurations", "type": "{str}"}, + "entry_script": {"key": "entryScript", "type": "str"}, + "liveness_route": {"key": "livenessRoute", "type": "Route"}, + "readiness_route": {"key": "readinessRoute", "type": "Route"}, + "scoring_route": {"key": "scoringRoute", "type": "Route"}, } 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, + configurations: Optional[Dict[str, str]] = None, + entry_script: Optional[str] = None, + liveness_route: Optional["_models.Route"] = None, + readiness_route: Optional["_models.Route"] = None, + scoring_route: Optional["_models.Route"] = 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 configurations: Additional configurations. + :paramtype configurations: dict[str, str] + :keyword entry_script: Entry script or command to invoke. + :paramtype entry_script: str + :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.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 - + self.configurations = configurations + self.entry_script = entry_script + self.liveness_route = liveness_route + self.readiness_route = readiness_route + self.scoring_route = scoring_route -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. +class OnlineRequestSettings(_serialization.Model): + """Online deployment scoring requests configuration. - :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 + :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 """ - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[AmlUserFeature]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "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, **kwargs: Any) -> None: - """ """ + 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: + """ + :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 + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance + self.max_queue_wait = max_queue_wait + self.request_timeout = request_timeout -class ListNotebookKeysResult(_serialization.Model): - """ListNotebookKeysResult. +class OpenAIEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): + """OpenAIEndpointDeploymentResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_access_key: - :vartype primary_access_key: str - :ivar secondary_access_key: - :vartype secondary_access_key: str + All required parameters must be populated in order to send to Azure. + + :ivar 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", and "Canceled". + :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 = { - "primary_access_key": {"readonly": True}, - "secondary_access_key": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9._]"}, + "model": {"required": True}, } _attribute_map = { - "primary_access_key": {"key": "primaryAccessKey", "type": "str"}, - "secondary_access_key": {"key": "secondaryAccessKey", "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, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.primary_access_key = None - self.secondary_access_key = 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 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__( + 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 ListStorageAccountKeysResult(_serialization.Model): - """ListStorageAccountKeysResult. +class OpenAIEndpointResourceProperties(EndpointResourceProperties): + """OpenAIEndpointResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: - :vartype user_storage_key: str + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", and "managedOnlineEndpoint". + :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 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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState """ _validation = { - "user_storage_key": {"readonly": True}, + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "user_storage_key": {"key": "userStorageKey", "type": "str"}, + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.user_storage_key = None + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + name: Optional[str] = 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 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 name: Name of the endpoint. + :paramtype name: str + """ + super().__init__( + associated_resource_id=associated_resource_id, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + name=name, + **kwargs + ) + self.endpoint_type: str = "Azure.OpenAI" -class ListUsagesResult(_serialization.Model): - """The List Usages operation response. +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 value: The list of AML resource usages. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Usage] - :ivar next_link: The URI to fetch the next page of AML resource usage information. Call - ListNext() with this to fetch the next page of AML resource usage information. - :vartype next_link: str + :ivar 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 = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, - "next_link": {"key": "nextLink", "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.value = None - self.next_link = None + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None -class ListWorkspaceKeysResult(_serialization.Model): - """ListWorkspaceKeysResult. +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 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 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}, - "user_storage_resource_id": {"readonly": True}, - "app_insights_instrumentation_key": {"readonly": True}, - "container_registry_credentials": {"readonly": True}, - "notebook_access_keys": {"readonly": True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"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"}, + "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.user_storage_resource_id = None - self.app_insights_instrumentation_key = None - self.container_registry_credentials = None - self.notebook_access_keys = None + self.provider = None + self.resource = None + self.operation = None + self.description = None -class ListWorkspaceQuotas(_serialization.Model): - """The List WorkspaceQuotasByVMFamily 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 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. + :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 """ @@ -14238,7 +27551,7 @@ class ListWorkspaceQuotas(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[ResourceQuota]"}, + "value": {"key": "value", "type": "[Operation]"}, "next_link": {"key": "nextLink", "type": "str"}, } @@ -14249,1525 +27562,1575 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class LiteralJobInput(JobInput): - """Literal input type. - - All required parameters must be populated in order to send to Azure. +class OsPatchingStatus(_serialization.Model): + """Returns metadata about the os patching. - :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 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 """ - _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"}, + "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"}, } - def __init__(self, *, value: str, description: Optional[str] = None, **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, + **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 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 """ - super().__init__(description=description, **kwargs) - self.job_input_type: str = "literal" - self.value = value + super().__init__(**kwargs) + self.patch_status = patch_status + self.latest_patch_time = latest_patch_time + self.reboot_pending = reboot_pending + self.scheduled_reboot_time = scheduled_reboot_time -class ManagedIdentity(IdentityConfiguration): - """Managed identity configuration. +class OutboundRuleBasicResource(Resource): + """OutboundRuleBasicResource. + + 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 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 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: Outbound Rule for the managed network of a machine learning workspace. + Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ _validation = { - "identity_type": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"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"}, + "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, - *, - client_id: Optional[str] = None, - object_id: Optional[str] = None, - resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.OutboundRule", **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 properties: Outbound Rule for the managed network of a machine learning workspace. + Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ super().__init__(**kwargs) - self.identity_type: str = "Managed" - self.client_id = client_id - self.object_id = object_id - self.resource_id = resource_id - - -class WorkspaceConnectionPropertiesV2(_serialization.Model): - """WorkspaceConnectionPropertiesV2. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ManagedIdentityAuthTypeWorkspaceConnectionProperties, - NoneAuthTypeWorkspaceConnectionProperties, PATAuthTypeWorkspaceConnectionProperties, - SASAuthTypeWorkspaceConnectionProperties, UsernamePasswordAuthTypeWorkspaceConnectionProperties + self.properties = properties - All required parameters must be populated in order to send to Azure. - :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar target: - :vartype target: str - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. "JSON" - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - """ +class OutboundRuleListResult(_serialization.Model): + """List of outbound rules for the managed network of a machine learning workspace. - _validation = { - "auth_type": {"required": True}, - } + :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] + """ _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", - } + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OutboundRuleBasicResource]"}, } 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, + next_link: Optional[str] = None, + value: Optional[List["_models.OutboundRuleBasicResource"]] = 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 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__(**kwargs) - self.auth_type: Optional[str] = None - self.category = category - self.target = target + self.next_link = next_link self.value = value - self.value_format = value_format -class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """ManagedIdentityAuthTypeWorkspaceConnectionProperties. +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. - :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 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 = { - "auth_type": {"required": True}, + "reference_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"}, + "reference_type": {"key": "referenceType", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "path": {"key": "path", "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, *, job_id: Optional[str] = None, path: 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 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__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "ManagedIdentity" - self.credentials = credentials + super().__init__(**kwargs) + self.reference_type: str = "OutputPath" + self.job_id = job_id + self.path = path -class ManagedOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=too-many-instance-attributes - """Properties specific to a ManagedOnlineDeployment. +class PackageInputPathBase(_serialization.Model): + """PackageInputPathBase. - 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: + PackageInputPathId, PackageInputPathVersion, PackageInputPathUrl 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 input_path_type: [Required] Input path type for package inputs. Required. Known values + are: "Url", "PathId", and "PathVersion". + :vartype input_path_type: str or ~azure.mgmt.machinelearningservices.models.InputPathType """ _validation = { - "endpoint_compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, + "input_path_type": {"required": 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"}, + "input_path_type": {"key": "inputPathType", "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, - **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" + _subtype_map = { + "input_path_type": { + "PathId": "PackageInputPathId", + "PathVersion": "PackageInputPathVersion", + "Url": "PackageInputPathUrl", + } + } + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.input_path_type: Optional[str] = None -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. +class PackageInputPathId(PackageInputPathBase): + """Package input path specified with a resource id. 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". - :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 input_path_type: [Required] Input path type for package inputs. Required. Known values + are: "Url", "PathId", and "PathVersion". + :vartype input_path_type: str or ~azure.mgmt.machinelearningservices.models.InputPathType + :ivar resource_id: Input resource id. + :vartype resource_id: str """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "input_path_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}"}, + "input_path_type": {"key": "inputPathType", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, resource_id: Optional[str] = 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}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :keyword resource_id: Input resource id. + :paramtype resource_id: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.input_path_type: str = "PathId" + self.resource_id = resource_id -class MedianStoppingPolicy(EarlyTerminationPolicy): - """Defines an early termination policy based on running averages of the primary metric of all - runs. +class PackageInputPathUrl(PackageInputPathBase): + """Package input path specified as an url. All required parameters must be populated in order to send to Azure. - :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 input_path_type: [Required] Input path type for package inputs. Required. Known values + are: "Url", "PathId", and "PathVersion". + :vartype input_path_type: str or ~azure.mgmt.machinelearningservices.models.InputPathType + :ivar url: Input path url. + :vartype url: str """ _validation = { - "policy_type": {"required": True}, + "input_path_type": {"required": True}, } _attribute_map = { - "delay_evaluation": {"key": "delayEvaluation", "type": "int"}, - "evaluation_interval": {"key": "evaluationInterval", "type": "int"}, - "policy_type": {"key": "policyType", "type": "str"}, + "input_path_type": {"key": "inputPathType", "type": "str"}, + "url": {"key": "url", "type": "str"}, } - def __init__(self, *, delay_evaluation: int = 0, evaluation_interval: int = 0, **kwargs: Any) -> None: + def __init__(self, *, url: Optional[str] = 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 url: Input path url. + :paramtype url: str """ - super().__init__(delay_evaluation=delay_evaluation, evaluation_interval=evaluation_interval, **kwargs) - self.policy_type: str = "MedianStopping" + super().__init__(**kwargs) + self.input_path_type: str = "Url" + self.url = url -class MLFlowModelJobInput(AssetJobInput, JobInput): - """MLFlowModelJobInput. +class PackageInputPathVersion(PackageInputPathBase): + """Package input path specified with name and version. 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 + :ivar input_path_type: [Required] Input path type for package inputs. Required. Known values + are: "Url", "PathId", and "PathVersion". + :vartype input_path_type: str or ~azure.mgmt.machinelearningservices.models.InputPathType + :ivar resource_name: Input resource name. + :vartype resource_name: str + :ivar resource_version: Input resource version. + :vartype resource_version: str """ _validation = { - "job_input_type": {"required": True}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "input_path_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"}, + "input_path_type": {"key": "inputPathType", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "resource_version": {"key": "resourceVersion", "type": "str"}, } def __init__( - self, - *, - uri: str, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, - **kwargs: Any + self, *, resource_name: Optional[str] = None, resource_version: Optional[str] = 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 resource_name: Input resource name. + :paramtype resource_name: str + :keyword resource_version: Input resource version. + :paramtype resource_version: 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 + super().__init__(**kwargs) + self.input_path_type: str = "PathVersion" + self.resource_name = resource_name + self.resource_version = resource_version -class MLFlowModelJobOutput(AssetJobOutput, JobOutput): - """MLFlowModelJobOutput. +class PackageRequest(_serialization.Model): + """Model package operation request properties. All required parameters must be populated in order to send to Azure. - :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 base_environment_source: Base environment to start with. + :vartype base_environment_source: + ~azure.mgmt.machinelearningservices.models.BaseEnvironmentSource + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar inferencing_server: [Required] Inferencing server configurations. Required. + :vartype inferencing_server: ~azure.mgmt.machinelearningservices.models.InferencingServer + :ivar inputs: Collection of inputs. + :vartype inputs: list[~azure.mgmt.machinelearningservices.models.ModelPackageInput] + :ivar model_configuration: Model configuration including the mount mode. + :vartype model_configuration: ~azure.mgmt.machinelearningservices.models.ModelConfiguration + :ivar properties: Property dictionary. Properties can be added, removed, and updated. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar target_environment_id: [Required] Arm ID of the target environment to be created by + package operation. Required. + :vartype target_environment_id: str """ _validation = { - "job_output_type": {"required": True}, + "inferencing_server": {"required": True}, + "target_environment_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "base_environment_source": {"key": "baseEnvironmentSource", "type": "BaseEnvironmentSource"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "inferencing_server": {"key": "inferencingServer", "type": "InferencingServer"}, + "inputs": {"key": "inputs", "type": "[ModelPackageInput]"}, + "model_configuration": {"key": "modelConfiguration", "type": "ModelConfiguration"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "target_environment_id": {"key": "targetEnvironmentId", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, - uri: Optional[str] = None, + inferencing_server: "_models.InferencingServer", + target_environment_id: str, + base_environment_source: Optional["_models.BaseEnvironmentSource"] = None, + environment_variables: Optional[Dict[str, str]] = None, + inputs: Optional[List["_models.ModelPackageInput"]] = None, + model_configuration: Optional["_models.ModelConfiguration"] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, 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 + :keyword base_environment_source: Base environment to start with. + :paramtype base_environment_source: + ~azure.mgmt.machinelearningservices.models.BaseEnvironmentSource + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword inferencing_server: [Required] Inferencing server configurations. Required. + :paramtype inferencing_server: ~azure.mgmt.machinelearningservices.models.InferencingServer + :keyword inputs: Collection of inputs. + :paramtype inputs: list[~azure.mgmt.machinelearningservices.models.ModelPackageInput] + :keyword model_configuration: Model configuration including the mount mode. + :paramtype model_configuration: ~azure.mgmt.machinelearningservices.models.ModelConfiguration + :keyword properties: Property dictionary. Properties can be added, removed, and updated. + :paramtype properties: dict[str, str] + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword target_environment_id: [Required] Arm ID of the target environment to be created by + package operation. Required. + :paramtype target_environment_id: 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 + super().__init__(**kwargs) + self.base_environment_source = base_environment_source + self.environment_variables = environment_variables + self.inferencing_server = inferencing_server + self.inputs = inputs + self.model_configuration = model_configuration + self.properties = properties + self.tags = tags + self.target_environment_id = target_environment_id -class MLTableData(DataVersionBaseProperties): - """MLTable data definition. +class PackageResponse(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Package response returned after async package operation completes successfully. - 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. + :ivar base_environment_source: Base environment to start with. + :vartype base_environment_source: + ~azure.mgmt.machinelearningservices.models.BaseEnvironmentSource + :ivar build_id: Build id of the image build operation. + :vartype build_id: str + :ivar build_state: Build state of the image build operation. Known values are: "NotStarted", + "Running", "Succeeded", and "Failed". + :vartype build_state: str or ~azure.mgmt.machinelearningservices.models.PackageBuildState + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar inferencing_server: Inferencing server configurations. + :vartype inferencing_server: ~azure.mgmt.machinelearningservices.models.InferencingServer + :ivar inputs: Collection of inputs. + :vartype inputs: list[~azure.mgmt.machinelearningservices.models.ModelPackageInput] + :ivar log_url: Log url of the image build operation. + :vartype log_url: str + :ivar model_configuration: Model configuration including the mount mode. + :vartype model_configuration: ~azure.mgmt.machinelearningservices.models.ModelConfiguration + :ivar properties: Property dictionary. Tags can be added, removed, and updated. :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] + :ivar target_environment_id: Asset ID of the target environment created by package operation. + :vartype target_environment_id: str """ _validation = { - "data_type": {"required": True}, - "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "base_environment_source": {"readonly": True}, + "build_id": {"readonly": True}, + "build_state": {"readonly": True}, + "environment_variables": {"readonly": True}, + "inferencing_server": {"readonly": True}, + "inputs": {"readonly": True}, + "log_url": {"readonly": True}, + "model_configuration": {"readonly": True}, + "properties": {"readonly": True}, + "tags": {"readonly": True}, + "target_environment_id": {"readonly": True}, + } + + _attribute_map = { + "base_environment_source": {"key": "baseEnvironmentSource", "type": "BaseEnvironmentSource"}, + "build_id": {"key": "buildId", "type": "str"}, + "build_state": {"key": "buildState", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "inferencing_server": {"key": "inferencingServer", "type": "InferencingServer"}, + "inputs": {"key": "inputs", "type": "[ModelPackageInput]"}, + "log_url": {"key": "logUrl", "type": "str"}, + "model_configuration": {"key": "modelConfiguration", "type": "ModelConfiguration"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "target_environment_id": {"key": "targetEnvironmentId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_environment_source = None + self.build_id = None + self.build_state = None + self.environment_variables = None + self.inferencing_server = None + self.inputs = None + self.log_url = None + self.model_configuration = None + self.properties = None + self.tags = None + self.target_environment_id = None + + +class PaginatedComputeResourcesList(_serialization.Model): + """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. + + :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 + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ComputeResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } + def __init__( + self, *, value: Optional[List["_models.ComputeResource"]] = None, next_link: Optional[str] = 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. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartialBatchDeployment(_serialization.Model): + """Mutable batch inference settings per deployment. + + :ivar description: Description of the endpoint deployment. + :vartype description: str + """ + _attribute_map = { "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: Description of the endpoint deployment. + :paramtype description: str + """ + super().__init__(**kwargs) + self.description = description + + +class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(_serialization.Model): + """Strictly used in update requests. + + :ivar properties: Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "PartialBatchDeployment"}, "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, + properties: Optional["_models.PartialBatchDeployment"] = 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] + :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 PartialJobBase(_serialization.Model): + """Mutable base definition for a job. + + :ivar notification_setting: Mutable notification setting for the job. + :vartype notification_setting: + ~azure.mgmt.machinelearningservices.models.PartialNotificationSetting + """ + + _attribute_map = { + "notification_setting": {"key": "notificationSetting", "type": "PartialNotificationSetting"}, + } + + def __init__( + self, *, notification_setting: Optional["_models.PartialNotificationSetting"] = None, **kwargs: Any + ) -> None: + """ + :keyword notification_setting: Mutable notification setting for the job. + :paramtype notification_setting: + ~azure.mgmt.machinelearningservices.models.PartialNotificationSetting """ - 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 - + super().__init__(**kwargs) + self.notification_setting = notification_setting -class MLTableJobInput(AssetJobInput, JobInput): - """MLTableJobInput. - All required parameters must be populated in order to send to Azure. +class PartialJobBasePartialResource(_serialization.Model): + """Azure Resource Manager resource envelope strictly used in update requests. - :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 + :ivar properties: Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialJobBase """ - _validation = { - "job_input_type": {"required": True}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + _attribute_map = { + "properties": {"key": "properties", "type": "PartialJobBase"}, } + def __init__(self, *, properties: Optional["_models.PartialJobBase"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialJobBase + """ + super().__init__(**kwargs) + self.properties = properties + + +class PartialManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + :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] + """ + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{object}"}, } def __init__( self, *, - uri: str, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, JSON]] = 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 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] """ - 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.type = type + self.user_assigned_identities = user_assigned_identities -class MLTableJobOutput(AssetJobOutput, JobOutput): - """MLTableJobOutput. - All required parameters must be populated in order to send to Azure. +class PartialMinimalTrackedResource(_serialization.Model): + """Strictly used in update requests. - :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 tags: Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - "job_output_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): + """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 = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, } def __init__( self, *, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, - uri: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.PartialManagedServiceIdentity"] = 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 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__(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__(tags=tags, **kwargs) + self.identity = identity - 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 PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): + """Strictly used in update requests. - :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 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 """ - _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"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "PartialSku"}, } - def __init__(self, *, properties: "_models.ModelContainerProperties", **kwargs: Any) -> None: + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.PartialSku"] = None, **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :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__(**kwargs) - self.properties = properties - + super().__init__(tags=tags, **kwargs) + self.sku = sku -class ModelContainerProperties(AssetContainer): - """ModelContainerProperties. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): + """Strictly used in update requests. - :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. + :ivar tags: Resource tags. :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 + :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 = { - "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"}, + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "PartialSku"}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, - is_archived: bool = False, + identity: Optional["_models.PartialManagedServiceIdentity"] = None, + sku: Optional["_models.PartialSku"] = 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. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :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__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + super().__init__(tags=tags, **kwargs) + self.identity = identity + self.sku = sku -class ModelContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ModelContainer entities. +class PartialNotificationSetting(_serialization.Model): + """Mutable configuration for notification. - :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] + :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 = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ModelContainer]"}, + "webhooks": {"key": "webhooks", "type": "{Webhook}"}, } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelContainer"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, webhooks: Optional[Dict[str, "_models.Webhook"]] = 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] + :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.next_link = next_link - self.value = value - - -class ModelVersion(Resource): - """Azure Resource Manager resource envelope. + self.webhooks = webhooks - 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 PartialRegistryPartialTrackedResource(_serialization.Model): + """Strictly used in update requests. - :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.ModelVersionProperties + :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] """ - _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"}, + "identity": {"key": "identity", "type": "RegistryPartialManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "PartialSku"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, properties: "_models.ModelVersionProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.RegistryPartialManagedServiceIdentity"] = None, + sku: Optional["_models.PartialSku"] = None, + tags: Optional[Dict[str, str]] = 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.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.properties = properties - + self.identity = identity + self.sku = sku + self.tags = tags -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 PartialSku(_serialization.Model): + """Common SKU definition. - :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 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 """ - _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"}, + "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, *, - 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, + 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: 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 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__( - 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.capacity = capacity + self.family = family + self.name = name + self.size = size + self.tier = tier + + +class Password(_serialization.Model): + """Password. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } -class ModelVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ModelVersion entities. + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None - :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] + +class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """PATAuthTypeWorkspaceConnectionProperties. + + 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 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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ModelVersion]"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "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": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionPersonalAccessToken"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelVersion"]] = None, **kwargs: Any + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + credentials: Optional["_models.WorkspaceConnectionPersonalAccessToken"] = 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 the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "PAT" + self.credentials = credentials -class Mpi(DistributionConfiguration): - """MPI distribution configuration. +class PendingUploadCredentialDto(_serialization.Model): + """PendingUploadCredentialDto. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SASCredentialDto All required parameters must be populated in order to send to Azure. - :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 credential_type: [Required] Credential type used to authentication with storage. + Required. "SAS" + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType """ _validation = { - "distribution_type": {"required": True}, + "credential_type": {"required": True}, } _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, - "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, + "credential_type": {"key": "credentialType", "type": "str"}, } - 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 - """ + _subtype_map = {"credential_type": {"SAS": "SASCredentialDto"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.distribution_type: str = "Mpi" - self.process_count_per_instance = process_count_per_instance + self.credential_type: Optional[str] = None -class NlpVertical(_serialization.Model): - """Abstract class for NLP related AutoML tasks. - NLP - Natural Language Processing. +class PendingUploadRequestDto(_serialization.Model): + """PendingUploadRequestDto. - :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 + :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 = { - "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "pending_upload_id": {"key": "pendingUploadId", "type": "str"}, + "pending_upload_type": {"key": "pendingUploadType", "type": "str"}, } def __init__( self, *, - featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, + pending_upload_id: Optional[str] = None, + pending_upload_type: Optional[Union[str, "_models.PendingUploadType"]] = 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 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__(**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 - """ - - _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__(dataset_language=dataset_language, **kwargs) + self.pending_upload_id = pending_upload_id + self.pending_upload_type = pending_upload_type -class NlpVerticalLimitSettings(_serialization.Model): - """Job execution constraints. +class PendingUploadResponseDto(_serialization.Model): + """PendingUploadResponseDto. - :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 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 """ _attribute_map = { - "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, - "max_trials": {"key": "maxTrials", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "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, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any + self, + *, + 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 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 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__(**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. + 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. - :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 - """ +class PersonalComputeInstanceSettings(_serialization.Model): + """Settings for a personal compute instance. - _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}, - } + :ivar assigned_user: A user explicitly assigned to a personal compute instance. + :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + """ _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"}, + "assigned_user": {"key": "assignedUser", "type": "AssignedUser"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, assigned_user: Optional["_models.AssignedUser"] = None, **kwargs: Any) -> None: + """ + :keyword assigned_user: A user explicitly assigned to a personal compute instance. + :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + """ 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.assigned_user = assigned_user -class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """NoneAuthTypeWorkspaceConnectionProperties. +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 Azure. - :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar target: - :vartype target: str - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. "JSON" - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar 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 = { - "auth_type": {"required": True}, + "job_type": {"required": True}, + "status": {"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"}, + "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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, + "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__( self, *, - category: Optional[Union[str, "_models.ConnectionCategory"]] = None, - target: Optional[str] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "_models.ValueFormat"]] = None, + 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, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = 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: """ - :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 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :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__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "None" - + 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, + secrets_configuration=secrets_configuration, + 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 NoneDatastoreCredentials(DatastoreCredentials): - """Empty/none datastore credentials. - All required parameters must be populated in order to send to Azure. +class PoolEnvironmentConfiguration(_serialization.Model): + """Environment configuration options. - :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 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: dict[str, str] + :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 """ - _validation = { - "credentials_type": {"required": True}, - } - _attribute_map = { - "credentials_type": {"key": "credentialsType", "type": "str"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, + "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, + "startup_probe": {"key": "startupProbe", "type": "ProbeSettings"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + environment_id: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = 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: dict[str, str] + :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.credentials_type: str = "None" - - -class NotebookAccessTokenResult(_serialization.Model): - """NotebookAccessTokenResult. - - Variables are only populated by the server, and will be ignored when sending a request. + 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 - :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 - """ - _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}, - } +class PoolModelConfiguration(_serialization.Model): + """Model configuration options. + + :ivar model_id: The URI path to the model. + :vartype model_id: str + """ _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"}, + "model_id": {"key": "modelId", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + 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.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.model_id = model_id -class NotebookPreparationError(_serialization.Model): - """NotebookPreparationError. +class PoolStatus(_serialization.Model): + """PoolStatus. - :ivar error_message: - :vartype error_message: str - :ivar status_code: - :vartype status_code: int + :ivar actual_capacity: Gets or sets the actual number of instances in the pool. + :vartype actual_capacity: int + :ivar group_count: Gets or sets the actual number of groups in the pool. + :vartype group_count: int + :ivar requested_capacity: Gets or sets the requested number of instances for the pool. + :vartype requested_capacity: int + :ivar reserved_capacity: Gets or sets the number of instances in the pool reserved by the + system. + :vartype reserved_capacity: int """ _attribute_map = { - "error_message": {"key": "errorMessage", "type": "str"}, - "status_code": {"key": "statusCode", "type": "int"}, + "actual_capacity": {"key": "actualCapacity", "type": "int"}, + "group_count": {"key": "groupCount", "type": "int"}, + "requested_capacity": {"key": "requestedCapacity", "type": "int"}, + "reserved_capacity": {"key": "reservedCapacity", "type": "int"}, } def __init__( - self, *, error_message: Optional[str] = None, status_code: Optional[int] = None, **kwargs: Any + self, + *, + actual_capacity: int = 0, + group_count: int = 0, + requested_capacity: int = 0, + reserved_capacity: int = 0, + **kwargs: Any ) -> None: """ - :keyword error_message: - :paramtype error_message: str - :keyword status_code: - :paramtype status_code: int + :keyword actual_capacity: Gets or sets the actual number of instances in the pool. + :paramtype actual_capacity: int + :keyword group_count: Gets or sets the actual number of groups in the pool. + :paramtype group_count: int + :keyword requested_capacity: Gets or sets the requested number of instances for the pool. + :paramtype requested_capacity: int + :keyword reserved_capacity: Gets or sets the number of instances in the pool reserved by the + system. + :paramtype reserved_capacity: int """ super().__init__(**kwargs) - self.error_message = error_message - self.status_code = status_code + self.actual_capacity = actual_capacity + self.group_count = group_count + self.requested_capacity = requested_capacity + self.reserved_capacity = reserved_capacity -class NotebookResourceInfo(_serialization.Model): - """NotebookResourceInfo. +class PredictionDriftMonitoringSignal(MonitoringSignalBase): + """PredictionDriftMonitoringSignal. - :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 + All required parameters must be populated in order to send to Azure. + + :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", "Custom", + "ModelPerformance", "GenerationSafetyQuality", and "GenerationTokenStatistics". + :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 = { - "fqdn": {"key": "fqdn", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "notebook_preparation_error": {"key": "notebookPreparationError", "type": "NotebookPreparationError"}, + "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, *, - fqdn: Optional[str] = None, - resource_id: Optional[str] = None, - notebook_preparation_error: Optional["_models.NotebookPreparationError"] = None, + 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: """ - :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 - """ - super().__init__(**kwargs) - self.fqdn = fqdn - self.resource_id = resource_id - self.notebook_preparation_error = notebook_preparation_error + :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 Objective(_serialization.Model): - """Optimization objective. +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint resource. - 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 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 id: The ARM identifier for Private Endpoint. + :vartype id: str """ _validation = { - "goal": {"required": True}, - "primary_metric": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "id": {"readonly": True}, } _attribute_map = { - "goal": {"key": "goal", "type": "str"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__(self, *, goal: Union[str, "_models.Goal"], primary_metric: str, **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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.goal = goal - self.primary_metric = primary_metric + self.id = None -class OnlineDeployment(TrackedResource): - """OnlineDeployment. +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}. :vartype id: str @@ -15779,19 +29142,25 @@ class OnlineDeployment(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.OnlineDeploymentProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. + :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 = { @@ -15799,8 +29168,6 @@ class OnlineDeployment(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "properties": {"required": True}, } _attribute_map = { @@ -15808,88 +29175,218 @@ class OnlineDeployment(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": "OnlineDeploymentProperties"}, + "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, *, - location: str, - properties: "_models.OnlineDeploymentProperties", - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[str] = 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 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. + :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__(tags=tags, location=location, **kwargs) + super().__init__(**kwargs) self.identity = identity - self.kind = kind - self.properties = properties + 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 OnlineDeploymentTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of OnlineDeployment entities. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified workspace. - :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 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 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 = { + "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, + *, + 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 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__(**kwargs) + self.service_resource_id = service_resource_id + self.spark_enabled = spark_enabled + self.spark_status = spark_status + self.subresource_target = subresource_target + + +class PrivateEndpointOutboundRule(OutboundRule): + """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. + + All required parameters must be populated in order to send to Azure. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :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 + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "destination": {"key": "destination", "type": "PrivateEndpointDestination"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + destination: Optional["_models.PrivateEndpointDestination"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :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 + """ + super().__init__(category=category, status=status, **kwargs) + self.type: str = "PrivateEndpoint" + self.destination = destination + + +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 = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OnlineDeployment]"}, + "id": {"key": "id", "type": "str"}, + "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.OnlineDeployment"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, subnet_arm_id: 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 subnet_arm_id: The subnetId that the private endpoint is connected to. + :paramtype subnet_arm_id: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.subnet_arm_id = subnet_arm_id -class OnlineEndpoint(TrackedResource): - """OnlineEndpoint. +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. - 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 @@ -15901,19 +29398,21 @@ 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. + :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 = { @@ -15921,8 +29420,6 @@ class OnlineEndpoint(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "properties": {"required": True}, } _attribute_map = { @@ -15930,3475 +29427,4050 @@ 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"}, + "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, *, - location: str, - properties: "_models.OnlineEndpointProperties", - tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[str] = 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 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. + :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__(tags=tags, location=location, **kwargs) + super().__init__(**kwargs) self.identity = identity - self.kind = kind - self.properties = properties + 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 OnlineEndpointProperties(EndpointPropertiesBase): # pylint: disable=too-many-instance-attributes - """Online endpoint configuration. +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + } - :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. + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :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 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 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 """ - _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"}, + "actions_required": {"key": "actionsRequired", "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}"}, + "status": {"key": "status", "type": "str"}, } def __init__( self, *, - auth_mode: Union[str, "_models.EndpointAuthMode"], + actions_required: Optional[str] = None, 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, + status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = 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. + :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 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] + :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.actions_required = actions_required + self.description = description + self.status = status + + +class ProbeSettings(_serialization.Model): + """Deployment container liveness/readiness probe configuration. + + :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 + """ + + _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"}, + } + + 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: + """ + :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__(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 + 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 OnlineEndpointTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of OnlineEndpoint entities. +class ProgressMetrics(_serialization.Model): + """Progress metrics definition. - :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] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar completed_datapoint_count: The completed datapoint count. + :vartype completed_datapoint_count: int + :ivar incremental_data_last_refresh_date_time: The time of last successful incremental data + refresh in UTC. + :vartype incremental_data_last_refresh_date_time: ~datetime.datetime + :ivar skipped_datapoint_count: The skipped datapoint count. + :vartype skipped_datapoint_count: int + :ivar total_datapoint_count: The total datapoint count. + :vartype total_datapoint_count: int + """ + + _validation = { + "completed_datapoint_count": {"readonly": True}, + "incremental_data_last_refresh_date_time": {"readonly": True}, + "skipped_datapoint_count": {"readonly": True}, + "total_datapoint_count": {"readonly": True}, + } + + _attribute_map = { + "completed_datapoint_count": {"key": "completedDatapointCount", "type": "int"}, + "incremental_data_last_refresh_date_time": {"key": "incrementalDataLastRefreshDateTime", "type": "iso-8601"}, + "skipped_datapoint_count": {"key": "skippedDatapointCount", "type": "int"}, + "total_datapoint_count": {"key": "totalDatapointCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.completed_datapoint_count = None + self.incremental_data_last_refresh_date_time = None + self.skipped_datapoint_count = None + self.total_datapoint_count = None + + +class PyTorch(DistributionConfiguration): + """PyTorch distribution configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", "Mpi", and "Ray". + :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 = { + "distribution_type": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OnlineEndpoint]"}, + "distribution_type": {"key": "distributionType", "type": "str"}, + "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.OnlineEndpoint"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, process_count_per_instance: Optional[int] = 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] + :keyword process_count_per_instance: Number of processes per node. + :paramtype process_count_per_instance: int """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.distribution_type: str = "PyTorch" + self.process_count_per_instance = process_count_per_instance -class OnlineRequestSettings(_serialization.Model): - """Online deployment scoring requests configuration. +class QueueSettings(_serialization.Model): + """QueueSettings. - :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 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 + :ivar priority: Controls the priority of the job on a compute. + :vartype priority: int """ _attribute_map = { - "max_concurrent_requests_per_instance": {"key": "maxConcurrentRequestsPerInstance", "type": "int"}, - "max_queue_wait": {"key": "maxQueueWait", "type": "duration"}, - "request_timeout": {"key": "requestTimeout", "type": "duration"}, + "job_tier": {"key": "jobTier", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, } def __init__( - self, - *, - max_concurrent_requests_per_instance: int = 1, - max_queue_wait: datetime.timedelta = "PT0.5S", - request_timeout: datetime.timedelta = "PT5S", - **kwargs: Any + self, *, job_tier: Optional[Union[str, "_models.JobTier"]] = None, priority: Optional[int] = 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 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 + :keyword priority: Controls the priority of the job on a compute. + :paramtype priority: int """ 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.job_tier = job_tier + self.priority = priority -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. +class QuotaBaseProperties(_serialization.Model): + """The properties for Quota update or retrieval. - :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 + :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 """ - _validation = { - "reference_type": {"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"}, + "type": {"key": "type", "type": "str"}, + "limit": {"key": "limit", "type": "int"}, + "unit": {"key": "unit", "type": "str"}, } - def __init__(self, *, job_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + 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, + **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 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.reference_type: str = "OutputPath" - self.job_id = job_id - self.path = path + self.id = id + self.type = type + self.limit = limit + self.unit = unit -class PaginatedComputeResourcesList(_serialization.Model): - """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. +class QuotaUpdateParameters(_serialization.Model): + """Quota update parameters. - :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 + :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 = { - "value": {"key": "value", "type": "[ComputeResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[QuotaBaseProperties]"}, + "location": {"key": "location", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.ComputeResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, + *, + value: Optional[List["_models.QuotaBaseProperties"]] = None, + location: Optional[str] = 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. - :paramtype next_link: str + :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.value = value - self.next_link = next_link + self.location = location -class PartialBatchDeployment(_serialization.Model): - """Mutable batch inference settings per deployment. +class RandomSamplingAlgorithm(SamplingAlgorithm): + """Defines a Sampling Algorithm that generates values randomly. - :ivar description: Description of the endpoint deployment. - :vartype description: str + All required parameters must be populated in order to send to Azure. + + :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 logbase: An optional positive number or e in string format to be used as base for log + based random sampling. + :vartype logbase: str + :ivar rule: The specific type of random algorithm. Known values are: "Random" and "Sobol". + :vartype rule: str or ~azure.mgmt.machinelearningservices.models.RandomSamplingAlgorithmRule + :ivar seed: An optional integer to use as the seed for random number generation. + :vartype seed: int """ + _validation = { + "sampling_algorithm_type": {"required": True}, + } + _attribute_map = { - "description": {"key": "description", "type": "str"}, + "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, + "logbase": {"key": "logbase", "type": "str"}, + "rule": {"key": "rule", "type": "str"}, + "seed": {"key": "seed", "type": "int"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + logbase: Optional[str] = None, + rule: Optional[Union[str, "_models.RandomSamplingAlgorithmRule"]] = None, + seed: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword description: Description of the endpoint deployment. - :paramtype description: str + :keyword logbase: An optional positive number or e in string format to be used as base for log + based random sampling. + :paramtype logbase: str + :keyword rule: The specific type of random algorithm. Known values are: "Random" and "Sobol". + :paramtype rule: str or ~azure.mgmt.machinelearningservices.models.RandomSamplingAlgorithmRule + :keyword seed: An optional integer to use as the seed for random number generation. + :paramtype seed: int """ super().__init__(**kwargs) - self.description = description + self.sampling_algorithm_type: str = "Random" + self.logbase = logbase + self.rule = rule + self.seed = seed -class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(_serialization.Model): - """Strictly used in update requests. +class Ray(DistributionConfiguration): + """Ray distribution configuration. - :ivar properties: Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", "Mpi", and "Ray". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar address: The address of Ray head node. + :vartype address: str + :ivar dashboard_port: The port to bind the dashboard server to. + :vartype dashboard_port: int + :ivar head_node_additional_args: Additional arguments passed to ray start in head node. + :vartype head_node_additional_args: str + :ivar include_dashboard: Provide this argument to start the Ray dashboard GUI. + :vartype include_dashboard: bool + :ivar port: The port of the head ray process. + :vartype port: int + :ivar worker_node_additional_args: Additional arguments passed to ray start in worker node. + :vartype worker_node_additional_args: str """ + _validation = { + "distribution_type": {"required": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "PartialBatchDeployment"}, - "tags": {"key": "tags", "type": "{str}"}, + "distribution_type": {"key": "distributionType", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "dashboard_port": {"key": "dashboardPort", "type": "int"}, + "head_node_additional_args": {"key": "headNodeAdditionalArgs", "type": "str"}, + "include_dashboard": {"key": "includeDashboard", "type": "bool"}, + "port": {"key": "port", "type": "int"}, + "worker_node_additional_args": {"key": "workerNodeAdditionalArgs", "type": "str"}, } def __init__( self, *, - properties: Optional["_models.PartialBatchDeployment"] = None, - tags: Optional[Dict[str, str]] = None, + address: Optional[str] = None, + dashboard_port: Optional[int] = None, + head_node_additional_args: Optional[str] = None, + include_dashboard: Optional[bool] = None, + port: Optional[int] = None, + worker_node_additional_args: Optional[str] = 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 address: The address of Ray head node. + :paramtype address: str + :keyword dashboard_port: The port to bind the dashboard server to. + :paramtype dashboard_port: int + :keyword head_node_additional_args: Additional arguments passed to ray start in head node. + :paramtype head_node_additional_args: str + :keyword include_dashboard: Provide this argument to start the Ray dashboard GUI. + :paramtype include_dashboard: bool + :keyword port: The port of the head ray process. + :paramtype port: int + :keyword worker_node_additional_args: Additional arguments passed to ray start in worker node. + :paramtype worker_node_additional_args: str """ super().__init__(**kwargs) - self.properties = properties - self.tags = tags + self.distribution_type: str = "Ray" + self.address = address + self.dashboard_port = dashboard_port + self.head_node_additional_args = head_node_additional_args + self.include_dashboard = include_dashboard + self.port = port + self.worker_node_additional_args = worker_node_additional_args -class PartialManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). +class Recurrence(_serialization.Model): + """The workflow trigger recurrence for ComputeStartStop schedule type. - :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 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 = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{object}"}, + "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, *, - type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, JSON]] = 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 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 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__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities + self.frequency = frequency + self.interval = interval + self.start_time = start_time + self.time_zone = time_zone + self.schedule = schedule -class PartialMinimalTrackedResource(_serialization.Model): - """Strictly used in update requests. +class RecurrenceSchedule(_serialization.Model): + """RecurrenceSchedule. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + All required parameters must be populated in order to send to Azure. + + :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}"}, + "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, **kwargs: Any) -> None: + 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: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, 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.WeekDay] """ super().__init__(**kwargs) - self.tags = tags + self.hours = hours + self.minutes = minutes + self.month_days = month_days + self.week_days = week_days -class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class RecurrenceTrigger(TriggerBase): + """RecurrenceTrigger. - :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 + All required parameters must be populated in order to send to Azure. + + :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 = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, + "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, *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.PartialManagedServiceIdentity"] = 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 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 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__(tags=tags, **kwargs) - self.identity = identity + 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 PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): - """Strictly used in update requests. +class RegenerateEndpointKeysRequest(_serialization.Model): + """RegenerateEndpointKeysRequest. - :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 Azure. + + :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 = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "PartialSku"}, + "key_type": {"key": "keyType", "type": "str"}, + "key_value": {"key": "keyValue", "type": "str"}, } def __init__( - self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.PartialSku"] = None, **kwargs: Any + self, *, key_type: Union[str, "_models.KeyType"], key_value: Optional[str] = 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 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__(tags=tags, **kwargs) - self.sku = sku + super().__init__(**kwargs) + self.key_type = key_type + self.key_value = key_value -class PartialRegistryPartialTrackedResource(_serialization.Model): - """Strictly used in update requests. +class RegenerateServiceAccountKeyContent(_serialization.Model): + """RegenerateServiceAccountKeyContent. - :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] + :ivar key_name: Known values are: "Key1" and "Key2". + :vartype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName """ _attribute_map = { - "identity": {"key": "identity", "type": "RegistryPartialManagedServiceIdentity"}, - "sku": {"key": "sku", "type": "PartialSku"}, - "tags": {"key": "tags", "type": "{str}"}, + "key_name": {"key": "keyName", "type": "str"}, } def __init__( - self, - *, - identity: Optional["_models.RegistryPartialManagedServiceIdentity"] = None, - sku: Optional["_models.PartialSku"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any + self, *, key_name: Optional[Union[str, "_models.ServiceAccountKeyName"]] = 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 key_name: Known values are: "Key1" and "Key2". + :paramtype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName """ super().__init__(**kwargs) - self.identity = identity - self.sku = sku - self.tags = tags + self.key_name = key_name -class PartialSku(_serialization.Model): - """Common SKU definition. +class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes + """Registry. - :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. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar 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 + :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}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + _attribute_map = { - "capacity": {"key": "capacity", "type": "int"}, - "family": {"key": "family", "type": "str"}, + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "tier": {"key": "tier", "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, *, - capacity: Optional[int] = None, - family: Optional[str] = None, - name: Optional[str] = None, - size: Optional[str] = None, - tier: Optional[Union[str, "_models.SkuTier"]] = None, + 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 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 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__(**kwargs) - self.capacity = capacity - self.family = family - self.name = name - self.size = size - self.tier = tier + 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 Password(_serialization.Model): - """Password. +class RegistryListCredentialsResult(_serialization.Model): + """RegistryListCredentialsResult. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: - :vartype name: str - :ivar value: - :vartype value: str + :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 = { - "name": {"readonly": True}, - "value": {"readonly": True}, + "location": {"readonly": True}, + "username": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "passwords": {"key": "passwords", "type": "[Password]"}, + "username": {"key": "username", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, passwords: Optional[List["_models.Password"]] = None, **kwargs: Any) -> None: + """ + :keyword passwords: + :paramtype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + """ super().__init__(**kwargs) - self.name = None - self.value = None + self.location = None + self.passwords = passwords + self.username = None -class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """PATAuthTypeWorkspaceConnectionProperties. +class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): + """Managed service identity (system assigned and/or user assigned identities). - 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 + 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". + :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] """ _validation = { - "auth_type": {"required": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "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": "WorkspaceConnectionPersonalAccessToken"}, + "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, *, - 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, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = 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 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] """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "PAT" - self.credentials = credentials - - -class PendingUploadCredentialDto(_serialization.Model): - """PendingUploadCredentialDto. + super().__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - SASCredentialDto - All required parameters must be populated in order to send to Azure. +class RegistryPrivateEndpointConnection(_serialization.Model): + """Private endpoint connection definition. - :ivar credential_type: [Required] Credential type used to authentication with storage. - Required. "SAS" - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType + :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 """ - _validation = { - "credential_type": {"required": True}, - } - _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}. + :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): + """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): + """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. - :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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :ivar test_data: Test data input. + :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation + 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"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "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, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + 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 fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :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 search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings + :keyword test_data: Test data input. + :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation + 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, + fixed_parameters=fixed_parameters, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + 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 + 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.fixed_parameters = fixed_parameters + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name -class PrivateEndpointConnection(Resource): # pylint: disable=too-many-instance-attributes - """The Private Endpoint Connection resource. +class RegressionModelPerformanceMetricThreshold(ModelPerformanceMetricThresholdBase): + """RegressionModelPerformanceMetricThreshold. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar 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 + :ivar model_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Classification" and "Regression". + :vartype model_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringModelType + :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 regression model performance metric to calculate. Required. Known + values are: "MeanAbsoluteError", "RootMeanSquaredError", and "MeanSquaredError". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.RegressionModelPerformanceMetric """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "model_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"}, - "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"}, + "model_type": {"key": "modelType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "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, + metric: Union[str, "_models.RegressionModelPerformanceMetric"], + threshold: Optional["_models.MonitoringThreshold"] = 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] + :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 regression model performance metric to calculate. Required. + Known values are: "MeanAbsoluteError", "RootMeanSquaredError", and "MeanSquaredError". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.RegressionModelPerformanceMetric """ - super().__init__(**kwargs) - self.value = value - + super().__init__(threshold=threshold, **kwargs) + self.model_type: str = "Regression" + self.metric = metric -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. +class RegressionTrainingSettings(TrainingSettings): + """Regression Training related configuration. - :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 + :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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :ivar allowed_training_algorithms: Allowed models for regression task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] + :ivar blocked_training_algorithms: Blocked models for regression task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] """ - _validation = { - "id": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "subnet_arm_id": {"key": "subnetArmId", "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"}, + "training_mode": {"key": "trainingMode", "type": "str"}, + "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, + "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } - def __init__(self, *, subnet_arm_id: Optional[str] = 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, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, + **kwargs: 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 training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode + :keyword allowed_training_algorithms: Allowed models for regression task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] + :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, + training_mode=training_mode, + **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] + :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.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 + 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 RequestMatchPattern(_serialization.Model): + """RequestMatchPattern. - :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 path: + :vartype path: str + :ivar method: + :vartype method: str """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "method": {"key": "method", "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, *, path: Optional[str] = None, method: 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 path: + :paramtype path: str + :keyword method: + :paramtype method: str """ super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required + self.path = path + self.method = method -class ProbeSettings(_serialization.Model): - """Deployment container liveness/readiness probe configuration. +class ResizeSchema(_serialization.Model): + """Schema for Compute Instance resize. - :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 + :ivar target_vm_size: The name of the virtual machine size. + :vartype target_vm_size: str """ _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"}, + "target_vm_size": {"key": "targetVMSize", "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, *, target_vm_size: Optional[str] = None, **kwargs: Any) -> None: """ - :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 target_vm_size: The name of the virtual machine size. + :paramtype target_vm_size: 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.target_vm_size = target_vm_size -class PyTorch(DistributionConfiguration): - """PyTorch distribution configuration. +class ResourceId(_serialization.Model): + """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. All required parameters must be populated in order to send to Azure. - :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 id: The ID of the resource. Required. + :vartype id: str """ _validation = { - "distribution_type": {"required": True}, + "id": {"required": True}, } _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, - "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, + "id": {"key": "id", "type": "str"}, } - def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword process_count_per_instance: Number of processes per node. - :paramtype process_count_per_instance: int + :keyword id: The ID of the resource. Required. + :paramtype id: str """ super().__init__(**kwargs) - self.distribution_type: str = "PyTorch" - self.process_count_per_instance = process_count_per_instance + self.id = id -class QuotaBaseProperties(_serialization.Model): - """The properties for Quota update or retrieval. +class ResourceName(_serialization.Model): + """The Resource Name. - :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 + 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 """ + _validation = { + "value": {"readonly": True}, + "localized_value": {"readonly": True}, + } + _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "limit": {"key": "limit", "type": "int"}, - "unit": {"key": "unit", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - 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, - **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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.id = id - self.type = type - self.limit = limit - self.unit = unit + self.value = None + self.localized_value = None -class QuotaUpdateParameters(_serialization.Model): - """Quota update parameters. +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 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 + :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 = { - "value": {"key": "value", "type": "[QuotaBaseProperties]"}, - "location": {"key": "location", "type": "str"}, + "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, - *, - value: Optional[List["_models.QuotaBaseProperties"]] = None, - location: Optional[str] = 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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.location = location + self.id = None + self.aml_workspace_location = None + self.type = None + self.name = None + self.limit = None + self.unit = None -class RandomSamplingAlgorithm(SamplingAlgorithm): - """Defines a Sampling Algorithm that generates values randomly. +class RollingInputData(MonitoringInputDataBase): + """Rolling input data definition. All required parameters must be populated in order to send to Azure. - :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 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: The ARM resource ID of the component resource 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 trailing data window. Required. + :vartype window_size: ~datetime.timedelta """ _validation = { - "sampling_algorithm_type": {"required": True}, + "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 = { - "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, - "rule": {"key": "rule", "type": "str"}, - "seed": {"key": "seed", "type": "int"}, + "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, *, - rule: Optional[Union[str, "_models.RandomSamplingAlgorithmRule"]] = None, - seed: Optional[int] = 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 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.sampling_algorithm_type: str = "Random" - self.rule = rule - self.seed = seed + :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: The ARM resource ID of the component resource 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 trailing 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 Recurrence(_serialization.Model): - """The workflow trigger recurrence for ComputeStartStop schedule type. +class Route(_serialization.Model): + """Route. - :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 Azure. + + :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 = { - "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"}, + "path": {"key": "path", "type": "str"}, + "port": {"key": "port", "type": "int"}, } - 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, *, path: str, port: int, **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 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.frequency = frequency - self.interval = interval - self.start_time = start_time - self.time_zone = time_zone - self.schedule = schedule + self.path = path + self.port = port -class RecurrenceSchedule(_serialization.Model): - """RecurrenceSchedule. +class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """SASAuthTypeWorkspaceConnectionProperties. + + 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 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 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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature """ _validation = { - "hours": {"required": True}, - "minutes": {"required": True}, + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": 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]"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "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": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionSharedAccessSignature"}, } def __init__( self, *, - hours: List[int], - minutes: List[int], - month_days: Optional[List[int]] = None, - week_days: Optional[List[Union[str, "_models.WeekDay"]]] = None, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + credentials: Optional["_models.WorkspaceConnectionSharedAccessSignature"] = None, **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 category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature """ - super().__init__(**kwargs) - self.hours = hours - self.minutes = minutes - self.month_days = month_days - self.week_days = week_days - - -class RecurrenceTrigger(TriggerBase): - """RecurrenceTrigger. + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "SAS" + self.credentials = credentials - All required parameters must be populated in order to send to Azure. - :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 +class SASCredential(DataReferenceCredential): + """Access with full SAS uri. + + All required parameters must be populated in order to send to Azure. + + :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 = { - "trigger_type": {"required": True}, - "frequency": {"required": True}, - "interval": {"required": True}, + "credential_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"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "sas_uri": {"key": "sasUri", "type": "str"}, } - 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, - **kwargs: Any - ) -> None: + def __init__(self, *, sas_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 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 sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :paramtype sas_uri: str """ - 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.credential_type: str = "SAS" + self.sas_uri = sas_uri -class RegenerateEndpointKeysRequest(_serialization.Model): - """RegenerateEndpointKeysRequest. +class SASCredentialDto(PendingUploadCredentialDto): + """SASCredentialDto. All required parameters must be populated in order to send to Azure. - :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 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 = { - "key_type": {"required": True}, + "credential_type": {"required": True}, } _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - "key_value": {"key": "keyValue", "type": "str"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "sas_uri": {"key": "sasUri", "type": "str"}, } - def __init__( - self, *, key_type: Union[str, "_models.KeyType"], key_value: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, sas_uri: Optional[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 sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :paramtype sas_uri: str """ super().__init__(**kwargs) - self.key_type = key_type - self.key_value = key_value - + self.credential_type: str = "SAS" + self.sas_uri = sas_uri -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. +class SasDatastoreCredentials(DatastoreCredentials): + """SAS datastore credentials configuration. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar 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 credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar secrets: [Required] Storage container secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, + "credentials_type": {"required": True}, + "secrets": {"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"}, - "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]"}, + "credentials_type": {"key": "credentialsType", "type": "str"}, + "secrets": {"key": "secrets", "type": "SasDatastoreSecrets"}, } - 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, *, secrets: "_models.SasDatastoreSecrets", **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 secrets: [Required] Storage container secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets """ - 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.credentials_type: str = "Sas" + self.secrets = secrets -class RegistryListCredentialsResult(_serialization.Model): - """RegistryListCredentialsResult. +class SasDatastoreSecrets(DatastoreSecrets): + """Datastore SAS secrets. - 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 location: - :vartype location: str - :ivar username: - :vartype username: str - :ivar passwords: - :vartype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar sas_token: Storage container SAS token. + :vartype sas_token: str """ _validation = { - "location": {"readonly": True}, - "username": {"readonly": True}, + "secrets_type": {"required": True}, } _attribute_map = { - "location": {"key": "location", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "passwords": {"key": "passwords", "type": "[Password]"}, + "secrets_type": {"key": "secretsType", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, } - def __init__(self, *, passwords: Optional[List["_models.Password"]] = None, **kwargs: Any) -> None: + def __init__(self, *, sas_token: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword passwords: - :paramtype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :keyword sas_token: Storage container SAS token. + :paramtype sas_token: str """ super().__init__(**kwargs) - self.location = None - self.username = None - self.passwords = passwords - + self.secrets_type: str = "Sas" + self.sas_token = sas_token -class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): - """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. +class ScaleSettings(_serialization.Model): + """scale settings for AML Compute. 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". - :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 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 = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "max_node_count": {"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}"}, + "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, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + max_node_count: int, + min_node_count: int = 0, + node_idle_time_before_scale_down: Optional[datetime.timedelta] = 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}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :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__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) + 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 RegistryPrivateEndpointConnection(_serialization.Model): - """Private endpoint connection definition. +class ScaleSettingsInformation(_serialization.Model): + """Desired scale settings for the amlCompute. - :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}. + :ivar scale_settings: scale settings for AML Compute. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + """ + + _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 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. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :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 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 """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + } + _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"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ScheduleProperties"}, } - 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: + def __init__(self, *, properties: "_models.ScheduleProperties", **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 properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties """ 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.properties = properties -class RegistryPrivateLinkServiceConnectionState(_serialization.Model): - """The connection state. +class ScheduleBase(_serialization.Model): + """ScheduleBase. - :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 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 """ _attribute_map = { - "actions_required": {"key": "actionsRequired", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "provisioning_status": {"key": "provisioningStatus", "type": "str"}, "status": {"key": "status", "type": "str"}, } def __init__( self, *, - actions_required: Optional[str] = None, - description: Optional[str] = None, - status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = None, + 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 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 + :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.actions_required = actions_required - self.description = description + self.id = id + self.provisioning_status = provisioning_status self.status = status -class RegistryRegionArmDetails(_serialization.Model): - """Details for each region the registry is in. +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. - :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 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 = { + "action": {"required": True}, + "provisioning_state": {"readonly": True}, + "trigger": {"required": True}, + } + _attribute_map = { - "acr_details": {"key": "acrDetails", "type": "[AcrDetails]"}, - "location": {"key": "location", "type": "str"}, - "storage_account_details": {"key": "storageAccountDetails", "type": "[StorageAccountDetails]"}, + "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, *, - acr_details: Optional[List["_models.AcrDetails"]] = None, - location: Optional[str] = None, - storage_account_details: Optional[List["_models.StorageAccountDetails"]] = 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 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 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__(**kwargs) - self.acr_details = acr_details - self.location = location - self.storage_account_details = storage_account_details + 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 RegistryTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Registry entities. +class ScheduleResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Schedule entities. - :ivar next_link: The link to the next page of Registry objects. If null, there are no + :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 Registry. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Registry] + :ivar value: An array of objects of type Schedule. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Schedule] """ _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Registry]"}, + "value": {"key": "value", "type": "[Schedule]"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.Registry"]] = None, **kwargs: Any + 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 Registry objects. If null, there are no + :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 Registry. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.Registry] + :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 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. +class ScriptReference(_serialization.Model): + """Script reference. - :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 + :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 """ - _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"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, - "training_settings": {"key": "trainingSettings", "type": "RegressionTrainingSettings"}, + "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, *, - 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, + script_source: Optional[str] = None, + script_data: Optional[str] = None, + script_arguments: Optional[str] = None, + timeout: 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 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 + :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__( - 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 + super().__init__(**kwargs) + self.script_source = script_source + self.script_data = script_data + self.script_arguments = script_arguments + self.timeout = timeout -class RegressionTrainingSettings(TrainingSettings): - """Regression Training related configuration. +class ScriptsToExecute(_serialization.Model): + """Customized setup scripts. - :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] + :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 = { - "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]"}, + "startup_script": {"key": "startupScript", "type": "ScriptReference"}, + "creation_script": {"key": "creationScript", "type": "ScriptReference"}, } 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, + startup_script: Optional["_models.ScriptReference"] = None, + creation_script: Optional["_models.ScriptReference"] = 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 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__( - 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.startup_script = startup_script + self.creation_script = creation_script -class ResourceId(_serialization.Model): - """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. - All required parameters must be populated in order to send to Azure. +class SecretConfiguration(_serialization.Model): + """Secret Configuration definition. - :ivar id: The ID of the resource. Required. - :vartype id: str + :ivar uri: Secret Uri. + Sample Uri : https://myvault.vault.azure.net/secrets/mysecretname/secretversion. + :vartype uri: str + :ivar workspace_secret_name: Name of secret in workspace key vault. + :vartype workspace_secret_name: str """ - _validation = { - "id": {"required": True}, + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + "workspace_secret_name": {"key": "workspaceSecretName", "type": "str"}, } + def __init__( + self, *, uri: Optional[str] = None, workspace_secret_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword uri: Secret Uri. + Sample Uri : https://myvault.vault.azure.net/secrets/mysecretname/secretversion. + :paramtype uri: str + :keyword workspace_secret_name: Name of secret in workspace key vault. + :paramtype workspace_secret_name: str + """ + super().__init__(**kwargs) + self.uri = uri + self.workspace_secret_name = workspace_secret_name + + +class ServerlessComputeSettings(_serialization.Model): + """ServerlessComputeSettings. + + :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 = { - "id": {"key": "id", "type": "str"}, + "serverless_compute_custom_subnet": {"key": "serverlessComputeCustomSubnet", "type": "str"}, + "serverless_compute_no_public_ip": {"key": "serverlessComputeNoPublicIP", "type": "bool"}, } - def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + def __init__( + self, + *, + serverless_compute_custom_subnet: Optional[str] = None, + serverless_compute_no_public_ip: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword id: The ID of the resource. Required. - :paramtype id: str + :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.id = id + self.serverless_compute_custom_subnet = serverless_compute_custom_subnet + self.serverless_compute_no_public_ip = serverless_compute_no_public_ip -class ResourceName(_serialization.Model): - """The Resource Name. +class ServerlessEndpoint(TrackedResource): + """ServerlessEndpoint. 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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { - "value": {"readonly": True}, - "localized_value": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "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": "ServerlessEndpointProperties"}, + "sku": {"key": "sku", "type": "Sku"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.localized_value = None + def __init__( + self, + *, + 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 ResourceQuota(_serialization.Model): - """The quota assigned to a resource. +class ServerlessEndpointCapacityReservation(_serialization.Model): + """ServerlessEndpointCapacityReservation. - 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: 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 + :ivar capacity_reservation_group_id: [Required] Specifies a capacity reservation group ID to + allocate capacity from. Required. + :vartype capacity_reservation_group_id: str + :ivar endpoint_reserved_capacity: Specifies a capacity amount to reserve for this endpoint + within the parent capacity reservation group. + :vartype endpoint_reserved_capacity: int """ _validation = { - "id": {"readonly": True}, - "aml_workspace_location": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "limit": {"readonly": True}, - "unit": {"readonly": True}, + "capacity_reservation_group_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _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"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupId", "type": "str"}, + "endpoint_reserved_capacity": {"key": "endpointReservedCapacity", "type": "int"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, capacity_reservation_group_id: str, endpoint_reserved_capacity: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword capacity_reservation_group_id: [Required] Specifies a capacity reservation group ID to + allocate capacity from. Required. + :paramtype capacity_reservation_group_id: str + :keyword endpoint_reserved_capacity: Specifies a capacity amount to reserve for this endpoint + within the parent capacity reservation group. + :paramtype endpoint_reserved_capacity: int + """ super().__init__(**kwargs) - self.id = None - self.aml_workspace_location = None - self.type = None - self.name = None - self.limit = None - self.unit = None + self.capacity_reservation_group_id = capacity_reservation_group_id + self.endpoint_reserved_capacity = endpoint_reserved_capacity -class Route(_serialization.Model): - """Route. +class ServerlessEndpointProperties(_serialization.Model): + """ServerlessEndpointProperties. - 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 path: [Required] The path for the route. Required. - :vartype path: str - :ivar port: [Required] The port for the route. Required. - :vartype port: int + :ivar auth_mode: Specifies the authentication mode for the Serverless endpoint. Known values + are: "Key" and "AAD". + :vartype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :ivar capacity_reservation: Optional capacity reservation information for the endpoint. When + specified, the Serverless Endpoint + will be allocated capacity from the specified capacity reservation group. + :vartype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :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 ARM 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 offer: The publisher-defined Serverless Offer to provision the endpoint with. + :vartype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + :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 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 """ _validation = { - "path": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - "port": {"required": True}, + "inference_endpoint": {"readonly": True}, + "marketplace_subscription_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "endpoint_state": {"readonly": True}, } _attribute_map = { - "path": {"key": "path", "type": "str"}, - "port": {"key": "port", "type": "int"}, + "auth_mode": {"key": "authMode", "type": "str"}, + "capacity_reservation": {"key": "capacityReservation", "type": "ServerlessEndpointCapacityReservation"}, + "inference_endpoint": {"key": "inferenceEndpoint", "type": "ServerlessInferenceEndpoint"}, + "marketplace_subscription_id": {"key": "marketplaceSubscriptionId", "type": "str"}, + "model_settings": {"key": "modelSettings", "type": "ModelSettings"}, + "offer": {"key": "offer", "type": "ServerlessOffer"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "endpoint_state": {"key": "endpointState", "type": "str"}, } - def __init__(self, *, path: str, port: int, **kwargs: Any) -> None: + def __init__( + self, + *, + auth_mode: Optional[Union[str, "_models.ServerlessInferenceEndpointAuthMode"]] = None, + capacity_reservation: Optional["_models.ServerlessEndpointCapacityReservation"] = None, + model_settings: Optional["_models.ModelSettings"] = None, + offer: Optional["_models.ServerlessOffer"] = None, + **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 auth_mode: Specifies the authentication mode for the Serverless endpoint. Known values + are: "Key" and "AAD". + :paramtype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :keyword capacity_reservation: Optional capacity reservation information for the endpoint. When + specified, the Serverless Endpoint + will be allocated capacity from the specified capacity reservation group. + :paramtype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :keyword model_settings: The model settings (model id) for the model being serviced on the + ServerlessEndpoint. + :paramtype model_settings: ~azure.mgmt.machinelearningservices.models.ModelSettings + :keyword offer: The publisher-defined Serverless Offer to provision the endpoint with. + :paramtype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer """ super().__init__(**kwargs) - self.path = path - self.port = port + self.auth_mode = auth_mode + self.capacity_reservation = capacity_reservation + self.inference_endpoint = None + self.marketplace_subscription_id = None + self.model_settings = model_settings + self.offer = offer + self.provisioning_state = None + self.endpoint_state = None -class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """SASAuthTypeWorkspaceConnectionProperties. +class ServerlessEndpointStatus(_serialization.Model): + """ServerlessEndpointStatus. - 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.WorkspaceConnectionSharedAccessSignature + :ivar metrics: The model-specific metrics from the backing inference endpoint. + :vartype metrics: dict[str, str] """ _validation = { - "auth_type": {"required": True}, + "metrics": {"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": "WorkspaceConnectionSharedAccessSignature"}, + "metrics": {"key": "metrics", "type": "{str}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.metrics = None + + +class ServerlessEndpointTrackedResourceArmPaginatedResult(_serialization.Model): + """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, *, - 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.WorkspaceConnectionSharedAccessSignature"] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.ServerlessEndpoint"]] = 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.WorkspaceConnectionSharedAccessSignature + :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__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "SAS" - self.credentials = credentials + super().__init__(**kwargs) + self.next_link = next_link + self.value = value -class SASCredentialDto(PendingUploadCredentialDto): - """SASCredentialDto. +class ServerlessInferenceEndpoint(_serialization.Model): + """ServerlessInferenceEndpoint. + + 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 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 + :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 = { - "credential_type": {"required": True}, + "headers": {"readonly": True}, + "uri": {"required": True}, } _attribute_map = { - "credential_type": {"key": "credentialType", "type": "str"}, - "sas_uri": {"key": "sasUri", "type": "str"}, + "headers": {"key": "headers", "type": "{str}"}, + "uri": {"key": "uri", "type": "str"}, } - def __init__(self, *, sas_uri: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, uri: str, **kwargs: Any) -> None: """ - :keyword sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. - :paramtype sas_uri: str + :keyword uri: [Required] The inference uri to target when making requests against the + Serverless Endpoint. Required. + :paramtype uri: str """ super().__init__(**kwargs) - self.credential_type: str = "SAS" - self.sas_uri = sas_uri + self.headers = None + self.uri = uri -class SasDatastoreCredentials(DatastoreCredentials): - """SAS datastore credentials configuration. +class ServerlessOffer(_serialization.Model): + """ServerlessOffer. All required parameters must be populated in order to send to Azure. - :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". - :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 offer_name: [Required] The name of the Serverless Offer. Required. + :vartype offer_name: str + :ivar publisher: [Required] Publisher name of the Serverless Offer. Required. + :vartype publisher: str """ _validation = { - "credentials_type": {"required": True}, - "secrets": {"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 = { - "credentials_type": {"key": "credentialsType", "type": "str"}, - "secrets": {"key": "secrets", "type": "SasDatastoreSecrets"}, + "offer_name": {"key": "offerName", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } - def __init__(self, *, secrets: "_models.SasDatastoreSecrets", **kwargs: Any) -> None: + def __init__(self, *, offer_name: str, publisher: str, **kwargs: Any) -> None: """ - :keyword secrets: [Required] Storage container secrets. Required. - :paramtype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets + :keyword offer_name: [Required] The name of the Serverless Offer. Required. + :paramtype offer_name: str + :keyword publisher: [Required] Publisher name of the Serverless Offer. Required. + :paramtype publisher: str """ super().__init__(**kwargs) - self.credentials_type: str = "Sas" - self.secrets = secrets - + self.offer_name = offer_name + self.publisher = publisher -class SasDatastoreSecrets(DatastoreSecrets): - """Datastore SAS secrets. - All required parameters must be populated in order to send to Azure. +class ServiceManagedResourcesSettings(_serialization.Model): + """ServiceManagedResourcesSettings. - :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 cosmos_db: + :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ - _validation = { - "secrets_type": {"required": True}, - } - _attribute_map = { - "secrets_type": {"key": "secretsType", "type": "str"}, - "sas_token": {"key": "sasToken", "type": "str"}, + "cosmos_db": {"key": "cosmosDb", "type": "CosmosDbSettings"}, } - def __init__(self, *, sas_token: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, cosmos_db: Optional["_models.CosmosDbSettings"] = None, **kwargs: Any) -> None: """ - :keyword sas_token: Storage container SAS token. - :paramtype sas_token: str + :keyword cosmos_db: + :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ super().__init__(**kwargs) - self.secrets_type: str = "Sas" - self.sas_token = sas_token + self.cosmos_db = cosmos_db -class ScaleSettings(_serialization.Model): - """scale settings for AML Compute. +class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """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. - :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 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", + "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", "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", and "GenericContainerRegistry". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal """ _validation = { - "max_node_count": {"required": True}, + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": 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"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "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": "object"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionServicePrincipal"}, } def __init__( self, *, - max_node_count: int, - min_node_count: int = 0, - node_idle_time_before_scale_down: Optional[datetime.timedelta] = None, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + credentials: Optional["_models.WorkspaceConnectionServicePrincipal"] = 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 category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "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", "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", and "GenericContainerRegistry". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal """ - 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 + super().__init__( + category=category, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) + self.auth_type: str = "ServicePrincipal" + self.credentials = credentials -class ScaleSettingsInformation(_serialization.Model): - """Desired scale settings for the amlCompute. +class ServicePrincipalDatastoreCredentials(DatastoreCredentials): + """Service Principal datastore credentials configuration. - :ivar scale_settings: scale settings for AML Compute. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + All required parameters must be populated in order to send to Azure. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar 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 = { - "scale_settings": {"key": "scaleSettings", "type": "ScaleSettings"}, + "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"}, } - def __init__(self, *, scale_settings: Optional["_models.ScaleSettings"] = None, **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 scale_settings: scale settings for AML Compute. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + :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.scale_settings = scale_settings - + 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 Schedule(Resource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class ServicePrincipalDatastoreSecrets(DatastoreSecrets): + """Datastore Service Principal secrets. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar client_secret: Service principal secret. + :vartype client_secret: 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": "ScheduleProperties"}, + "secrets_type": {"key": "secretsType", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, properties: "_models.ScheduleProperties", **kwargs: Any) -> None: + def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties + :keyword client_secret: Service principal secret. + :paramtype client_secret: str """ super().__init__(**kwargs) - self.properties = properties + self.secrets_type: str = "ServicePrincipal" + self.client_secret = client_secret -class ScheduleBase(_serialization.Model): - """ScheduleBase. +class ServiceTagDestination(_serialization.Model): + """Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine + learning workspace. - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + :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 = { + "address_prefixes": {"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"}, + "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, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - provisioning_status: Optional[Union[str, "_models.ScheduleProvisioningState"]] = None, - status: Optional[Union[str, "_models.ScheduleStatus"]] = None, + action: Optional[Union[str, "_models.RuleAction"]] = None, + port_ranges: Optional[str] = None, + protocol: Optional[str] = None, + service_tag: Optional[str] = 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 action: The action enum for networking rule. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.machinelearningservices.models.RuleAction + :keyword port_ranges: + :paramtype port_ranges: str + :keyword protocol: + :paramtype protocol: str + :keyword service_tag: + :paramtype service_tag: str """ super().__init__(**kwargs) - self.id = id - self.provisioning_status = provisioning_status - self.status = status - + self.action = action + self.address_prefixes = None + self.port_ranges = port_ranges + self.protocol = protocol + self.service_tag = service_tag -class ScheduleProperties(ResourceBase): - """Base definition of a schedule. - Variables are only populated by the server, and will be ignored when sending a request. +class ServiceTagOutboundRule(OutboundRule): + """Service Tag Outbound Rule for the managed network of a machine learning workspace. 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 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 category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :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 = { - "action": {"required": True}, - "provisioning_state": {"readonly": True}, - "trigger": {"required": True}, + "type": {"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"}, + "category": {"key": "category", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "destination": {"key": "destination", "type": "ServiceTagDestination"}, } 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, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + destination: Optional["_models.ServiceTagDestination"] = 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 category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", and "UserDefined". + :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__(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__(category=category, status=status, **kwargs) + self.type: str = "ServiceTag" + self.destination = destination -class ScheduleResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Schedule entities. +class SetupScripts(_serialization.Model): + """Details of customized scripts to execute for setting up the cluster. - :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 scripts: Customized setup scripts. + :vartype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Schedule]"}, + "scripts": {"key": "scripts", "type": "ScriptsToExecute"}, + } + + 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 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 = { + "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, *, next_link: Optional[str] = None, value: Optional[List["_models.Schedule"]] = None, **kwargs: Any + self, + *, + 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 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 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.next_link = next_link - self.value = value + 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 ScriptReference(_serialization.Model): - """Script reference. +class Sku(_serialization.Model): + """The resource model definition representing SKU. - :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 + All required parameters must be populated in order to send to Azure. + + :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 = { + "name": {"required": 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"}, + "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, *, - script_source: Optional[str] = None, - script_data: Optional[str] = None, - script_arguments: Optional[str] = None, - timeout: Optional[str] = None, + 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 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 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__(**kwargs) - self.script_source = script_source - self.script_data = script_data - self.script_arguments = script_arguments - self.timeout = timeout + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity -class ScriptsToExecute(_serialization.Model): - """Customized setup scripts. +class SkuCapacity(_serialization.Model): + """SKU capacity information. - :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 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 = { - "startup_script": {"key": "startupScript", "type": "ScriptReference"}, - "creation_script": {"key": "creationScript", "type": "ScriptReference"}, + "default": {"key": "default", "type": "int"}, + "maximum": {"key": "maximum", "type": "int"}, + "minimum": {"key": "minimum", "type": "int"}, + "scale_type": {"key": "scaleType", "type": "str"}, } def __init__( self, *, - startup_script: Optional["_models.ScriptReference"] = None, - creation_script: Optional["_models.ScriptReference"] = None, + default: int = 0, + maximum: int = 0, + minimum: int = 0, + scale_type: Optional[Union[str, "_models.SkuScaleType"]] = 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 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.startup_script = startup_script - self.creation_script = creation_script + self.default = default + self.maximum = maximum + self.minimum = minimum + self.scale_type = scale_type -class ServiceManagedResourcesSettings(_serialization.Model): - """ServiceManagedResourcesSettings. +class SkuResource(_serialization.Model): + """Fulfills ARM Contract requirement to list all available SKUS for a resource. - :ivar cosmos_db: The settings for the service managed cosmosdb account. - :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + 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 = { - "cosmos_db": {"key": "cosmosDb", "type": "CosmosDbSettings"}, + "capacity": {"key": "capacity", "type": "SkuCapacity"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "sku": {"key": "sku", "type": "SkuSetting"}, } - def __init__(self, *, cosmos_db: Optional["_models.CosmosDbSettings"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + capacity: Optional["_models.SkuCapacity"] = None, + sku: Optional["_models.SkuSetting"] = None, + **kwargs: Any + ) -> None: """ - :keyword cosmos_db: The settings for the service managed cosmosdb account. - :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + :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.cosmos_db = cosmos_db - + self.capacity = capacity + self.resource_type = None + self.sku = sku -class ServicePrincipalDatastoreCredentials(DatastoreCredentials): - """Service Principal datastore credentials configuration. - All required parameters must be populated in order to send to Azure. +class SkuResourceArmPaginatedResult(_serialization.Model): + """A paginated list of SkuResource entities. - :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 + :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] """ - _validation = { - "credentials_type": {"required": True}, - "client_id": {"required": True}, - "secrets": {"required": True}, - "tenant_id": {"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"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[SkuResource]"}, } def __init__( - self, - *, - client_id: str, - secrets: "_models.ServicePrincipalDatastoreSecrets", - tenant_id: str, - authority_url: Optional[str] = None, - resource_url: Optional[str] = None, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.SkuResource"]] = 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 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.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 + self.next_link = next_link + self.value = value -class ServicePrincipalDatastoreSecrets(DatastoreSecrets): - """Datastore Service Principal secrets. +class SkuSetting(_serialization.Model): + """SkuSetting fulfills the need for stripped down SKU info in ARM contract. All required parameters must be populated in order to send to Azure. - :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". - :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType - :ivar client_secret: Service principal secret. - :vartype client_secret: str + :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 = { - "secrets_type": {"required": True}, + "name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "secrets_type": {"key": "secretsType", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, name: str, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any) -> None: """ - :keyword client_secret: Service principal secret. - :paramtype client_secret: str + :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.secrets_type: str = "ServicePrincipal" - self.client_secret = client_secret + self.name = name + self.tier = tier -class SetupScripts(_serialization.Model): - """Details of customized scripts to execute for setting up the cluster. +class SparkJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Spark job definition. - :ivar scripts: Customized setup scripts. - :vartype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar archives: Archive files used in the job. + :vartype archives: list[str] + :ivar args: Arguments for the job. + :vartype args: str + :ivar code_id: [Required] ARM resource ID of the code asset. Required. + :vartype code_id: str + :ivar conf: Spark configured properties. + :vartype conf: dict[str, str] + :ivar entry: [Required] The entry to execute on startup of the job. Required. + :vartype entry: ~azure.mgmt.machinelearningservices.models.SparkJobEntry + :ivar environment_id: The ARM resource ID of the Environment specification for the job. + :vartype environment_id: str + :ivar 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 = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "code_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "entry": {"required": True}, + } + _attribute_map = { - "scripts": {"key": "scripts", "type": "ScriptsToExecute"}, + "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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, + "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__(self, *, scripts: Optional["_models.ScriptsToExecute"] = None, **kwargs: Any) -> None: + def __init__( # pylint: disable=too-many-locals + self, + *, + code_id: str, + entry: "_models.SparkJobEntry", + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + component_id: Optional[str] = None, + compute_id: Optional[str] = None, + display_name: Optional[str] = None, + experiment_name: str = "Default", + identity: Optional["_models.IdentityConfiguration"] = None, + is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = 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 scripts: Customized setup scripts. - :paramtype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute + :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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword archives: Archive files used in the job. + :paramtype archives: list[str] + :keyword args: Arguments for the job. + :paramtype args: str + :keyword code_id: [Required] ARM resource ID of the code asset. Required. + :paramtype code_id: str + :keyword conf: Spark configured properties. + :paramtype conf: dict[str, str] + :keyword entry: [Required] The entry to execute on startup of the job. Required. + :paramtype entry: ~azure.mgmt.machinelearningservices.models.SparkJobEntry + :keyword environment_id: The ARM resource ID of the Environment specification for the job. + :paramtype environment_id: str + :keyword 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.scripts = scripts + 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, + secrets_configuration=secrets_configuration, + 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 SharedPrivateLinkResource(_serialization.Model): - """SharedPrivateLinkResource. +class SparkJobEntry(_serialization.Model): + """Spark job entry point definition. - :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 + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SparkJobPythonEntry, SparkJobScalaEntry + + All required parameters must be populated in order to send to Azure. + + :ivar spark_job_entry_type: [Required] Type of the job's entry point. Required. Known values + are: "SparkJobPythonEntry" and "SparkJobScalaEntry". + :vartype spark_job_entry_type: str or + ~azure.mgmt.machinelearningservices.models.SparkJobEntryType """ + _validation = { + "spark_job_entry_type": {"required": True}, + } + _attribute_map = { - "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"}, + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, } - 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 - """ + _subtype_map = { + "spark_job_entry_type": { + "SparkJobPythonEntry": "SparkJobPythonEntry", + "SparkJobScalaEntry": "SparkJobScalaEntry", + } + } + + 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. - :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 = { + "spark_job_entry_type": {"required": True}, + "file": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + "file": {"key": "file", "type": "str"}, + } + + def __init__(self, *, file: str, **kwargs: Any) -> None: + """ + :keyword file: [Required] Relative python file path for job entry point. Required. + :paramtype file: str + """ + super().__init__(**kwargs) + self.spark_job_entry_type: str = "SparkJobPythonEntry" + self.file = file + + +class SparkJobScalaEntry(SparkJobEntry): + """SparkJobScalaEntry. + + All required parameters must be populated in order to send to Azure. + + :ivar spark_job_entry_type: [Required] Type of the job's entry point. Required. Known values + are: "SparkJobPythonEntry" and "SparkJobScalaEntry". + :vartype spark_job_entry_type: str or + ~azure.mgmt.machinelearningservices.models.SparkJobEntryType + :ivar class_name: [Required] Scala class name used as entry point. Required. + :vartype class_name: str """ _validation = { - "name": {"required": True}, + "spark_job_entry_type": {"required": True}, + "class_name": {"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"}, + "class_name": {"key": "className", "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, *, class_name: 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 class_name: [Required] Scala class name used as entry point. Required. + :paramtype class_name: 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 = "SparkJobScalaEntry" + self.class_name = class_name -class SkuCapacity(_serialization.Model): - """SKU capacity information. +class SparkResourceConfiguration(_serialization.Model): + """SparkResourceConfiguration. - :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 + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar runtime_version: Version of spark runtime used for the job. + :vartype runtime_version: str """ _attribute_map = { - "default": {"key": "default", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "minimum": {"key": "minimum", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "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, *, instance_type: Optional[str] = None, runtime_version: str = "3.1", **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 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.default = default - self.maximum = maximum - self.minimum = minimum - self.scale_type = scale_type + self.instance_type = instance_type + self.runtime_version = runtime_version -class SkuResource(_serialization.Model): - """Fulfills ARM Contract requirement to list all available SKUS for a resource. +class SpeechEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): + """SpeechEndpointDeploymentResourceProperties. 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 + All required parameters must be populated in order to send to Azure. + + :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", and "Canceled". + :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 = { - "resource_type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9._]"}, + "model": {"required": True}, } _attribute_map = { - "capacity": {"key": "capacity", "type": "SkuCapacity"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "sku": {"key": "sku", "type": "SkuSetting"}, + "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, *, - capacity: Optional["_models.SkuCapacity"] = None, - sku: Optional["_models.SkuSetting"] = 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 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 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.capacity = capacity - self.resource_type = None + 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 SkuResourceArmPaginatedResult(_serialization.Model): - """A paginated list of SkuResource entities. - - :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 = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[SkuResource]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.SkuResource"]] = 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] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - +class SpeechEndpointResourceProperties(EndpointResourceProperties): + """SpeechEndpointResourceProperties. -class SkuSetting(_serialization.Model): - """SkuSetting fulfills the need for stripped down SKU info in ARM contract. + 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 name: [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. - Required. + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", and "managedOnlineEndpoint". + :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 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", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState """ _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"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, name: str, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + name: Optional[str] = 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 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 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 """ - super().__init__(**kwargs) - self.name = name - self.tier = tier + super().__init__( + associated_resource_id=associated_resource_id, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + name=name, + **kwargs + ) + self.endpoint_type: str = "Azure.Speech" class SslConfiguration(_serialization.Model): @@ -19516,6 +33588,130 @@ 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 Azure. + + :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: The ARM resource ID of the component resource 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: The ARM resource ID of the component resource 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 StatusMessage(_serialization.Model): + """Active message associated with project. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service-defined message code. + :vartype code: str + :ivar created_date_time: Time in UTC at which the message was created. + :vartype created_date_time: ~datetime.datetime + :ivar level: Severity level of message. Known values are: "Error", "Information", and + "Warning". + :vartype level: str or ~azure.mgmt.machinelearningservices.models.StatusMessageLevel + :ivar message: A human-readable representation of the message code. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "created_date_time": {"readonly": True}, + "level": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, + "level": {"key": "level", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.created_date_time = None + self.level = None + self.message = None + + class StorageAccountDetails(_serialization.Model): """Details of storage account to be used for the Registry. @@ -19585,15 +33781,23 @@ class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attribut :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", "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 secrets_configuration: Configuration for secrets to be made available during runtime. + :vartype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar component_configuration: Component Configuration for sweep over component. + :vartype component_configuration: + ~azure.mgmt.machinelearningservices.models.ComponentConfiguration :ivar early_termination: Early termination policies enable canceling poor-performing runs before they complete. :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy @@ -19605,6 +33809,10 @@ 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 resources: Compute Resource configuration for the job. + :vartype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration :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,19 +33842,24 @@ 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"}, + "secrets_configuration": {"key": "secretsConfiguration", "type": "{SecretConfiguration}"}, "services": {"key": "services", "type": "{JobService}"}, "status": {"key": "status", "type": "str"}, + "component_configuration": {"key": "componentConfiguration", "type": "ComponentConfiguration"}, "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, "inputs": {"key": "inputs", "type": "{JobInput}"}, "limits": {"key": "limits", "type": "SweepJobLimits"}, "objective": {"key": "objective", "type": "Objective"}, "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, + "resources": {"key": "resources", "type": "JobResourceConfiguration"}, "sampling_algorithm": {"key": "samplingAlgorithm", "type": "SamplingAlgorithm"}, "search_space": {"key": "searchSpace", "type": "object"}, "trial": {"key": "trial", "type": "TrialComponent"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, objective: "_models.Objective", @@ -19662,11 +33875,16 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, + secrets_configuration: Optional[Dict[str, "_models.SecretConfiguration"]] = None, services: Optional[Dict[str, "_models.JobService"]] = None, + component_configuration: Optional["_models.ComponentConfiguration"] = 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, + resources: Optional["_models.JobResourceConfiguration"] = None, **kwargs: Any ) -> None: """ @@ -19691,9 +33909,17 @@ 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 secrets_configuration: Configuration for secrets to be made available during runtime. + :paramtype secrets_configuration: dict[str, + ~azure.mgmt.machinelearningservices.models.SecretConfiguration] :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 component_configuration: Component Configuration for sweep over component. + :paramtype component_configuration: + ~azure.mgmt.machinelearningservices.models.ComponentConfiguration :keyword early_termination: Early termination policies enable canceling poor-performing runs before they complete. :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy @@ -19705,6 +33931,10 @@ 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 resources: Compute Resource configuration for the job. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration :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,15 +33953,20 @@ def __init__( experiment_name=experiment_name, identity=identity, is_archived=is_archived, + notification_setting=notification_setting, + secrets_configuration=secrets_configuration, services=services, **kwargs ) self.job_type: str = "Sweep" + self.component_configuration = component_configuration self.early_termination = early_termination self.inputs = inputs self.limits = limits self.objective = objective self.outputs = outputs + self.queue_settings = queue_settings + self.resources = resources self.sampling_algorithm = sampling_algorithm self.search_space = search_space self.trial = trial @@ -20186,6 +34421,372 @@ def __init__(self, **kwargs: Any) -> None: self.version = None +class TableFixedParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Fixed training parameters that won't be swept over during AutoML Table training. + + :ivar booster: Specify the boosting type, e.g gbdt for XGBoost. + :vartype booster: str + :ivar boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :vartype boosting_type: str + :ivar grow_policy: Specify the grow policy, which controls the way new nodes are added to the + tree. + :vartype grow_policy: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: float + :ivar max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :vartype max_bin: int + :ivar max_depth: Specify the max depth to limit the tree depth explicitly. + :vartype max_depth: int + :ivar max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :vartype max_leaves: int + :ivar min_data_in_leaf: The minimum number of data per leaf. + :vartype min_data_in_leaf: int + :ivar min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :vartype min_split_gain: float + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar n_estimators: Specify the number of trees (or rounds) in an model. + :vartype n_estimators: int + :ivar num_leaves: Specify the number of leaves. + :vartype num_leaves: int + :ivar preprocessor_name: The name of the preprocessor to use. + :vartype preprocessor_name: str + :ivar reg_alpha: L1 regularization term on weights. + :vartype reg_alpha: float + :ivar reg_lambda: L2 regularization term on weights. + :vartype reg_lambda: float + :ivar subsample: Subsample ratio of the training instance. + :vartype subsample: float + :ivar subsample_freq: Frequency of subsample. + :vartype subsample_freq: float + :ivar tree_method: Specify the tree method. + :vartype tree_method: str + :ivar with_mean: If true, center before scaling the data with StandardScalar. + :vartype with_mean: bool + :ivar with_std: If true, scaling the data with Unit Variance with StandardScalar. + :vartype with_std: bool + """ + + _attribute_map = { + "booster": {"key": "booster", "type": "str"}, + "boosting_type": {"key": "boostingType", "type": "str"}, + "grow_policy": {"key": "growPolicy", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "max_bin": {"key": "maxBin", "type": "int"}, + "max_depth": {"key": "maxDepth", "type": "int"}, + "max_leaves": {"key": "maxLeaves", "type": "int"}, + "min_data_in_leaf": {"key": "minDataInLeaf", "type": "int"}, + "min_split_gain": {"key": "minSplitGain", "type": "float"}, + "model_name": {"key": "modelName", "type": "str"}, + "n_estimators": {"key": "nEstimators", "type": "int"}, + "num_leaves": {"key": "numLeaves", "type": "int"}, + "preprocessor_name": {"key": "preprocessorName", "type": "str"}, + "reg_alpha": {"key": "regAlpha", "type": "float"}, + "reg_lambda": {"key": "regLambda", "type": "float"}, + "subsample": {"key": "subsample", "type": "float"}, + "subsample_freq": {"key": "subsampleFreq", "type": "float"}, + "tree_method": {"key": "treeMethod", "type": "str"}, + "with_mean": {"key": "withMean", "type": "bool"}, + "with_std": {"key": "withStd", "type": "bool"}, + } + + def __init__( + self, + *, + booster: Optional[str] = None, + boosting_type: Optional[str] = None, + grow_policy: Optional[str] = None, + learning_rate: Optional[float] = None, + max_bin: Optional[int] = None, + max_depth: Optional[int] = None, + max_leaves: Optional[int] = None, + min_data_in_leaf: Optional[int] = None, + min_split_gain: Optional[float] = None, + model_name: Optional[str] = None, + n_estimators: Optional[int] = None, + num_leaves: Optional[int] = None, + preprocessor_name: Optional[str] = None, + reg_alpha: Optional[float] = None, + reg_lambda: Optional[float] = None, + subsample: Optional[float] = None, + subsample_freq: Optional[float] = None, + tree_method: Optional[str] = None, + with_mean: bool = False, + with_std: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword booster: Specify the boosting type, e.g gbdt for XGBoost. + :paramtype booster: str + :keyword boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :paramtype boosting_type: str + :keyword grow_policy: Specify the grow policy, which controls the way new nodes are added to + the tree. + :paramtype grow_policy: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: float + :keyword max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :paramtype max_bin: int + :keyword max_depth: Specify the max depth to limit the tree depth explicitly. + :paramtype max_depth: int + :keyword max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :paramtype max_leaves: int + :keyword min_data_in_leaf: The minimum number of data per leaf. + :paramtype min_data_in_leaf: int + :keyword min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :paramtype min_split_gain: float + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword n_estimators: Specify the number of trees (or rounds) in an model. + :paramtype n_estimators: int + :keyword num_leaves: Specify the number of leaves. + :paramtype num_leaves: int + :keyword preprocessor_name: The name of the preprocessor to use. + :paramtype preprocessor_name: str + :keyword reg_alpha: L1 regularization term on weights. + :paramtype reg_alpha: float + :keyword reg_lambda: L2 regularization term on weights. + :paramtype reg_lambda: float + :keyword subsample: Subsample ratio of the training instance. + :paramtype subsample: float + :keyword subsample_freq: Frequency of subsample. + :paramtype subsample_freq: float + :keyword tree_method: Specify the tree method. + :paramtype tree_method: str + :keyword with_mean: If true, center before scaling the data with StandardScalar. + :paramtype with_mean: bool + :keyword with_std: If true, scaling the data with Unit Variance with StandardScalar. + :paramtype with_std: bool + """ + super().__init__(**kwargs) + self.booster = booster + self.boosting_type = boosting_type + self.grow_policy = grow_policy + self.learning_rate = learning_rate + self.max_bin = max_bin + self.max_depth = max_depth + self.max_leaves = max_leaves + self.min_data_in_leaf = min_data_in_leaf + self.min_split_gain = min_split_gain + self.model_name = model_name + self.n_estimators = n_estimators + self.num_leaves = num_leaves + self.preprocessor_name = preprocessor_name + self.reg_alpha = reg_alpha + self.reg_lambda = reg_lambda + self.subsample = subsample + self.subsample_freq = subsample_freq + self.tree_method = tree_method + self.with_mean = with_mean + self.with_std = with_std + + +class TableParameterSubspace(_serialization.Model): # pylint: disable=too-many-instance-attributes + """TableParameterSubspace. + + :ivar booster: Specify the boosting type, e.g gbdt for XGBoost. + :vartype booster: str + :ivar boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :vartype boosting_type: str + :ivar grow_policy: Specify the grow policy, which controls the way new nodes are added to the + tree. + :vartype grow_policy: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: str + :ivar max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :vartype max_bin: str + :ivar max_depth: Specify the max depth to limit the tree depth explicitly. + :vartype max_depth: str + :ivar max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :vartype max_leaves: str + :ivar min_data_in_leaf: The minimum number of data per leaf. + :vartype min_data_in_leaf: str + :ivar min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :vartype min_split_gain: str + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar n_estimators: Specify the number of trees (or rounds) in an model. + :vartype n_estimators: str + :ivar num_leaves: Specify the number of leaves. + :vartype num_leaves: str + :ivar preprocessor_name: The name of the preprocessor to use. + :vartype preprocessor_name: str + :ivar reg_alpha: L1 regularization term on weights. + :vartype reg_alpha: str + :ivar reg_lambda: L2 regularization term on weights. + :vartype reg_lambda: str + :ivar subsample: Subsample ratio of the training instance. + :vartype subsample: str + :ivar subsample_freq: Frequency of subsample. + :vartype subsample_freq: str + :ivar tree_method: Specify the tree method. + :vartype tree_method: str + :ivar with_mean: If true, center before scaling the data with StandardScalar. + :vartype with_mean: str + :ivar with_std: If true, scaling the data with Unit Variance with StandardScalar. + :vartype with_std: str + """ + + _attribute_map = { + "booster": {"key": "booster", "type": "str"}, + "boosting_type": {"key": "boostingType", "type": "str"}, + "grow_policy": {"key": "growPolicy", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "max_bin": {"key": "maxBin", "type": "str"}, + "max_depth": {"key": "maxDepth", "type": "str"}, + "max_leaves": {"key": "maxLeaves", "type": "str"}, + "min_data_in_leaf": {"key": "minDataInLeaf", "type": "str"}, + "min_split_gain": {"key": "minSplitGain", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "n_estimators": {"key": "nEstimators", "type": "str"}, + "num_leaves": {"key": "numLeaves", "type": "str"}, + "preprocessor_name": {"key": "preprocessorName", "type": "str"}, + "reg_alpha": {"key": "regAlpha", "type": "str"}, + "reg_lambda": {"key": "regLambda", "type": "str"}, + "subsample": {"key": "subsample", "type": "str"}, + "subsample_freq": {"key": "subsampleFreq", "type": "str"}, + "tree_method": {"key": "treeMethod", "type": "str"}, + "with_mean": {"key": "withMean", "type": "str"}, + "with_std": {"key": "withStd", "type": "str"}, + } + + def __init__( + self, + *, + booster: Optional[str] = None, + boosting_type: Optional[str] = None, + grow_policy: Optional[str] = None, + learning_rate: Optional[str] = None, + max_bin: Optional[str] = None, + max_depth: Optional[str] = None, + max_leaves: Optional[str] = None, + min_data_in_leaf: Optional[str] = None, + min_split_gain: Optional[str] = None, + model_name: Optional[str] = None, + n_estimators: Optional[str] = None, + num_leaves: Optional[str] = None, + preprocessor_name: Optional[str] = None, + reg_alpha: Optional[str] = None, + reg_lambda: Optional[str] = None, + subsample: Optional[str] = None, + subsample_freq: Optional[str] = None, + tree_method: Optional[str] = None, + with_mean: Optional[str] = None, + with_std: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword booster: Specify the boosting type, e.g gbdt for XGBoost. + :paramtype booster: str + :keyword boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :paramtype boosting_type: str + :keyword grow_policy: Specify the grow policy, which controls the way new nodes are added to + the tree. + :paramtype grow_policy: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: str + :keyword max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :paramtype max_bin: str + :keyword max_depth: Specify the max depth to limit the tree depth explicitly. + :paramtype max_depth: str + :keyword max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :paramtype max_leaves: str + :keyword min_data_in_leaf: The minimum number of data per leaf. + :paramtype min_data_in_leaf: str + :keyword min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :paramtype min_split_gain: str + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword n_estimators: Specify the number of trees (or rounds) in an model. + :paramtype n_estimators: str + :keyword num_leaves: Specify the number of leaves. + :paramtype num_leaves: str + :keyword preprocessor_name: The name of the preprocessor to use. + :paramtype preprocessor_name: str + :keyword reg_alpha: L1 regularization term on weights. + :paramtype reg_alpha: str + :keyword reg_lambda: L2 regularization term on weights. + :paramtype reg_lambda: str + :keyword subsample: Subsample ratio of the training instance. + :paramtype subsample: str + :keyword subsample_freq: Frequency of subsample. + :paramtype subsample_freq: str + :keyword tree_method: Specify the tree method. + :paramtype tree_method: str + :keyword with_mean: If true, center before scaling the data with StandardScalar. + :paramtype with_mean: str + :keyword with_std: If true, scaling the data with Unit Variance with StandardScalar. + :paramtype with_std: str + """ + super().__init__(**kwargs) + self.booster = booster + self.boosting_type = boosting_type + self.grow_policy = grow_policy + self.learning_rate = learning_rate + self.max_bin = max_bin + self.max_depth = max_depth + self.max_leaves = max_leaves + self.min_data_in_leaf = min_data_in_leaf + self.min_split_gain = min_split_gain + self.model_name = model_name + self.n_estimators = n_estimators + self.num_leaves = num_leaves + self.preprocessor_name = preprocessor_name + self.reg_alpha = reg_alpha + self.reg_lambda = reg_lambda + self.subsample = subsample + self.subsample_freq = subsample_freq + self.tree_method = tree_method + self.with_mean = with_mean + self.with_std = with_std + + +class TableSweepSettings(_serialization.Model): + """TableSweepSettings. + + All required parameters must be populated in order to send to Azure. + + :ivar early_termination: Type of early termination policy for the sweeping job. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :vartype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + + _validation = { + "sampling_algorithm": {"required": True}, + } + + _attribute_map = { + "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, + "sampling_algorithm": {"key": "samplingAlgorithm", "type": "str"}, + } + + def __init__( + self, + *, + sampling_algorithm: Union[str, "_models.SamplingAlgorithmType"], + early_termination: Optional["_models.EarlyTerminationPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword early_termination: Type of early termination policy for the sweeping job. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :paramtype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + super().__init__(**kwargs) + self.early_termination = early_termination + self.sampling_algorithm = sampling_algorithm + + class TableVerticalFeaturizationSettings(FeaturizationSettings): """Featurization Configuration. @@ -20275,8 +34876,14 @@ class TableVerticalLimitSettings(_serialization.Model): :vartype max_concurrent_trials: int :ivar max_cores_per_trial: Max cores per iteration. :vartype max_cores_per_trial: int + :ivar max_nodes: Maximum nodes to use for the experiment. + :vartype max_nodes: int :ivar max_trials: Number of iterations. :vartype max_trials: int + :ivar sweep_concurrent_trials: Number of concurrent sweeping runs that user wants to trigger. + :vartype sweep_concurrent_trials: int + :ivar sweep_trials: Number of sweeping runs that user wants to trigger. + :vartype sweep_trials: int :ivar timeout: AutoML job timeout. :vartype timeout: ~datetime.timedelta :ivar trial_timeout: Iteration timeout. @@ -20288,7 +34895,10 @@ class TableVerticalLimitSettings(_serialization.Model): "exit_score": {"key": "exitScore", "type": "float"}, "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, "max_cores_per_trial": {"key": "maxCoresPerTrial", "type": "int"}, + "max_nodes": {"key": "maxNodes", "type": "int"}, "max_trials": {"key": "maxTrials", "type": "int"}, + "sweep_concurrent_trials": {"key": "sweepConcurrentTrials", "type": "int"}, + "sweep_trials": {"key": "sweepTrials", "type": "int"}, "timeout": {"key": "timeout", "type": "duration"}, "trial_timeout": {"key": "trialTimeout", "type": "duration"}, } @@ -20300,7 +34910,10 @@ def __init__( exit_score: Optional[float] = None, max_concurrent_trials: int = 1, max_cores_per_trial: int = -1, + max_nodes: int = 1, max_trials: int = 1000, + sweep_concurrent_trials: int = 0, + sweep_trials: int = 0, timeout: datetime.timedelta = "PT6H", trial_timeout: datetime.timedelta = "PT30M", **kwargs: Any @@ -20315,8 +34928,15 @@ def __init__( :paramtype max_concurrent_trials: int :keyword max_cores_per_trial: Max cores per iteration. :paramtype max_cores_per_trial: int + :keyword max_nodes: Maximum nodes to use for the experiment. + :paramtype max_nodes: int :keyword max_trials: Number of iterations. :paramtype max_trials: int + :keyword sweep_concurrent_trials: Number of concurrent sweeping runs that user wants to + trigger. + :paramtype sweep_concurrent_trials: int + :keyword sweep_trials: Number of sweeping runs that user wants to trigger. + :paramtype sweep_trials: int :keyword timeout: AutoML job timeout. :paramtype timeout: ~datetime.timedelta :keyword trial_timeout: Iteration timeout. @@ -20327,7 +34947,10 @@ def __init__( self.exit_score = exit_score self.max_concurrent_trials = max_concurrent_trials self.max_cores_per_trial = max_cores_per_trial + self.max_nodes = max_nodes self.max_trials = max_trials + self.sweep_concurrent_trials = sweep_concurrent_trials + self.sweep_trials = sweep_trials self.timeout = timeout self.trial_timeout = trial_timeout @@ -20399,7 +35022,7 @@ class TensorFlow(DistributionConfiguration): All required parameters must be populated in order to send to Azure. :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. - Known values are: "PyTorch", "TensorFlow", and "Mpi". + Known values are: "PyTorch", "TensorFlow", "Mpi", and "Ray". :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType :ivar parameter_server_count: Number of parameter server tasks. :vartype parameter_server_count: int @@ -20430,7 +35053,7 @@ def __init__(self, *, parameter_server_count: int = 0, worker_count: Optional[in self.worker_count = worker_count -class TextClassification(NlpVertical, AutoMLVertical): +class TextClassification(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text Classification task in AutoML NLP vertical. NLP - Natural Language Processing. @@ -20452,8 +35075,16 @@ class TextClassification(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-Classification task. Known values are: @@ -20474,7 +35105,10 @@ class TextClassification(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -20486,7 +35120,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, **kwargs: Any @@ -20503,8 +35140,16 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword primary_metric: Primary metric for Text-Classification task. Known values are: @@ -20515,7 +35160,10 @@ def __init__( """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -20528,11 +35176,14 @@ def __init__( self.training_data = training_data self.primary_metric = primary_metric self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data -class TextClassificationMultilabel(NlpVertical, AutoMLVertical): +class TextClassificationMultilabel(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text Classification Multilabel task in AutoML NLP vertical. NLP - Natural Language Processing. @@ -20556,8 +35207,16 @@ class TextClassificationMultilabel(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-Classification-Multilabel task. @@ -20580,7 +35239,10 @@ class TextClassificationMultilabel(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -20592,7 +35254,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, **kwargs: Any ) -> None: @@ -20608,14 +35273,25 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -20628,11 +35304,14 @@ def __init__( self.training_data = training_data self.primary_metric = None self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data -class TextNer(NlpVertical, AutoMLVertical): +class TextNer(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text-NER task in AutoML NLP vertical. NER - Named Entity Recognition. NLP - Natural Language Processing. @@ -20657,8 +35336,16 @@ class TextNer(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-NER task. @@ -20681,7 +35368,10 @@ class TextNer(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -20693,7 +35383,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, **kwargs: Any ) -> None: @@ -20709,14 +35402,25 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -20729,12 +35433,75 @@ def __init__( self.training_data = training_data self.primary_metric = None self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data +class ThrottlingRule(_serialization.Model): + """ThrottlingRule. + + :ivar key: + :vartype key: str + :ivar renewal_period: + :vartype renewal_period: float + :ivar count: + :vartype count: float + :ivar min_count: + :vartype min_count: float + :ivar dynamic_throttling_enabled: + :vartype dynamic_throttling_enabled: bool + :ivar match_patterns: + :vartype match_patterns: list[~azure.mgmt.machinelearningservices.models.RequestMatchPattern] + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + "renewal_period": {"key": "renewalPeriod", "type": "float"}, + "count": {"key": "count", "type": "float"}, + "min_count": {"key": "minCount", "type": "float"}, + "dynamic_throttling_enabled": {"key": "dynamicThrottlingEnabled", "type": "bool"}, + "match_patterns": {"key": "matchPatterns", "type": "[RequestMatchPattern]"}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + renewal_period: Optional[float] = None, + count: Optional[float] = None, + min_count: Optional[float] = None, + dynamic_throttling_enabled: Optional[bool] = None, + match_patterns: Optional[List["_models.RequestMatchPattern"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword key: + :paramtype key: str + :keyword renewal_period: + :paramtype renewal_period: float + :keyword count: + :paramtype count: float + :keyword min_count: + :paramtype min_count: float + :keyword dynamic_throttling_enabled: + :paramtype dynamic_throttling_enabled: bool + :keyword match_patterns: + :paramtype match_patterns: list[~azure.mgmt.machinelearningservices.models.RequestMatchPattern] + """ + super().__init__(**kwargs) + self.key = key + self.renewal_period = renewal_period + self.count = count + self.min_count = min_count + self.dynamic_throttling_enabled = dynamic_throttling_enabled + self.match_patterns = match_patterns + + class TmpfsOptions(_serialization.Model): - """Describes the tmpfs options for the container. + """TmpfsOptions. :ivar size: Mention the Tmpfs size. :vartype size: int @@ -20753,6 +35520,39 @@ 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 Azure. + + :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. @@ -20826,6 +35626,101 @@ def __init__( self.resources = resources +class TriggerOnceRequest(_serialization.Model): + """TriggerOnceRequest. + + All required parameters must be populated in order to send to Azure. + + :ivar schedule_time: [Required] Specify the schedule time for trigger once. Required. + :vartype schedule_time: str + """ + + _validation = { + "schedule_time": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "schedule_time": {"key": "scheduleTime", "type": "str"}, + } + + def __init__(self, *, schedule_time: str, **kwargs: Any) -> None: + """ + :keyword schedule_time: [Required] Specify the schedule time for trigger once. Required. + :paramtype schedule_time: str + """ + super().__init__(**kwargs) + self.schedule_time = schedule_time + + +class TriggerRunSubmissionDto(_serialization.Model): + """TriggerRunSubmissionDto. + + :ivar schedule_action_type: Known values are: "ComputeStartStop", "CreateJob", + "InvokeBatchEndpoint", "ImportData", "CreateMonitor", and "FeatureStoreMaterialization". + :vartype schedule_action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleType + :ivar submission_id: + :vartype submission_id: str + """ + + _attribute_map = { + "schedule_action_type": {"key": "scheduleActionType", "type": "str"}, + "submission_id": {"key": "submissionId", "type": "str"}, + } + + def __init__( + self, + *, + schedule_action_type: Optional[Union[str, "_models.ScheduleType"]] = None, + submission_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_action_type: Known values are: "ComputeStartStop", "CreateJob", + "InvokeBatchEndpoint", "ImportData", "CreateMonitor", and "FeatureStoreMaterialization". + :paramtype schedule_action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleType + :keyword submission_id: + :paramtype submission_id: str + """ + super().__init__(**kwargs) + self.schedule_action_type = schedule_action_type + self.submission_id = submission_id + + +class TritonInferencingServer(InferencingServer): + """Triton inferencing server configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar server_type: [Required] Inferencing server type for various targets. Required. Known + values are: "AzureMLOnline", "AzureMLBatch", "Triton", and "Custom". + :vartype server_type: str or ~azure.mgmt.machinelearningservices.models.InferencingServerType + :ivar inference_configuration: Inference configuration for Triton. + :vartype inference_configuration: + ~azure.mgmt.machinelearningservices.models.OnlineInferenceConfiguration + """ + + _validation = { + "server_type": {"required": True}, + } + + _attribute_map = { + "server_type": {"key": "serverType", "type": "str"}, + "inference_configuration": {"key": "inferenceConfiguration", "type": "OnlineInferenceConfiguration"}, + } + + def __init__( + self, *, inference_configuration: Optional["_models.OnlineInferenceConfiguration"] = None, **kwargs: Any + ) -> None: + """ + :keyword inference_configuration: Inference configuration for Triton. + :paramtype inference_configuration: + ~azure.mgmt.machinelearningservices.models.OnlineInferenceConfiguration + """ + super().__init__(**kwargs) + self.server_type: str = "Triton" + self.inference_configuration = inference_configuration + + class TritonModelJobInput(AssetJobInput, JobInput): """TritonModelJobInput. @@ -20840,6 +35735,8 @@ class TritonModelJobInput(AssetJobInput, JobInput): :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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: [Required] Input Asset URI. Required. :vartype uri: str """ @@ -20853,6 +35750,7 @@ class TritonModelJobInput(AssetJobInput, JobInput): "description": {"key": "description", "type": "str"}, "job_input_type": {"key": "jobInputType", "type": "str"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -20862,6 +35760,7 @@ def __init__( uri: str, description: Optional[str] = None, mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -20870,13 +35769,16 @@ def __init__( :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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: [Required] Input Asset URI. Required. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) self.description = description self.job_input_type: str = "triton_model" self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -20890,8 +35792,17 @@ class TritonModelJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: Output Asset URI. :vartype uri: str """ @@ -20903,7 +35814,11 @@ class TritonModelJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -20911,22 +35826,48 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) self.description = description self.job_output_type: str = "triton_model" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -21067,9 +36008,13 @@ class UriFileDataVersion(DataVersionBaseProperties): :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). + :ivar auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :vartype is_archived: bool :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". @@ -21077,6 +36022,11 @@ class UriFileDataVersion(DataVersionBaseProperties): :ivar data_uri: [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str + :ivar intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar stage: Stage in the data lifecycle assigned to this data asset. + :vartype stage: str """ _validation = { @@ -21088,10 +36038,13 @@ class UriFileDataVersion(DataVersionBaseProperties): "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, "data_type": {"key": "dataType", "type": "str"}, "data_uri": {"key": "dataUri", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "stage": {"key": "stage", "type": "str"}, } def __init__( @@ -21101,8 +36054,11 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, is_anonymous: bool = False, is_archived: bool = False, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + stage: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -21112,21 +36068,34 @@ def __init__( :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). + :keyword auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword stage: Stage in the data lifecycle assigned to this data asset. + :paramtype stage: str """ super().__init__( description=description, properties=properties, tags=tags, + auto_delete_setting=auto_delete_setting, is_anonymous=is_anonymous, is_archived=is_archived, data_uri=data_uri, + intellectual_property=intellectual_property, + stage=stage, **kwargs ) self.data_type: str = "uri_file" @@ -21146,6 +36115,8 @@ class UriFileJobInput(AssetJobInput, JobInput): :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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: [Required] Input Asset URI. Required. :vartype uri: str """ @@ -21159,6 +36130,7 @@ class UriFileJobInput(AssetJobInput, JobInput): "description": {"key": "description", "type": "str"}, "job_input_type": {"key": "jobInputType", "type": "str"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21168,6 +36140,7 @@ def __init__( uri: str, description: Optional[str] = None, mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -21176,13 +36149,16 @@ def __init__( :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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: [Required] Input Asset URI. Required. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) self.description = description self.job_input_type: str = "uri_file" self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -21196,8 +36172,17 @@ class UriFileJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: Output Asset URI. :vartype uri: str """ @@ -21209,7 +36194,11 @@ class UriFileJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21217,22 +36206,48 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) self.description = description self.job_output_type: str = "uri_file" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -21247,9 +36262,13 @@ class UriFolderDataVersion(DataVersionBaseProperties): :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). + :ivar auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. + :ivar is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :vartype is_archived: bool :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". @@ -21257,6 +36276,11 @@ class UriFolderDataVersion(DataVersionBaseProperties): :ivar data_uri: [Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str + :ivar intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :vartype intellectual_property: ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :ivar stage: Stage in the data lifecycle assigned to this data asset. + :vartype stage: str """ _validation = { @@ -21268,10 +36292,13 @@ class UriFolderDataVersion(DataVersionBaseProperties): "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, "tags": {"key": "tags", "type": "{str}"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, "data_type": {"key": "dataType", "type": "str"}, "data_uri": {"key": "dataUri", "type": "str"}, + "intellectual_property": {"key": "intellectualProperty", "type": "IntellectualProperty"}, + "stage": {"key": "stage", "type": "str"}, } def __init__( @@ -21281,8 +36308,11 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, is_anonymous: bool = False, is_archived: bool = False, + intellectual_property: Optional["_models.IntellectualProperty"] = None, + stage: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -21292,21 +36322,34 @@ def __init__( :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). + :keyword auto_delete_setting: Specifies the lifecycle setting of managed data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword is_anonymous: If the name version are system generated (anonymous registration). For + types where Stage is defined, when Stage is provided it will be used to populate IsAnonymous. :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. + :keyword is_archived: Is the asset archived? For types where Stage is defined, when Stage is + provided it will be used to populate IsArchived. :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 intellectual_property: Intellectual Property details. Used if data is an Intellectual + Property. + :paramtype intellectual_property: + ~azure.mgmt.machinelearningservices.models.IntellectualProperty + :keyword stage: Stage in the data lifecycle assigned to this data asset. + :paramtype stage: str """ super().__init__( description=description, properties=properties, tags=tags, + auto_delete_setting=auto_delete_setting, is_anonymous=is_anonymous, is_archived=is_archived, data_uri=data_uri, + intellectual_property=intellectual_property, + stage=stage, **kwargs ) self.data_type: str = "uri_folder" @@ -21326,6 +36369,8 @@ class UriFolderJobInput(AssetJobInput, JobInput): :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 path_on_compute: Input Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: [Required] Input Asset URI. Required. :vartype uri: str """ @@ -21339,6 +36384,7 @@ class UriFolderJobInput(AssetJobInput, JobInput): "description": {"key": "description", "type": "str"}, "job_input_type": {"key": "jobInputType", "type": "str"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21348,6 +36394,7 @@ def __init__( uri: str, description: Optional[str] = None, mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + path_on_compute: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -21356,13 +36403,16 @@ def __init__( :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 path_on_compute: Input Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: [Required] Input Asset URI. Required. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__(mode=mode, path_on_compute=path_on_compute, uri=uri, description=description, **kwargs) self.description = description self.job_input_type: str = "uri_folder" self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -21376,8 +36426,17 @@ class UriFolderJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar auto_delete_setting: Auto delete setting of output data asset. + :vartype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar path_on_compute: Output Asset Delivery Path. + :vartype path_on_compute: str :ivar uri: Output Asset URI. :vartype uri: str """ @@ -21389,7 +36448,11 @@ class UriFolderJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, + "auto_delete_setting": {"key": "autoDeleteSetting", "type": "AutoDeleteSetting"}, "mode": {"key": "mode", "type": "str"}, + "path_on_compute": {"key": "pathOnCompute", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21397,22 +36460,48 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + auto_delete_setting: Optional["_models.AutoDeleteSetting"] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + path_on_compute: Optional[str] = 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". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword auto_delete_setting: Auto delete setting of output data asset. + :paramtype auto_delete_setting: ~azure.mgmt.machinelearningservices.models.AutoDeleteSetting + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword path_on_compute: Output Asset Delivery Path. + :paramtype path_on_compute: str :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, + asset_version=asset_version, + auto_delete_setting=auto_delete_setting, + mode=mode, + path_on_compute=path_on_compute, + uri=uri, + description=description, + **kwargs + ) self.description = description self.job_output_type: str = "uri_folder" + self.asset_name = asset_name + self.asset_version = asset_version + self.auto_delete_setting = auto_delete_setting self.mode = mode + self.path_on_compute = path_on_compute self.uri = uri @@ -21640,20 +36729,47 @@ def __init__(self, **kwargs: Any) -> None: class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): """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 Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "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", + "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", "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", and "GenericContainerRegistry". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: 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: Any object. + :vartype metadata: JSON + :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 credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword @@ -21661,14 +36777,20 @@ 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"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "object"}, + "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": "WorkspaceConnectionUsernamePassword"}, } @@ -21676,27 +36798,56 @@ def __init__( self, *, category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[JSON] = 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.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", + "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", "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", and "GenericContainerRegistry". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Any object. + :paramtype metadata: JSON + :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 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, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + shared_user_list=shared_user_list, + target=target, + **kwargs + ) self.auth_type: str = "UsernamePassword" self.credentials = credentials @@ -22130,7 +37281,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 +37358,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 @@ -22242,83 +37393,120 @@ 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 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 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 enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterial 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 hub_resource_id: + :vartype hub_resource_id: str + :ivar image_build_compute: The compute name for image build. + :vartype image_build_compute: str + :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 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 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. - :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty - :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 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 private_endpoint_connections: The list of private endpoint connections in the workspace. - :vartype private_endpoint_connections: - list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + ~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. + :vartype system_datastores_auth_mode: str + :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 +37514,15 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "workspace_id": {"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 +37531,399 @@ 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}"}, + "allow_public_access_when_behind_vnet": {"key": "properties.allowPublicAccessWhenBehindVnet", "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_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"}, + "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"}, + "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, 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_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, primary_user_assigned_identity: Optional[str] = None, - v1_legacy_mode: bool = False, + 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[str] = 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 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_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterial 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 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 + ~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. + :paramtype system_datastores_auth_mode: str :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.allow_public_access_when_behind_vnet = allow_public_access_when_behind_vnet 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_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.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.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 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): @@ -22591,35 +37997,74 @@ def __init__(self, *, properties: "_models.WorkspaceConnectionPropertiesV2", **k class WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult(_serialization.Model): """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 +38087,344 @@ 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}. + :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 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 SoftwareBillOfMaterial 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 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 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}"}, + "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"}, + "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"}, + "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, + 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, 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, + 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 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 SoftwareBillOfMaterial 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 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 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.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.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.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 4967e3af6930..d4a852d78ded 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,23 +6,21 @@ # 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 ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations 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 ._marketplace_subscriptions_operations import MarketplaceSubscriptionsOperations from ._registry_model_containers_operations import RegistryModelContainersOperations from ._registry_model_versions_operations import RegistryModelVersionsOperations from ._batch_endpoints_operations import BatchEndpointsOperations @@ -36,37 +34,54 @@ 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 ._labeling_jobs_operations import LabelingJobsOperations from ._model_containers_operations import ModelContainersOperations from ._model_versions_operations import ModelVersionsOperations from ._online_endpoints_operations import OnlineEndpointsOperations from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations +from ._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 ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +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", + "CapacityReservationGroupsOperations", "RegistryCodeContainersOperations", "RegistryCodeVersionsOperations", "RegistryComponentContainersOperations", "RegistryComponentVersionsOperations", "RegistryDataContainersOperations", "RegistryDataVersionsOperations", + "RegistryDataReferencesOperations", "RegistryEnvironmentContainersOperations", "RegistryEnvironmentVersionsOperations", + "MarketplaceSubscriptionsOperations", "RegistryModelContainersOperations", "RegistryModelVersionsOperations", "BatchEndpointsOperations", @@ -80,14 +95,33 @@ "DatastoresOperations", "EnvironmentContainersOperations", "EnvironmentVersionsOperations", + "FeaturesetContainersOperations", + "FeaturesOperations", + "FeaturesetVersionsOperations", + "FeaturestoreEntityContainersOperations", + "FeaturestoreEntityVersionsOperations", + "InferencePoolsOperations", + "InferenceEndpointsOperations", + "InferenceGroupsOperations", "JobsOperations", + "LabelingJobsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "ServerlessEndpointsOperations", "RegistriesOperations", "WorkspaceFeaturesOperations", + "Operations", + "WorkspacesOperations", + "WorkspaceConnectionsOperations", + "EndpointDeploymentOperations", + "EndpointOperations", + "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 7fcc2d9cfc00..75d6f38d5985 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,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 +184,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +209,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 +233,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -258,7 +258,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") 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 afa2aebfed20..6fa8aa790fcc 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,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 +90,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,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 +126,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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 +162,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +184,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 +203,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,7 +225,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 +244,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +263,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") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capacity_reservation_groups_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capacity_reservation_groups_operations.py new file mode 100644 index 000000000000..3a77962e3ef5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capacity_reservation_groups_operations.py @@ -0,0 +1,875 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request( + subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_list_request( + resource_group_name: str, subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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, group_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}", + ) # 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 + ), + "groupId": _SERIALIZER.url("group_id", group_id, "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, group_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}", + ) # 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 + ), + "groupId": _SERIALIZER.url("group_id", group_id, "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, group_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-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/capacityReserverationGroups/{groupId}", + ) # 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 + ), + "groupId": _SERIALIZER.url("group_id", group_id, "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, group_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-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/capacityReserverationGroups/{groupId}", + ) # 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 + ), + "groupId": _SERIALIZER.url("group_id", group_id, "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 CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`capacity_reservation_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_by_subscription( + self, skip: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroup"]: + """List CapacityReservationGroups by subscription. + + List CapacityReservationGroups by subscription. + + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CapacityReservationGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] + :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.CapacityReservationGroupTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "CapacityReservationGroupTrackedResourceArmPaginatedResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups" + } + + @distributed_trace + def list( + self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroup"]: + """Lists CapacityReservationGroups. + + Lists CapacityReservationGroups. + + :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 CapacityReservationGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.CapacityReservationGroup] + :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.CapacityReservationGroupTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "CapacityReservationGroupTrackedResourceArmPaginatedResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, group_id: str, **kwargs: Any + ) -> None: + """Delete CapacityReservationGroup. + + Delete CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + group_id=group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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/capacityReserverationGroups/{groupId}" + } + + @distributed_trace + def get(self, resource_group_name: str, group_id: str, **kwargs: Any) -> _models.CapacityReservationGroup: + """Get CapacityReservationGroup. + + Get CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :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.CapacityReservationGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + group_id=group_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) + + _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("CapacityReservationGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}" + } + + @overload + def update( + self, + resource_group_name: str, + group_id: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + group_id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + group_id: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Update CapacityReservationGroup. + + Update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to update. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CapacityReservationGroup] = 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, + group_id=group_id, + 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) + + _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("CapacityReservationGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/capacityReserverationGroups/{groupId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + group_id: str, + body: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :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: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + group_id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, group_id: str, body: Union[_models.CapacityReservationGroup, IO], **kwargs: Any + ) -> _models.CapacityReservationGroup: + """Create or update CapacityReservationGroup. + + Create or update CapacityReservationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param group_id: Group ID. Required. + :type group_id: str + :param body: Capacity Reservation Group payload to create. Is either a CapacityReservationGroup + type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CapacityReservationGroup] = 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, "CapacityReservationGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CapacityReservationGroup", pipeline_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/capacityReserverationGroups/{groupId}" + } 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 bd3a7ea7d400..aa446b63969c 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,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 +80,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,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 +116,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,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 +152,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +172,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") 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 85aa291231f0..4e00d9c4cd18 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +55,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +74,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 +101,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +121,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 +138,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +158,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 +175,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -194,7 +196,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 +209,53 @@ 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-01-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( 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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -234,7 +276,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") @@ -703,6 +745,255 @@ def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" } + def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/publish" + } + @overload def create_or_get_start_pending_upload( self, 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 0bc38057f344..349d65ae248f 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,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 +88,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +107,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 +124,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,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 +160,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +180,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") 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 932e842e43de..35194a5c9b20 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,12 +49,13 @@ def build_list_request( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +74,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") @@ -83,6 +86,8 @@ def build_list_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "str") if list_view_type is not None: _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -96,7 +101,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +121,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 +138,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +158,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 +175,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +196,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 +209,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-01-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:: @@ -233,6 +278,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.ComponentVersion"]: """List component versions. @@ -255,6 +301,8 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param stage: Component stage. Default value is None. + :type stage: 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: @@ -287,6 +335,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -656,3 +705,252 @@ def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" } + + def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}/publish" + } 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 349245e851f3..adc49a37bd32 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,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") @@ -82,7 +82,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,10 +98,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 +120,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,10 +137,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 +161,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,10 +178,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 +208,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,10 +224,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 +243,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-01-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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,10 +306,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 +328,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,15 +344,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-01-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 +407,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,10 +423,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 +445,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -365,10 +461,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 +483,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -401,21 +499,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( + 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-01-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-01-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-01-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. @@ -1233,11 +1453,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" } - @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,19 +1473,77 @@ def list_nodes( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AmlComputeNodeInformation or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AmlComputeNodeInformation] + :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) + @overload + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: Union[List[_models.CustomService], IO], + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Is either a [CustomService] type or a IO + type. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1267,11 +1552,95 @@ def list_nodes( } 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_nodes_request( - resource_group_name=resource_group_name, + 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, + template_url=self.update_custom_services.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) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices" + } + + @distributed_trace + def list_nodes( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> 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 + :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] + :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 {}) + + def prepare_request(next_link=None): + if not next_link: + + 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, @@ -1398,6 +1767,164 @@ def list_keys( "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. + + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: IO, + *, + 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 + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_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], + **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. Is + either a [ComputeInstanceDataMount] type or a IO type. Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_data_mounts.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) + + if cls: + return cls(pipeline_response, None, {}) + + update_data_mounts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts" + } + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any ) -> None: @@ -1751,3 +2278,452 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_restart.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" } + + @overload + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.IdleShutdownSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.IdleShutdownSetting, IO], + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Is either a IdleShutdownSetting type or a IO type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.update_idle_shutdown_setting.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + update_idle_shutdown_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting" + } + + @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 + :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 = { + 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, + template_url=self.get_allowed_resize_sizes.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("VirtualMachineSizeListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_allowed_resize_sizes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize" + } + + def _resize_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, "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, + template_url=self._resize_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resize_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO], + **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 type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resize.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize" + } 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 48c5dee07f2c..b85b5922770c 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,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 +88,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +107,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 +124,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,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 +160,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +180,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") 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 e355736e9350..711db0a12d0e 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,12 +50,13 @@ def build_list_request( skip: Optional[str] = None, tags: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +75,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") @@ -86,6 +89,8 @@ def build_list_request( _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 stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -99,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-01-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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +161,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 +178,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -194,7 +199,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 +212,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-01-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:: @@ -237,6 +282,7 @@ def list( skip: Optional[str] = None, tags: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.DataVersionBase"]: """List data versions in the data container. @@ -266,6 +312,8 @@ 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 + :param stage: data stage. Default value is None. + :type stage: str :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: @@ -299,6 +347,7 @@ def prepare_request(next_link=None): skip=skip, tags=tags, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -668,3 +717,252 @@ def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" } + + def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}/publish" + } 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 651ac883ae0f..6fcfb9b825af 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,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 +139,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,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 +181,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +201,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 +222,7 @@ 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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +241,7 @@ 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") 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 000000000000..47d5f5848974 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_deployment_operations.py @@ -0,0 +1,970 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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, + **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-01-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="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-01-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-01-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", and "managedOnlineEndpoint". 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.get_in_workspace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + get_in_workspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_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, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :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.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, + 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("EndpointDeploymentResourcePropertiesBasicResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO], + **kwargs: Any + ) -> Optional[_models.EndpointDeploymentResourcePropertiesBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointDeploymentResourcePropertiesBasicResource]] = 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, + 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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + 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, + *, + 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 + :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 + 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource 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 + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}" + } 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 000000000000..a8447dbe71ea --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_operations.py @@ -0,0 +1,1058 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + 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-01-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 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_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-01-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-01-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-01-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-01-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-01-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, + skip: 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", and "managedOnlineEndpoint". 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :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.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, + 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("EndpointResourcePropertiesBasicResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO], + **kwargs: Any + ) -> Optional[_models.EndpointResourcePropertiesBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointResourcePropertiesBasicResource]] = 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, + 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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EndpointResourcePropertiesBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :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.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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys" + } + + @distributed_trace + def get_models( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.AccountModel"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountModel or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AccountModel] + :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 = { + 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, + template_url=self.get_models.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + get_models.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + *, + 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 + :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: 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.regenerate_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 + ) + + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey" + } 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 d65ee4225ec4..0ea9175d0c27 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,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 +88,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +107,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 +124,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,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 +160,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +180,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") 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 fc163b0b3bb7..e1764f72ac42 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,12 +49,13 @@ def build_list_request( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +74,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") @@ -83,6 +86,8 @@ def build_list_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "str") if list_view_type is not None: _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -96,7 +101,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +121,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 +138,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +158,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 +175,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +196,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 +209,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-01-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:: @@ -233,6 +278,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.EnvironmentVersion"]: """List versions. @@ -255,6 +301,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 + :param stage: Stage for including/excluding (for example) archived entities. Takes priority + over listViewType. Default value is None. + :type stage: str :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: @@ -287,6 +336,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -656,3 +706,252 @@ def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" } + + def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}/publish" + } 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 000000000000..d3eea16e18f1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_features_operations.py @@ -0,0 +1,381 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Feature or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Feature + :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.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, + 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("Feature", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features/{featureName}" + } 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 000000000000..79cad7337161 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_containers_operations.py @@ -0,0 +1,814 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturesetContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :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.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, + template_url=self.get_entity.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("FeaturesetContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO], + **kwargs: Any + ) -> _models.FeaturesetContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}" + } 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 000000000000..1f965ab9d924 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_versions_operations.py @@ -0,0 +1,1162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturesetVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :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.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, + 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("FeaturesetVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO], + **kwargs: Any + ) -> _models.FeaturesetVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}" + } + + def _backfill_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO], + **kwargs: Any + ) -> Optional[_models.FeaturesetVersionBackfillResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.FeaturesetVersionBackfillResponse]] = 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, + template_url=self._backfill_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _backfill_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}/backfill" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backfill.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}/backfill" + } 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 000000000000..93e75632b8f1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_containers_operations.py @@ -0,0 +1,815 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturestoreEntityContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :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.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, + template_url=self.get_entity.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("FeaturestoreEntityContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_entity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO], + **kwargs: Any + ) -> _models.FeaturestoreEntityContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}" + } 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 000000000000..a7095df6a875 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_versions_operations.py @@ -0,0 +1,859 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeaturestoreEntityVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :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.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, + 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("FeaturestoreEntityVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO], + **kwargs: Any + ) -> _models.FeaturestoreEntityVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}" + } 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 000000000000..bdbfc2749905 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_endpoints_operations.py @@ -0,0 +1,1067 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_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, + pool_name=pool_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferenceEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :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.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, + 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("InferenceEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> Optional[_models.InferenceEndpoint]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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[Optional[_models.InferenceEndpoint]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceEndpoint", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Union[_models.InferenceEndpoint, IO], + **kwargs: Any + ) -> _models.InferenceEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}" + } 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 000000000000..c46e113088cd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_groups_operations.py @@ -0,0 +1,1410 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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-01-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_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-01-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"), + "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 + _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-01-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"), + "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") + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, pool_name: str, group_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, + pool_name=pool_name, + group_name=group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferenceGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :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.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, + 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("InferenceGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + **kwargs: Any + ) -> Optional[_models.InferenceGroup]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.InferenceGroup]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceGroup", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 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. + :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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.InferenceGroup, IO], + **kwargs: Any + ) -> _models.InferenceGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferenceGroup", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferenceGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GroupStatus + :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.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, + template_url=self.get_status.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("GroupStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/getStatus" + } + + @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 + :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: + """ + _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 = { + 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, + template_url=self.list_skus.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/skus" + } 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 000000000000..2ba5a15bfc63 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_pools_operations.py @@ -0,0 +1,1361 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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"), + } + + _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-01-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-01-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) + + +def build_get_status_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-01-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}/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}$" + ), + "inferencePoolName": _SERIALIZER.url("inference_pool_name", inference_pool_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_skus_request( + resource_group_name: str, + workspace_name: str, + inference_pool_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-01-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}/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}$" + ), + "inferencePoolName": _SERIALIZER.url("inference_pool_name", inference_pool_name, "str"), + } + + _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 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, inference_pool_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, + inference_pool_name=inference_pool_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InferencePool or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferencePool + :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.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, + 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("InferencePool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> Optional[_models.InferencePool]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.InferencePool]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferencePool", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO], + **kwargs: Any + ) -> _models.InferencePool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("InferencePool", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("InferencePool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}" + } + + @distributed_trace + def get_status( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> _models.PoolStatus: + """Retrieve inference pool status. + + Retrieve inference pool 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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PoolStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.PoolStatus + :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.PoolStatus] = kwargs.pop("cls", None) + + request = build_get_status_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, + template_url=self.get_status.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("PoolStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}/getStatus" + } + + @distributed_trace + def list_skus( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SkuResource"]: + """List Inference Pool Skus. + + List Inference Pool 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 inference_pool_name: Inference Group name. Required. + :type inference_pool_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 + :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: + """ + _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 = { + 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, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}/skus" + } 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 83dc12a1ff03..f7ba6bfe8db3 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,12 +48,16 @@ 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, + asset_name: Optional[str] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,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") @@ -83,6 +87,14 @@ 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") + if asset_name is not None: + _params["assetName"] = _SERIALIZER.query("asset_name", asset_name, "str") + if scheduled is not None: + _params["scheduled"] = _SERIALIZER.query("scheduled", scheduled, "bool") + if schedule_id is not None: + _params["scheduleId"] = _SERIALIZER.query("schedule_id", schedule_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -96,7 +108,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +127,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 +144,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +163,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") @@ -162,13 +174,52 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-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}/jobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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, id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +239,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 +258,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +277,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 +316,10 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + properties: Optional[str] = None, + asset_name: Optional[str] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -285,6 +340,15 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param properties: Comma-separated list of property names (and optionally values). Example: + prop1,prop2=value2. Default value is None. + :type properties: str + :param asset_name: Asset name the job's named output is registered with. Default value is None. + :type asset_name: str + :param scheduled: Indicator whether the job is scheduled job. Default value is None. + :type scheduled: bool + :param schedule_id: The scheduled id for listing the job triggered from. Default value is None. + :type schedule_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.JobBase] @@ -315,6 +379,10 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + properties=properties, + asset_name=asset_name, + scheduled=scheduled, + schedule_id=schedule_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -566,6 +634,165 @@ def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" } + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.PartialJobBasePartialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialJobBasePartialResource + :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: + """ + + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobBase or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.JobBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.PartialJobBasePartialResource, IO], + **kwargs: Any + ) -> _models.JobBase: + """Updates a Job. + + Updates a Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the Job. This is case-sensitive. Required. + :type id: str + :param body: Job definition to apply during the operation. Is either a + PartialJobBasePartialResource type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialJobBasePartialResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobBase or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.JobBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.JobBase] = 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, "PartialJobBasePartialResource") + + request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.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("JobBase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" + } + @overload def create_or_update( self, @@ -578,8 +805,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. @@ -611,8 +840,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. @@ -637,8 +868,10 @@ def create_or_update( self, resource_group_name: str, workspace_name: str, id: str, body: Union[_models.JobBase, IO], **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. diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py new file mode 100644 index 000000000000..e56118c20835 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py @@ -0,0 +1,1280 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", 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 top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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_export_labels_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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_pause_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resume_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "id": _SERIALIZER.url("id", id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LabelingJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`labeling_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.LabelingJob"]: + """Lists labeling jobs in the workspace. + + Lists labeling jobs in the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param top: Number of labeling jobs to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabelingJob or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelingJobResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LabelingJobResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Delete a labeling job. + + Delete a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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}/labelingJobs/{id}" + } + + @distributed_trace + def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> _models.LabelingJob: + """Gets a labeling job by name/id. + + Gets a labeling job by name/id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJob or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + 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("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> _models.LabelingJob: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.LabelingJob] = 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, "LabelingJob") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.LabelingJob, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Is either a LabelingJob type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.LabelingJob] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJob", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + def _export_labels_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> Optional[_models.ExportSummary]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ExportSummary]] = 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, "ExportSummary") + + request = build_export_labels_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_labels_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ExportSummary", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_labels_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @overload + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.ExportSummary, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + Export labels from a labeling job (asynchronous). Using the URL in the Location header, the + status of the job export operation can be tracked. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Is either a ExportSummary type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ExportSummary] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_labels_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExportSummary", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_labels.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @distributed_trace + def pause( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> _models.LabelingJobProperties: + """Pause a labeling job. + + Pause a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJobProperties or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties + :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.LabelingJobProperties] = kwargs.pop("cls", None) + + request = build_pause_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.pause.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("LabelingJobProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + pause.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause" + } + + def _resume_initial( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> Optional[_models.LabelingJobProperties]: + 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[Optional[_models.LabelingJobProperties]] = kwargs.pop("cls", None) + + request = build_resume_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._resume_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabelingJobProperties", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _resume_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } + + @distributed_trace + def begin_resume( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> LROPoller[_models.LabelingJobProperties]: + """Resume a labeling job (asynchronous). + + Resume a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJobProperties or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJobProperties] + :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.LabelingJobProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJobProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_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 000000000000..3f8471dbc8d1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_provisions_operations.py @@ -0,0 +1,340 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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]] = None, + **kwargs: Any + ) -> Optional[_models.ManagedNetworkProvisionStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ManagedNetworkProvisionStatus]] = 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, + template_url=self._provision_managed_network_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _provision_managed_network_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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] = 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 + :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 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]] = 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 type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_provision_managed_network.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork" + } 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 000000000000..0fecc5979a43 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,752 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, rule_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, + rule_name=rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRuleBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :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.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, + 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("OutboundRuleBasicResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO], + **kwargs: Any + ) -> Optional[_models.OutboundRuleBasicResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OutboundRuleBasicResource]] = 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, + 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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OutboundRuleBasicResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OutboundRuleBasicResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}" + } 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 000000000000..212c7dbd9a01 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_marketplace_subscriptions_operations.py @@ -0,0 +1,761 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MarketplaceSubscription or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :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.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, + 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("MarketplaceSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO], + **kwargs: Any + ) -> _models.MarketplaceSubscription: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}" + } 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 bdc20a437ab9..2139144bf801 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,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") @@ -91,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,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") @@ -127,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,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") @@ -163,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,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") 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 94082df98347..e3c211930b7a 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,12 +55,13 @@ def build_list_request( properties: Optional[str] = None, feed: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +80,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,6 +104,8 @@ def build_list_request( _params["feed"] = _SERIALIZER.query("feed", feed, "str") if list_view_type is not None: _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -114,7 +119,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +139,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 +156,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-01-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") @@ -188,7 +193,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-01-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_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 +227,86 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_package_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-01-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}/package", + ) # 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="POST", 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-01-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:: @@ -257,6 +342,7 @@ def list( properties: Optional[str] = None, feed: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.ModelVersion"]: """List model versions. @@ -293,6 +379,8 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param stage: Model stage. Default value is None. + :type stage: str :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] @@ -330,6 +418,7 @@ def prepare_request(next_link=None): properties=properties, feed=feed, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -699,3 +788,516 @@ def create_or_update( create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" } + + def _package_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> Optional[_models.PackageResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageResponse]] = 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, "PackageRequest") + + request = build_package_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, + template_url=self._package_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PackageResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/package" + } + + @overload + def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.PackageRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest + :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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_package( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :param resource_group_name: The name of the resource group. The name 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: Package operation request body. Is either a PackageRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest 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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :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.PackageResponse] = 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._package_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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PackageResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/package" + } + + def _publish_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(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, + template_url=self._publish_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _publish_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/publish" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO, + *, + 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 + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO], + **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 type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset 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 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_publish.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}/publish" + } 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 618d15662d98..aa9747f0a5ab 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,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 +184,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +209,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 +233,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -258,7 +258,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 +282,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -303,7 +303,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 +330,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -350,7 +350,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") 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 6fbb16092160..21dc060d01f4 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,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") @@ -105,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +124,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +160,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 +177,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,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 +216,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -238,7 +238,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 +257,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +276,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 +293,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -313,7 +313,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 +332,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,7 +351,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") 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 7dbac1fe15f1..bb9b32e619bf 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 @@ -40,7 +40,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,19 +75,21 @@ 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. + 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] + :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 = { 401: ClientAuthenticationError, @@ -128,7 +130,7 @@ def prepare_request(next_link=None): 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 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 a5d73b4be943..5f29ef68a2d2 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,16 +52,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 +72,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 +82,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,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 +111,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 +124,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,20 +145,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 +166,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-01-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 +188,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,12 +224,14 @@ 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 @@ -314,19 +316,86 @@ def get_next(next_link=None): "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 + :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}" + } + @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) @@ -389,23 +458,26 @@ 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 @@ -421,23 +493,26 @@ def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + body: IO, *, 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -453,22 +528,25 @@ 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], **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 + :param body: PrivateEndpointConnection object. Is either a PrivateEndpointConnection type or a + IO type. Required. + :type body: ~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 @@ -495,10 +573,10 @@ 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( resource_group_name=resource_group_name, @@ -538,68 +616,3 @@ def create_or_update( 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}" - } 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 a262b6f295cc..cc997e342101 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 @@ -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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,6 +17,7 @@ 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 @@ -25,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +60,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,19 +93,40 @@ 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: """ + _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) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -112,42 +135,63 @@ def list( } 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 + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) list.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources" 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 1896a7522c0b..939185f929c2 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 @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +55,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 +72,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,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") 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 089d9208e62c..002e82c2244b 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,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 +69,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,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 +101,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,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 +134,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,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 +169,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +188,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 +207,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -226,7 +226,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 +245,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -264,7 +264,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") 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 c925671f74d2..c000547bfd5f 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,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") @@ -82,7 +82,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,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 +118,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +137,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 +154,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +174,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") 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 431682513a37..584c66d54224 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,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 +132,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,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 +169,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -190,7 +190,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,7 +209,7 @@ def build_create_or_get_start_pending_upload_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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -230,7 +230,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") 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 8fa9042f77a3..0d2e8411f3ea 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,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") @@ -82,7 +82,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,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 +120,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +141,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 +158,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +180,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") 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 7bb69cf38e1a..2bd465d61a66 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,12 +48,13 @@ def build_list_request( order_by: Optional[str] = None, top: Optional[int] = None, skip: 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,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") @@ -84,6 +85,8 @@ def build_list_request( _params["$top"] = _SERIALIZER.query("top", top, "int") if skip is not None: _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -97,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +122,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 +139,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +161,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 +178,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,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") @@ -239,6 +242,7 @@ def list( order_by: Optional[str] = None, top: Optional[int] = None, skip: Optional[str] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.ComponentVersion"]: """List versions. @@ -259,6 +263,8 @@ def list( :type top: int :param skip: Continuation token for pagination. Default value is None. :type skip: str + :param stage: Component stage. Default value is None. + :type stage: 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: @@ -290,6 +296,7 @@ def prepare_request(next_link=None): order_by=order_by, top=top, skip=skip, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, 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 a5a3f85fe645..5ccf97d500f8 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,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 +90,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,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 +126,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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 +162,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +182,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") 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 000000000000..bf7a0652cc91 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_references_operations.py @@ -0,0 +1,267 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +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-01-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 value. + + Get blob reference SAS Uri value. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri value. + + Get blob reference SAS Uri value. + + :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 + :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: 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], + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri value. + + Get blob reference SAS Uri value. + + :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 + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.get_blob_reference_sas.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("GetBlobReferenceSASResponseDto", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_blob_reference_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/datareferences/{name}/versions/{version}" + } 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 7fda48b37788..be30957bea2f 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,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 +101,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,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 +138,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,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 +175,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +196,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") @@ -215,7 +215,7 @@ def build_create_or_get_start_pending_upload_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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,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") 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 3a3ff9edbad1..86f5b947d9a5 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,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 +90,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +111,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 +128,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,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 +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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +188,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") 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 727a7a9602ce..f422c37e10aa 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,12 +49,13 @@ def build_list_request( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = 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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +76,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") @@ -87,6 +88,8 @@ def build_list_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "str") if list_view_type is not None: _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -105,7 +108,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +130,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +174,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 +196,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -216,7 +219,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") @@ -258,6 +261,7 @@ def list( top: Optional[int] = None, skip: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + stage: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.EnvironmentVersion"]: """List versions. @@ -281,6 +285,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 + :param stage: Stage for including/excluding (for example) archived entities. Takes priority + over listViewType. Default value is None. + :type stage: str :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: @@ -313,6 +320,7 @@ def prepare_request(next_link=None): top=top, skip=skip, list_view_type=list_view_type, + stage=stage, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, 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 8c44417d63e7..e46d19e539e2 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,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 +90,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,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 +126,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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 +162,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +182,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") 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 d883c93e7433..e400eab0f4aa 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +77,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,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 +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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,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 +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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +205,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 +218,53 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_package_request( + resource_group_name: str, registry_name: str, model_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/package", + ) # 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}$" + ), + "modelName": _SERIALIZER.url("model_name", model_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _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( 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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -245,7 +285,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") @@ -892,6 +932,273 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" } + def _package_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> Optional[_models.PackageResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageResponse]] = 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, "PackageRequest") + + request = build_package_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._package_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PackageResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/package" + } + + @overload + def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: _models.PackageRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest + :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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_package( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.PackageRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.PackageResponse]: + """Model Version Package operation. + + Model Version Package operation. + + :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 model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Package operation request body. Is either a PackageRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PackageRequest 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 PackageResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.PackageResponse] + :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.PackageResponse] = 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._package_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PackageResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/package" + } + @overload def create_or_get_start_pending_upload( self, 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 2e25ec11855a..4031585e10a5 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,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 +90,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,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 +126,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,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 +162,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-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +182,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") @@ -195,6 +195,45 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_trigger_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-01-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}/schedules/{name}/trigger", + ) # 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 + 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 SchedulesOperations: """ .. warning:: @@ -755,3 +794,162 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" } + + @overload + def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.TriggerOnceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Required. + :type body: ~azure.mgmt.machinelearningservices.models.TriggerOnceRequest + :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: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def trigger( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.TriggerOnceRequest, IO], + **kwargs: Any + ) -> _models.TriggerRunSubmissionDto: + """Trigger run. + + Trigger run. + + :param resource_group_name: The name of the resource group. The name 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: Schedule name. Required. + :type name: str + :param body: Request body for trigger once. Is either a TriggerOnceRequest type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.TriggerOnceRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggerRunSubmissionDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.TriggerRunSubmissionDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.TriggerRunSubmissionDto] = 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, "TriggerOnceRequest") + + request = build_trigger_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, + template_url=self.trigger.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("TriggerRunSubmissionDto", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}/trigger" + } 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 000000000000..2257c3ca74c5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_serverless_endpoints_operations.py @@ -0,0 +1,1558 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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-01-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-01-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-01-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-01-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-01-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_get_status_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-01-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}/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}$" + ), + "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_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-01-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-01-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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 = { + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, 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, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerlessEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :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.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, + 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("ServerlessEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO], + **kwargs: Any + ) -> Optional[_models.ServerlessEndpoint]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.ServerlessEndpoint]] = 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, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ServerlessEndpoint", 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") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO], + **kwargs: Any + ) -> _models.ServerlessEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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) + + 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, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint 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 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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}" + } + + @distributed_trace + def get_status( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.ServerlessEndpointStatus: + """Status of the model backing the Serverless Endpoint. + + Status of the model backing the 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerlessEndpointStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointStatus + :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.ServerlessEndpointStatus] = kwargs.pop("cls", None) + + request = build_get_status_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_status.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("ServerlessEndpointStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/getStatus" + } + + @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 + :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 = { + 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, + 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 = 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/listKeys" + } + + def _regenerate_keys_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO], + **kwargs: Any + ) -> Optional[_models.EndpointAuthKeys]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.EndpointAuthKeys]] = 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, + template_url=self._regenerate_keys_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _regenerate_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/regenerateKeys" + } + + @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 + :keyword callable cls: A custom type or function that will be passed the direct response + :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 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, + *, + 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 + :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 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], + **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 + 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. + :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 + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/regenerateKeys" + } 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 3dc29c049f1d..80d19c46a2a5 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,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") 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 27bb7d3b448a..b908200d1615 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 @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,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") 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 28c7857fccfb..864b4d07686b 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 @@ -7,7 +7,7 @@ # 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 +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,14 +21,16 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,14 +39,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-01-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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,29 +109,35 @@ 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( - resource_group_name: str, workspace_name: str, connection_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + workspace_name: str, + connection_name: str, + subscription_id: str, + *, + aoai_models_to_deploy: 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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,12 +153,16 @@ 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 + if aoai_models_to_deploy is not None: + _params["aoaiModelsToDeploy"] = _SERIALIZER.query("aoai_models_to_deploy", aoai_models_to_deploy, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -112,13 +171,55 @@ 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", "2024-01-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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +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", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,39 +235,43 @@ 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="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( +def build_list_secrets_request( resource_group_name: str, workspace_name: str, + connection_name: str, subscription_id: str, *, - target: Optional[str] = None, - category: Optional[str] = None, + aoai_models_to_deploy: 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-01-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", + "/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), @@ -176,41 +281,504 @@ def build_list_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", 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 aoai_models_to_deploy is not None: + _params["aoaiModelsToDeploy"] = _SERIALIZER.query("aoai_models_to_deploy", aoai_models_to_deploy, "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", "2024-01-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}/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 + :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] + :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 {}) + + 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, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" + } + + @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 + :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, + 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) + + _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}/connections/{connectionName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + aoai_models_to_deploy: Optional[str] = None, + **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 + :param aoai_models_to_deploy: query parameter for which AOAI mode should be deployed. Default + value is None. + :type aoai_models_to_deploy: 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 = { + 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, + aoai_models_to_deploy=aoai_models_to_deploy, + 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("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + } + + @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 + :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 + def update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO] = 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 + :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 + def update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionUpdateParameter, IO]] = 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 type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) - 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 + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + } @overload def create( @@ -218,22 +786,25 @@ 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". @@ -250,22 +821,25 @@ def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: IO, + body: Optional[IO] = 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -281,21 +855,23 @@ def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO], + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO]] = 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: + :param body: The object for creating or updating a new workspace connection. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -323,10 +899,13 @@ 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( resource_group_name=resource_group_name, @@ -368,18 +947,28 @@ def create( } @distributed_trace - def get( - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + aoai_models_to_deploy: Optional[str] = None, + **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 + :param aoai_models_to_deploy: query parameter for which AOAI mode should be deployed. Default + value is None. + :type aoai_models_to_deploy: 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 @@ -399,13 +988,14 @@ 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, + aoai_models_to_deploy=aoai_models_to_deploy, api_version=api_version, - template_url=self.get.metadata["url"], + template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) @@ -431,28 +1021,18 @@ def get( return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + list_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + def _test_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO]] = None, + **kwargs: Any ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -461,19 +1041,34 @@ 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)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_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_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, + template_url=self._test_connection_initial.metadata["url"], headers=_headers, params=_params, ) @@ -487,121 +1082,187 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.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")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" + _test_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection" } - @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 + :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 :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] + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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] = 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 + :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: + """ - 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]] = 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 type. Default value is None. + :type body: + ~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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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( # type: ignore + 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) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" + begin_test_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection" } 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 a8b05127e633..d5563ac64e86 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,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") 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 3531e4cd54cc..e768a459c60b 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 @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,34 +39,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-01-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 +78,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-01-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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,10 +146,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 +159,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-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,67 +183,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-01-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-01-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 +257,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 +267,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-01-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 +295,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-01-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 +332,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 +343,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-01-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-01-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 +402,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 +413,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-01-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 +437,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 +448,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( 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-01-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 +472,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 +480,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-01-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 +507,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 +518,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-01-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 +542,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 +550,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,19 +573,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 + 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 :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 + :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) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -573,50 +609,102 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - 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_list_by_subscription_request( + subscription_id=self._config.subscription_id, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + 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 = 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) + 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 - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) + 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) - response = pipeline_response.http_response + def get_next(next_link=None): + request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("Workspace", pipeline_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, deserialized, {}) + return pipeline_response - return deserialized + return ItemPaged(get_next, extract_data) - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" } - def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> Optional[_models.Workspace]: + @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 + ) -> 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 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 + :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) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -625,212 +713,72 @@ 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) - - _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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - workspace_name: str, - parameters: _models.Workspace, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Workspace]: - """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. - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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. + 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, + 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) - :param resource_group_name: The name of the resource group. The name 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: - """ + 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_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 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) - :param resource_group_name: The name of the resource group. The name 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 {}) + def get_next(next_link=None): + request = prepare_request(next_link) - 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return 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) - 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 + return pipeline_response - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -850,6 +798,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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, @@ -870,22 +819,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" } @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 + :param force_to_purge: Flag to indicate delete is a purge request. Default value is False. + :type force_to_purge: bool :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -910,6 +870,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: raw_result = self._delete_initial( # type: ignore 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, @@ -923,7 +884,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -941,11 +904,76 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "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 + :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 = { + 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}" + } + def _update_initial( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO], **kwargs: Any ) -> Optional[_models.Workspace]: error_map = { @@ -966,10 +994,10 @@ def _update_initial( 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( resource_group_name=resource_group_name, @@ -1016,20 +1044,22 @@ 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 @@ -1051,20 +1081,22 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: IO, + body: IO, *, 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1086,19 +1118,21 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO], **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 + :param body: 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 + :type body: ~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 @@ -1127,7 +1161,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, @@ -1162,103 +1196,237 @@ def get_long_running_output(pipeline_response): "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. + def _create_or_update_initial( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO], **kwargs: Any + ) -> Optional[_models.Workspace]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "Workspace") + + 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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Workspace", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" + } + + @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 skip: Continuation token for pagination. Default value is None. - :type skip: 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 :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] + :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 = kwargs.pop("headers", {}) 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 {}) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. - def prepare_request(next_link=None): - if not next_link: + Creates or updates a workspace with the specified parameters. - 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) + :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 + :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: + """ - 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_create_or_update( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO], **kwargs: Any + ) -> LROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. - 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) + Creates or updates a workspace with the specified parameters. - 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 body: The parameters for creating or updating a machine learning workspace. Is either a + Workspace type or a IO type. Required. + :type body: ~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 {}) - _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[_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 ) - 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) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Workspace", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" } def _diagnose_initial( self, resource_group_name: str, workspace_name: str, - parameters: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, + body: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, **kwargs: Any ) -> Optional[_models.DiagnoseResponseResult]: error_map = { @@ -1279,11 +1447,11 @@ def _diagnose_initial( 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 @@ -1337,7 +1505,7 @@ 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,10 +1517,10 @@ 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 @@ -1376,7 +1544,7 @@ def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[IO] = None, + body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1388,10 +1556,10 @@ 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 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1415,7 +1583,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]] = None, **kwargs: Any ) -> LROPoller[_models.DiagnoseResponseResult]: """Diagnose workspace setup issue. @@ -1425,11 +1593,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 + :param body: 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 + :type body: ~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 @@ -1460,7 +1628,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, @@ -1504,10 +1672,13 @@ 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) @@ -1563,9 +1734,24 @@ def list_keys( "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: + ) -> _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 + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1578,14 +1764,14 @@ 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"], + template_url=self.list_notebook_access_token.metadata["url"], headers=_headers, params=_params, ) @@ -1599,100 +1785,107 @@ def _resync_keys_initial( # pylint: disable=inconsistent-return-statements 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) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _resync_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" + return deserialized + + list_notebook_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" } @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 = { + 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, + template_url=self.list_notebook_keys.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_notebook_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" } @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 + 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 :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] + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1701,81 +1894,65 @@ 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: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListStorageAccountKeysResult] = 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 + 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) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - _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 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) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return ItemPaged(get_next, extract_data) + return deserialized - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" + list_storage_account_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys" } @distributed_trace - def list_notebook_access_token( + def list_outbound_network_dependencies_endpoints( 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 = { @@ -1790,14 +1967,14 @@ 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"], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -1816,15 +1993,15 @@ 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) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_notebook_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" + list_outbound_network_dependencies_endpoints.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" } def _prepare_notebook_initial( @@ -1869,11 +2046,16 @@ def _prepare_notebook_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("NotebookResourceInfo", 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, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1885,12 +2067,14 @@ def _prepare_notebook_initial( 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. @@ -1953,87 +2137,9 @@ def get_long_running_output(pipeline_response): "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 - ) - - 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( + def _resync_keys_initial( # pylint: disable=inconsistent-return-statements 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: - """ + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2046,14 +2152,14 @@ 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[None] = 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"], + template_url=self._resync_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2067,87 +2173,89 @@ def list_notebook_keys( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = 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, {}) - - return deserialized + return cls(pipeline_response, None, response_headers) - list_notebook_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" + _resync_keys_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" } @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 + :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: """ - 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) + 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) - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - return deserialized + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_outbound_network_dependencies_endpoints.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" + begin_resync_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/create_or_update.py new file mode 100644 index 000000000000..b90360c5dac2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/create_or_update.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. +# -------------------------------------------------------------------------- + +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.capacity_reservation_groups.create_or_update( + resource_group_name="test-rg", + group_id="string", + body={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": {"offer": {"offerName": "string", "publisher": "string"}, "reservedCapacity": 1}, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Premium"}, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/delete.py new file mode 100644 index 000000000000..778bae532d06 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.capacity_reservation_groups.delete( + resource_group_name="test-rg", + group_id="string", + ) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/get.py new file mode 100644 index 000000000000..7d12223f559d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python get.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.capacity_reservation_groups.get( + resource_group_name="test-rg", + group_id="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list.py new file mode 100644 index 000000000000..8b14e27241be --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python list.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.capacity_reservation_groups.list( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list_by_subscription.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list_by_subscription.py new file mode 100644 index 000000000000..d6be56562819 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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_by_subscription.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.capacity_reservation_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/listBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/update.py new file mode 100644 index 000000000000..0f608c8cca58 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capacity_reservation_group/update.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 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.capacity_reservation_groups.update( + resource_group_name="test-rg", + group_id="string", + body={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"string": {}}}, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Standard"}, + "tags": {}, + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/CapacityReservationGroup/update.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 6dca84bdc7dd..2e88bbf80875 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 @@ -46,6 +46,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-01-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 efbef7e090e7..5c66d0b2773e 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 @@ -47,6 +47,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-01-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 c4f5100e5166..a9870b5b819a 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 @@ -38,6 +38,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-01-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 4e8789e3ef24..d96b18fb3261 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 @@ -55,6 +55,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-01-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 322dec99f0ea..926a2b45cd7f 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 @@ -38,6 +38,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-01-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 d2e8342bc1ad..87bc680c2f6b 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 @@ -39,30 +39,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 +93,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-01-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 575439d32563..d8ee744c8d2d 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 @@ -41,6 +41,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-01-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 4134df53117f..55ce18d16105 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 @@ -69,6 +69,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-01-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 07fc5057133b..c629b1f088f1 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 @@ -58,6 +58,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-01-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 03e8f509fbae..26e521821806 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py @@ -37,6 +37,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-01-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 4692f63ff9d7..8a215e94d5af 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 @@ -37,6 +37,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-01-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 59ea7d05e296..51409dbf68c5 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 @@ -37,6 +37,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-01-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 fe66677f7193..951eb804b430 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 @@ -37,6 +37,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-01-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 b09cac4f3f62..6c6504942e30 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 @@ -37,6 +37,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-01-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 000000000000..baa59996f408 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get_allowed_vm_sizes_for_resize.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 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-01-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 884ceeb73b59..9df3586c8a27 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py @@ -37,6 +37,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-01-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 ed185cc80326..190ba360a815 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 @@ -37,6 +37,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-01-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 66ee6a0f4bee..7b2191f74f5a 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 @@ -38,6 +38,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-01-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 344934f7929b..24f635677ac6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py @@ -44,6 +44,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-01-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 000000000000..89f21481d7b9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/resize.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 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-01-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 6f314eb40ed9..fc7febfc5d86 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py @@ -36,6 +36,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-01-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 9e6d787b739b..6319a99f9338 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py @@ -36,6 +36,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-01-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 431311991b67..82c8ade7a42d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py @@ -36,6 +36,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-01-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 000000000000..bb27006a1714 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_custom_services.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 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-01-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 000000000000..08e27cf12e8b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_data_mounts.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 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-01-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 000000000000..7c3dc2c5c690 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_idle_shutdown_setting.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 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-01-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 000000000000..d6ebd370ba96 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/data_reference/get_blob_reference_sas.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_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-01-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 f51f887bbd51..734f4d47eff4 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 @@ -53,6 +53,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-01-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 bfbb9e2ecda5..5a49b18ec4fb 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 @@ -54,6 +54,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-01-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 d221f4673621..d33e46b2a01b 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 @@ -57,6 +57,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-01-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 0ae6c4a4789c..4104d3166571 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 @@ -53,6 +53,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-01-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 78dd652ab719..15b9bb8c2e64 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py @@ -36,6 +36,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-01-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 93e17e5a0997..737d313d4660 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py @@ -37,6 +37,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-01-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 4b5de229b6e2..5c1ab8762a2d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py @@ -37,6 +37,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-01-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 74fe51d50b35..425417eec906 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 @@ -37,6 +37,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-01-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 000000000000..7be7807774fd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/create.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. +# -------------------------------------------------------------------------- + +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-01-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 000000000000..012600a5bfa0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/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_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-01-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 000000000000..01c853b4fd64 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/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.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-01-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 000000000000..cf44fee49669 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/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_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-01-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 000000000000..5c7cd1ac620b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_deployments.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_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-01-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 000000000000..b8368d8bde65 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_in_workspace.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 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-01-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 000000000000..0ff9c78cbd1a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get.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 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-01-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 000000000000..57f3ef301af9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get_models.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_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-01-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 000000000000..14230070e9eb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list.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.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-01-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 000000000000..b0b552bda6f9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list_keys.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_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-01-01-preview/examples/Endpoint/listKeys.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 000000000000..76635f456957 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/regenerate_key.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 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-01-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 aa82632feffb..56d87caa1632 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 @@ -36,6 +36,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-01-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 000000000000..e07f67e2b44b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/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.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-01-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 000000000000..842cb1784e67 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/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.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-01-01-preview/examples/Feature/list.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 47f02ffa0535..a2dfa4738ee3 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 @@ -35,52 +35,59 @@ def main(): id="string", body={ "properties": { + "autologgerSettings": {"mlflowAutologger": "Disabled"}, + "codeId": "string", + "command": "string", + "componentId": "string", "computeId": "string", "description": "string", "displayName": "string", + "distribution": {"distributionType": "TensorFlow", "parameterServerCount": 1, "workerCount": 1}, "environmentId": "string", "environmentVariables": {"string": "string"}, "experimentName": "string", "identity": {"identityType": "AMLToken"}, + "inputs": {"string": {"description": "string", "jobInputType": "literal", "value": "string"}}, "isArchived": False, - "jobType": "AutoML", + "jobType": "Command", + "limits": {"jobLimitsType": "Command", "timeout": "PT5M"}, + "notificationSetting": {"emailOn": ["JobCompleted"], "emails": ["string"]}, "outputs": { "string": { + "assetName": "string", + "assetVersion": "string", "description": "string", "jobOutputType": "uri_file", - "mode": "ReadWriteMount", + "mode": "Direct", "uri": "string", } }, "properties": {"string": "string"}, + "queueSettings": {"jobTier": "Premium", "priority": 1}, "resources": { + "dockerArgs": "string", "instanceCount": 1, "instanceType": "string", - "properties": {"string": {"9bec0ab0-c62f-4fa9-a97c-7b24bbcc90ad": None}}, + "locations": ["string"], + "properties": {"string": {"f69c8d5a-9b39-4183-92d3-a2b18944cf95": None}}, + "shmSize": "2g", }, "services": { "string": { "endpoint": "string", "jobServiceType": "string", + "nodes": {"nodesValueType": "All"}, "port": 1, "properties": {"string": "string"}, } }, "tags": {"string": "string"}, - "taskDetails": { - "limitSettings": {"maxTrials": 2}, - "modelSettings": {"validationCropSize": 2}, - "searchSpace": [{"validationCropSize": "choice(2, 360)"}], - "targetColumnName": "string", - "taskType": "ImageClassification", - "trainingData": {"jobInputType": "mltable", "uri": "string"}, - }, } }, ) 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-01-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 5744ad654a74..ee8a6ac7c333 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 @@ -37,6 +37,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-01-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 2b84eaeaa4ea..f4bc57165b22 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 @@ -37,6 +37,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-01-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 92009c446172..bfc9486290fa 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py @@ -36,6 +36,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-01-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 d37efcce8ad5..a57a56a204c1 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 @@ -35,8 +35,10 @@ def main(): id="string", body={ "properties": { + "autologgerSettings": {"mlflowAutologger": "Disabled"}, "codeId": "string", "command": "string", + "componentId": "string", "computeId": "string", "description": "string", "displayName": "string", @@ -46,26 +48,35 @@ def main(): "experimentName": "string", "identity": {"identityType": "AMLToken"}, "inputs": {"string": {"description": "string", "jobInputType": "literal", "value": "string"}}, + "isArchived": False, "jobType": "Command", "limits": {"jobLimitsType": "Command", "timeout": "PT5M"}, + "notificationSetting": {"emailOn": ["JobCancelled"], "emails": ["string"]}, "outputs": { "string": { + "assetName": "string", + "assetVersion": "string", "description": "string", "jobOutputType": "uri_file", - "mode": "ReadWriteMount", + "mode": "Upload", "uri": "string", } }, "properties": {"string": "string"}, + "queueSettings": {"jobTier": "Basic", "priority": 1}, "resources": { + "dockerArgs": "string", "instanceCount": 1, "instanceType": "string", - "properties": {"string": {"e6b6493e-7d5e-4db3-be1e-306ec641327e": None}}, + "locations": ["string"], + "properties": {"string": {"c9ac10d0-915b-4de5-afe8-a4c78a37a558": None}}, + "shmSize": "2g", }, "services": { "string": { "endpoint": "string", "jobServiceType": "string", + "nodes": {"nodesValueType": "All"}, "port": 1, "properties": {"string": "string"}, } @@ -77,6 +88,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-01-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 da20b17f687c..7c47d0ca041e 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 @@ -37,6 +37,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-01-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 603f7bbbc412..2df0909ec8af 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 @@ -37,6 +37,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-01-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 80e82b2866eb..ffbc3ef9168e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py @@ -32,10 +32,10 @@ def main(): client.jobs.begin_delete( resource_group_name="test-rg", workspace_name="my-aml-workspace", - id="http://subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/my-favorite-aml-job", + id="string", ).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-01-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 000000000000..73ccc33bad8f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/create_or_update.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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": { + "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": { + "assetName": "string", + "assetVersion": "string", + "description": "string", + "jobOutputType": "mlflow_model", + "mode": "ReadWriteMount", + "uri": "string", + } + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 000000000000..a674ca0f2446 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/get.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 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-01-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 000000000000..dca815326adc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/list.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.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-01-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 8d093b05a24b..7c1b634a98d7 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 @@ -61,6 +61,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-01-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 69dd018de1ad..41b7c0e6ebb4 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 @@ -37,6 +37,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-01-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 2ee9adaf0c1e..7a10dc6ac7f2 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 @@ -37,6 +37,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-01-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 39198f670f47..23f1148590cc 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 @@ -35,49 +35,59 @@ def main(): id="string", body={ "properties": { + "autologgerSettings": {"mlflowAutologger": "Disabled"}, + "codeId": "string", + "command": "string", + "componentId": "string", "computeId": "string", "description": "string", "displayName": "string", - "earlyTermination": {"delayEvaluation": 1, "evaluationInterval": 1, "policyType": "MedianStopping"}, + "distribution": {"distributionType": "TensorFlow", "parameterServerCount": 1, "workerCount": 1}, + "environmentId": "string", + "environmentVariables": {"string": "string"}, "experimentName": "string", - "jobType": "Sweep", - "limits": { - "jobLimitsType": "Sweep", - "maxConcurrentTrials": 1, - "maxTotalTrials": 1, - "trialTimeout": "PT1S", + "identity": {"identityType": "AMLToken"}, + "inputs": {"string": {"description": "string", "jobInputType": "literal", "value": "string"}}, + "isArchived": False, + "jobType": "Command", + "limits": {"jobLimitsType": "Command", "timeout": "PT5M"}, + "notificationSetting": {"emailOn": ["JobCompleted"], "emails": ["string"]}, + "outputs": { + "string": { + "assetName": "string", + "assetVersion": "string", + "description": "string", + "jobOutputType": "uri_file", + "mode": "ReadWriteMount", + "uri": "string", + } }, - "objective": {"goal": "Minimize", "primaryMetric": "string"}, "properties": {"string": "string"}, - "samplingAlgorithm": {"samplingAlgorithmType": "Grid"}, - "searchSpace": {"string": {}}, + "queueSettings": {"jobTier": "Basic", "priority": 1}, + "resources": { + "dockerArgs": "string", + "instanceCount": 1, + "instanceType": "string", + "locations": ["string"], + "properties": {"string": {"5fc1f627-491e-45a0-a6a2-f5b4be884911": None}}, + "shmSize": "2g", + }, "services": { "string": { "endpoint": "string", "jobServiceType": "string", + "nodes": {"nodesValueType": "All"}, "port": 1, "properties": {"string": "string"}, } }, "tags": {"string": "string"}, - "trial": { - "codeId": "string", - "command": "string", - "distribution": {"distributionType": "Mpi", "processCountPerInstance": 1}, - "environmentId": "string", - "environmentVariables": {"string": "string"}, - "resources": { - "instanceCount": 1, - "instanceType": "string", - "properties": {"string": {"e6b6493e-7d5e-4db3-be1e-306ec641327e": None}}, - }, - }, } }, ) 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-01-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 4c424fedc4e7..90132a09a4e7 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 @@ -37,6 +37,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-01-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 3081f0d1b58d..00f663c8f10a 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 @@ -37,6 +37,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-01-01-preview/examples/Job/SweepJob/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/update.py new file mode 100644 index 000000000000..72df4722e613 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/update.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. +# -------------------------------------------------------------------------- + +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.jobs.update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + id="string", + body={ + "properties": { + "notificationSetting": {"webhooks": {"string": {"eventType": "string", "webhookType": "AzureDevOps"}}} + } + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/Job/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/create_or_update.py new file mode 100644 index 000000000000..b93acea20bff --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/create_or_update.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. +# -------------------------------------------------------------------------- + +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.labeling_jobs.begin_create_or_update( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + body={ + "properties": { + "description": "string", + "jobInstructions": {"uri": "link/to/instructions"}, + "jobType": "Labeling", + "labelCategories": { + "myCategory1": { + "classes": { + "myLabelClass1": {"displayName": "myLabelClass1", "subclasses": {}}, + "myLabelClass2": {"displayName": "myLabelClass2", "subclasses": {}}, + }, + "displayName": "myCategory1Title", + "multiSelect": "Disabled", + }, + "myCategory2": { + "classes": { + "myLabelClass1": {"displayName": "myLabelClass1", "subclasses": {}}, + "myLabelClass2": {"displayName": "myLabelClass2", "subclasses": {}}, + }, + "displayName": "myCategory2Title", + "multiSelect": "Disabled", + }, + }, + "labelingJobMediaProperties": {"mediaType": "Image"}, + "mlAssistConfiguration": { + "inferencingComputeBinding": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1234/providers/Microsoft.MachineLearningServices/workspaces/testworkspace/computes/myscoringcompute", + "mlAssist": "Enabled", + "trainingComputeBinding": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1234/providers/Microsoft.MachineLearningServices/workspaces/testworkspace/computes/mytrainingompute", + }, + "properties": {"additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string"}, + "tags": {"additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/delete.py new file mode 100644 index 000000000000..fd19c6a766bc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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.labeling_jobs.delete( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + ) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/export_labels.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/export_labels.py new file mode 100644 index 000000000000..814bc10629d8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/export_labels.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python export_labels.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.begin_export_labels( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + body={"format": "Dataset"}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/exportLabels.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/get.py new file mode 100644 index 000000000000..7116ea89297d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/get.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 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.labeling_jobs.get( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/list.py new file mode 100644 index 000000000000..29b48677b4ba --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/list.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.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.list( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/pause.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/pause.py new file mode 100644 index 000000000000..348e7499f41b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/pause.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python pause.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.pause( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + id="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/pause.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/resume.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/resume.py new file mode 100644 index 000000000000..5d794503f11a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/labeling_job/resume.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python resume.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.begin_resume( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + id="string", + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/LabelingJob/resume.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 000000000000..803b67c48bb3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/create_or_update_rule.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_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-1", + body={ + "properties": {"category": "UserDefined", "destination": "some_string", "status": "Active", "type": "FQDN"} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 000000000000..548c287a1a58 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/delete_rule.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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="some_string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 000000000000..0cd247861adf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/get_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 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="rule-1", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 000000000000..db7d9f091c85 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/list_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 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-01-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 000000000000..1f79a420d6aa --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/provision.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 66a02eb6b469..841a7f23f99e 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 @@ -36,6 +36,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-01-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 009f750c227c..4dbfc9baa7a3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py @@ -36,6 +36,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-01-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 2bae655720a4..d86675d54822 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 @@ -39,6 +39,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-01-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 da3956267da7..43ae4fb9057f 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 @@ -74,6 +74,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-01-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 bccba8918be1..ca3712094ec4 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 @@ -38,6 +38,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-01-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 532af7db70b6..52f48ab97e8f 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 @@ -39,6 +39,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-01-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 ef4bd08cf870..f2c87c576ed8 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 @@ -42,6 +42,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-01-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 7df4af070406..98c35fdfc276 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 @@ -38,6 +38,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-01-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 c890a3f55278..1615fa752bc6 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 @@ -77,6 +77,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-01-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 ccfa935e7f46..e800a8834e80 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 @@ -38,6 +38,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-01-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 ef2b493c784f..7addc9e8bbf3 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 @@ -39,6 +39,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-01-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 e7ec5681f716..c7c4418a0865 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 @@ -42,6 +42,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-01-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 4f95d6a5bdef..66e5fe2cbb42 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 @@ -33,13 +33,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-01-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 d071ba7e4df5..626650b6f48b 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 @@ -36,6 +36,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-01-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 f3a4e42b1c2b..018cece26eb6 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 @@ -37,6 +37,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-01-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 8a893d04e41b..4f352cf3b1d8 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 @@ -37,6 +37,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-01-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 71a768ec1c85..8ca35f1efe8f 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 @@ -33,9 +33,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-01-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 ba614e993d14..df2380a3bf47 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py @@ -36,6 +36,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-01-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 d135e3ae3a58..0336d2d98a31 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py @@ -51,6 +51,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-01-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 577787fee2b8..a8e728233274 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 @@ -91,6 +91,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-01-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 4fb0f626522f..fa44d265ffc2 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 @@ -75,6 +75,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-01-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 2e4a8a929e44..f098fff9f89b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py @@ -35,6 +35,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-01-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 fd5b114248b7..daa17cfb9f00 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 @@ -36,6 +36,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-01-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 bd86983df7e3..7329dadd86dd 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 @@ -36,6 +36,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-01-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 d017c80aa223..bb47d4005f5a 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 @@ -34,6 +34,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-01-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 d9ef5482f599..43e7df8d9b99 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 @@ -36,6 +36,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-01-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 193089df5170..60ad72a27ec7 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 @@ -36,6 +36,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-01-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 75dd8c55aac0..7272af9f6be9 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 @@ -93,6 +93,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-01-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 bda97b4ad6d5..1131d8e984ed 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 @@ -41,6 +41,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-01-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 d8ecdb855c20..b3d270d28883 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 @@ -41,6 +41,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-01-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 3b5010d9d181..ea8060cc30bd 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 @@ -38,6 +38,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-01-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 b72a96432c9f..513d9e7d3e44 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 @@ -36,6 +36,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-01-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 c8b1ce0c2a7c..d35a53eb0565 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 @@ -37,6 +37,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-01-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 8f5972265e01..3ae5f22d7a2b 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 @@ -37,6 +37,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-01-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 e3e974c61eb9..7f788c51c8c5 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 @@ -34,11 +34,11 @@ def main(): registry_name="registryName", code_name="string", version="string", - body={"pendingUploadId": "string", "pendingUploadType": "TemporaryBlobReference"}, + body={"pendingUploadId": "string", "pendingUploadType": "None"}, ) 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-01-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 1df9f062fc28..2656f86fe1ee 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 @@ -47,6 +47,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-01-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 3e012305c57c..ef21c724e607 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 @@ -37,6 +37,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-01-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 f62658b63374..5310028d56cb 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 @@ -38,6 +38,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-01-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 4453204ec59d..9e56377cef9e 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 @@ -38,6 +38,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-01-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 6c3efd5e6a13..bebf0bdcff68 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 @@ -40,6 +40,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-01-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 aea7dc0c0dea..e5a582d73ba8 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 @@ -36,6 +36,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-01-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 652246d77411..78493249629f 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 @@ -37,6 +37,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-01-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 af03b40d6482..53c2c724cab4 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 @@ -37,6 +37,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-01-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 3ef241cc2c8d..5146918ad290 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 @@ -47,6 +47,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-01-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 24e8ba968dcd..e8da0f0f5937 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 @@ -37,6 +37,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-01-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 906686be462b..9ba3170b05ca 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 @@ -38,6 +38,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-01-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 39d93fd0de0c..d35c742df462 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 @@ -38,6 +38,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-01-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 2619016ab138..85b397dba0d9 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 @@ -46,6 +46,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-01-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 db9823083c38..e239717e7599 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 @@ -36,6 +36,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-01-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 cd457746f179..abe6e1483add 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 @@ -37,6 +37,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-01-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 1b5917eb34e7..d75901f8168d 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 @@ -37,6 +37,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-01-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 9142baba5fad..c2fd9b17e29c 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 @@ -39,6 +39,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-01-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 01da03f03e19..9ed7cef5a771 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 @@ -50,6 +50,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-01-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 d8772f5b25d5..b223134c872b 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 @@ -37,6 +37,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-01-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 fdf5e3b6453f..c69483e17309 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 @@ -38,6 +38,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-01-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 54d19354ab1b..e2f5b3f3f76a 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 @@ -38,6 +38,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-01-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 931d285c42d8..a933b373d425 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 @@ -40,6 +40,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-01-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 098883e9fffe..ea145be58448 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 @@ -36,6 +36,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-01-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 bc742dec3e1b..ee179f04546a 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 @@ -37,6 +37,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-01-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 75d05a51b957..3517dc997364 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 @@ -37,6 +37,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-01-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 a24b50119143..e99669fe9f7a 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 @@ -34,11 +34,11 @@ def main(): registry_name="registryName", model_name="string", version="string", - body={"pendingUploadId": "string", "pendingUploadType": "TemporaryBlobReference"}, + body={"pendingUploadId": "string", "pendingUploadType": "None"}, ) 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-01-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 a2caeebafdd8..6a4e78d4c5f9 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 @@ -49,6 +49,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-01-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 243da0a3dc5e..bc934e4379c8 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 @@ -37,6 +37,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-01-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 3f718017c063..b7040711fa6f 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 @@ -38,6 +38,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-01-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 ca64f031391d..d7a3ccb05086 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 @@ -38,6 +38,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-01-01-preview/examples/Registry/ModelVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/package.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/package.py new file mode 100644 index 000000000000..13db766326fa --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/package.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 package.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_model_versions.begin_package( + resource_group_name="test-rg", + registry_name="my-aml-registry", + model_name="string", + version="string", + body={ + "baseEnvironmentSource": {"baseEnvironmentSourceType": "EnvironmentAsset", "resourceId": "string"}, + "environmentVariables": {"string": "string"}, + "inferencingServer": { + "codeConfiguration": {"codeId": "string", "scoringScript": "string"}, + "serverType": "AzureMLBatch", + }, + "inputs": [ + { + "inputType": "UriFile", + "mode": "Download", + "mountPath": "string", + "path": {"inputPathType": "Url", "url": "string"}, + } + ], + "modelConfiguration": {"mode": "ReadOnlyMount", "mountPath": "string"}, + "tags": {"string": "string"}, + "targetEnvironmentId": "string", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/Registry/ModelVersion/package.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 351a1bcdea58..f3774df6268a 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 @@ -57,6 +57,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-01-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 69da5de82fe1..ba5bfc379309 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py @@ -36,6 +36,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-01-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 7772e8800fa9..f28bfbb67fb8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py @@ -37,6 +37,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-01-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 0610eab1d68d..f6ae63eafcbc 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py @@ -37,6 +37,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-01-01-preview/examples/Schedule/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/trigger.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/trigger.py new file mode 100644 index 000000000000..b2b3c75e7bc5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/trigger.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 trigger.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.schedules.trigger( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="test-schedule", + body={"scheduleTime": "2024-01-01T12:34:56.999Z"}, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/Schedule/trigger.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 ccff07e2fa36..e0aab70ae2e6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py @@ -36,6 +36,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-01-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 e84b655dbd1e..a1d88eb5b5ed 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 @@ -35,6 +35,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-01-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 64b1e00ff40c..0126cb6b4341 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 @@ -66,6 +66,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-01-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 e4e9b5706e42..9b6a18d0c0cb 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 @@ -37,6 +37,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-01-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 d1617e809898..7f0573d818b8 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 @@ -38,6 +38,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-01-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 f1242ba35f7e..89e09bf542c6 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 @@ -38,6 +38,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-01-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 102b3fe0734c..328b05052d4a 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 @@ -39,6 +39,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-01-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 2074040353b4..8e78d9531e7d 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 @@ -50,6 +50,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-01-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 80701cf2af60..f9c2b6452e5c 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 @@ -36,6 +36,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-01-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 990f55858aee..29171c40b95a 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 @@ -37,6 +37,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-01-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 e3e3fe7fd1dc..945e216f3c1f 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 @@ -37,6 +37,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-01-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 cc96bcdff698..d712c1180640 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 @@ -37,6 +37,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-01-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 f6725836e685..172ceb0c5ad4 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 @@ -38,6 +38,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-01-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 af061e818d47..eba7ac4eff97 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 @@ -38,6 +38,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-01-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 7da2cb51b90a..4190ea52a4f4 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 @@ -36,6 +36,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-01-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 f56a7a87e660..84787e0c878f 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 @@ -37,6 +37,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-01-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 001ce2be8571..4e04f09e2200 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 @@ -37,6 +37,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-01-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 cea171e25bfb..aa7df119d526 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 @@ -34,11 +34,11 @@ def main(): workspace_name="my-aml-workspace", name="string", version="string", - body={"pendingUploadId": "string", "pendingUploadType": "None"}, + body={"pendingUploadId": "string", "pendingUploadType": "TemporaryBlobReference"}, ) 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-01-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 b894f4bda5f4..79198d327c1f 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 @@ -47,6 +47,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-01-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 c78c15a8ed47..5412dd76676b 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 @@ -37,6 +37,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-01-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 ecae464c7718..52b48008a31d 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 @@ -38,6 +38,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-01-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 52a9742de543..d5cd5ccf1340 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 @@ -38,6 +38,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-01-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 000000000000..e54e43d31f53 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/publish.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 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-01-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 1c6f64c469e1..88c31c548081 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 @@ -40,6 +40,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-01-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 8826100a38e4..29de91484104 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 @@ -36,6 +36,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-01-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 3954753f23ad..4033fa85f1c9 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 @@ -37,6 +37,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-01-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 45d349e330cd..f42e66774fe5 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 @@ -37,6 +37,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-01-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 724e7b3e919a..04f7e51da95b 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 @@ -47,6 +47,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-01-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 e3fe021ae631..04e9dbe13afc 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 @@ -37,6 +37,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-01-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 5d23ed45e902..7274ec6fa137 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 @@ -38,6 +38,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-01-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 aaecb70ad47d..87ec0fe7e477 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 @@ -38,6 +38,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-01-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 000000000000..39770dafade1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/publish.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 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-01-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 cd04a676e0e1..8c28a8312d45 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py @@ -32,7 +32,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 +76,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-01-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 98d366c715e9..fca7f92e8d66 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 @@ -45,6 +45,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-01-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 a135c9b5d424..eda43e07eabf 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 @@ -36,6 +36,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-01-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 53ef7b99be97..e10ffd67eac2 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 @@ -37,6 +37,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-01-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 3d48472b6ceb..062899375d24 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 @@ -37,6 +37,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-01-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 8705b06141a3..bdd747b66d2d 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 @@ -48,6 +48,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-01-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 4b7c673a5232..0951191bdd1d 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 @@ -37,6 +37,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-01-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 d0e194b55997..62823a5022bb 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 @@ -38,6 +38,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-01-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 72bb1bc4b0e0..e8f757757fda 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 @@ -38,6 +38,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-01-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 000000000000..3a3df3ea91cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/publish.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 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-01-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 205bca6f2e81..fea4e1924528 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py @@ -35,6 +35,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-01-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 3077375cd454..d3c03a40c010 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py @@ -36,6 +36,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-01-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 000000000000..21e3e7aaae1e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/create_or_update.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_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-01-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 000000000000..b56a9207cdce --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 000000000000..a7653d7e5c1b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/get_entity.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 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-01-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 000000000000..cf5df07eb355 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/list.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.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-01-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 000000000000..ea9777d0c3cc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/backfill.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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-01-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 000000000000..69a932154ee3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/create_or_update.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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-01-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 000000000000..f2eb768677d7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/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_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-01-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 000000000000..8942ad2bb3b3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/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.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-01-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 000000000000..5706ca043493 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/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_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-01-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 000000000000..0222cbaa1a67 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/create_or_update.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_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-01-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 000000000000..1558ea9e4a3b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 000000000000..ef4de98c35f2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/get_entity.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 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-01-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 000000000000..0b9da107a3ab --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/list.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.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-01-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 000000000000..00b89f0130be --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/create_or_update.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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-01-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 000000000000..a0f21f77eb11 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/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_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-01-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 000000000000..4abb5c9fefa5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/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.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-01-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 000000000000..0611653d07f5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/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_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-01-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 4c2f399080e3..7d511d9ccab1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py @@ -36,6 +36,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-01-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 000000000000..207eb6a0dd7b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/create_or_update.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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", + "groupId": "string", + "properties": {"string": "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-01-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 000000000000..6301a28dfe24 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_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.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-01-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 000000000000..1c3c113b21fa --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_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.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-01-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 000000000000..c25598adcb54 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_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.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-01-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 000000000000..bcd00cb37f2f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/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 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-01-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 000000000000..7caf4f6054c3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/create_or_update.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 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": { + "bonusExtraCapacity": 1, + "description": "string", + "metadata": "string", + "priority": 1, + "properties": {"string": "string"}, + }, + "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-01-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 000000000000..ed200b13bb5f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/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_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-01-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 000000000000..cd7025a50554 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/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_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-01-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 000000000000..ce822491551f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get_status.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_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-01-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 000000000000..6d13fe53a05d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/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_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-01-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 000000000000..2c9859a7d699 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list_skus.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_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-01-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 000000000000..846cb30c16e5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/update.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. +# -------------------------------------------------------------------------- + +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-01-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 000000000000..324573b98a9c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/create_or_update.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. +# -------------------------------------------------------------------------- + +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": { + "codeConfiguration": {"codeId": "string", "scoringScript": "string"}, + "description": "string", + "environmentConfiguration": { + "environmentId": "string", + "environmentVariables": {"string": "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": "string"}, + "nodeSkuType": "string", + "properties": {"string": "string"}, + "requestConfiguration": {"maxConcurrentRequestsPerInstance": 1, "requestTimeout": "PT5M"}, + }, + "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-01-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 000000000000..09a7a699b4fc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 000000000000..bd3a86c825c1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get.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 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-01-01-preview/examples/Workspace/InferencePool/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get_status.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get_status.py new file mode 100644 index 000000000000..1b4be35d8af8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get_status.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 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_pools.get_status( + 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-01-01-preview/examples/Workspace/InferencePool/getStatus.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 000000000000..4355d6413dd2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list.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.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-01-01-preview/examples/Workspace/InferencePool/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list_skus.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list_skus.py new file mode 100644 index 000000000000..eb6b2e21c6cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list_skus.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_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_pools.list_skus( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + inference_pool_name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/Workspace/InferencePool/listSkus.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 000000000000..57d3e9b69239 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/update.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. +# -------------------------------------------------------------------------- + +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-01-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 48ad1779487f..b0d9b5b3cf7d 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 @@ -36,6 +36,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-01-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 921bfb2b59f6..2e0c46be32cf 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 @@ -34,6 +34,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-01-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 9e0e183e60ef..66e08064db90 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 @@ -36,6 +36,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-01-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 d180f3ee30c2..3163ceec605f 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 @@ -36,6 +36,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-01-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 dbc963513d84..e8cddd5103ce 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 @@ -36,6 +36,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-01-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 000000000000..c448fc70cdbc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/create_or_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 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-01-01-preview/examples/Workspace/MarketplaceSubscription/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py similarity index 63% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py rename to sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py index 617969a2d794..ccf997282f80 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.scvmm import SCVMM +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-scvmm + pip install azure-mgmt-machinelearningservices # USAGE - python restore_checkpoint_virtual_machine.py + 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, @@ -24,18 +24,18 @@ def main(): - client = SCVMM( + client = MachineLearningServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.virtual_machines.begin_restore_checkpoint( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.marketplace_subscriptions.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestoreCheckpointVirtualMachine.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 000000000000..5fc74a570bff --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/get.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 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-01-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 000000000000..6a3440db1b19 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/list.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.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-01-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 3c3a3ce3aaf6..eab90aecb527 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 @@ -40,6 +40,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-01-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 7a5a7947d5a4..cae332ed0f5b 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 @@ -36,6 +36,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-01-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 9a5d2fcc742a..4a55c2a61302 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 @@ -37,6 +37,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-01-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 988fdad83e14..541e88f2459a 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 @@ -37,6 +37,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-01-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 0d9996be1fbb..7423c26ebeaa 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 @@ -49,6 +49,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-01-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 ddf28eee5525..aed2ed33c9ed 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 @@ -37,6 +37,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-01-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 3322b8491634..96ca8fe54433 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 @@ -38,6 +38,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-01-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 b6fe6cc09d99..5cc6149d0156 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 @@ -38,6 +38,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-01-01-preview/examples/Workspace/ModelVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/package.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/package.py new file mode 100644 index 000000000000..6a4853b169e0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/package.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 package.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.model_versions.begin_package( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={ + "baseEnvironmentSource": {"baseEnvironmentSourceType": "EnvironmentAsset", "resourceId": "string"}, + "environmentVariables": {"string": "string"}, + "inferencingServer": { + "codeConfiguration": {"codeId": "string", "scoringScript": "string"}, + "serverType": "AzureMLBatch", + }, + "inputs": [ + { + "inputType": "UriFile", + "mode": "Download", + "mountPath": "string", + "path": {"inputPathType": "Url", "url": "string"}, + } + ], + "modelConfiguration": {"mode": "ReadOnlyMount", "mountPath": "string"}, + "tags": {"string": "string"}, + "targetEnvironmentId": "string", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-01-preview/examples/Workspace/ModelVersion/package.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 000000000000..a8f6439fc42f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/publish.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 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-01-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 209f1dc99b4c..5e92495857a4 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 @@ -37,6 +37,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-01-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 0ad2062a3eef..6c11f85b2431 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 @@ -51,6 +51,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-01-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 c00b39bfcf47..1f2eccf938f9 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 @@ -36,6 +36,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-01-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 c22efccb2c1e..e9051900ca67 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 @@ -37,6 +37,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-01-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 f721177eb41c..3fb0cf18b83f 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 @@ -37,6 +37,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-01-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 741567b8ceed..911804f5149f 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 @@ -37,6 +37,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-01-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 550945711c4b..18144abd38c0 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 @@ -37,6 +37,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-01-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 f6f874cb710c..778fbfc80ef7 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 @@ -37,6 +37,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-01-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 b1c25f72b06b..cbf19f31d882 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 @@ -38,6 +38,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-01-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 91510c53d5b5..404c1fee178e 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 @@ -34,6 +34,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-01-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 f332a4120926..ba4ac645ef3a 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 @@ -35,6 +35,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-01-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 000000000000..384a19dd7cc5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/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.serverless_endpoints.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "authMode": "AAD", + "capacityReservation": {"capacityReservationGroupId": "string", "endpointReservedCapacity": 1}, + "offer": {"offerName": "string", "publisher": "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-01-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 000000000000..2a714ed6ac55 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 000000000000..d9dd01d8a447 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get.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 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-01-01-preview/examples/Workspace/ServerlessEndpoint/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get_status.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get_status.py new file mode 100644 index 000000000000..c8219745f76e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get_status.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 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.serverless_endpoints.get_status( + 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-01-01-preview/examples/Workspace/ServerlessEndpoint/getStatus.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 000000000000..d95aeb5b6a0a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list.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.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-01-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 000000000000..cb4abe578853 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list_keys.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_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-01-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 000000000000..5bdecdad8367 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/regenerate_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 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-01-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 000000000000..8cdcfdac3205 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/update.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. +# -------------------------------------------------------------------------- + +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": "Basic"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-01-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 f8b3fae5c4cc..f7d143a04af2 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py @@ -32,7 +32,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 +43,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-01-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 110d4862cc3a..8cbdfa89093f 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 @@ -33,11 +33,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-01-01-preview/examples/WorkspaceConnection/create.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 c154fbe498b6..40b7e3b318f7 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 @@ -36,6 +36,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-01-01-preview/examples/WorkspaceConnection/delete.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 98aa005623e0..8e17ea48be79 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 @@ -37,6 +37,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-01-01-preview/examples/WorkspaceConnection/get.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 3f4299cf1809..0190c648a2d9 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 @@ -37,6 +37,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-01-01-preview/examples/WorkspaceConnection/list.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 000000000000..fd3ecacde634 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_secrets.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_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-01-01-preview/examples/WorkspaceConnection/listSecrets.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 000000000000..1d9116ffc99c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/test_connection.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python 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-01-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 000000000000..b5322098fa1a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/update.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 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-01-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 3f1b7fa8da64..c999913876ce 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 @@ -37,6 +37,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-01-01-preview/examples/WorkspaceFeature/list.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/README.md b/sdk/network/azure-mgmt-network/README.md index 41a1a4c77465..fac00af2da20 100644 --- a/sdk/network/azure-mgmt-network/README.md +++ b/sdk/network/azure-mgmt-network/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Network 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 diff --git a/sdk/network/azure-mgmt-network/_meta.json b/sdk/network/azure-mgmt-network/_meta.json index ed94baa2f9f6..565430aad2be 100644 --- a/sdk/network/azure-mgmt-network/_meta.json +++ b/sdk/network/azure-mgmt-network/_meta.json @@ -1,12 +1,12 @@ { - "commit": "1ca8b90e85a54ad3de34aae95e319fe33b60a94b", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/network/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/network/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/network/resource-manager/readme.md", "package-2023-02": "2023-11-08 10:08:29 -0800 4b55e2d0e29fb2e829985485c9150f46157c3b80 Microsoft.Network/stable/2023-02-01/virtualWan.json", "package-2021-02": "2021-09-14 19:30:27 -0700 54f1c87938269d4706629dc04c26ee1f3634585a Microsoft.Network/stable/2021-02-01/privateLinkService.json", @@ -32,6 +32,7 @@ "package-2017-10": "2019-06-13 02:23:37 +0300 e19543a6a361096e5ca11a42424a39025fd008fa Microsoft.Network/stable/2017-10-01/applicationGateway.json", "package-2015-06split": "2019-06-13 02:17:06 +0300 f0f79bfa8191ac30cfb0f87665411769bd2063a6 Microsoft.Network/stable/2015-06-15/virtualNetworkGateway.json", "package-2023-04": "2023-11-08 10:08:29 -0800 4b55e2d0e29fb2e829985485c9150f46157c3b80 Microsoft.Network/stable/2023-04-01/virtualWan.json", - "package-2023-05": "2023-11-08 10:08:29 -0800 4b55e2d0e29fb2e829985485c9150f46157c3b80 Microsoft.Network/stable/2023-05-01/virtualWan.json", - "package-2023-06": "2023-11-08 10:08:29 -0800 4b55e2d0e29fb2e829985485c9150f46157c3b80 Microsoft.Network/stable/2023-06-01/webapplicationfirewall.json" + "package-2023-05": "2024-02-07 11:59:11 -0700 9097c69e0a06db68f37ce9d8522068029369d8e4 Microsoft.Network/stable/2023-05-01/azureFirewall.json", + "package-2023-06": "2023-11-08 10:08:29 -0800 4b55e2d0e29fb2e829985485c9150f46157c3b80 Microsoft.Network/stable/2023-06-01/webapplicationfirewall.json", + "package-2023-09": "2023-12-28 00:43:34 +0530 a6237cbef545ae4cd0d3674a7cb3effa2b7b13d8 Microsoft.Network/stable/2023-09-01/webapplicationfirewall.json" } \ No newline at end of file diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/_client.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/_client.py index 23be046ceaf8..147dfad3db35 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/_client.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/_client.py @@ -213,7 +213,7 @@ class NetworkManagementClient(NetworkManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2023-06-01' + DEFAULT_API_VERSION = '2023-09-01' _PROFILE_TAG = "azure.mgmt.network.NetworkManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -273,7 +273,7 @@ def _models_dict(cls): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateways(self): api_version = self._get_api_version("application_gateways") @@ -287,7 +287,7 @@ def application_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_authorizations(self): api_version = self._get_api_version("express_route_circuit_authorizations") @@ -301,7 +301,7 @@ def express_route_circuit_authorizations(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_peerings(self): api_version = self._get_api_version("express_route_circuit_peerings") @@ -315,7 +315,7 @@ def express_route_circuit_peerings(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuits(self): api_version = self._get_api_version("express_route_circuits") @@ -329,7 +329,7 @@ def express_route_circuits(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_service_providers(self): api_version = self._get_api_version("express_route_service_providers") @@ -343,7 +343,7 @@ def express_route_service_providers(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancers(self): api_version = self._get_api_version("load_balancers") @@ -357,7 +357,7 @@ def load_balancers(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def local_network_gateways(self): api_version = self._get_api_version("local_network_gateways") @@ -371,7 +371,7 @@ def local_network_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interfaces(self): api_version = self._get_api_version("network_interfaces") @@ -385,7 +385,7 @@ def network_interfaces(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_security_groups(self): api_version = self._get_api_version("network_security_groups") @@ -399,7 +399,7 @@ def network_security_groups(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def public_ip_addresses(self): api_version = self._get_api_version("public_ip_addresses") @@ -413,7 +413,7 @@ def public_ip_addresses(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_tables(self): api_version = self._get_api_version("route_tables") @@ -427,7 +427,7 @@ def route_tables(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def routes(self): api_version = self._get_api_version("routes") @@ -441,7 +441,7 @@ def routes(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_rules(self): api_version = self._get_api_version("security_rules") @@ -455,7 +455,7 @@ def security_rules(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def subnets(self): api_version = self._get_api_version("subnets") @@ -469,7 +469,7 @@ def subnets(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def usages(self): api_version = self._get_api_version("usages") @@ -483,7 +483,7 @@ def usages(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateway_connections(self): api_version = self._get_api_version("virtual_network_gateway_connections") @@ -497,7 +497,7 @@ def virtual_network_gateway_connections(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateways(self): api_version = self._get_api_version("virtual_network_gateways") @@ -511,7 +511,7 @@ def virtual_network_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_networks(self): api_version = self._get_api_version("virtual_networks") @@ -525,7 +525,7 @@ def virtual_networks(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_security_groups(self): api_version = self._get_api_version("application_security_groups") @@ -539,7 +539,7 @@ def application_security_groups(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_endpoint_services(self): api_version = self._get_api_version("available_endpoint_services") @@ -553,7 +553,7 @@ def available_endpoint_services(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def bgp_service_communities(self): api_version = self._get_api_version("bgp_service_communities") @@ -567,7 +567,7 @@ def bgp_service_communities(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def connection_monitors(self): api_version = self._get_api_version("connection_monitors") @@ -581,7 +581,7 @@ def connection_monitors(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def default_security_rules(self): api_version = self._get_api_version("default_security_rules") @@ -595,7 +595,7 @@ def default_security_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def inbound_nat_rules(self): api_version = self._get_api_version("inbound_nat_rules") @@ -609,7 +609,7 @@ def inbound_nat_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_backend_address_pools(self): api_version = self._get_api_version("load_balancer_backend_address_pools") @@ -623,7 +623,7 @@ def load_balancer_backend_address_pools(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_frontend_ip_configurations(self): api_version = self._get_api_version("load_balancer_frontend_ip_configurations") @@ -637,7 +637,7 @@ def load_balancer_frontend_ip_configurations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_load_balancing_rules(self): api_version = self._get_api_version("load_balancer_load_balancing_rules") @@ -651,7 +651,7 @@ def load_balancer_load_balancing_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_network_interfaces(self): api_version = self._get_api_version("load_balancer_network_interfaces") @@ -665,7 +665,7 @@ def load_balancer_network_interfaces(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_probes(self): api_version = self._get_api_version("load_balancer_probes") @@ -679,7 +679,7 @@ def load_balancer_probes(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_ip_configurations(self): api_version = self._get_api_version("network_interface_ip_configurations") @@ -693,7 +693,7 @@ def network_interface_ip_configurations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_load_balancers(self): api_version = self._get_api_version("network_interface_load_balancers") @@ -707,7 +707,7 @@ def network_interface_load_balancers(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_watchers(self): api_version = self._get_api_version("network_watchers") @@ -721,7 +721,7 @@ def network_watchers(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def operations(self): api_version = self._get_api_version("operations") @@ -735,7 +735,7 @@ def operations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def packet_captures(self): api_version = self._get_api_version("packet_captures") @@ -749,7 +749,7 @@ def packet_captures(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_filter_rules(self): api_version = self._get_api_version("route_filter_rules") @@ -763,7 +763,7 @@ def route_filter_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_filters(self): api_version = self._get_api_version("route_filters") @@ -777,7 +777,7 @@ def route_filters(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_peerings(self): api_version = self._get_api_version("virtual_network_peerings") @@ -791,7 +791,7 @@ def virtual_network_peerings(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def azure_firewalls(self): api_version = self._get_api_version("azure_firewalls") @@ -805,7 +805,7 @@ def azure_firewalls(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ddos_protection_plans(self): api_version = self._get_api_version("ddos_protection_plans") @@ -819,7 +819,7 @@ def ddos_protection_plans(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_connections(self): api_version = self._get_api_version("express_route_circuit_connections") @@ -833,7 +833,7 @@ def express_route_circuit_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_cross_connection_peerings(self): api_version = self._get_api_version("express_route_cross_connection_peerings") @@ -847,7 +847,7 @@ def express_route_cross_connection_peerings(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_cross_connections(self): api_version = self._get_api_version("express_route_cross_connections") @@ -861,7 +861,7 @@ def express_route_cross_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def hub_virtual_network_connections(self): api_version = self._get_api_version("hub_virtual_network_connections") @@ -875,7 +875,7 @@ def hub_virtual_network_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hubs(self): api_version = self._get_api_version("virtual_hubs") @@ -889,7 +889,7 @@ def virtual_hubs(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_wans(self): api_version = self._get_api_version("virtual_wans") @@ -903,7 +903,7 @@ def virtual_wans(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_connections(self): api_version = self._get_api_version("vpn_connections") @@ -917,7 +917,7 @@ def vpn_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_gateways(self): api_version = self._get_api_version("vpn_gateways") @@ -931,7 +931,7 @@ def vpn_gateways(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_sites_configuration(self): api_version = self._get_api_version("vpn_sites_configuration") @@ -945,7 +945,7 @@ def vpn_sites_configuration(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_sites(self): api_version = self._get_api_version("vpn_sites") @@ -959,7 +959,7 @@ def vpn_sites(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_delegations(self): api_version = self._get_api_version("available_delegations") @@ -973,7 +973,7 @@ def available_delegations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_resource_group_delegations(self): api_version = self._get_api_version("available_resource_group_delegations") @@ -987,7 +987,7 @@ def available_resource_group_delegations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def azure_firewall_fqdn_tags(self): api_version = self._get_api_version("azure_firewall_fqdn_tags") @@ -1001,7 +1001,7 @@ def azure_firewall_fqdn_tags(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ddos_custom_policies(self): api_version = self._get_api_version("ddos_custom_policies") @@ -1015,7 +1015,7 @@ def ddos_custom_policies(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_connections(self): api_version = self._get_api_version("express_route_connections") @@ -1029,7 +1029,7 @@ def express_route_connections(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_gateways(self): api_version = self._get_api_version("express_route_gateways") @@ -1043,7 +1043,7 @@ def express_route_gateways(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_links(self): api_version = self._get_api_version("express_route_links") @@ -1057,7 +1057,7 @@ def express_route_links(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_ports_locations(self): api_version = self._get_api_version("express_route_ports_locations") @@ -1071,7 +1071,7 @@ def express_route_ports_locations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_ports(self): api_version = self._get_api_version("express_route_ports") @@ -1099,7 +1099,7 @@ def interface_endpoints(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_outbound_rules(self): api_version = self._get_api_version("load_balancer_outbound_rules") @@ -1113,7 +1113,7 @@ def load_balancer_outbound_rules(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_tap_configurations(self): api_version = self._get_api_version("network_interface_tap_configurations") @@ -1127,7 +1127,7 @@ def network_interface_tap_configurations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_profiles(self): api_version = self._get_api_version("network_profiles") @@ -1141,7 +1141,7 @@ def network_profiles(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def p2_svpn_gateways(self): api_version = self._get_api_version("p2_svpn_gateways") @@ -1169,7 +1169,7 @@ def p2_svpn_server_configurations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def public_ip_prefixes(self): api_version = self._get_api_version("public_ip_prefixes") @@ -1183,7 +1183,7 @@ def public_ip_prefixes(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_endpoint_policies(self): api_version = self._get_api_version("service_endpoint_policies") @@ -1197,7 +1197,7 @@ def service_endpoint_policies(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_endpoint_policy_definitions(self): api_version = self._get_api_version("service_endpoint_policy_definitions") @@ -1211,7 +1211,7 @@ def service_endpoint_policy_definitions(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_taps(self): api_version = self._get_api_version("virtual_network_taps") @@ -1225,7 +1225,7 @@ def virtual_network_taps(self): @property @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def peer_express_route_circuit_connections(self): api_version = self._get_api_version("peer_express_route_circuit_connections") @@ -1239,7 +1239,7 @@ def peer_express_route_circuit_connections(self): @property @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def web_application_firewall_policies(self): api_version = self._get_api_version("web_application_firewall_policies") @@ -1253,7 +1253,7 @@ def web_application_firewall_policies(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def nat_gateways(self): api_version = self._get_api_version("nat_gateways") @@ -1267,7 +1267,7 @@ def nat_gateways(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def resource_navigation_links(self): api_version = self._get_api_version("resource_navigation_links") @@ -1281,7 +1281,7 @@ def resource_navigation_links(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_association_links(self): api_version = self._get_api_version("service_association_links") @@ -1295,7 +1295,7 @@ def service_association_links(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_private_endpoint_types(self): api_version = self._get_api_version("available_private_endpoint_types") @@ -1309,7 +1309,7 @@ def available_private_endpoint_types(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def bastion_hosts(self): api_version = self._get_api_version("bastion_hosts") @@ -1323,7 +1323,7 @@ def bastion_hosts(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_endpoints(self): api_version = self._get_api_version("private_endpoints") @@ -1337,7 +1337,7 @@ def private_endpoints(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_link_services(self): api_version = self._get_api_version("private_link_services") @@ -1351,7 +1351,7 @@ def private_link_services(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_tags(self): api_version = self._get_api_version("service_tags") @@ -1365,7 +1365,7 @@ def service_tags(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policies(self): api_version = self._get_api_version("firewall_policies") @@ -1393,7 +1393,7 @@ def firewall_policy_rule_groups(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_link_connections(self): api_version = self._get_api_version("vpn_link_connections") @@ -1407,7 +1407,7 @@ def vpn_link_connections(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_site_link_connections(self): api_version = self._get_api_version("vpn_site_link_connections") @@ -1421,7 +1421,7 @@ def vpn_site_link_connections(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_site_links(self): api_version = self._get_api_version("vpn_site_links") @@ -1435,7 +1435,7 @@ def vpn_site_links(self): @property @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_router_peerings(self): api_version = self._get_api_version("virtual_router_peerings") @@ -1449,7 +1449,7 @@ def virtual_router_peerings(self): @property @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_routers(self): api_version = self._get_api_version("virtual_routers") @@ -1463,7 +1463,7 @@ def virtual_routers(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_service_aliases(self): api_version = self._get_api_version("available_service_aliases") @@ -1477,7 +1477,7 @@ def available_service_aliases(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_server_configurations_associated_with_virtual_wan(self): api_version = self._get_api_version("vpn_server_configurations_associated_with_virtual_wan") @@ -1491,7 +1491,7 @@ def vpn_server_configurations_associated_with_virtual_wan(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_server_configurations(self): api_version = self._get_api_version("vpn_server_configurations") @@ -1505,7 +1505,7 @@ def vpn_server_configurations(self): @property @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ip_groups(self): api_version = self._get_api_version("ip_groups") @@ -1519,7 +1519,7 @@ def ip_groups(self): @property @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_route_table_v2_s(self): api_version = self._get_api_version("virtual_hub_route_table_v2_s") @@ -1533,7 +1533,7 @@ def virtual_hub_route_table_v2_s(self): @property @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def flow_logs(self): api_version = self._get_api_version("flow_logs") @@ -1547,7 +1547,7 @@ def flow_logs(self): @property @api_version_validation( - method_valid_on=['2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_virtual_appliances(self): api_version = self._get_api_version("network_virtual_appliances") @@ -1561,7 +1561,7 @@ def network_virtual_appliances(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ip_allocations(self): api_version = self._get_api_version("ip_allocations") @@ -1575,7 +1575,7 @@ def ip_allocations(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_dns_zone_groups(self): api_version = self._get_api_version("private_dns_zone_groups") @@ -1589,7 +1589,7 @@ def private_dns_zone_groups(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_partner_providers(self): api_version = self._get_api_version("security_partner_providers") @@ -1603,7 +1603,7 @@ def security_partner_providers(self): @property @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def hub_route_tables(self): api_version = self._get_api_version("hub_route_tables") @@ -1617,7 +1617,7 @@ def hub_route_tables(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_private_endpoint_connections(self): api_version = self._get_api_version("application_gateway_private_endpoint_connections") @@ -1631,7 +1631,7 @@ def application_gateway_private_endpoint_connections(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_private_link_resources(self): api_version = self._get_api_version("application_gateway_private_link_resources") @@ -1645,7 +1645,7 @@ def application_gateway_private_link_resources(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_rule_collection_groups(self): api_version = self._get_api_version("firewall_policy_rule_collection_groups") @@ -1659,7 +1659,7 @@ def firewall_policy_rule_collection_groups(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_appliance_sites(self): api_version = self._get_api_version("virtual_appliance_sites") @@ -1673,7 +1673,7 @@ def virtual_appliance_sites(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_appliance_skus(self): api_version = self._get_api_version("virtual_appliance_skus") @@ -1687,7 +1687,7 @@ def virtual_appliance_skus(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_bgp_connection(self): api_version = self._get_api_version("virtual_hub_bgp_connection") @@ -1701,7 +1701,7 @@ def virtual_hub_bgp_connection(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_bgp_connections(self): api_version = self._get_api_version("virtual_hub_bgp_connections") @@ -1715,7 +1715,7 @@ def virtual_hub_bgp_connections(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_ip_configuration(self): api_version = self._get_api_version("virtual_hub_ip_configuration") @@ -1729,7 +1729,7 @@ def virtual_hub_ip_configuration(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def custom_ip_prefixes(self): api_version = self._get_api_version("custom_ip_prefixes") @@ -1743,7 +1743,7 @@ def custom_ip_prefixes(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def dscp_configuration(self): api_version = self._get_api_version("dscp_configuration") @@ -1757,7 +1757,7 @@ def dscp_configuration(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def inbound_security_rule(self): api_version = self._get_api_version("inbound_security_rule") @@ -1771,7 +1771,7 @@ def inbound_security_rule(self): @property @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def web_categories(self): api_version = self._get_api_version("web_categories") @@ -1785,7 +1785,7 @@ def web_categories(self): @property @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def nat_rules(self): api_version = self._get_api_version("nat_rules") @@ -1799,7 +1799,7 @@ def nat_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateway_nat_rules(self): api_version = self._get_api_version("virtual_network_gateway_nat_rules") @@ -1855,7 +1855,7 @@ def active_security_user_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def admin_rule_collections(self): api_version = self._get_api_version("admin_rule_collections") @@ -1869,7 +1869,7 @@ def admin_rule_collections(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def admin_rules(self): api_version = self._get_api_version("admin_rules") @@ -1883,7 +1883,7 @@ def admin_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def connectivity_configurations(self): api_version = self._get_api_version("connectivity_configurations") @@ -1925,7 +1925,7 @@ def effective_virtual_networks(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_groups(self): api_version = self._get_api_version("network_groups") @@ -1939,7 +1939,7 @@ def network_groups(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_manager_commits(self): api_version = self._get_api_version("network_manager_commits") @@ -1953,7 +1953,7 @@ def network_manager_commits(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_manager_deployment_status(self): api_version = self._get_api_version("network_manager_deployment_status") @@ -1981,7 +1981,7 @@ def network_manager_effective_security_admin_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_managers(self): api_version = self._get_api_version("network_managers") @@ -2121,7 +2121,7 @@ def perimeter_associable_resource_types(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_admin_configurations(self): api_version = self._get_api_version("security_admin_configurations") @@ -2177,7 +2177,7 @@ def user_rules(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_waf_dynamic_manifests_default(self): api_version = self._get_api_version("application_gateway_waf_dynamic_manifests_default") @@ -2191,7 +2191,7 @@ def application_gateway_waf_dynamic_manifests_default(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_waf_dynamic_manifests(self): api_version = self._get_api_version("application_gateway_waf_dynamic_manifests") @@ -2205,7 +2205,7 @@ def application_gateway_waf_dynamic_manifests(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def configuration_policy_groups(self): api_version = self._get_api_version("configuration_policy_groups") @@ -2219,7 +2219,7 @@ def configuration_policy_groups(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_port_authorizations(self): api_version = self._get_api_version("express_route_port_authorizations") @@ -2233,7 +2233,7 @@ def express_route_port_authorizations(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_provider_ports_location(self): api_version = self._get_api_version("express_route_provider_ports_location") @@ -2247,7 +2247,7 @@ def express_route_provider_ports_location(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures_filter_values(self): api_version = self._get_api_version("firewall_policy_idps_signatures_filter_values") @@ -2261,7 +2261,7 @@ def firewall_policy_idps_signatures_filter_values(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures(self): api_version = self._get_api_version("firewall_policy_idps_signatures") @@ -2275,7 +2275,7 @@ def firewall_policy_idps_signatures(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures_overrides(self): api_version = self._get_api_version("firewall_policy_idps_signatures_overrides") @@ -2289,7 +2289,7 @@ def firewall_policy_idps_signatures_overrides(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def management_group_network_manager_connections(self): api_version = self._get_api_version("management_group_network_manager_connections") @@ -2303,7 +2303,7 @@ def management_group_network_manager_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_maps(self): api_version = self._get_api_version("route_maps") @@ -2317,7 +2317,7 @@ def route_maps(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def routing_intent(self): api_version = self._get_api_version("routing_intent") @@ -2331,7 +2331,7 @@ def routing_intent(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def scope_connections(self): api_version = self._get_api_version("scope_connections") @@ -2345,7 +2345,7 @@ def scope_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_tag_information(self): api_version = self._get_api_version("service_tag_information") @@ -2359,7 +2359,7 @@ def service_tag_information(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def static_members(self): api_version = self._get_api_version("static_members") @@ -2373,7 +2373,7 @@ def static_members(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def subscription_network_manager_connections(self): api_version = self._get_api_version("subscription_network_manager_connections") @@ -2387,7 +2387,7 @@ def subscription_network_manager_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vip_swap(self): api_version = self._get_api_version("vip_swap") @@ -2401,7 +2401,7 @@ def vip_swap(self): @property @api_version_validation( - method_valid_on=['2023-06-01'] + method_valid_on=['2023-06-01', '2023-09-01'] ) def network_virtual_appliance_connections(self): api_version = self._get_api_version("network_virtual_appliance_connections") diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/_version.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/_version.py index 05e4b2ec08fb..e5754a47ce68 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/_version.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "25.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/_client.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/_client.py index cd93911cea0b..70cdb67df03f 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/_client.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/_client.py @@ -213,7 +213,7 @@ class NetworkManagementClient(NetworkManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2023-06-01' + DEFAULT_API_VERSION = '2023-09-01' _PROFILE_TAG = "azure.mgmt.network.NetworkManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -273,7 +273,7 @@ def _models_dict(cls): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateways(self): api_version = self._get_api_version("application_gateways") @@ -287,7 +287,7 @@ def application_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_authorizations(self): api_version = self._get_api_version("express_route_circuit_authorizations") @@ -301,7 +301,7 @@ def express_route_circuit_authorizations(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_peerings(self): api_version = self._get_api_version("express_route_circuit_peerings") @@ -315,7 +315,7 @@ def express_route_circuit_peerings(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuits(self): api_version = self._get_api_version("express_route_circuits") @@ -329,7 +329,7 @@ def express_route_circuits(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_service_providers(self): api_version = self._get_api_version("express_route_service_providers") @@ -343,7 +343,7 @@ def express_route_service_providers(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancers(self): api_version = self._get_api_version("load_balancers") @@ -357,7 +357,7 @@ def load_balancers(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def local_network_gateways(self): api_version = self._get_api_version("local_network_gateways") @@ -371,7 +371,7 @@ def local_network_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interfaces(self): api_version = self._get_api_version("network_interfaces") @@ -385,7 +385,7 @@ def network_interfaces(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_security_groups(self): api_version = self._get_api_version("network_security_groups") @@ -399,7 +399,7 @@ def network_security_groups(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def public_ip_addresses(self): api_version = self._get_api_version("public_ip_addresses") @@ -413,7 +413,7 @@ def public_ip_addresses(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_tables(self): api_version = self._get_api_version("route_tables") @@ -427,7 +427,7 @@ def route_tables(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def routes(self): api_version = self._get_api_version("routes") @@ -441,7 +441,7 @@ def routes(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_rules(self): api_version = self._get_api_version("security_rules") @@ -455,7 +455,7 @@ def security_rules(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def subnets(self): api_version = self._get_api_version("subnets") @@ -469,7 +469,7 @@ def subnets(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def usages(self): api_version = self._get_api_version("usages") @@ -483,7 +483,7 @@ def usages(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateway_connections(self): api_version = self._get_api_version("virtual_network_gateway_connections") @@ -497,7 +497,7 @@ def virtual_network_gateway_connections(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateways(self): api_version = self._get_api_version("virtual_network_gateways") @@ -511,7 +511,7 @@ def virtual_network_gateways(self): @property @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_networks(self): api_version = self._get_api_version("virtual_networks") @@ -525,7 +525,7 @@ def virtual_networks(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_security_groups(self): api_version = self._get_api_version("application_security_groups") @@ -539,7 +539,7 @@ def application_security_groups(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_endpoint_services(self): api_version = self._get_api_version("available_endpoint_services") @@ -553,7 +553,7 @@ def available_endpoint_services(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def bgp_service_communities(self): api_version = self._get_api_version("bgp_service_communities") @@ -567,7 +567,7 @@ def bgp_service_communities(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def connection_monitors(self): api_version = self._get_api_version("connection_monitors") @@ -581,7 +581,7 @@ def connection_monitors(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def default_security_rules(self): api_version = self._get_api_version("default_security_rules") @@ -595,7 +595,7 @@ def default_security_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def inbound_nat_rules(self): api_version = self._get_api_version("inbound_nat_rules") @@ -609,7 +609,7 @@ def inbound_nat_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_backend_address_pools(self): api_version = self._get_api_version("load_balancer_backend_address_pools") @@ -623,7 +623,7 @@ def load_balancer_backend_address_pools(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_frontend_ip_configurations(self): api_version = self._get_api_version("load_balancer_frontend_ip_configurations") @@ -637,7 +637,7 @@ def load_balancer_frontend_ip_configurations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_load_balancing_rules(self): api_version = self._get_api_version("load_balancer_load_balancing_rules") @@ -651,7 +651,7 @@ def load_balancer_load_balancing_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_network_interfaces(self): api_version = self._get_api_version("load_balancer_network_interfaces") @@ -665,7 +665,7 @@ def load_balancer_network_interfaces(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_probes(self): api_version = self._get_api_version("load_balancer_probes") @@ -679,7 +679,7 @@ def load_balancer_probes(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_ip_configurations(self): api_version = self._get_api_version("network_interface_ip_configurations") @@ -693,7 +693,7 @@ def network_interface_ip_configurations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_load_balancers(self): api_version = self._get_api_version("network_interface_load_balancers") @@ -707,7 +707,7 @@ def network_interface_load_balancers(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_watchers(self): api_version = self._get_api_version("network_watchers") @@ -721,7 +721,7 @@ def network_watchers(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def operations(self): api_version = self._get_api_version("operations") @@ -735,7 +735,7 @@ def operations(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def packet_captures(self): api_version = self._get_api_version("packet_captures") @@ -749,7 +749,7 @@ def packet_captures(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_filter_rules(self): api_version = self._get_api_version("route_filter_rules") @@ -763,7 +763,7 @@ def route_filter_rules(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_filters(self): api_version = self._get_api_version("route_filters") @@ -777,7 +777,7 @@ def route_filters(self): @property @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_peerings(self): api_version = self._get_api_version("virtual_network_peerings") @@ -791,7 +791,7 @@ def virtual_network_peerings(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def azure_firewalls(self): api_version = self._get_api_version("azure_firewalls") @@ -805,7 +805,7 @@ def azure_firewalls(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ddos_protection_plans(self): api_version = self._get_api_version("ddos_protection_plans") @@ -819,7 +819,7 @@ def ddos_protection_plans(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_circuit_connections(self): api_version = self._get_api_version("express_route_circuit_connections") @@ -833,7 +833,7 @@ def express_route_circuit_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_cross_connection_peerings(self): api_version = self._get_api_version("express_route_cross_connection_peerings") @@ -847,7 +847,7 @@ def express_route_cross_connection_peerings(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_cross_connections(self): api_version = self._get_api_version("express_route_cross_connections") @@ -861,7 +861,7 @@ def express_route_cross_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def hub_virtual_network_connections(self): api_version = self._get_api_version("hub_virtual_network_connections") @@ -875,7 +875,7 @@ def hub_virtual_network_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hubs(self): api_version = self._get_api_version("virtual_hubs") @@ -889,7 +889,7 @@ def virtual_hubs(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_wans(self): api_version = self._get_api_version("virtual_wans") @@ -903,7 +903,7 @@ def virtual_wans(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_connections(self): api_version = self._get_api_version("vpn_connections") @@ -917,7 +917,7 @@ def vpn_connections(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_gateways(self): api_version = self._get_api_version("vpn_gateways") @@ -931,7 +931,7 @@ def vpn_gateways(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_sites_configuration(self): api_version = self._get_api_version("vpn_sites_configuration") @@ -945,7 +945,7 @@ def vpn_sites_configuration(self): @property @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_sites(self): api_version = self._get_api_version("vpn_sites") @@ -959,7 +959,7 @@ def vpn_sites(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_delegations(self): api_version = self._get_api_version("available_delegations") @@ -973,7 +973,7 @@ def available_delegations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_resource_group_delegations(self): api_version = self._get_api_version("available_resource_group_delegations") @@ -987,7 +987,7 @@ def available_resource_group_delegations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def azure_firewall_fqdn_tags(self): api_version = self._get_api_version("azure_firewall_fqdn_tags") @@ -1001,7 +1001,7 @@ def azure_firewall_fqdn_tags(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ddos_custom_policies(self): api_version = self._get_api_version("ddos_custom_policies") @@ -1015,7 +1015,7 @@ def ddos_custom_policies(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_connections(self): api_version = self._get_api_version("express_route_connections") @@ -1029,7 +1029,7 @@ def express_route_connections(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_gateways(self): api_version = self._get_api_version("express_route_gateways") @@ -1043,7 +1043,7 @@ def express_route_gateways(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_links(self): api_version = self._get_api_version("express_route_links") @@ -1057,7 +1057,7 @@ def express_route_links(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_ports_locations(self): api_version = self._get_api_version("express_route_ports_locations") @@ -1071,7 +1071,7 @@ def express_route_ports_locations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_ports(self): api_version = self._get_api_version("express_route_ports") @@ -1099,7 +1099,7 @@ def interface_endpoints(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def load_balancer_outbound_rules(self): api_version = self._get_api_version("load_balancer_outbound_rules") @@ -1113,7 +1113,7 @@ def load_balancer_outbound_rules(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_interface_tap_configurations(self): api_version = self._get_api_version("network_interface_tap_configurations") @@ -1127,7 +1127,7 @@ def network_interface_tap_configurations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_profiles(self): api_version = self._get_api_version("network_profiles") @@ -1141,7 +1141,7 @@ def network_profiles(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def p2_svpn_gateways(self): api_version = self._get_api_version("p2_svpn_gateways") @@ -1169,7 +1169,7 @@ def p2_svpn_server_configurations(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def public_ip_prefixes(self): api_version = self._get_api_version("public_ip_prefixes") @@ -1183,7 +1183,7 @@ def public_ip_prefixes(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_endpoint_policies(self): api_version = self._get_api_version("service_endpoint_policies") @@ -1197,7 +1197,7 @@ def service_endpoint_policies(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_endpoint_policy_definitions(self): api_version = self._get_api_version("service_endpoint_policy_definitions") @@ -1211,7 +1211,7 @@ def service_endpoint_policy_definitions(self): @property @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_taps(self): api_version = self._get_api_version("virtual_network_taps") @@ -1225,7 +1225,7 @@ def virtual_network_taps(self): @property @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def peer_express_route_circuit_connections(self): api_version = self._get_api_version("peer_express_route_circuit_connections") @@ -1239,7 +1239,7 @@ def peer_express_route_circuit_connections(self): @property @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def web_application_firewall_policies(self): api_version = self._get_api_version("web_application_firewall_policies") @@ -1253,7 +1253,7 @@ def web_application_firewall_policies(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def nat_gateways(self): api_version = self._get_api_version("nat_gateways") @@ -1267,7 +1267,7 @@ def nat_gateways(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def resource_navigation_links(self): api_version = self._get_api_version("resource_navigation_links") @@ -1281,7 +1281,7 @@ def resource_navigation_links(self): @property @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_association_links(self): api_version = self._get_api_version("service_association_links") @@ -1295,7 +1295,7 @@ def service_association_links(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_private_endpoint_types(self): api_version = self._get_api_version("available_private_endpoint_types") @@ -1309,7 +1309,7 @@ def available_private_endpoint_types(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def bastion_hosts(self): api_version = self._get_api_version("bastion_hosts") @@ -1323,7 +1323,7 @@ def bastion_hosts(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_endpoints(self): api_version = self._get_api_version("private_endpoints") @@ -1337,7 +1337,7 @@ def private_endpoints(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_link_services(self): api_version = self._get_api_version("private_link_services") @@ -1351,7 +1351,7 @@ def private_link_services(self): @property @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_tags(self): api_version = self._get_api_version("service_tags") @@ -1365,7 +1365,7 @@ def service_tags(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policies(self): api_version = self._get_api_version("firewall_policies") @@ -1393,7 +1393,7 @@ def firewall_policy_rule_groups(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_link_connections(self): api_version = self._get_api_version("vpn_link_connections") @@ -1407,7 +1407,7 @@ def vpn_link_connections(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_site_link_connections(self): api_version = self._get_api_version("vpn_site_link_connections") @@ -1421,7 +1421,7 @@ def vpn_site_link_connections(self): @property @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_site_links(self): api_version = self._get_api_version("vpn_site_links") @@ -1435,7 +1435,7 @@ def vpn_site_links(self): @property @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_router_peerings(self): api_version = self._get_api_version("virtual_router_peerings") @@ -1449,7 +1449,7 @@ def virtual_router_peerings(self): @property @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_routers(self): api_version = self._get_api_version("virtual_routers") @@ -1463,7 +1463,7 @@ def virtual_routers(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def available_service_aliases(self): api_version = self._get_api_version("available_service_aliases") @@ -1477,7 +1477,7 @@ def available_service_aliases(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_server_configurations_associated_with_virtual_wan(self): api_version = self._get_api_version("vpn_server_configurations_associated_with_virtual_wan") @@ -1491,7 +1491,7 @@ def vpn_server_configurations_associated_with_virtual_wan(self): @property @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vpn_server_configurations(self): api_version = self._get_api_version("vpn_server_configurations") @@ -1505,7 +1505,7 @@ def vpn_server_configurations(self): @property @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ip_groups(self): api_version = self._get_api_version("ip_groups") @@ -1519,7 +1519,7 @@ def ip_groups(self): @property @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_route_table_v2_s(self): api_version = self._get_api_version("virtual_hub_route_table_v2_s") @@ -1533,7 +1533,7 @@ def virtual_hub_route_table_v2_s(self): @property @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def flow_logs(self): api_version = self._get_api_version("flow_logs") @@ -1547,7 +1547,7 @@ def flow_logs(self): @property @api_version_validation( - method_valid_on=['2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_virtual_appliances(self): api_version = self._get_api_version("network_virtual_appliances") @@ -1561,7 +1561,7 @@ def network_virtual_appliances(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def ip_allocations(self): api_version = self._get_api_version("ip_allocations") @@ -1575,7 +1575,7 @@ def ip_allocations(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def private_dns_zone_groups(self): api_version = self._get_api_version("private_dns_zone_groups") @@ -1589,7 +1589,7 @@ def private_dns_zone_groups(self): @property @api_version_validation( - method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_partner_providers(self): api_version = self._get_api_version("security_partner_providers") @@ -1603,7 +1603,7 @@ def security_partner_providers(self): @property @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def hub_route_tables(self): api_version = self._get_api_version("hub_route_tables") @@ -1617,7 +1617,7 @@ def hub_route_tables(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_private_endpoint_connections(self): api_version = self._get_api_version("application_gateway_private_endpoint_connections") @@ -1631,7 +1631,7 @@ def application_gateway_private_endpoint_connections(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_private_link_resources(self): api_version = self._get_api_version("application_gateway_private_link_resources") @@ -1645,7 +1645,7 @@ def application_gateway_private_link_resources(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_rule_collection_groups(self): api_version = self._get_api_version("firewall_policy_rule_collection_groups") @@ -1659,7 +1659,7 @@ def firewall_policy_rule_collection_groups(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_appliance_sites(self): api_version = self._get_api_version("virtual_appliance_sites") @@ -1673,7 +1673,7 @@ def virtual_appliance_sites(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_appliance_skus(self): api_version = self._get_api_version("virtual_appliance_skus") @@ -1687,7 +1687,7 @@ def virtual_appliance_skus(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_bgp_connection(self): api_version = self._get_api_version("virtual_hub_bgp_connection") @@ -1701,7 +1701,7 @@ def virtual_hub_bgp_connection(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_bgp_connections(self): api_version = self._get_api_version("virtual_hub_bgp_connections") @@ -1715,7 +1715,7 @@ def virtual_hub_bgp_connections(self): @property @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_hub_ip_configuration(self): api_version = self._get_api_version("virtual_hub_ip_configuration") @@ -1729,7 +1729,7 @@ def virtual_hub_ip_configuration(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def custom_ip_prefixes(self): api_version = self._get_api_version("custom_ip_prefixes") @@ -1743,7 +1743,7 @@ def custom_ip_prefixes(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def dscp_configuration(self): api_version = self._get_api_version("dscp_configuration") @@ -1757,7 +1757,7 @@ def dscp_configuration(self): @property @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def inbound_security_rule(self): api_version = self._get_api_version("inbound_security_rule") @@ -1771,7 +1771,7 @@ def inbound_security_rule(self): @property @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def web_categories(self): api_version = self._get_api_version("web_categories") @@ -1785,7 +1785,7 @@ def web_categories(self): @property @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def nat_rules(self): api_version = self._get_api_version("nat_rules") @@ -1799,7 +1799,7 @@ def nat_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def virtual_network_gateway_nat_rules(self): api_version = self._get_api_version("virtual_network_gateway_nat_rules") @@ -1855,7 +1855,7 @@ def active_security_user_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def admin_rule_collections(self): api_version = self._get_api_version("admin_rule_collections") @@ -1869,7 +1869,7 @@ def admin_rule_collections(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def admin_rules(self): api_version = self._get_api_version("admin_rules") @@ -1883,7 +1883,7 @@ def admin_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def connectivity_configurations(self): api_version = self._get_api_version("connectivity_configurations") @@ -1925,7 +1925,7 @@ def effective_virtual_networks(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_groups(self): api_version = self._get_api_version("network_groups") @@ -1939,7 +1939,7 @@ def network_groups(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_manager_commits(self): api_version = self._get_api_version("network_manager_commits") @@ -1953,7 +1953,7 @@ def network_manager_commits(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_manager_deployment_status(self): api_version = self._get_api_version("network_manager_deployment_status") @@ -1981,7 +1981,7 @@ def network_manager_effective_security_admin_rules(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def network_managers(self): api_version = self._get_api_version("network_managers") @@ -2121,7 +2121,7 @@ def perimeter_associable_resource_types(self): @property @api_version_validation( - method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2021-02-01-preview', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def security_admin_configurations(self): api_version = self._get_api_version("security_admin_configurations") @@ -2177,7 +2177,7 @@ def user_rules(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_waf_dynamic_manifests_default(self): api_version = self._get_api_version("application_gateway_waf_dynamic_manifests_default") @@ -2191,7 +2191,7 @@ def application_gateway_waf_dynamic_manifests_default(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def application_gateway_waf_dynamic_manifests(self): api_version = self._get_api_version("application_gateway_waf_dynamic_manifests") @@ -2205,7 +2205,7 @@ def application_gateway_waf_dynamic_manifests(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def configuration_policy_groups(self): api_version = self._get_api_version("configuration_policy_groups") @@ -2219,7 +2219,7 @@ def configuration_policy_groups(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_port_authorizations(self): api_version = self._get_api_version("express_route_port_authorizations") @@ -2233,7 +2233,7 @@ def express_route_port_authorizations(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def express_route_provider_ports_location(self): api_version = self._get_api_version("express_route_provider_ports_location") @@ -2247,7 +2247,7 @@ def express_route_provider_ports_location(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures_filter_values(self): api_version = self._get_api_version("firewall_policy_idps_signatures_filter_values") @@ -2261,7 +2261,7 @@ def firewall_policy_idps_signatures_filter_values(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures(self): api_version = self._get_api_version("firewall_policy_idps_signatures") @@ -2275,7 +2275,7 @@ def firewall_policy_idps_signatures(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def firewall_policy_idps_signatures_overrides(self): api_version = self._get_api_version("firewall_policy_idps_signatures_overrides") @@ -2289,7 +2289,7 @@ def firewall_policy_idps_signatures_overrides(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def management_group_network_manager_connections(self): api_version = self._get_api_version("management_group_network_manager_connections") @@ -2303,7 +2303,7 @@ def management_group_network_manager_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def route_maps(self): api_version = self._get_api_version("route_maps") @@ -2317,7 +2317,7 @@ def route_maps(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def routing_intent(self): api_version = self._get_api_version("routing_intent") @@ -2331,7 +2331,7 @@ def routing_intent(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def scope_connections(self): api_version = self._get_api_version("scope_connections") @@ -2345,7 +2345,7 @@ def scope_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def service_tag_information(self): api_version = self._get_api_version("service_tag_information") @@ -2359,7 +2359,7 @@ def service_tag_information(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def static_members(self): api_version = self._get_api_version("static_members") @@ -2373,7 +2373,7 @@ def static_members(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def subscription_network_manager_connections(self): api_version = self._get_api_version("subscription_network_manager_connections") @@ -2387,7 +2387,7 @@ def subscription_network_manager_connections(self): @property @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'] + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'] ) def vip_swap(self): api_version = self._get_api_version("vip_swap") @@ -2401,7 +2401,7 @@ def vip_swap(self): @property @api_version_validation( - method_valid_on=['2023-06-01'] + method_valid_on=['2023-06-01', '2023-09-01'] ) def network_virtual_appliance_connections(self): api_version = self._get_api_version("network_virtual_appliance_connections") diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py index 3c27ce31d19c..83dd60129848 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/aio/operations/_operations.py @@ -823,7 +823,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) @@ -888,7 +888,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_delete_request( @@ -933,7 +933,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_start_request( @@ -978,7 +978,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_stop_request( @@ -1046,7 +1046,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1117,7 +1117,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -1182,7 +1182,7 @@ async def begin_start( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -1247,7 +1247,7 @@ async def begin_stop( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -1313,7 +1313,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) request = build_application_gateways_get_request( @@ -1363,7 +1363,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -1434,7 +1434,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationGateway"] _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -1505,7 +1505,7 @@ async def _backend_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ApplicationGatewayBackendHealth]] = kwargs.pop("cls", None) request = build_application_gateways_backend_health_request( @@ -1609,7 +1609,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_backend_health( @@ -1641,7 +1641,7 @@ async def begin_backend_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayBackendHealth] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1768,7 +1768,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_ssl_predefined_policy( @@ -1794,7 +1794,7 @@ async def get_ssl_predefined_policy( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewaySslPredefinedPolicy] = kwargs.pop("cls", None) request = build_application_gateways_get_ssl_predefined_policy_request( @@ -1829,7 +1829,7 @@ async def get_ssl_predefined_policy( get_ssl_predefined_policy.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableSslOptions: @@ -1851,7 +1851,7 @@ async def list_available_ssl_options(self, **kwargs: Any) -> _models.Application _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableSslOptions] = kwargs.pop("cls", None) request = build_application_gateways_list_available_ssl_options_request( @@ -1885,7 +1885,7 @@ async def list_available_ssl_options(self, **kwargs: Any) -> _models.Application list_available_ssl_options.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_ssl_predefined_policies( @@ -1903,7 +1903,7 @@ def list_available_ssl_predefined_policies( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableSslPredefinedPolicies] = kwargs.pop("cls", None) error_map = { @@ -1961,7 +1961,7 @@ async def get_next(next_link=None): list_available_ssl_predefined_policies.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableWafRuleSetsResult: @@ -1983,7 +1983,7 @@ async def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.Applicati _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableWafRuleSetsResult] = kwargs.pop("cls", None) request = build_application_gateways_list_available_waf_rule_sets_request( @@ -2017,7 +2017,7 @@ async def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.Applicati list_available_waf_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_available_request_headers(self, **kwargs: Any) -> List[str]: @@ -2039,7 +2039,7 @@ async def list_available_request_headers(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_request_headers_request( @@ -2074,7 +2074,7 @@ async def list_available_request_headers(self, **kwargs: Any) -> List[str]: list_available_request_headers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_available_response_headers(self, **kwargs: Any) -> List[str]: @@ -2096,7 +2096,7 @@ async def list_available_response_headers(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_response_headers_request( @@ -2131,7 +2131,7 @@ async def list_available_response_headers(self, **kwargs: Any) -> List[str]: list_available_response_headers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_available_server_variables(self, **kwargs: Any) -> List[str]: @@ -2153,7 +2153,7 @@ async def list_available_server_variables(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_server_variables_request( @@ -2207,7 +2207,7 @@ async def _backend_health_on_demand_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ApplicationGatewayBackendHealthOnDemand]] = kwargs.pop("cls", None) @@ -2258,7 +2258,7 @@ async def _backend_health_on_demand_initial( _backend_health_on_demand_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand'} @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_backend_health_on_demand( @@ -2304,7 +2304,7 @@ async def begin_backend_health_on_demand( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGatewayBackendHealthOnDemand] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2351,7 +2351,7 @@ def get_long_running_output(pipeline_response): begin_backend_health_on_demand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -2389,7 +2389,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) @@ -2475,7 +2475,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) @@ -2541,7 +2541,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_authorizations_delete_request( @@ -2615,7 +2615,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2689,7 +2689,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -2758,7 +2758,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) request = build_express_route_circuit_authorizations_get_request( @@ -2814,7 +2814,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AuthorizationListResult] = kwargs.pop("cls", None) error_map = { @@ -2912,7 +2912,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) @@ -2978,7 +2978,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_peerings_delete_request( @@ -3051,7 +3051,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -3125,7 +3125,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -3194,7 +3194,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) request = build_express_route_circuit_peerings_get_request( @@ -3250,7 +3250,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -3347,7 +3347,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) @@ -3412,7 +3412,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuits_delete_request( @@ -3480,7 +3480,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -3549,7 +3549,7 @@ async def begin_delete(self, resource_group_name: str, circuit_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -3613,7 +3613,7 @@ async def get(self, resource_group_name: str, circuit_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) request = build_express_route_circuits_get_request( @@ -3663,7 +3663,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitListResult] = kwargs.pop("cls", None) error_map = { @@ -3734,7 +3734,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteCircuit" _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitListResult] = kwargs.pop("cls", None) error_map = { @@ -4087,7 +4087,7 @@ async def _list_arp_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_arp_table_request( @@ -4140,7 +4140,7 @@ async def _list_routes_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_routes_table_request( @@ -4193,7 +4193,7 @@ async def _list_routes_table_summary_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_routes_table_summary_request( @@ -4294,7 +4294,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_arp_table( @@ -4328,7 +4328,7 @@ async def begin_list_arp_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4373,7 +4373,7 @@ def get_long_running_output(pipeline_response): begin_list_arp_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_routes_table( @@ -4407,7 +4407,7 @@ async def begin_list_routes_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4452,7 +4452,7 @@ def get_long_running_output(pipeline_response): begin_list_routes_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_routes_table_summary( @@ -4486,7 +4486,7 @@ async def begin_list_routes_table_summary( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableSummaryListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4610,7 +4610,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_peering_stats( @@ -4640,7 +4640,7 @@ async def get_peering_stats( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) request = build_express_route_circuits_get_peering_stats_request( @@ -4677,7 +4677,7 @@ async def get_peering_stats( get_peering_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_stats( @@ -4705,7 +4705,7 @@ async def get_stats( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) request = build_express_route_circuits_get_stats_request( @@ -4741,7 +4741,7 @@ async def get_stats( get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -4775,7 +4775,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) @@ -4856,7 +4856,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteServiceProvi _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteServiceProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -4951,7 +4951,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) @@ -5016,7 +5016,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_load_balancers_delete_request( @@ -5083,7 +5083,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -5154,7 +5154,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -5222,7 +5222,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) request = build_load_balancers_get_request( @@ -5273,7 +5273,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -5344,7 +5344,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.LoadBalancer"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -5549,7 +5549,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -5587,7 +5587,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) @@ -5648,7 +5648,7 @@ async def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-ret _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -5691,7 +5691,7 @@ async def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-ret _swap_public_ip_addresses_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses'} @api_version_validation( - method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_swap_public_ip_addresses( @@ -5722,7 +5722,7 @@ async def begin_swap_public_ip_addresses( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -5783,7 +5783,7 @@ async def _list_inbound_nat_rule_port_mappings_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = kwargs.pop("cls", None) @@ -5836,7 +5836,7 @@ async def _list_inbound_nat_rule_port_mappings_initial( _list_inbound_nat_rule_port_mappings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_inbound_nat_rule_port_mappings( @@ -5879,7 +5879,7 @@ async def begin_list_inbound_nat_rule_port_mappings( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -5926,7 +5926,7 @@ def get_long_running_output(pipeline_response): begin_list_inbound_nat_rule_port_mappings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping'} @api_version_validation( - method_valid_on=['2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def migrate_to_ip_based( @@ -5965,7 +5965,7 @@ async def migrate_to_ip_based( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MigratedPools] = kwargs.pop("cls", None) @@ -6053,7 +6053,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) @@ -6118,7 +6118,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_local_network_gateways_delete_request( @@ -6186,7 +6186,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -6257,7 +6257,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -6323,7 +6323,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) request = build_local_network_gateways_get_request( @@ -6373,7 +6373,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LocalNetworkGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -6580,7 +6580,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -6618,7 +6618,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) @@ -6703,7 +6703,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) @@ -6768,7 +6768,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_interfaces_delete_request( @@ -6836,7 +6836,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -6907,7 +6907,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -6975,7 +6975,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) request = build_network_interfaces_get_request( @@ -7103,7 +7103,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -7174,7 +7174,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkInterface"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -7405,7 +7405,7 @@ async def _get_effective_route_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.EffectiveRouteListResult]] = kwargs.pop("cls", None) request = build_network_interfaces_get_effective_route_table_request( @@ -7456,7 +7456,7 @@ async def _list_effective_network_security_groups_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.EffectiveNetworkSecurityGroupListResult]] = kwargs.pop("cls", None) request = build_network_interfaces_list_effective_network_security_groups_request( @@ -7559,7 +7559,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_effective_route_table( @@ -7588,7 +7588,7 @@ async def begin_get_effective_route_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EffectiveRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -7631,7 +7631,7 @@ def get_long_running_output(pipeline_response): begin_get_effective_route_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_effective_network_security_groups( @@ -7660,7 +7660,7 @@ async def begin_list_effective_network_security_groups( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EffectiveNetworkSecurityGroupListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -7786,7 +7786,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_virtual_machine_scale_set_ip_configuration( @@ -7870,7 +7870,7 @@ async def get_virtual_machine_scale_set_ip_configuration( get_virtual_machine_scale_set_ip_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_ip_configurations( @@ -7968,7 +7968,7 @@ async def get_next(next_link=None): list_virtual_machine_scale_set_ip_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -8006,7 +8006,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) @@ -8054,7 +8054,7 @@ async def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_cloud_service_network_interface( @@ -8095,7 +8095,7 @@ async def get_cloud_service_network_interface( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) request = build_network_interfaces_get_cloud_service_network_interface_request( @@ -8134,7 +8134,7 @@ async def get_cloud_service_network_interface( get_cloud_service_network_interface.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_network_interfaces( @@ -8155,7 +8155,7 @@ def list_cloud_service_network_interfaces( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -8215,7 +8215,7 @@ async def get_next(next_link=None): list_cloud_service_network_interfaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_role_instance_network_interfaces( @@ -8238,7 +8238,7 @@ def list_cloud_service_role_instance_network_interfaces( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -8336,7 +8336,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) @@ -8401,7 +8401,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_security_groups_delete_request( @@ -8469,7 +8469,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -8540,7 +8540,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -8608,7 +8608,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) request = build_network_security_groups_get_request( @@ -8660,7 +8660,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -8732,7 +8732,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkSecurityGroup _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -8938,7 +8938,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -8976,7 +8976,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) @@ -9061,7 +9061,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) @@ -9126,7 +9126,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_public_ip_addresses_delete_request( @@ -9198,7 +9198,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -9269,7 +9269,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -9337,7 +9337,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) request = build_public_ip_addresses_get_request( @@ -9388,7 +9388,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -9459,7 +9459,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.PublicIPAddress"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -9665,7 +9665,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_virtual_machine_scale_set_public_ip_address( @@ -9753,7 +9753,7 @@ async def get_virtual_machine_scale_set_public_ip_address( get_virtual_machine_scale_set_public_ip_address.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_public_ip_addresses( @@ -9834,7 +9834,7 @@ async def get_next(next_link=None): list_virtual_machine_scale_set_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_vm_public_ip_addresses( @@ -9931,7 +9931,7 @@ async def get_next(next_link=None): list_virtual_machine_scale_set_vm_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -9969,7 +9969,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) @@ -10017,7 +10017,7 @@ async def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_cloud_service_public_ip_address( @@ -10064,7 +10064,7 @@ async def get_cloud_service_public_ip_address( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) request = build_public_ip_addresses_get_cloud_service_public_ip_address_request( @@ -10105,7 +10105,7 @@ async def get_cloud_service_public_ip_address( get_cloud_service_public_ip_address.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_public_ip_addresses( @@ -10126,7 +10126,7 @@ def list_cloud_service_public_ip_addresses( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -10186,7 +10186,7 @@ async def get_next(next_link=None): list_cloud_service_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_role_instance_public_ip_addresses( @@ -10220,7 +10220,7 @@ def list_cloud_service_role_instance_public_ip_addresses( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -10296,7 +10296,7 @@ async def _ddos_protection_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.PublicIpDdosProtectionStatusResult]] = kwargs.pop("cls", None) request = build_public_ip_addresses_ddos_protection_status_request( @@ -10338,7 +10338,7 @@ async def _ddos_protection_status_initial( _ddos_protection_status_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_ddos_protection_status( @@ -10367,7 +10367,7 @@ async def begin_ddos_protection_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIpDdosProtectionStatusResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -10443,7 +10443,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) @@ -10508,7 +10508,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_tables_delete_request( @@ -10571,7 +10571,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -10642,7 +10642,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -10710,7 +10710,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) request = build_route_tables_get_request( @@ -10761,7 +10761,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTableListResult] = kwargs.pop("cls", None) error_map = { @@ -10832,7 +10832,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.RouteTable"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTableListResult] = kwargs.pop("cls", None) error_map = { @@ -11029,7 +11029,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -11063,7 +11063,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) @@ -11149,7 +11149,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Route] = kwargs.pop("cls", None) @@ -11215,7 +11215,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_routes_delete_request( @@ -11285,7 +11285,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Route] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -11359,7 +11359,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -11428,7 +11428,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Route] = kwargs.pop("cls", None) request = build_routes_get_request( @@ -11480,7 +11480,7 @@ def list(self, resource_group_name: str, route_table_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteListResult] = kwargs.pop("cls", None) error_map = { @@ -11578,7 +11578,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) @@ -11644,7 +11644,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_rules_delete_request( @@ -11715,7 +11715,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -11789,7 +11789,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -11858,7 +11858,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) request = build_security_rules_get_request( @@ -11913,7 +11913,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -12011,7 +12011,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) @@ -12077,7 +12077,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_subnets_delete_request( @@ -12148,7 +12148,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -12222,7 +12222,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -12299,7 +12299,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) request = build_subnets_get_request( @@ -12354,7 +12354,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SubnetListResult] = kwargs.pop("cls", None) error_map = { @@ -12432,7 +12432,7 @@ async def _prepare_network_policies_initial( # pylint: disable=inconsistent-ret _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -12477,7 +12477,7 @@ async def _prepare_network_policies_initial( # pylint: disable=inconsistent-ret _prepare_network_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies'} @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_prepare_network_policies( @@ -12519,7 +12519,7 @@ async def begin_prepare_network_policies( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -12582,7 +12582,7 @@ async def _unprepare_network_policies_initial( # pylint: disable=inconsistent-r _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -12629,7 +12629,7 @@ async def _unprepare_network_policies_initial( # pylint: disable=inconsistent-r _unprepare_network_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_unprepare_network_policies( @@ -12671,7 +12671,7 @@ async def begin_unprepare_network_policies( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -12749,7 +12749,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { @@ -12845,7 +12845,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) @@ -12910,7 +12910,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_delete_request( @@ -12959,7 +12959,7 @@ async def _reset_shared_key_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ConnectionResetSharedKey]] = kwargs.pop("cls", None) @@ -13026,7 +13026,7 @@ async def _set_shared_key_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) @@ -13115,7 +13115,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -13187,7 +13187,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -13268,7 +13268,7 @@ async def begin_reset_shared_key( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionResetSharedKey] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -13354,7 +13354,7 @@ async def begin_set_shared_key( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -13427,7 +13427,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_request( @@ -13490,7 +13490,7 @@ async def get_shared_key( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_shared_key_request( @@ -13542,7 +13542,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -13618,7 +13618,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualNetworkGatewayConnection]] = kwargs.pop("cls", None) @@ -13668,7 +13668,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -13708,7 +13708,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -13772,7 +13772,7 @@ async def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -13843,7 +13843,7 @@ async def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -13894,7 +13894,7 @@ async def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_start_packet_capture( @@ -13933,7 +13933,7 @@ async def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -13979,7 +13979,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_stop_packet_capture( @@ -14018,7 +14018,7 @@ async def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -14077,7 +14077,7 @@ async def _get_ike_sas_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_ike_sas_request( @@ -14116,7 +14116,7 @@ async def _get_ike_sas_initial( _get_ike_sas_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas'} @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_ike_sas( @@ -14145,7 +14145,7 @@ async def begin_get_ike_sas( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14201,7 +14201,7 @@ async def _reset_connection_initial( # pylint: disable=inconsistent-return-stat _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_reset_connection_request( @@ -14234,7 +14234,7 @@ async def _reset_connection_initial( # pylint: disable=inconsistent-return-stat _reset_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_reset_connection( @@ -14262,7 +14262,7 @@ async def begin_reset_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -14340,7 +14340,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) @@ -14405,7 +14405,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateways_delete_request( @@ -14454,7 +14454,7 @@ async def _generatevpnclientpackage_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -14522,7 +14522,7 @@ async def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_reset_request( @@ -14597,7 +14597,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -14668,7 +14668,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -14744,7 +14744,7 @@ async def begin_generatevpnclientpackage( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -14792,7 +14792,7 @@ def get_long_running_output(pipeline_response): @api_version_validation( params_valid_on={ "parameters": ['2015-06-15'], - "gateway_vip": ['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "gateway_vip": ['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -14830,7 +14830,7 @@ async def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14899,7 +14899,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_request( @@ -14950,7 +14950,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -15026,7 +15026,7 @@ async def _generate_vpn_profile_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -15089,7 +15089,7 @@ async def _get_advertised_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_advertised_routes_request( @@ -15141,7 +15141,7 @@ async def _get_bgp_peer_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.BgpPeerStatusListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_bgp_peer_status_request( @@ -15193,7 +15193,7 @@ async def _get_learned_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_learned_routes_request( @@ -15244,7 +15244,7 @@ async def _get_vpn_profile_package_url_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpn_profile_package_url_request( @@ -15299,7 +15299,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) @@ -15349,7 +15349,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_generate_vpn_profile( @@ -15387,7 +15387,7 @@ async def begin_generate_vpn_profile( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -15433,7 +15433,7 @@ def get_long_running_output(pipeline_response): begin_generate_vpn_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_advertised_routes( @@ -15465,7 +15465,7 @@ async def begin_get_advertised_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.GatewayRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15509,7 +15509,7 @@ def get_long_running_output(pipeline_response): begin_get_advertised_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_bgp_peer_status( @@ -15540,7 +15540,7 @@ async def begin_get_bgp_peer_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpPeerStatusListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15584,7 +15584,7 @@ def get_long_running_output(pipeline_response): begin_get_bgp_peer_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_learned_routes( @@ -15614,7 +15614,7 @@ async def begin_get_learned_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.GatewayRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15657,7 +15657,7 @@ def get_long_running_output(pipeline_response): begin_get_learned_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_vpn_profile_package_url( @@ -15685,7 +15685,7 @@ async def begin_get_vpn_profile_package_url( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15728,7 +15728,7 @@ def get_long_running_output(pipeline_response): begin_get_vpn_profile_package_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -15767,7 +15767,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -15814,7 +15814,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_connections( @@ -15836,7 +15836,7 @@ def list_connections( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayListConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -15896,7 +15896,7 @@ async def get_next(next_link=None): list_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def supported_vpn_devices( @@ -15924,7 +15924,7 @@ async def supported_vpn_devices( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_virtual_network_gateways_supported_vpn_devices_request( @@ -15960,7 +15960,7 @@ async def supported_vpn_devices( supported_vpn_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def vpn_device_configuration_script( @@ -15999,7 +15999,7 @@ async def vpn_device_configuration_script( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) @@ -16060,7 +16060,7 @@ async def _get_vpnclient_ipsec_parameters_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpnclient_ipsec_parameters_request( @@ -16113,7 +16113,7 @@ async def _set_vpnclient_ipsec_parameters_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnClientIPsecParameters]] = kwargs.pop("cls", None) @@ -16163,7 +16163,7 @@ async def _set_vpnclient_ipsec_parameters_initial( _set_vpnclient_ipsec_parameters_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_vpnclient_ipsec_parameters( @@ -16194,7 +16194,7 @@ async def begin_get_vpnclient_ipsec_parameters( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -16237,7 +16237,7 @@ def get_long_running_output(pipeline_response): begin_get_vpnclient_ipsec_parameters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_set_vpnclient_ipsec_parameters( @@ -16279,7 +16279,7 @@ async def begin_set_vpnclient_ipsec_parameters( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -16338,7 +16338,7 @@ async def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent- _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateways_reset_vpn_client_shared_key_request( @@ -16370,7 +16370,7 @@ async def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent- _reset_vpn_client_shared_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_reset_vpn_client_shared_key( @@ -16398,7 +16398,7 @@ async def begin_reset_vpn_client_shared_key( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -16452,7 +16452,7 @@ async def _get_vpnclient_connection_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnClientConnectionHealthDetailListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpnclient_connection_health_request( @@ -16490,7 +16490,7 @@ async def _get_vpnclient_connection_health_initial( _get_vpnclient_connection_health_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_vpnclient_connection_health( @@ -16520,7 +16520,7 @@ async def begin_get_vpnclient_connection_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientConnectionHealthDetailListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -16580,7 +16580,7 @@ async def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -16651,7 +16651,7 @@ async def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -16702,7 +16702,7 @@ async def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_start_packet_capture( @@ -16740,7 +16740,7 @@ async def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -16786,7 +16786,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_stop_packet_capture( @@ -16823,7 +16823,7 @@ async def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -16886,7 +16886,7 @@ async def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -16930,7 +16930,7 @@ async def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint _disconnect_virtual_network_gateway_vpn_connections_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections'} @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_disconnect_virtual_network_gateway_vpn_connections( @@ -16967,7 +16967,7 @@ async def begin_disconnect_virtual_network_gateway_vpn_connections( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -17048,7 +17048,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) @@ -17113,7 +17113,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_networks_delete_request( @@ -17181,7 +17181,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -17252,7 +17252,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -17320,7 +17320,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_virtual_networks_get_request( @@ -17371,7 +17371,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -17442,7 +17442,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -17648,7 +17648,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def check_ip_address_availability( @@ -17678,7 +17678,7 @@ async def check_ip_address_availability( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IPAddressAvailabilityResult] = kwargs.pop("cls", None) request = build_virtual_networks_check_ip_address_availability_request( @@ -17715,7 +17715,7 @@ async def check_ip_address_availability( check_ip_address_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_usage( @@ -17736,7 +17736,7 @@ def list_usage( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListUsageResult] = kwargs.pop("cls", None) error_map = { @@ -17796,7 +17796,7 @@ async def get_next(next_link=None): list_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -17834,7 +17834,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) @@ -17965,7 +17965,7 @@ async def _list_ddos_protection_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VirtualNetworkDdosProtectionStatusResult]] = kwargs.pop("cls", None) request = build_virtual_networks_list_ddos_protection_status_request( @@ -18005,7 +18005,7 @@ async def _list_ddos_protection_status_initial( _list_ddos_protection_status_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_ddos_protection_status( @@ -18045,7 +18045,7 @@ async def begin_list_ddos_protection_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkDdosProtectionStatusResult] = kwargs.pop("cls", None) error_map = { @@ -18184,7 +18184,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) @@ -18249,7 +18249,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_security_groups_delete_request( @@ -18317,7 +18317,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -18388,7 +18388,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -18454,7 +18454,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) request = build_application_security_groups_get_request( @@ -18505,7 +18505,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -18577,7 +18577,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationSecurityG _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -18783,7 +18783,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -18821,7 +18821,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) @@ -18904,7 +18904,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.EndpointS _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EndpointServicesListResult] = kwargs.pop("cls", None) error_map = { @@ -18995,7 +18995,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.BgpServiceCommunity"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpServiceCommunityListResult] = kwargs.pop("cls", None) error_map = { @@ -19093,7 +19093,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) @@ -19161,7 +19161,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_delete_request( @@ -19208,7 +19208,7 @@ async def _query_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) request = build_connection_monitors_query_request( @@ -19263,7 +19263,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_start_request( @@ -19310,7 +19310,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_stop_request( @@ -19345,7 +19345,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements @api_version_validation( params_valid_on={ - "migrate": ['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "migrate": ['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -19394,7 +19394,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -19470,7 +19470,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -19541,7 +19541,7 @@ async def begin_query( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19612,7 +19612,7 @@ async def begin_start( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -19681,7 +19681,7 @@ async def begin_stop( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -19751,7 +19751,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) request = build_connection_monitors_get_request( @@ -19809,7 +19809,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorListResult] = kwargs.pop("cls", None) error_map = { @@ -19870,7 +19870,7 @@ async def get_next(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -19911,7 +19911,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) @@ -20008,7 +20008,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) request = build_default_security_rules_get_request( @@ -20063,7 +20063,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -20161,7 +20161,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) @@ -20227,7 +20227,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_inbound_nat_rules_delete_request( @@ -20299,7 +20299,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -20373,7 +20373,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -20450,7 +20450,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) request = build_inbound_nat_rules_get_request( @@ -20506,7 +20506,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.InboundNatRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -20613,7 +20613,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) request = build_load_balancer_backend_address_pools_get_request( @@ -20668,7 +20668,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerBackendAddressPoolListResult] = kwargs.pop("cls", None) error_map = { @@ -20746,7 +20746,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) @@ -20812,7 +20812,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_load_balancer_backend_address_pools_delete_request( @@ -20845,7 +20845,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'} @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_create_or_update( @@ -20887,7 +20887,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -20935,7 +20935,7 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'} @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -20964,7 +20964,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -21053,7 +21053,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FrontendIPConfiguration] = kwargs.pop("cls", None) request = build_load_balancer_frontend_ip_configurations_get_request( @@ -21109,7 +21109,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerFrontendIPConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -21216,7 +21216,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancingRule] = kwargs.pop("cls", None) request = build_load_balancer_load_balancing_rules_get_request( @@ -21271,7 +21271,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerLoadBalancingRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -21369,7 +21369,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -21476,7 +21476,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Probe] = kwargs.pop("cls", None) request = build_load_balancer_probes_get_request( @@ -21528,7 +21528,7 @@ def list(self, resource_group_name: str, load_balancer_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerProbeListResult] = kwargs.pop("cls", None) error_map = { @@ -21635,7 +21635,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) request = build_network_interface_ip_configurations_get_request( @@ -21691,7 +21691,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -21789,7 +21789,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceLoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -21886,7 +21886,7 @@ async def _check_connectivity_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityInformation] = kwargs.pop("cls", None) @@ -21952,7 +21952,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_watchers_delete_request( @@ -22002,7 +22002,7 @@ async def _get_azure_reachability_report_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureReachabilityReport] = kwargs.pop("cls", None) @@ -22072,7 +22072,7 @@ async def _get_flow_log_status_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) @@ -22142,7 +22142,7 @@ async def _get_next_hop_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NextHopResult] = kwargs.pop("cls", None) @@ -22212,7 +22212,7 @@ async def _get_troubleshooting_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) @@ -22282,7 +22282,7 @@ async def _get_troubleshooting_result_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) @@ -22352,7 +22352,7 @@ async def _get_vm_security_rules_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityGroupViewResult] = kwargs.pop("cls", None) @@ -22422,7 +22422,7 @@ async def _list_available_providers_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableProvidersList] = kwargs.pop("cls", None) @@ -22492,7 +22492,7 @@ async def _set_flow_log_configuration_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) @@ -22562,7 +22562,7 @@ async def _verify_ip_flow_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VerificationIPFlowResult] = kwargs.pop("cls", None) @@ -22652,7 +22652,7 @@ async def begin_check_connectivity( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityInformation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -22722,7 +22722,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -22802,7 +22802,7 @@ async def begin_get_azure_reachability_report( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureReachabilityReport] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -22884,7 +22884,7 @@ async def begin_get_flow_log_status( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -22966,7 +22966,7 @@ async def begin_get_next_hop( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NextHopResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23048,7 +23048,7 @@ async def begin_get_troubleshooting( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23130,7 +23130,7 @@ async def begin_get_troubleshooting_result( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23212,7 +23212,7 @@ async def begin_get_vm_security_rules( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityGroupViewResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23295,7 +23295,7 @@ async def begin_list_available_providers( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableProvidersList] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23377,7 +23377,7 @@ async def begin_set_flow_log_configuration( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23459,7 +23459,7 @@ async def begin_verify_ip_flow( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VerificationIPFlowResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -23540,7 +23540,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) @@ -23616,7 +23616,7 @@ async def get(self, resource_group_name: str, network_watcher_name: str, **kwarg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) request = build_network_watchers_get_request( @@ -23688,7 +23688,7 @@ async def get_topology( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Topology] = kwargs.pop("cls", None) @@ -23751,7 +23751,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -23823,7 +23823,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkWatcher"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -23917,7 +23917,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) @@ -23983,7 +23983,7 @@ async def _get_network_configuration_diagnostic_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = kwargs.pop("cls", None) @@ -24036,7 +24036,7 @@ async def _get_network_configuration_diagnostic_initial( _get_network_configuration_diagnostic_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_network_configuration_diagnostic( @@ -24080,7 +24080,7 @@ async def begin_get_network_configuration_diagnostic( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -24158,7 +24158,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -24253,7 +24253,7 @@ async def _create_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) @@ -24316,7 +24316,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_packet_captures_delete_request( @@ -24363,7 +24363,7 @@ async def _get_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) request = build_packet_captures_get_status_request( @@ -24418,7 +24418,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_packet_captures_stop_request( @@ -24491,7 +24491,7 @@ async def begin_create( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -24565,7 +24565,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -24635,7 +24635,7 @@ async def begin_get_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -24705,7 +24705,7 @@ async def begin_stop( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -24774,7 +24774,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) request = build_packet_captures_get_request( @@ -24830,7 +24830,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureListResult] = kwargs.pop("cls", None) error_map = { @@ -24929,7 +24929,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) @@ -24995,7 +24995,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_filter_rules_delete_request( @@ -25135,7 +25135,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -25209,7 +25209,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -25366,7 +25366,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) request = build_route_filter_rules_get_request( @@ -25421,7 +25421,7 @@ def list_by_route_filter( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -25518,7 +25518,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) @@ -25583,7 +25583,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_filters_delete_request( @@ -25715,7 +25715,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -25786,7 +25786,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -25936,7 +25936,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) request = build_route_filters_get_request( @@ -25985,7 +25985,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.RouteFilter"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterListResult] = kwargs.pop("cls", None) error_map = { @@ -26057,7 +26057,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterListResult] = kwargs.pop("cls", None) error_map = { @@ -26116,7 +26116,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -26150,7 +26150,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) @@ -26238,7 +26238,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) @@ -26305,7 +26305,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_peerings_delete_request( @@ -26339,7 +26339,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @api_version_validation( params_valid_on={ - "sync_remote_address_space": ['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "sync_remote_address_space": ['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -26389,7 +26389,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -26464,7 +26464,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -26533,7 +26533,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) request = build_virtual_network_peerings_get_request( @@ -26589,7 +26589,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -26686,7 +26686,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) @@ -26751,7 +26751,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_azure_firewalls_delete_request( @@ -26819,7 +26819,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -26890,7 +26890,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -26954,7 +26954,7 @@ async def get(self, resource_group_name: str, azure_firewall_name: str, **kwargs _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) request = build_azure_firewalls_get_request( @@ -27004,7 +27004,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallListResult] = kwargs.pop("cls", None) error_map = { @@ -27075,7 +27075,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.AzureFirewall"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallListResult] = kwargs.pop("cls", None) error_map = { @@ -27236,7 +27236,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AzureFirewall]] = kwargs.pop("cls", None) @@ -27286,7 +27286,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -27325,7 +27325,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -27385,7 +27385,7 @@ async def _list_learned_prefixes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.IPPrefixesList]] = kwargs.pop("cls", None) request = build_azure_firewalls_list_learned_prefixes_request( @@ -27440,7 +27440,7 @@ async def _packet_capture_initial( # pylint: disable=inconsistent-return-statem _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -27487,7 +27487,7 @@ async def _packet_capture_initial( # pylint: disable=inconsistent-return-statem _packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_learned_prefixes( @@ -27516,7 +27516,7 @@ async def begin_list_learned_prefixes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IPPrefixesList] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -27559,7 +27559,7 @@ def get_long_running_output(pipeline_response): begin_list_learned_prefixes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_packet_capture( @@ -27596,7 +27596,7 @@ async def begin_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -27677,7 +27677,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) @@ -27742,7 +27742,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ddos_protection_plans_delete_request( @@ -27814,7 +27814,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -27885,7 +27885,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -27951,7 +27951,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) request = build_ddos_protection_plans_get_request( @@ -27999,7 +27999,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DdosProtectionPlan"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlanListResult] = kwargs.pop("cls", None) error_map = { @@ -28073,7 +28073,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlanListResult] = kwargs.pop("cls", None) error_map = { @@ -28280,7 +28280,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -28318,7 +28318,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) @@ -28405,7 +28405,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) @@ -28472,7 +28472,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_connections_delete_request( @@ -28550,7 +28550,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -28628,7 +28628,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -28700,7 +28700,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) request = build_express_route_circuit_connections_get_request( @@ -28738,7 +28738,7 @@ async def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list( @@ -28763,7 +28763,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -28862,7 +28862,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) @@ -28928,7 +28928,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_cross_connection_peerings_delete_request( @@ -29002,7 +29002,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -29076,7 +29076,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -29145,7 +29145,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) request = build_express_route_cross_connection_peerings_get_request( @@ -29201,7 +29201,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionPeeringList] = kwargs.pop("cls", None) error_map = { @@ -29298,7 +29298,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) @@ -29359,7 +29359,7 @@ async def _list_arp_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) request = build_express_route_cross_connections_list_arp_table_request( @@ -29412,7 +29412,7 @@ async def _list_routes_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) request = build_express_route_cross_connections_list_routes_table_request( @@ -29465,7 +29465,7 @@ async def _list_routes_table_summary_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]] = kwargs.pop( "cls", None ) @@ -29610,7 +29610,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -29688,7 +29688,7 @@ async def begin_list_arp_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -29764,7 +29764,7 @@ async def begin_list_routes_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -29840,7 +29840,7 @@ async def begin_list_routes_table_summary( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -29997,7 +29997,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) request = build_express_route_cross_connections_get_request( @@ -30046,7 +30046,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteCrossConnect _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -30121,7 +30121,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -30180,7 +30180,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -30218,7 +30218,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) @@ -30313,7 +30313,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) request = build_hub_virtual_network_connections_get_request( @@ -30369,7 +30369,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListHubVirtualNetworkConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -30447,7 +30447,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) @@ -30513,7 +30513,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_hub_virtual_network_connections_delete_request( @@ -30546,7 +30546,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_create_or_update( @@ -30591,7 +30591,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -30639,7 +30639,7 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -30668,7 +30668,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -30747,7 +30747,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) @@ -30812,7 +30812,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hubs_delete_request( @@ -30948,7 +30948,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -31019,7 +31019,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -31165,7 +31165,7 @@ async def get(self, resource_group_name: str, virtual_hub_name: str, **kwargs: A _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) request = build_virtual_hubs_get_request( @@ -31213,7 +31213,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualHub"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubsResult] = kwargs.pop("cls", None) error_map = { @@ -31285,7 +31285,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubsResult] = kwargs.pop("cls", None) error_map = { @@ -31344,7 +31344,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -31382,7 +31382,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) @@ -31447,7 +31447,7 @@ async def _get_effective_virtual_hub_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualHubEffectiveRouteList]] = kwargs.pop("cls", None) @@ -31500,7 +31500,7 @@ async def _get_effective_virtual_hub_routes_initial( _get_effective_virtual_hub_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_effective_virtual_hub_routes( @@ -31541,7 +31541,7 @@ async def begin_get_effective_virtual_hub_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubEffectiveRouteList] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -31604,7 +31604,7 @@ async def _get_inbound_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) @@ -31671,7 +31671,7 @@ async def _get_outbound_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) @@ -31721,7 +31721,7 @@ async def _get_outbound_routes_initial( _get_outbound_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_inbound_routes( @@ -31761,7 +31761,7 @@ async def begin_get_inbound_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.EffectiveRouteMapRouteList] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -31807,7 +31807,7 @@ def get_long_running_output(pipeline_response): begin_get_inbound_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_outbound_routes( @@ -31847,7 +31847,7 @@ async def begin_get_outbound_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.EffectiveRouteMapRouteList] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -32563,7 +32563,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) @@ -32629,7 +32629,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_connections_delete_request( @@ -32702,7 +32702,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -32776,7 +32776,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -32845,7 +32845,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) request = build_vpn_connections_get_request( @@ -32900,7 +32900,7 @@ def list_by_vpn_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -32978,7 +32978,7 @@ async def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -33050,7 +33050,7 @@ async def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -33104,7 +33104,7 @@ async def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_start_packet_capture( @@ -33146,7 +33146,7 @@ async def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -33193,7 +33193,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_stop_packet_capture( @@ -33235,7 +33235,7 @@ async def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -33319,7 +33319,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) @@ -33384,7 +33384,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_gateways_delete_request( @@ -33433,7 +33433,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) @@ -33518,7 +33518,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -33587,7 +33587,7 @@ async def begin_delete(self, resource_group_name: str, gateway_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -33628,7 +33628,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -33666,7 +33666,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -33736,7 +33736,7 @@ async def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) request = build_vpn_gateways_get_request( @@ -33784,7 +33784,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -33856,7 +33856,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -33928,7 +33928,7 @@ async def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) request = build_vpn_gateways_reset_request( @@ -33967,9 +33967,9 @@ async def _reset_initial( _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ - "ip_configuration_id": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "ip_configuration_id": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -34001,7 +34001,7 @@ async def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -34148,7 +34148,7 @@ async def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -34218,7 +34218,7 @@ async def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -34271,7 +34271,7 @@ async def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_start_packet_capture( @@ -34310,7 +34310,7 @@ async def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -34356,7 +34356,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_stop_packet_capture( @@ -34395,7 +34395,7 @@ async def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -34478,7 +34478,7 @@ async def _download_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -34557,7 +34557,7 @@ async def begin_download( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -34638,7 +34638,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) @@ -34703,7 +34703,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_sites_delete_request( @@ -34839,7 +34839,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -34908,7 +34908,7 @@ async def begin_delete(self, resource_group_name: str, vpn_site_name: str, **kwa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -35054,7 +35054,7 @@ async def get(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) request = build_vpn_sites_get_request( @@ -35101,7 +35101,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnSite"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSitesResult] = kwargs.pop("cls", None) error_map = { @@ -35172,7 +35172,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSitesResult] = kwargs.pop("cls", None) error_map = { @@ -35231,7 +35231,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -35269,7 +35269,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) @@ -35351,7 +35351,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Available _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableDelegationsResult] = kwargs.pop("cls", None) error_map = { @@ -35448,7 +35448,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableDelegationsResult] = kwargs.pop("cls", None) error_map = { @@ -35541,7 +35541,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.AzureFirewallFqdnTag _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallFqdnTagListResult] = kwargs.pop("cls", None) error_map = { @@ -35636,7 +35636,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) @@ -35701,7 +35701,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ddos_custom_policies_delete_request( @@ -35838,7 +35838,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -35909,7 +35909,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -36058,7 +36058,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) request = build_ddos_custom_policies_get_request( @@ -36094,7 +36094,7 @@ async def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -36132,7 +36132,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) @@ -36218,7 +36218,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) @@ -36284,7 +36284,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_connections_delete_request( @@ -36358,7 +36358,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -36432,7 +36432,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -36501,7 +36501,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) request = build_express_route_connections_get_request( @@ -36563,7 +36563,7 @@ async def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteConnectionList] = kwargs.pop("cls", None) request = build_express_route_connections_list_request( @@ -36636,7 +36636,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) @@ -36701,7 +36701,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_gateways_delete_request( @@ -36770,7 +36770,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -36842,7 +36842,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -36908,7 +36908,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) request = build_express_route_gateways_get_request( @@ -36965,7 +36965,7 @@ async def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) request = build_express_route_gateways_list_by_resource_group_request( @@ -37019,7 +37019,7 @@ async def list_by_subscription(self, **kwargs: Any) -> _models.ExpressRouteGatew _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) request = build_express_route_gateways_list_by_subscription_request( @@ -37070,7 +37070,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ExpressRouteGateway]] = kwargs.pop("cls", None) @@ -37120,7 +37120,7 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}'} @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -37159,7 +37159,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -37253,7 +37253,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteLink] = kwargs.pop("cls", None) request = build_express_route_links_get_request( @@ -37308,7 +37308,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteLinkListResult] = kwargs.pop("cls", None) error_map = { @@ -37410,7 +37410,7 @@ async def get(self, location_name: str, **kwargs: Any) -> _models.ExpressRoutePo _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortsLocation] = kwargs.pop("cls", None) request = build_express_route_ports_locations_get_request( @@ -37460,7 +37460,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRoutePortsLocatio _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortsLocationListResult] = kwargs.pop("cls", None) error_map = { @@ -37555,7 +37555,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) @@ -37620,7 +37620,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_ports_delete_request( @@ -37753,7 +37753,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -37824,7 +37824,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -37973,7 +37973,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) request = build_express_route_ports_get_request( @@ -38021,7 +38021,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRoutePort"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortListResult] = kwargs.pop("cls", None) error_map = { @@ -38095,7 +38095,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortListResult] = kwargs.pop("cls", None) error_map = { @@ -38154,7 +38154,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -38192,7 +38192,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) @@ -38240,7 +38240,7 @@ async def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def generate_loa( @@ -38278,7 +38278,7 @@ async def generate_loa( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GenerateExpressRoutePortsLOAResult] = kwargs.pop("cls", None) @@ -38862,7 +38862,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.OutboundRule] = kwargs.pop("cls", None) request = build_load_balancer_outbound_rules_get_request( @@ -38917,7 +38917,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerOutboundRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -39015,7 +39015,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) @@ -39081,7 +39081,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_interface_tap_configurations_delete_request( @@ -39155,7 +39155,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -39229,7 +39229,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -39298,7 +39298,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) request = build_network_interface_tap_configurations_get_request( @@ -39354,7 +39354,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceTapConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -39447,7 +39447,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_profiles_delete_request( @@ -39503,7 +39503,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -39579,7 +39579,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) @@ -39658,7 +39658,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) request = build_network_profiles_get_request( @@ -39709,7 +39709,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -39780,7 +39780,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkProfile"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -39873,7 +39873,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) @@ -39958,7 +39958,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) @@ -40023,7 +40023,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_delete_request( @@ -40072,7 +40072,7 @@ async def _generate_vpn_profile_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnProfileResponse]] = kwargs.pop("cls", None) @@ -40139,7 +40139,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) @@ -40225,7 +40225,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -40294,7 +40294,7 @@ async def begin_delete(self, resource_group_name: str, gateway_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -40371,7 +40371,7 @@ async def begin_generate_vpn_profile( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnProfileResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -40417,7 +40417,7 @@ def get_long_running_output(pipeline_response): begin_generate_vpn_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_update_tags( @@ -40456,7 +40456,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -40526,7 +40526,7 @@ async def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_get_request( @@ -40574,7 +40574,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.P2SVpnGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListP2SVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -40646,7 +40646,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListP2SVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -40718,7 +40718,7 @@ async def _get_p2_s_vpn_connection_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_request( @@ -40756,7 +40756,7 @@ async def _get_p2_s_vpn_connection_health_initial( _get_p2_s_vpn_connection_health_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_p2_s_vpn_connection_health( @@ -40786,7 +40786,7 @@ async def begin_get_p2_s_vpn_connection_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -40846,7 +40846,7 @@ async def _get_p2_s_vpn_connection_health_detailed_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.P2SVpnConnectionHealth]] = kwargs.pop("cls", None) @@ -40896,7 +40896,7 @@ async def _get_p2_s_vpn_connection_health_detailed_initial( _get_p2_s_vpn_connection_health_detailed_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed'} @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_p2_s_vpn_connection_health_detailed( @@ -40936,7 +40936,7 @@ async def begin_get_p2_s_vpn_connection_health_detailed( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnConnectionHealth] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -41085,7 +41085,7 @@ async def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsist _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -41129,7 +41129,7 @@ async def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsist _disconnect_p2_s_vpn_connections_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections'} @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_disconnect_p2_s_vpn_connections( @@ -41167,7 +41167,7 @@ async def begin_disconnect_p2_s_vpn_connections( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -41224,7 +41224,7 @@ async def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_reset_request( @@ -41262,7 +41262,7 @@ async def _reset_initial( _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_reset( @@ -41291,7 +41291,7 @@ async def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -41812,7 +41812,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) @@ -41877,7 +41877,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_public_ip_prefixes_delete_request( @@ -42010,7 +42010,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -42080,7 +42080,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -42231,7 +42231,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) request = build_public_ip_prefixes_get_request( @@ -42282,7 +42282,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -42353,7 +42353,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.PublicIPPrefix"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -42411,7 +42411,7 @@ async def get_next(next_link=None): list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -42449,7 +42449,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) @@ -42534,7 +42534,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) @@ -42599,7 +42599,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_service_endpoint_policies_delete_request( @@ -42732,7 +42732,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -42803,7 +42803,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -42959,7 +42959,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) request = build_service_endpoint_policies_get_request( @@ -43009,7 +43009,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ServiceEndpointPolicy"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -43084,7 +43084,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -43143,7 +43143,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -43181,7 +43181,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) @@ -43267,7 +43267,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) @@ -43337,7 +43337,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_service_endpoint_policy_definitions_delete_request( @@ -43413,7 +43413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -43492,7 +43492,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -43566,7 +43566,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) request = build_service_endpoint_policy_definitions_get_request( @@ -43622,7 +43622,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyDefinitionListResult] = kwargs.pop("cls", None) error_map = { @@ -43715,7 +43715,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) @@ -43780,7 +43780,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_taps_delete_request( @@ -43905,7 +43905,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -43974,7 +43974,7 @@ async def begin_delete(self, resource_group_name: str, tap_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -44117,7 +44117,7 @@ async def get(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> _ _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) request = build_virtual_network_taps_get_request( @@ -44165,7 +44165,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetworkTap"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTapListResult] = kwargs.pop("cls", None) error_map = { @@ -44239,7 +44239,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTapListResult] = kwargs.pop("cls", None) error_map = { @@ -44298,7 +44298,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -44332,7 +44332,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) @@ -44417,7 +44417,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) @@ -44482,7 +44482,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_wans_delete_request( @@ -44618,7 +44618,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -44689,7 +44689,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -44835,7 +44835,7 @@ async def get(self, resource_group_name: str, virtual_wan_name: str, **kwargs: A _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) request = build_virtual_wans_get_request( @@ -44883,7 +44883,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualWAN"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualWANsResult] = kwargs.pop("cls", None) error_map = { @@ -44955,7 +44955,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualWANsResult] = kwargs.pop("cls", None) error_map = { @@ -45014,7 +45014,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -45052,7 +45052,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) @@ -45150,7 +45150,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PeerExpressRouteCircuitConnection] = kwargs.pop("cls", None) request = build_peer_express_route_circuit_connections_get_request( @@ -45210,7 +45210,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PeerExpressRouteCircuitConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -45304,7 +45304,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_web_application_firewall_policies_delete_request( @@ -45358,7 +45358,7 @@ async def begin_delete(self, resource_group_name: str, policy_name: str, **kwarg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -45434,7 +45434,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) @@ -45511,7 +45511,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) request = build_web_application_firewall_policies_get_request( @@ -45562,7 +45562,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -45634,7 +45634,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.WebApplicationFirewa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -45725,7 +45725,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.NatGateway]] = kwargs.pop("cls", None) @@ -45791,7 +45791,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_nat_gateways_delete_request( @@ -45854,7 +45854,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -45925,7 +45925,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -45993,7 +45993,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) request = build_nat_gateways_get_request( @@ -46044,7 +46044,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -46115,7 +46115,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NatGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -46204,7 +46204,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) @@ -46339,7 +46339,7 @@ async def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list( @@ -46369,7 +46369,7 @@ async def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ResourceNavigationLinksListResult] = kwargs.pop("cls", None) request = build_resource_navigation_links_list_request( @@ -46493,7 +46493,7 @@ async def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list( @@ -46523,7 +46523,7 @@ async def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceAssociationLinksListResult] = kwargs.pop("cls", None) request = build_service_association_links_list_request( @@ -46596,7 +46596,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Available _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = kwargs.pop("cls", None) error_map = { @@ -46675,7 +46675,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = kwargs.pop("cls", None) error_map = { @@ -46772,7 +46772,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) @@ -46837,7 +46837,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_bastion_hosts_delete_request( @@ -46904,7 +46904,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -46975,7 +46975,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -47039,7 +47039,7 @@ async def get(self, resource_group_name: str, bastion_host_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) request = build_bastion_hosts_get_request( @@ -47087,7 +47087,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.BastionHost"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHostListResult] = kwargs.pop("cls", None) error_map = { @@ -47159,7 +47159,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHostListResult] = kwargs.pop("cls", None) error_map = { @@ -47231,7 +47231,7 @@ async def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BastionHost]] = kwargs.pop("cls", None) @@ -47281,10 +47281,10 @@ async def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}'} @api_version_validation( - method_valid_on=['2019-06-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ "bastion_host_parameters": ['2019-06-01'], - "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -47319,7 +47319,7 @@ async def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -47403,7 +47403,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) @@ -47469,7 +47469,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_endpoints_delete_request( @@ -47538,7 +47538,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -47609,7 +47609,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -47677,7 +47677,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) request = build_private_endpoints_get_request( @@ -47729,7 +47729,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointListResult] = kwargs.pop("cls", None) error_map = { @@ -47801,7 +47801,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateE _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointListResult] = kwargs.pop("cls", None) error_map = { @@ -47897,7 +47897,7 @@ async def _check_private_link_service_visibility_by_resource_group_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = kwargs.pop("cls", None) @@ -47960,7 +47960,7 @@ async def _check_private_link_service_visibility_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = kwargs.pop("cls", None) @@ -48026,7 +48026,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) @@ -48092,7 +48092,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_link_services_delete_request( @@ -48138,7 +48138,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=incons _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_link_services_delete_private_endpoint_connection_request( @@ -48203,7 +48203,7 @@ async def begin_check_private_link_service_visibility( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkServiceVisibility] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -48286,7 +48286,7 @@ async def begin_check_private_link_service_visibility_by_resource_group( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkServiceVisibility] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -48368,7 +48368,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -48437,7 +48437,7 @@ async def begin_delete(self, resource_group_name: str, service_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -48504,7 +48504,7 @@ async def begin_delete_private_endpoint_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -48573,7 +48573,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) request = build_private_link_services_get_request( @@ -48625,7 +48625,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkServiceListResult] = kwargs.pop("cls", None) error_map = { @@ -48703,7 +48703,7 @@ def list_auto_approved_private_link_services( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = kwargs.pop("cls", None) error_map = { @@ -48782,7 +48782,7 @@ def list_auto_approved_private_link_services_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = kwargs.pop("cls", None) error_map = { @@ -48856,7 +48856,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateL _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkServiceListResult] = kwargs.pop("cls", None) error_map = { @@ -48953,7 +48953,7 @@ async def update_private_endpoint_connection( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -49003,7 +49003,7 @@ async def update_private_endpoint_connection( update_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def get_private_endpoint_connection( @@ -49042,7 +49042,7 @@ async def get_private_endpoint_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_private_link_services_get_private_endpoint_connection_request( @@ -49081,7 +49081,7 @@ async def get_private_endpoint_connection( get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_private_endpoint_connections( @@ -49103,7 +49103,7 @@ def list_private_endpoint_connections( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -49207,7 +49207,7 @@ async def list(self, location: str, **kwargs: Any) -> _models.ServiceTagsListRes _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceTagsListResult] = kwargs.pop("cls", None) request = build_service_tags_list_request( @@ -49279,7 +49279,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) @@ -49344,7 +49344,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_firewall_policies_delete_request( @@ -49412,7 +49412,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -49483,7 +49483,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -49551,7 +49551,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) request = build_firewall_policies_get_request( @@ -49602,7 +49602,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -49673,7 +49673,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.FirewallPolicy"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -49731,10 +49731,10 @@ async def get_next(next_link=None): list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ "firewall_policy_parameters": ['2019-06-01', '2019-07-01', '2019-08-01'], - "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -49773,7 +49773,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) @@ -50298,7 +50298,7 @@ def list_by_vpn_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSiteLinkConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -50377,7 +50377,7 @@ async def _get_ike_sas_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_vpn_link_connections_get_ike_sas_request( @@ -50436,7 +50436,7 @@ async def _reset_connection_initial( # pylint: disable=inconsistent-return-stat _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_link_connections_reset_connection_request( @@ -50471,7 +50471,7 @@ async def _reset_connection_initial( # pylint: disable=inconsistent-return-stat _reset_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_ike_sas( @@ -50507,7 +50507,7 @@ async def begin_get_ike_sas( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -50552,7 +50552,7 @@ def get_long_running_output(pipeline_response): begin_get_ike_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_reset_connection( @@ -50588,7 +50588,7 @@ async def begin_reset_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -50685,7 +50685,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSiteLinkConnection] = kwargs.pop("cls", None) request = build_vpn_site_link_connections_get_request( @@ -50770,7 +50770,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSiteLink] = kwargs.pop("cls", None) request = build_vpn_site_links_get_request( @@ -50825,7 +50825,7 @@ def list_by_vpn_site( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSiteLinksResult] = kwargs.pop("cls", None) error_map = { @@ -50923,7 +50923,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) @@ -50990,7 +50990,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_router_peerings_delete_request( @@ -51063,7 +51063,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -51137,7 +51137,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -51206,7 +51206,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) request = build_virtual_router_peerings_get_request( @@ -51263,7 +51263,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -51452,7 +51452,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) @@ -51518,7 +51518,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_routers_delete_request( @@ -51587,7 +51587,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -51658,7 +51658,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -51726,7 +51726,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) request = build_virtual_routers_get_request( @@ -51776,7 +51776,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualRouter"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterListResult] = kwargs.pop("cls", None) error_map = { @@ -51849,7 +51849,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterListResult] = kwargs.pop("cls", None) error_map = { @@ -52031,7 +52031,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Available _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableServiceAliasesResult] = kwargs.pop("cls", None) error_map = { @@ -52109,7 +52109,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableServiceAliasesResult] = kwargs.pop("cls", None) error_map = { @@ -52202,7 +52202,7 @@ async def _list_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnServerConfigurationsResponse]] = kwargs.pop("cls", None) request = build_vpn_server_configurations_associated_with_virtual_wan_list_request( @@ -52267,7 +52267,7 @@ async def begin_list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfigurationsResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -52347,7 +52347,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) @@ -52412,7 +52412,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_server_configurations_delete_request( @@ -52552,7 +52552,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -52624,7 +52624,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -52779,7 +52779,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) request = build_vpn_server_configurations_get_request( @@ -52828,7 +52828,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnServerConfiguration"] _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationsResult] = kwargs.pop("cls", None) error_map = { @@ -52903,7 +52903,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationsResult] = kwargs.pop("cls", None) error_map = { @@ -52962,7 +52962,7 @@ async def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -53002,7 +53002,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) @@ -53083,7 +53083,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) @@ -53149,7 +53149,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ip_groups_delete_request( @@ -53213,7 +53213,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -53282,7 +53282,7 @@ async def begin_delete(self, resource_group_name: str, ip_groups_name: str, **kw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -53351,7 +53351,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) request = build_ip_groups_get_request( @@ -53400,7 +53400,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.IpGroup"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -53472,7 +53472,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -53563,7 +53563,7 @@ async def update_groups( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) @@ -53650,7 +53650,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) @@ -53717,7 +53717,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_route_table_v2_s_delete_request( @@ -53792,7 +53792,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -53866,7 +53866,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -53935,7 +53935,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) request = build_virtual_hub_route_table_v2_s_get_request( @@ -53992,7 +53992,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubRouteTableV2SResult] = kwargs.pop("cls", None) error_map = { @@ -54090,7 +54090,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) @@ -54157,7 +54157,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_flow_logs_delete_request( @@ -54229,7 +54229,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -54303,7 +54303,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -54372,7 +54372,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) request = build_flow_logs_get_request( @@ -54428,7 +54428,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FlowLogListResult] = kwargs.pop("cls", None) error_map = { @@ -54489,7 +54489,7 @@ async def get_next(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def update_tags( @@ -54530,7 +54530,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) @@ -54617,7 +54617,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) @@ -54685,7 +54685,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_virtual_appliances_delete_request( @@ -54757,7 +54757,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -54828,7 +54828,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -54901,7 +54901,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) request = build_network_virtual_appliances_get_request( @@ -54951,7 +54951,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkVirtualAppliance" _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceListResult] = kwargs.pop("cls", None) error_map = { @@ -55026,7 +55026,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceListResult] = kwargs.pop("cls", None) error_map = { @@ -55121,7 +55121,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) @@ -55206,7 +55206,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) @@ -55271,7 +55271,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ip_allocations_delete_request( @@ -55338,7 +55338,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -55409,7 +55409,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -55477,7 +55477,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) request = build_ip_allocations_get_request( @@ -55526,7 +55526,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.IpAllocation"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocationListResult] = kwargs.pop("cls", None) error_map = { @@ -55598,7 +55598,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocationListResult] = kwargs.pop("cls", None) error_map = { @@ -55692,7 +55692,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) @@ -55778,7 +55778,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) @@ -55844,7 +55844,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_dns_zone_groups_delete_request( @@ -55916,7 +55916,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -55990,7 +55990,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -56059,7 +56059,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) request = build_private_dns_zone_groups_get_request( @@ -56114,7 +56114,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateDnsZoneGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -56212,7 +56212,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) @@ -56277,7 +56277,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_partner_providers_delete_request( @@ -56345,7 +56345,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -56416,7 +56416,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -56482,7 +56482,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) request = build_security_partner_providers_get_request( @@ -56531,7 +56531,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityPartnerProvider" _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -56606,7 +56606,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -56700,7 +56700,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) @@ -56786,7 +56786,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) @@ -56852,7 +56852,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_hub_route_tables_delete_request( @@ -56924,7 +56924,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -56998,7 +56998,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -57067,7 +57067,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) request = build_hub_route_tables_get_request( @@ -57122,7 +57122,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListHubRouteTablesResult] = kwargs.pop("cls", None) error_map = { @@ -57215,7 +57215,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateway_private_endpoint_connections_delete_request( @@ -57266,7 +57266,7 @@ async def _update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ApplicationGatewayPrivateEndpointConnection]] = kwargs.pop("cls", None) @@ -57344,7 +57344,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -57428,7 +57428,7 @@ async def begin_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -57504,7 +57504,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) request = build_application_gateway_private_endpoint_connections_get_request( @@ -57560,7 +57560,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -57659,7 +57659,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -57757,7 +57757,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) @@ -57823,7 +57823,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_firewall_policy_rule_collection_groups_delete_request( @@ -57897,7 +57897,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -57971,7 +57971,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -58040,7 +58040,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) request = build_firewall_policy_rule_collection_groups_get_request( @@ -58096,7 +58096,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyRuleCollectionGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -58194,7 +58194,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) @@ -58260,7 +58260,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_appliance_sites_delete_request( @@ -58332,7 +58332,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -58406,7 +58406,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -58475,7 +58475,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) request = build_virtual_appliance_sites_get_request( @@ -58531,7 +58531,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSiteListResult] = kwargs.pop("cls", None) error_map = { @@ -58632,7 +58632,7 @@ async def get(self, sku_name: str, **kwargs: Any) -> _models.NetworkVirtualAppli _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSku] = kwargs.pop("cls", None) request = build_virtual_appliance_skus_get_request( @@ -58680,7 +58680,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkVirtualApplianceS _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSkuListResult] = kwargs.pop("cls", None) error_map = { @@ -58776,7 +58776,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) @@ -58842,7 +58842,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connection_delete_request( @@ -58915,7 +58915,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -58989,7 +58989,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -59058,7 +59058,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connection_get_request( @@ -59133,7 +59133,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubBgpConnectionResults] = kwargs.pop("cls", None) error_map = { @@ -59206,7 +59206,7 @@ async def _list_advertised_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connections_list_advertised_routes_request( @@ -59258,7 +59258,7 @@ async def _list_learned_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connections_list_learned_routes_request( @@ -59297,7 +59297,7 @@ async def _list_learned_routes_initial( _list_learned_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_advertised_routes( @@ -59328,7 +59328,7 @@ async def begin_list_advertised_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Dict[str, List[_models.PeerRoute]]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -59372,7 +59372,7 @@ def get_long_running_output(pipeline_response): begin_list_advertised_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_list_learned_routes( @@ -59403,7 +59403,7 @@ async def begin_list_learned_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Dict[str, List[_models.PeerRoute]]] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -59485,7 +59485,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) @@ -59551,7 +59551,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_ip_configuration_delete_request( @@ -59624,7 +59624,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -59698,7 +59698,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -59767,7 +59767,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) request = build_virtual_hub_ip_configuration_get_request( @@ -59822,7 +59822,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubIpConfigurationResults] = kwargs.pop("cls", None) error_map = { @@ -59919,7 +59919,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) @@ -59984,7 +59984,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_custom_ip_prefixes_delete_request( @@ -60052,7 +60052,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -60122,7 +60122,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -60190,7 +60190,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) request = build_custom_ip_prefixes_get_request( @@ -60241,7 +60241,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -60312,7 +60312,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.CustomIpPrefix"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -60405,7 +60405,7 @@ async def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) @@ -60490,7 +60490,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) @@ -60555,7 +60555,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_dscp_configuration_delete_request( @@ -60623,7 +60623,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -60693,7 +60693,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -60759,7 +60759,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) request = build_dscp_configuration_get_request( @@ -60809,7 +60809,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -60880,7 +60880,7 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.DscpConfiguration"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -60976,7 +60976,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundSecurityRule] = kwargs.pop("cls", None) @@ -61068,7 +61068,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundSecurityRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -61160,7 +61160,7 @@ async def get(self, name: str, *, expand: Optional[str] = None, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureWebCategory] = kwargs.pop("cls", None) request = build_web_categories_get_request( @@ -61208,7 +61208,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AzureWeb _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureWebCategoryListResult] = kwargs.pop("cls", None) error_map = { @@ -61304,7 +61304,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) @@ -61370,7 +61370,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_nat_rules_delete_request( @@ -61443,7 +61443,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -61517,7 +61517,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -61586,7 +61586,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) request = build_nat_rules_get_request( @@ -61641,7 +61641,7 @@ def list_by_vpn_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewayNatRulesResult] = kwargs.pop("cls", None) error_map = { @@ -61739,7 +61739,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) @@ -61805,7 +61805,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_nat_rules_delete_request( @@ -61879,7 +61879,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -61953,7 +61953,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -62022,7 +62022,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) request = build_virtual_network_gateway_nat_rules_get_request( @@ -62078,7 +62078,7 @@ def list_by_virtual_network_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualNetworkGatewayNatRulesResult] = kwargs.pop("cls", None) error_map = { @@ -62519,7 +62519,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) @@ -62682,7 +62682,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) request = build_admin_rule_collections_get_request( @@ -62755,7 +62755,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleCollectionListResult] = kwargs.pop("cls", None) error_map = { @@ -62838,7 +62838,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_admin_rule_collections_delete_request( @@ -62877,7 +62877,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -62920,7 +62920,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -63029,7 +63029,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) @@ -63200,7 +63200,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) request = build_admin_rules_get_request( @@ -63278,7 +63278,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -63363,7 +63363,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_admin_rules_delete_request( @@ -63403,7 +63403,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -63449,7 +63449,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -63554,7 +63554,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) @@ -63703,7 +63703,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) request = build_connectivity_configurations_get_request( @@ -63773,7 +63773,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectivityConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -63854,7 +63854,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connectivity_configurations_delete_request( @@ -63892,7 +63892,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -63933,7 +63933,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -64357,7 +64357,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) @@ -64508,7 +64508,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) request = build_network_groups_get_request( @@ -64577,7 +64577,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -64658,7 +64658,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_groups_delete_request( @@ -64696,7 +64696,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -64735,7 +64735,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -64903,7 +64903,7 @@ async def _post_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerCommit] = kwargs.pop("cls", None) @@ -64958,7 +64958,7 @@ async def _post_initial( _post_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_post( @@ -64997,7 +64997,7 @@ async def begin_post( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerCommit] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -65064,7 +65064,7 @@ def __init__(self, *args, **kwargs): self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @api_version_validation( params_valid_on={ - "top": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "top": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace_async @@ -65109,7 +65109,7 @@ async def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerDeploymentStatusListResult] = kwargs.pop("cls", None) @@ -65319,7 +65319,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) @@ -65456,7 +65456,7 @@ async def get(self, resource_group_name: str, network_manager_name: str, **kwarg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) request = build_network_managers_get_request( @@ -65516,7 +65516,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerListResult] = kwargs.pop("cls", None) error_map = { @@ -65599,7 +65599,7 @@ def list_by_subscription( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerListResult] = kwargs.pop("cls", None) error_map = { @@ -65760,7 +65760,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_managers_delete_request( @@ -65797,7 +65797,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -65828,7 +65828,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -65870,7 +65870,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def patch( @@ -65908,7 +65908,7 @@ async def patch( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) @@ -68683,7 +68683,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) @@ -68828,7 +68828,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) request = build_security_admin_configurations_get_request( @@ -68899,7 +68899,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityAdminConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -68980,7 +68980,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_admin_configurations_delete_request( @@ -69018,7 +69018,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete( @@ -69057,7 +69057,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -70259,7 +70259,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.ApplicationGatewayW _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResult] = kwargs.pop("cls", None) request = build_application_gateway_waf_dynamic_manifests_default_get_request( @@ -70329,7 +70329,7 @@ def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Applicatio _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResultList] = kwargs.pop("cls", None) error_map = { @@ -70426,7 +70426,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) @@ -70498,7 +70498,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_configuration_policy_groups_delete_request( @@ -70572,7 +70572,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -70650,7 +70650,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -70724,7 +70724,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) request = build_configuration_policy_groups_get_request( @@ -70780,7 +70780,7 @@ def list_by_vpn_server_configuration( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationPolicyGroupsResult] = kwargs.pop("cls", None) error_map = { @@ -70878,7 +70878,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) @@ -70944,7 +70944,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_port_authorizations_delete_request( @@ -71017,7 +71017,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -71091,7 +71091,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -71160,7 +71160,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) request = build_express_route_port_authorizations_get_request( @@ -71216,7 +71216,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortAuthorizationListResult] = kwargs.pop("cls", None) error_map = { @@ -71318,7 +71318,7 @@ async def list(self, *, filter: Optional[str] = None, **kwargs: Any) -> _models. _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteProviderPortListResult] = kwargs.pop("cls", None) request = build_express_route_provider_ports_location_list_request( @@ -71408,7 +71408,7 @@ async def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignatureOverridesFilterValuesResponse] = kwargs.pop("cls", None) @@ -71511,7 +71511,7 @@ async def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.QueryResults] = kwargs.pop("cls", None) @@ -71604,7 +71604,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) request = build_firewall_policy_idps_signatures_overrides_get_request( @@ -71666,7 +71666,7 @@ async def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SignaturesOverridesList] = kwargs.pop("cls", None) request = build_firewall_policy_idps_signatures_overrides_list_request( @@ -71737,7 +71737,7 @@ async def patch( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) @@ -71820,7 +71820,7 @@ async def put( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) @@ -71924,7 +71924,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) @@ -72001,7 +72001,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_management_group_network_manager_connections_delete_request( @@ -72058,7 +72058,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) request = build_management_group_network_manager_connections_get_request( @@ -72119,7 +72119,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -72217,7 +72217,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) @@ -72283,7 +72283,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_maps_delete_request( @@ -72354,7 +72354,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -72428,7 +72428,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -72497,7 +72497,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) request = build_route_maps_get_request( @@ -72551,7 +72551,7 @@ def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListRouteMapsResult] = kwargs.pop("cls", None) error_map = { @@ -72649,7 +72649,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) @@ -72715,7 +72715,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_routing_intent_delete_request( @@ -72788,7 +72788,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -72862,7 +72862,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -72931,7 +72931,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) request = build_routing_intent_get_request( @@ -72986,7 +72986,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListRoutingIntentResult] = kwargs.pop("cls", None) error_map = { @@ -73104,7 +73104,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) @@ -73184,7 +73184,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scope_connections_delete_request( @@ -73244,7 +73244,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) request = build_scope_connections_get_request( @@ -73313,7 +73313,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ScopeConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -73424,7 +73424,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceTagInformationListResult] = kwargs.pop("cls", None) error_map = { @@ -73546,7 +73546,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) @@ -73634,7 +73634,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_static_members_delete_request( @@ -73702,7 +73702,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) request = build_static_members_get_request( @@ -73775,7 +73775,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.StaticMemberListResult] = kwargs.pop("cls", None) error_map = { @@ -73890,7 +73890,7 @@ async def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) @@ -73964,7 +73964,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_subscription_network_manager_connections_delete_request( @@ -74016,7 +74016,7 @@ async def get(self, network_manager_connection_name: str, **kwargs: Any) -> _mod _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) request = build_subscription_network_manager_connections_get_request( @@ -74074,7 +74074,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -74168,7 +74168,7 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -74248,7 +74248,7 @@ async def begin_create( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -74320,7 +74320,7 @@ async def get(self, group_name: str, resource_name: str, **kwargs: Any) -> _mode _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SwapResource] = kwargs.pop("cls", None) request = build_vip_swap_get_request( @@ -74381,7 +74381,7 @@ async def list(self, group_name: str, resource_name: str, **kwargs: Any) -> _mod _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SwapResourceListResult] = kwargs.pop("cls", None) request = build_vip_swap_list_request( @@ -74455,7 +74455,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) @@ -74523,7 +74523,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_virtual_appliance_connections_delete_request( @@ -74602,7 +74602,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -74676,7 +74676,7 @@ async def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -74745,7 +74745,7 @@ async def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) request = build_network_virtual_appliance_connections_get_request( @@ -74801,7 +74801,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceConnectionList] = kwargs.pop("cls", None) error_map = { @@ -74865,7 +74865,7 @@ def _api_version(self, op_name: str) -> str: return self._get_api_version(op_name) @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def check_dns_name_availability( @@ -74895,7 +74895,7 @@ async def check_dns_name_availability( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("check_dns_name_availability") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("check_dns_name_availability") or "2023-09-01") ) cls: ClsType[_models.DnsNameAvailabilityResult] = kwargs.pop("cls", None) @@ -74932,7 +74932,7 @@ async def check_dns_name_availability( check_dns_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def supported_security_providers( @@ -74962,7 +74962,7 @@ async def supported_security_providers( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("supported_security_providers") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("supported_security_providers") or "2023-09-01") ) cls: ClsType[_models.VirtualWanSecurityProviders] = kwargs.pop("cls", None) @@ -75020,7 +75020,7 @@ async def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( "api_version", _params.pop( "api-version", - self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-06-01", + self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -75072,7 +75072,7 @@ async def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( _generatevirtualwanvpnserverconfigurationvpnprofile_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile'} @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_generatevirtualwanvpnserverconfigurationvpnprofile( @@ -75118,7 +75118,7 @@ async def begin_generatevirtualwanvpnserverconfigurationvpnprofile( "api_version", _params.pop( "api-version", - self._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-06-01", + self._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -75185,7 +75185,7 @@ async def _delete_bastion_shareable_link_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-06-01"), + _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -75244,7 +75244,7 @@ async def _get_active_sessions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("_get_active_sessions_initial") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("_get_active_sessions_initial") or "2023-09-01") ) cls: ClsType[Optional[_models.BastionActiveSessionListResult]] = kwargs.pop("cls", None) @@ -75302,7 +75302,7 @@ async def _put_bastion_shareable_link_initial( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-06-01"), + _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BastionShareableLinkListResult]] = kwargs.pop("cls", None) @@ -75353,7 +75353,7 @@ async def _put_bastion_shareable_link_initial( _put_bastion_shareable_link_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete_bastion_shareable_link( @@ -75392,7 +75392,7 @@ async def begin_delete_bastion_shareable_link( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("begin_delete_bastion_shareable_link") or "2023-06-01"), + _params.pop("api-version", self._api_version("begin_delete_bastion_shareable_link") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -75437,7 +75437,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_get_active_sessions( @@ -75468,7 +75468,7 @@ async def begin_get_active_sessions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("begin_get_active_sessions") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("begin_get_active_sessions") or "2023-09-01") ) cls: ClsType[_models.BastionActiveSessionListResult] = kwargs.pop("cls", None) @@ -75567,7 +75567,7 @@ async def internal_get_next(next_link=None): begin_get_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_put_bastion_shareable_link( @@ -75609,7 +75609,7 @@ async def begin_put_bastion_shareable_link( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("begin_put_bastion_shareable_link") or "2023-06-01"), + _params.pop("api-version", self._api_version("begin_put_bastion_shareable_link") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) @@ -75720,7 +75720,7 @@ async def internal_get_next(next_link=None): begin_put_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def disconnect_active_sessions( @@ -75752,7 +75752,7 @@ def disconnect_active_sessions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("disconnect_active_sessions") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("disconnect_active_sessions") or "2023-09-01") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionSessionDeleteResult] = kwargs.pop("cls", None) @@ -75824,7 +75824,7 @@ async def get_next(next_link=None): disconnect_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_bastion_shareable_link( @@ -75857,7 +75857,7 @@ def get_bastion_shareable_link( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("get_bastion_shareable_link") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("get_bastion_shareable_link") or "2023-09-01") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) @@ -75929,7 +75929,7 @@ async def get_next(next_link=None): get_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _models.ExpressRouteProviderPort: @@ -75954,7 +75954,7 @@ async def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("express_route_provider_port") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("express_route_provider_port") or "2023-09-01") ) cls: ClsType[_models.ExpressRouteProviderPort] = kwargs.pop("cls", None) @@ -75990,7 +75990,7 @@ async def express_route_provider_port(self, providerport: str, **kwargs: Any) -> express_route_provider_port.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_active_connectivity_configurations( @@ -76035,7 +76035,7 @@ async def list_active_connectivity_configurations( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-06-01"), + _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActiveConnectivityConfigurationsListResult] = kwargs.pop("cls", None) @@ -76085,7 +76085,7 @@ async def list_active_connectivity_configurations( list_active_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_active_security_admin_rules( @@ -76130,7 +76130,7 @@ async def list_active_security_admin_rules( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-06-01"), + _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActiveSecurityAdminRulesListResult] = kwargs.pop("cls", None) @@ -76180,7 +76180,7 @@ async def list_active_security_admin_rules( list_active_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_network_manager_effective_connectivity_configurations( @@ -76229,7 +76229,7 @@ async def list_network_manager_effective_connectivity_configurations( "api_version", _params.pop( "api-version", - self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-06-01", + self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -76282,7 +76282,7 @@ async def list_network_manager_effective_connectivity_configurations( list_network_manager_effective_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace_async async def list_network_manager_effective_security_admin_rules( @@ -76329,7 +76329,7 @@ async def list_network_manager_effective_security_admin_rules( api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-06-01" + "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -76400,7 +76400,7 @@ async def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=in api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-06-01" + "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -76449,7 +76449,7 @@ async def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=in _delete_bastion_shareable_link_by_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken'} @api_version_validation( - method_valid_on=['2023-06-01'], + method_valid_on=['2023-06-01', '2023-09-01'], ) @distributed_trace_async async def begin_delete_bastion_shareable_link_by_token( @@ -76490,7 +76490,7 @@ async def begin_delete_bastion_shareable_link_by_token( api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-06-01" + "api-version", self._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_enums.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_enums.py index 3150f9b9a354..d390e08c99db 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_enums.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_enums.py @@ -1274,6 +1274,8 @@ class VirtualNetworkPrivateEndpointNetworkPolicies(str, Enum, metaclass=CaseInse ENABLED = "Enabled" DISABLED = "Disabled" + NETWORK_SECURITY_GROUP_ENABLED = "NetworkSecurityGroupEnabled" + ROUTE_TABLE_ENABLED = "RouteTableEnabled" class VirtualNetworkPrivateLinkServiceNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enable or Disable apply network policies on private link service in the subnet.""" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py index 353be731ba41..fa0b2be791aa 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/models/_models.py @@ -5913,7 +5913,8 @@ class Subnet(SubResource): # pylint: disable=too-many-instance-attributes "Succeeded", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.models.ProvisioningState :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Known values are: "Enabled" and "Disabled". + end point in the subnet. Known values are: "Enabled", "Disabled", + "NetworkSecurityGroupEnabled", and "RouteTableEnabled". :vartype private_endpoint_network_policies: str or ~azure.mgmt.network.models.VirtualNetworkPrivateEndpointNetworkPolicies :ivar private_link_service_network_policies: Enable or Disable apply network policies on @@ -6025,7 +6026,8 @@ def __init__( # pylint: disable=too-many-locals :keyword delegations: An array of references to the delegations on the subnet. :paramtype delegations: list[~azure.mgmt.network.models.Delegation] :keyword private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Known values are: "Enabled" and "Disabled". + end point in the subnet. Known values are: "Enabled", "Disabled", + "NetworkSecurityGroupEnabled", and "RouteTableEnabled". :paramtype private_endpoint_network_policies: str or ~azure.mgmt.network.models.VirtualNetworkPrivateEndpointNetworkPolicies :keyword private_link_service_network_policies: Enable or Disable apply network policies on @@ -22929,6 +22931,8 @@ class BastionHost(Resource): # pylint: disable=too-many-instance-attributes :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar sku: The sku of this Bastion Host. @@ -22977,6 +22981,7 @@ class BastionHost(Resource): # pylint: disable=too-many-instance-attributes "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "zones": {"key": "zones", "type": "[str]"}, "etag": {"key": "etag", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "ip_configurations": {"key": "properties.ipConfigurations", "type": "[BastionHostIPConfiguration]"}, @@ -22999,6 +23004,7 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, sku: Optional["_models.Sku"] = None, ip_configurations: Optional[List["_models.BastionHostIPConfiguration"]] = None, dns_name: Optional[str] = None, @@ -23020,6 +23026,8 @@ def __init__( :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] :keyword sku: The sku of this Bastion Host. :paramtype sku: ~azure.mgmt.network.models.Sku :keyword ip_configurations: IP configuration of the Bastion Host resource. @@ -23049,6 +23057,7 @@ def __init__( :paramtype enable_kerberos: bool """ super().__init__(id=id, location=location, tags=tags, **kwargs) + self.zones = zones self.etag = None self.sku = sku self.ip_configurations = ip_configurations diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py index 3116d671c9fb..9834889a3931 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/operations/_operations.py @@ -64,7 +64,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,7 +97,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +187,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +217,7 @@ def build_application_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +244,7 @@ def build_application_gateways_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_application_gateways_backend_health_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -339,7 +339,7 @@ def build_application_gateways_get_ssl_predefined_policy_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,7 +366,7 @@ def build_application_gateways_list_available_ssl_options_request(subscription_i _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -394,7 +394,7 @@ def build_application_gateways_list_available_ssl_predefined_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -420,7 +420,7 @@ def build_application_gateways_list_available_waf_rule_sets_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -448,7 +448,7 @@ def build_application_gateways_list_available_request_headers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -476,7 +476,7 @@ def build_application_gateways_list_available_response_headers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -504,7 +504,7 @@ def build_application_gateways_list_available_server_variables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -537,7 +537,7 @@ def build_application_gateways_backend_health_on_demand_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -572,7 +572,7 @@ def build_application_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -637,7 +637,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) @@ -702,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_delete_request( @@ -747,7 +747,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_start_request( @@ -792,7 +792,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateways_stop_request( @@ -860,7 +860,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -928,7 +928,7 @@ def begin_delete(self, resource_group_name: str, application_gateway_name: str, _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -991,7 +991,7 @@ def begin_start(self, resource_group_name: str, application_gateway_name: str, * _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -1054,7 +1054,7 @@ def begin_stop(self, resource_group_name: str, application_gateway_name: str, ** _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -1118,7 +1118,7 @@ def get(self, resource_group_name: str, application_gateway_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) request = build_application_gateways_get_request( @@ -1167,7 +1167,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.App _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -1237,7 +1237,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.ApplicationGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -1308,7 +1308,7 @@ def _backend_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ApplicationGatewayBackendHealth]] = kwargs.pop("cls", None) request = build_application_gateways_backend_health_request( @@ -1412,7 +1412,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_backend_health( @@ -1444,7 +1444,7 @@ def begin_backend_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayBackendHealth] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1571,7 +1571,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_ssl_predefined_policy( @@ -1597,7 +1597,7 @@ def get_ssl_predefined_policy( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewaySslPredefinedPolicy] = kwargs.pop("cls", None) request = build_application_gateways_get_ssl_predefined_policy_request( @@ -1632,7 +1632,7 @@ def get_ssl_predefined_policy( get_ssl_predefined_policy.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableSslOptions: @@ -1654,7 +1654,7 @@ def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableSslOptions] = kwargs.pop("cls", None) request = build_application_gateways_list_available_ssl_options_request( @@ -1688,7 +1688,7 @@ def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewa list_available_ssl_options.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_ssl_predefined_policies( @@ -1706,7 +1706,7 @@ def list_available_ssl_predefined_policies( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableSslPredefinedPolicies] = kwargs.pop("cls", None) error_map = { @@ -1764,7 +1764,7 @@ def get_next(next_link=None): list_available_ssl_predefined_policies.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableWafRuleSetsResult: @@ -1786,7 +1786,7 @@ def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGate _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayAvailableWafRuleSetsResult] = kwargs.pop("cls", None) request = build_application_gateways_list_available_waf_rule_sets_request( @@ -1820,7 +1820,7 @@ def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGate list_available_waf_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_request_headers(self, **kwargs: Any) -> List[str]: @@ -1842,7 +1842,7 @@ def list_available_request_headers(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_request_headers_request( @@ -1877,7 +1877,7 @@ def list_available_request_headers(self, **kwargs: Any) -> List[str]: list_available_request_headers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_response_headers(self, **kwargs: Any) -> List[str]: @@ -1899,7 +1899,7 @@ def list_available_response_headers(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_response_headers_request( @@ -1934,7 +1934,7 @@ def list_available_response_headers(self, **kwargs: Any) -> List[str]: list_available_response_headers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_available_server_variables(self, **kwargs: Any) -> List[str]: @@ -1956,7 +1956,7 @@ def list_available_server_variables(self, **kwargs: Any) -> List[str]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[List[str]] = kwargs.pop("cls", None) request = build_application_gateways_list_available_server_variables_request( @@ -2010,7 +2010,7 @@ def _backend_health_on_demand_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ApplicationGatewayBackendHealthOnDemand]] = kwargs.pop("cls", None) @@ -2061,7 +2061,7 @@ def _backend_health_on_demand_initial( _backend_health_on_demand_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand'} @api_version_validation( - method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_backend_health_on_demand( @@ -2107,7 +2107,7 @@ def begin_backend_health_on_demand( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGatewayBackendHealthOnDemand] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2154,7 +2154,7 @@ def get_long_running_output(pipeline_response): begin_backend_health_on_demand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -2192,7 +2192,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) @@ -2245,7 +2245,7 @@ def build_express_route_circuit_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -2279,7 +2279,7 @@ def build_express_route_circuit_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2310,7 +2310,7 @@ def build_express_route_circuit_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2341,7 +2341,7 @@ def build_express_route_circuit_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2404,7 +2404,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) @@ -2470,7 +2470,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_authorizations_delete_request( @@ -2544,7 +2544,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2617,7 +2617,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -2686,7 +2686,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) request = build_express_route_circuit_authorizations_get_request( @@ -2742,7 +2742,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AuthorizationListResult] = kwargs.pop("cls", None) error_map = { @@ -2807,7 +2807,7 @@ def build_express_route_circuit_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -2841,7 +2841,7 @@ def build_express_route_circuit_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2872,7 +2872,7 @@ def build_express_route_circuit_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2903,7 +2903,7 @@ def build_express_route_circuit_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2966,7 +2966,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) @@ -3032,7 +3032,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_peerings_delete_request( @@ -3105,7 +3105,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -3178,7 +3178,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -3247,7 +3247,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) request = build_express_route_circuit_peerings_get_request( @@ -3303,7 +3303,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -3368,7 +3368,7 @@ def build_express_route_circuits_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -3401,7 +3401,7 @@ def build_express_route_circuits_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3431,7 +3431,7 @@ def build_express_route_circuits_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3461,7 +3461,7 @@ def build_express_route_circuits_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3488,7 +3488,7 @@ def build_express_route_circuits_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3610,7 +3610,7 @@ def build_express_route_circuits_list_arp_table_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3647,7 +3647,7 @@ def build_express_route_circuits_list_routes_table_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3684,7 +3684,7 @@ def build_express_route_circuits_list_routes_table_summary_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3749,7 +3749,7 @@ def build_express_route_circuits_get_peering_stats_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3780,7 +3780,7 @@ def build_express_route_circuits_get_stats_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3810,7 +3810,7 @@ def build_express_route_circuits_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -3875,7 +3875,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) @@ -3940,7 +3940,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuits_delete_request( @@ -4008,7 +4008,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -4076,7 +4076,7 @@ def begin_delete(self, resource_group_name: str, circuit_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -4140,7 +4140,7 @@ def get(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> _mo _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) request = build_express_route_circuits_get_request( @@ -4190,7 +4190,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Exp _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitListResult] = kwargs.pop("cls", None) error_map = { @@ -4261,7 +4261,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.ExpressRouteCircuit"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitListResult] = kwargs.pop("cls", None) error_map = { @@ -4614,7 +4614,7 @@ def _list_arp_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_arp_table_request( @@ -4667,7 +4667,7 @@ def _list_routes_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_routes_table_request( @@ -4720,7 +4720,7 @@ def _list_routes_table_summary_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]] = kwargs.pop("cls", None) request = build_express_route_circuits_list_routes_table_summary_request( @@ -4821,7 +4821,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_arp_table( @@ -4855,7 +4855,7 @@ def begin_list_arp_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4900,7 +4900,7 @@ def get_long_running_output(pipeline_response): begin_list_arp_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_routes_table( @@ -4934,7 +4934,7 @@ def begin_list_routes_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4979,7 +4979,7 @@ def get_long_running_output(pipeline_response): begin_list_routes_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_routes_table_summary( @@ -5013,7 +5013,7 @@ def begin_list_routes_table_summary( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableSummaryListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -5137,7 +5137,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_peering_stats( @@ -5167,7 +5167,7 @@ def get_peering_stats( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) request = build_express_route_circuits_get_peering_stats_request( @@ -5204,7 +5204,7 @@ def get_peering_stats( get_peering_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_stats(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> _models.ExpressRouteCircuitStats: @@ -5230,7 +5230,7 @@ def get_stats(self, resource_group_name: str, circuit_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) request = build_express_route_circuits_get_stats_request( @@ -5266,7 +5266,7 @@ def get_stats(self, resource_group_name: str, circuit_name: str, **kwargs: Any) get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -5300,7 +5300,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) @@ -5351,7 +5351,7 @@ def build_express_route_service_providers_list_request(subscription_id: str, **k _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5406,7 +5406,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExpressRouteServiceProvider"] _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteServiceProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -5469,7 +5469,7 @@ def build_load_balancers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -5502,7 +5502,7 @@ def build_load_balancers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5537,7 +5537,7 @@ def build_load_balancers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5567,7 +5567,7 @@ def build_load_balancers_list_request(resource_group_name: str, subscription_id: _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5594,7 +5594,7 @@ def build_load_balancers_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5652,7 +5652,7 @@ def build_load_balancers_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -5685,7 +5685,7 @@ def build_load_balancers_swap_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -5717,7 +5717,7 @@ def build_load_balancers_list_inbound_nat_rule_port_mappings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -5751,7 +5751,7 @@ def build_load_balancers_migrate_to_ip_based_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -5818,7 +5818,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) @@ -5883,7 +5883,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_load_balancers_delete_request( @@ -5950,7 +5950,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -6018,7 +6018,7 @@ def begin_delete(self, resource_group_name: str, load_balancer_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -6086,7 +6086,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) request = build_load_balancers_get_request( @@ -6136,7 +6136,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Loa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -6206,7 +6206,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.LoadBalancer"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -6411,7 +6411,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -6449,7 +6449,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) @@ -6510,7 +6510,7 @@ def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -6553,7 +6553,7 @@ def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-return-st _swap_public_ip_addresses_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses'} @api_version_validation( - method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_swap_public_ip_addresses( @@ -6584,7 +6584,7 @@ def begin_swap_public_ip_addresses( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -6645,7 +6645,7 @@ def _list_inbound_nat_rule_port_mappings_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = kwargs.pop("cls", None) @@ -6698,7 +6698,7 @@ def _list_inbound_nat_rule_port_mappings_initial( _list_inbound_nat_rule_port_mappings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_inbound_nat_rule_port_mappings( @@ -6741,7 +6741,7 @@ def begin_list_inbound_nat_rule_port_mappings( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -6788,7 +6788,7 @@ def get_long_running_output(pipeline_response): begin_list_inbound_nat_rule_port_mappings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping'} @api_version_validation( - method_valid_on=['2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def migrate_to_ip_based( @@ -6827,7 +6827,7 @@ def migrate_to_ip_based( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MigratedPools] = kwargs.pop("cls", None) @@ -6883,7 +6883,7 @@ def build_local_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -6918,7 +6918,7 @@ def build_local_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6950,7 +6950,7 @@ def build_local_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6982,7 +6982,7 @@ def build_local_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7046,7 +7046,7 @@ def build_local_network_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -7113,7 +7113,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) @@ -7178,7 +7178,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_local_network_gateways_delete_request( @@ -7246,7 +7246,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -7314,7 +7314,7 @@ def begin_delete(self, resource_group_name: str, local_network_gateway_name: str _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -7380,7 +7380,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) request = build_local_network_gateways_get_request( @@ -7430,7 +7430,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Loc _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LocalNetworkGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -7637,7 +7637,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -7675,7 +7675,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) @@ -7728,7 +7728,7 @@ def build_network_interfaces_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -7761,7 +7761,7 @@ def build_network_interfaces_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7796,7 +7796,7 @@ def build_network_interfaces_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7869,7 +7869,7 @@ def build_network_interfaces_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7896,7 +7896,7 @@ def build_network_interfaces_list_all_request(subscription_id: str, **kwargs: An _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7990,7 +7990,7 @@ def build_network_interfaces_get_effective_route_table_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -8020,7 +8020,7 @@ def build_network_interfaces_list_effective_network_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -8171,7 +8171,7 @@ def build_network_interfaces_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -8211,7 +8211,7 @@ def build_network_interfaces_get_cloud_service_network_interface_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -8245,7 +8245,7 @@ def build_network_interfaces_list_cloud_service_network_interfaces_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -8275,7 +8275,7 @@ def build_network_interfaces_list_cloud_service_role_instance_network_interfaces _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -8338,7 +8338,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) @@ -8403,7 +8403,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_interfaces_delete_request( @@ -8470,7 +8470,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -8538,7 +8538,7 @@ def begin_delete(self, resource_group_name: str, network_interface_name: str, ** _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -8606,7 +8606,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) request = build_network_interfaces_get_request( @@ -8733,7 +8733,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Net _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -8803,7 +8803,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkInterface"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -9032,7 +9032,7 @@ def _get_effective_route_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.EffectiveRouteListResult]] = kwargs.pop("cls", None) request = build_network_interfaces_get_effective_route_table_request( @@ -9083,7 +9083,7 @@ def _list_effective_network_security_groups_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.EffectiveNetworkSecurityGroupListResult]] = kwargs.pop("cls", None) request = build_network_interfaces_list_effective_network_security_groups_request( @@ -9186,7 +9186,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_effective_route_table( @@ -9215,7 +9215,7 @@ def begin_get_effective_route_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EffectiveRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -9258,7 +9258,7 @@ def get_long_running_output(pipeline_response): begin_get_effective_route_table.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_effective_network_security_groups( @@ -9287,7 +9287,7 @@ def begin_list_effective_network_security_groups( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EffectiveNetworkSecurityGroupListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -9412,7 +9412,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_virtual_machine_scale_set_ip_configuration( @@ -9496,7 +9496,7 @@ def get_virtual_machine_scale_set_ip_configuration( get_virtual_machine_scale_set_ip_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_ip_configurations( @@ -9594,7 +9594,7 @@ def get_next(next_link=None): list_virtual_machine_scale_set_ip_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -9632,7 +9632,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) @@ -9680,7 +9680,7 @@ def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_cloud_service_network_interface( @@ -9721,7 +9721,7 @@ def get_cloud_service_network_interface( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) request = build_network_interfaces_get_cloud_service_network_interface_request( @@ -9760,7 +9760,7 @@ def get_cloud_service_network_interface( get_cloud_service_network_interface.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_network_interfaces( @@ -9780,7 +9780,7 @@ def list_cloud_service_network_interfaces( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -9840,7 +9840,7 @@ def get_next(next_link=None): list_cloud_service_network_interfaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_role_instance_network_interfaces( @@ -9862,7 +9862,7 @@ def list_cloud_service_role_instance_network_interfaces( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -9928,7 +9928,7 @@ def build_network_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -9961,7 +9961,7 @@ def build_network_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -9996,7 +9996,7 @@ def build_network_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10028,7 +10028,7 @@ def build_network_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10055,7 +10055,7 @@ def build_network_security_groups_list_all_request(subscription_id: str, **kwarg _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10115,7 +10115,7 @@ def build_network_security_groups_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -10180,7 +10180,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) @@ -10245,7 +10245,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_security_groups_delete_request( @@ -10313,7 +10313,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -10383,7 +10383,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -10451,7 +10451,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) request = build_network_security_groups_get_request( @@ -10503,7 +10503,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Net _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -10575,7 +10575,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkSecurityGroup"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -10781,7 +10781,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -10819,7 +10819,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) @@ -10872,7 +10872,7 @@ def build_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -10905,7 +10905,7 @@ def build_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10940,7 +10940,7 @@ def build_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10972,7 +10972,7 @@ def build_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -10999,7 +10999,7 @@ def build_public_ip_addresses_list_all_request(subscription_id: str, **kwargs: A _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -11177,7 +11177,7 @@ def build_public_ip_addresses_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -11219,7 +11219,7 @@ def build_public_ip_addresses_get_cloud_service_public_ip_address_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -11255,7 +11255,7 @@ def build_public_ip_addresses_list_cloud_service_public_ip_addresses_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -11291,7 +11291,7 @@ def build_public_ip_addresses_list_cloud_service_role_instance_public_ip_address _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -11324,7 +11324,7 @@ def build_public_ip_addresses_ddos_protection_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -11386,7 +11386,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) @@ -11451,7 +11451,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_public_ip_addresses_delete_request( @@ -11522,7 +11522,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -11590,7 +11590,7 @@ def begin_delete(self, resource_group_name: str, public_ip_address_name: str, ** _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -11658,7 +11658,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) request = build_public_ip_addresses_get_request( @@ -11708,7 +11708,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pub _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -11778,7 +11778,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.PublicIPAddress"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -11983,7 +11983,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_virtual_machine_scale_set_public_ip_address( @@ -12071,7 +12071,7 @@ def get_virtual_machine_scale_set_public_ip_address( get_virtual_machine_scale_set_public_ip_address.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_public_ip_addresses( @@ -12151,7 +12151,7 @@ def get_next(next_link=None): list_virtual_machine_scale_set_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_virtual_machine_scale_set_vm_public_ip_addresses( @@ -12247,7 +12247,7 @@ def get_next(next_link=None): list_virtual_machine_scale_set_vm_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -12285,7 +12285,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) @@ -12333,7 +12333,7 @@ def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_cloud_service_public_ip_address( @@ -12380,7 +12380,7 @@ def get_cloud_service_public_ip_address( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) request = build_public_ip_addresses_get_cloud_service_public_ip_address_request( @@ -12421,7 +12421,7 @@ def get_cloud_service_public_ip_address( get_cloud_service_public_ip_address.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_public_ip_addresses( @@ -12441,7 +12441,7 @@ def list_cloud_service_public_ip_addresses( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -12501,7 +12501,7 @@ def get_next(next_link=None): list_cloud_service_public_ip_addresses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses'} @api_version_validation( - method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_cloud_service_role_instance_public_ip_addresses( @@ -12534,7 +12534,7 @@ def list_cloud_service_role_instance_public_ip_addresses( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPAddressListResult] = kwargs.pop("cls", None) error_map = { @@ -12610,7 +12610,7 @@ def _ddos_protection_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.PublicIpDdosProtectionStatusResult]] = kwargs.pop("cls", None) request = build_public_ip_addresses_ddos_protection_status_request( @@ -12652,7 +12652,7 @@ def _ddos_protection_status_initial( _ddos_protection_status_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_ddos_protection_status( @@ -12681,7 +12681,7 @@ def begin_ddos_protection_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIpDdosProtectionStatusResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -12729,7 +12729,7 @@ def build_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -12762,7 +12762,7 @@ def build_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -12797,7 +12797,7 @@ def build_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -12827,7 +12827,7 @@ def build_route_tables_list_request(resource_group_name: str, subscription_id: s _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -12854,7 +12854,7 @@ def build_route_tables_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -12912,7 +12912,7 @@ def build_route_tables_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -12973,7 +12973,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) @@ -13038,7 +13038,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_tables_delete_request( @@ -13100,7 +13100,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -13168,7 +13168,7 @@ def begin_delete(self, resource_group_name: str, route_table_name: str, **kwargs _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -13236,7 +13236,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) request = build_route_tables_get_request( @@ -13286,7 +13286,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Rou _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTableListResult] = kwargs.pop("cls", None) error_map = { @@ -13356,7 +13356,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.RouteTable"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteTableListResult] = kwargs.pop("cls", None) error_map = { @@ -13552,7 +13552,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -13586,7 +13586,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) @@ -13639,7 +13639,7 @@ def build_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -13673,7 +13673,7 @@ def build_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -13704,7 +13704,7 @@ def build_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -13735,7 +13735,7 @@ def build_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -13798,7 +13798,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Route] = kwargs.pop("cls", None) @@ -13864,7 +13864,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_routes_delete_request( @@ -13934,7 +13934,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Route] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -14007,7 +14007,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -14074,7 +14074,7 @@ def get(self, resource_group_name: str, route_table_name: str, route_name: str, _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Route] = kwargs.pop("cls", None) request = build_routes_get_request( @@ -14126,7 +14126,7 @@ def list(self, resource_group_name: str, route_table_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteListResult] = kwargs.pop("cls", None) error_map = { @@ -14195,7 +14195,7 @@ def build_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -14233,7 +14233,7 @@ def build_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14268,7 +14268,7 @@ def build_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14299,7 +14299,7 @@ def build_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14362,7 +14362,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) @@ -14428,7 +14428,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_rules_delete_request( @@ -14499,7 +14499,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -14572,7 +14572,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -14641,7 +14641,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) request = build_security_rules_get_request( @@ -14695,7 +14695,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -14760,7 +14760,7 @@ def build_subnets_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -14794,7 +14794,7 @@ def build_subnets_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14831,7 +14831,7 @@ def build_subnets_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14864,7 +14864,7 @@ def build_subnets_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -14894,7 +14894,7 @@ def build_subnets_prepare_network_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -14928,7 +14928,7 @@ def build_subnets_unprepare_network_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -14995,7 +14995,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) @@ -15061,7 +15061,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_subnets_delete_request( @@ -15131,7 +15131,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -15204,7 +15204,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -15281,7 +15281,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) request = build_subnets_get_request( @@ -15334,7 +15334,7 @@ def list(self, resource_group_name: str, virtual_network_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SubnetListResult] = kwargs.pop("cls", None) error_map = { @@ -15412,7 +15412,7 @@ def _prepare_network_policies_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -15457,7 +15457,7 @@ def _prepare_network_policies_initial( # pylint: disable=inconsistent-return-st _prepare_network_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies'} @api_version_validation( - method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_prepare_network_policies( @@ -15499,7 +15499,7 @@ def begin_prepare_network_policies( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -15562,7 +15562,7 @@ def _unprepare_network_policies_initial( # pylint: disable=inconsistent-return- _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -15609,7 +15609,7 @@ def _unprepare_network_policies_initial( # pylint: disable=inconsistent-return- _unprepare_network_policies_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_unprepare_network_policies( @@ -15651,7 +15651,7 @@ def begin_unprepare_network_policies( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -15699,7 +15699,7 @@ def build_usages_list_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -15755,7 +15755,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { @@ -15819,7 +15819,7 @@ def build_virtual_network_gateway_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -15854,7 +15854,7 @@ def build_virtual_network_gateway_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -15886,7 +15886,7 @@ def build_virtual_network_gateway_connections_reset_shared_key_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -15921,7 +15921,7 @@ def build_virtual_network_gateway_connections_set_shared_key_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -15956,7 +15956,7 @@ def build_virtual_network_gateway_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -15988,7 +15988,7 @@ def build_virtual_network_gateway_connections_get_shared_key_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -16020,7 +16020,7 @@ def build_virtual_network_gateway_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -16049,7 +16049,7 @@ def build_virtual_network_gateway_connections_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -16084,7 +16084,7 @@ def build_virtual_network_gateway_connections_start_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -16119,7 +16119,7 @@ def build_virtual_network_gateway_connections_stop_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -16154,7 +16154,7 @@ def build_virtual_network_gateway_connections_get_ike_sas_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -16186,7 +16186,7 @@ def build_virtual_network_gateway_connections_reset_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -16250,7 +16250,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) @@ -16315,7 +16315,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_delete_request( @@ -16364,7 +16364,7 @@ def _reset_shared_key_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ConnectionResetSharedKey]] = kwargs.pop("cls", None) @@ -16431,7 +16431,7 @@ def _set_shared_key_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) @@ -16520,7 +16520,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -16591,7 +16591,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -16672,7 +16672,7 @@ def begin_reset_shared_key( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionResetSharedKey] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -16758,7 +16758,7 @@ def begin_set_shared_key( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -16830,7 +16830,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_request( @@ -16893,7 +16893,7 @@ def get_shared_key( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_shared_key_request( @@ -16945,7 +16945,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Vir _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -17021,7 +17021,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualNetworkGatewayConnection]] = kwargs.pop("cls", None) @@ -17071,7 +17071,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -17111,7 +17111,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -17174,7 +17174,7 @@ def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -17245,7 +17245,7 @@ def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -17296,7 +17296,7 @@ def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_start_packet_capture( @@ -17335,7 +17335,7 @@ def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -17381,7 +17381,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_stop_packet_capture( @@ -17420,7 +17420,7 @@ def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -17479,7 +17479,7 @@ def _get_ike_sas_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_get_ike_sas_request( @@ -17518,7 +17518,7 @@ def _get_ike_sas_initial( _get_ike_sas_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas'} @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_ike_sas( @@ -17547,7 +17547,7 @@ def begin_get_ike_sas( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -17603,7 +17603,7 @@ def _reset_connection_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_connections_reset_connection_request( @@ -17636,7 +17636,7 @@ def _reset_connection_initial( # pylint: disable=inconsistent-return-statements _reset_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_reset_connection( @@ -17664,7 +17664,7 @@ def begin_reset_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -17710,7 +17710,7 @@ def build_virtual_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -17745,7 +17745,7 @@ def build_virtual_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -17777,7 +17777,7 @@ def build_virtual_network_gateways_generatevpnclientpackage_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -17817,7 +17817,7 @@ def build_virtual_network_gateways_reset_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -17851,7 +17851,7 @@ def build_virtual_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -17883,7 +17883,7 @@ def build_virtual_network_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -17912,7 +17912,7 @@ def build_virtual_network_gateways_generate_vpn_profile_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -17947,7 +17947,7 @@ def build_virtual_network_gateways_get_advertised_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -17985,7 +17985,7 @@ def build_virtual_network_gateways_get_bgp_peer_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18019,7 +18019,7 @@ def build_virtual_network_gateways_get_learned_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18051,7 +18051,7 @@ def build_virtual_network_gateways_get_vpn_profile_package_url_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18083,7 +18083,7 @@ def build_virtual_network_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18118,7 +18118,7 @@ def build_virtual_network_gateways_list_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18150,7 +18150,7 @@ def build_virtual_network_gateways_supported_vpn_devices_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18182,7 +18182,7 @@ def build_virtual_network_gateways_vpn_device_configuration_script_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18217,7 +18217,7 @@ def build_virtual_network_gateways_get_vpnclient_ipsec_parameters_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18249,7 +18249,7 @@ def build_virtual_network_gateways_set_vpnclient_ipsec_parameters_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18284,7 +18284,7 @@ def build_virtual_network_gateways_reset_vpn_client_shared_key_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18316,7 +18316,7 @@ def build_virtual_network_gateways_get_vpnclient_connection_health_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -18348,7 +18348,7 @@ def build_virtual_network_gateways_start_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18383,7 +18383,7 @@ def build_virtual_network_gateways_stop_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18418,7 +18418,7 @@ def build_virtual_network_gateways_disconnect_virtual_network_gateway_vpn_connec _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -18485,7 +18485,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) @@ -18550,7 +18550,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateways_delete_request( @@ -18599,7 +18599,7 @@ def _generatevpnclientpackage_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -18667,7 +18667,7 @@ def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_reset_request( @@ -18742,7 +18742,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -18812,7 +18812,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -18888,7 +18888,7 @@ def begin_generatevpnclientpackage( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -18936,7 +18936,7 @@ def get_long_running_output(pipeline_response): @api_version_validation( params_valid_on={ "parameters": ['2015-06-15'], - "gateway_vip": ['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "gateway_vip": ['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -18974,7 +18974,7 @@ def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19043,7 +19043,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_request( @@ -19094,7 +19094,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Vir _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -19170,7 +19170,7 @@ def _generate_vpn_profile_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -19233,7 +19233,7 @@ def _get_advertised_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_advertised_routes_request( @@ -19285,7 +19285,7 @@ def _get_bgp_peer_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.BgpPeerStatusListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_bgp_peer_status_request( @@ -19337,7 +19337,7 @@ def _get_learned_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_learned_routes_request( @@ -19388,7 +19388,7 @@ def _get_vpn_profile_package_url_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpn_profile_package_url_request( @@ -19443,7 +19443,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) @@ -19493,7 +19493,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_generate_vpn_profile( @@ -19531,7 +19531,7 @@ def begin_generate_vpn_profile( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -19577,7 +19577,7 @@ def get_long_running_output(pipeline_response): begin_generate_vpn_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_advertised_routes( @@ -19609,7 +19609,7 @@ def begin_get_advertised_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.GatewayRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19653,7 +19653,7 @@ def get_long_running_output(pipeline_response): begin_get_advertised_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_bgp_peer_status( @@ -19684,7 +19684,7 @@ def begin_get_bgp_peer_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpPeerStatusListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19728,7 +19728,7 @@ def get_long_running_output(pipeline_response): begin_get_bgp_peer_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_learned_routes( @@ -19758,7 +19758,7 @@ def begin_get_learned_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.GatewayRouteListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19801,7 +19801,7 @@ def get_long_running_output(pipeline_response): begin_get_learned_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_vpn_profile_package_url( @@ -19829,7 +19829,7 @@ def begin_get_vpn_profile_package_url( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -19872,7 +19872,7 @@ def get_long_running_output(pipeline_response): begin_get_vpn_profile_package_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -19911,7 +19911,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -19957,7 +19957,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_connections( @@ -19979,7 +19979,7 @@ def list_connections( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayListConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -20039,7 +20039,7 @@ def get_next(next_link=None): list_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def supported_vpn_devices(self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any) -> str: @@ -20065,7 +20065,7 @@ def supported_vpn_devices(self, resource_group_name: str, virtual_network_gatewa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) request = build_virtual_network_gateways_supported_vpn_devices_request( @@ -20101,7 +20101,7 @@ def supported_vpn_devices(self, resource_group_name: str, virtual_network_gatewa supported_vpn_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def vpn_device_configuration_script( @@ -20140,7 +20140,7 @@ def vpn_device_configuration_script( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) @@ -20201,7 +20201,7 @@ def _get_vpnclient_ipsec_parameters_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpnclient_ipsec_parameters_request( @@ -20254,7 +20254,7 @@ def _set_vpnclient_ipsec_parameters_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnClientIPsecParameters]] = kwargs.pop("cls", None) @@ -20304,7 +20304,7 @@ def _set_vpnclient_ipsec_parameters_initial( _set_vpnclient_ipsec_parameters_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_vpnclient_ipsec_parameters( @@ -20335,7 +20335,7 @@ def begin_get_vpnclient_ipsec_parameters( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -20378,7 +20378,7 @@ def get_long_running_output(pipeline_response): begin_get_vpnclient_ipsec_parameters.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_set_vpnclient_ipsec_parameters( @@ -20420,7 +20420,7 @@ def begin_set_vpnclient_ipsec_parameters( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -20479,7 +20479,7 @@ def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent-return _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateways_reset_vpn_client_shared_key_request( @@ -20511,7 +20511,7 @@ def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent-return _reset_vpn_client_shared_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_reset_vpn_client_shared_key( @@ -20539,7 +20539,7 @@ def begin_reset_vpn_client_shared_key( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -20593,7 +20593,7 @@ def _get_vpnclient_connection_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnClientConnectionHealthDetailListResult]] = kwargs.pop("cls", None) request = build_virtual_network_gateways_get_vpnclient_connection_health_request( @@ -20631,7 +20631,7 @@ def _get_vpnclient_connection_health_initial( _get_vpnclient_connection_health_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_vpnclient_connection_health( @@ -20661,7 +20661,7 @@ def begin_get_vpnclient_connection_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnClientConnectionHealthDetailListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -20721,7 +20721,7 @@ def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -20792,7 +20792,7 @@ def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -20843,7 +20843,7 @@ def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_start_packet_capture( @@ -20881,7 +20881,7 @@ def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -20927,7 +20927,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture'} @api_version_validation( - method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_stop_packet_capture( @@ -20964,7 +20964,7 @@ def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -21027,7 +21027,7 @@ def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint: disa _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -21071,7 +21071,7 @@ def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint: disa _disconnect_virtual_network_gateway_vpn_connections_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections'} @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_disconnect_virtual_network_gateway_vpn_connections( @@ -21108,7 +21108,7 @@ def begin_disconnect_virtual_network_gateway_vpn_connections( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -21157,7 +21157,7 @@ def build_virtual_networks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -21190,7 +21190,7 @@ def build_virtual_networks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21225,7 +21225,7 @@ def build_virtual_networks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21255,7 +21255,7 @@ def build_virtual_networks_list_request(resource_group_name: str, subscription_i _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21282,7 +21282,7 @@ def build_virtual_networks_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21340,7 +21340,7 @@ def build_virtual_networks_check_ip_address_availability_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21371,7 +21371,7 @@ def build_virtual_networks_list_usage_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21401,7 +21401,7 @@ def build_virtual_networks_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -21470,7 +21470,7 @@ def build_virtual_networks_list_ddos_protection_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -21536,7 +21536,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) @@ -21601,7 +21601,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_networks_delete_request( @@ -21668,7 +21668,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -21736,7 +21736,7 @@ def begin_delete(self, resource_group_name: str, virtual_network_name: str, **kw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -21804,7 +21804,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_virtual_networks_get_request( @@ -21854,7 +21854,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Vir _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -21924,7 +21924,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -22129,7 +22129,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def check_ip_address_availability( @@ -22159,7 +22159,7 @@ def check_ip_address_availability( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IPAddressAvailabilityResult] = kwargs.pop("cls", None) request = build_virtual_networks_check_ip_address_availability_request( @@ -22196,7 +22196,7 @@ def check_ip_address_availability( check_ip_address_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability'} @api_version_validation( - method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_usage( @@ -22217,7 +22217,7 @@ def list_usage( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkListUsageResult] = kwargs.pop("cls", None) error_map = { @@ -22277,7 +22277,7 @@ def get_next(next_link=None): list_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -22315,7 +22315,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) @@ -22446,7 +22446,7 @@ def _list_ddos_protection_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VirtualNetworkDdosProtectionStatusResult]] = kwargs.pop("cls", None) request = build_virtual_networks_list_ddos_protection_status_request( @@ -22486,7 +22486,7 @@ def _list_ddos_protection_status_initial( _list_ddos_protection_status_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_ddos_protection_status( @@ -22526,7 +22526,7 @@ def begin_list_ddos_protection_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkDdosProtectionStatusResult] = kwargs.pop("cls", None) error_map = { @@ -22633,7 +22633,7 @@ def build_application_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -22668,7 +22668,7 @@ def build_application_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -22700,7 +22700,7 @@ def build_application_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -22732,7 +22732,7 @@ def build_application_security_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -22759,7 +22759,7 @@ def build_application_security_groups_list_all_request(subscription_id: str, **k _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -22821,7 +22821,7 @@ def build_application_security_groups_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -22888,7 +22888,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) @@ -22953,7 +22953,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_security_groups_delete_request( @@ -23021,7 +23021,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -23091,7 +23091,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -23157,7 +23157,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) request = build_application_security_groups_get_request( @@ -23208,7 +23208,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.App _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -23280,7 +23280,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.ApplicationSecurityGroup" _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationSecurityGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -23486,7 +23486,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -23524,7 +23524,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) @@ -23575,7 +23575,7 @@ def build_available_endpoint_services_list_request(location: str, subscription_i _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23634,7 +23634,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.EndpointServic _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.EndpointServicesListResult] = kwargs.pop("cls", None) error_map = { @@ -23696,7 +23696,7 @@ def build_bgp_service_communities_list_request(subscription_id: str, **kwargs: A _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23750,7 +23750,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.BgpServiceCommunity"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpServiceCommunityListResult] = kwargs.pop("cls", None) error_map = { @@ -23819,7 +23819,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -23859,7 +23859,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23894,7 +23894,7 @@ def build_connection_monitors_query_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23929,7 +23929,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23964,7 +23964,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -23999,7 +23999,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -24030,7 +24030,7 @@ def build_connection_monitors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -24064,7 +24064,7 @@ def build_connection_monitors_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -24133,7 +24133,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) @@ -24201,7 +24201,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_delete_request( @@ -24248,7 +24248,7 @@ def _query_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) request = build_connection_monitors_query_request( @@ -24303,7 +24303,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_start_request( @@ -24350,7 +24350,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connection_monitors_stop_request( @@ -24385,7 +24385,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements @api_version_validation( params_valid_on={ - "migrate": ['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "migrate": ['2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -24434,7 +24434,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -24509,7 +24509,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -24580,7 +24580,7 @@ def begin_query( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -24651,7 +24651,7 @@ def begin_start( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -24720,7 +24720,7 @@ def begin_stop( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -24790,7 +24790,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) request = build_connection_monitors_get_request( @@ -24848,7 +24848,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectionMonitorListResult] = kwargs.pop("cls", None) error_map = { @@ -24909,7 +24909,7 @@ def get_next(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -24950,7 +24950,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) @@ -25009,7 +25009,7 @@ def build_default_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25040,7 +25040,7 @@ def build_default_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25112,7 +25112,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) request = build_default_security_rules_get_request( @@ -25166,7 +25166,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -25231,7 +25231,7 @@ def build_inbound_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -25265,7 +25265,7 @@ def build_inbound_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25302,7 +25302,7 @@ def build_inbound_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25335,7 +25335,7 @@ def build_inbound_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25398,7 +25398,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) @@ -25464,7 +25464,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_inbound_nat_rules_delete_request( @@ -25535,7 +25535,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -25608,7 +25608,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -25685,7 +25685,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) request = build_inbound_nat_rules_get_request( @@ -25740,7 +25740,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.InboundNatRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -25809,7 +25809,7 @@ def build_load_balancer_backend_address_pools_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25840,7 +25840,7 @@ def build_load_balancer_backend_address_pools_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25874,7 +25874,7 @@ def build_load_balancer_backend_address_pools_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -25912,7 +25912,7 @@ def build_load_balancer_backend_address_pools_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -25985,7 +25985,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) request = build_load_balancer_backend_address_pools_get_request( @@ -26039,7 +26039,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerBackendAddressPoolListResult] = kwargs.pop("cls", None) error_map = { @@ -26117,7 +26117,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) @@ -26183,7 +26183,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_load_balancer_backend_address_pools_delete_request( @@ -26216,7 +26216,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'} @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_create_or_update( @@ -26258,7 +26258,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -26305,7 +26305,7 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'} @api_version_validation( - method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -26334,7 +26334,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -26385,7 +26385,7 @@ def build_load_balancer_frontend_ip_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26418,7 +26418,7 @@ def build_load_balancer_frontend_ip_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26490,7 +26490,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FrontendIPConfiguration] = kwargs.pop("cls", None) request = build_load_balancer_frontend_ip_configurations_get_request( @@ -26546,7 +26546,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerFrontendIPConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -26615,7 +26615,7 @@ def build_load_balancer_load_balancing_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26646,7 +26646,7 @@ def build_load_balancer_load_balancing_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26718,7 +26718,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancingRule] = kwargs.pop("cls", None) request = build_load_balancer_load_balancing_rules_get_request( @@ -26772,7 +26772,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerLoadBalancingRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -26837,7 +26837,7 @@ def build_load_balancer_network_interfaces_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26899,7 +26899,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceListResult] = kwargs.pop("cls", None) error_map = { @@ -26964,7 +26964,7 @@ def build_load_balancer_probes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -26995,7 +26995,7 @@ def build_load_balancer_probes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27065,7 +27065,7 @@ def get(self, resource_group_name: str, load_balancer_name: str, probe_name: str _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.Probe] = kwargs.pop("cls", None) request = build_load_balancer_probes_get_request( @@ -27117,7 +27117,7 @@ def list(self, resource_group_name: str, load_balancer_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerProbeListResult] = kwargs.pop("cls", None) error_map = { @@ -27186,7 +27186,7 @@ def build_network_interface_ip_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27217,7 +27217,7 @@ def build_network_interface_ip_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27289,7 +27289,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) request = build_network_interface_ip_configurations_get_request( @@ -27345,7 +27345,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -27410,7 +27410,7 @@ def build_network_interface_load_balancers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27472,7 +27472,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceLoadBalancerListResult] = kwargs.pop("cls", None) error_map = { @@ -27537,7 +27537,7 @@ def build_network_watchers_check_connectivity_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27570,7 +27570,7 @@ def build_network_watchers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27600,7 +27600,7 @@ def build_network_watchers_get_azure_reachability_report_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27633,7 +27633,7 @@ def build_network_watchers_get_flow_log_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27666,7 +27666,7 @@ def build_network_watchers_get_next_hop_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27699,7 +27699,7 @@ def build_network_watchers_get_troubleshooting_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27732,7 +27732,7 @@ def build_network_watchers_get_troubleshooting_result_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27765,7 +27765,7 @@ def build_network_watchers_get_vm_security_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27798,7 +27798,7 @@ def build_network_watchers_list_available_providers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27831,7 +27831,7 @@ def build_network_watchers_set_flow_log_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27864,7 +27864,7 @@ def build_network_watchers_verify_ip_flow_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27897,7 +27897,7 @@ def build_network_watchers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27930,7 +27930,7 @@ def build_network_watchers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -27960,7 +27960,7 @@ def build_network_watchers_get_topology_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -27991,7 +27991,7 @@ def build_network_watchers_list_request(resource_group_name: str, subscription_i _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -28018,7 +28018,7 @@ def build_network_watchers_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -28043,7 +28043,7 @@ def build_network_watchers_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -28076,7 +28076,7 @@ def build_network_watchers_get_network_configuration_diagnostic_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -28141,7 +28141,7 @@ def _check_connectivity_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityInformation] = kwargs.pop("cls", None) @@ -28207,7 +28207,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_watchers_delete_request( @@ -28257,7 +28257,7 @@ def _get_azure_reachability_report_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureReachabilityReport] = kwargs.pop("cls", None) @@ -28327,7 +28327,7 @@ def _get_flow_log_status_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) @@ -28397,7 +28397,7 @@ def _get_next_hop_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NextHopResult] = kwargs.pop("cls", None) @@ -28467,7 +28467,7 @@ def _get_troubleshooting_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) @@ -28537,7 +28537,7 @@ def _get_troubleshooting_result_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) @@ -28607,7 +28607,7 @@ def _get_vm_security_rules_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityGroupViewResult] = kwargs.pop("cls", None) @@ -28677,7 +28677,7 @@ def _list_available_providers_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableProvidersList] = kwargs.pop("cls", None) @@ -28747,7 +28747,7 @@ def _set_flow_log_configuration_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) @@ -28817,7 +28817,7 @@ def _verify_ip_flow_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VerificationIPFlowResult] = kwargs.pop("cls", None) @@ -28907,7 +28907,7 @@ def begin_check_connectivity( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityInformation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -28975,7 +28975,7 @@ def begin_delete(self, resource_group_name: str, network_watcher_name: str, **kw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -29055,7 +29055,7 @@ def begin_get_azure_reachability_report( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureReachabilityReport] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29137,7 +29137,7 @@ def begin_get_flow_log_status( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29218,7 +29218,7 @@ def begin_get_next_hop( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NextHopResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29300,7 +29300,7 @@ def begin_get_troubleshooting( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29382,7 +29382,7 @@ def begin_get_troubleshooting_result( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TroubleshootingResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29464,7 +29464,7 @@ def begin_get_vm_security_rules( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityGroupViewResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29547,7 +29547,7 @@ def begin_list_available_providers( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableProvidersList] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29629,7 +29629,7 @@ def begin_set_flow_log_configuration( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLogInformation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29711,7 +29711,7 @@ def begin_verify_ip_flow( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VerificationIPFlowResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -29792,7 +29792,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) @@ -29868,7 +29868,7 @@ def get(self, resource_group_name: str, network_watcher_name: str, **kwargs: Any _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) request = build_network_watchers_get_request( @@ -29940,7 +29940,7 @@ def get_topology( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Topology] = kwargs.pop("cls", None) @@ -30002,7 +30002,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Net _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -30073,7 +30073,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkWatcher"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkWatcherListResult] = kwargs.pop("cls", None) error_map = { @@ -30167,7 +30167,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) @@ -30233,7 +30233,7 @@ def _get_network_configuration_diagnostic_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = kwargs.pop("cls", None) @@ -30286,7 +30286,7 @@ def _get_network_configuration_diagnostic_initial( _get_network_configuration_diagnostic_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_network_configuration_diagnostic( @@ -30330,7 +30330,7 @@ def begin_get_network_configuration_diagnostic( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -30379,7 +30379,7 @@ def build_operations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30425,7 +30425,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -30487,7 +30487,7 @@ def build_packet_captures_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -30521,7 +30521,7 @@ def build_packet_captures_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30552,7 +30552,7 @@ def build_packet_captures_get_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30583,7 +30583,7 @@ def build_packet_captures_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30614,7 +30614,7 @@ def build_packet_captures_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30645,7 +30645,7 @@ def build_packet_captures_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -30708,7 +30708,7 @@ def _create_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) @@ -30771,7 +30771,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_packet_captures_delete_request( @@ -30818,7 +30818,7 @@ def _get_status_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) request = build_packet_captures_get_status_request( @@ -30873,7 +30873,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_packet_captures_stop_request( @@ -30946,7 +30946,7 @@ def begin_create( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -31019,7 +31019,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -31089,7 +31089,7 @@ def begin_get_status( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -31159,7 +31159,7 @@ def begin_stop( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -31228,7 +31228,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) request = build_packet_captures_get_request( @@ -31284,7 +31284,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PacketCaptureListResult] = kwargs.pop("cls", None) error_map = { @@ -31350,7 +31350,7 @@ def build_route_filter_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -31384,7 +31384,7 @@ def build_route_filter_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -31449,7 +31449,7 @@ def build_route_filter_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -31480,7 +31480,7 @@ def build_route_filter_rules_list_by_route_filter_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -31543,7 +31543,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) @@ -31609,7 +31609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_filter_rules_delete_request( @@ -31748,7 +31748,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -31821,7 +31821,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -31977,7 +31977,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) request = build_route_filter_rules_get_request( @@ -32031,7 +32031,7 @@ def list_by_route_filter( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -32096,7 +32096,7 @@ def build_route_filters_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -32129,7 +32129,7 @@ def build_route_filters_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -32197,7 +32197,7 @@ def build_route_filters_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -32227,7 +32227,7 @@ def build_route_filters_list_request(subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -32252,7 +32252,7 @@ def build_route_filters_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -32281,7 +32281,7 @@ def build_route_filters_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -32346,7 +32346,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) @@ -32411,7 +32411,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_filters_delete_request( @@ -32543,7 +32543,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -32611,7 +32611,7 @@ def begin_delete(self, resource_group_name: str, route_filter_name: str, **kwarg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -32761,7 +32761,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) request = build_route_filters_get_request( @@ -32809,7 +32809,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.RouteFilter"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterListResult] = kwargs.pop("cls", None) error_map = { @@ -32880,7 +32880,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteFilterListResult] = kwargs.pop("cls", None) error_map = { @@ -32939,7 +32939,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -32973,7 +32973,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) @@ -33032,7 +33032,7 @@ def build_virtual_network_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -33076,7 +33076,7 @@ def build_virtual_network_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33113,7 +33113,7 @@ def build_virtual_network_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33146,7 +33146,7 @@ def build_virtual_network_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33211,7 +33211,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) @@ -33278,7 +33278,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_peerings_delete_request( @@ -33312,7 +33312,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @api_version_validation( params_valid_on={ - "sync_remote_address_space": ['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "sync_remote_address_space": ['2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -33362,7 +33362,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -33436,7 +33436,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -33505,7 +33505,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) request = build_virtual_network_peerings_get_request( @@ -33561,7 +33561,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -33626,7 +33626,7 @@ def build_azure_firewalls_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -33661,7 +33661,7 @@ def build_azure_firewalls_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33691,7 +33691,7 @@ def build_azure_firewalls_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33719,7 +33719,7 @@ def build_azure_firewalls_list_request(resource_group_name: str, subscription_id _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33746,7 +33746,7 @@ def build_azure_firewalls_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33804,7 +33804,7 @@ def build_azure_firewalls_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -33837,7 +33837,7 @@ def build_azure_firewalls_list_learned_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -33867,7 +33867,7 @@ def build_azure_firewalls_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -33934,7 +33934,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) @@ -33999,7 +33999,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_azure_firewalls_delete_request( @@ -34066,7 +34066,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -34134,7 +34134,7 @@ def begin_delete(self, resource_group_name: str, azure_firewall_name: str, **kwa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -34198,7 +34198,7 @@ def get(self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any) _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) request = build_azure_firewalls_get_request( @@ -34247,7 +34247,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Azu _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallListResult] = kwargs.pop("cls", None) error_map = { @@ -34317,7 +34317,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.AzureFirewall"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallListResult] = kwargs.pop("cls", None) error_map = { @@ -34478,7 +34478,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.AzureFirewall]] = kwargs.pop("cls", None) @@ -34528,7 +34528,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -34566,7 +34566,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -34625,7 +34625,7 @@ def _list_learned_prefixes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.IPPrefixesList]] = kwargs.pop("cls", None) request = build_azure_firewalls_list_learned_prefixes_request( @@ -34680,7 +34680,7 @@ def _packet_capture_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -34727,7 +34727,7 @@ def _packet_capture_initial( # pylint: disable=inconsistent-return-statements _packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_learned_prefixes( @@ -34755,7 +34755,7 @@ def begin_list_learned_prefixes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IPPrefixesList] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -34798,7 +34798,7 @@ def get_long_running_output(pipeline_response): begin_list_learned_prefixes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_packet_capture( @@ -34835,7 +34835,7 @@ def begin_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -34884,7 +34884,7 @@ def build_ddos_protection_plans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -34917,7 +34917,7 @@ def build_ddos_protection_plans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -34947,7 +34947,7 @@ def build_ddos_protection_plans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -34975,7 +34975,7 @@ def build_ddos_protection_plans_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -35000,7 +35000,7 @@ def build_ddos_protection_plans_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -35062,7 +35062,7 @@ def build_ddos_protection_plans_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -35127,7 +35127,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) @@ -35192,7 +35192,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ddos_protection_plans_delete_request( @@ -35264,7 +35264,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -35332,7 +35332,7 @@ def begin_delete(self, resource_group_name: str, ddos_protection_plan_name: str, _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -35398,7 +35398,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) request = build_ddos_protection_plans_get_request( @@ -35445,7 +35445,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DdosProtectionPlan"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlanListResult] = kwargs.pop("cls", None) error_map = { @@ -35516,7 +35516,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosProtectionPlanListResult] = kwargs.pop("cls", None) error_map = { @@ -35723,7 +35723,7 @@ def get_long_running_output(pipeline_response): begin_update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -35761,7 +35761,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) @@ -35819,7 +35819,7 @@ def build_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -35859,7 +35859,7 @@ def build_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -35896,7 +35896,7 @@ def build_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -35928,7 +35928,7 @@ def build_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -35993,7 +35993,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) @@ -36060,7 +36060,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_circuit_connections_delete_request( @@ -36138,7 +36138,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -36215,7 +36215,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -36287,7 +36287,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) request = build_express_route_circuit_connections_get_request( @@ -36325,7 +36325,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list( @@ -36350,7 +36350,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -36416,7 +36416,7 @@ def build_express_route_cross_connection_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -36450,7 +36450,7 @@ def build_express_route_cross_connection_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -36481,7 +36481,7 @@ def build_express_route_cross_connection_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -36512,7 +36512,7 @@ def build_express_route_cross_connection_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -36575,7 +36575,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) @@ -36641,7 +36641,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_cross_connection_peerings_delete_request( @@ -36715,7 +36715,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -36788,7 +36788,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -36857,7 +36857,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) request = build_express_route_cross_connection_peerings_get_request( @@ -36913,7 +36913,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionPeeringList] = kwargs.pop("cls", None) error_map = { @@ -36978,7 +36978,7 @@ def build_express_route_cross_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -37016,7 +37016,7 @@ def build_express_route_cross_connections_list_arp_table_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37053,7 +37053,7 @@ def build_express_route_cross_connections_list_routes_table_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37090,7 +37090,7 @@ def build_express_route_cross_connections_list_routes_table_summary_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37155,7 +37155,7 @@ def build_express_route_cross_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37183,7 +37183,7 @@ def build_express_route_cross_connections_list_request(subscription_id: str, **k _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37210,7 +37210,7 @@ def build_express_route_cross_connections_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -37239,7 +37239,7 @@ def build_express_route_cross_connections_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -37304,7 +37304,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) @@ -37365,7 +37365,7 @@ def _list_arp_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) request = build_express_route_cross_connections_list_arp_table_request( @@ -37418,7 +37418,7 @@ def _list_routes_table_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) request = build_express_route_cross_connections_list_routes_table_request( @@ -37471,7 +37471,7 @@ def _list_routes_table_summary_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]] = kwargs.pop( "cls", None ) @@ -37616,7 +37616,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -37693,7 +37693,7 @@ def begin_list_arp_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -37769,7 +37769,7 @@ def begin_list_routes_table( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -37845,7 +37845,7 @@ def begin_list_routes_table_summary( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -38002,7 +38002,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) request = build_express_route_cross_connections_get_request( @@ -38051,7 +38051,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExpressRouteCrossConnection"] _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -38126,7 +38126,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -38185,7 +38185,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -38223,7 +38223,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) @@ -38276,7 +38276,7 @@ def build_hub_virtual_network_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38307,7 +38307,7 @@ def build_hub_virtual_network_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38337,7 +38337,7 @@ def build_hub_virtual_network_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -38371,7 +38371,7 @@ def build_hub_virtual_network_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38444,7 +38444,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) request = build_hub_virtual_network_connections_get_request( @@ -38500,7 +38500,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListHubVirtualNetworkConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -38578,7 +38578,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) @@ -38644,7 +38644,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_hub_virtual_network_connections_delete_request( @@ -38677,7 +38677,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_create_or_update( @@ -38722,7 +38722,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -38769,7 +38769,7 @@ def get_long_running_output(pipeline_response): begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -38798,7 +38798,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -38845,7 +38845,7 @@ def build_virtual_hubs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -38878,7 +38878,7 @@ def build_virtual_hubs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38941,7 +38941,7 @@ def build_virtual_hubs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38969,7 +38969,7 @@ def build_virtual_hubs_list_request(subscription_id: str, **kwargs: Any) -> Http _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -38994,7 +38994,7 @@ def build_virtual_hubs_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -39023,7 +39023,7 @@ def build_virtual_hubs_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -39056,7 +39056,7 @@ def build_virtual_hubs_get_effective_virtual_hub_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -39089,7 +39089,7 @@ def build_virtual_hubs_get_inbound_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -39122,7 +39122,7 @@ def build_virtual_hubs_get_outbound_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -39187,7 +39187,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) @@ -39252,7 +39252,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hubs_delete_request( @@ -39387,7 +39387,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -39455,7 +39455,7 @@ def begin_delete(self, resource_group_name: str, virtual_hub_name: str, **kwargs _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -39600,7 +39600,7 @@ def get(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) request = build_virtual_hubs_get_request( @@ -39647,7 +39647,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualHub"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubsResult] = kwargs.pop("cls", None) error_map = { @@ -39718,7 +39718,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubsResult] = kwargs.pop("cls", None) error_map = { @@ -39777,7 +39777,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -39815,7 +39815,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) @@ -39880,7 +39880,7 @@ def _get_effective_virtual_hub_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VirtualHubEffectiveRouteList]] = kwargs.pop("cls", None) @@ -39933,7 +39933,7 @@ def _get_effective_virtual_hub_routes_initial( _get_effective_virtual_hub_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes'} @api_version_validation( - method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_effective_virtual_hub_routes( @@ -39974,7 +39974,7 @@ def begin_get_effective_virtual_hub_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubEffectiveRouteList] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -40037,7 +40037,7 @@ def _get_inbound_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) @@ -40104,7 +40104,7 @@ def _get_outbound_routes_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) @@ -40154,7 +40154,7 @@ def _get_outbound_routes_initial( _get_outbound_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_inbound_routes( @@ -40194,7 +40194,7 @@ def begin_get_inbound_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.EffectiveRouteMapRouteList] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -40240,7 +40240,7 @@ def get_long_running_output(pipeline_response): begin_get_inbound_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_outbound_routes( @@ -40280,7 +40280,7 @@ def begin_get_outbound_routes( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.EffectiveRouteMapRouteList] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -41135,7 +41135,7 @@ def build_vpn_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -41169,7 +41169,7 @@ def build_vpn_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -41200,7 +41200,7 @@ def build_vpn_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -41231,7 +41231,7 @@ def build_vpn_connections_list_by_vpn_gateway_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -41261,7 +41261,7 @@ def build_vpn_connections_start_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -41295,7 +41295,7 @@ def build_vpn_connections_stop_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -41362,7 +41362,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) @@ -41428,7 +41428,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_connections_delete_request( @@ -41500,7 +41500,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -41573,7 +41573,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -41642,7 +41642,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) request = build_vpn_connections_get_request( @@ -41696,7 +41696,7 @@ def list_by_vpn_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -41774,7 +41774,7 @@ def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -41846,7 +41846,7 @@ def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -41900,7 +41900,7 @@ def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_start_packet_capture( @@ -41942,7 +41942,7 @@ def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -41989,7 +41989,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_stop_packet_capture( @@ -42031,7 +42031,7 @@ def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -42083,7 +42083,7 @@ def build_vpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -42116,7 +42116,7 @@ def build_vpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -42146,7 +42146,7 @@ def build_vpn_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -42179,7 +42179,7 @@ def build_vpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -42207,7 +42207,7 @@ def build_vpn_gateways_list_request(subscription_id: str, **kwargs: Any) -> Http _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -42232,7 +42232,7 @@ def build_vpn_gateways_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -42266,7 +42266,7 @@ def build_vpn_gateways_reset_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -42331,7 +42331,7 @@ def build_vpn_gateways_start_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -42364,7 +42364,7 @@ def build_vpn_gateways_stop_packet_capture_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -42429,7 +42429,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) @@ -42494,7 +42494,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_gateways_delete_request( @@ -42543,7 +42543,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) @@ -42627,7 +42627,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -42695,7 +42695,7 @@ def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -42736,7 +42736,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}'} @api_version_validation( - method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -42773,7 +42773,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -42842,7 +42842,7 @@ def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _mo _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) request = build_vpn_gateways_get_request( @@ -42889,7 +42889,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VpnGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -42960,7 +42960,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -43032,7 +43032,7 @@ def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) request = build_vpn_gateways_reset_request( @@ -43071,9 +43071,9 @@ def _reset_initial( _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ - "ip_configuration_id": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "ip_configuration_id": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -43104,7 +43104,7 @@ def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -43251,7 +43251,7 @@ def _start_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -43321,7 +43321,7 @@ def _stop_packet_capture_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) @@ -43374,7 +43374,7 @@ def _stop_packet_capture_initial( _stop_packet_capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_start_packet_capture( @@ -43413,7 +43413,7 @@ def begin_start_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -43459,7 +43459,7 @@ def get_long_running_output(pipeline_response): begin_start_packet_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_stop_packet_capture( @@ -43498,7 +43498,7 @@ def begin_stop_packet_capture( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -43549,7 +43549,7 @@ def build_vpn_sites_configuration_download_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -43614,7 +43614,7 @@ def _download_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -43693,7 +43693,7 @@ def begin_download( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -43742,7 +43742,7 @@ def build_vpn_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -43775,7 +43775,7 @@ def build_vpn_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -43838,7 +43838,7 @@ def build_vpn_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -43866,7 +43866,7 @@ def build_vpn_sites_list_request(subscription_id: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -43891,7 +43891,7 @@ def build_vpn_sites_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -43920,7 +43920,7 @@ def build_vpn_sites_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -43985,7 +43985,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) @@ -44050,7 +44050,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_sites_delete_request( @@ -44185,7 +44185,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -44253,7 +44253,7 @@ def begin_delete(self, resource_group_name: str, vpn_site_name: str, **kwargs: A _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -44398,7 +44398,7 @@ def get(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) -> _m _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) request = build_vpn_sites_get_request( @@ -44445,7 +44445,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VpnSite"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSitesResult] = kwargs.pop("cls", None) error_map = { @@ -44516,7 +44516,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSitesResult] = kwargs.pop("cls", None) error_map = { @@ -44575,7 +44575,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -44613,7 +44613,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) @@ -44664,7 +44664,7 @@ def build_available_delegations_list_request(location: str, subscription_id: str _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -44722,7 +44722,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableDeleg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableDelegationsResult] = kwargs.pop("cls", None) error_map = { @@ -44786,7 +44786,7 @@ def build_available_resource_group_delegations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -44847,7 +44847,7 @@ def list(self, location: str, resource_group_name: str, **kwargs: Any) -> Iterab _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableDelegationsResult] = kwargs.pop("cls", None) error_map = { @@ -44910,7 +44910,7 @@ def build_azure_firewall_fqdn_tags_list_all_request(subscription_id: str, **kwar _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -44965,7 +44965,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.AzureFirewallFqdnTag"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureFirewallFqdnTagListResult] = kwargs.pop("cls", None) error_map = { @@ -45028,7 +45028,7 @@ def build_ddos_custom_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -45061,7 +45061,7 @@ def build_ddos_custom_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -45124,7 +45124,7 @@ def build_ddos_custom_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -45154,7 +45154,7 @@ def build_ddos_custom_policies_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -45219,7 +45219,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) @@ -45284,7 +45284,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ddos_custom_policies_delete_request( @@ -45420,7 +45420,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -45488,7 +45488,7 @@ def begin_delete(self, resource_group_name: str, ddos_custom_policy_name: str, * _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -45634,7 +45634,7 @@ def get(self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) request = build_ddos_custom_policies_get_request( @@ -45670,7 +45670,7 @@ def get(self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -45708,7 +45708,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) @@ -45761,7 +45761,7 @@ def build_express_route_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -45795,7 +45795,7 @@ def build_express_route_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -45826,7 +45826,7 @@ def build_express_route_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -45857,7 +45857,7 @@ def build_express_route_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -45920,7 +45920,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) @@ -45986,7 +45986,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_connections_delete_request( @@ -46060,7 +46060,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -46133,7 +46133,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -46202,7 +46202,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) request = build_express_route_connections_get_request( @@ -46264,7 +46264,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteConnectionList] = kwargs.pop("cls", None) request = build_express_route_connections_list_request( @@ -46305,7 +46305,7 @@ def build_express_route_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -46338,7 +46338,7 @@ def build_express_route_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46368,7 +46368,7 @@ def build_express_route_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46398,7 +46398,7 @@ def build_express_route_gateways_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46425,7 +46425,7 @@ def build_express_route_gateways_list_by_subscription_request(subscription_id: s _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46452,7 +46452,7 @@ def build_express_route_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -46517,7 +46517,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) @@ -46582,7 +46582,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_gateways_delete_request( @@ -46651,7 +46651,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -46720,7 +46720,7 @@ def begin_delete(self, resource_group_name: str, express_route_gateway_name: str _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -46786,7 +46786,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) request = build_express_route_gateways_get_request( @@ -46843,7 +46843,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> _mo _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) request = build_express_route_gateways_list_by_resource_group_request( @@ -46897,7 +46897,7 @@ def list_by_subscription(self, **kwargs: Any) -> _models.ExpressRouteGatewayList _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) request = build_express_route_gateways_list_by_subscription_request( @@ -46948,7 +46948,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ExpressRouteGateway]] = kwargs.pop("cls", None) @@ -46998,7 +46998,7 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}'} @api_version_validation( - method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -47037,7 +47037,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -47088,7 +47088,7 @@ def build_express_route_links_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47119,7 +47119,7 @@ def build_express_route_links_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47191,7 +47191,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteLink] = kwargs.pop("cls", None) request = build_express_route_links_get_request( @@ -47245,7 +47245,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteLinkListResult] = kwargs.pop("cls", None) error_map = { @@ -47310,7 +47310,7 @@ def build_express_route_ports_locations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47337,7 +47337,7 @@ def build_express_route_ports_locations_list_request(subscription_id: str, **kwa _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47401,7 +47401,7 @@ def get(self, location_name: str, **kwargs: Any) -> _models.ExpressRoutePortsLoc _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortsLocation] = kwargs.pop("cls", None) request = build_express_route_ports_locations_get_request( @@ -47451,7 +47451,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExpressRoutePortsLocation"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortsLocationListResult] = kwargs.pop("cls", None) error_map = { @@ -47514,7 +47514,7 @@ def build_express_route_ports_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -47547,7 +47547,7 @@ def build_express_route_ports_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47610,7 +47610,7 @@ def build_express_route_ports_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47638,7 +47638,7 @@ def build_express_route_ports_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47663,7 +47663,7 @@ def build_express_route_ports_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47692,7 +47692,7 @@ def build_express_route_ports_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -47725,7 +47725,7 @@ def build_express_route_ports_generate_loa_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -47790,7 +47790,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) @@ -47855,7 +47855,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_ports_delete_request( @@ -47987,7 +47987,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -48055,7 +48055,7 @@ def begin_delete(self, resource_group_name: str, express_route_port_name: str, * _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -48201,7 +48201,7 @@ def get(self, resource_group_name: str, express_route_port_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) request = build_express_route_ports_get_request( @@ -48248,7 +48248,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExpressRoutePort"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortListResult] = kwargs.pop("cls", None) error_map = { @@ -48319,7 +48319,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortListResult] = kwargs.pop("cls", None) error_map = { @@ -48378,7 +48378,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -48416,7 +48416,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) @@ -48464,7 +48464,7 @@ def update_tags( update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def generate_loa( @@ -48502,7 +48502,7 @@ def generate_loa( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GenerateExpressRoutePortsLOAResult] = kwargs.pop("cls", None) @@ -49184,7 +49184,7 @@ def build_load_balancer_outbound_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49215,7 +49215,7 @@ def build_load_balancer_outbound_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49287,7 +49287,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.OutboundRule] = kwargs.pop("cls", None) request = build_load_balancer_outbound_rules_get_request( @@ -49341,7 +49341,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.LoadBalancerOutboundRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -49410,7 +49410,7 @@ def build_network_interface_tap_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -49448,7 +49448,7 @@ def build_network_interface_tap_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49483,7 +49483,7 @@ def build_network_interface_tap_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49514,7 +49514,7 @@ def build_network_interface_tap_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49577,7 +49577,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) @@ -49643,7 +49643,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_interface_tap_configurations_delete_request( @@ -49717,7 +49717,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -49790,7 +49790,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -49859,7 +49859,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) request = build_network_interface_tap_configurations_get_request( @@ -49915,7 +49915,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkInterfaceTapConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -49980,7 +49980,7 @@ def build_network_profiles_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50010,7 +50010,7 @@ def build_network_profiles_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50048,7 +50048,7 @@ def build_network_profiles_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50078,7 +50078,7 @@ def build_network_profiles_list_request(resource_group_name: str, subscription_i _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50105,7 +50105,7 @@ def build_network_profiles_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50130,7 +50130,7 @@ def build_network_profiles_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50191,7 +50191,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_profiles_delete_request( @@ -50245,7 +50245,7 @@ def begin_delete(self, resource_group_name: str, network_profile_name: str, **kw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -50321,7 +50321,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) @@ -50400,7 +50400,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) request = build_network_profiles_get_request( @@ -50450,7 +50450,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Net _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -50520,7 +50520,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkProfile"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -50613,7 +50613,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) @@ -50666,7 +50666,7 @@ def build_p2_svpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50699,7 +50699,7 @@ def build_p2_svpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50729,7 +50729,7 @@ def build_p2_svpn_gateways_generate_vpn_profile_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50762,7 +50762,7 @@ def build_p2_svpn_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50795,7 +50795,7 @@ def build_p2_svpn_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50823,7 +50823,7 @@ def build_p2_svpn_gateways_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50848,7 +50848,7 @@ def build_p2_svpn_gateways_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50877,7 +50877,7 @@ def build_p2_svpn_gateways_get_p2_s_vpn_connection_health_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50907,7 +50907,7 @@ def build_p2_svpn_gateways_get_p2_s_vpn_connection_health_detailed_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50973,7 +50973,7 @@ def build_p2_svpn_gateways_disconnect_p2_s_vpn_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51006,7 +51006,7 @@ def build_p2_svpn_gateways_reset_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51068,7 +51068,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) @@ -51133,7 +51133,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_delete_request( @@ -51182,7 +51182,7 @@ def _generate_vpn_profile_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.VpnProfileResponse]] = kwargs.pop("cls", None) @@ -51249,7 +51249,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) @@ -51334,7 +51334,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -51402,7 +51402,7 @@ def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -51479,7 +51479,7 @@ def begin_generate_vpn_profile( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnProfileResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -51525,7 +51525,7 @@ def get_long_running_output(pipeline_response): begin_generate_vpn_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_update_tags( @@ -51563,7 +51563,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -51632,7 +51632,7 @@ def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _mo _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_get_request( @@ -51679,7 +51679,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.P2SVpnGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListP2SVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -51750,7 +51750,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListP2SVpnGatewaysResult] = kwargs.pop("cls", None) error_map = { @@ -51822,7 +51822,7 @@ def _get_p2_s_vpn_connection_health_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_request( @@ -51860,7 +51860,7 @@ def _get_p2_s_vpn_connection_health_initial( _get_p2_s_vpn_connection_health_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_p2_s_vpn_connection_health( @@ -51889,7 +51889,7 @@ def begin_get_p2_s_vpn_connection_health( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -51949,7 +51949,7 @@ def _get_p2_s_vpn_connection_health_detailed_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.P2SVpnConnectionHealth]] = kwargs.pop("cls", None) @@ -51999,7 +51999,7 @@ def _get_p2_s_vpn_connection_health_detailed_initial( _get_p2_s_vpn_connection_health_detailed_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed'} @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_p2_s_vpn_connection_health_detailed( @@ -52039,7 +52039,7 @@ def begin_get_p2_s_vpn_connection_health_detailed( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.P2SVpnConnectionHealth] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -52188,7 +52188,7 @@ def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsistent-re _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -52232,7 +52232,7 @@ def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsistent-re _disconnect_p2_s_vpn_connections_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections'} @api_version_validation( - method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_disconnect_p2_s_vpn_connections( @@ -52270,7 +52270,7 @@ def begin_disconnect_p2_s_vpn_connections( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -52327,7 +52327,7 @@ def _reset_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) request = build_p2_svpn_gateways_reset_request( @@ -52365,7 +52365,7 @@ def _reset_initial( _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_reset( @@ -52393,7 +52393,7 @@ def begin_reset( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -53025,7 +53025,7 @@ def build_public_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53058,7 +53058,7 @@ def build_public_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53126,7 +53126,7 @@ def build_public_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53156,7 +53156,7 @@ def build_public_ip_prefixes_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53183,7 +53183,7 @@ def build_public_ip_prefixes_list_all_request(subscription_id: str, **kwargs: An _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53208,7 +53208,7 @@ def build_public_ip_prefixes_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53273,7 +53273,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) @@ -53338,7 +53338,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_public_ip_prefixes_delete_request( @@ -53470,7 +53470,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -53538,7 +53538,7 @@ def begin_delete(self, resource_group_name: str, public_ip_prefix_name: str, **k _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -53688,7 +53688,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) request = build_public_ip_prefixes_get_request( @@ -53738,7 +53738,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pub _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -53808,7 +53808,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.PublicIPPrefix"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PublicIPPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -53866,7 +53866,7 @@ def get_next(next_link=None): list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -53904,7 +53904,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) @@ -53957,7 +53957,7 @@ def build_service_endpoint_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53992,7 +53992,7 @@ def build_service_endpoint_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54064,7 +54064,7 @@ def build_service_endpoint_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54096,7 +54096,7 @@ def build_service_endpoint_policies_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54123,7 +54123,7 @@ def build_service_endpoint_policies_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54152,7 +54152,7 @@ def build_service_endpoint_policies_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -54219,7 +54219,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) @@ -54284,7 +54284,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_service_endpoint_policies_delete_request( @@ -54417,7 +54417,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -54487,7 +54487,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -54643,7 +54643,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) request = build_service_endpoint_policies_get_request( @@ -54693,7 +54693,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ServiceEndpointPolicy"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -54768,7 +54768,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -54827,7 +54827,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -54865,7 +54865,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) @@ -54922,7 +54922,7 @@ def build_service_endpoint_policy_definitions_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -54964,7 +54964,7 @@ def build_service_endpoint_policy_definitions_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55003,7 +55003,7 @@ def build_service_endpoint_policy_definitions_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55038,7 +55038,7 @@ def build_service_endpoint_policy_definitions_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55103,7 +55103,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) @@ -55173,7 +55173,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_service_endpoint_policy_definitions_delete_request( @@ -55249,7 +55249,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -55327,7 +55327,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -55401,7 +55401,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) request = build_service_endpoint_policy_definitions_get_request( @@ -55457,7 +55457,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceEndpointPolicyDefinitionListResult] = kwargs.pop("cls", None) error_map = { @@ -55522,7 +55522,7 @@ def build_virtual_network_taps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55555,7 +55555,7 @@ def build_virtual_network_taps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55618,7 +55618,7 @@ def build_virtual_network_taps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55646,7 +55646,7 @@ def build_virtual_network_taps_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55671,7 +55671,7 @@ def build_virtual_network_taps_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55700,7 +55700,7 @@ def build_virtual_network_taps_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55761,7 +55761,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) @@ -55826,7 +55826,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_taps_delete_request( @@ -55950,7 +55950,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -56018,7 +56018,7 @@ def begin_delete(self, resource_group_name: str, tap_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -56160,7 +56160,7 @@ def get(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> _models _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) request = build_virtual_network_taps_get_request( @@ -56207,7 +56207,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualNetworkTap"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTapListResult] = kwargs.pop("cls", None) error_map = { @@ -56278,7 +56278,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkTapListResult] = kwargs.pop("cls", None) error_map = { @@ -56337,7 +56337,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -56371,7 +56371,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) @@ -56424,7 +56424,7 @@ def build_virtual_wans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -56457,7 +56457,7 @@ def build_virtual_wans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56520,7 +56520,7 @@ def build_virtual_wans_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56548,7 +56548,7 @@ def build_virtual_wans_list_request(subscription_id: str, **kwargs: Any) -> Http _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56573,7 +56573,7 @@ def build_virtual_wans_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56602,7 +56602,7 @@ def build_virtual_wans_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -56667,7 +56667,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) @@ -56732,7 +56732,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_wans_delete_request( @@ -56867,7 +56867,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -56935,7 +56935,7 @@ def begin_delete(self, resource_group_name: str, virtual_wan_name: str, **kwargs _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -57080,7 +57080,7 @@ def get(self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any) -> _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) request = build_virtual_wans_get_request( @@ -57127,7 +57127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualWAN"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualWANsResult] = kwargs.pop("cls", None) error_map = { @@ -57198,7 +57198,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualWANsResult] = kwargs.pop("cls", None) error_map = { @@ -57257,7 +57257,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -57295,7 +57295,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) @@ -57353,7 +57353,7 @@ def build_peer_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57385,7 +57385,7 @@ def build_peer_express_route_circuit_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57461,7 +57461,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PeerExpressRouteCircuitConnection] = kwargs.pop("cls", None) request = build_peer_express_route_circuit_connections_get_request( @@ -57521,7 +57521,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PeerExpressRouteCircuitConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -57587,7 +57587,7 @@ def build_web_application_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57617,7 +57617,7 @@ def build_web_application_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -57650,7 +57650,7 @@ def build_web_application_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57680,7 +57680,7 @@ def build_web_application_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57707,7 +57707,7 @@ def build_web_application_firewall_policies_list_all_request(subscription_id: st _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57763,7 +57763,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_web_application_firewall_policies_delete_request( @@ -57817,7 +57817,7 @@ def begin_delete(self, resource_group_name: str, policy_name: str, **kwargs: Any _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -57893,7 +57893,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) @@ -57968,7 +57968,7 @@ def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _mod _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) request = build_web_application_firewall_policies_get_request( @@ -58019,7 +58019,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Web _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -58091,7 +58091,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.WebApplicationFirewallPol _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -58154,7 +58154,7 @@ def build_nat_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58187,7 +58187,7 @@ def build_nat_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58222,7 +58222,7 @@ def build_nat_gateways_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58252,7 +58252,7 @@ def build_nat_gateways_list_request(resource_group_name: str, subscription_id: s _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58279,7 +58279,7 @@ def build_nat_gateways_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58304,7 +58304,7 @@ def build_nat_gateways_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58365,7 +58365,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.NatGateway]] = kwargs.pop("cls", None) @@ -58431,7 +58431,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_nat_gateways_delete_request( @@ -58493,7 +58493,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -58561,7 +58561,7 @@ def begin_delete(self, resource_group_name: str, nat_gateway_name: str, **kwargs _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -58629,7 +58629,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) request = build_nat_gateways_get_request( @@ -58679,7 +58679,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Nat _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -58749,7 +58749,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.NatGateway"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NatGatewayListResult] = kwargs.pop("cls", None) error_map = { @@ -58838,7 +58838,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) @@ -58922,7 +58922,7 @@ def build_resource_navigation_links_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59035,7 +59035,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list( @@ -59065,7 +59065,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ResourceNavigationLinksListResult] = kwargs.pop("cls", None) request = build_resource_navigation_links_list_request( @@ -59138,7 +59138,7 @@ def build_service_association_links_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59251,7 +59251,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks'} @api_version_validation( - method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list( @@ -59281,7 +59281,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceAssociationLinksListResult] = kwargs.pop("cls", None) request = build_service_association_links_list_request( @@ -59323,7 +59323,7 @@ def build_available_private_endpoint_types_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59352,7 +59352,7 @@ def build_available_private_endpoint_types_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59413,7 +59413,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailablePriva _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = kwargs.pop("cls", None) error_map = { @@ -59492,7 +59492,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = kwargs.pop("cls", None) error_map = { @@ -59557,7 +59557,7 @@ def build_bastion_hosts_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -59590,7 +59590,7 @@ def build_bastion_hosts_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59620,7 +59620,7 @@ def build_bastion_hosts_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59648,7 +59648,7 @@ def build_bastion_hosts_list_request(subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59673,7 +59673,7 @@ def build_bastion_hosts_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59702,7 +59702,7 @@ def build_bastion_hosts_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -59767,7 +59767,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) @@ -59832,7 +59832,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_bastion_hosts_delete_request( @@ -59899,7 +59899,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -59967,7 +59967,7 @@ def begin_delete(self, resource_group_name: str, bastion_host_name: str, **kwarg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -60031,7 +60031,7 @@ def get(self, resource_group_name: str, bastion_host_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) request = build_bastion_hosts_get_request( @@ -60078,7 +60078,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.BastionHost"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHostListResult] = kwargs.pop("cls", None) error_map = { @@ -60149,7 +60149,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BastionHostListResult] = kwargs.pop("cls", None) error_map = { @@ -60221,7 +60221,7 @@ def _update_tags_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BastionHost]] = kwargs.pop("cls", None) @@ -60271,10 +60271,10 @@ def _update_tags_initial( _update_tags_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}'} @api_version_validation( - method_valid_on=['2019-06-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ "bastion_host_parameters": ['2019-06-01'], - "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -60309,7 +60309,7 @@ def begin_update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -60360,7 +60360,7 @@ def build_private_endpoints_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -60393,7 +60393,7 @@ def build_private_endpoints_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60428,7 +60428,7 @@ def build_private_endpoints_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60458,7 +60458,7 @@ def build_private_endpoints_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60485,7 +60485,7 @@ def build_private_endpoints_list_by_subscription_request(subscription_id: str, * _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60542,7 +60542,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) @@ -60608,7 +60608,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_endpoints_delete_request( @@ -60676,7 +60676,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -60744,7 +60744,7 @@ def begin_delete(self, resource_group_name: str, private_endpoint_name: str, **k _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -60812,7 +60812,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) request = build_private_endpoints_get_request( @@ -60863,7 +60863,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pri _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointListResult] = kwargs.pop("cls", None) error_map = { @@ -60934,7 +60934,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateEndpoi _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointListResult] = kwargs.pop("cls", None) error_map = { @@ -60998,7 +60998,7 @@ def build_private_link_services_check_private_link_service_visibility_by_resourc _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61031,7 +61031,7 @@ def build_private_link_services_check_private_link_service_visibility_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61063,7 +61063,7 @@ def build_private_link_services_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61096,7 +61096,7 @@ def build_private_link_services_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61126,7 +61126,7 @@ def build_private_link_services_delete_private_endpoint_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61157,7 +61157,7 @@ def build_private_link_services_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61189,7 +61189,7 @@ def build_private_link_services_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61218,7 +61218,7 @@ def build_private_link_services_list_auto_approved_private_link_services_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61247,7 +61247,7 @@ def build_private_link_services_list_auto_approved_private_link_services_by_reso _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61275,7 +61275,7 @@ def build_private_link_services_list_by_subscription_request(subscription_id: st _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61300,7 +61300,7 @@ def build_private_link_services_update_private_endpoint_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61340,7 +61340,7 @@ def build_private_link_services_get_private_endpoint_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61373,7 +61373,7 @@ def build_private_link_services_list_private_endpoint_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61435,7 +61435,7 @@ def _check_private_link_service_visibility_by_resource_group_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = kwargs.pop("cls", None) @@ -61498,7 +61498,7 @@ def _check_private_link_service_visibility_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = kwargs.pop("cls", None) @@ -61564,7 +61564,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) @@ -61630,7 +61630,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_link_services_delete_request( @@ -61676,7 +61676,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=inconsistent _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_link_services_delete_private_endpoint_connection_request( @@ -61741,7 +61741,7 @@ def begin_check_private_link_service_visibility( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkServiceVisibility] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -61824,7 +61824,7 @@ def begin_check_private_link_service_visibility_by_resource_group( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkServiceVisibility] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -61906,7 +61906,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -61974,7 +61974,7 @@ def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -62041,7 +62041,7 @@ def begin_delete_private_endpoint_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -62110,7 +62110,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) request = build_private_link_services_get_request( @@ -62161,7 +62161,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Pri _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkServiceListResult] = kwargs.pop("cls", None) error_map = { @@ -62239,7 +62239,7 @@ def list_auto_approved_private_link_services( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = kwargs.pop("cls", None) error_map = { @@ -62318,7 +62318,7 @@ def list_auto_approved_private_link_services_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = kwargs.pop("cls", None) error_map = { @@ -62391,7 +62391,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateLinkSe _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateLinkServiceListResult] = kwargs.pop("cls", None) error_map = { @@ -62488,7 +62488,7 @@ def update_private_endpoint_connection( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -62538,7 +62538,7 @@ def update_private_endpoint_connection( update_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_private_endpoint_connection( @@ -62577,7 +62577,7 @@ def get_private_endpoint_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_private_link_services_get_private_endpoint_connection_request( @@ -62616,7 +62616,7 @@ def get_private_endpoint_connection( get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_private_endpoint_connections( @@ -62638,7 +62638,7 @@ def list_private_endpoint_connections( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -62702,7 +62702,7 @@ def build_service_tags_list_request(location: str, subscription_id: str, **kwarg _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62768,7 +62768,7 @@ def list(self, location: str, **kwargs: Any) -> _models.ServiceTagsListResult: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceTagsListResult] = kwargs.pop("cls", None) request = build_service_tags_list_request( @@ -62808,7 +62808,7 @@ def build_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -62841,7 +62841,7 @@ def build_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62876,7 +62876,7 @@ def build_firewall_policies_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62906,7 +62906,7 @@ def build_firewall_policies_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62933,7 +62933,7 @@ def build_firewall_policies_list_all_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62958,7 +62958,7 @@ def build_firewall_policies_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -63023,7 +63023,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) @@ -63088,7 +63088,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_firewall_policies_delete_request( @@ -63155,7 +63155,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -63223,7 +63223,7 @@ def begin_delete(self, resource_group_name: str, firewall_policy_name: str, **kw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -63291,7 +63291,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) request = build_firewall_policies_get_request( @@ -63341,7 +63341,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fir _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -63411,7 +63411,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.FirewallPolicy"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyListResult] = kwargs.pop("cls", None) error_map = { @@ -63469,10 +63469,10 @@ def get_next(next_link=None): list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies'} @api_version_validation( - method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-06-01', '2019-07-01', '2019-08-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], params_valid_on={ "firewall_policy_parameters": ['2019-06-01', '2019-07-01', '2019-08-01'], - "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "parameters": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -63511,7 +63511,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) @@ -64124,7 +64124,7 @@ def build_vpn_link_connections_list_by_vpn_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64160,7 +64160,7 @@ def build_vpn_link_connections_get_ike_sas_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64197,7 +64197,7 @@ def build_vpn_link_connections_reset_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64266,7 +64266,7 @@ def list_by_vpn_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSiteLinkConnectionsResult] = kwargs.pop("cls", None) error_map = { @@ -64345,7 +64345,7 @@ def _get_ike_sas_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[str]] = kwargs.pop("cls", None) request = build_vpn_link_connections_get_ike_sas_request( @@ -64404,7 +64404,7 @@ def _reset_connection_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_link_connections_reset_connection_request( @@ -64439,7 +64439,7 @@ def _reset_connection_initial( # pylint: disable=inconsistent-return-statements _reset_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_ike_sas( @@ -64475,7 +64475,7 @@ def begin_get_ike_sas( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[str] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -64520,7 +64520,7 @@ def get_long_running_output(pipeline_response): begin_get_ike_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas'} @api_version_validation( - method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_reset_connection( @@ -64556,7 +64556,7 @@ def begin_reset_connection( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -64609,7 +64609,7 @@ def build_vpn_site_link_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64690,7 +64690,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSiteLinkConnection] = kwargs.pop("cls", None) request = build_vpn_site_link_connections_get_request( @@ -64733,7 +64733,7 @@ def build_vpn_site_links_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64764,7 +64764,7 @@ def build_vpn_site_links_list_by_vpn_site_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64836,7 +64836,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnSiteLink] = kwargs.pop("cls", None) request = build_vpn_site_links_get_request( @@ -64890,7 +64890,7 @@ def list_by_vpn_site( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnSiteLinksResult] = kwargs.pop("cls", None) error_map = { @@ -64955,7 +64955,7 @@ def build_virtual_router_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64989,7 +64989,7 @@ def build_virtual_router_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65020,7 +65020,7 @@ def build_virtual_router_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65051,7 +65051,7 @@ def build_virtual_router_peerings_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65148,7 +65148,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) @@ -65215,7 +65215,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_router_peerings_delete_request( @@ -65288,7 +65288,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -65361,7 +65361,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -65430,7 +65430,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) request = build_virtual_router_peerings_get_request( @@ -65487,7 +65487,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterPeeringListResult] = kwargs.pop("cls", None) error_map = { @@ -65644,7 +65644,7 @@ def build_virtual_routers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -65677,7 +65677,7 @@ def build_virtual_routers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65712,7 +65712,7 @@ def build_virtual_routers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65742,7 +65742,7 @@ def build_virtual_routers_list_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65767,7 +65767,7 @@ def build_virtual_routers_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65861,7 +65861,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) @@ -65927,7 +65927,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_routers_delete_request( @@ -65995,7 +65995,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -66063,7 +66063,7 @@ def begin_delete(self, resource_group_name: str, virtual_router_name: str, **kwa _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -66131,7 +66131,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) request = build_virtual_routers_get_request( @@ -66180,7 +66180,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualRouter"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterListResult] = kwargs.pop("cls", None) error_map = { @@ -66252,7 +66252,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualRouterListResult] = kwargs.pop("cls", None) error_map = { @@ -66402,7 +66402,7 @@ def build_available_service_aliases_list_request(location: str, subscription_id: _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66431,7 +66431,7 @@ def build_available_service_aliases_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66491,7 +66491,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableServi _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableServiceAliasesResult] = kwargs.pop("cls", None) error_map = { @@ -66569,7 +66569,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AvailableServiceAliasesResult] = kwargs.pop("cls", None) error_map = { @@ -66634,7 +66634,7 @@ def build_vpn_server_configurations_associated_with_virtual_wan_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66692,7 +66692,7 @@ def _list_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[_models.VpnServerConfigurationsResponse]] = kwargs.pop("cls", None) request = build_vpn_server_configurations_associated_with_virtual_wan_list_request( @@ -66757,7 +66757,7 @@ def begin_list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfigurationsResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -66805,7 +66805,7 @@ def build_vpn_server_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66840,7 +66840,7 @@ def build_vpn_server_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66907,7 +66907,7 @@ def build_vpn_server_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66937,7 +66937,7 @@ def build_vpn_server_configurations_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66964,7 +66964,7 @@ def build_vpn_server_configurations_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66993,7 +66993,7 @@ def build_vpn_server_configurations_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67060,7 +67060,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) @@ -67125,7 +67125,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_vpn_server_configurations_delete_request( @@ -67265,7 +67265,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -67336,7 +67336,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -67490,7 +67490,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) request = build_vpn_server_configurations_get_request( @@ -67539,7 +67539,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VpnServerConfiguration"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationsResult] = kwargs.pop("cls", None) error_map = { @@ -67614,7 +67614,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationsResult] = kwargs.pop("cls", None) error_map = { @@ -67673,7 +67673,7 @@ def get_next(next_link=None): list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -67713,7 +67713,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) @@ -67766,7 +67766,7 @@ def build_ip_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67799,7 +67799,7 @@ def build_ip_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67829,7 +67829,7 @@ def build_ip_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67859,7 +67859,7 @@ def build_ip_groups_list_request(subscription_id: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67884,7 +67884,7 @@ def build_ip_groups_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67913,7 +67913,7 @@ def build_ip_groups_update_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -67974,7 +67974,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) @@ -68040,7 +68040,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ip_groups_delete_request( @@ -68103,7 +68103,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -68171,7 +68171,7 @@ def begin_delete(self, resource_group_name: str, ip_groups_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -68240,7 +68240,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) request = build_ip_groups_get_request( @@ -68289,7 +68289,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.IpGroup"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -68361,7 +68361,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -68452,7 +68452,7 @@ def update_groups( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) @@ -68506,7 +68506,7 @@ def build_virtual_hub_route_table_v2_s_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68540,7 +68540,7 @@ def build_virtual_hub_route_table_v2_s_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68571,7 +68571,7 @@ def build_virtual_hub_route_table_v2_s_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68602,7 +68602,7 @@ def build_virtual_hub_route_table_v2_s_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68665,7 +68665,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) @@ -68732,7 +68732,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_route_table_v2_s_delete_request( @@ -68807,7 +68807,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -68880,7 +68880,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -68949,7 +68949,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) request = build_virtual_hub_route_table_v2_s_get_request( @@ -69006,7 +69006,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubRouteTableV2SResult] = kwargs.pop("cls", None) error_map = { @@ -69071,7 +69071,7 @@ def build_flow_logs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -69105,7 +69105,7 @@ def build_flow_logs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69136,7 +69136,7 @@ def build_flow_logs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69167,7 +69167,7 @@ def build_flow_logs_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69197,7 +69197,7 @@ def build_flow_logs_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -69264,7 +69264,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) @@ -69331,7 +69331,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_flow_logs_delete_request( @@ -69402,7 +69402,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -69475,7 +69475,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -69544,7 +69544,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) request = build_flow_logs_get_request( @@ -69598,7 +69598,7 @@ def list(self, resource_group_name: str, network_watcher_name: str, **kwargs: An _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FlowLogListResult] = kwargs.pop("cls", None) error_map = { @@ -69659,7 +69659,7 @@ def get_next(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def update_tags( @@ -69700,7 +69700,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) @@ -69755,7 +69755,7 @@ def build_network_virtual_appliances_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -69790,7 +69790,7 @@ def build_network_virtual_appliances_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69827,7 +69827,7 @@ def build_network_virtual_appliances_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69859,7 +69859,7 @@ def build_network_virtual_appliances_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69886,7 +69886,7 @@ def build_network_virtual_appliances_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69915,7 +69915,7 @@ def build_network_virtual_appliances_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -69982,7 +69982,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) @@ -70050,7 +70050,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_virtual_appliances_delete_request( @@ -70122,7 +70122,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -70192,7 +70192,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -70265,7 +70265,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) request = build_network_virtual_appliances_get_request( @@ -70315,7 +70315,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.NetworkVirtualAppliance"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceListResult] = kwargs.pop("cls", None) error_map = { @@ -70390,7 +70390,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceListResult] = kwargs.pop("cls", None) error_map = { @@ -70485,7 +70485,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) @@ -70538,7 +70538,7 @@ def build_ip_allocations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -70571,7 +70571,7 @@ def build_ip_allocations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70606,7 +70606,7 @@ def build_ip_allocations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70636,7 +70636,7 @@ def build_ip_allocations_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70661,7 +70661,7 @@ def build_ip_allocations_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70690,7 +70690,7 @@ def build_ip_allocations_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -70755,7 +70755,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) @@ -70820,7 +70820,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_ip_allocations_delete_request( @@ -70887,7 +70887,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -70955,7 +70955,7 @@ def begin_delete(self, resource_group_name: str, ip_allocation_name: str, **kwar _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -71023,7 +71023,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) request = build_ip_allocations_get_request( @@ -71071,7 +71071,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.IpAllocation"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocationListResult] = kwargs.pop("cls", None) error_map = { @@ -71142,7 +71142,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.IpAllocationListResult] = kwargs.pop("cls", None) error_map = { @@ -71236,7 +71236,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) @@ -71293,7 +71293,7 @@ def build_private_dns_zone_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71331,7 +71331,7 @@ def build_private_dns_zone_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71366,7 +71366,7 @@ def build_private_dns_zone_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71397,7 +71397,7 @@ def build_private_dns_zone_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71460,7 +71460,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) @@ -71526,7 +71526,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_private_dns_zone_groups_delete_request( @@ -71598,7 +71598,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -71671,7 +71671,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -71740,7 +71740,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) request = build_private_dns_zone_groups_get_request( @@ -71795,7 +71795,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.PrivateDnsZoneGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -71861,7 +71861,7 @@ def build_security_partner_providers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71896,7 +71896,7 @@ def build_security_partner_providers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71928,7 +71928,7 @@ def build_security_partner_providers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71958,7 +71958,7 @@ def build_security_partner_providers_list_request(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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71985,7 +71985,7 @@ def build_security_partner_providers_list_by_resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72014,7 +72014,7 @@ def build_security_partner_providers_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72081,7 +72081,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) @@ -72146,7 +72146,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_partner_providers_delete_request( @@ -72214,7 +72214,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -72284,7 +72284,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -72350,7 +72350,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) request = build_security_partner_providers_get_request( @@ -72399,7 +72399,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityPartnerProvider"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -72474,7 +72474,7 @@ def list_by_resource_group( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityPartnerProviderListResult] = kwargs.pop("cls", None) error_map = { @@ -72568,7 +72568,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) @@ -72621,7 +72621,7 @@ def build_hub_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72655,7 +72655,7 @@ def build_hub_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72686,7 +72686,7 @@ def build_hub_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72717,7 +72717,7 @@ def build_hub_route_tables_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72780,7 +72780,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) @@ -72846,7 +72846,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_hub_route_tables_delete_request( @@ -72917,7 +72917,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -72990,7 +72990,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -73059,7 +73059,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) request = build_hub_route_tables_get_request( @@ -73111,7 +73111,7 @@ def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListHubRouteTablesResult] = kwargs.pop("cls", None) error_map = { @@ -73176,7 +73176,7 @@ def build_application_gateway_private_endpoint_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73207,7 +73207,7 @@ def build_application_gateway_private_endpoint_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -73241,7 +73241,7 @@ def build_application_gateway_private_endpoint_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73272,7 +73272,7 @@ def build_application_gateway_private_endpoint_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73330,7 +73330,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_application_gateway_private_endpoint_connections_delete_request( @@ -73381,7 +73381,7 @@ def _update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ApplicationGatewayPrivateEndpointConnection]] = kwargs.pop("cls", None) @@ -73459,7 +73459,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -73543,7 +73543,7 @@ def begin_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -73618,7 +73618,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) request = build_application_gateway_private_endpoint_connections_get_request( @@ -73674,7 +73674,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -73739,7 +73739,7 @@ def build_application_gateway_private_link_resources_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73803,7 +73803,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayPrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { @@ -73872,7 +73872,7 @@ def build_firewall_policy_rule_collection_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -73910,7 +73910,7 @@ def build_firewall_policy_rule_collection_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73945,7 +73945,7 @@ def build_firewall_policy_rule_collection_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73976,7 +73976,7 @@ def build_firewall_policy_rule_collection_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74039,7 +74039,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) @@ -74105,7 +74105,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_firewall_policy_rule_collection_groups_delete_request( @@ -74179,7 +74179,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -74252,7 +74252,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -74321,7 +74321,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) request = build_firewall_policy_rule_collection_groups_get_request( @@ -74377,7 +74377,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.FirewallPolicyRuleCollectionGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -74442,7 +74442,7 @@ def build_virtual_appliance_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74478,7 +74478,7 @@ def build_virtual_appliance_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74511,7 +74511,7 @@ def build_virtual_appliance_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74544,7 +74544,7 @@ def build_virtual_appliance_sites_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74609,7 +74609,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) @@ -74675,7 +74675,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_appliance_sites_delete_request( @@ -74747,7 +74747,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -74820,7 +74820,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -74889,7 +74889,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) request = build_virtual_appliance_sites_get_request( @@ -74945,7 +74945,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSiteListResult] = kwargs.pop("cls", None) error_map = { @@ -75008,7 +75008,7 @@ def build_virtual_appliance_skus_get_request(sku_name: str, subscription_id: str _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75035,7 +75035,7 @@ def build_virtual_appliance_skus_list_request(subscription_id: str, **kwargs: An _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75098,7 +75098,7 @@ def get(self, sku_name: str, **kwargs: Any) -> _models.NetworkVirtualApplianceSk _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSku] = kwargs.pop("cls", None) request = build_virtual_appliance_skus_get_request( @@ -75146,7 +75146,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.NetworkVirtualApplianceSku"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceSkuListResult] = kwargs.pop("cls", None) error_map = { @@ -75209,7 +75209,7 @@ def build_virtual_hub_bgp_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -75243,7 +75243,7 @@ def build_virtual_hub_bgp_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75274,7 +75274,7 @@ def build_virtual_hub_bgp_connection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75338,7 +75338,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) @@ -75404,7 +75404,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connection_delete_request( @@ -75476,7 +75476,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -75549,7 +75549,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -75618,7 +75618,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connection_get_request( @@ -75660,7 +75660,7 @@ def build_virtual_hub_bgp_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75690,7 +75690,7 @@ def build_virtual_hub_bgp_connections_list_advertised_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75721,7 +75721,7 @@ def build_virtual_hub_bgp_connections_list_learned_routes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75782,7 +75782,7 @@ def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubBgpConnectionResults] = kwargs.pop("cls", None) error_map = { @@ -75855,7 +75855,7 @@ def _list_advertised_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connections_list_advertised_routes_request( @@ -75907,7 +75907,7 @@ def _list_learned_routes_initial( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) request = build_virtual_hub_bgp_connections_list_learned_routes_request( @@ -75946,7 +75946,7 @@ def _list_learned_routes_initial( _list_learned_routes_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_advertised_routes( @@ -75977,7 +75977,7 @@ def begin_list_advertised_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Dict[str, List[_models.PeerRoute]]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -76021,7 +76021,7 @@ def get_long_running_output(pipeline_response): begin_list_advertised_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes'} @api_version_validation( - method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_list_learned_routes( @@ -76052,7 +76052,7 @@ def begin_list_learned_routes( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[Dict[str, List[_models.PeerRoute]]] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -76101,7 +76101,7 @@ def build_virtual_hub_ip_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76135,7 +76135,7 @@ def build_virtual_hub_ip_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76166,7 +76166,7 @@ def build_virtual_hub_ip_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76197,7 +76197,7 @@ def build_virtual_hub_ip_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76260,7 +76260,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) @@ -76326,7 +76326,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_hub_ip_configuration_delete_request( @@ -76399,7 +76399,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -76472,7 +76472,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -76541,7 +76541,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) request = build_virtual_hub_ip_configuration_get_request( @@ -76595,7 +76595,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualHubIpConfigurationResults] = kwargs.pop("cls", None) error_map = { @@ -76660,7 +76660,7 @@ def build_custom_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76693,7 +76693,7 @@ def build_custom_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76728,7 +76728,7 @@ def build_custom_ip_prefixes_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76758,7 +76758,7 @@ def build_custom_ip_prefixes_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76785,7 +76785,7 @@ def build_custom_ip_prefixes_list_all_request(subscription_id: str, **kwargs: An _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76810,7 +76810,7 @@ def build_custom_ip_prefixes_update_tags_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76875,7 +76875,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) @@ -76940,7 +76940,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_custom_ip_prefixes_delete_request( @@ -77007,7 +77007,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -77075,7 +77075,7 @@ def begin_delete(self, resource_group_name: str, custom_ip_prefix_name: str, **k _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -77143,7 +77143,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) request = build_custom_ip_prefixes_get_request( @@ -77193,7 +77193,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cus _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -77263,7 +77263,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.CustomIpPrefix"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.CustomIpPrefixListResult] = kwargs.pop("cls", None) error_map = { @@ -77356,7 +77356,7 @@ def update_tags( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) @@ -77409,7 +77409,7 @@ def build_dscp_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -77442,7 +77442,7 @@ def build_dscp_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77472,7 +77472,7 @@ def build_dscp_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77500,7 +77500,7 @@ def build_dscp_configuration_list_request(resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77527,7 +77527,7 @@ def build_dscp_configuration_list_all_request(subscription_id: str, **kwargs: An _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77584,7 +77584,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) @@ -77649,7 +77649,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_dscp_configuration_delete_request( @@ -77716,7 +77716,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -77784,7 +77784,7 @@ def begin_delete(self, resource_group_name: str, dscp_configuration_name: str, * _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -77848,7 +77848,7 @@ def get(self, resource_group_name: str, dscp_configuration_name: str, **kwargs: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) request = build_dscp_configuration_get_request( @@ -77897,7 +77897,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Dsc _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -77967,7 +77967,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.DscpConfiguration"]: _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.DscpConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -78034,7 +78034,7 @@ def build_inbound_security_rule_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -78103,7 +78103,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundSecurityRule] = kwargs.pop("cls", None) @@ -78195,7 +78195,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InboundSecurityRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -78247,7 +78247,7 @@ def build_web_categories_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78275,7 +78275,7 @@ def build_web_categories_list_by_subscription_request(subscription_id: str, **kw _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78339,7 +78339,7 @@ def get(self, name: str, *, expand: Optional[str] = None, **kwargs: Any) -> _mod _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureWebCategory] = kwargs.pop("cls", None) request = build_web_categories_get_request( @@ -78386,7 +78386,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AzureWebCateg _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AzureWebCategoryListResult] = kwargs.pop("cls", None) error_map = { @@ -78449,7 +78449,7 @@ def build_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -78483,7 +78483,7 @@ def build_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78514,7 +78514,7 @@ def build_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78545,7 +78545,7 @@ def build_nat_rules_list_by_vpn_gateway_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78608,7 +78608,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) @@ -78674,7 +78674,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_nat_rules_delete_request( @@ -78746,7 +78746,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -78819,7 +78819,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -78888,7 +78888,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) request = build_nat_rules_get_request( @@ -78942,7 +78942,7 @@ def list_by_vpn_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnGatewayNatRulesResult] = kwargs.pop("cls", None) error_map = { @@ -79007,7 +79007,7 @@ def build_virtual_network_gateway_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -79043,7 +79043,7 @@ def build_virtual_network_gateway_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79076,7 +79076,7 @@ def build_virtual_network_gateway_nat_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79109,7 +79109,7 @@ def build_virtual_network_gateway_nat_rules_list_by_virtual_network_gateway_requ _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79174,7 +79174,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) @@ -79240,7 +79240,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_virtual_network_gateway_nat_rules_delete_request( @@ -79314,7 +79314,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -79387,7 +79387,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -79456,7 +79456,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) request = build_virtual_network_gateway_nat_rules_get_request( @@ -79512,7 +79512,7 @@ def list_by_virtual_network_gateway( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVirtualNetworkGatewayNatRulesResult] = kwargs.pop("cls", None) error_map = { @@ -80000,7 +80000,7 @@ def build_admin_rule_collections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -80077,7 +80077,7 @@ def build_admin_rule_collections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80116,7 +80116,7 @@ def build_admin_rule_collections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80158,7 +80158,7 @@ def build_admin_rule_collections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80249,7 +80249,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) @@ -80412,7 +80412,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) request = build_admin_rule_collections_get_request( @@ -80485,7 +80485,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleCollectionListResult] = kwargs.pop("cls", None) error_map = { @@ -80568,7 +80568,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_admin_rule_collections_delete_request( @@ -80607,7 +80607,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -80650,7 +80650,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -80705,7 +80705,7 @@ def build_admin_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -80786,7 +80786,7 @@ def build_admin_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80827,7 +80827,7 @@ def build_admin_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80871,7 +80871,7 @@ def build_admin_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80966,7 +80966,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) @@ -81137,7 +81137,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) request = build_admin_rules_get_request( @@ -81214,7 +81214,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.AdminRuleListResult] = kwargs.pop("cls", None) error_map = { @@ -81299,7 +81299,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_admin_rules_delete_request( @@ -81339,7 +81339,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -81385,7 +81385,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -81435,7 +81435,7 @@ def build_connectivity_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -81500,7 +81500,7 @@ def build_connectivity_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81537,7 +81537,7 @@ def build_connectivity_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81577,7 +81577,7 @@ def build_connectivity_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81665,7 +81665,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) @@ -81814,7 +81814,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) request = build_connectivity_configurations_get_request( @@ -81884,7 +81884,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ConnectivityConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -81965,7 +81965,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_connectivity_configurations_delete_request( @@ -82003,7 +82003,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -82044,7 +82044,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -82525,7 +82525,7 @@ def build_network_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -82592,7 +82592,7 @@ def build_network_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82629,7 +82629,7 @@ def build_network_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82669,7 +82669,7 @@ def build_network_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82761,7 +82761,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) @@ -82912,7 +82912,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) request = build_network_groups_get_request( @@ -82980,7 +82980,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkGroupListResult] = kwargs.pop("cls", None) error_map = { @@ -83061,7 +83061,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_groups_delete_request( @@ -83099,7 +83099,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -83138,7 +83138,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -83219,7 +83219,7 @@ def build_network_manager_commits_post_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83372,7 +83372,7 @@ def _post_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerCommit] = kwargs.pop("cls", None) @@ -83427,7 +83427,7 @@ def _post_initial( _post_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_post( @@ -83466,7 +83466,7 @@ def begin_post( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerCommit] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -83522,7 +83522,7 @@ def build_network_manager_deployment_status_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83573,7 +83573,7 @@ def __init__(self, *args, **kwargs): self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @api_version_validation( params_valid_on={ - "top": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + "top": ['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], } ) @distributed_trace @@ -83618,7 +83618,7 @@ def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerDeploymentStatusListResult] = kwargs.pop("cls", None) @@ -83811,7 +83811,7 @@ def build_network_managers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -83874,7 +83874,7 @@ def build_network_managers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83909,7 +83909,7 @@ def build_network_managers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83942,7 +83942,7 @@ def build_network_managers_list_by_subscription_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84009,7 +84009,7 @@ def build_network_managers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84041,7 +84041,7 @@ def build_network_managers_patch_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -84124,7 +84124,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) @@ -84261,7 +84261,7 @@ def get(self, resource_group_name: str, network_manager_name: str, **kwargs: Any _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) request = build_network_managers_get_request( @@ -84320,7 +84320,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerListResult] = kwargs.pop("cls", None) error_map = { @@ -84402,7 +84402,7 @@ def list_by_subscription( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerListResult] = kwargs.pop("cls", None) error_map = { @@ -84563,7 +84563,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_managers_delete_request( @@ -84600,7 +84600,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -84631,7 +84631,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -84673,7 +84673,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def patch( @@ -84711,7 +84711,7 @@ def patch( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) @@ -88484,7 +88484,7 @@ def build_security_admin_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88549,7 +88549,7 @@ def build_security_admin_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88586,7 +88586,7 @@ def build_security_admin_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88626,7 +88626,7 @@ def build_security_admin_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88713,7 +88713,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) @@ -88858,7 +88858,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) request = build_security_admin_configurations_get_request( @@ -88929,7 +88929,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SecurityAdminConfigurationListResult] = kwargs.pop("cls", None) error_map = { @@ -89010,7 +89010,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_security_admin_configurations_delete_request( @@ -89048,7 +89048,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete( @@ -89087,7 +89087,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -90709,7 +90709,7 @@ def build_application_gateway_waf_dynamic_manifests_default_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90774,7 +90774,7 @@ def get(self, location: str, **kwargs: Any) -> _models.ApplicationGatewayWafDyna _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResult] = kwargs.pop("cls", None) request = build_application_gateway_waf_dynamic_manifests_default_get_request( @@ -90814,7 +90814,7 @@ def build_application_gateway_waf_dynamic_manifests_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90873,7 +90873,7 @@ def get(self, location: str, **kwargs: Any) -> Iterable["_models.ApplicationGate _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResultList] = kwargs.pop("cls", None) error_map = { @@ -90941,7 +90941,7 @@ def build_configuration_policy_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -90983,7 +90983,7 @@ def build_configuration_policy_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91022,7 +91022,7 @@ def build_configuration_policy_groups_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91057,7 +91057,7 @@ def build_configuration_policy_groups_list_by_vpn_server_configuration_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91122,7 +91122,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) @@ -91194,7 +91194,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_configuration_policy_groups_delete_request( @@ -91268,7 +91268,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -91345,7 +91345,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -91419,7 +91419,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) request = build_configuration_policy_groups_get_request( @@ -91475,7 +91475,7 @@ def list_by_vpn_server_configuration( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListVpnServerConfigurationPolicyGroupsResult] = kwargs.pop("cls", None) error_map = { @@ -91540,7 +91540,7 @@ def build_express_route_port_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -91574,7 +91574,7 @@ def build_express_route_port_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91605,7 +91605,7 @@ def build_express_route_port_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91636,7 +91636,7 @@ def build_express_route_port_authorizations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91699,7 +91699,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) @@ -91765,7 +91765,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_express_route_port_authorizations_delete_request( @@ -91838,7 +91838,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -91911,7 +91911,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -91980,7 +91980,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) request = build_express_route_port_authorizations_get_request( @@ -92036,7 +92036,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRoutePortAuthorizationListResult] = kwargs.pop("cls", None) error_map = { @@ -92101,7 +92101,7 @@ def build_express_route_provider_ports_location_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92167,7 +92167,7 @@ def list(self, *, filter: Optional[str] = None, **kwargs: Any) -> _models.Expres _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ExpressRouteProviderPortListResult] = kwargs.pop("cls", None) request = build_express_route_provider_ports_location_list_request( @@ -92207,7 +92207,7 @@ def build_firewall_policy_idps_signatures_filter_values_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92290,7 +92290,7 @@ def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignatureOverridesFilterValuesResponse] = kwargs.pop("cls", None) @@ -92343,7 +92343,7 @@ def build_firewall_policy_idps_signatures_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92426,7 +92426,7 @@ def list( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.QueryResults] = kwargs.pop("cls", None) @@ -92479,7 +92479,7 @@ def build_firewall_policy_idps_signatures_overrides_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92509,7 +92509,7 @@ def build_firewall_policy_idps_signatures_overrides_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92539,7 +92539,7 @@ def build_firewall_policy_idps_signatures_overrides_patch_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92572,7 +92572,7 @@ def build_firewall_policy_idps_signatures_overrides_put_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92643,7 +92643,7 @@ def get(self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) request = build_firewall_policy_idps_signatures_overrides_get_request( @@ -92705,7 +92705,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SignaturesOverridesList] = kwargs.pop("cls", None) request = build_firewall_policy_idps_signatures_overrides_list_request( @@ -92776,7 +92776,7 @@ def patch( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) @@ -92859,7 +92859,7 @@ def put( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) @@ -92912,7 +92912,7 @@ def build_management_group_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92946,7 +92946,7 @@ def build_management_group_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92977,7 +92977,7 @@ def build_management_group_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93008,7 +93008,7 @@ def build_management_group_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93091,7 +93091,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) @@ -93168,7 +93168,7 @@ def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_management_group_network_manager_connections_delete_request( @@ -93225,7 +93225,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) request = build_management_group_network_manager_connections_get_request( @@ -93286,7 +93286,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -93351,7 +93351,7 @@ def build_route_maps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93385,7 +93385,7 @@ def build_route_maps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93416,7 +93416,7 @@ def build_route_maps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93447,7 +93447,7 @@ def build_route_maps_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93510,7 +93510,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) @@ -93576,7 +93576,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_route_maps_delete_request( @@ -93646,7 +93646,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -93719,7 +93719,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -93788,7 +93788,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) request = build_route_maps_get_request( @@ -93841,7 +93841,7 @@ def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListRouteMapsResult] = kwargs.pop("cls", None) error_map = { @@ -93906,7 +93906,7 @@ def build_routing_intent_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93940,7 +93940,7 @@ def build_routing_intent_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93971,7 +93971,7 @@ def build_routing_intent_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94002,7 +94002,7 @@ def build_routing_intent_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94065,7 +94065,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) @@ -94131,7 +94131,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_routing_intent_delete_request( @@ -94203,7 +94203,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -94276,7 +94276,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -94345,7 +94345,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) request = build_routing_intent_get_request( @@ -94397,7 +94397,7 @@ def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) - _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ListRoutingIntentResult] = kwargs.pop("cls", None) error_map = { @@ -94462,7 +94462,7 @@ def build_scope_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -94496,7 +94496,7 @@ def build_scope_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94527,7 +94527,7 @@ def build_scope_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94564,7 +94564,7 @@ def build_scope_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94651,7 +94651,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) @@ -94731,7 +94731,7 @@ def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_scope_connections_delete_request( @@ -94791,7 +94791,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) request = build_scope_connections_get_request( @@ -94859,7 +94859,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ScopeConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -94931,7 +94931,7 @@ def build_service_tag_information_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95008,7 +95008,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.ServiceTagInformationListResult] = kwargs.pop("cls", None) error_map = { @@ -95079,7 +95079,7 @@ def build_static_members_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95119,7 +95119,7 @@ def build_static_members_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95156,7 +95156,7 @@ def build_static_members_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95195,7 +95195,7 @@ def build_static_members_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95286,7 +95286,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) @@ -95374,7 +95374,7 @@ def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_static_members_delete_request( @@ -95442,7 +95442,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) request = build_static_members_get_request( @@ -95514,7 +95514,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.StaticMemberListResult] = kwargs.pop("cls", None) error_map = { @@ -95582,7 +95582,7 @@ def build_subscription_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95616,7 +95616,7 @@ def build_subscription_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95647,7 +95647,7 @@ def build_subscription_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95678,7 +95678,7 @@ def build_subscription_network_manager_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95756,7 +95756,7 @@ def create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) @@ -95830,7 +95830,7 @@ def delete( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_subscription_network_manager_connections_delete_request( @@ -95882,7 +95882,7 @@ def get(self, network_manager_connection_name: str, **kwargs: Any) -> _models.Ne _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) request = build_subscription_network_manager_connections_get_request( @@ -95940,7 +95940,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkManagerConnectionListResult] = kwargs.pop("cls", None) error_map = { @@ -96006,7 +96006,7 @@ def build_vip_swap_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96039,7 +96039,7 @@ def build_vip_swap_get_request(group_name: str, resource_name: str, subscription _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96070,7 +96070,7 @@ def build_vip_swap_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96129,7 +96129,7 @@ def _create_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -96209,7 +96209,7 @@ def begin_create( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -96281,7 +96281,7 @@ def get(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.Swa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SwapResource] = kwargs.pop("cls", None) request = build_vip_swap_get_request( @@ -96342,7 +96342,7 @@ def list(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.Sw _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.SwapResourceListResult] = kwargs.pop("cls", None) request = build_vip_swap_list_request( @@ -96387,7 +96387,7 @@ def build_network_virtual_appliance_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96427,7 +96427,7 @@ def build_network_virtual_appliance_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96464,7 +96464,7 @@ def build_network_virtual_appliance_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96497,7 +96497,7 @@ def build_network_virtual_appliance_connections_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96562,7 +96562,7 @@ def _create_or_update_initial( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) @@ -96630,7 +96630,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_network_virtual_appliance_connections_delete_request( @@ -96709,7 +96709,7 @@ def begin_create_or_update( _headers = case_insensitive_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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -96782,7 +96782,7 @@ def begin_delete( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) 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) @@ -96851,7 +96851,7 @@ def get( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) request = build_network_virtual_appliance_connections_get_request( @@ -96907,7 +96907,7 @@ def list( _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._api_version or "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) cls: ClsType[_models.NetworkVirtualApplianceConnectionList] = kwargs.pop("cls", None) error_map = { @@ -96972,7 +96972,7 @@ def build_network_management_check_dns_name_availability_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97002,7 +97002,7 @@ def build_network_management_supported_security_providers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97032,7 +97032,7 @@ def build_network_management_generatevirtualwanvpnserverconfigurationvpnprofile_ _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97065,7 +97065,7 @@ def build_network_management_delete_bastion_shareable_link_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97098,7 +97098,7 @@ def build_network_management_get_active_sessions_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97128,7 +97128,7 @@ def build_network_management_put_bastion_shareable_link_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97161,7 +97161,7 @@ def build_network_management_disconnect_active_sessions_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97194,7 +97194,7 @@ def build_network_management_get_bastion_shareable_link_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97227,7 +97227,7 @@ def build_network_management_express_route_provider_port_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97261,7 +97261,7 @@ def build_network_management_list_active_connectivity_configurations_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97301,7 +97301,7 @@ def build_network_management_list_active_security_admin_rules_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97341,7 +97341,7 @@ def build_network_management_list_network_manager_effective_connectivity_configu _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97381,7 +97381,7 @@ def build_network_management_list_network_manager_effective_security_admin_rules _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97416,7 +97416,7 @@ def build_network_management_delete_bastion_shareable_link_by_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97448,7 +97448,7 @@ def _api_version(self, op_name: str) -> str: return self._get_api_version(op_name) @api_version_validation( - method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2015-06-15', '2017-10-01', '2018-04-01', '2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def check_dns_name_availability( @@ -97478,7 +97478,7 @@ def check_dns_name_availability( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("check_dns_name_availability") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("check_dns_name_availability") or "2023-09-01") ) cls: ClsType[_models.DnsNameAvailabilityResult] = kwargs.pop("cls", None) @@ -97515,7 +97515,7 @@ def check_dns_name_availability( check_dns_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability'} @api_version_validation( - method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2018-11-01', '2018-12-01', '2019-02-01', '2019-04-01', '2019-06-01', '2019-07-01', '2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def supported_security_providers( @@ -97545,7 +97545,7 @@ def supported_security_providers( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("supported_security_providers") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("supported_security_providers") or "2023-09-01") ) cls: ClsType[_models.VirtualWanSecurityProviders] = kwargs.pop("cls", None) @@ -97603,7 +97603,7 @@ def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( "api_version", _params.pop( "api-version", - self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-06-01", + self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -97655,7 +97655,7 @@ def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( _generatevirtualwanvpnserverconfigurationvpnprofile_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile'} @api_version_validation( - method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-08-01', '2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_generatevirtualwanvpnserverconfigurationvpnprofile( @@ -97701,7 +97701,7 @@ def begin_generatevirtualwanvpnserverconfigurationvpnprofile( "api_version", _params.pop( "api-version", - self._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-06-01", + self._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -97768,7 +97768,7 @@ def _delete_bastion_shareable_link_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-06-01"), + _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -97827,7 +97827,7 @@ def _get_active_sessions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("_get_active_sessions_initial") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("_get_active_sessions_initial") or "2023-09-01") ) cls: ClsType[Optional[_models.BastionActiveSessionListResult]] = kwargs.pop("cls", None) @@ -97885,7 +97885,7 @@ def _put_bastion_shareable_link_initial( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-06-01"), + _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.BastionShareableLinkListResult]] = kwargs.pop("cls", None) @@ -97936,7 +97936,7 @@ def _put_bastion_shareable_link_initial( _put_bastion_shareable_link_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete_bastion_shareable_link( @@ -97975,7 +97975,7 @@ def begin_delete_bastion_shareable_link( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("begin_delete_bastion_shareable_link") or "2023-06-01"), + _params.pop("api-version", self._api_version("begin_delete_bastion_shareable_link") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -98020,7 +98020,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_get_active_sessions( @@ -98051,7 +98051,7 @@ def begin_get_active_sessions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("begin_get_active_sessions") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("begin_get_active_sessions") or "2023-09-01") ) cls: ClsType[_models.BastionActiveSessionListResult] = kwargs.pop("cls", None) @@ -98150,7 +98150,7 @@ def internal_get_next(next_link=None): begin_get_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def begin_put_bastion_shareable_link( @@ -98192,7 +98192,7 @@ def begin_put_bastion_shareable_link( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("begin_put_bastion_shareable_link") or "2023-06-01"), + _params.pop("api-version", self._api_version("begin_put_bastion_shareable_link") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) @@ -98303,7 +98303,7 @@ def internal_get_next(next_link=None): begin_put_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def disconnect_active_sessions( @@ -98335,7 +98335,7 @@ def disconnect_active_sessions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("disconnect_active_sessions") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("disconnect_active_sessions") or "2023-09-01") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionSessionDeleteResult] = kwargs.pop("cls", None) @@ -98407,7 +98407,7 @@ def get_next(next_link=None): disconnect_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions'} @api_version_validation( - method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2019-09-01', '2019-11-01', '2019-12-01', '2020-03-01', '2020-04-01', '2020-05-01', '2020-06-01', '2020-07-01', '2020-08-01', '2020-11-01', '2021-02-01', '2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def get_bastion_shareable_link( @@ -98440,7 +98440,7 @@ def get_bastion_shareable_link( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("get_bastion_shareable_link") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("get_bastion_shareable_link") or "2023-09-01") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) @@ -98512,7 +98512,7 @@ def get_next(next_link=None): get_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _models.ExpressRouteProviderPort: @@ -98537,7 +98537,7 @@ def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _mode _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version("express_route_provider_port") or "2023-06-01") + "api_version", _params.pop("api-version", self._api_version("express_route_provider_port") or "2023-09-01") ) cls: ClsType[_models.ExpressRouteProviderPort] = kwargs.pop("cls", None) @@ -98573,7 +98573,7 @@ def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _mode express_route_provider_port.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_active_connectivity_configurations( @@ -98618,7 +98618,7 @@ def list_active_connectivity_configurations( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-06-01"), + _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActiveConnectivityConfigurationsListResult] = kwargs.pop("cls", None) @@ -98668,7 +98668,7 @@ def list_active_connectivity_configurations( list_active_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_active_security_admin_rules( @@ -98713,7 +98713,7 @@ def list_active_security_admin_rules( api_version: str = kwargs.pop( "api_version", - _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-06-01"), + _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-09-01"), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActiveSecurityAdminRulesListResult] = kwargs.pop("cls", None) @@ -98763,7 +98763,7 @@ def list_active_security_admin_rules( list_active_security_admin_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_network_manager_effective_connectivity_configurations( @@ -98812,7 +98812,7 @@ def list_network_manager_effective_connectivity_configurations( "api_version", _params.pop( "api-version", - self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-06-01", + self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-09-01", ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -98865,7 +98865,7 @@ def list_network_manager_effective_connectivity_configurations( list_network_manager_effective_connectivity_configurations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations'} @api_version_validation( - method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01'], + method_valid_on=['2023-02-01', '2023-04-01', '2023-05-01', '2023-06-01', '2023-09-01'], ) @distributed_trace def list_network_manager_effective_security_admin_rules( @@ -98912,7 +98912,7 @@ def list_network_manager_effective_security_admin_rules( api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-06-01" + "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -98983,7 +98983,7 @@ def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsis api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-06-01" + "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -99032,7 +99032,7 @@ def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsis _delete_bastion_shareable_link_by_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken'} @api_version_validation( - method_valid_on=['2023-06-01'], + method_valid_on=['2023-06-01', '2023-09-01'], ) @distributed_trace def begin_delete_bastion_shareable_link_by_token( @@ -99073,7 +99073,7 @@ def begin_delete_bastion_shareable_link_by_token( api_version: str = kwargs.pop( "api_version", _params.pop( - "api-version", self._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-06-01" + "api-version", self._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-09-01" ), ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/_version.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/_version.py index 05e4b2ec08fb..e5754a47ce68 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/_version.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "25.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/aio/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/aio/operations/_operations.py index 854034bf89b0..555bf5dd62b1 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/aio/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/aio/operations/_operations.py @@ -4347,8 +4347,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/operations/_operations.py index f5d73c190f85..038183ea23fc 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/operations/_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_05_01/operations/_operations.py @@ -24067,8 +24067,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/__init__.py new file mode 100644 index 000000000000..22f85294640f --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._network_management_client import NetworkManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NetworkManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_configuration.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_configuration.py new file mode 100644 index 000000000000..2d3e406d04a2 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_configuration.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class NetworkManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for NetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-network/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_metadata.json b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_metadata.json new file mode 100644 index 000000000000..258456c70573 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_metadata.json @@ -0,0 +1,496 @@ +{ + "chosen_version": "2023-09-01", + "total_api_version_list": ["2018-10-01", "2023-09-01"], + "client": { + "name": "NetworkManagementClient", + "filename": "_network_management_client", + "description": "Network Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"NetworkManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"NetworkManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"NetworkManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "application_gateways": "ApplicationGatewaysOperations", + "application_gateway_private_link_resources": "ApplicationGatewayPrivateLinkResourcesOperations", + "application_gateway_private_endpoint_connections": "ApplicationGatewayPrivateEndpointConnectionsOperations", + "application_gateway_waf_dynamic_manifests_default": "ApplicationGatewayWafDynamicManifestsDefaultOperations", + "application_gateway_waf_dynamic_manifests": "ApplicationGatewayWafDynamicManifestsOperations", + "application_security_groups": "ApplicationSecurityGroupsOperations", + "available_delegations": "AvailableDelegationsOperations", + "available_resource_group_delegations": "AvailableResourceGroupDelegationsOperations", + "available_service_aliases": "AvailableServiceAliasesOperations", + "azure_firewalls": "AzureFirewallsOperations", + "azure_firewall_fqdn_tags": "AzureFirewallFqdnTagsOperations", + "web_categories": "WebCategoriesOperations", + "bastion_hosts": "BastionHostsOperations", + "network_interfaces": "NetworkInterfacesOperations", + "public_ip_addresses": "PublicIPAddressesOperations", + "vip_swap": "VipSwapOperations", + "custom_ip_prefixes": "CustomIPPrefixesOperations", + "ddos_custom_policies": "DdosCustomPoliciesOperations", + "ddos_protection_plans": "DdosProtectionPlansOperations", + "dscp_configuration": "DscpConfigurationOperations", + "available_endpoint_services": "AvailableEndpointServicesOperations", + "express_route_circuit_authorizations": "ExpressRouteCircuitAuthorizationsOperations", + "express_route_circuit_peerings": "ExpressRouteCircuitPeeringsOperations", + "express_route_circuit_connections": "ExpressRouteCircuitConnectionsOperations", + "peer_express_route_circuit_connections": "PeerExpressRouteCircuitConnectionsOperations", + "express_route_circuits": "ExpressRouteCircuitsOperations", + "express_route_service_providers": "ExpressRouteServiceProvidersOperations", + "express_route_cross_connections": "ExpressRouteCrossConnectionsOperations", + "express_route_cross_connection_peerings": "ExpressRouteCrossConnectionPeeringsOperations", + "express_route_ports_locations": "ExpressRoutePortsLocationsOperations", + "express_route_ports": "ExpressRoutePortsOperations", + "express_route_links": "ExpressRouteLinksOperations", + "express_route_port_authorizations": "ExpressRoutePortAuthorizationsOperations", + "express_route_provider_ports_location": "ExpressRouteProviderPortsLocationOperations", + "firewall_policies": "FirewallPoliciesOperations", + "firewall_policy_rule_collection_groups": "FirewallPolicyRuleCollectionGroupsOperations", + "firewall_policy_idps_signatures": "FirewallPolicyIdpsSignaturesOperations", + "firewall_policy_idps_signatures_overrides": "FirewallPolicyIdpsSignaturesOverridesOperations", + "firewall_policy_idps_signatures_filter_values": "FirewallPolicyIdpsSignaturesFilterValuesOperations", + "ip_allocations": "IpAllocationsOperations", + "ip_groups": "IpGroupsOperations", + "load_balancers": "LoadBalancersOperations", + "load_balancer_backend_address_pools": "LoadBalancerBackendAddressPoolsOperations", + "load_balancer_frontend_ip_configurations": "LoadBalancerFrontendIPConfigurationsOperations", + "inbound_nat_rules": "InboundNatRulesOperations", + "load_balancer_load_balancing_rules": "LoadBalancerLoadBalancingRulesOperations", + "load_balancer_outbound_rules": "LoadBalancerOutboundRulesOperations", + "load_balancer_network_interfaces": "LoadBalancerNetworkInterfacesOperations", + "load_balancer_probes": "LoadBalancerProbesOperations", + "nat_gateways": "NatGatewaysOperations", + "network_interface_ip_configurations": "NetworkInterfaceIPConfigurationsOperations", + "network_interface_load_balancers": "NetworkInterfaceLoadBalancersOperations", + "network_interface_tap_configurations": "NetworkInterfaceTapConfigurationsOperations", + "network_managers": "NetworkManagersOperations", + "network_manager_commits": "NetworkManagerCommitsOperations", + "network_manager_deployment_status": "NetworkManagerDeploymentStatusOperations", + "subscription_network_manager_connections": "SubscriptionNetworkManagerConnectionsOperations", + "management_group_network_manager_connections": "ManagementGroupNetworkManagerConnectionsOperations", + "connectivity_configurations": "ConnectivityConfigurationsOperations", + "network_groups": "NetworkGroupsOperations", + "static_members": "StaticMembersOperations", + "scope_connections": "ScopeConnectionsOperations", + "security_admin_configurations": "SecurityAdminConfigurationsOperations", + "admin_rule_collections": "AdminRuleCollectionsOperations", + "admin_rules": "AdminRulesOperations", + "network_profiles": "NetworkProfilesOperations", + "network_security_groups": "NetworkSecurityGroupsOperations", + "security_rules": "SecurityRulesOperations", + "default_security_rules": "DefaultSecurityRulesOperations", + "network_virtual_appliances": "NetworkVirtualAppliancesOperations", + "virtual_appliance_sites": "VirtualApplianceSitesOperations", + "virtual_appliance_skus": "VirtualApplianceSkusOperations", + "inbound_security_rule": "InboundSecurityRuleOperations", + "network_watchers": "NetworkWatchersOperations", + "packet_captures": "PacketCapturesOperations", + "connection_monitors": "ConnectionMonitorsOperations", + "flow_logs": "FlowLogsOperations", + "operations": "Operations", + "private_endpoints": "PrivateEndpointsOperations", + "available_private_endpoint_types": "AvailablePrivateEndpointTypesOperations", + "private_dns_zone_groups": "PrivateDnsZoneGroupsOperations", + "private_link_services": "PrivateLinkServicesOperations", + "public_ip_prefixes": "PublicIPPrefixesOperations", + "route_filters": "RouteFiltersOperations", + "route_filter_rules": "RouteFilterRulesOperations", + "route_tables": "RouteTablesOperations", + "routes": "RoutesOperations", + "security_partner_providers": "SecurityPartnerProvidersOperations", + "bgp_service_communities": "BgpServiceCommunitiesOperations", + "service_endpoint_policies": "ServiceEndpointPoliciesOperations", + "service_endpoint_policy_definitions": "ServiceEndpointPolicyDefinitionsOperations", + "service_tags": "ServiceTagsOperations", + "service_tag_information": "ServiceTagInformationOperations", + "usages": "UsagesOperations", + "virtual_networks": "VirtualNetworksOperations", + "subnets": "SubnetsOperations", + "resource_navigation_links": "ResourceNavigationLinksOperations", + "service_association_links": "ServiceAssociationLinksOperations", + "virtual_network_peerings": "VirtualNetworkPeeringsOperations", + "virtual_network_gateways": "VirtualNetworkGatewaysOperations", + "virtual_network_gateway_connections": "VirtualNetworkGatewayConnectionsOperations", + "local_network_gateways": "LocalNetworkGatewaysOperations", + "virtual_network_gateway_nat_rules": "VirtualNetworkGatewayNatRulesOperations", + "virtual_network_taps": "VirtualNetworkTapsOperations", + "virtual_routers": "VirtualRoutersOperations", + "virtual_router_peerings": "VirtualRouterPeeringsOperations", + "virtual_wans": "VirtualWansOperations", + "vpn_sites": "VpnSitesOperations", + "vpn_site_links": "VpnSiteLinksOperations", + "vpn_sites_configuration": "VpnSitesConfigurationOperations", + "vpn_server_configurations": "VpnServerConfigurationsOperations", + "configuration_policy_groups": "ConfigurationPolicyGroupsOperations", + "virtual_hubs": "VirtualHubsOperations", + "route_maps": "RouteMapsOperations", + "hub_virtual_network_connections": "HubVirtualNetworkConnectionsOperations", + "vpn_gateways": "VpnGatewaysOperations", + "vpn_link_connections": "VpnLinkConnectionsOperations", + "vpn_connections": "VpnConnectionsOperations", + "vpn_site_link_connections": "VpnSiteLinkConnectionsOperations", + "nat_rules": "NatRulesOperations", + "p2_svpn_gateways": "P2SVpnGatewaysOperations", + "vpn_server_configurations_associated_with_virtual_wan": "VpnServerConfigurationsAssociatedWithVirtualWanOperations", + "virtual_hub_route_table_v2_s": "VirtualHubRouteTableV2SOperations", + "express_route_gateways": "ExpressRouteGatewaysOperations", + "express_route_connections": "ExpressRouteConnectionsOperations", + "network_virtual_appliance_connections": "NetworkVirtualApplianceConnectionsOperations", + "virtual_hub_bgp_connection": "VirtualHubBgpConnectionOperations", + "virtual_hub_bgp_connections": "VirtualHubBgpConnectionsOperations", + "virtual_hub_ip_configuration": "VirtualHubIpConfigurationOperations", + "hub_route_tables": "HubRouteTablesOperations", + "routing_intent": "RoutingIntentOperations", + "web_application_firewall_policies": "WebApplicationFirewallPoliciesOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}, \"azurecore\": {\"azure.core.paging\": [\"ItemPaged\"], \"azure.core.polling\": [\"LROPoller\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}, \"azurecore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"], \"azure.core.polling\": [\"AsyncLROPoller\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", + "operations": { + "_put_bastion_shareable_link_initial" : { + "sync": { + "signature": "def _put_bastion_shareable_link_initial(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e Optional[_models.BastionShareableLinkListResult]:\n", + "doc": "\"\"\"Creates a Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BastionShareableLinkListResult or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListResult or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def _put_bastion_shareable_link_initial(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e Optional[_models.BastionShareableLinkListResult]:\n", + "doc": "\"\"\"Creates a Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BastionShareableLinkListResult or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListResult or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + } + }, + "begin_put_bastion_shareable_link" : { + "sync": { + "signature": "def begin_put_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.BastionShareableLink\"]]:\n", + "doc": "\"\"\"Creates a Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either\n BastionShareableLinkListResult or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def begin_put_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e AsyncLROPoller[AsyncIterable[\"_models.BastionShareableLink\"]]:\n", + "doc": "\"\"\"Creates a Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either\n BastionShareableLinkListResult or the result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + } + }, + "_delete_bastion_shareable_link_initial" : { + "sync": { + "signature": "def _delete_bastion_shareable_link_initial( # pylint: disable=inconsistent-return-statements\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def _delete_bastion_shareable_link_initial( # pylint: disable=inconsistent-return-statements\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + } + }, + "begin_delete_bastion_shareable_link" : { + "sync": { + "signature": "def begin_delete_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e LROPoller[None]:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def begin_delete_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + } + }, + "_delete_bastion_shareable_link_by_token_initial" : { + "sync": { + "signature": "def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsistent-return-statements\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the tokens specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is\n either a BastionShareableLinkTokenListRequest type or a IO type. Required.\n:type bsl_token_request:\n ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_token_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsistent-return-statements\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the tokens specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is\n either a BastionShareableLinkTokenListRequest type or a IO type. Required.\n:type bsl_token_request:\n ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_token_request, **kwargs" + } + }, + "begin_delete_bastion_shareable_link_by_token" : { + "sync": { + "signature": "def begin_delete_bastion_shareable_link_by_token(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO],\n **kwargs: Any\n) -\u003e LROPoller[None]:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the tokens specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is\n either a BastionShareableLinkTokenListRequest type or a IO type. Required.\n:type bsl_token_request:\n ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_token_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def begin_delete_bastion_shareable_link_by_token(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO],\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Deletes the Bastion Shareable Links for all the tokens specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is\n either a BastionShareableLinkTokenListRequest type or a IO type. Required.\n:type bsl_token_request:\n ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_token_request, **kwargs" + } + }, + "get_bastion_shareable_link" : { + "sync": { + "signature": "def get_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e Iterable[\"_models.BastionShareableLink\"]:\n", + "doc": "\"\"\"Return the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BastionShareableLink or the result of\n cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + }, + "async": { + "coroutine": false, + "signature": "def get_bastion_shareable_link(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n bsl_request: Union[_models.BastionShareableLinkListRequest, IO],\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.BastionShareableLink\"]:\n", + "doc": "\"\"\"Return the Bastion Shareable Links for all the VMs specified in the request.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is\n either a BastionShareableLinkListRequest type or a IO type. Required.\n:type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BastionShareableLink or the result of\n cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, bsl_request, **kwargs" + } + }, + "_get_active_sessions_initial" : { + "sync": { + "signature": "def _get_active_sessions_initial(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n **kwargs: Any\n) -\u003e Optional[_models.BastionActiveSessionListResult]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BastionActiveSessionListResult or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.BastionActiveSessionListResult or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def _get_active_sessions_initial(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n **kwargs: Any\n) -\u003e Optional[_models.BastionActiveSessionListResult]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BastionActiveSessionListResult or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.BastionActiveSessionListResult or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, **kwargs" + } + }, + "begin_get_active_sessions" : { + "sync": { + "signature": "def begin_get_active_sessions(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.BastionActiveSession\"]]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either\n BastionActiveSessionListResult or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def begin_get_active_sessions(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n **kwargs: Any\n) -\u003e AsyncLROPoller[AsyncIterable[\"_models.BastionActiveSession\"]]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either\n BastionActiveSessionListResult or the result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, **kwargs" + } + }, + "disconnect_active_sessions" : { + "sync": { + "signature": "def disconnect_active_sessions(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n session_ids: Union[_models.SessionIds, IO],\n **kwargs: Any\n) -\u003e Iterable[\"_models.BastionSessionState\"]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param session_ids: The list of sessionids to disconnect. Is either a SessionIds type or a IO\n type. Required.\n:type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BastionSessionState or the result of cls(response)\n:rtype:\n ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, session_ids, **kwargs" + }, + "async": { + "coroutine": false, + "signature": "def disconnect_active_sessions(\n self,\n resource_group_name: str,\n bastion_host_name: str,\n session_ids: Union[_models.SessionIds, IO],\n **kwargs: Any\n) -\u003e AsyncIterable[\"_models.BastionSessionState\"]:\n", + "doc": "\"\"\"Returns the list of currently active sessions on the Bastion.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param bastion_host_name: The name of the Bastion Host. Required.\n:type bastion_host_name: str\n:param session_ids: The list of sessionids to disconnect. Is either a SessionIds type or a IO\n type. Required.\n:type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either BastionSessionState or the result of cls(response)\n:rtype:\n ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, bastion_host_name, session_ids, **kwargs" + } + }, + "check_dns_name_availability" : { + "sync": { + "signature": "def check_dns_name_availability(\n self,\n location: str,\n *,\n domain_name_label: str,\n **kwargs: Any\n) -\u003e _models.DnsNameAvailabilityResult:\n", + "doc": "\"\"\"Checks whether a domain name in the cloudapp.azure.com zone is available for use.\n\n:param location: The location of the domain name. Required.\n:type location: str\n:keyword domain_name_label: The domain name to be verified. It must conform to the following\n regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. Required.\n:paramtype domain_name_label: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DnsNameAvailabilityResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.DnsNameAvailabilityResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "location, domain_name_label=domain_name_label, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def check_dns_name_availability(\n self,\n location: str,\n *,\n domain_name_label: str,\n **kwargs: Any\n) -\u003e _models.DnsNameAvailabilityResult:\n", + "doc": "\"\"\"Checks whether a domain name in the cloudapp.azure.com zone is available for use.\n\n:param location: The location of the domain name. Required.\n:type location: str\n:keyword domain_name_label: The domain name to be verified. It must conform to the following\n regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. Required.\n:paramtype domain_name_label: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DnsNameAvailabilityResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.DnsNameAvailabilityResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "location, domain_name_label=domain_name_label, **kwargs" + } + }, + "express_route_provider_port" : { + "sync": { + "signature": "def express_route_provider_port(\n self,\n providerport: str,\n **kwargs: Any\n) -\u003e _models.ExpressRouteProviderPort:\n", + "doc": "\"\"\"Retrieves detail of a provider port.\n\n:param providerport: The name of the provider port. Required.\n:type providerport: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ExpressRouteProviderPort or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "providerport, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def express_route_provider_port(\n self,\n providerport: str,\n **kwargs: Any\n) -\u003e _models.ExpressRouteProviderPort:\n", + "doc": "\"\"\"Retrieves detail of a provider port.\n\n:param providerport: The name of the provider port. Required.\n:type providerport: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ExpressRouteProviderPort or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "providerport, **kwargs" + } + }, + "list_active_connectivity_configurations" : { + "sync": { + "signature": "def list_active_connectivity_configurations(\n self,\n resource_group_name: str,\n network_manager_name: str,\n parameters: Union[_models.ActiveConfigurationParameter, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.ActiveConnectivityConfigurationsListResult:\n", + "doc": "\"\"\"Lists active connectivity configurations in a network manager.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param network_manager_name: The name of the network manager. Required.\n:type network_manager_name: str\n:param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ActiveConnectivityConfigurationsListResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, network_manager_name, parameters, top=top, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def list_active_connectivity_configurations(\n self,\n resource_group_name: str,\n network_manager_name: str,\n parameters: Union[_models.ActiveConfigurationParameter, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.ActiveConnectivityConfigurationsListResult:\n", + "doc": "\"\"\"Lists active connectivity configurations in a network manager.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param network_manager_name: The name of the network manager. Required.\n:type network_manager_name: str\n:param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ActiveConnectivityConfigurationsListResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, network_manager_name, parameters, top=top, **kwargs" + } + }, + "list_active_security_admin_rules" : { + "sync": { + "signature": "def list_active_security_admin_rules(\n self,\n resource_group_name: str,\n network_manager_name: str,\n parameters: Union[_models.ActiveConfigurationParameter, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.ActiveSecurityAdminRulesListResult:\n", + "doc": "\"\"\"Lists active security admin rules in a network manager.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param network_manager_name: The name of the network manager. Required.\n:type network_manager_name: str\n:param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ActiveSecurityAdminRulesListResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, network_manager_name, parameters, top=top, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def list_active_security_admin_rules(\n self,\n resource_group_name: str,\n network_manager_name: str,\n parameters: Union[_models.ActiveConfigurationParameter, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.ActiveSecurityAdminRulesListResult:\n", + "doc": "\"\"\"Lists active security admin rules in a network manager.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param network_manager_name: The name of the network manager. Required.\n:type network_manager_name: str\n:param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ActiveSecurityAdminRulesListResult or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, network_manager_name, parameters, top=top, **kwargs" + } + }, + "list_network_manager_effective_connectivity_configurations" : { + "sync": { + "signature": "def list_network_manager_effective_connectivity_configurations(\n self,\n resource_group_name: str,\n virtual_network_name: str,\n parameters: Union[_models.QueryRequestOptions, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.NetworkManagerEffectiveConnectivityConfigurationListResult:\n", + "doc": "\"\"\"List all effective connectivity configurations applied on a virtual network.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param virtual_network_name: The name of the virtual network. Required.\n:type virtual_network_name: str\n:param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of\n cls(response)\n:rtype:\n ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_network_name, parameters, top=top, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def list_network_manager_effective_connectivity_configurations(\n self,\n resource_group_name: str,\n virtual_network_name: str,\n parameters: Union[_models.QueryRequestOptions, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.NetworkManagerEffectiveConnectivityConfigurationListResult:\n", + "doc": "\"\"\"List all effective connectivity configurations applied on a virtual network.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param virtual_network_name: The name of the virtual network. Required.\n:type virtual_network_name: str\n:param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of\n cls(response)\n:rtype:\n ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_network_name, parameters, top=top, **kwargs" + } + }, + "list_network_manager_effective_security_admin_rules" : { + "sync": { + "signature": "def list_network_manager_effective_security_admin_rules(\n self,\n resource_group_name: str,\n virtual_network_name: str,\n parameters: Union[_models.QueryRequestOptions, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.NetworkManagerEffectiveSecurityAdminRulesListResult:\n", + "doc": "\"\"\"List all effective security admin rules applied on a virtual network.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param virtual_network_name: The name of the virtual network. Required.\n:type virtual_network_name: str\n:param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response)\n:rtype:\n ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_network_name, parameters, top=top, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def list_network_manager_effective_security_admin_rules(\n self,\n resource_group_name: str,\n virtual_network_name: str,\n parameters: Union[_models.QueryRequestOptions, IO],\n *,\n top: Optional[int] = None,\n **kwargs: Any\n) -\u003e _models.NetworkManagerEffectiveSecurityAdminRulesListResult:\n", + "doc": "\"\"\"List all effective security admin rules applied on a virtual network.\n\n:param resource_group_name: The name of the resource group. Required.\n:type resource_group_name: str\n:param virtual_network_name: The name of the virtual network. Required.\n:type virtual_network_name: str\n:param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions\n type or a IO type. Required.\n:type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO\n:keyword top: An optional query parameter which specifies the maximum number of records to be\n returned by the server. Default value is None.\n:paramtype top: int\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response)\n:rtype:\n ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_network_name, parameters, top=top, **kwargs" + } + }, + "supported_security_providers" : { + "sync": { + "signature": "def supported_security_providers(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n **kwargs: Any\n) -\u003e _models.VirtualWanSecurityProviders:\n", + "doc": "\"\"\"Gives the supported security providers for the virtual wan.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN for which supported security providers are\n needed. Required.\n:type virtual_wan_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VirtualWanSecurityProviders or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProviders\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def supported_security_providers(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n **kwargs: Any\n) -\u003e _models.VirtualWanSecurityProviders:\n", + "doc": "\"\"\"Gives the supported security providers for the virtual wan.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN for which supported security providers are\n needed. Required.\n:type virtual_wan_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VirtualWanSecurityProviders or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProviders\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, **kwargs" + } + }, + "_generatevirtualwanvpnserverconfigurationvpnprofile_initial" : { + "sync": { + "signature": "def _generatevirtualwanvpnserverconfigurationvpnprofile_initial(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO],\n **kwargs: Any\n) -\u003e Optional[_models.VpnProfileResponse]:\n", + "doc": "\"\"\"Generates a unique VPN profile for P2S clients for VirtualWan and associated\nVpnServerConfiguration combination in the specified resource group.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is\n needed. Required.\n:type virtual_wan_name: str\n:param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation\n operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required.\n:type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VpnProfileResponse or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, vpn_client_params, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def _generatevirtualwanvpnserverconfigurationvpnprofile_initial(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO],\n **kwargs: Any\n) -\u003e Optional[_models.VpnProfileResponse]:\n", + "doc": "\"\"\"Generates a unique VPN profile for P2S clients for VirtualWan and associated\nVpnServerConfiguration combination in the specified resource group.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is\n needed. Required.\n:type virtual_wan_name: str\n:param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation\n operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required.\n:type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: VpnProfileResponse or None or the result of cls(response)\n:rtype: ~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, vpn_client_params, **kwargs" + } + }, + "begin_generatevirtualwanvpnserverconfigurationvpnprofile" : { + "sync": { + "signature": "def begin_generatevirtualwanvpnserverconfigurationvpnprofile(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO],\n **kwargs: Any\n) -\u003e LROPoller[_models.VpnProfileResponse]:\n", + "doc": "\"\"\"Generates a unique VPN profile for P2S clients for VirtualWan and associated\nVpnServerConfiguration combination in the specified resource group.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is\n needed. Required.\n:type virtual_wan_name: str\n:param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation\n operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required.\n:type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either VpnProfileResponse or the result of\n cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, vpn_client_params, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def begin_generatevirtualwanvpnserverconfigurationvpnprofile(\n self,\n resource_group_name: str,\n virtual_wan_name: str,\n vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO],\n **kwargs: Any\n) -\u003e AsyncLROPoller[_models.VpnProfileResponse]:\n", + "doc": "\"\"\"Generates a unique VPN profile for P2S clients for VirtualWan and associated\nVpnServerConfiguration combination in the specified resource group.\n\n:param resource_group_name: The resource group name. Required.\n:type resource_group_name: str\n:param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is\n needed. Required.\n:type virtual_wan_name: str\n:param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation\n operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required.\n:type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters\n or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either VpnProfileResponse or the result of\n cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "resource_group_name, virtual_wan_name, vpn_client_params, **kwargs" + } + } + } + } +} diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_network_management_client.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_network_management_client.py new file mode 100644 index 000000000000..0fed795c9d46 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_network_management_client.py @@ -0,0 +1,989 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import NetworkManagementClientConfiguration +from .operations import ( + AdminRuleCollectionsOperations, + AdminRulesOperations, + ApplicationGatewayPrivateEndpointConnectionsOperations, + ApplicationGatewayPrivateLinkResourcesOperations, + ApplicationGatewayWafDynamicManifestsDefaultOperations, + ApplicationGatewayWafDynamicManifestsOperations, + ApplicationGatewaysOperations, + ApplicationSecurityGroupsOperations, + AvailableDelegationsOperations, + AvailableEndpointServicesOperations, + AvailablePrivateEndpointTypesOperations, + AvailableResourceGroupDelegationsOperations, + AvailableServiceAliasesOperations, + AzureFirewallFqdnTagsOperations, + AzureFirewallsOperations, + BastionHostsOperations, + BgpServiceCommunitiesOperations, + ConfigurationPolicyGroupsOperations, + ConnectionMonitorsOperations, + ConnectivityConfigurationsOperations, + CustomIPPrefixesOperations, + DdosCustomPoliciesOperations, + DdosProtectionPlansOperations, + DefaultSecurityRulesOperations, + DscpConfigurationOperations, + ExpressRouteCircuitAuthorizationsOperations, + ExpressRouteCircuitConnectionsOperations, + ExpressRouteCircuitPeeringsOperations, + ExpressRouteCircuitsOperations, + ExpressRouteConnectionsOperations, + ExpressRouteCrossConnectionPeeringsOperations, + ExpressRouteCrossConnectionsOperations, + ExpressRouteGatewaysOperations, + ExpressRouteLinksOperations, + ExpressRoutePortAuthorizationsOperations, + ExpressRoutePortsLocationsOperations, + ExpressRoutePortsOperations, + ExpressRouteProviderPortsLocationOperations, + ExpressRouteServiceProvidersOperations, + FirewallPoliciesOperations, + FirewallPolicyIdpsSignaturesFilterValuesOperations, + FirewallPolicyIdpsSignaturesOperations, + FirewallPolicyIdpsSignaturesOverridesOperations, + FirewallPolicyRuleCollectionGroupsOperations, + FlowLogsOperations, + HubRouteTablesOperations, + HubVirtualNetworkConnectionsOperations, + InboundNatRulesOperations, + InboundSecurityRuleOperations, + IpAllocationsOperations, + IpGroupsOperations, + LoadBalancerBackendAddressPoolsOperations, + LoadBalancerFrontendIPConfigurationsOperations, + LoadBalancerLoadBalancingRulesOperations, + LoadBalancerNetworkInterfacesOperations, + LoadBalancerOutboundRulesOperations, + LoadBalancerProbesOperations, + LoadBalancersOperations, + LocalNetworkGatewaysOperations, + ManagementGroupNetworkManagerConnectionsOperations, + NatGatewaysOperations, + NatRulesOperations, + NetworkGroupsOperations, + NetworkInterfaceIPConfigurationsOperations, + NetworkInterfaceLoadBalancersOperations, + NetworkInterfaceTapConfigurationsOperations, + NetworkInterfacesOperations, + NetworkManagementClientOperationsMixin, + NetworkManagerCommitsOperations, + NetworkManagerDeploymentStatusOperations, + NetworkManagersOperations, + NetworkProfilesOperations, + NetworkSecurityGroupsOperations, + NetworkVirtualApplianceConnectionsOperations, + NetworkVirtualAppliancesOperations, + NetworkWatchersOperations, + Operations, + P2SVpnGatewaysOperations, + PacketCapturesOperations, + PeerExpressRouteCircuitConnectionsOperations, + PrivateDnsZoneGroupsOperations, + PrivateEndpointsOperations, + PrivateLinkServicesOperations, + PublicIPAddressesOperations, + PublicIPPrefixesOperations, + ResourceNavigationLinksOperations, + RouteFilterRulesOperations, + RouteFiltersOperations, + RouteMapsOperations, + RouteTablesOperations, + RoutesOperations, + RoutingIntentOperations, + ScopeConnectionsOperations, + SecurityAdminConfigurationsOperations, + SecurityPartnerProvidersOperations, + SecurityRulesOperations, + ServiceAssociationLinksOperations, + ServiceEndpointPoliciesOperations, + ServiceEndpointPolicyDefinitionsOperations, + ServiceTagInformationOperations, + ServiceTagsOperations, + StaticMembersOperations, + SubnetsOperations, + SubscriptionNetworkManagerConnectionsOperations, + UsagesOperations, + VipSwapOperations, + VirtualApplianceSitesOperations, + VirtualApplianceSkusOperations, + VirtualHubBgpConnectionOperations, + VirtualHubBgpConnectionsOperations, + VirtualHubIpConfigurationOperations, + VirtualHubRouteTableV2SOperations, + VirtualHubsOperations, + VirtualNetworkGatewayConnectionsOperations, + VirtualNetworkGatewayNatRulesOperations, + VirtualNetworkGatewaysOperations, + VirtualNetworkPeeringsOperations, + VirtualNetworkTapsOperations, + VirtualNetworksOperations, + VirtualRouterPeeringsOperations, + VirtualRoutersOperations, + VirtualWansOperations, + VpnConnectionsOperations, + VpnGatewaysOperations, + VpnLinkConnectionsOperations, + VpnServerConfigurationsAssociatedWithVirtualWanOperations, + VpnServerConfigurationsOperations, + VpnSiteLinkConnectionsOperations, + VpnSiteLinksOperations, + VpnSitesConfigurationOperations, + VpnSitesOperations, + WebApplicationFirewallPoliciesOperations, + WebCategoriesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class NetworkManagementClient( + NetworkManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Network Client. + + :ivar application_gateways: ApplicationGatewaysOperations operations + :vartype application_gateways: + azure.mgmt.network.v2023_09_01.operations.ApplicationGatewaysOperations + :ivar application_gateway_private_link_resources: + ApplicationGatewayPrivateLinkResourcesOperations operations + :vartype application_gateway_private_link_resources: + azure.mgmt.network.v2023_09_01.operations.ApplicationGatewayPrivateLinkResourcesOperations + :ivar application_gateway_private_endpoint_connections: + ApplicationGatewayPrivateEndpointConnectionsOperations operations + :vartype application_gateway_private_endpoint_connections: + azure.mgmt.network.v2023_09_01.operations.ApplicationGatewayPrivateEndpointConnectionsOperations + :ivar application_gateway_waf_dynamic_manifests_default: + ApplicationGatewayWafDynamicManifestsDefaultOperations operations + :vartype application_gateway_waf_dynamic_manifests_default: + azure.mgmt.network.v2023_09_01.operations.ApplicationGatewayWafDynamicManifestsDefaultOperations + :ivar application_gateway_waf_dynamic_manifests: + ApplicationGatewayWafDynamicManifestsOperations operations + :vartype application_gateway_waf_dynamic_manifests: + azure.mgmt.network.v2023_09_01.operations.ApplicationGatewayWafDynamicManifestsOperations + :ivar application_security_groups: ApplicationSecurityGroupsOperations operations + :vartype application_security_groups: + azure.mgmt.network.v2023_09_01.operations.ApplicationSecurityGroupsOperations + :ivar available_delegations: AvailableDelegationsOperations operations + :vartype available_delegations: + azure.mgmt.network.v2023_09_01.operations.AvailableDelegationsOperations + :ivar available_resource_group_delegations: AvailableResourceGroupDelegationsOperations + operations + :vartype available_resource_group_delegations: + azure.mgmt.network.v2023_09_01.operations.AvailableResourceGroupDelegationsOperations + :ivar available_service_aliases: AvailableServiceAliasesOperations operations + :vartype available_service_aliases: + azure.mgmt.network.v2023_09_01.operations.AvailableServiceAliasesOperations + :ivar azure_firewalls: AzureFirewallsOperations operations + :vartype azure_firewalls: azure.mgmt.network.v2023_09_01.operations.AzureFirewallsOperations + :ivar azure_firewall_fqdn_tags: AzureFirewallFqdnTagsOperations operations + :vartype azure_firewall_fqdn_tags: + azure.mgmt.network.v2023_09_01.operations.AzureFirewallFqdnTagsOperations + :ivar web_categories: WebCategoriesOperations operations + :vartype web_categories: azure.mgmt.network.v2023_09_01.operations.WebCategoriesOperations + :ivar bastion_hosts: BastionHostsOperations operations + :vartype bastion_hosts: azure.mgmt.network.v2023_09_01.operations.BastionHostsOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: + azure.mgmt.network.v2023_09_01.operations.NetworkInterfacesOperations + :ivar public_ip_addresses: PublicIPAddressesOperations operations + :vartype public_ip_addresses: + azure.mgmt.network.v2023_09_01.operations.PublicIPAddressesOperations + :ivar vip_swap: VipSwapOperations operations + :vartype vip_swap: azure.mgmt.network.v2023_09_01.operations.VipSwapOperations + :ivar custom_ip_prefixes: CustomIPPrefixesOperations operations + :vartype custom_ip_prefixes: + azure.mgmt.network.v2023_09_01.operations.CustomIPPrefixesOperations + :ivar ddos_custom_policies: DdosCustomPoliciesOperations operations + :vartype ddos_custom_policies: + azure.mgmt.network.v2023_09_01.operations.DdosCustomPoliciesOperations + :ivar ddos_protection_plans: DdosProtectionPlansOperations operations + :vartype ddos_protection_plans: + azure.mgmt.network.v2023_09_01.operations.DdosProtectionPlansOperations + :ivar dscp_configuration: DscpConfigurationOperations operations + :vartype dscp_configuration: + azure.mgmt.network.v2023_09_01.operations.DscpConfigurationOperations + :ivar available_endpoint_services: AvailableEndpointServicesOperations operations + :vartype available_endpoint_services: + azure.mgmt.network.v2023_09_01.operations.AvailableEndpointServicesOperations + :ivar express_route_circuit_authorizations: ExpressRouteCircuitAuthorizationsOperations + operations + :vartype express_route_circuit_authorizations: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCircuitAuthorizationsOperations + :ivar express_route_circuit_peerings: ExpressRouteCircuitPeeringsOperations operations + :vartype express_route_circuit_peerings: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCircuitPeeringsOperations + :ivar express_route_circuit_connections: ExpressRouteCircuitConnectionsOperations operations + :vartype express_route_circuit_connections: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCircuitConnectionsOperations + :ivar peer_express_route_circuit_connections: PeerExpressRouteCircuitConnectionsOperations + operations + :vartype peer_express_route_circuit_connections: + azure.mgmt.network.v2023_09_01.operations.PeerExpressRouteCircuitConnectionsOperations + :ivar express_route_circuits: ExpressRouteCircuitsOperations operations + :vartype express_route_circuits: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCircuitsOperations + :ivar express_route_service_providers: ExpressRouteServiceProvidersOperations operations + :vartype express_route_service_providers: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteServiceProvidersOperations + :ivar express_route_cross_connections: ExpressRouteCrossConnectionsOperations operations + :vartype express_route_cross_connections: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCrossConnectionsOperations + :ivar express_route_cross_connection_peerings: ExpressRouteCrossConnectionPeeringsOperations + operations + :vartype express_route_cross_connection_peerings: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteCrossConnectionPeeringsOperations + :ivar express_route_ports_locations: ExpressRoutePortsLocationsOperations operations + :vartype express_route_ports_locations: + azure.mgmt.network.v2023_09_01.operations.ExpressRoutePortsLocationsOperations + :ivar express_route_ports: ExpressRoutePortsOperations operations + :vartype express_route_ports: + azure.mgmt.network.v2023_09_01.operations.ExpressRoutePortsOperations + :ivar express_route_links: ExpressRouteLinksOperations operations + :vartype express_route_links: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteLinksOperations + :ivar express_route_port_authorizations: ExpressRoutePortAuthorizationsOperations operations + :vartype express_route_port_authorizations: + azure.mgmt.network.v2023_09_01.operations.ExpressRoutePortAuthorizationsOperations + :ivar express_route_provider_ports_location: ExpressRouteProviderPortsLocationOperations + operations + :vartype express_route_provider_ports_location: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteProviderPortsLocationOperations + :ivar firewall_policies: FirewallPoliciesOperations operations + :vartype firewall_policies: + azure.mgmt.network.v2023_09_01.operations.FirewallPoliciesOperations + :ivar firewall_policy_rule_collection_groups: FirewallPolicyRuleCollectionGroupsOperations + operations + :vartype firewall_policy_rule_collection_groups: + azure.mgmt.network.v2023_09_01.operations.FirewallPolicyRuleCollectionGroupsOperations + :ivar firewall_policy_idps_signatures: FirewallPolicyIdpsSignaturesOperations operations + :vartype firewall_policy_idps_signatures: + azure.mgmt.network.v2023_09_01.operations.FirewallPolicyIdpsSignaturesOperations + :ivar firewall_policy_idps_signatures_overrides: + FirewallPolicyIdpsSignaturesOverridesOperations operations + :vartype firewall_policy_idps_signatures_overrides: + azure.mgmt.network.v2023_09_01.operations.FirewallPolicyIdpsSignaturesOverridesOperations + :ivar firewall_policy_idps_signatures_filter_values: + FirewallPolicyIdpsSignaturesFilterValuesOperations operations + :vartype firewall_policy_idps_signatures_filter_values: + azure.mgmt.network.v2023_09_01.operations.FirewallPolicyIdpsSignaturesFilterValuesOperations + :ivar ip_allocations: IpAllocationsOperations operations + :vartype ip_allocations: azure.mgmt.network.v2023_09_01.operations.IpAllocationsOperations + :ivar ip_groups: IpGroupsOperations operations + :vartype ip_groups: azure.mgmt.network.v2023_09_01.operations.IpGroupsOperations + :ivar load_balancers: LoadBalancersOperations operations + :vartype load_balancers: azure.mgmt.network.v2023_09_01.operations.LoadBalancersOperations + :ivar load_balancer_backend_address_pools: LoadBalancerBackendAddressPoolsOperations operations + :vartype load_balancer_backend_address_pools: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerBackendAddressPoolsOperations + :ivar load_balancer_frontend_ip_configurations: LoadBalancerFrontendIPConfigurationsOperations + operations + :vartype load_balancer_frontend_ip_configurations: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerFrontendIPConfigurationsOperations + :ivar inbound_nat_rules: InboundNatRulesOperations operations + :vartype inbound_nat_rules: azure.mgmt.network.v2023_09_01.operations.InboundNatRulesOperations + :ivar load_balancer_load_balancing_rules: LoadBalancerLoadBalancingRulesOperations operations + :vartype load_balancer_load_balancing_rules: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerLoadBalancingRulesOperations + :ivar load_balancer_outbound_rules: LoadBalancerOutboundRulesOperations operations + :vartype load_balancer_outbound_rules: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerOutboundRulesOperations + :ivar load_balancer_network_interfaces: LoadBalancerNetworkInterfacesOperations operations + :vartype load_balancer_network_interfaces: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerNetworkInterfacesOperations + :ivar load_balancer_probes: LoadBalancerProbesOperations operations + :vartype load_balancer_probes: + azure.mgmt.network.v2023_09_01.operations.LoadBalancerProbesOperations + :ivar nat_gateways: NatGatewaysOperations operations + :vartype nat_gateways: azure.mgmt.network.v2023_09_01.operations.NatGatewaysOperations + :ivar network_interface_ip_configurations: NetworkInterfaceIPConfigurationsOperations + operations + :vartype network_interface_ip_configurations: + azure.mgmt.network.v2023_09_01.operations.NetworkInterfaceIPConfigurationsOperations + :ivar network_interface_load_balancers: NetworkInterfaceLoadBalancersOperations operations + :vartype network_interface_load_balancers: + azure.mgmt.network.v2023_09_01.operations.NetworkInterfaceLoadBalancersOperations + :ivar network_interface_tap_configurations: NetworkInterfaceTapConfigurationsOperations + operations + :vartype network_interface_tap_configurations: + azure.mgmt.network.v2023_09_01.operations.NetworkInterfaceTapConfigurationsOperations + :ivar network_managers: NetworkManagersOperations operations + :vartype network_managers: azure.mgmt.network.v2023_09_01.operations.NetworkManagersOperations + :ivar network_manager_commits: NetworkManagerCommitsOperations operations + :vartype network_manager_commits: + azure.mgmt.network.v2023_09_01.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :vartype network_manager_deployment_status: + azure.mgmt.network.v2023_09_01.operations.NetworkManagerDeploymentStatusOperations + :ivar subscription_network_manager_connections: SubscriptionNetworkManagerConnectionsOperations + operations + :vartype subscription_network_manager_connections: + azure.mgmt.network.v2023_09_01.operations.SubscriptionNetworkManagerConnectionsOperations + :ivar management_group_network_manager_connections: + ManagementGroupNetworkManagerConnectionsOperations operations + :vartype management_group_network_manager_connections: + azure.mgmt.network.v2023_09_01.operations.ManagementGroupNetworkManagerConnectionsOperations + :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations + :vartype connectivity_configurations: + azure.mgmt.network.v2023_09_01.operations.ConnectivityConfigurationsOperations + :ivar network_groups: NetworkGroupsOperations operations + :vartype network_groups: azure.mgmt.network.v2023_09_01.operations.NetworkGroupsOperations + :ivar static_members: StaticMembersOperations operations + :vartype static_members: azure.mgmt.network.v2023_09_01.operations.StaticMembersOperations + :ivar scope_connections: ScopeConnectionsOperations operations + :vartype scope_connections: + azure.mgmt.network.v2023_09_01.operations.ScopeConnectionsOperations + :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations + :vartype security_admin_configurations: + azure.mgmt.network.v2023_09_01.operations.SecurityAdminConfigurationsOperations + :ivar admin_rule_collections: AdminRuleCollectionsOperations operations + :vartype admin_rule_collections: + azure.mgmt.network.v2023_09_01.operations.AdminRuleCollectionsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2023_09_01.operations.AdminRulesOperations + :ivar network_profiles: NetworkProfilesOperations operations + :vartype network_profiles: azure.mgmt.network.v2023_09_01.operations.NetworkProfilesOperations + :ivar network_security_groups: NetworkSecurityGroupsOperations operations + :vartype network_security_groups: + azure.mgmt.network.v2023_09_01.operations.NetworkSecurityGroupsOperations + :ivar security_rules: SecurityRulesOperations operations + :vartype security_rules: azure.mgmt.network.v2023_09_01.operations.SecurityRulesOperations + :ivar default_security_rules: DefaultSecurityRulesOperations operations + :vartype default_security_rules: + azure.mgmt.network.v2023_09_01.operations.DefaultSecurityRulesOperations + :ivar network_virtual_appliances: NetworkVirtualAppliancesOperations operations + :vartype network_virtual_appliances: + azure.mgmt.network.v2023_09_01.operations.NetworkVirtualAppliancesOperations + :ivar virtual_appliance_sites: VirtualApplianceSitesOperations operations + :vartype virtual_appliance_sites: + azure.mgmt.network.v2023_09_01.operations.VirtualApplianceSitesOperations + :ivar virtual_appliance_skus: VirtualApplianceSkusOperations operations + :vartype virtual_appliance_skus: + azure.mgmt.network.v2023_09_01.operations.VirtualApplianceSkusOperations + :ivar inbound_security_rule: InboundSecurityRuleOperations operations + :vartype inbound_security_rule: + azure.mgmt.network.v2023_09_01.operations.InboundSecurityRuleOperations + :ivar network_watchers: NetworkWatchersOperations operations + :vartype network_watchers: azure.mgmt.network.v2023_09_01.operations.NetworkWatchersOperations + :ivar packet_captures: PacketCapturesOperations operations + :vartype packet_captures: azure.mgmt.network.v2023_09_01.operations.PacketCapturesOperations + :ivar connection_monitors: ConnectionMonitorsOperations operations + :vartype connection_monitors: + azure.mgmt.network.v2023_09_01.operations.ConnectionMonitorsOperations + :ivar flow_logs: FlowLogsOperations operations + :vartype flow_logs: azure.mgmt.network.v2023_09_01.operations.FlowLogsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.network.v2023_09_01.operations.Operations + :ivar private_endpoints: PrivateEndpointsOperations operations + :vartype private_endpoints: + azure.mgmt.network.v2023_09_01.operations.PrivateEndpointsOperations + :ivar available_private_endpoint_types: AvailablePrivateEndpointTypesOperations operations + :vartype available_private_endpoint_types: + azure.mgmt.network.v2023_09_01.operations.AvailablePrivateEndpointTypesOperations + :ivar private_dns_zone_groups: PrivateDnsZoneGroupsOperations operations + :vartype private_dns_zone_groups: + azure.mgmt.network.v2023_09_01.operations.PrivateDnsZoneGroupsOperations + :ivar private_link_services: PrivateLinkServicesOperations operations + :vartype private_link_services: + azure.mgmt.network.v2023_09_01.operations.PrivateLinkServicesOperations + :ivar public_ip_prefixes: PublicIPPrefixesOperations operations + :vartype public_ip_prefixes: + azure.mgmt.network.v2023_09_01.operations.PublicIPPrefixesOperations + :ivar route_filters: RouteFiltersOperations operations + :vartype route_filters: azure.mgmt.network.v2023_09_01.operations.RouteFiltersOperations + :ivar route_filter_rules: RouteFilterRulesOperations operations + :vartype route_filter_rules: + azure.mgmt.network.v2023_09_01.operations.RouteFilterRulesOperations + :ivar route_tables: RouteTablesOperations operations + :vartype route_tables: azure.mgmt.network.v2023_09_01.operations.RouteTablesOperations + :ivar routes: RoutesOperations operations + :vartype routes: azure.mgmt.network.v2023_09_01.operations.RoutesOperations + :ivar security_partner_providers: SecurityPartnerProvidersOperations operations + :vartype security_partner_providers: + azure.mgmt.network.v2023_09_01.operations.SecurityPartnerProvidersOperations + :ivar bgp_service_communities: BgpServiceCommunitiesOperations operations + :vartype bgp_service_communities: + azure.mgmt.network.v2023_09_01.operations.BgpServiceCommunitiesOperations + :ivar service_endpoint_policies: ServiceEndpointPoliciesOperations operations + :vartype service_endpoint_policies: + azure.mgmt.network.v2023_09_01.operations.ServiceEndpointPoliciesOperations + :ivar service_endpoint_policy_definitions: ServiceEndpointPolicyDefinitionsOperations + operations + :vartype service_endpoint_policy_definitions: + azure.mgmt.network.v2023_09_01.operations.ServiceEndpointPolicyDefinitionsOperations + :ivar service_tags: ServiceTagsOperations operations + :vartype service_tags: azure.mgmt.network.v2023_09_01.operations.ServiceTagsOperations + :ivar service_tag_information: ServiceTagInformationOperations operations + :vartype service_tag_information: + azure.mgmt.network.v2023_09_01.operations.ServiceTagInformationOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.network.v2023_09_01.operations.UsagesOperations + :ivar virtual_networks: VirtualNetworksOperations operations + :vartype virtual_networks: azure.mgmt.network.v2023_09_01.operations.VirtualNetworksOperations + :ivar subnets: SubnetsOperations operations + :vartype subnets: azure.mgmt.network.v2023_09_01.operations.SubnetsOperations + :ivar resource_navigation_links: ResourceNavigationLinksOperations operations + :vartype resource_navigation_links: + azure.mgmt.network.v2023_09_01.operations.ResourceNavigationLinksOperations + :ivar service_association_links: ServiceAssociationLinksOperations operations + :vartype service_association_links: + azure.mgmt.network.v2023_09_01.operations.ServiceAssociationLinksOperations + :ivar virtual_network_peerings: VirtualNetworkPeeringsOperations operations + :vartype virtual_network_peerings: + azure.mgmt.network.v2023_09_01.operations.VirtualNetworkPeeringsOperations + :ivar virtual_network_gateways: VirtualNetworkGatewaysOperations operations + :vartype virtual_network_gateways: + azure.mgmt.network.v2023_09_01.operations.VirtualNetworkGatewaysOperations + :ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnectionsOperations + operations + :vartype virtual_network_gateway_connections: + azure.mgmt.network.v2023_09_01.operations.VirtualNetworkGatewayConnectionsOperations + :ivar local_network_gateways: LocalNetworkGatewaysOperations operations + :vartype local_network_gateways: + azure.mgmt.network.v2023_09_01.operations.LocalNetworkGatewaysOperations + :ivar virtual_network_gateway_nat_rules: VirtualNetworkGatewayNatRulesOperations operations + :vartype virtual_network_gateway_nat_rules: + azure.mgmt.network.v2023_09_01.operations.VirtualNetworkGatewayNatRulesOperations + :ivar virtual_network_taps: VirtualNetworkTapsOperations operations + :vartype virtual_network_taps: + azure.mgmt.network.v2023_09_01.operations.VirtualNetworkTapsOperations + :ivar virtual_routers: VirtualRoutersOperations operations + :vartype virtual_routers: azure.mgmt.network.v2023_09_01.operations.VirtualRoutersOperations + :ivar virtual_router_peerings: VirtualRouterPeeringsOperations operations + :vartype virtual_router_peerings: + azure.mgmt.network.v2023_09_01.operations.VirtualRouterPeeringsOperations + :ivar virtual_wans: VirtualWansOperations operations + :vartype virtual_wans: azure.mgmt.network.v2023_09_01.operations.VirtualWansOperations + :ivar vpn_sites: VpnSitesOperations operations + :vartype vpn_sites: azure.mgmt.network.v2023_09_01.operations.VpnSitesOperations + :ivar vpn_site_links: VpnSiteLinksOperations operations + :vartype vpn_site_links: azure.mgmt.network.v2023_09_01.operations.VpnSiteLinksOperations + :ivar vpn_sites_configuration: VpnSitesConfigurationOperations operations + :vartype vpn_sites_configuration: + azure.mgmt.network.v2023_09_01.operations.VpnSitesConfigurationOperations + :ivar vpn_server_configurations: VpnServerConfigurationsOperations operations + :vartype vpn_server_configurations: + azure.mgmt.network.v2023_09_01.operations.VpnServerConfigurationsOperations + :ivar configuration_policy_groups: ConfigurationPolicyGroupsOperations operations + :vartype configuration_policy_groups: + azure.mgmt.network.v2023_09_01.operations.ConfigurationPolicyGroupsOperations + :ivar virtual_hubs: VirtualHubsOperations operations + :vartype virtual_hubs: azure.mgmt.network.v2023_09_01.operations.VirtualHubsOperations + :ivar route_maps: RouteMapsOperations operations + :vartype route_maps: azure.mgmt.network.v2023_09_01.operations.RouteMapsOperations + :ivar hub_virtual_network_connections: HubVirtualNetworkConnectionsOperations operations + :vartype hub_virtual_network_connections: + azure.mgmt.network.v2023_09_01.operations.HubVirtualNetworkConnectionsOperations + :ivar vpn_gateways: VpnGatewaysOperations operations + :vartype vpn_gateways: azure.mgmt.network.v2023_09_01.operations.VpnGatewaysOperations + :ivar vpn_link_connections: VpnLinkConnectionsOperations operations + :vartype vpn_link_connections: + azure.mgmt.network.v2023_09_01.operations.VpnLinkConnectionsOperations + :ivar vpn_connections: VpnConnectionsOperations operations + :vartype vpn_connections: azure.mgmt.network.v2023_09_01.operations.VpnConnectionsOperations + :ivar vpn_site_link_connections: VpnSiteLinkConnectionsOperations operations + :vartype vpn_site_link_connections: + azure.mgmt.network.v2023_09_01.operations.VpnSiteLinkConnectionsOperations + :ivar nat_rules: NatRulesOperations operations + :vartype nat_rules: azure.mgmt.network.v2023_09_01.operations.NatRulesOperations + :ivar p2_svpn_gateways: P2SVpnGatewaysOperations operations + :vartype p2_svpn_gateways: azure.mgmt.network.v2023_09_01.operations.P2SVpnGatewaysOperations + :ivar vpn_server_configurations_associated_with_virtual_wan: + VpnServerConfigurationsAssociatedWithVirtualWanOperations operations + :vartype vpn_server_configurations_associated_with_virtual_wan: + azure.mgmt.network.v2023_09_01.operations.VpnServerConfigurationsAssociatedWithVirtualWanOperations + :ivar virtual_hub_route_table_v2_s: VirtualHubRouteTableV2SOperations operations + :vartype virtual_hub_route_table_v2_s: + azure.mgmt.network.v2023_09_01.operations.VirtualHubRouteTableV2SOperations + :ivar express_route_gateways: ExpressRouteGatewaysOperations operations + :vartype express_route_gateways: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteGatewaysOperations + :ivar express_route_connections: ExpressRouteConnectionsOperations operations + :vartype express_route_connections: + azure.mgmt.network.v2023_09_01.operations.ExpressRouteConnectionsOperations + :ivar network_virtual_appliance_connections: NetworkVirtualApplianceConnectionsOperations + operations + :vartype network_virtual_appliance_connections: + azure.mgmt.network.v2023_09_01.operations.NetworkVirtualApplianceConnectionsOperations + :ivar virtual_hub_bgp_connection: VirtualHubBgpConnectionOperations operations + :vartype virtual_hub_bgp_connection: + azure.mgmt.network.v2023_09_01.operations.VirtualHubBgpConnectionOperations + :ivar virtual_hub_bgp_connections: VirtualHubBgpConnectionsOperations operations + :vartype virtual_hub_bgp_connections: + azure.mgmt.network.v2023_09_01.operations.VirtualHubBgpConnectionsOperations + :ivar virtual_hub_ip_configuration: VirtualHubIpConfigurationOperations operations + :vartype virtual_hub_ip_configuration: + azure.mgmt.network.v2023_09_01.operations.VirtualHubIpConfigurationOperations + :ivar hub_route_tables: HubRouteTablesOperations operations + :vartype hub_route_tables: azure.mgmt.network.v2023_09_01.operations.HubRouteTablesOperations + :ivar routing_intent: RoutingIntentOperations operations + :vartype routing_intent: azure.mgmt.network.v2023_09_01.operations.RoutingIntentOperations + :ivar web_application_firewall_policies: WebApplicationFirewallPoliciesOperations operations + :vartype web_application_firewall_policies: + azure.mgmt.network.v2023_09_01.operations.WebApplicationFirewallPoliciesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = NetworkManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.application_gateways = ApplicationGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_private_link_resources = ApplicationGatewayPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_private_endpoint_connections = ApplicationGatewayPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_waf_dynamic_manifests_default = ApplicationGatewayWafDynamicManifestsDefaultOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_waf_dynamic_manifests = ApplicationGatewayWafDynamicManifestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_security_groups = ApplicationSecurityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_delegations = AvailableDelegationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_resource_group_delegations = AvailableResourceGroupDelegationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_service_aliases = AvailableServiceAliasesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.azure_firewalls = AzureFirewallsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.azure_firewall_fqdn_tags = AzureFirewallFqdnTagsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.web_categories = WebCategoriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.bastion_hosts = BastionHostsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interfaces = NetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.public_ip_addresses = PublicIPAddressesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vip_swap = VipSwapOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.custom_ip_prefixes = CustomIPPrefixesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ddos_custom_policies = DdosCustomPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ddos_protection_plans = DdosProtectionPlansOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.dscp_configuration = DscpConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_endpoint_services = AvailableEndpointServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_authorizations = ExpressRouteCircuitAuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_peerings = ExpressRouteCircuitPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_connections = ExpressRouteCircuitConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.peer_express_route_circuit_connections = PeerExpressRouteCircuitConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuits = ExpressRouteCircuitsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_service_providers = ExpressRouteServiceProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_cross_connections = ExpressRouteCrossConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_cross_connection_peerings = ExpressRouteCrossConnectionPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_ports_locations = ExpressRoutePortsLocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_ports = ExpressRoutePortsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_links = ExpressRouteLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_port_authorizations = ExpressRoutePortAuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_provider_ports_location = ExpressRouteProviderPortsLocationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policies = FirewallPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_rule_collection_groups = FirewallPolicyRuleCollectionGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures = FirewallPolicyIdpsSignaturesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures_overrides = FirewallPolicyIdpsSignaturesOverridesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures_filter_values = FirewallPolicyIdpsSignaturesFilterValuesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ip_allocations = IpAllocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ip_groups = IpGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancers = LoadBalancersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_backend_address_pools = LoadBalancerBackendAddressPoolsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_frontend_ip_configurations = LoadBalancerFrontendIPConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.inbound_nat_rules = InboundNatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_load_balancing_rules = LoadBalancerLoadBalancingRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_outbound_rules = LoadBalancerOutboundRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_network_interfaces = LoadBalancerNetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_probes = LoadBalancerProbesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.nat_gateways = NatGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_ip_configurations = NetworkInterfaceIPConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_load_balancers = NetworkInterfaceLoadBalancersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_tap_configurations = NetworkInterfaceTapConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_managers = NetworkManagersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_manager_commits = NetworkManagerCommitsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.subscription_network_manager_connections = SubscriptionNetworkManagerConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.management_group_network_manager_connections = ManagementGroupNetworkManagerConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.connectivity_configurations = ConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_groups = NetworkGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.static_members = StaticMembersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.scope_connections = ScopeConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.security_admin_configurations = SecurityAdminConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.admin_rule_collections = AdminRuleCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_profiles = NetworkProfilesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_security_groups = NetworkSecurityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.security_rules = SecurityRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.default_security_rules = DefaultSecurityRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_virtual_appliances = NetworkVirtualAppliancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_appliance_sites = VirtualApplianceSitesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_appliance_skus = VirtualApplianceSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.inbound_security_rule = InboundSecurityRuleOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_watchers = NetworkWatchersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.packet_captures = PacketCapturesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.connection_monitors = ConnectionMonitorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.flow_logs = FlowLogsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.private_endpoints = PrivateEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_private_endpoint_types = AvailablePrivateEndpointTypesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.private_dns_zone_groups = PrivateDnsZoneGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.private_link_services = PrivateLinkServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.public_ip_prefixes = PublicIPPrefixesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_filters = RouteFiltersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_filter_rules = RouteFilterRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_tables = RouteTablesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.routes = RoutesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.security_partner_providers = SecurityPartnerProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.bgp_service_communities = BgpServiceCommunitiesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_endpoint_policies = ServiceEndpointPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_endpoint_policy_definitions = ServiceEndpointPolicyDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_tags = ServiceTagsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_tag_information = ServiceTagInformationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.virtual_networks = VirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.subnets = SubnetsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.resource_navigation_links = ResourceNavigationLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_association_links = ServiceAssociationLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_peerings = VirtualNetworkPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateways = VirtualNetworkGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.local_network_gateways = LocalNetworkGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateway_nat_rules = VirtualNetworkGatewayNatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_taps = VirtualNetworkTapsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_routers = VirtualRoutersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_router_peerings = VirtualRouterPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_wans = VirtualWansOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_sites = VpnSitesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_site_links = VpnSiteLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_sites_configuration = VpnSitesConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_server_configurations = VpnServerConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.configuration_policy_groups = ConfigurationPolicyGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hubs = VirtualHubsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_maps = RouteMapsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.hub_virtual_network_connections = HubVirtualNetworkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_gateways = VpnGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_link_connections = VpnLinkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_connections = VpnConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_site_link_connections = VpnSiteLinkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.nat_rules = NatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.p2_svpn_gateways = P2SVpnGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_server_configurations_associated_with_virtual_wan = ( + VpnServerConfigurationsAssociatedWithVirtualWanOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + ) + self.virtual_hub_route_table_v2_s = VirtualHubRouteTableV2SOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_gateways = ExpressRouteGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_connections = ExpressRouteConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_virtual_appliance_connections = NetworkVirtualApplianceConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_bgp_connection = VirtualHubBgpConnectionOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_bgp_connections = VirtualHubBgpConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_ip_configuration = VirtualHubIpConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.hub_route_tables = HubRouteTablesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.routing_intent = RoutingIntentOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.web_application_firewall_policies = WebApplicationFirewallPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "NetworkManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_patch.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_vendor.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_vendor.py new file mode 100644 index 000000000000..789c0a30e2ec --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_vendor.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import NetworkManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + +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 + + +class NetworkManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: NetworkManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_version.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/__init__.py new file mode 100644 index 000000000000..3e9fedfa0ae0 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._network_management_client import NetworkManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NetworkManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_configuration.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_configuration.py new file mode 100644 index 000000000000..be149ab4c022 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_configuration.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class NetworkManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for NetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(NetworkManagementClientConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-network/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_network_management_client.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_network_management_client.py new file mode 100644 index 000000000000..a7b80adf516d --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_network_management_client.py @@ -0,0 +1,1000 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import NetworkManagementClientConfiguration +from .operations import ( + AdminRuleCollectionsOperations, + AdminRulesOperations, + ApplicationGatewayPrivateEndpointConnectionsOperations, + ApplicationGatewayPrivateLinkResourcesOperations, + ApplicationGatewayWafDynamicManifestsDefaultOperations, + ApplicationGatewayWafDynamicManifestsOperations, + ApplicationGatewaysOperations, + ApplicationSecurityGroupsOperations, + AvailableDelegationsOperations, + AvailableEndpointServicesOperations, + AvailablePrivateEndpointTypesOperations, + AvailableResourceGroupDelegationsOperations, + AvailableServiceAliasesOperations, + AzureFirewallFqdnTagsOperations, + AzureFirewallsOperations, + BastionHostsOperations, + BgpServiceCommunitiesOperations, + ConfigurationPolicyGroupsOperations, + ConnectionMonitorsOperations, + ConnectivityConfigurationsOperations, + CustomIPPrefixesOperations, + DdosCustomPoliciesOperations, + DdosProtectionPlansOperations, + DefaultSecurityRulesOperations, + DscpConfigurationOperations, + ExpressRouteCircuitAuthorizationsOperations, + ExpressRouteCircuitConnectionsOperations, + ExpressRouteCircuitPeeringsOperations, + ExpressRouteCircuitsOperations, + ExpressRouteConnectionsOperations, + ExpressRouteCrossConnectionPeeringsOperations, + ExpressRouteCrossConnectionsOperations, + ExpressRouteGatewaysOperations, + ExpressRouteLinksOperations, + ExpressRoutePortAuthorizationsOperations, + ExpressRoutePortsLocationsOperations, + ExpressRoutePortsOperations, + ExpressRouteProviderPortsLocationOperations, + ExpressRouteServiceProvidersOperations, + FirewallPoliciesOperations, + FirewallPolicyIdpsSignaturesFilterValuesOperations, + FirewallPolicyIdpsSignaturesOperations, + FirewallPolicyIdpsSignaturesOverridesOperations, + FirewallPolicyRuleCollectionGroupsOperations, + FlowLogsOperations, + HubRouteTablesOperations, + HubVirtualNetworkConnectionsOperations, + InboundNatRulesOperations, + InboundSecurityRuleOperations, + IpAllocationsOperations, + IpGroupsOperations, + LoadBalancerBackendAddressPoolsOperations, + LoadBalancerFrontendIPConfigurationsOperations, + LoadBalancerLoadBalancingRulesOperations, + LoadBalancerNetworkInterfacesOperations, + LoadBalancerOutboundRulesOperations, + LoadBalancerProbesOperations, + LoadBalancersOperations, + LocalNetworkGatewaysOperations, + ManagementGroupNetworkManagerConnectionsOperations, + NatGatewaysOperations, + NatRulesOperations, + NetworkGroupsOperations, + NetworkInterfaceIPConfigurationsOperations, + NetworkInterfaceLoadBalancersOperations, + NetworkInterfaceTapConfigurationsOperations, + NetworkInterfacesOperations, + NetworkManagementClientOperationsMixin, + NetworkManagerCommitsOperations, + NetworkManagerDeploymentStatusOperations, + NetworkManagersOperations, + NetworkProfilesOperations, + NetworkSecurityGroupsOperations, + NetworkVirtualApplianceConnectionsOperations, + NetworkVirtualAppliancesOperations, + NetworkWatchersOperations, + Operations, + P2SVpnGatewaysOperations, + PacketCapturesOperations, + PeerExpressRouteCircuitConnectionsOperations, + PrivateDnsZoneGroupsOperations, + PrivateEndpointsOperations, + PrivateLinkServicesOperations, + PublicIPAddressesOperations, + PublicIPPrefixesOperations, + ResourceNavigationLinksOperations, + RouteFilterRulesOperations, + RouteFiltersOperations, + RouteMapsOperations, + RouteTablesOperations, + RoutesOperations, + RoutingIntentOperations, + ScopeConnectionsOperations, + SecurityAdminConfigurationsOperations, + SecurityPartnerProvidersOperations, + SecurityRulesOperations, + ServiceAssociationLinksOperations, + ServiceEndpointPoliciesOperations, + ServiceEndpointPolicyDefinitionsOperations, + ServiceTagInformationOperations, + ServiceTagsOperations, + StaticMembersOperations, + SubnetsOperations, + SubscriptionNetworkManagerConnectionsOperations, + UsagesOperations, + VipSwapOperations, + VirtualApplianceSitesOperations, + VirtualApplianceSkusOperations, + VirtualHubBgpConnectionOperations, + VirtualHubBgpConnectionsOperations, + VirtualHubIpConfigurationOperations, + VirtualHubRouteTableV2SOperations, + VirtualHubsOperations, + VirtualNetworkGatewayConnectionsOperations, + VirtualNetworkGatewayNatRulesOperations, + VirtualNetworkGatewaysOperations, + VirtualNetworkPeeringsOperations, + VirtualNetworkTapsOperations, + VirtualNetworksOperations, + VirtualRouterPeeringsOperations, + VirtualRoutersOperations, + VirtualWansOperations, + VpnConnectionsOperations, + VpnGatewaysOperations, + VpnLinkConnectionsOperations, + VpnServerConfigurationsAssociatedWithVirtualWanOperations, + VpnServerConfigurationsOperations, + VpnSiteLinkConnectionsOperations, + VpnSiteLinksOperations, + VpnSitesConfigurationOperations, + VpnSitesOperations, + WebApplicationFirewallPoliciesOperations, + WebCategoriesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class NetworkManagementClient( + NetworkManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Network Client. + + :ivar application_gateways: ApplicationGatewaysOperations operations + :vartype application_gateways: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationGatewaysOperations + :ivar application_gateway_private_link_resources: + ApplicationGatewayPrivateLinkResourcesOperations operations + :vartype application_gateway_private_link_resources: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationGatewayPrivateLinkResourcesOperations + :ivar application_gateway_private_endpoint_connections: + ApplicationGatewayPrivateEndpointConnectionsOperations operations + :vartype application_gateway_private_endpoint_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationGatewayPrivateEndpointConnectionsOperations + :ivar application_gateway_waf_dynamic_manifests_default: + ApplicationGatewayWafDynamicManifestsDefaultOperations operations + :vartype application_gateway_waf_dynamic_manifests_default: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationGatewayWafDynamicManifestsDefaultOperations + :ivar application_gateway_waf_dynamic_manifests: + ApplicationGatewayWafDynamicManifestsOperations operations + :vartype application_gateway_waf_dynamic_manifests: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationGatewayWafDynamicManifestsOperations + :ivar application_security_groups: ApplicationSecurityGroupsOperations operations + :vartype application_security_groups: + azure.mgmt.network.v2023_09_01.aio.operations.ApplicationSecurityGroupsOperations + :ivar available_delegations: AvailableDelegationsOperations operations + :vartype available_delegations: + azure.mgmt.network.v2023_09_01.aio.operations.AvailableDelegationsOperations + :ivar available_resource_group_delegations: AvailableResourceGroupDelegationsOperations + operations + :vartype available_resource_group_delegations: + azure.mgmt.network.v2023_09_01.aio.operations.AvailableResourceGroupDelegationsOperations + :ivar available_service_aliases: AvailableServiceAliasesOperations operations + :vartype available_service_aliases: + azure.mgmt.network.v2023_09_01.aio.operations.AvailableServiceAliasesOperations + :ivar azure_firewalls: AzureFirewallsOperations operations + :vartype azure_firewalls: + azure.mgmt.network.v2023_09_01.aio.operations.AzureFirewallsOperations + :ivar azure_firewall_fqdn_tags: AzureFirewallFqdnTagsOperations operations + :vartype azure_firewall_fqdn_tags: + azure.mgmt.network.v2023_09_01.aio.operations.AzureFirewallFqdnTagsOperations + :ivar web_categories: WebCategoriesOperations operations + :vartype web_categories: azure.mgmt.network.v2023_09_01.aio.operations.WebCategoriesOperations + :ivar bastion_hosts: BastionHostsOperations operations + :vartype bastion_hosts: azure.mgmt.network.v2023_09_01.aio.operations.BastionHostsOperations + :ivar network_interfaces: NetworkInterfacesOperations operations + :vartype network_interfaces: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkInterfacesOperations + :ivar public_ip_addresses: PublicIPAddressesOperations operations + :vartype public_ip_addresses: + azure.mgmt.network.v2023_09_01.aio.operations.PublicIPAddressesOperations + :ivar vip_swap: VipSwapOperations operations + :vartype vip_swap: azure.mgmt.network.v2023_09_01.aio.operations.VipSwapOperations + :ivar custom_ip_prefixes: CustomIPPrefixesOperations operations + :vartype custom_ip_prefixes: + azure.mgmt.network.v2023_09_01.aio.operations.CustomIPPrefixesOperations + :ivar ddos_custom_policies: DdosCustomPoliciesOperations operations + :vartype ddos_custom_policies: + azure.mgmt.network.v2023_09_01.aio.operations.DdosCustomPoliciesOperations + :ivar ddos_protection_plans: DdosProtectionPlansOperations operations + :vartype ddos_protection_plans: + azure.mgmt.network.v2023_09_01.aio.operations.DdosProtectionPlansOperations + :ivar dscp_configuration: DscpConfigurationOperations operations + :vartype dscp_configuration: + azure.mgmt.network.v2023_09_01.aio.operations.DscpConfigurationOperations + :ivar available_endpoint_services: AvailableEndpointServicesOperations operations + :vartype available_endpoint_services: + azure.mgmt.network.v2023_09_01.aio.operations.AvailableEndpointServicesOperations + :ivar express_route_circuit_authorizations: ExpressRouteCircuitAuthorizationsOperations + operations + :vartype express_route_circuit_authorizations: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCircuitAuthorizationsOperations + :ivar express_route_circuit_peerings: ExpressRouteCircuitPeeringsOperations operations + :vartype express_route_circuit_peerings: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCircuitPeeringsOperations + :ivar express_route_circuit_connections: ExpressRouteCircuitConnectionsOperations operations + :vartype express_route_circuit_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCircuitConnectionsOperations + :ivar peer_express_route_circuit_connections: PeerExpressRouteCircuitConnectionsOperations + operations + :vartype peer_express_route_circuit_connections: + azure.mgmt.network.v2023_09_01.aio.operations.PeerExpressRouteCircuitConnectionsOperations + :ivar express_route_circuits: ExpressRouteCircuitsOperations operations + :vartype express_route_circuits: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCircuitsOperations + :ivar express_route_service_providers: ExpressRouteServiceProvidersOperations operations + :vartype express_route_service_providers: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteServiceProvidersOperations + :ivar express_route_cross_connections: ExpressRouteCrossConnectionsOperations operations + :vartype express_route_cross_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCrossConnectionsOperations + :ivar express_route_cross_connection_peerings: ExpressRouteCrossConnectionPeeringsOperations + operations + :vartype express_route_cross_connection_peerings: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteCrossConnectionPeeringsOperations + :ivar express_route_ports_locations: ExpressRoutePortsLocationsOperations operations + :vartype express_route_ports_locations: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRoutePortsLocationsOperations + :ivar express_route_ports: ExpressRoutePortsOperations operations + :vartype express_route_ports: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRoutePortsOperations + :ivar express_route_links: ExpressRouteLinksOperations operations + :vartype express_route_links: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteLinksOperations + :ivar express_route_port_authorizations: ExpressRoutePortAuthorizationsOperations operations + :vartype express_route_port_authorizations: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRoutePortAuthorizationsOperations + :ivar express_route_provider_ports_location: ExpressRouteProviderPortsLocationOperations + operations + :vartype express_route_provider_ports_location: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteProviderPortsLocationOperations + :ivar firewall_policies: FirewallPoliciesOperations operations + :vartype firewall_policies: + azure.mgmt.network.v2023_09_01.aio.operations.FirewallPoliciesOperations + :ivar firewall_policy_rule_collection_groups: FirewallPolicyRuleCollectionGroupsOperations + operations + :vartype firewall_policy_rule_collection_groups: + azure.mgmt.network.v2023_09_01.aio.operations.FirewallPolicyRuleCollectionGroupsOperations + :ivar firewall_policy_idps_signatures: FirewallPolicyIdpsSignaturesOperations operations + :vartype firewall_policy_idps_signatures: + azure.mgmt.network.v2023_09_01.aio.operations.FirewallPolicyIdpsSignaturesOperations + :ivar firewall_policy_idps_signatures_overrides: + FirewallPolicyIdpsSignaturesOverridesOperations operations + :vartype firewall_policy_idps_signatures_overrides: + azure.mgmt.network.v2023_09_01.aio.operations.FirewallPolicyIdpsSignaturesOverridesOperations + :ivar firewall_policy_idps_signatures_filter_values: + FirewallPolicyIdpsSignaturesFilterValuesOperations operations + :vartype firewall_policy_idps_signatures_filter_values: + azure.mgmt.network.v2023_09_01.aio.operations.FirewallPolicyIdpsSignaturesFilterValuesOperations + :ivar ip_allocations: IpAllocationsOperations operations + :vartype ip_allocations: azure.mgmt.network.v2023_09_01.aio.operations.IpAllocationsOperations + :ivar ip_groups: IpGroupsOperations operations + :vartype ip_groups: azure.mgmt.network.v2023_09_01.aio.operations.IpGroupsOperations + :ivar load_balancers: LoadBalancersOperations operations + :vartype load_balancers: azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancersOperations + :ivar load_balancer_backend_address_pools: LoadBalancerBackendAddressPoolsOperations operations + :vartype load_balancer_backend_address_pools: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerBackendAddressPoolsOperations + :ivar load_balancer_frontend_ip_configurations: LoadBalancerFrontendIPConfigurationsOperations + operations + :vartype load_balancer_frontend_ip_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerFrontendIPConfigurationsOperations + :ivar inbound_nat_rules: InboundNatRulesOperations operations + :vartype inbound_nat_rules: + azure.mgmt.network.v2023_09_01.aio.operations.InboundNatRulesOperations + :ivar load_balancer_load_balancing_rules: LoadBalancerLoadBalancingRulesOperations operations + :vartype load_balancer_load_balancing_rules: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerLoadBalancingRulesOperations + :ivar load_balancer_outbound_rules: LoadBalancerOutboundRulesOperations operations + :vartype load_balancer_outbound_rules: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerOutboundRulesOperations + :ivar load_balancer_network_interfaces: LoadBalancerNetworkInterfacesOperations operations + :vartype load_balancer_network_interfaces: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerNetworkInterfacesOperations + :ivar load_balancer_probes: LoadBalancerProbesOperations operations + :vartype load_balancer_probes: + azure.mgmt.network.v2023_09_01.aio.operations.LoadBalancerProbesOperations + :ivar nat_gateways: NatGatewaysOperations operations + :vartype nat_gateways: azure.mgmt.network.v2023_09_01.aio.operations.NatGatewaysOperations + :ivar network_interface_ip_configurations: NetworkInterfaceIPConfigurationsOperations + operations + :vartype network_interface_ip_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkInterfaceIPConfigurationsOperations + :ivar network_interface_load_balancers: NetworkInterfaceLoadBalancersOperations operations + :vartype network_interface_load_balancers: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkInterfaceLoadBalancersOperations + :ivar network_interface_tap_configurations: NetworkInterfaceTapConfigurationsOperations + operations + :vartype network_interface_tap_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkInterfaceTapConfigurationsOperations + :ivar network_managers: NetworkManagersOperations operations + :vartype network_managers: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkManagersOperations + :ivar network_manager_commits: NetworkManagerCommitsOperations operations + :vartype network_manager_commits: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkManagerCommitsOperations + :ivar network_manager_deployment_status: NetworkManagerDeploymentStatusOperations operations + :vartype network_manager_deployment_status: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkManagerDeploymentStatusOperations + :ivar subscription_network_manager_connections: SubscriptionNetworkManagerConnectionsOperations + operations + :vartype subscription_network_manager_connections: + azure.mgmt.network.v2023_09_01.aio.operations.SubscriptionNetworkManagerConnectionsOperations + :ivar management_group_network_manager_connections: + ManagementGroupNetworkManagerConnectionsOperations operations + :vartype management_group_network_manager_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ManagementGroupNetworkManagerConnectionsOperations + :ivar connectivity_configurations: ConnectivityConfigurationsOperations operations + :vartype connectivity_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.ConnectivityConfigurationsOperations + :ivar network_groups: NetworkGroupsOperations operations + :vartype network_groups: azure.mgmt.network.v2023_09_01.aio.operations.NetworkGroupsOperations + :ivar static_members: StaticMembersOperations operations + :vartype static_members: azure.mgmt.network.v2023_09_01.aio.operations.StaticMembersOperations + :ivar scope_connections: ScopeConnectionsOperations operations + :vartype scope_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ScopeConnectionsOperations + :ivar security_admin_configurations: SecurityAdminConfigurationsOperations operations + :vartype security_admin_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.SecurityAdminConfigurationsOperations + :ivar admin_rule_collections: AdminRuleCollectionsOperations operations + :vartype admin_rule_collections: + azure.mgmt.network.v2023_09_01.aio.operations.AdminRuleCollectionsOperations + :ivar admin_rules: AdminRulesOperations operations + :vartype admin_rules: azure.mgmt.network.v2023_09_01.aio.operations.AdminRulesOperations + :ivar network_profiles: NetworkProfilesOperations operations + :vartype network_profiles: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkProfilesOperations + :ivar network_security_groups: NetworkSecurityGroupsOperations operations + :vartype network_security_groups: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkSecurityGroupsOperations + :ivar security_rules: SecurityRulesOperations operations + :vartype security_rules: azure.mgmt.network.v2023_09_01.aio.operations.SecurityRulesOperations + :ivar default_security_rules: DefaultSecurityRulesOperations operations + :vartype default_security_rules: + azure.mgmt.network.v2023_09_01.aio.operations.DefaultSecurityRulesOperations + :ivar network_virtual_appliances: NetworkVirtualAppliancesOperations operations + :vartype network_virtual_appliances: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkVirtualAppliancesOperations + :ivar virtual_appliance_sites: VirtualApplianceSitesOperations operations + :vartype virtual_appliance_sites: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualApplianceSitesOperations + :ivar virtual_appliance_skus: VirtualApplianceSkusOperations operations + :vartype virtual_appliance_skus: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualApplianceSkusOperations + :ivar inbound_security_rule: InboundSecurityRuleOperations operations + :vartype inbound_security_rule: + azure.mgmt.network.v2023_09_01.aio.operations.InboundSecurityRuleOperations + :ivar network_watchers: NetworkWatchersOperations operations + :vartype network_watchers: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkWatchersOperations + :ivar packet_captures: PacketCapturesOperations operations + :vartype packet_captures: + azure.mgmt.network.v2023_09_01.aio.operations.PacketCapturesOperations + :ivar connection_monitors: ConnectionMonitorsOperations operations + :vartype connection_monitors: + azure.mgmt.network.v2023_09_01.aio.operations.ConnectionMonitorsOperations + :ivar flow_logs: FlowLogsOperations operations + :vartype flow_logs: azure.mgmt.network.v2023_09_01.aio.operations.FlowLogsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.network.v2023_09_01.aio.operations.Operations + :ivar private_endpoints: PrivateEndpointsOperations operations + :vartype private_endpoints: + azure.mgmt.network.v2023_09_01.aio.operations.PrivateEndpointsOperations + :ivar available_private_endpoint_types: AvailablePrivateEndpointTypesOperations operations + :vartype available_private_endpoint_types: + azure.mgmt.network.v2023_09_01.aio.operations.AvailablePrivateEndpointTypesOperations + :ivar private_dns_zone_groups: PrivateDnsZoneGroupsOperations operations + :vartype private_dns_zone_groups: + azure.mgmt.network.v2023_09_01.aio.operations.PrivateDnsZoneGroupsOperations + :ivar private_link_services: PrivateLinkServicesOperations operations + :vartype private_link_services: + azure.mgmt.network.v2023_09_01.aio.operations.PrivateLinkServicesOperations + :ivar public_ip_prefixes: PublicIPPrefixesOperations operations + :vartype public_ip_prefixes: + azure.mgmt.network.v2023_09_01.aio.operations.PublicIPPrefixesOperations + :ivar route_filters: RouteFiltersOperations operations + :vartype route_filters: azure.mgmt.network.v2023_09_01.aio.operations.RouteFiltersOperations + :ivar route_filter_rules: RouteFilterRulesOperations operations + :vartype route_filter_rules: + azure.mgmt.network.v2023_09_01.aio.operations.RouteFilterRulesOperations + :ivar route_tables: RouteTablesOperations operations + :vartype route_tables: azure.mgmt.network.v2023_09_01.aio.operations.RouteTablesOperations + :ivar routes: RoutesOperations operations + :vartype routes: azure.mgmt.network.v2023_09_01.aio.operations.RoutesOperations + :ivar security_partner_providers: SecurityPartnerProvidersOperations operations + :vartype security_partner_providers: + azure.mgmt.network.v2023_09_01.aio.operations.SecurityPartnerProvidersOperations + :ivar bgp_service_communities: BgpServiceCommunitiesOperations operations + :vartype bgp_service_communities: + azure.mgmt.network.v2023_09_01.aio.operations.BgpServiceCommunitiesOperations + :ivar service_endpoint_policies: ServiceEndpointPoliciesOperations operations + :vartype service_endpoint_policies: + azure.mgmt.network.v2023_09_01.aio.operations.ServiceEndpointPoliciesOperations + :ivar service_endpoint_policy_definitions: ServiceEndpointPolicyDefinitionsOperations + operations + :vartype service_endpoint_policy_definitions: + azure.mgmt.network.v2023_09_01.aio.operations.ServiceEndpointPolicyDefinitionsOperations + :ivar service_tags: ServiceTagsOperations operations + :vartype service_tags: azure.mgmt.network.v2023_09_01.aio.operations.ServiceTagsOperations + :ivar service_tag_information: ServiceTagInformationOperations operations + :vartype service_tag_information: + azure.mgmt.network.v2023_09_01.aio.operations.ServiceTagInformationOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.network.v2023_09_01.aio.operations.UsagesOperations + :ivar virtual_networks: VirtualNetworksOperations operations + :vartype virtual_networks: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworksOperations + :ivar subnets: SubnetsOperations operations + :vartype subnets: azure.mgmt.network.v2023_09_01.aio.operations.SubnetsOperations + :ivar resource_navigation_links: ResourceNavigationLinksOperations operations + :vartype resource_navigation_links: + azure.mgmt.network.v2023_09_01.aio.operations.ResourceNavigationLinksOperations + :ivar service_association_links: ServiceAssociationLinksOperations operations + :vartype service_association_links: + azure.mgmt.network.v2023_09_01.aio.operations.ServiceAssociationLinksOperations + :ivar virtual_network_peerings: VirtualNetworkPeeringsOperations operations + :vartype virtual_network_peerings: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworkPeeringsOperations + :ivar virtual_network_gateways: VirtualNetworkGatewaysOperations operations + :vartype virtual_network_gateways: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworkGatewaysOperations + :ivar virtual_network_gateway_connections: VirtualNetworkGatewayConnectionsOperations + operations + :vartype virtual_network_gateway_connections: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworkGatewayConnectionsOperations + :ivar local_network_gateways: LocalNetworkGatewaysOperations operations + :vartype local_network_gateways: + azure.mgmt.network.v2023_09_01.aio.operations.LocalNetworkGatewaysOperations + :ivar virtual_network_gateway_nat_rules: VirtualNetworkGatewayNatRulesOperations operations + :vartype virtual_network_gateway_nat_rules: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworkGatewayNatRulesOperations + :ivar virtual_network_taps: VirtualNetworkTapsOperations operations + :vartype virtual_network_taps: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualNetworkTapsOperations + :ivar virtual_routers: VirtualRoutersOperations operations + :vartype virtual_routers: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualRoutersOperations + :ivar virtual_router_peerings: VirtualRouterPeeringsOperations operations + :vartype virtual_router_peerings: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualRouterPeeringsOperations + :ivar virtual_wans: VirtualWansOperations operations + :vartype virtual_wans: azure.mgmt.network.v2023_09_01.aio.operations.VirtualWansOperations + :ivar vpn_sites: VpnSitesOperations operations + :vartype vpn_sites: azure.mgmt.network.v2023_09_01.aio.operations.VpnSitesOperations + :ivar vpn_site_links: VpnSiteLinksOperations operations + :vartype vpn_site_links: azure.mgmt.network.v2023_09_01.aio.operations.VpnSiteLinksOperations + :ivar vpn_sites_configuration: VpnSitesConfigurationOperations operations + :vartype vpn_sites_configuration: + azure.mgmt.network.v2023_09_01.aio.operations.VpnSitesConfigurationOperations + :ivar vpn_server_configurations: VpnServerConfigurationsOperations operations + :vartype vpn_server_configurations: + azure.mgmt.network.v2023_09_01.aio.operations.VpnServerConfigurationsOperations + :ivar configuration_policy_groups: ConfigurationPolicyGroupsOperations operations + :vartype configuration_policy_groups: + azure.mgmt.network.v2023_09_01.aio.operations.ConfigurationPolicyGroupsOperations + :ivar virtual_hubs: VirtualHubsOperations operations + :vartype virtual_hubs: azure.mgmt.network.v2023_09_01.aio.operations.VirtualHubsOperations + :ivar route_maps: RouteMapsOperations operations + :vartype route_maps: azure.mgmt.network.v2023_09_01.aio.operations.RouteMapsOperations + :ivar hub_virtual_network_connections: HubVirtualNetworkConnectionsOperations operations + :vartype hub_virtual_network_connections: + azure.mgmt.network.v2023_09_01.aio.operations.HubVirtualNetworkConnectionsOperations + :ivar vpn_gateways: VpnGatewaysOperations operations + :vartype vpn_gateways: azure.mgmt.network.v2023_09_01.aio.operations.VpnGatewaysOperations + :ivar vpn_link_connections: VpnLinkConnectionsOperations operations + :vartype vpn_link_connections: + azure.mgmt.network.v2023_09_01.aio.operations.VpnLinkConnectionsOperations + :ivar vpn_connections: VpnConnectionsOperations operations + :vartype vpn_connections: + azure.mgmt.network.v2023_09_01.aio.operations.VpnConnectionsOperations + :ivar vpn_site_link_connections: VpnSiteLinkConnectionsOperations operations + :vartype vpn_site_link_connections: + azure.mgmt.network.v2023_09_01.aio.operations.VpnSiteLinkConnectionsOperations + :ivar nat_rules: NatRulesOperations operations + :vartype nat_rules: azure.mgmt.network.v2023_09_01.aio.operations.NatRulesOperations + :ivar p2_svpn_gateways: P2SVpnGatewaysOperations operations + :vartype p2_svpn_gateways: + azure.mgmt.network.v2023_09_01.aio.operations.P2SVpnGatewaysOperations + :ivar vpn_server_configurations_associated_with_virtual_wan: + VpnServerConfigurationsAssociatedWithVirtualWanOperations operations + :vartype vpn_server_configurations_associated_with_virtual_wan: + azure.mgmt.network.v2023_09_01.aio.operations.VpnServerConfigurationsAssociatedWithVirtualWanOperations + :ivar virtual_hub_route_table_v2_s: VirtualHubRouteTableV2SOperations operations + :vartype virtual_hub_route_table_v2_s: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualHubRouteTableV2SOperations + :ivar express_route_gateways: ExpressRouteGatewaysOperations operations + :vartype express_route_gateways: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteGatewaysOperations + :ivar express_route_connections: ExpressRouteConnectionsOperations operations + :vartype express_route_connections: + azure.mgmt.network.v2023_09_01.aio.operations.ExpressRouteConnectionsOperations + :ivar network_virtual_appliance_connections: NetworkVirtualApplianceConnectionsOperations + operations + :vartype network_virtual_appliance_connections: + azure.mgmt.network.v2023_09_01.aio.operations.NetworkVirtualApplianceConnectionsOperations + :ivar virtual_hub_bgp_connection: VirtualHubBgpConnectionOperations operations + :vartype virtual_hub_bgp_connection: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualHubBgpConnectionOperations + :ivar virtual_hub_bgp_connections: VirtualHubBgpConnectionsOperations operations + :vartype virtual_hub_bgp_connections: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualHubBgpConnectionsOperations + :ivar virtual_hub_ip_configuration: VirtualHubIpConfigurationOperations operations + :vartype virtual_hub_ip_configuration: + azure.mgmt.network.v2023_09_01.aio.operations.VirtualHubIpConfigurationOperations + :ivar hub_route_tables: HubRouteTablesOperations operations + :vartype hub_route_tables: + azure.mgmt.network.v2023_09_01.aio.operations.HubRouteTablesOperations + :ivar routing_intent: RoutingIntentOperations operations + :vartype routing_intent: azure.mgmt.network.v2023_09_01.aio.operations.RoutingIntentOperations + :ivar web_application_firewall_policies: WebApplicationFirewallPoliciesOperations operations + :vartype web_application_firewall_policies: + azure.mgmt.network.v2023_09_01.aio.operations.WebApplicationFirewallPoliciesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = NetworkManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.application_gateways = ApplicationGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_private_link_resources = ApplicationGatewayPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_private_endpoint_connections = ApplicationGatewayPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_waf_dynamic_manifests_default = ApplicationGatewayWafDynamicManifestsDefaultOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_gateway_waf_dynamic_manifests = ApplicationGatewayWafDynamicManifestsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.application_security_groups = ApplicationSecurityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_delegations = AvailableDelegationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_resource_group_delegations = AvailableResourceGroupDelegationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_service_aliases = AvailableServiceAliasesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.azure_firewalls = AzureFirewallsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.azure_firewall_fqdn_tags = AzureFirewallFqdnTagsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.web_categories = WebCategoriesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.bastion_hosts = BastionHostsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interfaces = NetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.public_ip_addresses = PublicIPAddressesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vip_swap = VipSwapOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.custom_ip_prefixes = CustomIPPrefixesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ddos_custom_policies = DdosCustomPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ddos_protection_plans = DdosProtectionPlansOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.dscp_configuration = DscpConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_endpoint_services = AvailableEndpointServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_authorizations = ExpressRouteCircuitAuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_peerings = ExpressRouteCircuitPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuit_connections = ExpressRouteCircuitConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.peer_express_route_circuit_connections = PeerExpressRouteCircuitConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_circuits = ExpressRouteCircuitsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_service_providers = ExpressRouteServiceProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_cross_connections = ExpressRouteCrossConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_cross_connection_peerings = ExpressRouteCrossConnectionPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_ports_locations = ExpressRoutePortsLocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_ports = ExpressRoutePortsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_links = ExpressRouteLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_port_authorizations = ExpressRoutePortAuthorizationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_provider_ports_location = ExpressRouteProviderPortsLocationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policies = FirewallPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_rule_collection_groups = FirewallPolicyRuleCollectionGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures = FirewallPolicyIdpsSignaturesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures_overrides = FirewallPolicyIdpsSignaturesOverridesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.firewall_policy_idps_signatures_filter_values = FirewallPolicyIdpsSignaturesFilterValuesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ip_allocations = IpAllocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.ip_groups = IpGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancers = LoadBalancersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_backend_address_pools = LoadBalancerBackendAddressPoolsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_frontend_ip_configurations = LoadBalancerFrontendIPConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.inbound_nat_rules = InboundNatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_load_balancing_rules = LoadBalancerLoadBalancingRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_outbound_rules = LoadBalancerOutboundRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_network_interfaces = LoadBalancerNetworkInterfacesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.load_balancer_probes = LoadBalancerProbesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.nat_gateways = NatGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_ip_configurations = NetworkInterfaceIPConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_load_balancers = NetworkInterfaceLoadBalancersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_interface_tap_configurations = NetworkInterfaceTapConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_managers = NetworkManagersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_manager_commits = NetworkManagerCommitsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_manager_deployment_status = NetworkManagerDeploymentStatusOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.subscription_network_manager_connections = SubscriptionNetworkManagerConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.management_group_network_manager_connections = ManagementGroupNetworkManagerConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.connectivity_configurations = ConnectivityConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_groups = NetworkGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.static_members = StaticMembersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.scope_connections = ScopeConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.security_admin_configurations = SecurityAdminConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.admin_rule_collections = AdminRuleCollectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.admin_rules = AdminRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_profiles = NetworkProfilesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_security_groups = NetworkSecurityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.security_rules = SecurityRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.default_security_rules = DefaultSecurityRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_virtual_appliances = NetworkVirtualAppliancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_appliance_sites = VirtualApplianceSitesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_appliance_skus = VirtualApplianceSkusOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.inbound_security_rule = InboundSecurityRuleOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_watchers = NetworkWatchersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.packet_captures = PacketCapturesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.connection_monitors = ConnectionMonitorsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.flow_logs = FlowLogsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.private_endpoints = PrivateEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.available_private_endpoint_types = AvailablePrivateEndpointTypesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.private_dns_zone_groups = PrivateDnsZoneGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.private_link_services = PrivateLinkServicesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.public_ip_prefixes = PublicIPPrefixesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_filters = RouteFiltersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_filter_rules = RouteFilterRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_tables = RouteTablesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.routes = RoutesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.security_partner_providers = SecurityPartnerProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.bgp_service_communities = BgpServiceCommunitiesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_endpoint_policies = ServiceEndpointPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_endpoint_policy_definitions = ServiceEndpointPolicyDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_tags = ServiceTagsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_tag_information = ServiceTagInformationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.virtual_networks = VirtualNetworksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.subnets = SubnetsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-09-01") + self.resource_navigation_links = ResourceNavigationLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.service_association_links = ServiceAssociationLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_peerings = VirtualNetworkPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateways = VirtualNetworkGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateway_connections = VirtualNetworkGatewayConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.local_network_gateways = LocalNetworkGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_gateway_nat_rules = VirtualNetworkGatewayNatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_network_taps = VirtualNetworkTapsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_routers = VirtualRoutersOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_router_peerings = VirtualRouterPeeringsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_wans = VirtualWansOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_sites = VpnSitesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_site_links = VpnSiteLinksOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_sites_configuration = VpnSitesConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_server_configurations = VpnServerConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.configuration_policy_groups = ConfigurationPolicyGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hubs = VirtualHubsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.route_maps = RouteMapsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.hub_virtual_network_connections = HubVirtualNetworkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_gateways = VpnGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_link_connections = VpnLinkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_connections = VpnConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_site_link_connections = VpnSiteLinkConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.nat_rules = NatRulesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.p2_svpn_gateways = P2SVpnGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.vpn_server_configurations_associated_with_virtual_wan = ( + VpnServerConfigurationsAssociatedWithVirtualWanOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + ) + self.virtual_hub_route_table_v2_s = VirtualHubRouteTableV2SOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_gateways = ExpressRouteGatewaysOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.express_route_connections = ExpressRouteConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.network_virtual_appliance_connections = NetworkVirtualApplianceConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_bgp_connection = VirtualHubBgpConnectionOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_bgp_connections = VirtualHubBgpConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.virtual_hub_ip_configuration = VirtualHubIpConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.hub_route_tables = HubRouteTablesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.routing_intent = RoutingIntentOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + self.web_application_firewall_policies = WebApplicationFirewallPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-09-01" + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "NetworkManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_patch.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_vendor.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_vendor.py new file mode 100644 index 000000000000..f19aae839ebd --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import NetworkManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class NetworkManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: NetworkManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/__init__.py new file mode 100644 index 000000000000..475c77afc399 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/__init__.py @@ -0,0 +1,283 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import ApplicationGatewaysOperations +from ._operations import ApplicationGatewayPrivateLinkResourcesOperations +from ._operations import ApplicationGatewayPrivateEndpointConnectionsOperations +from ._operations import ApplicationGatewayWafDynamicManifestsDefaultOperations +from ._operations import ApplicationGatewayWafDynamicManifestsOperations +from ._operations import ApplicationSecurityGroupsOperations +from ._operations import AvailableDelegationsOperations +from ._operations import AvailableResourceGroupDelegationsOperations +from ._operations import AvailableServiceAliasesOperations +from ._operations import AzureFirewallsOperations +from ._operations import AzureFirewallFqdnTagsOperations +from ._operations import WebCategoriesOperations +from ._operations import BastionHostsOperations +from ._operations import NetworkManagementClientOperationsMixin +from ._operations import NetworkInterfacesOperations +from ._operations import PublicIPAddressesOperations +from ._operations import VipSwapOperations +from ._operations import CustomIPPrefixesOperations +from ._operations import DdosCustomPoliciesOperations +from ._operations import DdosProtectionPlansOperations +from ._operations import DscpConfigurationOperations +from ._operations import AvailableEndpointServicesOperations +from ._operations import ExpressRouteCircuitAuthorizationsOperations +from ._operations import ExpressRouteCircuitPeeringsOperations +from ._operations import ExpressRouteCircuitConnectionsOperations +from ._operations import PeerExpressRouteCircuitConnectionsOperations +from ._operations import ExpressRouteCircuitsOperations +from ._operations import ExpressRouteServiceProvidersOperations +from ._operations import ExpressRouteCrossConnectionsOperations +from ._operations import ExpressRouteCrossConnectionPeeringsOperations +from ._operations import ExpressRoutePortsLocationsOperations +from ._operations import ExpressRoutePortsOperations +from ._operations import ExpressRouteLinksOperations +from ._operations import ExpressRoutePortAuthorizationsOperations +from ._operations import ExpressRouteProviderPortsLocationOperations +from ._operations import FirewallPoliciesOperations +from ._operations import FirewallPolicyRuleCollectionGroupsOperations +from ._operations import FirewallPolicyIdpsSignaturesOperations +from ._operations import FirewallPolicyIdpsSignaturesOverridesOperations +from ._operations import FirewallPolicyIdpsSignaturesFilterValuesOperations +from ._operations import IpAllocationsOperations +from ._operations import IpGroupsOperations +from ._operations import LoadBalancersOperations +from ._operations import LoadBalancerBackendAddressPoolsOperations +from ._operations import LoadBalancerFrontendIPConfigurationsOperations +from ._operations import InboundNatRulesOperations +from ._operations import LoadBalancerLoadBalancingRulesOperations +from ._operations import LoadBalancerOutboundRulesOperations +from ._operations import LoadBalancerNetworkInterfacesOperations +from ._operations import LoadBalancerProbesOperations +from ._operations import NatGatewaysOperations +from ._operations import NetworkInterfaceIPConfigurationsOperations +from ._operations import NetworkInterfaceLoadBalancersOperations +from ._operations import NetworkInterfaceTapConfigurationsOperations +from ._operations import NetworkManagersOperations +from ._operations import NetworkManagerCommitsOperations +from ._operations import NetworkManagerDeploymentStatusOperations +from ._operations import SubscriptionNetworkManagerConnectionsOperations +from ._operations import ManagementGroupNetworkManagerConnectionsOperations +from ._operations import ConnectivityConfigurationsOperations +from ._operations import NetworkGroupsOperations +from ._operations import StaticMembersOperations +from ._operations import ScopeConnectionsOperations +from ._operations import SecurityAdminConfigurationsOperations +from ._operations import AdminRuleCollectionsOperations +from ._operations import AdminRulesOperations +from ._operations import NetworkProfilesOperations +from ._operations import NetworkSecurityGroupsOperations +from ._operations import SecurityRulesOperations +from ._operations import DefaultSecurityRulesOperations +from ._operations import NetworkVirtualAppliancesOperations +from ._operations import VirtualApplianceSitesOperations +from ._operations import VirtualApplianceSkusOperations +from ._operations import InboundSecurityRuleOperations +from ._operations import NetworkWatchersOperations +from ._operations import PacketCapturesOperations +from ._operations import ConnectionMonitorsOperations +from ._operations import FlowLogsOperations +from ._operations import Operations +from ._operations import PrivateEndpointsOperations +from ._operations import AvailablePrivateEndpointTypesOperations +from ._operations import PrivateDnsZoneGroupsOperations +from ._operations import PrivateLinkServicesOperations +from ._operations import PublicIPPrefixesOperations +from ._operations import RouteFiltersOperations +from ._operations import RouteFilterRulesOperations +from ._operations import RouteTablesOperations +from ._operations import RoutesOperations +from ._operations import SecurityPartnerProvidersOperations +from ._operations import BgpServiceCommunitiesOperations +from ._operations import ServiceEndpointPoliciesOperations +from ._operations import ServiceEndpointPolicyDefinitionsOperations +from ._operations import ServiceTagsOperations +from ._operations import ServiceTagInformationOperations +from ._operations import UsagesOperations +from ._operations import VirtualNetworksOperations +from ._operations import SubnetsOperations +from ._operations import ResourceNavigationLinksOperations +from ._operations import ServiceAssociationLinksOperations +from ._operations import VirtualNetworkPeeringsOperations +from ._operations import VirtualNetworkGatewaysOperations +from ._operations import VirtualNetworkGatewayConnectionsOperations +from ._operations import LocalNetworkGatewaysOperations +from ._operations import VirtualNetworkGatewayNatRulesOperations +from ._operations import VirtualNetworkTapsOperations +from ._operations import VirtualRoutersOperations +from ._operations import VirtualRouterPeeringsOperations +from ._operations import VirtualWansOperations +from ._operations import VpnSitesOperations +from ._operations import VpnSiteLinksOperations +from ._operations import VpnSitesConfigurationOperations +from ._operations import VpnServerConfigurationsOperations +from ._operations import ConfigurationPolicyGroupsOperations +from ._operations import VirtualHubsOperations +from ._operations import RouteMapsOperations +from ._operations import HubVirtualNetworkConnectionsOperations +from ._operations import VpnGatewaysOperations +from ._operations import VpnLinkConnectionsOperations +from ._operations import VpnConnectionsOperations +from ._operations import VpnSiteLinkConnectionsOperations +from ._operations import NatRulesOperations +from ._operations import P2SVpnGatewaysOperations +from ._operations import VpnServerConfigurationsAssociatedWithVirtualWanOperations +from ._operations import VirtualHubRouteTableV2SOperations +from ._operations import ExpressRouteGatewaysOperations +from ._operations import ExpressRouteConnectionsOperations +from ._operations import NetworkVirtualApplianceConnectionsOperations +from ._operations import VirtualHubBgpConnectionOperations +from ._operations import VirtualHubBgpConnectionsOperations +from ._operations import VirtualHubIpConfigurationOperations +from ._operations import HubRouteTablesOperations +from ._operations import RoutingIntentOperations +from ._operations import WebApplicationFirewallPoliciesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationGatewaysOperations", + "ApplicationGatewayPrivateLinkResourcesOperations", + "ApplicationGatewayPrivateEndpointConnectionsOperations", + "ApplicationGatewayWafDynamicManifestsDefaultOperations", + "ApplicationGatewayWafDynamicManifestsOperations", + "ApplicationSecurityGroupsOperations", + "AvailableDelegationsOperations", + "AvailableResourceGroupDelegationsOperations", + "AvailableServiceAliasesOperations", + "AzureFirewallsOperations", + "AzureFirewallFqdnTagsOperations", + "WebCategoriesOperations", + "BastionHostsOperations", + "NetworkManagementClientOperationsMixin", + "NetworkInterfacesOperations", + "PublicIPAddressesOperations", + "VipSwapOperations", + "CustomIPPrefixesOperations", + "DdosCustomPoliciesOperations", + "DdosProtectionPlansOperations", + "DscpConfigurationOperations", + "AvailableEndpointServicesOperations", + "ExpressRouteCircuitAuthorizationsOperations", + "ExpressRouteCircuitPeeringsOperations", + "ExpressRouteCircuitConnectionsOperations", + "PeerExpressRouteCircuitConnectionsOperations", + "ExpressRouteCircuitsOperations", + "ExpressRouteServiceProvidersOperations", + "ExpressRouteCrossConnectionsOperations", + "ExpressRouteCrossConnectionPeeringsOperations", + "ExpressRoutePortsLocationsOperations", + "ExpressRoutePortsOperations", + "ExpressRouteLinksOperations", + "ExpressRoutePortAuthorizationsOperations", + "ExpressRouteProviderPortsLocationOperations", + "FirewallPoliciesOperations", + "FirewallPolicyRuleCollectionGroupsOperations", + "FirewallPolicyIdpsSignaturesOperations", + "FirewallPolicyIdpsSignaturesOverridesOperations", + "FirewallPolicyIdpsSignaturesFilterValuesOperations", + "IpAllocationsOperations", + "IpGroupsOperations", + "LoadBalancersOperations", + "LoadBalancerBackendAddressPoolsOperations", + "LoadBalancerFrontendIPConfigurationsOperations", + "InboundNatRulesOperations", + "LoadBalancerLoadBalancingRulesOperations", + "LoadBalancerOutboundRulesOperations", + "LoadBalancerNetworkInterfacesOperations", + "LoadBalancerProbesOperations", + "NatGatewaysOperations", + "NetworkInterfaceIPConfigurationsOperations", + "NetworkInterfaceLoadBalancersOperations", + "NetworkInterfaceTapConfigurationsOperations", + "NetworkManagersOperations", + "NetworkManagerCommitsOperations", + "NetworkManagerDeploymentStatusOperations", + "SubscriptionNetworkManagerConnectionsOperations", + "ManagementGroupNetworkManagerConnectionsOperations", + "ConnectivityConfigurationsOperations", + "NetworkGroupsOperations", + "StaticMembersOperations", + "ScopeConnectionsOperations", + "SecurityAdminConfigurationsOperations", + "AdminRuleCollectionsOperations", + "AdminRulesOperations", + "NetworkProfilesOperations", + "NetworkSecurityGroupsOperations", + "SecurityRulesOperations", + "DefaultSecurityRulesOperations", + "NetworkVirtualAppliancesOperations", + "VirtualApplianceSitesOperations", + "VirtualApplianceSkusOperations", + "InboundSecurityRuleOperations", + "NetworkWatchersOperations", + "PacketCapturesOperations", + "ConnectionMonitorsOperations", + "FlowLogsOperations", + "Operations", + "PrivateEndpointsOperations", + "AvailablePrivateEndpointTypesOperations", + "PrivateDnsZoneGroupsOperations", + "PrivateLinkServicesOperations", + "PublicIPPrefixesOperations", + "RouteFiltersOperations", + "RouteFilterRulesOperations", + "RouteTablesOperations", + "RoutesOperations", + "SecurityPartnerProvidersOperations", + "BgpServiceCommunitiesOperations", + "ServiceEndpointPoliciesOperations", + "ServiceEndpointPolicyDefinitionsOperations", + "ServiceTagsOperations", + "ServiceTagInformationOperations", + "UsagesOperations", + "VirtualNetworksOperations", + "SubnetsOperations", + "ResourceNavigationLinksOperations", + "ServiceAssociationLinksOperations", + "VirtualNetworkPeeringsOperations", + "VirtualNetworkGatewaysOperations", + "VirtualNetworkGatewayConnectionsOperations", + "LocalNetworkGatewaysOperations", + "VirtualNetworkGatewayNatRulesOperations", + "VirtualNetworkTapsOperations", + "VirtualRoutersOperations", + "VirtualRouterPeeringsOperations", + "VirtualWansOperations", + "VpnSitesOperations", + "VpnSiteLinksOperations", + "VpnSitesConfigurationOperations", + "VpnServerConfigurationsOperations", + "ConfigurationPolicyGroupsOperations", + "VirtualHubsOperations", + "RouteMapsOperations", + "HubVirtualNetworkConnectionsOperations", + "VpnGatewaysOperations", + "VpnLinkConnectionsOperations", + "VpnConnectionsOperations", + "VpnSiteLinkConnectionsOperations", + "NatRulesOperations", + "P2SVpnGatewaysOperations", + "VpnServerConfigurationsAssociatedWithVirtualWanOperations", + "VirtualHubRouteTableV2SOperations", + "ExpressRouteGatewaysOperations", + "ExpressRouteConnectionsOperations", + "NetworkVirtualApplianceConnectionsOperations", + "VirtualHubBgpConnectionOperations", + "VirtualHubBgpConnectionsOperations", + "VirtualHubIpConfigurationOperations", + "HubRouteTablesOperations", + "RoutingIntentOperations", + "WebApplicationFirewallPoliciesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_operations.py new file mode 100644 index 000000000000..ee61922c552e --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_operations.py @@ -0,0 +1,79630 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import ( + build_admin_rule_collections_create_or_update_request, + build_admin_rule_collections_delete_request, + build_admin_rule_collections_get_request, + build_admin_rule_collections_list_request, + build_admin_rules_create_or_update_request, + build_admin_rules_delete_request, + build_admin_rules_get_request, + build_admin_rules_list_request, + build_application_gateway_private_endpoint_connections_delete_request, + build_application_gateway_private_endpoint_connections_get_request, + build_application_gateway_private_endpoint_connections_list_request, + build_application_gateway_private_endpoint_connections_update_request, + build_application_gateway_private_link_resources_list_request, + build_application_gateway_waf_dynamic_manifests_default_get_request, + build_application_gateway_waf_dynamic_manifests_get_request, + build_application_gateways_backend_health_on_demand_request, + build_application_gateways_backend_health_request, + build_application_gateways_create_or_update_request, + build_application_gateways_delete_request, + build_application_gateways_get_request, + build_application_gateways_get_ssl_predefined_policy_request, + build_application_gateways_list_all_request, + build_application_gateways_list_available_request_headers_request, + build_application_gateways_list_available_response_headers_request, + build_application_gateways_list_available_server_variables_request, + build_application_gateways_list_available_ssl_options_request, + build_application_gateways_list_available_ssl_predefined_policies_request, + build_application_gateways_list_available_waf_rule_sets_request, + build_application_gateways_list_request, + build_application_gateways_start_request, + build_application_gateways_stop_request, + build_application_gateways_update_tags_request, + build_application_security_groups_create_or_update_request, + build_application_security_groups_delete_request, + build_application_security_groups_get_request, + build_application_security_groups_list_all_request, + build_application_security_groups_list_request, + build_application_security_groups_update_tags_request, + build_available_delegations_list_request, + build_available_endpoint_services_list_request, + build_available_private_endpoint_types_list_by_resource_group_request, + build_available_private_endpoint_types_list_request, + build_available_resource_group_delegations_list_request, + build_available_service_aliases_list_by_resource_group_request, + build_available_service_aliases_list_request, + build_azure_firewall_fqdn_tags_list_all_request, + build_azure_firewalls_create_or_update_request, + build_azure_firewalls_delete_request, + build_azure_firewalls_get_request, + build_azure_firewalls_list_all_request, + build_azure_firewalls_list_learned_prefixes_request, + build_azure_firewalls_list_request, + build_azure_firewalls_packet_capture_request, + build_azure_firewalls_update_tags_request, + build_bastion_hosts_create_or_update_request, + build_bastion_hosts_delete_request, + build_bastion_hosts_get_request, + build_bastion_hosts_list_by_resource_group_request, + build_bastion_hosts_list_request, + build_bastion_hosts_update_tags_request, + build_bgp_service_communities_list_request, + build_configuration_policy_groups_create_or_update_request, + build_configuration_policy_groups_delete_request, + build_configuration_policy_groups_get_request, + build_configuration_policy_groups_list_by_vpn_server_configuration_request, + build_connection_monitors_create_or_update_request, + build_connection_monitors_delete_request, + build_connection_monitors_get_request, + build_connection_monitors_list_request, + build_connection_monitors_query_request, + build_connection_monitors_start_request, + build_connection_monitors_stop_request, + build_connection_monitors_update_tags_request, + build_connectivity_configurations_create_or_update_request, + build_connectivity_configurations_delete_request, + build_connectivity_configurations_get_request, + build_connectivity_configurations_list_request, + build_custom_ip_prefixes_create_or_update_request, + build_custom_ip_prefixes_delete_request, + build_custom_ip_prefixes_get_request, + build_custom_ip_prefixes_list_all_request, + build_custom_ip_prefixes_list_request, + build_custom_ip_prefixes_update_tags_request, + build_ddos_custom_policies_create_or_update_request, + build_ddos_custom_policies_delete_request, + build_ddos_custom_policies_get_request, + build_ddos_custom_policies_update_tags_request, + build_ddos_protection_plans_create_or_update_request, + build_ddos_protection_plans_delete_request, + build_ddos_protection_plans_get_request, + build_ddos_protection_plans_list_by_resource_group_request, + build_ddos_protection_plans_list_request, + build_ddos_protection_plans_update_tags_request, + build_default_security_rules_get_request, + build_default_security_rules_list_request, + build_dscp_configuration_create_or_update_request, + build_dscp_configuration_delete_request, + build_dscp_configuration_get_request, + build_dscp_configuration_list_all_request, + build_dscp_configuration_list_request, + build_express_route_circuit_authorizations_create_or_update_request, + build_express_route_circuit_authorizations_delete_request, + build_express_route_circuit_authorizations_get_request, + build_express_route_circuit_authorizations_list_request, + build_express_route_circuit_connections_create_or_update_request, + build_express_route_circuit_connections_delete_request, + build_express_route_circuit_connections_get_request, + build_express_route_circuit_connections_list_request, + build_express_route_circuit_peerings_create_or_update_request, + build_express_route_circuit_peerings_delete_request, + build_express_route_circuit_peerings_get_request, + build_express_route_circuit_peerings_list_request, + build_express_route_circuits_create_or_update_request, + build_express_route_circuits_delete_request, + build_express_route_circuits_get_peering_stats_request, + build_express_route_circuits_get_request, + build_express_route_circuits_get_stats_request, + build_express_route_circuits_list_all_request, + build_express_route_circuits_list_arp_table_request, + build_express_route_circuits_list_request, + build_express_route_circuits_list_routes_table_request, + build_express_route_circuits_list_routes_table_summary_request, + build_express_route_circuits_update_tags_request, + build_express_route_connections_create_or_update_request, + build_express_route_connections_delete_request, + build_express_route_connections_get_request, + build_express_route_connections_list_request, + build_express_route_cross_connection_peerings_create_or_update_request, + build_express_route_cross_connection_peerings_delete_request, + build_express_route_cross_connection_peerings_get_request, + build_express_route_cross_connection_peerings_list_request, + build_express_route_cross_connections_create_or_update_request, + build_express_route_cross_connections_get_request, + build_express_route_cross_connections_list_arp_table_request, + build_express_route_cross_connections_list_by_resource_group_request, + build_express_route_cross_connections_list_request, + build_express_route_cross_connections_list_routes_table_request, + build_express_route_cross_connections_list_routes_table_summary_request, + build_express_route_cross_connections_update_tags_request, + build_express_route_gateways_create_or_update_request, + build_express_route_gateways_delete_request, + build_express_route_gateways_get_request, + build_express_route_gateways_list_by_resource_group_request, + build_express_route_gateways_list_by_subscription_request, + build_express_route_gateways_update_tags_request, + build_express_route_links_get_request, + build_express_route_links_list_request, + build_express_route_port_authorizations_create_or_update_request, + build_express_route_port_authorizations_delete_request, + build_express_route_port_authorizations_get_request, + build_express_route_port_authorizations_list_request, + build_express_route_ports_create_or_update_request, + build_express_route_ports_delete_request, + build_express_route_ports_generate_loa_request, + build_express_route_ports_get_request, + build_express_route_ports_list_by_resource_group_request, + build_express_route_ports_list_request, + build_express_route_ports_locations_get_request, + build_express_route_ports_locations_list_request, + build_express_route_ports_update_tags_request, + build_express_route_provider_ports_location_list_request, + build_express_route_service_providers_list_request, + build_firewall_policies_create_or_update_request, + build_firewall_policies_delete_request, + build_firewall_policies_get_request, + build_firewall_policies_list_all_request, + build_firewall_policies_list_request, + build_firewall_policies_update_tags_request, + build_firewall_policy_idps_signatures_filter_values_list_request, + build_firewall_policy_idps_signatures_list_request, + build_firewall_policy_idps_signatures_overrides_get_request, + build_firewall_policy_idps_signatures_overrides_list_request, + build_firewall_policy_idps_signatures_overrides_patch_request, + build_firewall_policy_idps_signatures_overrides_put_request, + build_firewall_policy_rule_collection_groups_create_or_update_request, + build_firewall_policy_rule_collection_groups_delete_request, + build_firewall_policy_rule_collection_groups_get_request, + build_firewall_policy_rule_collection_groups_list_request, + build_flow_logs_create_or_update_request, + build_flow_logs_delete_request, + build_flow_logs_get_request, + build_flow_logs_list_request, + build_flow_logs_update_tags_request, + build_hub_route_tables_create_or_update_request, + build_hub_route_tables_delete_request, + build_hub_route_tables_get_request, + build_hub_route_tables_list_request, + build_hub_virtual_network_connections_create_or_update_request, + build_hub_virtual_network_connections_delete_request, + build_hub_virtual_network_connections_get_request, + build_hub_virtual_network_connections_list_request, + build_inbound_nat_rules_create_or_update_request, + build_inbound_nat_rules_delete_request, + build_inbound_nat_rules_get_request, + build_inbound_nat_rules_list_request, + build_inbound_security_rule_create_or_update_request, + build_ip_allocations_create_or_update_request, + build_ip_allocations_delete_request, + build_ip_allocations_get_request, + build_ip_allocations_list_by_resource_group_request, + build_ip_allocations_list_request, + build_ip_allocations_update_tags_request, + build_ip_groups_create_or_update_request, + build_ip_groups_delete_request, + build_ip_groups_get_request, + build_ip_groups_list_by_resource_group_request, + build_ip_groups_list_request, + build_ip_groups_update_groups_request, + build_load_balancer_backend_address_pools_create_or_update_request, + build_load_balancer_backend_address_pools_delete_request, + build_load_balancer_backend_address_pools_get_request, + build_load_balancer_backend_address_pools_list_request, + build_load_balancer_frontend_ip_configurations_get_request, + build_load_balancer_frontend_ip_configurations_list_request, + build_load_balancer_load_balancing_rules_get_request, + build_load_balancer_load_balancing_rules_list_request, + build_load_balancer_network_interfaces_list_request, + build_load_balancer_outbound_rules_get_request, + build_load_balancer_outbound_rules_list_request, + build_load_balancer_probes_get_request, + build_load_balancer_probes_list_request, + build_load_balancers_create_or_update_request, + build_load_balancers_delete_request, + build_load_balancers_get_request, + build_load_balancers_list_all_request, + build_load_balancers_list_inbound_nat_rule_port_mappings_request, + build_load_balancers_list_request, + build_load_balancers_migrate_to_ip_based_request, + build_load_balancers_swap_public_ip_addresses_request, + build_load_balancers_update_tags_request, + build_local_network_gateways_create_or_update_request, + build_local_network_gateways_delete_request, + build_local_network_gateways_get_request, + build_local_network_gateways_list_request, + build_local_network_gateways_update_tags_request, + build_management_group_network_manager_connections_create_or_update_request, + build_management_group_network_manager_connections_delete_request, + build_management_group_network_manager_connections_get_request, + build_management_group_network_manager_connections_list_request, + build_nat_gateways_create_or_update_request, + build_nat_gateways_delete_request, + build_nat_gateways_get_request, + build_nat_gateways_list_all_request, + build_nat_gateways_list_request, + build_nat_gateways_update_tags_request, + build_nat_rules_create_or_update_request, + build_nat_rules_delete_request, + build_nat_rules_get_request, + build_nat_rules_list_by_vpn_gateway_request, + build_network_groups_create_or_update_request, + build_network_groups_delete_request, + build_network_groups_get_request, + build_network_groups_list_request, + build_network_interface_ip_configurations_get_request, + build_network_interface_ip_configurations_list_request, + build_network_interface_load_balancers_list_request, + build_network_interface_tap_configurations_create_or_update_request, + build_network_interface_tap_configurations_delete_request, + build_network_interface_tap_configurations_get_request, + build_network_interface_tap_configurations_list_request, + build_network_interfaces_create_or_update_request, + build_network_interfaces_delete_request, + build_network_interfaces_get_cloud_service_network_interface_request, + build_network_interfaces_get_effective_route_table_request, + build_network_interfaces_get_request, + build_network_interfaces_get_virtual_machine_scale_set_ip_configuration_request, + build_network_interfaces_get_virtual_machine_scale_set_network_interface_request, + build_network_interfaces_list_all_request, + build_network_interfaces_list_cloud_service_network_interfaces_request, + build_network_interfaces_list_cloud_service_role_instance_network_interfaces_request, + build_network_interfaces_list_effective_network_security_groups_request, + build_network_interfaces_list_request, + build_network_interfaces_list_virtual_machine_scale_set_ip_configurations_request, + build_network_interfaces_list_virtual_machine_scale_set_network_interfaces_request, + build_network_interfaces_list_virtual_machine_scale_set_vm_network_interfaces_request, + build_network_interfaces_update_tags_request, + build_network_management_check_dns_name_availability_request, + build_network_management_delete_bastion_shareable_link_by_token_request, + build_network_management_delete_bastion_shareable_link_request, + build_network_management_disconnect_active_sessions_request, + build_network_management_express_route_provider_port_request, + build_network_management_generatevirtualwanvpnserverconfigurationvpnprofile_request, + build_network_management_get_active_sessions_request, + build_network_management_get_bastion_shareable_link_request, + build_network_management_list_active_connectivity_configurations_request, + build_network_management_list_active_security_admin_rules_request, + build_network_management_list_network_manager_effective_connectivity_configurations_request, + build_network_management_list_network_manager_effective_security_admin_rules_request, + build_network_management_put_bastion_shareable_link_request, + build_network_management_supported_security_providers_request, + build_network_manager_commits_post_request, + build_network_manager_deployment_status_list_request, + build_network_managers_create_or_update_request, + build_network_managers_delete_request, + build_network_managers_get_request, + build_network_managers_list_by_subscription_request, + build_network_managers_list_request, + build_network_managers_patch_request, + build_network_profiles_create_or_update_request, + build_network_profiles_delete_request, + build_network_profiles_get_request, + build_network_profiles_list_all_request, + build_network_profiles_list_request, + build_network_profiles_update_tags_request, + build_network_security_groups_create_or_update_request, + build_network_security_groups_delete_request, + build_network_security_groups_get_request, + build_network_security_groups_list_all_request, + build_network_security_groups_list_request, + build_network_security_groups_update_tags_request, + build_network_virtual_appliance_connections_create_or_update_request, + build_network_virtual_appliance_connections_delete_request, + build_network_virtual_appliance_connections_get_request, + build_network_virtual_appliance_connections_list_request, + build_network_virtual_appliances_create_or_update_request, + build_network_virtual_appliances_delete_request, + build_network_virtual_appliances_get_request, + build_network_virtual_appliances_list_by_resource_group_request, + build_network_virtual_appliances_list_request, + build_network_virtual_appliances_update_tags_request, + build_network_watchers_check_connectivity_request, + build_network_watchers_create_or_update_request, + build_network_watchers_delete_request, + build_network_watchers_get_azure_reachability_report_request, + build_network_watchers_get_flow_log_status_request, + build_network_watchers_get_network_configuration_diagnostic_request, + build_network_watchers_get_next_hop_request, + build_network_watchers_get_request, + build_network_watchers_get_topology_request, + build_network_watchers_get_troubleshooting_request, + build_network_watchers_get_troubleshooting_result_request, + build_network_watchers_get_vm_security_rules_request, + build_network_watchers_list_all_request, + build_network_watchers_list_available_providers_request, + build_network_watchers_list_request, + build_network_watchers_set_flow_log_configuration_request, + build_network_watchers_update_tags_request, + build_network_watchers_verify_ip_flow_request, + build_operations_list_request, + build_p2_svpn_gateways_create_or_update_request, + build_p2_svpn_gateways_delete_request, + build_p2_svpn_gateways_disconnect_p2_s_vpn_connections_request, + build_p2_svpn_gateways_generate_vpn_profile_request, + build_p2_svpn_gateways_get_p2_s_vpn_connection_health_detailed_request, + build_p2_svpn_gateways_get_p2_s_vpn_connection_health_request, + build_p2_svpn_gateways_get_request, + build_p2_svpn_gateways_list_by_resource_group_request, + build_p2_svpn_gateways_list_request, + build_p2_svpn_gateways_reset_request, + build_p2_svpn_gateways_update_tags_request, + build_packet_captures_create_request, + build_packet_captures_delete_request, + build_packet_captures_get_request, + build_packet_captures_get_status_request, + build_packet_captures_list_request, + build_packet_captures_stop_request, + build_peer_express_route_circuit_connections_get_request, + build_peer_express_route_circuit_connections_list_request, + build_private_dns_zone_groups_create_or_update_request, + build_private_dns_zone_groups_delete_request, + build_private_dns_zone_groups_get_request, + build_private_dns_zone_groups_list_request, + build_private_endpoints_create_or_update_request, + build_private_endpoints_delete_request, + build_private_endpoints_get_request, + build_private_endpoints_list_by_subscription_request, + build_private_endpoints_list_request, + build_private_link_services_check_private_link_service_visibility_by_resource_group_request, + build_private_link_services_check_private_link_service_visibility_request, + build_private_link_services_create_or_update_request, + build_private_link_services_delete_private_endpoint_connection_request, + build_private_link_services_delete_request, + build_private_link_services_get_private_endpoint_connection_request, + build_private_link_services_get_request, + build_private_link_services_list_auto_approved_private_link_services_by_resource_group_request, + build_private_link_services_list_auto_approved_private_link_services_request, + build_private_link_services_list_by_subscription_request, + build_private_link_services_list_private_endpoint_connections_request, + build_private_link_services_list_request, + build_private_link_services_update_private_endpoint_connection_request, + build_public_ip_addresses_create_or_update_request, + build_public_ip_addresses_ddos_protection_status_request, + build_public_ip_addresses_delete_request, + build_public_ip_addresses_get_cloud_service_public_ip_address_request, + build_public_ip_addresses_get_request, + build_public_ip_addresses_get_virtual_machine_scale_set_public_ip_address_request, + build_public_ip_addresses_list_all_request, + build_public_ip_addresses_list_cloud_service_public_ip_addresses_request, + build_public_ip_addresses_list_cloud_service_role_instance_public_ip_addresses_request, + build_public_ip_addresses_list_request, + build_public_ip_addresses_list_virtual_machine_scale_set_public_ip_addresses_request, + build_public_ip_addresses_list_virtual_machine_scale_set_vm_public_ip_addresses_request, + build_public_ip_addresses_update_tags_request, + build_public_ip_prefixes_create_or_update_request, + build_public_ip_prefixes_delete_request, + build_public_ip_prefixes_get_request, + build_public_ip_prefixes_list_all_request, + build_public_ip_prefixes_list_request, + build_public_ip_prefixes_update_tags_request, + build_resource_navigation_links_list_request, + build_route_filter_rules_create_or_update_request, + build_route_filter_rules_delete_request, + build_route_filter_rules_get_request, + build_route_filter_rules_list_by_route_filter_request, + build_route_filters_create_or_update_request, + build_route_filters_delete_request, + build_route_filters_get_request, + build_route_filters_list_by_resource_group_request, + build_route_filters_list_request, + build_route_filters_update_tags_request, + build_route_maps_create_or_update_request, + build_route_maps_delete_request, + build_route_maps_get_request, + build_route_maps_list_request, + build_route_tables_create_or_update_request, + build_route_tables_delete_request, + build_route_tables_get_request, + build_route_tables_list_all_request, + build_route_tables_list_request, + build_route_tables_update_tags_request, + build_routes_create_or_update_request, + build_routes_delete_request, + build_routes_get_request, + build_routes_list_request, + build_routing_intent_create_or_update_request, + build_routing_intent_delete_request, + build_routing_intent_get_request, + build_routing_intent_list_request, + build_scope_connections_create_or_update_request, + build_scope_connections_delete_request, + build_scope_connections_get_request, + build_scope_connections_list_request, + build_security_admin_configurations_create_or_update_request, + build_security_admin_configurations_delete_request, + build_security_admin_configurations_get_request, + build_security_admin_configurations_list_request, + build_security_partner_providers_create_or_update_request, + build_security_partner_providers_delete_request, + build_security_partner_providers_get_request, + build_security_partner_providers_list_by_resource_group_request, + build_security_partner_providers_list_request, + build_security_partner_providers_update_tags_request, + build_security_rules_create_or_update_request, + build_security_rules_delete_request, + build_security_rules_get_request, + build_security_rules_list_request, + build_service_association_links_list_request, + build_service_endpoint_policies_create_or_update_request, + build_service_endpoint_policies_delete_request, + build_service_endpoint_policies_get_request, + build_service_endpoint_policies_list_by_resource_group_request, + build_service_endpoint_policies_list_request, + build_service_endpoint_policies_update_tags_request, + build_service_endpoint_policy_definitions_create_or_update_request, + build_service_endpoint_policy_definitions_delete_request, + build_service_endpoint_policy_definitions_get_request, + build_service_endpoint_policy_definitions_list_by_resource_group_request, + build_service_tag_information_list_request, + build_service_tags_list_request, + build_static_members_create_or_update_request, + build_static_members_delete_request, + build_static_members_get_request, + build_static_members_list_request, + build_subnets_create_or_update_request, + build_subnets_delete_request, + build_subnets_get_request, + build_subnets_list_request, + build_subnets_prepare_network_policies_request, + build_subnets_unprepare_network_policies_request, + build_subscription_network_manager_connections_create_or_update_request, + build_subscription_network_manager_connections_delete_request, + build_subscription_network_manager_connections_get_request, + build_subscription_network_manager_connections_list_request, + build_usages_list_request, + build_vip_swap_create_request, + build_vip_swap_get_request, + build_vip_swap_list_request, + build_virtual_appliance_sites_create_or_update_request, + build_virtual_appliance_sites_delete_request, + build_virtual_appliance_sites_get_request, + build_virtual_appliance_sites_list_request, + build_virtual_appliance_skus_get_request, + build_virtual_appliance_skus_list_request, + build_virtual_hub_bgp_connection_create_or_update_request, + build_virtual_hub_bgp_connection_delete_request, + build_virtual_hub_bgp_connection_get_request, + build_virtual_hub_bgp_connections_list_advertised_routes_request, + build_virtual_hub_bgp_connections_list_learned_routes_request, + build_virtual_hub_bgp_connections_list_request, + build_virtual_hub_ip_configuration_create_or_update_request, + build_virtual_hub_ip_configuration_delete_request, + build_virtual_hub_ip_configuration_get_request, + build_virtual_hub_ip_configuration_list_request, + build_virtual_hub_route_table_v2_s_create_or_update_request, + build_virtual_hub_route_table_v2_s_delete_request, + build_virtual_hub_route_table_v2_s_get_request, + build_virtual_hub_route_table_v2_s_list_request, + build_virtual_hubs_create_or_update_request, + build_virtual_hubs_delete_request, + build_virtual_hubs_get_effective_virtual_hub_routes_request, + build_virtual_hubs_get_inbound_routes_request, + build_virtual_hubs_get_outbound_routes_request, + build_virtual_hubs_get_request, + build_virtual_hubs_list_by_resource_group_request, + build_virtual_hubs_list_request, + build_virtual_hubs_update_tags_request, + build_virtual_network_gateway_connections_create_or_update_request, + build_virtual_network_gateway_connections_delete_request, + build_virtual_network_gateway_connections_get_ike_sas_request, + build_virtual_network_gateway_connections_get_request, + build_virtual_network_gateway_connections_get_shared_key_request, + build_virtual_network_gateway_connections_list_request, + build_virtual_network_gateway_connections_reset_connection_request, + build_virtual_network_gateway_connections_reset_shared_key_request, + build_virtual_network_gateway_connections_set_shared_key_request, + build_virtual_network_gateway_connections_start_packet_capture_request, + build_virtual_network_gateway_connections_stop_packet_capture_request, + build_virtual_network_gateway_connections_update_tags_request, + build_virtual_network_gateway_nat_rules_create_or_update_request, + build_virtual_network_gateway_nat_rules_delete_request, + build_virtual_network_gateway_nat_rules_get_request, + build_virtual_network_gateway_nat_rules_list_by_virtual_network_gateway_request, + build_virtual_network_gateways_create_or_update_request, + build_virtual_network_gateways_delete_request, + build_virtual_network_gateways_disconnect_virtual_network_gateway_vpn_connections_request, + build_virtual_network_gateways_generate_vpn_profile_request, + build_virtual_network_gateways_generatevpnclientpackage_request, + build_virtual_network_gateways_get_advertised_routes_request, + build_virtual_network_gateways_get_bgp_peer_status_request, + build_virtual_network_gateways_get_learned_routes_request, + build_virtual_network_gateways_get_request, + build_virtual_network_gateways_get_vpn_profile_package_url_request, + build_virtual_network_gateways_get_vpnclient_connection_health_request, + build_virtual_network_gateways_get_vpnclient_ipsec_parameters_request, + build_virtual_network_gateways_list_connections_request, + build_virtual_network_gateways_list_request, + build_virtual_network_gateways_reset_request, + build_virtual_network_gateways_reset_vpn_client_shared_key_request, + build_virtual_network_gateways_set_vpnclient_ipsec_parameters_request, + build_virtual_network_gateways_start_packet_capture_request, + build_virtual_network_gateways_stop_packet_capture_request, + build_virtual_network_gateways_supported_vpn_devices_request, + build_virtual_network_gateways_update_tags_request, + build_virtual_network_gateways_vpn_device_configuration_script_request, + build_virtual_network_peerings_create_or_update_request, + build_virtual_network_peerings_delete_request, + build_virtual_network_peerings_get_request, + build_virtual_network_peerings_list_request, + build_virtual_network_taps_create_or_update_request, + build_virtual_network_taps_delete_request, + build_virtual_network_taps_get_request, + build_virtual_network_taps_list_all_request, + build_virtual_network_taps_list_by_resource_group_request, + build_virtual_network_taps_update_tags_request, + build_virtual_networks_check_ip_address_availability_request, + build_virtual_networks_create_or_update_request, + build_virtual_networks_delete_request, + build_virtual_networks_get_request, + build_virtual_networks_list_all_request, + build_virtual_networks_list_ddos_protection_status_request, + build_virtual_networks_list_request, + build_virtual_networks_list_usage_request, + build_virtual_networks_update_tags_request, + build_virtual_router_peerings_create_or_update_request, + build_virtual_router_peerings_delete_request, + build_virtual_router_peerings_get_request, + build_virtual_router_peerings_list_request, + build_virtual_routers_create_or_update_request, + build_virtual_routers_delete_request, + build_virtual_routers_get_request, + build_virtual_routers_list_by_resource_group_request, + build_virtual_routers_list_request, + build_virtual_wans_create_or_update_request, + build_virtual_wans_delete_request, + build_virtual_wans_get_request, + build_virtual_wans_list_by_resource_group_request, + build_virtual_wans_list_request, + build_virtual_wans_update_tags_request, + build_vpn_connections_create_or_update_request, + build_vpn_connections_delete_request, + build_vpn_connections_get_request, + build_vpn_connections_list_by_vpn_gateway_request, + build_vpn_connections_start_packet_capture_request, + build_vpn_connections_stop_packet_capture_request, + build_vpn_gateways_create_or_update_request, + build_vpn_gateways_delete_request, + build_vpn_gateways_get_request, + build_vpn_gateways_list_by_resource_group_request, + build_vpn_gateways_list_request, + build_vpn_gateways_reset_request, + build_vpn_gateways_start_packet_capture_request, + build_vpn_gateways_stop_packet_capture_request, + build_vpn_gateways_update_tags_request, + build_vpn_link_connections_get_ike_sas_request, + build_vpn_link_connections_list_by_vpn_connection_request, + build_vpn_link_connections_reset_connection_request, + build_vpn_server_configurations_associated_with_virtual_wan_list_request, + build_vpn_server_configurations_create_or_update_request, + build_vpn_server_configurations_delete_request, + build_vpn_server_configurations_get_request, + build_vpn_server_configurations_list_by_resource_group_request, + build_vpn_server_configurations_list_request, + build_vpn_server_configurations_update_tags_request, + build_vpn_site_link_connections_get_request, + build_vpn_site_links_get_request, + build_vpn_site_links_list_by_vpn_site_request, + build_vpn_sites_configuration_download_request, + build_vpn_sites_create_or_update_request, + build_vpn_sites_delete_request, + build_vpn_sites_get_request, + build_vpn_sites_list_by_resource_group_request, + build_vpn_sites_list_request, + build_vpn_sites_update_tags_request, + build_web_application_firewall_policies_create_or_update_request, + build_web_application_firewall_policies_delete_request, + build_web_application_firewall_policies_get_request, + build_web_application_firewall_policies_list_all_request, + build_web_application_firewall_policies_list_request, + build_web_categories_get_request, + build_web_categories_list_by_subscription_request, +) +from .._vendor import NetworkManagementClientMixinABC + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ApplicationGatewaysOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_delete_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_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._api_version or "2023-09-01")) + 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, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> _models.ApplicationGateway: + """Gets the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) + + request = build_application_gateways_get_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.ApplicationGateway, IO], + **kwargs: Any + ) -> _models.ApplicationGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, "ApplicationGateway") + + request = build_application_gateways_create_or_update_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + 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.Network/applicationGateways/{applicationGatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: _models.ApplicationGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :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 ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + 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 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 ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.ApplicationGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + Is either a ApplicationGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, + application_gateway_name=application_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, "TagsObject") + + request = build_application_gateways_update_tags_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ApplicationGateway"]: + """Lists all application gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 ApplicationGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayListResult] = 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_application_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationGateway"]: + """Gets all the application gateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayListResult] = 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_application_gateways_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways"} + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_start_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start" + } + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_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._api_version or "2023-09-01")) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_stop_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_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._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop" + } + + async def _backend_health_initial( + self, resource_group_name: str, application_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.ApplicationGatewayBackendHealth]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ApplicationGatewayBackendHealth]] = kwargs.pop("cls", None) + + request = build_application_gateways_backend_health_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self._backend_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayBackendHealth", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _backend_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth" + } + + @distributed_trace_async + async def begin_backend_health( + self, resource_group_name: str, application_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayBackendHealth]: + """Gets the backend health of the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApplicationGatewayBackendHealth or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealth] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayBackendHealth] = 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._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + 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): + deserialized = self._deserialize("ApplicationGatewayBackendHealth", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backend_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth" + } + + async def _backend_health_on_demand_initial( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: Union[_models.ApplicationGatewayOnDemandProbe, IO], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.ApplicationGatewayBackendHealthOnDemand]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApplicationGatewayBackendHealthOnDemand]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(probe_request, (IOBase, bytes)): + _content = probe_request + else: + _json = self._serialize.body(probe_request, "ApplicationGatewayOnDemandProbe") + + request = build_application_gateways_backend_health_on_demand_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._backend_health_on_demand_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayBackendHealthOnDemand", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _backend_health_on_demand_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand" + } + + @overload + async def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: _models.ApplicationGatewayOnDemandProbe, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Required. + :type probe_request: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayOnDemandProbe + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :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 + ApplicationGatewayBackendHealthOnDemand or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: IO, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Required. + :type probe_request: IO + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :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 + ApplicationGatewayBackendHealthOnDemand or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: Union[_models.ApplicationGatewayOnDemandProbe, IO], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Is either a + ApplicationGatewayOnDemandProbe type or a IO type. Required. + :type probe_request: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayOnDemandProbe or + IO + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ApplicationGatewayBackendHealthOnDemand or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGatewayBackendHealthOnDemand] = 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._backend_health_on_demand_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + probe_request=probe_request, + expand=expand, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayBackendHealthOnDemand", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backend_health_on_demand.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand" + } + + @distributed_trace_async + async def list_available_server_variables(self, **kwargs: Any) -> List[str]: + """Lists all available server variables. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_server_variables_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_server_variables.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_server_variables.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables" + } + + @distributed_trace_async + async def list_available_request_headers(self, **kwargs: Any) -> List[str]: + """Lists all available request headers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_request_headers_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_request_headers.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_request_headers.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders" + } + + @distributed_trace_async + async def list_available_response_headers(self, **kwargs: Any) -> List[str]: + """Lists all available response headers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_response_headers_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_response_headers.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_response_headers.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders" + } + + @distributed_trace_async + async def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableWafRuleSetsResult: + """Lists all available web application firewall rule sets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayAvailableWafRuleSetsResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAvailableWafRuleSetsResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableWafRuleSetsResult] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_waf_rule_sets_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_waf_rule_sets.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayAvailableWafRuleSetsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_waf_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets" + } + + @distributed_trace_async + async def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableSslOptions: + """Lists available Ssl options for configuring Ssl policy. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayAvailableSslOptions or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAvailableSslOptions + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableSslOptions] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_ssl_options_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_ssl_options.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayAvailableSslOptions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_ssl_options.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default" + } + + @distributed_trace + def list_available_ssl_predefined_policies( + self, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGatewaySslPredefinedPolicy"]: + """Lists all SSL predefined policies for configuring Ssl policy. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewaySslPredefinedPolicy or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableSslPredefinedPolicies] = 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_application_gateways_list_available_ssl_predefined_policies_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_ssl_predefined_policies.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayAvailableSslPredefinedPolicies", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_available_ssl_predefined_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies" + } + + @distributed_trace_async + async def get_ssl_predefined_policy( + self, predefined_policy_name: str, **kwargs: Any + ) -> _models.ApplicationGatewaySslPredefinedPolicy: + """Gets Ssl predefined policy with the specified policy name. + + :param predefined_policy_name: Name of Ssl predefined policy. Required. + :type predefined_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewaySslPredefinedPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewaySslPredefinedPolicy] = kwargs.pop("cls", None) + + request = build_application_gateways_get_ssl_predefined_policy_request( + predefined_policy_name=predefined_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_ssl_predefined_policy.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewaySslPredefinedPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_ssl_predefined_policy.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}" + } + + +class ApplicationGatewayPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_gateway_private_link_resources` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGatewayPrivateLinkResource"]: + """Lists all private link resources on an application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewayPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkResource] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateLinkResourceListResult] = 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_application_gateway_private_link_resources_list_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateLinkResourceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateLinkResources" + } + + +class ApplicationGatewayPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_gateway_private_endpoint_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateway_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, application_gateway_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_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._api_version or "2023-09-01")) + 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, + application_gateway_name=application_gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: Union[_models.ApplicationGatewayPrivateEndpointConnection, IO], + **kwargs: Any + ) -> Optional[_models.ApplicationGatewayPrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApplicationGatewayPrivateEndpointConnection]] = 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, "ApplicationGatewayPrivateEndpointConnection") + + request = build_application_gateway_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: _models.ApplicationGatewayPrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection + :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 + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. 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 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 + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: Union[_models.ApplicationGatewayPrivateEndpointConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. Is either a ApplicationGatewayPrivateEndpointConnection type or a IO + type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = 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, + application_gateway_name=application_gateway_name, + connection_name=connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, application_gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.ApplicationGatewayPrivateEndpointConnection: + """Gets the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_application_gateway_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGatewayPrivateEndpointConnection"]: + """Lists all private endpoint connections on an application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewayPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnectionListResult] = 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_application_gateway_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections" + } + + +class ApplicationGatewayWafDynamicManifestsDefaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_gateway_waf_dynamic_manifests_default` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, location: str, **kwargs: Any) -> _models.ApplicationGatewayWafDynamicManifestResult: + """Gets the regional application gateway waf manifest. + + :param location: The region where the nrp are located at. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayWafDynamicManifestResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResult] = kwargs.pop("cls", None) + + request = build_application_gateway_waf_dynamic_manifests_default_get_request( + location=location, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayWafDynamicManifestResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault" + } + + +class ApplicationGatewayWafDynamicManifestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_gateway_waf_dynamic_manifests` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ApplicationGatewayWafDynamicManifestResult"]: + """Gets the regional application gateway waf manifest. + + :param location: The region where the nrp are located at. 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 ApplicationGatewayWafDynamicManifestResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResultList] = 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_application_gateway_waf_dynamic_manifests_get_request( + location=location, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayWafDynamicManifestResultList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests" + } + + +class ApplicationSecurityGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`application_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_security_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_security_groups_delete_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, application_security_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_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._api_version or "2023-09-01")) + 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, + application_security_group_name=application_security_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, application_security_group_name: str, **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Gets information about the specified application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) + + request = build_application_security_groups_get_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.ApplicationSecurityGroup, IO], + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, "ApplicationSecurityGroup") + + request = build_application_security_groups_create_or_update_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + 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.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: _models.ApplicationSecurityGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :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 ApplicationSecurityGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. 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 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 ApplicationSecurityGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.ApplicationSecurityGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. Is either a ApplicationSecurityGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationSecurityGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, + application_security_group_name=application_security_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, "TagsObject") + + request = build_application_security_groups_update_tags_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ApplicationSecurityGroup"]: + """Gets all application security groups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroupListResult] = 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_application_security_groups_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ApplicationSecurityGroup"]: + """Gets all the application security groups in a resource group. + + :param resource_group_name: The name of the resource group. 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 ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroupListResult] = 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_application_security_groups_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups" + } + + +class AvailableDelegationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`available_delegations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableDelegation"]: + """Gets all of the available subnet delegations for this subscription in this region. + + :param location: The location of the subnet. 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 AvailableDelegation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableDelegationsResult] = 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_available_delegations_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableDelegationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations" + } + + +class AvailableResourceGroupDelegationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`available_resource_group_delegations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, location: str, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AvailableDelegation"]: + """Gets all of the available subnet delegations for this resource group in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AvailableDelegation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableDelegationsResult] = 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_available_resource_group_delegations_list_request( + location=location, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableDelegationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations" + } + + +class AvailableServiceAliasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`available_service_aliases` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableServiceAlias"]: + """Gets all available service aliases for this subscription in this region. + + :param location: The location. 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 AvailableServiceAlias or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableServiceAliasesResult] = 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_available_service_aliases_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableServiceAliasesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, location: str, **kwargs: Any + ) -> AsyncIterable["_models.AvailableServiceAlias"]: + """Gets all available service aliases for this resource group in this region. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param location: The location. 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 AvailableServiceAlias or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableServiceAliasesResult] = 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_available_service_aliases_list_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableServiceAliasesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + } + + +class AzureFirewallsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`azure_firewalls` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, azure_firewall_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_azure_firewalls_delete_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_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._api_version or "2023-09-01")) + 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, + azure_firewall_name=azure_firewall_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any) -> _models.AzureFirewall: + """Gets the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureFirewall or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) + + request = build_azure_firewalls_get_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.AzureFirewall, IO], + **kwargs: Any + ) -> _models.AzureFirewall: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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, "AzureFirewall") + + request = build_azure_firewalls_create_or_update_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + 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.Network/azureFirewalls/{azureFirewallName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.AzureFirewall, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall + :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 AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. + 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 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 AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.AzureFirewall, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. Is + either a AzureFirewall type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureFirewall", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.AzureFirewall]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AzureFirewall]] = 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, "TagsObject") + + request = build_azure_firewalls_update_tags_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. 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 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 AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AzureFirewall or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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_tags_initial( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureFirewall", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.AzureFirewall"]: + """Lists all Azure Firewalls in a resource group. + + :param resource_group_name: The name of the resource group. 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 AzureFirewall or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallListResult] = 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_azure_firewalls_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.AzureFirewall"]: + """Gets all the Azure Firewalls in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureFirewall or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallListResult] = 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_azure_firewalls_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls"} + + async def _list_learned_prefixes_initial( + self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any + ) -> Optional[_models.IPPrefixesList]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.IPPrefixesList]] = kwargs.pop("cls", None) + + request = build_azure_firewalls_list_learned_prefixes_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_learned_prefixes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("IPPrefixesList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_learned_prefixes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes" + } + + @distributed_trace_async + async def begin_list_learned_prefixes( + self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.IPPrefixesList]: + """Retrieves a list of all IP prefixes that azure firewall has learned to not SNAT. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the azure firewall. Required. + :type azure_firewall_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 IPPrefixesList or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IPPrefixesList] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IPPrefixesList] = 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._list_learned_prefixes_initial( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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): + deserialized = self._deserialize("IPPrefixesList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_learned_prefixes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes" + } + + async def _packet_capture_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.FirewallPacketCaptureParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "FirewallPacketCaptureParameters") + + request = build_azure_firewalls_packet_capture_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._packet_capture_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture" + } + + @overload + async def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.FirewallPacketCaptureParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPacketCaptureParameters + :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: + """ + + @overload + async def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. 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 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: + """ + + @distributed_trace_async + async def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.FirewallPacketCaptureParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. Is either a + FirewallPacketCaptureParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPacketCaptureParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._packet_capture_initial( # type: ignore + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture" + } + + +class AzureFirewallFqdnTagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`azure_firewall_fqdn_tags` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.AzureFirewallFqdnTag"]: + """Gets all the Azure Firewall FQDN Tags in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureFirewallFqdnTag or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewallFqdnTag] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallFqdnTagListResult] = 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_azure_firewall_fqdn_tags_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallFqdnTagListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags"} + + +class WebCategoriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`web_categories` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, name: str, *, expand: Optional[str] = None, **kwargs: Any) -> _models.AzureWebCategory: + """Gets the specified Azure Web Category. + + :param name: The name of the azureWebCategory. Required. + :type name: str + :keyword expand: Expands resourceIds back referenced by the azureWebCategory resource. Default + value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureWebCategory or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AzureWebCategory + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureWebCategory] = kwargs.pop("cls", None) + + request = build_web_categories_get_request( + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureWebCategory", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}"} + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AzureWebCategory"]: + """Gets all the Azure Web Categories in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureWebCategory or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureWebCategory] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureWebCategoryListResult] = 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_web_categories_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AzureWebCategoryListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories" + } + + +class BastionHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`bastion_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, bastion_host_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_bastion_hosts_delete_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, bastion_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_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._api_version or "2023-09-01")) + 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, + bastion_host_name=bastion_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, bastion_host_name: str, **kwargs: Any) -> _models.BastionHost: + """Gets the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BastionHost + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + request = build_bastion_hosts_get_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: Union[_models.BastionHost, IO], + **kwargs: Any + ) -> _models.BastionHost: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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, "BastionHost") + + request = build_bastion_hosts_create_or_update_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BastionHost", pipeline_response) + + 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.Network/bastionHosts/{bastionHostName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: _models.BastionHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BastionHost + :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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. + 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 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: Union[_models.BastionHost, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. Is + either a BastionHost type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BastionHost or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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, + bastion_host_name=bastion_host_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + async def _update_tags_initial( + self, resource_group_name: str, bastion_host_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> Optional[_models.BastionHost]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BastionHost]] = 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, "TagsObject") + + request = build_bastion_hosts_update_tags_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. 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 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, bastion_host_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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_tags_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.BastionHost"]: + """Lists all Bastion Hosts in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionHost or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHostListResult] = 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_bastion_hosts_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.BastionHost"]: + """Lists all Bastion Hosts in a resource group. + + :param resource_group_name: The name of the resource group. 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 BastionHost or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHostListResult] = 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_bastion_hosts_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts" + } + + +class NetworkManagementClientOperationsMixin(NetworkManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + async def _put_bastion_shareable_link_initial( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> Optional[_models.BastionShareableLinkListResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BastionShareableLinkListResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + request = build_network_management_put_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_bastion_shareable_link_initial.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( # type: ignore # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionShareableLinkListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _put_bastion_shareable_link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" + } + + @overload + async def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[AsyncIterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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 LROPoller that returns an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[AsyncIterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[AsyncIterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :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._api_version("begin_put_bastion_shareable_link") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) + + error_map = { + 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 + if isinstance(bsl_request, (IOBase, bytes)): + _json = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_put_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.begin_put_bastion_shareable_link.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionShareableLinkListResult", 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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._put_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_request=bsl_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return await get_next(next_link) + + return AsyncItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" + } + + async def _delete_bastion_shareable_link_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-09-01"), + ) + 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(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + request = build_network_management_delete_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_bastion_shareable_link_initial.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( # type: ignore # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_bastion_shareable_link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" + } + + @overload + async def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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: + """ + + @overload + async def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version("begin_delete_bastion_shareable_link") or "2023-09-01"), + ) + 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._delete_bastion_shareable_link_initial( # type: ignore + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_request=bsl_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" + } + + async def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-09-01" + ), + ) + 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(bsl_token_request, (IOBase, bytes)): + _content = bsl_token_request + else: + _json = self._serialize.body(bsl_token_request, "BastionShareableLinkTokenListRequest") + + request = build_network_management_delete_bastion_shareable_link_by_token_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_bastion_shareable_link_by_token_initial.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( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_bastion_shareable_link_by_token_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken" + } + + @overload + async def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: _models.BastionShareableLinkTokenListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. + Required. + :type bsl_token_request: + ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest + :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: + """ + + @overload + async def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. + Required. + :type bsl_token_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is + either a BastionShareableLinkTokenListRequest type or a IO type. Required. + :type bsl_token_request: + ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-09-01" + ), + ) + 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._delete_bastion_shareable_link_by_token_initial( # type: ignore + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_token_request=bsl_token_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_bastion_shareable_link_by_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken" + } + + @overload + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :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._api_version("get_bastion_shareable_link") or "2023-09-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) + + error_map = { + 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(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_get_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_bastion_shareable_link.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionShareableLinkListResult", 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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + get_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks" + } + + async def _get_active_sessions_initial( + self, resource_group_name: str, bastion_host_name: str, **kwargs: Any + ) -> Optional[_models.BastionActiveSessionListResult]: + 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._api_version("_get_active_sessions_initial") or "2023-09-01") + ) + cls: ClsType[Optional[_models.BastionActiveSessionListResult]] = kwargs.pop("cls", None) + + request = build_network_management_get_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_active_sessions_initial.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( # type: ignore # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionActiveSessionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_active_sessions_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" + } + + @distributed_trace_async + async def begin_get_active_sessions( + self, resource_group_name: str, bastion_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[AsyncIterable["_models.BastionActiveSession"]]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_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 LROPoller that returns an iterator like instance of either + BastionActiveSessionListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession]] + :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._api_version("begin_get_active_sessions") or "2023-09-01") + ) + cls: ClsType[_models.BastionActiveSessionListResult] = 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_network_management_get_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.begin_get_active_sessions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionActiveSessionListResult", 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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._get_active_sessions_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return await get_next(next_link) + + return AsyncItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_active_sessions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" + } + + @overload + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: _models.SessionIds, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Required. + :type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds + :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: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Required. + :type session_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: Union[_models.SessionIds, IO], + **kwargs: Any + ) -> AsyncIterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Is either a SessionIds type or a IO + type. Required. + :type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :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._api_version("disconnect_active_sessions") or "2023-09-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionSessionDeleteResult] = kwargs.pop("cls", None) + + error_map = { + 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(session_ids, (IOBase, bytes)): + _content = session_ids + else: + _json = self._serialize.body(session_ids, "SessionIds") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_disconnect_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.disconnect_active_sessions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionSessionDeleteResult", 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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + disconnect_active_sessions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions" + } + + @distributed_trace_async + async def check_dns_name_availability( + self, location: str, *, domain_name_label: str, **kwargs: Any + ) -> _models.DnsNameAvailabilityResult: + """Checks whether a domain name in the cloudapp.azure.com zone is available for use. + + :param location: The location of the domain name. Required. + :type location: str + :keyword domain_name_label: The domain name to be verified. It must conform to the following + regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. Required. + :paramtype domain_name_label: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DnsNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DnsNameAvailabilityResult + :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._api_version("check_dns_name_availability") or "2023-09-01") + ) + cls: ClsType[_models.DnsNameAvailabilityResult] = kwargs.pop("cls", None) + + request = build_network_management_check_dns_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + domain_name_label=domain_name_label, + api_version=api_version, + template_url=self.check_dns_name_availability.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_dns_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability" + } + + @distributed_trace_async + async def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _models.ExpressRouteProviderPort: + """Retrieves detail of a provider port. + + :param providerport: The name of the provider port. Required. + :type providerport: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteProviderPort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort + :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._api_version("express_route_provider_port") or "2023-09-01") + ) + cls: ClsType[_models.ExpressRouteProviderPort] = kwargs.pop("cls", None) + + request = build_network_management_express_route_provider_port_request( + providerport=providerport, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.express_route_provider_port.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteProviderPort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + express_route_provider_port.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}" + } + + @overload + async def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.ActiveConfigurationParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.ActiveConfigurationParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveConnectivityConfigurationsListResult] = 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, "ActiveConfigurationParameter") + + request = build_network_management_list_active_connectivity_configurations_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_active_connectivity_configurations.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveConnectivityConfigurationsListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_connectivity_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations" + } + + @overload + async def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.ActiveConfigurationParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.ActiveConfigurationParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveSecurityAdminRulesListResult] = 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, "ActiveConfigurationParameter") + + request = build_network_management_list_active_security_admin_rules_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_active_security_admin_rules.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSecurityAdminRulesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_admin_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules" + } + + @overload + async def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.QueryRequestOptions, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.QueryRequestOptions, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", + self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerEffectiveConnectivityConfigurationListResult] = 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, "QueryRequestOptions") + + request = build_network_management_list_network_manager_effective_connectivity_configurations_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_network_manager_effective_connectivity_configurations.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "NetworkManagerEffectiveConnectivityConfigurationListResult", pipeline_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_connectivity_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations" + } + + @overload + async def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.QueryRequestOptions, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.QueryRequestOptions, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-09-01" + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerEffectiveSecurityAdminRulesListResult] = 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, "QueryRequestOptions") + + request = build_network_management_list_network_manager_effective_security_admin_rules_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_network_manager_effective_security_admin_rules.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerEffectiveSecurityAdminRulesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_security_admin_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules" + } + + @distributed_trace_async + async def supported_security_providers( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> _models.VirtualWanSecurityProviders: + """Gives the supported security providers for the virtual wan. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which supported security providers are + needed. Required. + :type virtual_wan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWanSecurityProviders or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProviders + :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._api_version("supported_security_providers") or "2023-09-01") + ) + cls: ClsType[_models.VirtualWanSecurityProviders] = kwargs.pop("cls", None) + + request = build_network_management_supported_security_providers_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.supported_security_providers.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( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWanSecurityProviders", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + supported_security_providers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders" + } + + async def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnProfileResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", + self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnProfileResponse]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_client_params, (IOBase, bytes)): + _content = vpn_client_params + else: + _json = self._serialize.body(vpn_client_params, "VirtualWanVpnProfileParameters") + + request = build_network_management_generatevirtualwanvpnserverconfigurationvpnprofile_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generatevirtualwanvpnserverconfigurationvpnprofile_initial.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( # type: ignore # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generatevirtualwanvpnserverconfigurationvpnprofile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" + } + + @overload + async def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: _models.VirtualWanVpnProfileParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Required. + :type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters + :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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Required. + :type vpn_client_params: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required. + :type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :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._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnProfileResponse] = 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._generatevirtualwanvpnserverconfigurationvpnprofile_initial( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + vpn_client_params=vpn_client_params, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generatevirtualwanvpnserverconfigurationvpnprofile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" + } + + +class NetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_interfaces` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_cloud_service_role_instance_network_interfaces( + self, resource_group_name: str, cloud_service_name: str, role_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """Gets information about all network interfaces in a role instance in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_cloud_service_role_instance_network_interfaces_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_role_instance_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_cloud_service_role_instance_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces" + } + + @distributed_trace + def list_cloud_service_network_interfaces( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """Gets all network interfaces in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_cloud_service_network_interfaces_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_cloud_service_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces" + } + + @distributed_trace_async + async def get_cloud_service_network_interface( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterface: + """Get the specified network interface in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_cloud_service_network_interface_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_cloud_service_network_interface.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_cloud_service_network_interface.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_interfaces_delete_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_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._api_version or "2023-09-01")) + 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, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_interface_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkInterface: + """Gets information about the specified network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, "NetworkInterface") + + request = build_network_interfaces_create_or_update_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + 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.Network/networkInterfaces/{networkInterfaceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: _models.NetworkInterface, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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 NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. + 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 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 NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. Is + either a NetworkInterface type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterface or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, + network_interface_name=network_interface_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, "TagsObject") + + request = build_network_interfaces_update_tags_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkInterface"]: + """Gets all network interfaces in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkInterface"]: + """Gets all network interfaces in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces" + } + + async def _get_effective_route_table_initial( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Optional[_models.EffectiveRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.EffectiveRouteListResult]] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_effective_route_table_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_effective_route_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_effective_route_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" + } + + @distributed_trace_async + async def begin_get_effective_route_table( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteListResult]: + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_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 EffectiveRouteListResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EffectiveRouteListResult] = 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._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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): + deserialized = self._deserialize("EffectiveRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_effective_route_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" + } + + async def _list_effective_network_security_groups_initial( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Optional[_models.EffectiveNetworkSecurityGroupListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.EffectiveNetworkSecurityGroupListResult]] = kwargs.pop("cls", None) + + request = build_network_interfaces_list_effective_network_security_groups_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_effective_network_security_groups_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveNetworkSecurityGroupListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_effective_network_security_groups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" + } + + @distributed_trace_async + async def begin_list_effective_network_security_groups( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveNetworkSecurityGroupListResult]: + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_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 + EffectiveNetworkSecurityGroupListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroupListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EffectiveNetworkSecurityGroupListResult] = 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._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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): + deserialized = self._deserialize("EffectiveNetworkSecurityGroupListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_effective_network_security_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" + } + + @distributed_trace + def list_virtual_machine_scale_set_vm_network_interfaces( + self, resource_group_name: str, virtual_machine_scale_set_name: str, virtualmachine_index: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """Gets information about all network interfaces in a virtual machine in a virtual machine scale + set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_virtual_machine_scale_set_vm_network_interfaces_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_vm_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_vm_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces" + } + + @distributed_trace + def list_virtual_machine_scale_set_network_interfaces( + self, resource_group_name: str, virtual_machine_scale_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """Gets all network interfaces in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_virtual_machine_scale_set_network_interfaces_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces" + } + + @distributed_trace_async + async def get_virtual_machine_scale_set_network_interface( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterface: + """Get the specified network interface in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_virtual_machine_scale_set_network_interface_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_network_interface.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_network_interface.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list_virtual_machine_scale_set_ip_configurations( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterfaceIPConfiguration"]: + """Get the specified network interface ip configuration in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = 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_network_interfaces_list_virtual_machine_scale_set_ip_configurations_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_ip_configurations.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_ip_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations" + } + + @distributed_trace_async + async def get_virtual_machine_scale_set_ip_configuration( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterfaceIPConfiguration: + """Get the specified network interface ip configuration in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the ip configuration. Required. + :type ip_configuration_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_virtual_machine_scale_set_ip_configuration_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_ip_configuration.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_ip_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + } + + +class PublicIPAddressesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`public_ip_addresses` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_cloud_service_public_ip_addresses( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses on a cloud service level. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_cloud_service_public_ip_addresses_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_cloud_service_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses" + } + + @distributed_trace + def list_cloud_service_role_instance_public_ip_addresses( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses in a role instance IP configuration in a cloud + service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :param network_interface_name: The network interface name. Required. + :type network_interface_name: str + :param ip_configuration_name: The IP configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_cloud_service_role_instance_public_ip_addresses_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_role_instance_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_cloud_service_role_instance_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + } + + @distributed_trace_async + async def get_cloud_service_public_ip_address( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PublicIPAddress: + """Get the specified public IP address in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The role instance name. Required. + :type role_instance_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the IP configuration. Required. + :type ip_configuration_name: str + :param public_ip_address_name: The name of the public IP Address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_cloud_service_public_ip_address_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_cloud_service_public_ip_address.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_cloud_service_public_ip_address.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_address_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_delete_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_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._api_version or "2023-09-01")) + 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, + public_ip_address_name=public_ip_address_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, public_ip_address_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PublicIPAddress: + """Gets the specified public IP address in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.PublicIPAddress, IO], + **kwargs: Any + ) -> _models.PublicIPAddress: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, "PublicIPAddress") + + request = build_public_ip_addresses_create_or_update_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + 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.Network/publicIPAddresses/{publicIpAddressName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: _models.PublicIPAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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 PublicIPAddress or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. + 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 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 PublicIPAddress or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.PublicIPAddress, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. Is + either a PublicIPAddress type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PublicIPAddress or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, + public_ip_address_name=public_ip_address_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, "TagsObject") + + request = build_public_ip_addresses_update_tags_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets all the public IP addresses in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets all public IP addresses in a resource group. + + :param resource_group_name: The name of the resource group. 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 PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses" + } + + async def _ddos_protection_status_initial( + self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any + ) -> Optional[_models.PublicIpDdosProtectionStatusResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.PublicIpDdosProtectionStatusResult]] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_ddos_protection_status_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._ddos_protection_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PublicIpDdosProtectionStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _ddos_protection_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus" + } + + @distributed_trace_async + async def begin_ddos_protection_status( + self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIpDdosProtectionStatusResult]: + """Gets the Ddos Protection Status of a Public IP Address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_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 PublicIpDdosProtectionStatusResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIpDdosProtectionStatusResult] = 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._ddos_protection_status_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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): + deserialized = self._deserialize("PublicIpDdosProtectionStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_ddos_protection_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus" + } + + @distributed_trace + def list_virtual_machine_scale_set_public_ip_addresses( + self, resource_group_name: str, virtual_machine_scale_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses on a virtual machine scale set level. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_virtual_machine_scale_set_public_ip_addresses_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses" + } + + @distributed_trace + def list_virtual_machine_scale_set_vm_public_ip_addresses( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses in a virtual machine IP configuration in a + virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The network interface name. Required. + :type network_interface_name: str + :param ip_configuration_name: The IP configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_virtual_machine_scale_set_vm_public_ip_addresses_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_vm_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_vm_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + } + + @distributed_trace_async + async def get_virtual_machine_scale_set_public_ip_address( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PublicIPAddress: + """Get the specified public IP address in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the IP configuration. Required. + :type ip_configuration_name: str + :param public_ip_address_name: The name of the public IP Address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_virtual_machine_scale_set_public_ip_address_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_public_ip_address.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_public_ip_address.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + } + + +class VipSwapOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vip_swap` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.SwapResource: + """Gets the SwapResource which identifies the slot type for the specified cloud service. The slot + type on a cloud service can either be Staging or Production. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :keyword singleton_resource: Specifies a synthetic proxy resource that cannot be created or + deleted. Value must be set to swap. Default value is "swap". Note that overriding this default + value may result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwapResource or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SwapResource + :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 {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[_models.SwapResource] = kwargs.pop("cls", None) + + request = build_vip_swap_get_request( + group_name=group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + singleton_resource=singleton_resource, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SwapResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + async def _create_initial( # pylint: disable=inconsistent-return-statements + self, group_name: str, resource_name: str, parameters: Union[_models.SwapResource, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "SwapResource") + + request = build_vip_swap_create_request( + group_name=group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + singleton_resource=singleton_resource, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + @overload + async def begin_create( + self, + group_name: str, + resource_name: str, + parameters: _models.SwapResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SwapResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + async def begin_create( + self, + group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. 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 singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @distributed_trace_async + async def begin_create( + self, group_name: str, resource_name: str, parameters: Union[_models.SwapResource, IO], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. Is either a SwapResource type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SwapResource or IO + :keyword singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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 {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._create_initial( # type: ignore + group_name=group_name, + resource_name=resource_name, + parameters=parameters, + singleton_resource=singleton_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # 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_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + @distributed_trace_async + async def list(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.SwapResourceListResult: + """Gets the list of SwapResource which identifies the slot type for the specified cloud service. + The slot type on a cloud service can either be Staging or Production. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwapResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SwapResourceListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SwapResourceListResult] = kwargs.pop("cls", None) + + request = build_vip_swap_list_request( + group_name=group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SwapResourceListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots" + } + + +class CustomIPPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`custom_ip_prefixes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, custom_ip_prefix_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_custom_ip_prefixes_delete_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, custom_ip_prefix_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the CustomIpPrefix. Required. + :type custom_ip_prefix_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._api_version or "2023-09-01")) + 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, + custom_ip_prefix_name=custom_ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, custom_ip_prefix_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.CustomIpPrefix: + """Gets the specified custom IP prefix in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) + + request = build_custom_ip_prefixes_get_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.CustomIpPrefix, IO], + **kwargs: Any + ) -> _models.CustomIpPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, "CustomIpPrefix") + + request = build_custom_ip_prefixes_create_or_update_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + 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.Network/customIpPrefixes/{customIpPrefixName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: _models.CustomIpPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :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 CustomIpPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. + 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 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 CustomIpPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.CustomIpPrefix, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. Is + either a CustomIpPrefix type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomIpPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, + custom_ip_prefix_name=custom_ip_prefix_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, "TagsObject") + + request = build_custom_ip_prefixes_update_tags_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.CustomIpPrefix"]: + """Gets all the custom IP prefixes in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomIpPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefixListResult] = 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_custom_ip_prefixes_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CustomIpPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.CustomIpPrefix"]: + """Gets all custom IP prefixes in a resource group. + + :param resource_group_name: The name of the resource group. 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 CustomIpPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefixListResult] = 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_custom_ip_prefixes_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CustomIpPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes" + } + + +class DdosCustomPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`ddos_custom_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ddos_custom_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ddos_custom_policies_delete_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_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._api_version or "2023-09-01")) + 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, + ddos_custom_policy_name=ddos_custom_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Gets information about the specified DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) + + request = build_ddos_custom_policies_get_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.DdosCustomPolicy, IO], + **kwargs: Any + ) -> _models.DdosCustomPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, "DdosCustomPolicy") + + request = build_ddos_custom_policies_create_or_update_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + 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.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: _models.DdosCustomPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :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 DdosCustomPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. 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 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 DdosCustomPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.DdosCustomPolicy, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. Is either a + DdosCustomPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DdosCustomPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, + ddos_custom_policy_name=ddos_custom_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, "TagsObject") + + request = build_ddos_custom_policies_update_tags_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + +class DdosProtectionPlansOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`ddos_protection_plans` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ddos_protection_plan_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ddos_protection_plans_delete_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, ddos_protection_plan_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_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._api_version or "2023-09-01")) + 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, + ddos_protection_plan_name=ddos_protection_plan_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, ddos_protection_plan_name: str, **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Gets information about the specified DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) + + request = build_ddos_protection_plans_get_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.DdosProtectionPlan, IO], + **kwargs: Any + ) -> _models.DdosProtectionPlan: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, "DdosProtectionPlan") + + request = build_ddos_protection_plans_create_or_update_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + 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.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: _models.DdosProtectionPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :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 DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. 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 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 DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.DdosProtectionPlan, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. Is either a + DdosProtectionPlan type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, + ddos_protection_plan_name=ddos_protection_plan_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, "TagsObject") + + request = build_ddos_protection_plans_update_tags_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.DdosProtectionPlan"]: + """Gets all DDoS protection plans in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DdosProtectionPlan or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlanListResult] = 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_ddos_protection_plans_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlanListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DdosProtectionPlan"]: + """Gets all the DDoS protection plans in a resource group. + + :param resource_group_name: The name of the resource group. 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 DdosProtectionPlan or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlanListResult] = 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_ddos_protection_plans_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlanListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans" + } + + +class DscpConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`dscp_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: Union[_models.DscpConfiguration, IO], + **kwargs: Any + ) -> _models.DscpConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscpConfiguration] = 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, "DscpConfiguration") + + request = build_dscp_configuration_create_or_update_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + 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.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: _models.DscpConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration + :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 DscpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. + 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 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 DscpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: Union[_models.DscpConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. Is + either a DscpConfiguration type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DscpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscpConfiguration] = 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, + dscp_configuration_name=dscp_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dscp_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_dscp_configuration_delete_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, dscp_configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_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._api_version or "2023-09-01")) + 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, + dscp_configuration_name=dscp_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, dscp_configuration_name: str, **kwargs: Any + ) -> _models.DscpConfiguration: + """Gets a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DscpConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) + + request = build_dscp_configuration_get_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.DscpConfiguration"]: + """Gets a DSCP Configuration. + + :param resource_group_name: The name of the resource group. 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 DscpConfiguration or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfigurationListResult] = 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_dscp_configuration_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DscpConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.DscpConfiguration"]: + """Gets all dscp configurations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DscpConfiguration or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfigurationListResult] = 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_dscp_configuration_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DscpConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations"} + + +class AvailableEndpointServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`available_endpoint_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.EndpointServiceResult"]: + """List what values of endpoint services are available for use. + + :param location: The location to check available endpoint services. 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 EndpointServiceResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.EndpointServiceResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EndpointServicesListResult] = 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_available_endpoint_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointServicesListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices" + } + + +class ExpressRouteCircuitAuthorizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_circuit_authorizations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, authorization_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_authorizations_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, circuit_name: str, authorization_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified authorization from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_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._api_version or "2023-09-01")) + 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, + circuit_name=circuit_name, + authorization_name=authorization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, circuit_name: str, authorization_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitAuthorization: + """Gets the specified authorization from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitAuthorization or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) + + request = build_express_route_circuit_authorizations_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRouteCircuitAuthorization, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitAuthorization: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(authorization_parameters, (IOBase, bytes)): + _content = authorization_parameters + else: + _json = self._serialize.body(authorization_parameters, "ExpressRouteCircuitAuthorization") + + request = build_express_route_circuit_authorizations_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: _models.ExpressRouteCircuitAuthorization, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization + :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 ExpressRouteCircuitAuthorization or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Required. + :type authorization_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 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 ExpressRouteCircuitAuthorization or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRouteCircuitAuthorization, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Is either a ExpressRouteCircuitAuthorization type or a IO + type. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCircuitAuthorization or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = 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, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteCircuitAuthorization"]: + """Gets all authorizations in an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitAuthorization or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AuthorizationListResult] = 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_express_route_circuit_authorizations_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations" + } + + +class ExpressRouteCircuitPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_circuit_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_peerings_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_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._api_version or "2023-09-01")) + 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, + circuit_name=circuit_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitPeering: + """Gets the specified peering for the express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) + + request = build_express_route_circuit_peerings_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCircuitPeering, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(peering_parameters, (IOBase, bytes)): + _content = peering_parameters + else: + _json = self._serialize.body(peering_parameters, "ExpressRouteCircuitPeering") + + request = build_express_route_circuit_peerings_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: _models.ExpressRouteCircuitPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Required. + :type peering_parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering + :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 ExpressRouteCircuitPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Required. + :type peering_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 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 ExpressRouteCircuitPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCircuitPeering, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Is either a ExpressRouteCircuitPeering type or a IO type. Required. + :type peering_parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCircuitPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitPeering] = 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, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteCircuitPeering"]: + """Gets all peerings in a specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitPeering or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitPeeringListResult] = 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_express_route_circuit_peerings_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitPeeringListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings" + } + + +class ExpressRouteCircuitConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_circuit_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_connections_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Express Route Circuit Connection from the specified express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitConnection: + """Gets the specified Express Route Circuit Connection from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + request = build_express_route_circuit_connections_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: Union[_models.ExpressRouteCircuitConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(express_route_circuit_connection_parameters, (IOBase, bytes)): + _content = express_route_circuit_connection_parameters + else: + _json = self._serialize.body(express_route_circuit_connection_parameters, "ExpressRouteCircuitConnection") + + request = build_express_route_circuit_connections_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: _models.ExpressRouteCircuitConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Required. + :type express_route_circuit_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection + :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 ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Required. + :type express_route_circuit_connection_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 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 ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: Union[_models.ExpressRouteCircuitConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Is either a ExpressRouteCircuitConnection type or a + IO type. Required. + :type express_route_circuit_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitConnection] = 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, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_name, + express_route_circuit_connection_parameters=express_route_circuit_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteCircuitConnection"]: + """Gets all global reach connections associated with a private peering in an express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitConnectionListResult] = 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_express_route_circuit_connections_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections" + } + + +class PeerExpressRouteCircuitConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`peer_express_route_circuit_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> _models.PeerExpressRouteCircuitConnection: + """Gets the specified Peer Express Route Circuit Connection from the specified express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the peer express route circuit connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PeerExpressRouteCircuitConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PeerExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + request = build_peer_express_route_circuit_connections_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PeerExpressRouteCircuitConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PeerExpressRouteCircuitConnection"]: + """Gets all global reach peer connections associated with a private peering in an express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PeerExpressRouteCircuitConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PeerExpressRouteCircuitConnectionListResult] = 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_peer_express_route_circuit_connections_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PeerExpressRouteCircuitConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections" + } + + +class ExpressRouteCircuitsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_circuits` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuits_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_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._api_version or "2023-09-01")) + 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, + circuit_name=circuit_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> _models.ExpressRouteCircuit: + """Gets information about the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + parameters: Union[_models.ExpressRouteCircuit, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, "ExpressRouteCircuit") + + request = build_express_route_circuits_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: _models.ExpressRouteCircuit, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :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 ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + 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 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 ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: Union[_models.ExpressRouteCircuit, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + Is either a ExpressRouteCircuit type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, + circuit_name=circuit_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + circuit_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + circuit_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, circuit_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, "TagsObject") + + request = build_express_route_circuits_update_tags_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + async def _list_arp_table_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsArpTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_arp_table_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_arp_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + @distributed_trace_async + async def begin_list_arp_table( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitsArpTableListResult]: + """Gets the currently advertised ARP table associated with the express route circuit in a resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsArpTableListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsArpTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = 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._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + async def _list_routes_table_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_routes_table_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + @distributed_trace_async + async def begin_list_routes_table( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitsRoutesTableListResult]: + """Gets the currently advertised routes table associated with the express route circuit in a + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsRoutesTableListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = 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._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + async def _list_routes_table_summary_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_routes_table_summary_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_summary_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableSummaryListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_summary_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace_async + async def begin_list_routes_table_summary( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]: + """Gets the currently advertised routes table summary associated with the express route circuit in + a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsRoutesTableSummaryListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableSummaryListResult] = 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._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableSummaryListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table_summary.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace_async + async def get_stats( + self, resource_group_name: str, circuit_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitStats: + """Gets all the stats from an express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitStats or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_stats_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_stats.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitStats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats" + } + + @distributed_trace_async + async def get_peering_stats( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitStats: + """Gets all stats from an express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitStats or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_peering_stats_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_peering_stats.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitStats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_peering_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteCircuit"]: + """Gets all the express route circuits in a resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRouteCircuit or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitListResult] = 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_express_route_circuits_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteCircuit"]: + """Gets all the express route circuits in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuit or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitListResult] = 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_express_route_circuits_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits"} + + +class ExpressRouteServiceProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_service_providers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteServiceProvider"]: + """Gets all the available express route service providers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteServiceProvider or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteServiceProviderListResult] = 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_express_route_service_providers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteServiceProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders"} + + +class ExpressRouteCrossConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_cross_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRouteCrossConnection"]: + """Retrieves all the ExpressRouteCrossConnections in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCrossConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = 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_express_route_cross_connections_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteCrossConnection"]: + """Retrieves all the ExpressRouteCrossConnections in a resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRouteCrossConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = 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_express_route_cross_connections_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, cross_connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Gets details about the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group (peering location of the circuit). + Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection (service key of the + circuit). Required. + :type cross_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_get_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: Union[_models.ExpressRouteCrossConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = 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, "ExpressRouteCrossConnection") + + request = build_express_route_cross_connections_create_or_update_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: _models.ExpressRouteCrossConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :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 ExpressRouteCrossConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + 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 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 ExpressRouteCrossConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: Union[_models.ExpressRouteCrossConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + Is either a ExpressRouteCrossConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCrossConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = 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, + cross_connection_name=cross_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Required. + :type cross_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Required. + :type cross_connection_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Is either a TagsObject type or a IO type. Required. + :type cross_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cross_connection_parameters, (IOBase, bytes)): + _content = cross_connection_parameters + else: + _json = self._serialize.body(cross_connection_parameters, "TagsObject") + + request = build_express_route_cross_connections_update_tags_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + async def _list_arp_table_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsArpTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_list_arp_table_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_arp_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + @distributed_trace_async + async def begin_list_arp_table( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitsArpTableListResult]: + """Gets the currently advertised ARP table associated with the express route cross connection in a + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsArpTableListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsArpTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = 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._list_arp_table_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + async def _list_routes_table_summary_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]] = kwargs.pop( + "cls", None + ) + + request = build_express_route_cross_connections_list_routes_table_summary_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_summary_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize( + "ExpressRouteCrossConnectionsRoutesTableSummaryListResult", pipeline_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_summary_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace_async + async def begin_list_routes_table_summary( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]: + """Gets the route table summary associated with the express route cross connection in a resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCrossConnectionsRoutesTableSummaryListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] = 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._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize( + "ExpressRouteCrossConnectionsRoutesTableSummaryListResult", pipeline_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table_summary.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + async def _list_routes_table_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_list_routes_table_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + @distributed_trace_async + async def begin_list_routes_table( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCircuitsRoutesTableListResult]: + """Gets the currently advertised routes table associated with the express route cross connection + in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsRoutesTableListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = 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._list_routes_table_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + +class ExpressRouteCrossConnectionPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_cross_connection_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, cross_connection_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteCrossConnectionPeering"]: + """Gets all peerings in a specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCrossConnectionPeering or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionPeeringList] = 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_express_route_cross_connection_peerings_list_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionPeeringList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cross_connection_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_cross_connection_peerings_delete_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified peering from the ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_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._api_version or "2023-09-01")) + 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, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCrossConnectionPeering: + """Gets the specified peering for the ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnectionPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) + + request = build_express_route_cross_connection_peerings_get_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCrossConnectionPeering, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnectionPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(peering_parameters, (IOBase, bytes)): + _content = peering_parameters + else: + _json = self._serialize.body(peering_parameters, "ExpressRouteCrossConnectionPeering") + + request = build_express_route_cross_connection_peerings_create_or_update_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + 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.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: _models.ExpressRouteCrossConnectionPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Required. + :type peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering + :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 ExpressRouteCrossConnectionPeering + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Required. + :type peering_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 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 ExpressRouteCrossConnectionPeering + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCrossConnectionPeering, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Is either a ExpressRouteCrossConnectionPeering + type or a IO type. Required. + :type peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteCrossConnectionPeering + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = 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, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + peering_parameters=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + +class ExpressRoutePortsLocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_ports_locations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRoutePortsLocation"]: + """Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each + location. Available bandwidths can only be obtained when retrieving a specific peering + location. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePortsLocation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortsLocationListResult] = 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_express_route_ports_locations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortsLocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations"} + + @distributed_trace_async + async def get(self, location_name: str, **kwargs: Any) -> _models.ExpressRoutePortsLocation: + """Retrieves a single ExpressRoutePort peering location, including the list of available + bandwidths available at said peering location. + + :param location_name: Name of the requested ExpressRoutePort peering location. Required. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePortsLocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortsLocation] = kwargs.pop("cls", None) + + request = build_express_route_ports_locations_get_request( + location_name=location_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePortsLocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}" + } + + +class ExpressRoutePortsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_ports` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_port_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_ports_delete_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_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._api_version or "2023-09-01")) + 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, + express_route_port_name=express_route_port_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> _models.ExpressRoutePort: + """Retrieves the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) + + request = build_express_route_ports_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.ExpressRoutePort, IO], + **kwargs: Any + ) -> _models.ExpressRoutePort: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, "ExpressRoutePort") + + request = build_express_route_ports_create_or_update_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + 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.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: _models.ExpressRoutePort, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :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 ExpressRoutePort or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. 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 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 ExpressRoutePort or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.ExpressRoutePort, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. Is either a + ExpressRoutePort type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRoutePort or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, + express_route_port_name=express_route_port_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, "TagsObject") + + request = build_express_route_ports_update_tags_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRoutePort"]: + """List all the ExpressRoutePort resources in the specified resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRoutePort or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortListResult] = 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_express_route_ports_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ExpressRoutePort"]: + """List all the ExpressRoutePort resources in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePort or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortListResult] = 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_express_route_ports_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts"} + + @overload + async def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: _models.GenerateExpressRoutePortsLOARequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOARequest + :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: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: Union[_models.GenerateExpressRoutePortsLOARequest, IO], + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Is either a + GenerateExpressRoutePortsLOARequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOARequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateExpressRoutePortsLOAResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "GenerateExpressRoutePortsLOARequest") + + request = build_express_route_ports_generate_loa_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.generate_loa.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GenerateExpressRoutePortsLOAResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_loa.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/generateLoa" + } + + +class ExpressRouteLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, express_route_port_name: str, link_name: str, **kwargs: Any + ) -> _models.ExpressRouteLink: + """Retrieves the specified ExpressRouteLink resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param link_name: The name of the ExpressRouteLink resource. Required. + :type link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteLink or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteLink] = kwargs.pop("cls", None) + + request = build_express_route_links_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + link_name=link_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteLink", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRouteLink"]: + """Retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteLink or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteLinkListResult] = 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_express_route_links_list_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteLinkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links" + } + + +class ExpressRoutePortAuthorizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_port_authorizations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_port_name: str, authorization_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_port_authorizations_delete_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, express_route_port_name: str, authorization_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified authorization from the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_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._api_version or "2023-09-01")) + 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, + express_route_port_name=express_route_port_name, + authorization_name=authorization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, express_route_port_name: str, authorization_name: str, **kwargs: Any + ) -> _models.ExpressRoutePortAuthorization: + """Gets the specified authorization from the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePortAuthorization or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) + + request = build_express_route_port_authorizations_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRoutePortAuthorization, IO], + **kwargs: Any + ) -> _models.ExpressRoutePortAuthorization: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(authorization_parameters, (IOBase, bytes)): + _content = authorization_parameters + else: + _json = self._serialize.body(authorization_parameters, "ExpressRoutePortAuthorization") + + request = build_express_route_port_authorizations_create_or_update_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + 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.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: _models.ExpressRoutePortAuthorization, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization + :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 ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Required. + :type authorization_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 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 ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRoutePortAuthorization, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Is either a ExpressRoutePortAuthorization type or a IO type. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePortAuthorization] = 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, + express_route_port_name=express_route_port_name, + authorization_name=authorization_name, + authorization_parameters=authorization_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ExpressRoutePortAuthorization"]: + """Gets all authorizations in an express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePortAuthorization or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortAuthorizationListResult] = 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_express_route_port_authorizations_list_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortAuthorizationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations" + } + + +class ExpressRouteProviderPortsLocationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_provider_ports_location` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list(self, *, filter: Optional[str] = None, **kwargs: Any) -> _models.ExpressRouteProviderPortListResult: + """Retrieves all the ExpressRouteProviderPorts in a subscription. + + :keyword filter: The filter to apply on the operation. For example, you can use + $filter=location eq '{state}'. Default value is None. + :paramtype filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteProviderPortListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPortListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteProviderPortListResult] = kwargs.pop("cls", None) + + request = build_express_route_provider_ports_location_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteProviderPortListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts"} + + +class FirewallPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`firewall_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, firewall_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_firewall_policies_delete_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_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._api_version or "2023-09-01")) + 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, + firewall_policy_name=firewall_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, firewall_policy_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.FirewallPolicy: + """Gets the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) + + request = build_firewall_policies_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.FirewallPolicy, IO], + **kwargs: Any + ) -> _models.FirewallPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, "FirewallPolicy") + + request = build_firewall_policies_create_or_update_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + 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.Network/firewallPolicies/{firewallPolicyName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.FirewallPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :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 FirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. + 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 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 FirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.FirewallPolicy, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. Is + either a FirewallPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, + firewall_policy_name=firewall_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, "TagsObject") + + request = build_firewall_policies_update_tags_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.FirewallPolicy"]: + """Lists all Firewall Policies in a resource group. + + :param resource_group_name: The name of the resource group. 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 FirewallPolicy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyListResult] = 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_firewall_policies_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.FirewallPolicy"]: + """Gets all the Firewall Policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallPolicy or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyListResult] = 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_firewall_policies_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies"} + + +class FirewallPolicyRuleCollectionGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`firewall_policy_rule_collection_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_firewall_policy_rule_collection_groups_delete_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_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._api_version or "2023-09-01")) + 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, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_name: str, **kwargs: Any + ) -> _models.FirewallPolicyRuleCollectionGroup: + """Gets the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicyRuleCollectionGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) + + request = build_firewall_policy_rule_collection_groups_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: Union[_models.FirewallPolicyRuleCollectionGroup, IO], + **kwargs: Any + ) -> _models.FirewallPolicyRuleCollectionGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = 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, "FirewallPolicyRuleCollectionGroup") + + request = build_firewall_policy_rule_collection_groups_create_or_update_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + 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.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: _models.FirewallPolicyRuleCollectionGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup + :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 FirewallPolicyRuleCollectionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. 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 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 FirewallPolicyRuleCollectionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: Union[_models.FirewallPolicyRuleCollectionGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. Is either a FirewallPolicyRuleCollectionGroup type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FirewallPolicyRuleCollectionGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = 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, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FirewallPolicyRuleCollectionGroup"]: + """Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallPolicyRuleCollectionGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroupListResult] = 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_firewall_policy_rule_collection_groups_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups" + } + + +class FirewallPolicyIdpsSignaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.IDPSQueryObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IDPSQueryObject + :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: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.IDPSQueryObject, IO], + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Is either a IDPSQueryObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IDPSQueryObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResults] = 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, "IDPSQueryObject") + + request = build_firewall_policy_idps_signatures_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("QueryResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsSignatures" + } + + +class FirewallPolicyIdpsSignaturesOverridesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures_overrides` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignaturesOverrides, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignaturesOverrides, IO], + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Is either a + SignaturesOverrides type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignaturesOverrides] = 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, "SignaturesOverrides") + + request = build_firewall_policy_idps_signatures_overrides_patch_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @overload + async def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignaturesOverrides, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignaturesOverrides, IO], + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Is either a + SignaturesOverrides type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignaturesOverrides] = 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, "SignaturesOverrides") + + request = build_firewall_policy_idps_signatures_overrides_put_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> _models.SignaturesOverrides: + """Returns all signatures overrides for a specific policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) + + request = build_firewall_policy_idps_signatures_overrides_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @distributed_trace_async + async def list( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> _models.SignaturesOverridesList: + """Returns all signatures overrides objects for a specific policy as a list containing a single + value. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverridesList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverridesList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SignaturesOverridesList] = kwargs.pop("cls", None) + + request = build_firewall_policy_idps_signatures_overrides_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverridesList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides" + } + + +class FirewallPolicyIdpsSignaturesFilterValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures_filter_values` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignatureOverridesFilterValuesQuery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesQuery + :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: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignatureOverridesFilterValuesQuery, IO], + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Is either a SignatureOverridesFilterValuesQuery type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesQuery or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignatureOverridesFilterValuesResponse] = 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, "SignatureOverridesFilterValuesQuery") + + request = build_firewall_policy_idps_signatures_filter_values_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignatureOverridesFilterValuesResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions" + } + + +class IpAllocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`ip_allocations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_allocation_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ip_allocations_delete_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, ip_allocation_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified IpAllocation. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_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._api_version or "2023-09-01")) + 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, + ip_allocation_name=ip_allocation_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, ip_allocation_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.IpAllocation: + """Gets the specified IpAllocation by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) + + request = build_ip_allocations_get_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.IpAllocation, IO], + **kwargs: Any + ) -> _models.IpAllocation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, "IpAllocation") + + request = build_ip_allocations_create_or_update_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("IpAllocation", pipeline_response) + + 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.Network/IpAllocations/{ipAllocationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: _models.IpAllocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :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 IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + 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 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 IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.IpAllocation, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. Is + either a IpAllocation type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpAllocation or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, + ip_allocation_name=ip_allocation_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpAllocation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, "TagsObject") + + request = build_ip_allocations_update_tags_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.IpAllocation"]: + """Gets all IpAllocations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpAllocation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocationListResult] = 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_ip_allocations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpAllocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.IpAllocation"]: + """Gets all IpAllocations in a resource group. + + :param resource_group_name: The name of the resource group. 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 IpAllocation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocationListResult] = 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_ip_allocations_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpAllocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations" + } + + +class IpGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`ip_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, ip_groups_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.IpGroup: + """Gets the specified ipGroups. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :keyword expand: Expands resourceIds (of Firewalls/Network Security Groups etc.) back + referenced by the IpGroups resource. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) + + request = build_ip_groups_get_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.IpGroup, IO], **kwargs: Any + ) -> _models.IpGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, "IpGroup") + + request = build_ip_groups_create_or_update_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("IpGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("IpGroup", pipeline_response) + + 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.Network/ipGroups/{ipGroupsName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: _models.IpGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :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 IpGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. 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 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 IpGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.IpGroup, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. Is either a + IpGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, + ip_groups_name=ip_groups_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + @overload + async def update_groups( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_groups( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_groups( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, "TagsObject") + + request = build_ip_groups_update_groups_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_groups.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_groups_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ip_groups_delete_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_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) + + _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.Error, 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.Network/ipGroups/{ipGroupsName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, ip_groups_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified ipGroups. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_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._api_version or "2023-09-01")) + 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, + ip_groups_name=ip_groups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.IpGroup"]: + """Gets all IpGroups in a resource group. + + :param resource_group_name: The name of the resource group. 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 IpGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroupListResult] = 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_ip_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpGroupListResult", 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.Error, 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.Network/ipGroups" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.IpGroup"]: + """Gets all IpGroups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroupListResult] = 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_ip_groups_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("IpGroupListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups"} + + +class LoadBalancersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_load_balancers_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_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._api_version or "2023-09-01")) + 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, + load_balancer_name=load_balancer_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.LoadBalancer: + """Gets the specified load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) + + request = build_load_balancers_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.LoadBalancer, IO], + **kwargs: Any + ) -> _models.LoadBalancer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, "LoadBalancer") + + request = build_load_balancers_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: _models.LoadBalancer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :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 LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. + 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 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 LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.LoadBalancer, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. Is + either a LoadBalancer type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, + load_balancer_name=load_balancer_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LoadBalancer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, "TagsObject") + + request = build_load_balancers_update_tags_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.LoadBalancer"]: + """Gets all the load balancers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerListResult] = 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_load_balancers_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.LoadBalancer"]: + """Gets all the load balancers in a resource group. + + :param resource_group_name: The name of the resource group. 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 LoadBalancer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerListResult] = 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_load_balancers_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers" + } + + async def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-return-statements + self, location: str, parameters: Union[_models.LoadBalancerVipSwapRequest, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "LoadBalancerVipSwapRequest") + + request = build_load_balancers_swap_public_ip_addresses_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._swap_public_ip_addresses_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_public_ip_addresses_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses" + } + + @overload + async def begin_swap_public_ip_addresses( + self, + location: str, + parameters: _models.LoadBalancerVipSwapRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequest + :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: + """ + + @overload + async def begin_swap_public_ip_addresses( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. 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 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: + """ + + @distributed_trace_async + async def begin_swap_public_ip_addresses( + self, location: str, parameters: Union[_models.LoadBalancerVipSwapRequest, IO], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. Is either a + LoadBalancerVipSwapRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._swap_public_ip_addresses_initial( # type: ignore + location=location, + 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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_swap_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses" + } + + async def _list_inbound_nat_rule_port_mappings_initial( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: Union[_models.QueryInboundNatRulePortMappingRequest, IO], + **kwargs: Any + ) -> _models.BackendAddressInboundNatRulePortMappings: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = 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, "QueryInboundNatRulePortMappingRequest") + + request = build_load_balancers_list_inbound_nat_rule_port_mappings_request( + group_name=group_name, + load_balancer_name=load_balancer_name, + backend_pool_name=backend_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._list_inbound_nat_rule_port_mappings_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _list_inbound_nat_rule_port_mappings_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + } + + @overload + async def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: _models.QueryInboundNatRulePortMappingRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryInboundNatRulePortMappingRequest + :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 + BackendAddressInboundNatRulePortMappings or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. 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 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 + BackendAddressInboundNatRulePortMappings or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: Union[_models.QueryInboundNatRulePortMappingRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. Is either a + QueryInboundNatRulePortMappingRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryInboundNatRulePortMappingRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BackendAddressInboundNatRulePortMappings or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = 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._list_inbound_nat_rule_port_mappings_initial( + group_name=group_name, + load_balancer_name=load_balancer_name, + backend_pool_name=backend_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_inbound_nat_rule_port_mappings.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + } + + @overload + async def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[_models.MigrateLoadBalancerToIpBasedRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.MigrateLoadBalancerToIpBasedRequest + :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: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[Union[_models.MigrateLoadBalancerToIpBasedRequest, IO]] = None, + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Is either a + MigrateLoadBalancerToIpBasedRequest type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.MigrateLoadBalancerToIpBasedRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigratedPools] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "MigrateLoadBalancerToIpBasedRequest") + else: + _json = None + + request = build_load_balancers_migrate_to_ip_based_request( + group_name=group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.migrate_to_ip_based.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MigratedPools", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + migrate_to_ip_based.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/migrateToIpBased" + } + + +class LoadBalancerBackendAddressPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_backend_address_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BackendAddressPool"]: + """Gets all the load balancer backed address pools. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackendAddressPool or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerBackendAddressPoolListResult] = 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_load_balancer_backend_address_pools_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerBackendAddressPoolListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_name: str, **kwargs: Any + ) -> _models.BackendAddressPool: + """Gets load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackendAddressPool or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) + + request = build_load_balancer_backend_address_pools_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: Union[_models.BackendAddressPool, IO], + **kwargs: Any + ) -> _models.BackendAddressPool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressPool] = 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, "BackendAddressPool") + + request = build_load_balancer_backend_address_pools_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: _models.BackendAddressPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool + :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 BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. 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 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 BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: Union[_models.BackendAddressPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. Is either a BackendAddressPool type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressPool] = 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, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_load_balancer_backend_address_pools_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_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._api_version or "2023-09-01")) + 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, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + +class LoadBalancerFrontendIPConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_frontend_ip_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FrontendIPConfiguration"]: + """Gets all the load balancer frontend IP configurations. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FrontendIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerFrontendIPConfigurationListResult] = 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_load_balancer_frontend_ip_configurations_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerFrontendIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, frontend_ip_configuration_name: str, **kwargs: Any + ) -> _models.FrontendIPConfiguration: + """Gets load balancer frontend IP configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param frontend_ip_configuration_name: The name of the frontend IP configuration. Required. + :type frontend_ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FrontendIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FrontendIPConfiguration] = kwargs.pop("cls", None) + + request = build_load_balancer_frontend_ip_configurations_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + frontend_ip_configuration_name=frontend_ip_configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FrontendIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}" + } + + +class InboundNatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`inbound_nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.InboundNatRule"]: + """Gets all the inbound NAT rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundNatRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.InboundNatRuleListResult] = 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_inbound_nat_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InboundNatRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_name: str, inbound_nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_inbound_nat_rules_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, load_balancer_name: str, inbound_nat_rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_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._api_version or "2023-09-01")) + 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, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.InboundNatRule: + """Gets the specified load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InboundNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) + + request = build_inbound_nat_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: Union[_models.InboundNatRule, IO], + **kwargs: Any + ) -> _models.InboundNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(inbound_nat_rule_parameters, (IOBase, bytes)): + _content = inbound_nat_rule_parameters + else: + _json = self._serialize.body(inbound_nat_rule_parameters, "InboundNatRule") + + request = build_inbound_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: _models.InboundNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Required. + :type inbound_nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule + :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 InboundNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Required. + :type inbound_nat_rule_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 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 InboundNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: Union[_models.InboundNatRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Is either a InboundNatRule type or a IO type. Required. + :type inbound_nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InboundNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundNatRule] = 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, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InboundNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + +class LoadBalancerLoadBalancingRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_load_balancing_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.LoadBalancingRule"]: + """Gets all the load balancing rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancingRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerLoadBalancingRuleListResult] = 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_load_balancer_load_balancing_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerLoadBalancingRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, load_balancing_rule_name: str, **kwargs: Any + ) -> _models.LoadBalancingRule: + """Gets the specified load balancer load balancing rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param load_balancing_rule_name: The name of the load balancing rule. Required. + :type load_balancing_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancingRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancingRule] = kwargs.pop("cls", None) + + request = build_load_balancer_load_balancing_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + load_balancing_rule_name=load_balancing_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancingRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}" + } + + +class LoadBalancerOutboundRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_outbound_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundRule"]: + """Gets all the outbound rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerOutboundRuleListResult] = 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_load_balancer_outbound_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerOutboundRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, outbound_rule_name: str, **kwargs: Any + ) -> _models.OutboundRule: + """Gets the specified load balancer outbound rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param outbound_rule_name: The name of the outbound rule. Required. + :type outbound_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.OutboundRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.OutboundRule] = kwargs.pop("cls", None) + + request = build_load_balancer_outbound_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + outbound_rule_name=outbound_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OutboundRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}" + } + + +class LoadBalancerNetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_network_interfaces` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterface"]: + """Gets associated load balancer network interfaces. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_load_balancer_network_interfaces_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces" + } + + +class LoadBalancerProbesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`load_balancer_probes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, load_balancer_name: str, **kwargs: Any) -> AsyncIterable["_models.Probe"]: + """Gets all the load balancer probes. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Probe or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.Probe] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerProbeListResult] = 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_load_balancer_probes_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerProbeListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, load_balancer_name: str, probe_name: str, **kwargs: Any + ) -> _models.Probe: + """Gets load balancer probe. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param probe_name: The name of the probe. Required. + :type probe_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Probe or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Probe + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Probe] = kwargs.pop("cls", None) + + request = build_load_balancer_probes_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + probe_name=probe_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Probe", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}" + } + + +class NatGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`nat_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, nat_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_nat_gateways_delete_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, nat_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_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._api_version or "2023-09-01")) + 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, + nat_gateway_name=nat_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, nat_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NatGateway: + """Gets the specified nat gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) + + request = build_nat_gateways_get_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.NatGateway, IO], **kwargs: Any + ) -> Optional[_models.NatGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NatGateway]] = 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, "NatGateway") + + request = build_nat_gateways_create_or_update_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("NatGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: _models.NatGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :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 NatGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. 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 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 NatGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.NatGateway, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. Is either + a NatGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NatGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NatGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NatGateway] = 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, + nat_gateway_name=nat_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NatGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NatGateway] = 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, "TagsObject") + + request = build_nat_gateways_update_tags_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NatGateway"]: + """Gets all the Nat Gateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NatGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGatewayListResult] = 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_nat_gateways_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NatGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NatGateway"]: + """Gets all nat gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 NatGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGatewayListResult] = 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_nat_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NatGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways" + } + + +class NetworkInterfaceIPConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_interface_ip_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterfaceIPConfiguration"]: + """Get all ip configurations in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = 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_network_interface_ip_configurations_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_interface_name: str, ip_configuration_name: str, **kwargs: Any + ) -> _models.NetworkInterfaceIPConfiguration: + """Gets the specified network interface ip configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the ip configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) + + request = build_network_interface_ip_configurations_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + } + + +class NetworkInterfaceLoadBalancersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_interface_load_balancers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncIterable["_models.LoadBalancer"]: + """List all load balancers in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceLoadBalancerListResult] = 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_network_interface_load_balancers_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceLoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers" + } + + +class NetworkInterfaceTapConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_interface_tap_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_name: str, tap_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_interface_tap_configurations_delete_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_interface_name: str, tap_configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified tap configuration from the NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_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._api_version or "2023-09-01")) + 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, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_interface_name: str, tap_configuration_name: str, **kwargs: Any + ) -> _models.NetworkInterfaceTapConfiguration: + """Get the specified tap configuration on a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceTapConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) + + request = build_network_interface_tap_configurations_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: Union[_models.NetworkInterfaceTapConfiguration, IO], + **kwargs: Any + ) -> _models.NetworkInterfaceTapConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(tap_configuration_parameters, (IOBase, bytes)): + _content = tap_configuration_parameters + else: + _json = self._serialize.body(tap_configuration_parameters, "NetworkInterfaceTapConfiguration") + + request = build_network_interface_tap_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + 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.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: _models.NetworkInterfaceTapConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Required. + :type tap_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration + :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 NetworkInterfaceTapConfiguration or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Required. + :type tap_configuration_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 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 NetworkInterfaceTapConfiguration or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: Union[_models.NetworkInterfaceTapConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Is either a NetworkInterfaceTapConfiguration type or a IO type. + Required. + :type tap_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkInterfaceTapConfiguration or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = 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, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_name, + tap_configuration_parameters=tap_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkInterfaceTapConfiguration"]: + """Get all Tap configurations in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceTapConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceTapConfigurationListResult] = 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_network_interface_tap_configurations_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceTapConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations" + } + + +class NetworkManagersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_managers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, network_manager_name: str, **kwargs: Any) -> _models.NetworkManager: + """Gets the specified Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) + + request = build_network_managers_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManager, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :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: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManager, IO], + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Is either a + NetworkManager type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManager or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManager] = 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, "NetworkManager") + + request = build_network_managers_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManager", pipeline_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.Network/networkManagers/{networkManagerName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_manager_name: str, *, force: Optional[bool] = None, **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_managers_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_manager_name: str, *, force: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @overload + async def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.PatchObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PatchObject + :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: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.PatchObject, IO], + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Is either a + PatchObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PatchObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManager] = 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, "PatchObject") + + request = build_network_managers_patch_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.NetworkManager"]: + """List all network managers in a subscription. + + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManager or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerListResult] = 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_network_managers_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers" + } + + @distributed_trace + def list( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.NetworkManager"]: + """List network managers in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManager or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerListResult] = 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_network_managers_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers" + } + + +class NetworkManagerCommitsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_manager_commits` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _post_initial( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerCommit, IO], + **kwargs: Any + ) -> _models.NetworkManagerCommit: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerCommit] = 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, "NetworkManagerCommit") + + request = build_network_manager_commits_post_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit" + } + + @overload + async def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManagerCommit, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit + :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 NetworkManagerCommit or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. 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 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 NetworkManagerCommit or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerCommit, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. Is either a + NetworkManagerCommit type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkManagerCommit or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerCommit] = 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._post_initial( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit" + } + + +class NetworkManagerDeploymentStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_manager_deployment_status` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManagerDeploymentStatusParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerDeploymentStatusParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Is either a NetworkManagerDeploymentStatusParameter type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerDeploymentStatusListResult] = 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, "NetworkManagerDeploymentStatusParameter") + + request = build_network_manager_deployment_status_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerDeploymentStatusListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus" + } + + +class SubscriptionNetworkManagerConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`subscription_network_manager_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def create_or_update( + self, + network_manager_connection_name: str, + parameters: _models.NetworkManagerConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + network_manager_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + network_manager_connection_name: str, + parameters: Union[_models.NetworkManagerConnection, IO], + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Is either a + NetworkManagerConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerConnection] = 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, "NetworkManagerConnection") + + request = build_subscription_network_manager_connections_create_or_update_request( + network_manager_connection_name=network_manager_connection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace_async + async def get(self, network_manager_connection_name: str, **kwargs: Any) -> _models.NetworkManagerConnection: + """Get a specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) + + request = build_subscription_network_manager_connections_get_request( + network_manager_connection_name=network_manager_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, network_manager_connection_name: str, **kwargs: Any + ) -> None: + """Delete specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_subscription_network_manager_connections_delete_request( + network_manager_connection_name=network_manager_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def list( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.NetworkManagerConnection"]: + """List all network manager connections created by this subscription. + + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnectionListResult] = 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_subscription_network_manager_connections_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections"} + + +class ManagementGroupNetworkManagerConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`management_group_network_manager_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: _models.NetworkManagerConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: Union[_models.NetworkManagerConnection, IO], + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Is either a + NetworkManagerConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerConnection] = 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, "NetworkManagerConnection") + + request = build_management_group_network_manager_connections_create_or_update_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace_async + async def get( + self, management_group_id: str, network_manager_connection_name: str, **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Get a specified connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) + + request = build_management_group_network_manager_connections_get_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, management_group_id: str, network_manager_connection_name: str, **kwargs: Any + ) -> None: + """Delete specified pending connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_management_group_network_manager_connections_delete_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def list( + self, management_group_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.NetworkManagerConnection"]: + """List all network manager connections created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnectionListResult] = 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_management_group_network_manager_connections_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections" + } + + +class ConnectivityConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`connectivity_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Gets a Network Connectivity Configuration, specified by the resource group, network manager + name, and connectivity Configuration name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) + + request = build_connectivity_configurations_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: _models.ConnectivityConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Required. + :type connectivity_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :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: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Required. + :type connectivity_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: Union[_models.ConnectivityConfiguration, IO], + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Is either a ConnectivityConfiguration type or a IO type. Required. + :type connectivity_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connectivity_configuration, (IOBase, bytes)): + _content = connectivity_configuration + else: + _json = self._serialize.body(connectivity_configuration, "ConnectivityConfiguration") + + request = build_connectivity_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_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.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connectivity_configurations_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a network manager connectivity configuration, specified by the resource group, network + manager name, and connectivity configuration name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ConnectivityConfiguration"]: + """Lists all the network manager connectivity configuration in a specified network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectivityConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectivityConfigurationListResult] = 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_connectivity_configurations_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectivityConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations" + } + + +class NetworkGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_manager_name: str, network_group_name: str, **kwargs: Any + ) -> _models.NetworkGroup: + """Gets the specified network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) + + request = build_network_groups_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: _models.NetworkGroup, + *, + if_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: IO, + *, + if_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + Required. + :type parameters: IO + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: Union[_models.NetworkGroup, IO], + *, + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. Is + either a NetworkGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup or IO + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkGroup] = 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, "NetworkGroup") + + request = build_network_groups_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_groups_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkGroup"]: + """Lists the specified network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkGroupListResult] = 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_network_groups_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups" + } + + +class StaticMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`static_members` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> _models.StaticMember: + """Gets the specified static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :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._api_version or "2023-09-01")) + cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) + + request = build_static_members_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StaticMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: _models.StaticMember, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :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: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: Union[_models.StaticMember, IO], + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Is either a + StaticMember type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.StaticMember or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StaticMember] = 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, "StaticMember") + + request = build_static_members_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StaticMember", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StaticMember", pipeline_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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> None: + """Deletes a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_static_members_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.StaticMember"]: + """Lists the specified static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticMember or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.StaticMember] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.StaticMemberListResult] = 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_static_members_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StaticMemberListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers" + } + + +class ScopeConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`scope_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: _models.ScopeConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :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: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: Union[_models.ScopeConnection, IO], + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Is either a ScopeConnection type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeConnection] = 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, "ScopeConnection") + + request = build_scope_connections_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ScopeConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ScopeConnection", pipeline_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.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_manager_name: str, scope_connection_name: str, **kwargs: Any + ) -> _models.ScopeConnection: + """Get specified scope connection created by this Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) + + request = build_scope_connections_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ScopeConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_manager_name: str, scope_connection_name: str, **kwargs: Any + ) -> None: + """Delete the pending scope connection created by this network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_scope_connections_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ScopeConnection"]: + """List all scope connections created by this network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeConnection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ScopeConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ScopeConnectionListResult] = 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_scope_connections_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ScopeConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections" + } + + +class SecurityAdminConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`security_admin_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SecurityAdminConfiguration"]: + """Lists all the network manager security admin configurations in a network manager, in a + paginated format. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityAdminConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityAdminConfigurationListResult] = 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_security_admin_configurations_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityAdminConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Retrieves a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) + + request = build_security_admin_configurations_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: _models.SecurityAdminConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + Required. + :type security_admin_configuration: + ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :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: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + Required. + :type security_admin_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: Union[_models.SecurityAdminConfiguration, IO], + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. Is + either a SecurityAdminConfiguration type or a IO type. Required. + :type security_admin_configuration: + ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_admin_configuration, (IOBase, bytes)): + _content = security_admin_configuration + else: + _json = self._serialize.body(security_admin_configuration, "SecurityAdminConfiguration") + + request = build_security_admin_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_admin_configurations_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + +class AdminRuleCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`admin_rule_collections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AdminRuleCollection"]: + """Lists all the rule collections in a security admin configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AdminRuleCollection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleCollectionListResult] = 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_admin_rule_collections_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AdminRuleCollectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Gets a network manager security admin configuration rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) + + request = build_admin_rule_collections_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AdminRuleCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: _models.AdminRuleCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Required. + :type rule_collection: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :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: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Required. + :type rule_collection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: Union[_models.AdminRuleCollection, IO], + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Is either a + AdminRuleCollection type or a IO type. Required. + :type rule_collection: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule_collection, (IOBase, bytes)): + _content = rule_collection + else: + _json = self._serialize.body(rule_collection, "AdminRuleCollection") + + request = build_admin_rule_collections_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AdminRuleCollection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AdminRuleCollection", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_admin_rule_collections_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + +class AdminRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`admin_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.BaseAdminRule"]: + """List all network manager security configuration admin rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BaseAdminRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BaseAdminRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleListResult] = 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_admin_rules_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AdminRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any + ) -> _models.BaseAdminRule: + """Gets a network manager security configuration admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) + + request = build_admin_rules_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BaseAdminRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: _models.BaseAdminRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Required. + :type admin_rule: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :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: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Required. + :type admin_rule: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: Union[_models.BaseAdminRule, IO], + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Is either a BaseAdminRule type or a IO + type. Required. + :type admin_rule: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(admin_rule, (IOBase, bytes)): + _content = admin_rule + else: + _json = self._serialize.body(admin_rule, "BaseAdminRule") + + request = build_admin_rules_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BaseAdminRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BaseAdminRule", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_admin_rules_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :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._api_version or "2023-09-01")) + 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, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + +class NetworkProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_profiles` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_profile_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_profiles_delete_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_profile_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the NetworkProfile. Required. + :type network_profile_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._api_version or "2023-09-01")) + 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, + network_profile_name=network_profile_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_profile_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkProfile: + """Gets the specified network profile in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the public IP prefix. Required. + :type network_profile_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) + + request = build_network_profiles_get_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: _models.NetworkProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :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: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: Union[_models.NetworkProfile, IO], + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. Is + either a NetworkProfile type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkProfile] = 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, "NetworkProfile") + + request = build_network_profiles_create_or_update_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkProfile", pipeline_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.Network/networkProfiles/{networkProfileName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkProfile] = 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, "TagsObject") + + request = build_network_profiles_update_tags_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkProfile"]: + """Gets all the network profiles in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfileListResult] = 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_network_profiles_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkProfileListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkProfile"]: + """Gets all network profiles in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfileListResult] = 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_network_profiles_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkProfileListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles" + } + + +class NetworkSecurityGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_security_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_security_groups_delete_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_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._api_version or "2023-09-01")) + 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, + network_security_group_name=network_security_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_security_group_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Gets the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) + + request = build_network_security_groups_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.NetworkSecurityGroup, IO], + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, "NetworkSecurityGroup") + + request = build_network_security_groups_create_or_update_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + 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.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: _models.NetworkSecurityGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :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 NetworkSecurityGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. 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 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 NetworkSecurityGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.NetworkSecurityGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. Is either a NetworkSecurityGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkSecurityGroup or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, + network_security_group_name=network_security_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, "TagsObject") + + request = build_network_security_groups_update_tags_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkSecurityGroup"]: + """Gets all network security groups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroupListResult] = 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_network_security_groups_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkSecurityGroup"]: + """Gets all network security groups in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroupListResult] = 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_network_security_groups_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups" + } + + +class SecurityRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`security_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_security_group_name: str, security_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_rules_delete_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_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._api_version or "2023-09-01")) + 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, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs: Any + ) -> _models.SecurityRule: + """Get the specified network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + request = build_security_rules_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: Union[_models.SecurityRule, IO], + **kwargs: Any + ) -> _models.SecurityRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_rule_parameters, (IOBase, bytes)): + _content = security_rule_parameters + else: + _json = self._serialize.body(security_rule_parameters, "SecurityRule") + + request = build_security_rules_create_or_update_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityRule", pipeline_response) + + 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.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: _models.SecurityRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Required. + :type security_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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 SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Required. + :type security_rule_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 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 SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: Union[_models.SecurityRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Is either a SecurityRule type or a IO type. Required. + :type security_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityRule] = 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, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SecurityRule"]: + """Gets all security rules in a network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_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 SecurityRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRuleListResult] = 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_security_rules_list_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules" + } + + +class DefaultSecurityRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`default_security_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SecurityRule"]: + """Gets all default security rules in a network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_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 SecurityRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRuleListResult] = 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_default_security_rules_list_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_security_group_name: str, default_security_rule_name: str, **kwargs: Any + ) -> _models.SecurityRule: + """Get the specified default network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param default_security_rule_name: The name of the default security rule. Required. + :type default_security_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + request = build_default_security_rules_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + default_security_rule_name=default_security_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}" + } + + +class NetworkVirtualAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_virtual_appliances` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_virtual_appliances_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_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._api_version or "2023-09-01")) + 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, + network_virtual_appliance_name=network_virtual_appliance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Gets the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) + + request = build_network_virtual_appliances_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, "TagsObject") + + request = build_network_virtual_appliances_update_tags_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.NetworkVirtualAppliance, IO], + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, "NetworkVirtualAppliance") + + request = build_network_virtual_appliances_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: _models.NetworkVirtualAppliance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :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 NetworkVirtualAppliance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. + 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 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 NetworkVirtualAppliance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.NetworkVirtualAppliance, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. Is + either a NetworkVirtualAppliance type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkVirtualAppliance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, + network_virtual_appliance_name=network_virtual_appliance_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkVirtualAppliance"]: + """Lists all Network Virtual Appliances in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceListResult] = 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_network_virtual_appliances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkVirtualAppliance"]: + """Gets all Network Virtual Appliances in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceListResult] = 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_network_virtual_appliances_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances"} + + +class VirtualApplianceSitesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_appliance_sites` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_name: str, site_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_appliance_sites_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, site_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified site from a Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_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._api_version or "2023-09-01")) + 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, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_virtual_appliance_name: str, site_name: str, **kwargs: Any + ) -> _models.VirtualApplianceSite: + """Gets the specified Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualApplianceSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) + + request = build_virtual_appliance_sites_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: Union[_models.VirtualApplianceSite, IO], + **kwargs: Any + ) -> _models.VirtualApplianceSite: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualApplianceSite] = 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, "VirtualApplianceSite") + + request = build_virtual_appliance_sites_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: _models.VirtualApplianceSite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite + :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 VirtualApplianceSite or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. 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 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 VirtualApplianceSite or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: Union[_models.VirtualApplianceSite, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. Is either a VirtualApplianceSite type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualApplianceSite or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualApplianceSite] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualApplianceSite"]: + """Lists all Network Virtual Appliance Sites in a Network Virtual Appliance resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualApplianceSite or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSiteListResult] = 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_virtual_appliance_sites_list_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceSiteListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites" + } + + +class VirtualApplianceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_appliance_skus` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.NetworkVirtualApplianceSku"]: + """List all SKUs available for a virtual appliance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualApplianceSku or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSkuListResult] = 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_virtual_appliance_skus_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceSkuListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus"} + + @distributed_trace_async + async def get(self, sku_name: str, **kwargs: Any) -> _models.NetworkVirtualApplianceSku: + """Retrieves a single available sku for network virtual appliance. + + :param sku_name: Name of the Sku. Required. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualApplianceSku or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSku] = kwargs.pop("cls", None) + + request = build_virtual_appliance_skus_get_request( + sku_name=sku_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualApplianceSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}" + } + + +class InboundSecurityRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`inbound_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: Union[_models.InboundSecurityRule, IO], + **kwargs: Any + ) -> _models.InboundSecurityRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundSecurityRule] = 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, "InboundSecurityRule") + + request = build_inbound_security_rule_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + rule_collection_name=rule_collection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: _models.InboundSecurityRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule + :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 InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. 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 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 InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: Union[_models.InboundSecurityRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. Is either a InboundSecurityRule type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundSecurityRule] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + rule_collection_name=rule_collection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}" + } + + +class NetworkWatchersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_watchers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NetworkWatcher, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :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: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkWatcher, IO], + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Is either a + NetworkWatcher type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkWatcher] = 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, "NetworkWatcher") + + request = build_network_watchers_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkWatcher", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkWatcher", pipeline_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.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, network_watcher_name: str, **kwargs: Any) -> _models.NetworkWatcher: + """Gets the specified network watcher by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) + + request = build_network_watchers_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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 = 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("NetworkWatcher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_watchers_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_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._api_version or "2023-09-01")) + 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, + network_watcher_name=network_watcher_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkWatcher] = 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, "TagsObject") + + request = build_network_watchers_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("NetworkWatcher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NetworkWatcher"]: + """Gets all network watchers by resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkWatcher or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcherListResult] = 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_network_watchers_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkWatcherListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.NetworkWatcher"]: + """Gets all network watchers by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkWatcher or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcherListResult] = 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_network_watchers_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkWatcherListResult", 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) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers"} + + @overload + async def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TopologyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TopologyParameters + :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: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TopologyParameters, IO], + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Is either a + TopologyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TopologyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Topology] = 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, "TopologyParameters") + + request = build_network_watchers_get_topology_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_topology.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("Topology", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_topology.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology" + } + + async def _verify_ip_flow_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.VerificationIPFlowParameters, IO], + **kwargs: Any + ) -> _models.VerificationIPFlowResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VerificationIPFlowResult] = 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, "VerificationIPFlowParameters") + + request = build_network_watchers_verify_ip_flow_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._verify_ip_flow_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _verify_ip_flow_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify" + } + + @overload + async def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.VerificationIPFlowParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowParameters + :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 VerificationIPFlowResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. 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 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 VerificationIPFlowResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.VerificationIPFlowParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. Is either a + VerificationIPFlowParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VerificationIPFlowResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VerificationIPFlowResult] = 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._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_verify_ip_flow.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify" + } + + async def _get_next_hop_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NextHopParameters, IO], + **kwargs: Any + ) -> _models.NextHopResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NextHopResult] = 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, "NextHopParameters") + + request = build_network_watchers_get_next_hop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_next_hop_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("NextHopResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NextHopResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_next_hop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop" + } + + @overload + async def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NextHopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NextHopParameters + :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 NextHopResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. 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 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 NextHopResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NextHopParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. Is either a + NextHopParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NextHopParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NextHopResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NextHopResult] = 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._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NextHopResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_next_hop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop" + } + + async def _get_vm_security_rules_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.SecurityGroupViewParameters, IO], + **kwargs: Any + ) -> _models.SecurityGroupViewResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityGroupViewResult] = 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, "SecurityGroupViewParameters") + + request = build_network_watchers_get_vm_security_rules_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_vm_security_rules_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_vm_security_rules_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView" + } + + @overload + async def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.SecurityGroupViewParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewParameters + :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 SecurityGroupViewResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. 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 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 SecurityGroupViewResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.SecurityGroupViewParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. Is either a + SecurityGroupViewParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SecurityGroupViewResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityGroupViewResult] = 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._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vm_security_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView" + } + + async def _get_troubleshooting_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TroubleshootingParameters, IO], + **kwargs: Any + ) -> _models.TroubleshootingResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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, "TroubleshootingParameters") + + request = build_network_watchers_get_troubleshooting_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_troubleshooting_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_troubleshooting_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot" + } + + @overload + async def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TroubleshootingParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TroubleshootingParameters + :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 TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. 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 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 TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TroubleshootingParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. Is either a + TroubleshootingParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TroubleshootingParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_troubleshooting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot" + } + + async def _get_troubleshooting_result_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.QueryTroubleshootingParameters, IO], + **kwargs: Any + ) -> _models.TroubleshootingResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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, "QueryTroubleshootingParameters") + + request = build_network_watchers_get_troubleshooting_result_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_troubleshooting_result_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_troubleshooting_result_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult" + } + + @overload + async def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.QueryTroubleshootingParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryTroubleshootingParameters + :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 TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. + 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 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 TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.QueryTroubleshootingParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. Is + either a QueryTroubleshootingParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryTroubleshootingParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TroubleshootingResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_troubleshooting_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult" + } + + async def _set_flow_log_configuration_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogInformation, IO], + **kwargs: Any + ) -> _models.FlowLogInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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, "FlowLogInformation") + + request = build_network_watchers_set_flow_log_configuration_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_flow_log_configuration_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_flow_log_configuration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog" + } + + @overload + async def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.FlowLogInformation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogInformation + :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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. 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 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogInformation, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. Is either a + FlowLogInformation type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogInformation or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_flow_log_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog" + } + + async def _get_flow_log_status_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogStatusParameters, IO], + **kwargs: Any + ) -> _models.FlowLogInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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, "FlowLogStatusParameters") + + request = build_network_watchers_get_flow_log_status_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_flow_log_status_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_flow_log_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus" + } + + @overload + async def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.FlowLogStatusParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogStatusParameters + :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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. 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 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogStatusParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. Is either a FlowLogStatusParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogStatusParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_flow_log_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus" + } + + async def _check_connectivity_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.ConnectivityParameters, IO], + **kwargs: Any + ) -> _models.ConnectivityInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityInformation] = 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, "ConnectivityParameters") + + request = build_network_watchers_check_connectivity_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_connectivity_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _check_connectivity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck" + } + + @overload + async def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.ConnectivityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectivityParameters + :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 ConnectivityInformation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. + 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 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 ConnectivityInformation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.ConnectivityParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. Is + either a ConnectivityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectivityParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectivityInformation or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityInformation] = 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._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_connectivity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck" + } + + async def _get_azure_reachability_report_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AzureReachabilityReportParameters, IO], + **kwargs: Any + ) -> _models.AzureReachabilityReport: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureReachabilityReport] = 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, "AzureReachabilityReportParameters") + + request = build_network_watchers_get_azure_reachability_report_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_azure_reachability_report_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_azure_reachability_report_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport" + } + + @overload + async def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.AzureReachabilityReportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportParameters + :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 AzureReachabilityReport or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. 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 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 AzureReachabilityReport or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AzureReachabilityReportParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. Is either + a AzureReachabilityReportParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportParameters or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AzureReachabilityReport or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureReachabilityReport] = 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._get_azure_reachability_report_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_azure_reachability_report.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport" + } + + async def _list_available_providers_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AvailableProvidersListParameters, IO], + **kwargs: Any + ) -> _models.AvailableProvidersList: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableProvidersList] = 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, "AvailableProvidersListParameters") + + request = build_network_watchers_list_available_providers_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._list_available_providers_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _list_available_providers_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList" + } + + @overload + async def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.AvailableProvidersListParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListParameters + :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 AvailableProvidersList or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. 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 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 AvailableProvidersList or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AvailableProvidersListParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. Is either a + AvailableProvidersListParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AvailableProvidersList or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableProvidersList] = 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._list_available_providers_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_available_providers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList" + } + + async def _get_network_configuration_diagnostic_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkConfigurationDiagnosticParameters, IO], + **kwargs: Any + ) -> _models.NetworkConfigurationDiagnosticResponse: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = 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, "NetworkConfigurationDiagnosticParameters") + + request = build_network_watchers_get_network_configuration_diagnostic_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_network_configuration_diagnostic_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_network_configuration_diagnostic_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic" + } + + @overload + async def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NetworkConfigurationDiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticParameters + :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 + NetworkConfigurationDiagnosticResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. 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 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 + NetworkConfigurationDiagnosticResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkConfigurationDiagnosticParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. Is either a + NetworkConfigurationDiagnosticParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + NetworkConfigurationDiagnosticResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = 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._get_network_configuration_diagnostic_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_network_configuration_diagnostic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic" + } + + +class PacketCapturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`packet_captures` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_initial( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> _models.PacketCaptureResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCaptureResult] = 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, "PacketCapture") + + request = build_packet_captures_create_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PacketCaptureResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: _models.PacketCapture, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PacketCapture + :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 PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. 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 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 PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. Is either a + PacketCapture type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PacketCapture or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCaptureResult] = 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, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PacketCaptureResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCaptureResult: + """Gets a packet capture session by name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PacketCaptureResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) + + request = build_packet_captures_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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 = 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("PacketCaptureResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, packet_capture_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_packet_captures_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_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._api_version or "2023-09-01")) + 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, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, packet_capture_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_packet_captures_stop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + _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]: + map_error(status_code=response.status_code, 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, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_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._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop" + } + + async def _get_status_initial( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCaptureQueryStatusResult: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) + + request = build_packet_captures_get_status_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus" + } + + @distributed_trace_async + async def begin_get_status( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCaptureQueryStatusResult]: + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture session. Required. + :type packet_capture_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 PacketCaptureQueryStatusResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureQueryStatusResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureQueryStatusResult] = 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._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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): + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PacketCaptureResult"]: + """Lists all packet capture sessions within the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PacketCaptureResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureListResult] = 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_packet_captures_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PacketCaptureListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures" + } + + +class ConnectionMonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`connection_monitors` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.ConnectionMonitor, IO], + *, + migrate: Optional[str] = None, + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, "ConnectionMonitor") + + request = build_connection_monitors_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + migrate=migrate, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + + 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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: _models.ConnectionMonitor, + *, + migrate: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitor + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :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 ConnectionMonitorResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: IO, + *, + migrate: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. + Required. + :type parameters: IO + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :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 ConnectionMonitorResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.ConnectionMonitor, IO], + *, + migrate: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. Is + either a ConnectionMonitor type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitor or IO + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectionMonitorResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + parameters=parameters, + migrate=migrate, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Gets a connection monitor by name. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) + + request = build_connection_monitors_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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 = 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("ConnectionMonitorResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_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._api_version or "2023-09-01")) + 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, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, "TagsObject") + + request = build_connection_monitors_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("ConnectionMonitorResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_stop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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) + + _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]: + map_error(status_code=response.status_code, 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, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_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._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop" + } + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_start_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 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, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start" + } + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_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._api_version or "2023-09-01")) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start" + } + + async def _query_initial( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> _models.ConnectionMonitorQueryResult: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) + + request = build_connection_monitors_query_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._query_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _query_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query" + } + + @distributed_trace_async + async def begin_query( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionMonitorQueryResult]: + """Query a snapshot of the most recent connection states. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name given to the connection monitor. Required. + :type connection_monitor_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 ConnectionMonitorQueryResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorQueryResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorQueryResult] = 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._query_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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): + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_query.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConnectionMonitorResult"]: + """Lists all connection monitors for the specified Network Watcher. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectionMonitorResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorListResult] = 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_connection_monitors_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionMonitorListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors" + } + + +class FlowLogsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`flow_logs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.FlowLog, IO], + **kwargs: Any + ) -> _models.FlowLog: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, "FlowLog") + + request = build_flow_logs_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FlowLog", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FlowLog", pipeline_response) + + 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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: _models.FlowLog, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :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 FlowLog or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. 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 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 FlowLog or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.FlowLog, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. Is either a + FlowLog type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLog or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FlowLog or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLog", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Is either a TagsObject type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, "TagsObject") + + request = build_flow_logs_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("FlowLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_watcher_name: str, flow_log_name: str, **kwargs: Any + ) -> _models.FlowLog: + """Gets a flow log resource by name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log resource. Required. + :type flow_log_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) + + request = build_flow_logs_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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 = 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("FlowLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, flow_log_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_flow_logs_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_watcher_name: str, flow_log_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified flow log resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log resource. Required. + :type flow_log_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._api_version or "2023-09-01")) + 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, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FlowLog"]: + """Lists all flow log resources for the specified Network Watcher. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FlowLog or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FlowLogListResult] = 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_flow_logs_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FlowLogListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs" + } + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all of the available Network 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 Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.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._api_version or "2023-09-01")) + cls: ClsType[_models.OperationListResult] = 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_operations_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.Network/operations"} + + +class PrivateEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`private_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_endpoint_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_endpoints_delete_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_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) + + _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.Error, 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.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, private_endpoint_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_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: + """ + _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._api_version or "2023-09-01")) + 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, + private_endpoint_name=private_endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, private_endpoint_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PrivateEndpoint: + """Gets the specified private endpoint by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) + + request = build_private_endpoints_get_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: Union[_models.PrivateEndpoint, IO], + **kwargs: Any + ) -> _models.PrivateEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpoint] = 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, "PrivateEndpoint") + + request = build_private_endpoints_create_or_update_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + 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.Network/privateEndpoints/{privateEndpointName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: _models.PrivateEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint + :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 PrivateEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. + 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 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 PrivateEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: Union[_models.PrivateEndpoint, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. Is + either a PrivateEndpoint type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpoint] = 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, + private_endpoint_name=private_endpoint_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateEndpoint"]: + """Gets all private endpoints in a resource group. + + :param resource_group_name: The name of the resource group. 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 PrivateEndpoint or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointListResult] = 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_private_endpoints_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateEndpoint"]: + """Gets all private endpoints in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpoint or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointListResult] = 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_private_endpoints_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints" + } + + +class AvailablePrivateEndpointTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`available_private_endpoint_types` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailablePrivateEndpointType"]: + """Returns all of the resource types that can be linked to a Private Endpoint in this subscription + in this region. + + :param location: The location of the domain name. 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 AvailablePrivateEndpointType or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = 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_available_private_endpoint_types_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailablePrivateEndpointTypesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + } + + @distributed_trace + def list_by_resource_group( + self, location: str, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AvailablePrivateEndpointType"]: + """Returns all of the resource types that can be linked to a Private Endpoint in this subscription + in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AvailablePrivateEndpointType or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = 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_available_private_endpoint_types_list_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailablePrivateEndpointTypesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + } + + +class PrivateDnsZoneGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`private_dns_zone_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_dns_zone_groups_delete_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private dns zone group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_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._api_version or "2023-09-01")) + 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, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_name: str, **kwargs: Any + ) -> _models.PrivateDnsZoneGroup: + """Gets the private dns zone group resource by specified private dns zone group name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateDnsZoneGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) + + request = build_private_dns_zone_groups_get_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: Union[_models.PrivateDnsZoneGroup, IO], + **kwargs: Any + ) -> _models.PrivateDnsZoneGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateDnsZoneGroup] = 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, "PrivateDnsZoneGroup") + + request = build_private_dns_zone_groups_create_or_update_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + 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.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: _models.PrivateDnsZoneGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup + :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 PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. 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 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 PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: Union[_models.PrivateDnsZoneGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. Is either a PrivateDnsZoneGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateDnsZoneGroup] = 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, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace + def list( + self, private_endpoint_name: str, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateDnsZoneGroup"]: + """Gets all private dns zone groups in a private endpoint. + + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param resource_group_name: The name of the resource group. 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 PrivateDnsZoneGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateDnsZoneGroupListResult] = 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_private_dns_zone_groups_list_request( + private_endpoint_name=private_endpoint_name, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateDnsZoneGroupListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups" + } + + +class PrivateLinkServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`private_link_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_link_services_delete_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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.Error, 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.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified private link service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_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._api_version or "2023-09-01")) + 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, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, service_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PrivateLinkService: + """Gets the specified private link service by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkService or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) + + request = build_private_link_services_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + parameters: Union[_models.PrivateLinkService, IO], + **kwargs: Any + ) -> _models.PrivateLinkService: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkService] = 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, "PrivateLinkService") + + request = build_private_link_services_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + 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.Network/privateLinkServices/{serviceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: _models.PrivateLinkService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :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 PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + 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 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 PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: Union[_models.PrivateLinkService, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + Is either a PrivateLinkService type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkService] = 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, + service_name=service_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateLinkService"]: + """Gets all private link services in a resource group. + + :param resource_group_name: The name of the resource group. 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 PrivateLinkService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkServiceListResult] = 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_private_link_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateLinkService"]: + """Gets all private link service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkService or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkServiceListResult] = 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_private_link_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices" + } + + @distributed_trace_async + async def get_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get the specific private end point connection by specific private link service in the resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: 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.network.v2023_09_01.models.PrivateEndpointConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_private_link_services_get_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_private_endpoint_connection.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.Error, 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 + + get_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @overload + async def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.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.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.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 + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") + + request = build_private_link_services_update_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_private_endpoint_connection.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.Error, 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 + + update_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + async def _delete_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, pe_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_link_services_delete_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_private_endpoint_connection_initial.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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_private_endpoint_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @distributed_trace_async + async def begin_delete_private_endpoint_connection( + self, resource_group_name: str, service_name: str, pe_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_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._api_version or "2023-09-01")) + 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_private_endpoint_connection_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @distributed_trace + def list_private_endpoint_connections( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """Gets all private end point connections for a specific private link service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_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: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = 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_private_link_services_list_private_endpoint_connections_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_private_endpoint_connections.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_private_endpoint_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections" + } + + async def _check_private_link_service_visibility_initial( + self, location: str, parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], **kwargs: Any + ) -> Optional[_models.PrivateLinkServiceVisibility]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = 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, "CheckPrivateLinkServiceVisibilityRequest") + + request = build_private_link_services_check_private_link_service_visibility_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_private_link_service_visibility_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _check_private_link_service_visibility_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @overload + async def begin_check_private_link_service_visibility( + self, + location: str, + parameters: _models.CheckPrivateLinkServiceVisibilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest + :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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_check_private_link_service_visibility( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. 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 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_check_private_link_service_visibility( + self, location: str, parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. Is either a + CheckPrivateLinkServiceVisibilityRequest type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkServiceVisibility] = 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._check_private_link_service_visibility_initial( + location=location, + 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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_private_link_service_visibility.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + async def _check_private_link_service_visibility_by_resource_group_initial( + self, + location: str, + resource_group_name: str, + parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], + **kwargs: Any + ) -> Optional[_models.PrivateLinkServiceVisibility]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = 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, "CheckPrivateLinkServiceVisibilityRequest") + + request = build_private_link_services_check_private_link_service_visibility_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_private_link_service_visibility_by_resource_group_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _check_private_link_service_visibility_by_resource_group_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @overload + async def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: _models.CheckPrivateLinkServiceVisibilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest + :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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. 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 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. Is either a + CheckPrivateLinkServiceVisibilityRequest type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkServiceVisibility] = 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._check_private_link_service_visibility_by_resource_group_initial( + location=location, + resource_group_name=resource_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_private_link_service_visibility_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @distributed_trace + def list_auto_approved_private_link_services( + self, location: str, **kwargs: Any + ) -> AsyncIterable["_models.AutoApprovedPrivateLinkService"]: + """Returns all of the private link service ids that can be linked to a Private Endpoint with auto + approved in this subscription in this region. + + :param location: The location of the domain name. 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 AutoApprovedPrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = 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_private_link_services_list_auto_approved_private_link_services_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auto_approved_private_link_services.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutoApprovedPrivateLinkServicesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_auto_approved_private_link_services.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + } + + @distributed_trace + def list_auto_approved_private_link_services_by_resource_group( + self, location: str, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AutoApprovedPrivateLinkService"]: + """Returns all of the private link service ids that can be linked to a Private Endpoint with auto + approved in this subscription in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AutoApprovedPrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = 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_private_link_services_list_auto_approved_private_link_services_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auto_approved_private_link_services_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutoApprovedPrivateLinkServicesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_auto_approved_private_link_services_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + } + + +class PublicIPPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`public_ip_prefixes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_prefix_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_public_ip_prefixes_delete_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, public_ip_prefix_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the PublicIpPrefix. Required. + :type public_ip_prefix_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._api_version or "2023-09-01")) + 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, + public_ip_prefix_name=public_ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, public_ip_prefix_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PublicIPPrefix: + """Gets the specified public IP prefix in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) + + request = build_public_ip_prefixes_get_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.PublicIPPrefix, IO], + **kwargs: Any + ) -> _models.PublicIPPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, "PublicIPPrefix") + + request = build_public_ip_prefixes_create_or_update_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + 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.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: _models.PublicIPPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :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 PublicIPPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. + 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 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 PublicIPPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.PublicIPPrefix, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. Is + either a PublicIPPrefix type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PublicIPPrefix or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, + public_ip_prefix_name=public_ip_prefix_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, "TagsObject") + + request = build_public_ip_prefixes_update_tags_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.PublicIPPrefix"]: + """Gets all the public IP prefixes in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefixListResult] = 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_public_ip_prefixes_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PublicIPPrefix"]: + """Gets all public IP prefixes in a resource group. + + :param resource_group_name: The name of the resource group. 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 PublicIPPrefix or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefixListResult] = 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_public_ip_prefixes_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes" + } + + +class RouteFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`route_filters` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_filter_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_filters_delete_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, route_filter_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_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._api_version or "2023-09-01")) + 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, + route_filter_name=route_filter_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, route_filter_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.RouteFilter: + """Gets the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :keyword expand: Expands referenced express route bgp peering resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) + + request = build_route_filters_get_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: Union[_models.RouteFilter, IO], + **kwargs: Any + ) -> _models.RouteFilter: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_filter_parameters, (IOBase, bytes)): + _content = route_filter_parameters + else: + _json = self._serialize.body(route_filter_parameters, "RouteFilter") + + request = build_route_filters_create_or_update_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteFilter", pipeline_response) + + 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.Network/routeFilters/{routeFilterName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: _models.RouteFilter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Required. + :type route_filter_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :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 RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Required. + :type route_filter_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 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 RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: Union[_models.RouteFilter, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Is either a RouteFilter type or a IO type. Required. + :type route_filter_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = 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, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteFilter", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + route_filter_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + route_filter_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, route_filter_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = 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, "TagsObject") + + request = build_route_filters_update_tags_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RouteFilter"]: + """Gets all route filters in a resource group. + + :param resource_group_name: The name of the resource group. 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 RouteFilter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterListResult] = 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_route_filters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.RouteFilter"]: + """Gets all route filters in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteFilter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterListResult] = 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_route_filters_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters"} + + +class RouteFilterRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`route_filter_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_filter_name: str, rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_filter_rules_delete_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, route_filter_name: str, rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the rule. Required. + :type rule_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._api_version or "2023-09-01")) + 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, + route_filter_name=route_filter_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, route_filter_name: str, rule_name: str, **kwargs: Any + ) -> _models.RouteFilterRule: + """Gets the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) + + request = build_route_filter_rules_get_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: Union[_models.RouteFilterRule, IO], + **kwargs: Any + ) -> _models.RouteFilterRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_filter_rule_parameters, (IOBase, bytes)): + _content = route_filter_rule_parameters + else: + _json = self._serialize.body(route_filter_rule_parameters, "RouteFilterRule") + + request = build_route_filter_rules_create_or_update_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + 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.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: _models.RouteFilterRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Required. + :type route_filter_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule + :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 RouteFilterRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Required. + :type route_filter_rule_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 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 RouteFilterRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: Union[_models.RouteFilterRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Is either a RouteFilterRule type or a IO type. Required. + :type route_filter_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RouteFilterRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilterRule] = 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, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace + def list_by_route_filter( + self, resource_group_name: str, route_filter_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RouteFilterRule"]: + """Gets all RouteFilterRules in a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteFilterRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterRuleListResult] = 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_route_filter_rules_list_by_route_filter_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_route_filter.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_route_filter.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules" + } + + +class RouteTablesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`route_tables` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_tables_delete_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, route_table_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_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._api_version or "2023-09-01")) + 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, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, route_table_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.RouteTable: + """Gets the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) + + request = build_route_tables_get_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.RouteTable, IO], **kwargs: Any + ) -> _models.RouteTable: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, "RouteTable") + + request = build_route_tables_create_or_update_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteTable", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteTable", pipeline_response) + + 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.Network/routeTables/{routeTableName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + parameters: _models.RouteTable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :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 RouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. 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 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 RouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.RouteTable, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. Is either + a RouteTable type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.RouteTable or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, + route_table_name=route_table_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteTable", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + route_table_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + route_table_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, "TagsObject") + + request = build_route_tables_update_tags_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RouteTable"]: + """Gets all route tables in a resource group. + + :param resource_group_name: The name of the resource group. 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 RouteTable or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTableListResult] = 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_route_tables_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteTableListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.RouteTable"]: + """Gets all route tables in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteTable or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTableListResult] = 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_route_tables_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteTableListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables"} + + +class RoutesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`routes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_table_name: str, route_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_routes_delete_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_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._api_version or "2023-09-01")) + 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, + route_table_name=route_table_name, + route_name=route_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs: Any + ) -> _models.Route: + """Gets the specified route from a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Route or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Route + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + + request = build_routes_get_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Route", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: Union[_models.Route, IO], + **kwargs: Any + ) -> _models.Route: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_parameters, (IOBase, bytes)): + _content = route_parameters + else: + _json = self._serialize.body(route_parameters, "Route") + + request = build_routes_create_or_update_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Route", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Route", pipeline_response) + + 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.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: _models.Route, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Required. + :type route_parameters: ~azure.mgmt.network.v2023_09_01.models.Route + :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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Required. + :type route_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 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: Union[_models.Route, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Is either + a Route type or a IO type. Required. + :type route_parameters: ~azure.mgmt.network.v2023_09_01.models.Route or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = 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, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Route", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace + def list(self, resource_group_name: str, route_table_name: str, **kwargs: Any) -> AsyncIterable["_models.Route"]: + """Gets all routes in a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Route or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.Route] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteListResult] = 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_routes_list_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RouteListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes" + } + + +class SecurityPartnerProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`security_partner_providers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, security_partner_provider_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_partner_providers_delete_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, security_partner_provider_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_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._api_version or "2023-09-01")) + 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, + security_partner_provider_name=security_partner_provider_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, security_partner_provider_name: str, **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Gets the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) + + request = build_security_partner_providers_get_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.SecurityPartnerProvider, IO], + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, "SecurityPartnerProvider") + + request = build_security_partner_providers_create_or_update_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + 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.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: _models.SecurityPartnerProvider, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :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 SecurityPartnerProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. 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 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 SecurityPartnerProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.SecurityPartnerProvider, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. Is either a SecurityPartnerProvider type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SecurityPartnerProvider or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, + security_partner_provider_name=security_partner_provider_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, "TagsObject") + + request = build_security_partner_providers_update_tags_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SecurityPartnerProvider"]: + """Lists all Security Partner Providers in a resource group. + + :param resource_group_name: The name of the resource group. 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 SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProviderListResult] = 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_security_partner_providers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityPartnerProvider"]: + """Gets all the Security Partner Providers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProviderListResult] = 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_security_partner_providers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders"} + + +class BgpServiceCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`bgp_service_communities` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.BgpServiceCommunity"]: + """Gets all the available bgp service communities. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BgpServiceCommunity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BgpServiceCommunity] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpServiceCommunityListResult] = 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_bgp_service_communities_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BgpServiceCommunityListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities"} + + +class ServiceEndpointPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`service_endpoint_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_endpoint_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_service_endpoint_policies_delete_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, service_endpoint_policy_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_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._api_version or "2023-09-01")) + 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, + service_endpoint_policy_name=service_endpoint_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Gets the specified service Endpoint Policies in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) + + request = build_service_endpoint_policies_get_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.ServiceEndpointPolicy, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, "ServiceEndpointPolicy") + + request = build_service_endpoint_policies_create_or_update_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: _models.ServiceEndpointPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :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 ServiceEndpointPolicy or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. 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 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 ServiceEndpointPolicy or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.ServiceEndpointPolicy, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. Is either a ServiceEndpointPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceEndpointPolicy or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, + service_endpoint_policy_name=service_endpoint_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, "TagsObject") + + request = build_service_endpoint_policies_update_tags_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ServiceEndpointPolicy"]: + """Gets all the service endpoint policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyListResult] = 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_service_endpoint_policies_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServiceEndpointPolicy"]: + """Gets all service endpoint Policies in a resource group. + + :param resource_group_name: The name of the resource group. 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 ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyListResult] = 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_service_endpoint_policies_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies" + } + + +class ServiceEndpointPolicyDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`service_endpoint_policy_definitions` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_service_endpoint_policy_definitions_delete_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified ServiceEndpoint policy definitions. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the Service Endpoint Policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition. Required. + :type service_endpoint_policy_definition_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._api_version or "2023-09-01")) + 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, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + **kwargs: Any + ) -> _models.ServiceEndpointPolicyDefinition: + """Get the specified service endpoint policy definitions from service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy name. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicyDefinition or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) + + request = build_service_endpoint_policy_definitions_get_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: Union[_models.ServiceEndpointPolicyDefinition, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicyDefinition: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_endpoint_policy_definitions, (IOBase, bytes)): + _content = service_endpoint_policy_definitions + else: + _json = self._serialize.body(service_endpoint_policy_definitions, "ServiceEndpointPolicyDefinition") + + request = build_service_endpoint_policy_definitions_create_or_update_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: _models.ServiceEndpointPolicyDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Required. + :type service_endpoint_policy_definitions: + ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition + :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 ServiceEndpointPolicyDefinition or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Required. + :type service_endpoint_policy_definitions: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceEndpointPolicyDefinition or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: Union[_models.ServiceEndpointPolicyDefinition, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Is either a ServiceEndpointPolicyDefinition type or a IO type. + Required. + :type service_endpoint_policy_definitions: + ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceEndpointPolicyDefinition or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = 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, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_name, + service_endpoint_policy_definitions=service_endpoint_policy_definitions, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, service_endpoint_policy_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServiceEndpointPolicyDefinition"]: + """Gets all service endpoint policy definitions in a service end point policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy name. Required. + :type service_endpoint_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceEndpointPolicyDefinition or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyDefinitionListResult] = 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_service_endpoint_policy_definitions_list_by_resource_group_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyDefinitionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions" + } + + +class ServiceTagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`service_tags` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list(self, location: str, **kwargs: Any) -> _models.ServiceTagsListResult: + """Gets a list of service tag information resources. + + :param location: The location that will be used as a reference for version (not as a filter + based on location, you will get the list of service tags with prefix details across all regions + but limited to the cloud that your subscription belongs to). Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceTagsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceTagsListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceTagsListResult] = kwargs.pop("cls", None) + + request = build_service_tags_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceTagsListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags" + } + + +class ServiceTagInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`service_tag_information` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + location: str, + *, + no_address_prefixes: Optional[bool] = None, + tag_name: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceTagInformation"]: + """Gets a list of service tag information resources with pagination. + + :param location: The location that will be used as a reference for cloud (not as a filter based + on location, you will get the list of service tags with prefix details across all regions but + limited to the cloud that your subscription belongs to). Required. + :type location: str + :keyword no_address_prefixes: Do not return address prefixes for the tag(s). Default value is + None. + :paramtype no_address_prefixes: bool + :keyword tag_name: Return tag information for a particular tag. Default value is None. + :paramtype tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceTagInformation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceTagInformation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceTagInformationListResult] = 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_service_tag_information_list_request( + location=location, + subscription_id=self._config.subscription_id, + no_address_prefixes=no_address_prefixes, + tag_name=tag_name, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceTagInformationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails" + } + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`usages` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: + """List network usages for a subscription. + + :param location: The location where 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.network.v2023_09_01.models.Usage] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.UsagesListResult] = 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_usages_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UsagesListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages"} + + +class VirtualNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_networks` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_networks_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_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._api_version or "2023-09-01")) + 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, + virtual_network_name=virtual_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_network_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualNetwork: + """Gets the specified virtual network by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) + + request = build_virtual_networks_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.VirtualNetwork, IO], + **kwargs: Any + ) -> _models.VirtualNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, "VirtualNetwork") + + request = build_virtual_networks_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.VirtualNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :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 VirtualNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + 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 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 VirtualNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.VirtualNetwork, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. Is + either a VirtualNetwork type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, + virtual_network_name=virtual_network_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, "TagsObject") + + request = build_virtual_networks_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: + """Gets all virtual networks in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListResult] = 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_virtual_networks_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: + """Gets all virtual networks in a resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualNetwork or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListResult] = 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_virtual_networks_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks" + } + + @distributed_trace_async + async def check_ip_address_availability( + self, resource_group_name: str, virtual_network_name: str, *, ip_address: str, **kwargs: Any + ) -> _models.IPAddressAvailabilityResult: + """Checks whether a private IP address is available for use. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword ip_address: The private IP address to be verified. Required. + :paramtype ip_address: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IPAddressAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IPAddressAvailabilityResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IPAddressAvailabilityResult] = kwargs.pop("cls", None) + + request = build_virtual_networks_check_ip_address_availability_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + ip_address=ip_address, + api_version=api_version, + template_url=self.check_ip_address_availability.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IPAddressAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_ip_address_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability" + } + + @distributed_trace + def list_usage( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkUsage"]: + """Lists usage stats. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkUsage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkUsage] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListUsageResult] = 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_virtual_networks_list_usage_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_usage.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListUsageResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages" + } + + async def _list_ddos_protection_status_initial( + self, + resource_group_name: str, + virtual_network_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.VirtualNetworkDdosProtectionStatusResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VirtualNetworkDdosProtectionStatusResult]] = kwargs.pop("cls", None) + + request = build_virtual_networks_list_ddos_protection_status_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self._list_ddos_protection_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkDdosProtectionStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_ddos_protection_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus" + } + + @distributed_trace_async + async def begin_list_ddos_protection_status( + self, + resource_group_name: str, + virtual_network_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[AsyncIterable["_models.PublicIpDdosProtectionStatusResult"]]: + """Gets the Ddos Protection Status of all IP Addresses under the Virtual Network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword top: The max number of ip addresses to return. Default value is None. + :paramtype top: int + :keyword skip_token: The skipToken that is given with nextLink. Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 LROPoller that returns an iterator like instance of either + VirtualNetworkDdosProtectionStatusResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult]] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkDdosProtectionStatusResult] = 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_virtual_networks_list_ddos_protection_status_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.begin_list_ddos_protection_status.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkDdosProtectionStatusResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._list_ddos_protection_status_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + top=top, + skip_token=skip_token, + 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): + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return await get_next(next_link) + + return AsyncItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_ddos_protection_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus" + } + + +class SubnetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`subnets` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, subnet_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_subnets_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_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._api_version or "2023-09-01")) + 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, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Subnet: + """Gets the specified subnet by virtual network and resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Subnet or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Subnet + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) + + request = build_subnets_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Subnet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: Union[_models.Subnet, IO], + **kwargs: Any + ) -> _models.Subnet: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(subnet_parameters, (IOBase, bytes)): + _content = subnet_parameters + else: + _json = self._serialize.body(subnet_parameters, "Subnet") + + request = build_subnets_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Subnet", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Subnet", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: _models.Subnet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. + Required. + :type subnet_parameters: ~azure.mgmt.network.v2023_09_01.models.Subnet + :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 Subnet or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. + Required. + :type subnet_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 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 Subnet or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: Union[_models.Subnet, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. Is + either a Subnet type or a IO type. Required. + :type subnet_parameters: ~azure.mgmt.network.v2023_09_01.models.Subnet or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Subnet or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Subnet] = 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, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Subnet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + async def _prepare_network_policies_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: Union[_models.PrepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(prepare_network_policies_request_parameters, (IOBase, bytes)): + _content = prepare_network_policies_request_parameters + else: + _json = self._serialize.body(prepare_network_policies_request_parameters, "PrepareNetworkPoliciesRequest") + + request = build_subnets_prepare_network_policies_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._prepare_network_policies_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _prepare_network_policies_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies" + } + + @overload + async def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: _models.PrepareNetworkPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Required. + :type prepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.PrepareNetworkPoliciesRequest + :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: + """ + + @overload + async def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Required. + :type prepare_network_policies_request_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 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: + """ + + @distributed_trace_async + async def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: Union[_models.PrepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Is either a PrepareNetworkPoliciesRequest type or a IO type. + Required. + :type prepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.PrepareNetworkPoliciesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._prepare_network_policies_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + prepare_network_policies_request_parameters=prepare_network_policies_request_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_prepare_network_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies" + } + + async def _unprepare_network_policies_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: Union[_models.UnprepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(unprepare_network_policies_request_parameters, (IOBase, bytes)): + _content = unprepare_network_policies_request_parameters + else: + _json = self._serialize.body( + unprepare_network_policies_request_parameters, "UnprepareNetworkPoliciesRequest" + ) + + request = build_subnets_unprepare_network_policies_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unprepare_network_policies_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _unprepare_network_policies_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies" + } + + @overload + async def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: _models.UnprepareNetworkPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Required. + :type unprepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.UnprepareNetworkPoliciesRequest + :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: + """ + + @overload + async def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Required. + :type unprepare_network_policies_request_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 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: + """ + + @distributed_trace_async + async def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: Union[_models.UnprepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Is either a UnprepareNetworkPoliciesRequest type or a IO + type. Required. + :type unprepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.UnprepareNetworkPoliciesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._unprepare_network_policies_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + unprepare_network_policies_request_parameters=unprepare_network_policies_request_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_unprepare_network_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Subnet"]: + """Gets all subnets in a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Subnet or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.Subnet] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SubnetListResult] = 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_subnets_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SubnetListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets" + } + + +class ResourceNavigationLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`resource_navigation_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> _models.ResourceNavigationLinksListResult: + """Gets a list of resource navigation links for a subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNavigationLinksListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ResourceNavigationLinksListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ResourceNavigationLinksListResult] = kwargs.pop("cls", None) + + request = build_resource_navigation_links_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceNavigationLinksListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks" + } + + +class ServiceAssociationLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`service_association_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> _models.ServiceAssociationLinksListResult: + """Gets a list of service association links for a subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceAssociationLinksListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceAssociationLinksListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceAssociationLinksListResult] = kwargs.pop("cls", None) + + request = build_service_association_links_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceAssociationLinksListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks" + } + + +class VirtualNetworkPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_network_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_peerings_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network peering. Required. + :type virtual_network_peering_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._api_version or "2023-09-01")) + 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, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_name: str, **kwargs: Any + ) -> _models.VirtualNetworkPeering: + """Gets the specified virtual network peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network peering. Required. + :type virtual_network_peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) + + request = build_virtual_network_peerings_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: Union[_models.VirtualNetworkPeering, IO], + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + **kwargs: Any + ) -> _models.VirtualNetworkPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_network_peering_parameters, (IOBase, bytes)): + _content = virtual_network_peering_parameters + else: + _json = self._serialize.body(virtual_network_peering_parameters, "VirtualNetworkPeering") + + request = build_virtual_network_peerings_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + subscription_id=self._config.subscription_id, + sync_remote_address_space=sync_remote_address_space, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: _models.VirtualNetworkPeering, + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Required. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :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 VirtualNetworkPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: IO, + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Required. + :type virtual_network_peering_parameters: IO + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :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 VirtualNetworkPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: Union[_models.VirtualNetworkPeering, IO], + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Is either a VirtualNetworkPeering type or a IO type. Required. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering or IO + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkPeering] = 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, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + sync_remote_address_space=sync_remote_address_space, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkPeering"]: + """Gets all virtual network peerings in a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkPeeringListResult] = 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_virtual_network_peerings_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkPeeringListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings" + } + + +class VirtualNetworkGatewaysOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_network_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VirtualNetworkGateway, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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, "VirtualNetworkGateway") + + request = build_virtual_network_gateways_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VirtualNetworkGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :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 VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + 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 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 VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VirtualNetworkGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + Is either a VirtualNetworkGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGateway: + """Gets the specified virtual network gateway by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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._api_version or "2023-09-01")) + 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, + virtual_network_gateway_name=virtual_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkGateway]] = 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, "TagsObject") + + request = build_virtual_network_gateways_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. 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 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 VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualNetworkGateway"]: + """Gets all virtual network gateways by resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayListResult] = 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_virtual_network_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways" + } + + @distributed_trace + def list_connections( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkGatewayConnectionListEntity"]: + """Gets all the connections in a virtual network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkGatewayConnectionListEntity or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionListEntity] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayListConnectionsResult] = 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_virtual_network_gateways_list_connections_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_connections.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayListConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections" + } + + async def _reset_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + *, + gateway_vip: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_reset_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + gateway_vip=gateway_vip, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" + } + + @distributed_trace_async + async def begin_reset( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + *, + gateway_vip: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGateway]: + """Resets the primary of the virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword gateway_vip: Virtual network gateway vip address supplied to the begin reset of the + active-active feature enabled gateway. Default value is None. + :paramtype gateway_vip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 VirtualNetworkGateway or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + 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): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" + } + + async def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_reset_vpn_client_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_vpn_client_shared_key_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_vpn_client_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" + } + + @distributed_trace_async + async def begin_reset_vpn_client_shared_key( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resets the VPN client shared key of the virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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._api_version or "2023-09-01")) + 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._reset_vpn_client_shared_key_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_vpn_client_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" + } + + async def _generatevpnclientpackage_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnClientParameters") + + request = build_virtual_network_gateways_generatevpnclientpackage_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generatevpnclientpackage_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generatevpnclientpackage_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" + } + + @overload + async def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnClientParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. 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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Is either a VpnClientParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generatevpnclientpackage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" + } + + async def _generate_vpn_profile_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnClientParameters") + + request = build_virtual_network_gateways_generate_vpn_profile_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_vpn_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generate_vpn_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" + } + + @overload + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnClientParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. 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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Is either a VpnClientParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_vpn_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" + } + + async def _get_vpn_profile_package_url_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpn_profile_package_url_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpn_profile_package_url_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpn_profile_package_url_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" + } + + @distributed_trace_async + async def begin_get_vpn_profile_package_url( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[str]: + """Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified + resource group. The profile needs to be generated first using generateVpnProfile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_vpn_profile_package_url_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpn_profile_package_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" + } + + async def _get_bgp_peer_status_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.BgpPeerStatusListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.BgpPeerStatusListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_bgp_peer_status_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + peer=peer, + api_version=api_version, + template_url=self._get_bgp_peer_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BgpPeerStatusListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_bgp_peer_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" + } + + @distributed_trace_async + async def begin_get_bgp_peer_status( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.BgpPeerStatusListResult]: + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword peer: The IP address of the peer to retrieve the status of. Default value is None. + :paramtype peer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BgpPeerStatusListResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BgpPeerStatusListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpPeerStatusListResult] = 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._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + 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): + deserialized = self._deserialize("BgpPeerStatusListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_bgp_peer_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" + } + + @distributed_trace_async + async def supported_vpn_devices( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> str: + """Gets a xml format representation for supported vpn devices. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :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._api_version or "2023-09-01")) + cls: ClsType[str] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_supported_vpn_devices_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.supported_vpn_devices.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + supported_vpn_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices" + } + + async def _get_learned_routes_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[_models.GatewayRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_learned_routes_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_learned_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_learned_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" + } + + @distributed_trace_async + async def begin_get_learned_routes( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayRouteListResult]: + """This operation retrieves a list of routes the virtual network gateway has learned, including + routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 GatewayRouteListResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.GatewayRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.GatewayRouteListResult] = 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._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_learned_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" + } + + async def _get_advertised_routes_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: str, **kwargs: Any + ) -> Optional[_models.GatewayRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_advertised_routes_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + peer=peer, + api_version=api_version, + template_url=self._get_advertised_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_advertised_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" + } + + @distributed_trace_async + async def begin_get_advertised_routes( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: str, **kwargs: Any + ) -> AsyncLROPoller[_models.GatewayRouteListResult]: + """This operation retrieves a list of routes the virtual network gateway is advertising to the + specified peer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword peer: The IP address of the peer. Required. + :paramtype peer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayRouteListResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.GatewayRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.GatewayRouteListResult] = 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._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + 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): + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_advertised_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" + } + + async def _set_vpnclient_ipsec_parameters_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: Union[_models.VpnClientIPsecParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnClientIPsecParameters]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnClientIPsecParameters]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpnclient_ipsec_params, (IOBase, bytes)): + _content = vpnclient_ipsec_params + else: + _json = self._serialize.body(vpnclient_ipsec_params, "VpnClientIPsecParameters") + + request = build_virtual_network_gateways_set_vpnclient_ipsec_parameters_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_vpnclient_ipsec_parameters_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_vpnclient_ipsec_parameters_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" + } + + @overload + async def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: _models.VpnClientIPsecParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Required. + :type vpnclient_ipsec_params: ~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters + :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 VpnClientIPsecParameters or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Required. + :type vpnclient_ipsec_params: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnClientIPsecParameters or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: Union[_models.VpnClientIPsecParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Is either a + VpnClientIPsecParameters type or a IO type. Required. + :type vpnclient_ipsec_params: ~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnClientIPsecParameters or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnClientIPsecParameters] = 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._set_vpnclient_ipsec_parameters_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + vpnclient_ipsec_params=vpnclient_ipsec_params, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_vpnclient_ipsec_parameters.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" + } + + async def _get_vpnclient_ipsec_parameters_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> _models.VpnClientIPsecParameters: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpnclient_ipsec_parameters_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpnclient_ipsec_parameters_initial.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpnclient_ipsec_parameters_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" + } + + @distributed_trace_async + async def begin_get_vpnclient_ipsec_parameters( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.VpnClientIPsecParameters]: + """The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec + policy for P2S client of virtual network gateway in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The virtual network gateway name. Required. + :type virtual_network_gateway_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 VpnClientIPsecParameters or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientIPsecParameters] = 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._get_vpnclient_ipsec_parameters_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpnclient_ipsec_parameters.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" + } + + @overload + async def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VpnDeviceScriptParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnDeviceScriptParameters + :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: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnDeviceScriptParameters, IO], + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Is either a + VpnDeviceScriptParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnDeviceScriptParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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, "VpnDeviceScriptParameters") + + request = build_virtual_network_gateways_vpn_device_configuration_script_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.vpn_device_configuration_script.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + vpn_device_configuration_script.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript" + } + + async def _start_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnPacketCaptureStartParameters") + else: + _json = None + + request = build_virtual_network_gateways_start_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" + } + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[_models.VpnPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Is either a VpnPacketCaptureStartParameters type or a IO type. Default + value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" + } + + async def _stop_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnPacketCaptureStopParameters") + + request = build_virtual_network_gateways_stop_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" + } + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnPacketCaptureStopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. 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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. Is either a VpnPacketCaptureStopParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" + } + + async def _get_vpnclient_connection_health_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[_models.VpnClientConnectionHealthDetailListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnClientConnectionHealthDetailListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpnclient_connection_health_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpnclient_connection_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnClientConnectionHealthDetailListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpnclient_connection_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" + } + + @distributed_trace_async + async def begin_get_vpnclient_connection_health( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.VpnClientConnectionHealthDetailListResult]: + """Get VPN client connection health detail per P2S client connection of the virtual network + gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 + VpnClientConnectionHealthDetailListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientConnectionHealthDetailListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientConnectionHealthDetailListResult] = 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._get_vpnclient_connection_health_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("VpnClientConnectionHealthDetailListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpnclient_connection_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" + } + + async def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionRequest") + + request = build_virtual_network_gateways_disconnect_virtual_network_gateway_vpn_connections_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disconnect_virtual_network_gateway_vpn_connections_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _disconnect_virtual_network_gateway_vpn_connections_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" + } + + @overload + async def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: _models.P2SVpnConnectionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest + :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: + """ + + @overload + async def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Is either a + P2SVpnConnectionRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._disconnect_virtual_network_gateway_vpn_connections_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disconnect_virtual_network_gateway_vpn_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" + } + + +class VirtualNetworkGatewayConnectionsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_network_gateway_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VirtualNetworkGatewayConnection, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGatewayConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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, "VirtualNetworkGatewayConnection") + + request = build_virtual_network_gateway_connections_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + 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.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VirtualNetworkGatewayConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection + :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 VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. 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 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 VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VirtualNetworkGatewayConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. Is either a VirtualNetworkGatewayConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGatewayConnection: + """Gets the specified virtual network gateway connection by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGatewayConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_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._api_version or "2023-09-01")) + 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, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGatewayConnection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkGatewayConnection]] = 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, "TagsObject") + + request = build_virtual_network_gateway_connections_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. + 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 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 VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkGatewayConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + async def _set_shared_key_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionSharedKey, IO], + **kwargs: Any + ) -> _models.ConnectionSharedKey: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSharedKey] = 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, "ConnectionSharedKey") + + request = build_virtual_network_gateway_connections_set_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_shared_key_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @overload + async def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.ConnectionSharedKey, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey + :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 ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. 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 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 ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionSharedKey, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. Is either a ConnectionSharedKey type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSharedKey] = 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._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @distributed_trace_async + async def get_shared_key( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> _models.ConnectionSharedKey: + """The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the + specified virtual network gateway connection shared key through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection shared + key name. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionSharedKey or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_shared_key.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualNetworkGatewayConnection"]: + """The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways + connections created. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkGatewayConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayConnectionListResult] = 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_virtual_network_gateway_connections_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections" + } + + async def _reset_shared_key_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionResetSharedKey, IO], + **kwargs: Any + ) -> Optional[_models.ConnectionResetSharedKey]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConnectionResetSharedKey]] = 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, "ConnectionResetSharedKey") + + request = build_virtual_network_gateway_connections_reset_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_shared_key_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ConnectionResetSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset" + } + + @overload + async def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.ConnectionResetSharedKey, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey + :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 ConnectionResetSharedKey or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. 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 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 ConnectionResetSharedKey or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionResetSharedKey, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. Is either a ConnectionResetSharedKey + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectionResetSharedKey or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionResetSharedKey] = 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._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionResetSharedKey", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset" + } + + async def _start_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnPacketCaptureStartParameters") + else: + _json = None + + request = build_virtual_network_gateway_connections_start_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture" + } + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[_models.VpnPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Is either a VpnPacketCaptureStartParameters type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture" + } + + async def _stop_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnPacketCaptureStopParameters") + + request = build_virtual_network_gateway_connections_stop_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture" + } + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VpnPacketCaptureStopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. 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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. Is either a VpnPacketCaptureStopParameters type or a IO type. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture" + } + + async def _get_ike_sas_initial( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_ike_sas_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_ike_sas_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_ike_sas_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas" + } + + @distributed_trace_async + async def begin_get_ike_sas( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[str]: + """Lists IKE Security Associations for the virtual network gateway connection in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_ike_sas_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_ike_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas" + } + + async def _reset_connection_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_reset_connection_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_connection_initial.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 [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, {}) + + _reset_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection" + } + + @distributed_trace_async + async def begin_reset_connection( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resets the virtual network gateway connection specified. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_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._api_version or "2023-09-01")) + 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._reset_connection_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection" + } + + +class LocalNetworkGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`local_network_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.LocalNetworkGateway, IO], + **kwargs: Any + ) -> _models.LocalNetworkGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, "LocalNetworkGateway") + + request = build_local_network_gateways_create_or_update_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + 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.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: _models.LocalNetworkGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :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 LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + 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 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 LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.LocalNetworkGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + Is either a LocalNetworkGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, + local_network_gateway_name=local_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, local_network_gateway_name: str, **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Gets the specified local network gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) + + request = build_local_network_gateways_get_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, local_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_local_network_gateways_delete_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, local_network_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_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._api_version or "2023-09-01")) + 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, + local_network_gateway_name=local_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, "TagsObject") + + request = build_local_network_gateways_update_tags_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.LocalNetworkGateway"]: + """Gets all the local network gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 LocalNetworkGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LocalNetworkGatewayListResult] = 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_local_network_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LocalNetworkGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways" + } + + +class VirtualNetworkGatewayNatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_network_gateway_nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGatewayNatRule: + """Retrieves the details of a nat rule. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGatewayNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_nat_rules_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VirtualNetworkGatewayNatRule, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGatewayNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(nat_rule_parameters, (IOBase, bytes)): + _content = nat_rule_parameters + else: + _json = self._serialize.body(nat_rule_parameters, "VirtualNetworkGatewayNatRule") + + request = build_virtual_network_gateway_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: _models.VirtualNetworkGatewayNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + :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 VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_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 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 VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VirtualNetworkGatewayNatRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Is either a + VirtualNetworkGatewayNatRule type or a IO type. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = 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, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_name, + nat_rule_parameters=nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_nat_rules_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a nat rule. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_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._api_version or "2023-09-01")) + 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, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def list_by_virtual_network_gateway( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkGatewayNatRule"]: + """Retrieves all nat rules for a particular virtual network gateway. + + :param resource_group_name: The resource group name of the virtual network gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkGatewayNatRule or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualNetworkGatewayNatRulesResult] = 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_virtual_network_gateway_nat_rules_list_by_virtual_network_gateway_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_virtual_network_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualNetworkGatewayNatRulesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_virtual_network_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules" + } + + +class VirtualNetworkTapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_network_taps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, tap_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_taps_delete_request( + resource_group_name=resource_group_name, + tap_name=tap_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified virtual network tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_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._api_version or "2023-09-01")) + 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, + tap_name=tap_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> _models.VirtualNetworkTap: + """Gets information about the specified virtual network tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of virtual network tap. Required. + :type tap_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) + + request = build_virtual_network_taps_get_request( + resource_group_name=resource_group_name, + tap_name=tap_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, tap_name: str, parameters: Union[_models.VirtualNetworkTap, IO], **kwargs: Any + ) -> _models.VirtualNetworkTap: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = 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, "VirtualNetworkTap") + + request = build_virtual_network_taps_create_or_update_request( + resource_group_name=resource_group_name, + tap_name=tap_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + 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.Network/virtualNetworkTaps/{tapName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + tap_name: str, + parameters: _models.VirtualNetworkTap, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :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 VirtualNetworkTap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + tap_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + 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 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 VirtualNetworkTap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, tap_name: str, parameters: Union[_models.VirtualNetworkTap, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + Is either a VirtualNetworkTap type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualNetworkTap or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = 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, + tap_name=tap_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + tap_name: str, + tap_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Required. + :type tap_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + tap_name: str, + tap_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Required. + :type tap_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, tap_name: str, tap_parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Is either a + TagsObject type or a IO type. Required. + :type tap_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(tap_parameters, (IOBase, bytes)): + _content = tap_parameters + else: + _json = self._serialize.body(tap_parameters, "TagsObject") + + request = build_virtual_network_taps_update_tags_request( + resource_group_name=resource_group_name, + tap_name=tap_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetworkTap"]: + """Gets all the VirtualNetworkTaps in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkTap or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTapListResult] = 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_virtual_network_taps_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTapListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkTap"]: + """Gets all the VirtualNetworkTaps in a subscription. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkTap or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTapListResult] = 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_virtual_network_taps_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTapListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps" + } + + +class VirtualRoutersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_routers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_router_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_routers_delete_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + _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.Error, 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.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_router_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_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._api_version or "2023-09-01")) + 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, + virtual_router_name=virtual_router_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_router_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualRouter: + """Gets the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualRouter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) + + request = build_virtual_routers_get_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: Union[_models.VirtualRouter, IO], + **kwargs: Any + ) -> _models.VirtualRouter: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouter] = 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, "VirtualRouter") + + request = build_virtual_routers_create_or_update_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + 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.Network/virtualRouters/{virtualRouterName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: _models.VirtualRouter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter + :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 VirtualRouter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. 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 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 VirtualRouter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: Union[_models.VirtualRouter, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. Is either a + VirtualRouter type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualRouter or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouter] = 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, + virtual_router_name=virtual_router_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualRouter", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualRouter"]: + """Lists all Virtual Routers in a resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualRouter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterListResult] = 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_virtual_routers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterListResult", 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.Error, 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.Network/virtualRouters" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualRouter"]: + """Gets all the Virtual Routers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualRouter or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterListResult] = 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_virtual_routers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters"} + + +class VirtualRouterPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_router_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_router_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_router_peerings_delete_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + _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.Error, 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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_router_name: str, peering_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified peering from a Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the peering. Required. + :type peering_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._api_version or "2023-09-01")) + 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, + virtual_router_name=virtual_router_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_router_name: str, peering_name: str, **kwargs: Any + ) -> _models.VirtualRouterPeering: + """Gets the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualRouterPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) + + request = build_virtual_router_peerings_get_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: Union[_models.VirtualRouterPeering, IO], + **kwargs: Any + ) -> _models.VirtualRouterPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouterPeering] = 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, "VirtualRouterPeering") + + request = build_virtual_router_peerings_create_or_update_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + 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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: _models.VirtualRouterPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering + :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 VirtualRouterPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. 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 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 VirtualRouterPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: Union[_models.VirtualRouterPeering, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. Is either a VirtualRouterPeering type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualRouterPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouterPeering] = 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, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_router_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualRouterPeering"]: + """Lists all Virtual Router Peerings in a Virtual Router resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualRouterPeering or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterPeeringListResult] = 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_virtual_router_peerings_list_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterPeeringListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings" + } + + +class VirtualWansOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_wans` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any) -> _models.VirtualWAN: + """Retrieves the details of a VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being retrieved. Required. + :type virtual_wan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + request = build_virtual_wans_get_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.VirtualWAN, IO], + **kwargs: Any + ) -> _models.VirtualWAN: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(wan_parameters, (IOBase, bytes)): + _content = wan_parameters + else: + _json = self._serialize.body(wan_parameters, "VirtualWAN") + + request = build_virtual_wans_create_or_update_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + 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.Network/virtualWans/{VirtualWANName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: _models.VirtualWAN, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :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 VirtualWAN or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Required. + :type wan_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 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 VirtualWAN or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.VirtualWAN, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Is either a + VirtualWAN type or a IO type. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualWAN or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = 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, + virtual_wan_name=virtual_wan_name, + wan_parameters=wan_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualWAN", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Required. + :type wan_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Is either a TagsObject + type or a IO type. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(wan_parameters, (IOBase, bytes)): + _content = wan_parameters + else: + _json = self._serialize.body(wan_parameters, "TagsObject") + + request = build_virtual_wans_update_tags_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_wan_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_wans_delete_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being deleted. Required. + :type virtual_wan_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._api_version or "2023-09-01")) + 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, + virtual_wan_name=virtual_wan_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualWAN"]: + """Lists all the VirtualWANs in a resource group. + + :param resource_group_name: The resource group name of the VirtualWan. 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 VirtualWAN or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualWANsResult] = 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_virtual_wans_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualWANsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualWAN"]: + """Lists all the VirtualWANs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualWAN or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualWANsResult] = 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_virtual_wans_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualWANsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans"} + + +class VpnSitesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_sites` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) -> _models.VpnSite: + """Retrieves the details of a VPN site. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being retrieved. Required. + :type vpn_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + request = build_vpn_sites_get_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.VpnSite, IO], + **kwargs: Any + ) -> _models.VpnSite: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_site_parameters, (IOBase, bytes)): + _content = vpn_site_parameters + else: + _json = self._serialize.body(vpn_site_parameters, "VpnSite") + + request = build_vpn_sites_create_or_update_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnSite", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnSite", pipeline_response) + + 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.Network/vpnSites/{vpnSiteName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: _models.VpnSite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :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 VpnSite or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Required. + :type vpn_site_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 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 VpnSite or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.VpnSite, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Is either a + VpnSite type or a IO type. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnSite or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnSite or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = 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, + vpn_site_name=vpn_site_name, + vpn_site_parameters=vpn_site_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnSite", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Required. + :type vpn_site_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Is either a TagsObject + type or a IO type. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_site_parameters, (IOBase, bytes)): + _content = vpn_site_parameters + else: + _json = self._serialize.body(vpn_site_parameters, "TagsObject") + + request = build_vpn_sites_update_tags_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vpn_site_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_sites_delete_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being deleted. Required. + :type vpn_site_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._api_version or "2023-09-01")) + 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, + vpn_site_name=vpn_site_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VpnSite"]: + """Lists all the vpnSites in a resource group. + + :param resource_group_name: The resource group name of the VpnSite. 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 VpnSite or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSitesResult] = 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_vpn_sites_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSitesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnSite"]: + """Lists all the VpnSites in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSite or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSitesResult] = 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_vpn_sites_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSitesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites"} + + +class VpnSiteLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_site_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vpn_site_name: str, vpn_site_link_name: str, **kwargs: Any + ) -> _models.VpnSiteLink: + """Retrieves the details of a VPN site link. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite. Required. + :type vpn_site_name: str + :param vpn_site_link_name: The name of the VpnSiteLink being retrieved. Required. + :type vpn_site_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSiteLink or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSiteLink + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSiteLink] = kwargs.pop("cls", None) + + request = build_vpn_site_links_get_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + vpn_site_link_name=vpn_site_link_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSiteLink", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}" + } + + @distributed_trace + def list_by_vpn_site( + self, resource_group_name: str, vpn_site_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnSiteLink"]: + """Lists all the vpnSiteLinks in a resource group for a vpn site. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite. Required. + :type vpn_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSiteLink or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSiteLinksResult] = 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_vpn_site_links_list_by_vpn_site_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_site.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSiteLinksResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_vpn_site.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks" + } + + +class VpnSitesConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_sites_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _download_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_wan_name: str, + request: Union[_models.GetVpnSitesConfigurationRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "GetVpnSitesConfigurationRequest") + + request = build_vpn_sites_configuration_download_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._download_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _download_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" + } + + @overload + async def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: _models.GetVpnSitesConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GetVpnSitesConfigurationRequest + :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: + """ + + @overload + async def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: Union[_models.GetVpnSitesConfigurationRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Is either a + GetVpnSitesConfigurationRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GetVpnSitesConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._download_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_download.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" + } + + +class VpnServerConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_server_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Retrieves the details of a VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being retrieved. + Required. + :type vpn_server_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_get_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.VpnServerConfiguration, IO], + **kwargs: Any + ) -> _models.VpnServerConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_parameters + else: + _json = self._serialize.body(vpn_server_configuration_parameters, "VpnServerConfiguration") + + request = build_vpn_server_configurations_create_or_update_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: _models.VpnServerConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Required. + :type vpn_server_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :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 VpnServerConfiguration or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Required. + :type vpn_server_configuration_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 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 VpnServerConfiguration or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.VpnServerConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Is either a VpnServerConfiguration type or a IO type. Required. + :type vpn_server_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnServerConfiguration or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = 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, + vpn_server_configuration_name=vpn_server_configuration_name, + vpn_server_configuration_parameters=vpn_server_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Required. + :type vpn_server_configuration_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Required. + :type vpn_server_configuration_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Is either a TagsObject type or a IO type. Required. + :type vpn_server_configuration_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_parameters + else: + _json = self._serialize.body(vpn_server_configuration_parameters, "TagsObject") + + request = build_vpn_server_configurations_update_tags_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vpn_server_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_delete_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being deleted. + Required. + :type vpn_server_configuration_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._api_version or "2023-09-01")) + 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, + vpn_server_configuration_name=vpn_server_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnServerConfiguration"]: + """Lists all the vpnServerConfigurations in a resource group. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. 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 VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationsResult] = 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_vpn_server_configurations_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnServerConfiguration"]: + """Lists all the VpnServerConfigurations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationsResult] = 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_vpn_server_configurations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations"} + + +class ConfigurationPolicyGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`configuration_policy_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: Union[_models.VpnServerConfigurationPolicyGroup, IO], + **kwargs: Any + ) -> _models.VpnServerConfigurationPolicyGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_policy_group_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_policy_group_parameters + else: + _json = self._serialize.body( + vpn_server_configuration_policy_group_parameters, "VpnServerConfigurationPolicyGroup" + ) + + request = build_configuration_policy_groups_create_or_update_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: _models.VpnServerConfigurationPolicyGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Required. + :type vpn_server_configuration_policy_group_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup + :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 VpnServerConfigurationPolicyGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Required. + :type vpn_server_configuration_policy_group_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 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 VpnServerConfigurationPolicyGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: Union[_models.VpnServerConfigurationPolicyGroup, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Is either a VpnServerConfigurationPolicyGroup type + or a IO type. Required. + :type vpn_server_configuration_policy_group_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnServerConfigurationPolicyGroup or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = 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, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_name, + vpn_server_configuration_policy_group_parameters=vpn_server_configuration_policy_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_configuration_policy_groups_delete_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a ConfigurationPolicyGroup. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_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._api_version or "2023-09-01")) + 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, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + **kwargs: Any + ) -> _models.VpnServerConfigurationPolicyGroup: + """Retrieves the details of a ConfigurationPolicyGroup. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup being + retrieved. Required. + :type configuration_policy_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfigurationPolicyGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) + + request = build_configuration_policy_groups_get_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace + def list_by_vpn_server_configuration( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnServerConfigurationPolicyGroup"]: + """Lists all the configurationPolicyGroups in a resource group for a vpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnServerConfigurationPolicyGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationPolicyGroupsResult] = 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_configuration_policy_groups_list_by_vpn_server_configuration_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_server_configuration.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationPolicyGroupsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_vpn_server_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups" + } + + +class VirtualHubsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_hubs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> _models.VirtualHub: + """Retrieves the details of a VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + request = build_virtual_hubs_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.VirtualHub, IO], + **kwargs: Any + ) -> _models.VirtualHub: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_parameters, (IOBase, bytes)): + _content = virtual_hub_parameters + else: + _json = self._serialize.body(virtual_hub_parameters, "VirtualHub") + + request = build_virtual_hubs_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualHub", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: _models.VirtualHub, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :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 VirtualHub or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Required. + :type virtual_hub_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 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 VirtualHub or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.VirtualHub, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Is either a + VirtualHub type or a IO type. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualHub or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualHub or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = 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, + virtual_hub_name=virtual_hub_name, + virtual_hub_parameters=virtual_hub_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHub", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Required. + :type virtual_hub_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Is either a + TagsObject type or a IO type. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_parameters, (IOBase, bytes)): + _content = virtual_hub_parameters + else: + _json = self._serialize.body(virtual_hub_parameters, "TagsObject") + + request = build_virtual_hubs_update_tags_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hubs_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualHub"]: + """Lists all the VirtualHubs in a resource group. + + :param resource_group_name: The resource group name of the VirtualHub. 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 VirtualHub or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubsResult] = 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_virtual_hubs_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualHub"]: + """Lists all the VirtualHubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualHub or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubsResult] = 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_virtual_hubs_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs"} + + async def _get_effective_virtual_hub_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[Union[_models.EffectiveRoutesParameters, IO]] = None, + **kwargs: Any + ) -> Optional[_models.VirtualHubEffectiveRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualHubEffectiveRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(effective_routes_parameters, (IOBase, bytes)): + _content = effective_routes_parameters + else: + if effective_routes_parameters is not None: + _json = self._serialize.body(effective_routes_parameters, "EffectiveRoutesParameters") + else: + _json = None + + request = build_virtual_hubs_get_effective_virtual_hub_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_effective_virtual_hub_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualHubEffectiveRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_effective_virtual_hub_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes" + } + + @overload + async def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[_models.EffectiveRoutesParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Default value is None. + :type effective_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.EffectiveRoutesParameters + :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 VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Default value is None. + :type effective_routes_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 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 VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[Union[_models.EffectiveRoutesParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Is either a EffectiveRoutesParameters type or a IO type. Default value is + None. + :type effective_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.EffectiveRoutesParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubEffectiveRouteList] = 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._get_effective_virtual_hub_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + effective_routes_parameters=effective_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHubEffectiveRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_effective_virtual_hub_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes" + } + + async def _get_inbound_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: Union[_models.GetInboundRoutesParameters, IO], + **kwargs: Any + ) -> Optional[_models.EffectiveRouteMapRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(get_inbound_routes_parameters, (IOBase, bytes)): + _content = get_inbound_routes_parameters + else: + _json = self._serialize.body(get_inbound_routes_parameters, "GetInboundRoutesParameters") + + request = build_virtual_hubs_get_inbound_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_inbound_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_inbound_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes" + } + + @overload + async def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: _models.GetInboundRoutesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Required. + :type get_inbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetInboundRoutesParameters + :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 EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Required. + :type get_inbound_routes_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 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 EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: Union[_models.GetInboundRoutesParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Is either a GetInboundRoutesParameters type or a IO type. Required. + :type get_inbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetInboundRoutesParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EffectiveRouteMapRouteList] = 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._get_inbound_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + get_inbound_routes_parameters=get_inbound_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_inbound_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes" + } + + async def _get_outbound_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: Union[_models.GetOutboundRoutesParameters, IO], + **kwargs: Any + ) -> Optional[_models.EffectiveRouteMapRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(get_outbound_routes_parameters, (IOBase, bytes)): + _content = get_outbound_routes_parameters + else: + _json = self._serialize.body(get_outbound_routes_parameters, "GetOutboundRoutesParameters") + + request = build_virtual_hubs_get_outbound_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_outbound_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_outbound_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes" + } + + @overload + async def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: _models.GetOutboundRoutesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Required. + :type get_outbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetOutboundRoutesParameters + :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 EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Required. + :type get_outbound_routes_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 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 EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: Union[_models.GetOutboundRoutesParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Is either a GetOutboundRoutesParameters type or a IO type. Required. + :type get_outbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetOutboundRoutesParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EffectiveRouteMapRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EffectiveRouteMapRouteList] = 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._get_outbound_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + get_outbound_routes_parameters=get_outbound_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_outbound_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes" + } + + +class RouteMapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`route_maps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, route_map_name: str, **kwargs: Any + ) -> _models.RouteMap: + """Retrieves the details of a RouteMap. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteMap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteMap + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) + + request = build_route_maps_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteMap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: Union[_models.RouteMap, IO], + **kwargs: Any + ) -> _models.RouteMap: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_map_parameters, (IOBase, bytes)): + _content = route_map_parameters + else: + _json = self._serialize.body(route_map_parameters, "RouteMap") + + request = build_route_maps_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteMap", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteMap", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: _models.RouteMap, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Required. + :type route_map_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteMap + :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 RouteMap or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Required. + :type route_map_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 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 RouteMap or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: Union[_models.RouteMap, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Is either a + RouteMap type or a IO type. Required. + :type route_map_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteMap or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RouteMap or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteMap] = 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, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_name, + route_map_parameters=route_map_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteMap", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_map_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_maps_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_map_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a RouteMap. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @distributed_trace + def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> AsyncIterable["_models.RouteMap"]: + """Retrieves the details of all RouteMaps. + + :param resource_group_name: The resource group name of the RouteMap's resource group'. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteMap or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListRouteMapsResult] = 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_route_maps_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListRouteMapsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps" + } + + +class HubVirtualNetworkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`hub_virtual_network_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: Union[_models.HubVirtualNetworkConnection, IO], + **kwargs: Any + ) -> _models.HubVirtualNetworkConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hub_virtual_network_connection_parameters, (IOBase, bytes)): + _content = hub_virtual_network_connection_parameters + else: + _json = self._serialize.body(hub_virtual_network_connection_parameters, "HubVirtualNetworkConnection") + + request = build_hub_virtual_network_connections_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: _models.HubVirtualNetworkConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Required. + :type hub_virtual_network_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection + :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 HubVirtualNetworkConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Required. + :type hub_virtual_network_connection_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 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 HubVirtualNetworkConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: Union[_models.HubVirtualNetworkConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Is either a HubVirtualNetworkConnection type or a IO type. + Required. + :type hub_virtual_network_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either HubVirtualNetworkConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubVirtualNetworkConnection] = 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + hub_virtual_network_connection_parameters=hub_virtual_network_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_hub_virtual_network_connections_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a HubVirtualNetworkConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> _models.HubVirtualNetworkConnection: + """Retrieves the details of a HubVirtualNetworkConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubVirtualNetworkConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) + + request = build_hub_virtual_network_connections_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HubVirtualNetworkConnection"]: + """Retrieves the details of all HubVirtualNetworkConnections. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubVirtualNetworkConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListHubVirtualNetworkConnectionsResult] = 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_hub_virtual_network_connections_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListHubVirtualNetworkConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections" + } + + +class VpnGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.VpnGateway: + """Retrieves the details of a virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) + + request = build_vpn_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.VpnGateway, IO], + **kwargs: Any + ) -> _models.VpnGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_gateway_parameters, (IOBase, bytes)): + _content = vpn_gateway_parameters + else: + _json = self._serialize.body(vpn_gateway_parameters, "VpnGateway") + + request = build_vpn_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: _models.VpnGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGateway + :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 VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Required. + :type vpn_gateway_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 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 VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.VpnGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Is either a VpnGateway type or a IO type. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = 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, + gateway_name=gateway_name, + vpn_gateway_parameters=vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VpnGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_gateway_parameters, (IOBase, bytes)): + _content = vpn_gateway_parameters + else: + _json = self._serialize.body(vpn_gateway_parameters, "TagsObject") + + request = build_vpn_gateways_update_tags_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. + Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. + Required. + :type vpn_gateway_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 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 VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. Is + either a TagsObject type or a IO type. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_gateway_parameters=vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_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._api_version or "2023-09-01")) + 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, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + async def _reset_initial( + self, resource_group_name: str, gateway_name: str, *, ip_configuration_id: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.VpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) + + request = build_vpn_gateways_reset_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + ip_configuration_id=ip_configuration_id, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset" + } + + @distributed_trace_async + async def begin_reset( + self, resource_group_name: str, gateway_name: str, *, ip_configuration_id: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGateway]: + """Resets the primary of the vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword ip_configuration_id: VpnGateway ipConfigurationId to specify the gateway instance. + Default value is None. + :paramtype ip_configuration_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 VpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + ip_configuration_id=ip_configuration_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset" + } + + async def _start_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnGatewayPacketCaptureStartParameters") + else: + _json = None + + request = build_vpn_gateways_start_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture" + } + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[_models.VpnGatewayPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Is either a VpnGatewayPacketCaptureStartParameters type or a IO type. Default + value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStartParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture" + } + + async def _stop_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnGatewayPacketCaptureStopParameters") + else: + _json = None + + request = build_vpn_gateways_stop_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture" + } + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[_models.VpnGatewayPacketCaptureStopParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Is either a VpnGatewayPacketCaptureStopParameters type or a IO type. Default value is + None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStopParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VpnGateway"]: + """Lists all the VpnGateways in a resource group. + + :param resource_group_name: The resource group name of the VpnGateway. 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 VpnGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewaysResult] = 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_vpn_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.VpnGateway"]: + """Lists all the VpnGateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewaysResult] = 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_vpn_gateways_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways"} + + +class VpnLinkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_link_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _reset_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_link_connections_reset_connection_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_connection_initial.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 [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, {}) + + _reset_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" + } + + @distributed_trace_async + async def begin_reset_connection( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resets the VpnLink connection specified. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn link connection. Required. + :type link_connection_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._api_version or "2023-09-01")) + 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._reset_connection_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" + } + + async def _get_ike_sas_initial( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_vpn_link_connections_get_ike_sas_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_ike_sas_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_ike_sas_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" + } + + @distributed_trace_async + async def begin_get_ike_sas( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn link connection. Required. + :type link_connection_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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_ike_sas_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_ike_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" + } + + @distributed_trace + def list_by_vpn_connection( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnSiteLinkConnection"]: + """Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn + connection. + + :param resource_group_name: The resource group name of the vpn gateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSiteLinkConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSiteLinkConnectionsResult] = 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_vpn_link_connections_list_by_vpn_connection_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_connection.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSiteLinkConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_vpn_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections" + } + + +class VpnConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.VpnConnection: + """Retrieves the details of a vpn connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) + + request = build_vpn_connections_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: Union[_models.VpnConnection, IO], + **kwargs: Any + ) -> _models.VpnConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_connection_parameters, (IOBase, bytes)): + _content = vpn_connection_parameters + else: + _json = self._serialize.body(vpn_connection_parameters, "VpnConnection") + + request = build_vpn_connections_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnConnection", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: _models.VpnConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. + Required. + :type vpn_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnConnection + :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 VpnConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. + Required. + :type vpn_connection_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 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 VpnConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: Union[_models.VpnConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. Is + either a VpnConnection type or a IO type. Required. + :type vpn_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnConnection] = 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, + gateway_name=gateway_name, + connection_name=connection_name, + vpn_connection_parameters=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_connections_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a vpn connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + gateway_name=gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + async def _start_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnConnectionPacketCaptureStartParameters") + else: + _json = None + + request = build_vpn_connections_start_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture" + } + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[_models.VpnConnectionPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Is either a VpnConnectionPacketCaptureStartParameters type or a IO type. + Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStartParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture" + } + + async def _stop_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnConnectionPacketCaptureStopParameters") + else: + _json = None + + request = build_vpn_connections_stop_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture" + } + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[_models.VpnConnectionPacketCaptureStopParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Default value is None. + :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 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 str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Is either a VpnConnectionPacketCaptureStopParameters type or a IO type. + Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStopParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either str or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture" + } + + @distributed_trace + def list_by_vpn_gateway( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnConnection"]: + """Retrieves all vpn connections for a particular virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnConnection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnConnectionsResult] = 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_vpn_connections_list_by_vpn_gateway_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_vpn_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections" + } + + +class VpnSiteLinkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_site_link_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> _models.VpnSiteLinkConnection: + """Retrieves the details of a vpn site link connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn connection. Required. + :type link_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSiteLinkConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSiteLinkConnection] = kwargs.pop("cls", None) + + request = build_vpn_site_link_connections_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSiteLinkConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}" + } + + +class NatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> _models.VpnGatewayNatRule: + """Retrieves the details of a nat ruleGet. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnGatewayNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) + + request = build_nat_rules_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VpnGatewayNatRule, IO], + **kwargs: Any + ) -> _models.VpnGatewayNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(nat_rule_parameters, (IOBase, bytes)): + _content = nat_rule_parameters + else: + _json = self._serialize.body(nat_rule_parameters, "VpnGatewayNatRule") + + request = build_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: _models.VpnGatewayNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule + :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 VpnGatewayNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_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 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 VpnGatewayNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VpnGatewayNatRule, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Is either a + VpnGatewayNatRule type or a IO type. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnGatewayNatRule or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGatewayNatRule] = 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, + gateway_name=gateway_name, + nat_rule_name=nat_rule_name, + nat_rule_parameters=nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_name: str, nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_nat_rules_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a nat rule. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_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._api_version or "2023-09-01")) + 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, + gateway_name=gateway_name, + nat_rule_name=nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def list_by_vpn_gateway( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VpnGatewayNatRule"]: + """Retrieves all nat rules for a particular virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnGatewayNatRule or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewayNatRulesResult] = 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_nat_rules_list_by_vpn_gateway_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewayNatRulesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_vpn_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules" + } + + +class P2SVpnGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`p2_svpn_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.P2SVpnGateway: + """Retrieves the details of a virtual wan p2s vpn gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: P2SVpnGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.P2SVpnGateway, IO], + **kwargs: Any + ) -> _models.P2SVpnGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(p2_s_vpn_gateway_parameters, (IOBase, bytes)): + _content = p2_s_vpn_gateway_parameters + else: + _json = self._serialize.body(p2_s_vpn_gateway_parameters, "P2SVpnGateway") + + request = build_p2_svpn_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + 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.Network/p2svpnGateways/{gatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: _models.P2SVpnGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway + :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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Required. + :type p2_s_vpn_gateway_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 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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.P2SVpnGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Is either a P2SVpnGateway type or a IO type. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = 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, + gateway_name=gateway_name, + p2_s_vpn_gateway_parameters=p2_s_vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(p2_s_vpn_gateway_parameters, (IOBase, bytes)): + _content = p2_s_vpn_gateway_parameters + else: + _json = self._serialize.body(p2_s_vpn_gateway_parameters, "TagsObject") + + request = build_p2_svpn_gateways_update_tags_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Required. + :type p2_s_vpn_gateway_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 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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Is either a TagsObject type or a IO type. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + p2_s_vpn_gateway_parameters=p2_s_vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a virtual wan p2s vpn gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_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._api_version or "2023-09-01")) + 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, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.P2SVpnGateway"]: + """Lists all the P2SVpnGateways in a resource group. + + :param resource_group_name: The resource group name of the P2SVpnGateway. 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 P2SVpnGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListP2SVpnGatewaysResult] = 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_p2_svpn_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListP2SVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways" + } + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.P2SVpnGateway"]: + """Lists all the P2SVpnGateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either P2SVpnGateway or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListP2SVpnGatewaysResult] = 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_p2_svpn_gateways_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListP2SVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways"} + + async def _reset_initial( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_reset_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset" + } + + @distributed_trace_async + async def begin_reset( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Resets the primary of the p2s vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset" + } + + async def _generate_vpn_profile_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.P2SVpnProfileParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnProfileResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnProfileResponse]] = 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, "P2SVpnProfileParameters") + + request = build_p2_svpn_gateways_generate_vpn_profile_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_vpn_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generate_vpn_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile" + } + + @overload + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: _models.P2SVpnProfileParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnProfileParameters + :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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. 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 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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.P2SVpnProfileParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. Is either a P2SVpnProfileParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnProfileParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnProfileResponse] = 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._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_vpn_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile" + } + + async def _get_p2_s_vpn_connection_health_initial( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_p2_s_vpn_connection_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_p2_s_vpn_connection_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth" + } + + @distributed_trace_async + async def begin_get_p2_s_vpn_connection_health( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnGateway]: + """Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = 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._get_p2_s_vpn_connection_health_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_p2_s_vpn_connection_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth" + } + + async def _get_p2_s_vpn_connection_health_detailed_initial( + self, + resource_group_name: str, + gateway_name: str, + request: Union[_models.P2SVpnConnectionHealthRequest, IO], + **kwargs: Any + ) -> Optional[_models.P2SVpnConnectionHealth]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.P2SVpnConnectionHealth]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionHealthRequest") + + request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_detailed_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_p2_s_vpn_connection_health_detailed_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnConnectionHealth", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_p2_s_vpn_connection_health_detailed_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed" + } + + @overload + async def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: _models.P2SVpnConnectionHealthRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. + Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealthRequest + :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 P2SVpnConnectionHealth or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. + Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either P2SVpnConnectionHealth or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: Union[_models.P2SVpnConnectionHealthRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. Is + either a P2SVpnConnectionHealthRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealthRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either P2SVpnConnectionHealth or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnConnectionHealth] = 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._get_p2_s_vpn_connection_health_detailed_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnConnectionHealth", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_p2_s_vpn_connection_health_detailed.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed" + } + + async def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionRequest") + + request = build_p2_svpn_gateways_disconnect_p2_s_vpn_connections_request( + resource_group_name=resource_group_name, + p2_s_vpn_gateway_name=p2_s_vpn_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disconnect_p2_s_vpn_connections_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _disconnect_p2_s_vpn_connections_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections" + } + + @overload + async def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: _models.P2SVpnConnectionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest + :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: + """ + + @overload + async def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Is either a + P2SVpnConnectionRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._api_version or "2023-09-01")) + 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._disconnect_p2_s_vpn_connections_initial( # type: ignore + resource_group_name=resource_group_name, + p2_s_vpn_gateway_name=p2_s_vpn_gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disconnect_p2_s_vpn_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections" + } + + +class VpnServerConfigurationsAssociatedWithVirtualWanOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`vpn_server_configurations_associated_with_virtual_wan` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _list_initial( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> Optional[_models.VpnServerConfigurationsResponse]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnServerConfigurationsResponse]] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_associated_with_virtual_wan_list_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfigurationsResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations" + } + + @distributed_trace_async + async def begin_list( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.VpnServerConfigurationsResponse]: + """Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_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 VpnServerConfigurationsResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationsResponse] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfigurationsResponse] = 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._list_initial( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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): + deserialized = self._deserialize("VpnServerConfigurationsResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations" + } + + +class VirtualHubRouteTableV2SOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_hub_route_table_v2_s` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> _models.VirtualHubRouteTableV2: + """Retrieves the details of a VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHubRouteTableV2. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHubRouteTableV2 or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) + + request = build_virtual_hub_route_table_v2_s_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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 = 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: Union[_models.VirtualHubRouteTableV2, IO], + **kwargs: Any + ) -> _models.VirtualHubRouteTableV2: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_route_table_v2_parameters, (IOBase, bytes)): + _content = virtual_hub_route_table_v2_parameters + else: + _json = self._serialize.body(virtual_hub_route_table_v2_parameters, "VirtualHubRouteTableV2") + + request = build_virtual_hub_route_table_v2_s_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: _models.VirtualHubRouteTableV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Required. + :type virtual_hub_route_table_v2_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 + :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 VirtualHubRouteTableV2 or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Required. + :type virtual_hub_route_table_v2_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 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 VirtualHubRouteTableV2 or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: Union[_models.VirtualHubRouteTableV2, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Is either a VirtualHubRouteTableV2 type or a IO type. Required. + :type virtual_hub_route_table_v2_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualHubRouteTableV2 or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubRouteTableV2] = 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + virtual_hub_route_table_v2_parameters=virtual_hub_route_table_v2_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_route_table_v2_s_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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.Error, 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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHubRouteTableV2. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualHubRouteTableV2"]: + """Retrieves the details of all VirtualHubRouteTableV2s. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualHubRouteTableV2 or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubRouteTableV2SResult] = 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_virtual_hub_route_table_v2_s_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubRouteTableV2SResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables" + } + + +class ExpressRouteGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list_by_subscription(self, **kwargs: Any) -> _models.ExpressRouteGatewayList: + """Lists ExpressRoute gateways under a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGatewayList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) + + request = build_express_route_gateways_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGatewayList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways" + } + + @distributed_trace_async + async def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> _models.ExpressRouteGatewayList: + """Lists ExpressRoute gateways in a given resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGatewayList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) + + request = build_express_route_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGatewayList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: Union[_models.ExpressRouteGateway, IO], + **kwargs: Any + ) -> _models.ExpressRouteGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(put_express_route_gateway_parameters, (IOBase, bytes)): + _content = put_express_route_gateway_parameters + else: + _json = self._serialize.body(put_express_route_gateway_parameters, "ExpressRouteGateway") + + request = build_express_route_gateways_create_or_update_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + 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.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: _models.ExpressRouteGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Required. + :type put_express_route_gateway_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway + :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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Required. + :type put_express_route_gateway_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 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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: Union[_models.ExpressRouteGateway, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Is either a ExpressRouteGateway type or a IO type. Required. + :type put_express_route_gateway_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = 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, + express_route_gateway_name=express_route_gateway_name, + put_express_route_gateway_parameters=put_express_route_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + async def _update_tags_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.ExpressRouteGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ExpressRouteGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(express_route_gateway_parameters, (IOBase, bytes)): + _content = express_route_gateway_parameters + else: + _json = self._serialize.body(express_route_gateway_parameters, "TagsObject") + + request = build_express_route_gateways_update_tags_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Required. + :type express_route_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Required. + :type express_route_gateway_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 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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Is either a TagsObject type or a IO type. Required. + :type express_route_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + express_route_gateway_parameters=express_route_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any + ) -> _models.ExpressRouteGateway: + """Fetches the details of a ExpressRoute gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) + + request = build_express_route_gateways_get_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_gateways_delete_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway + resource can only be deleted when there are no connection subresources. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_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._api_version or "2023-09-01")) + 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, + express_route_gateway_name=express_route_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + +class ExpressRouteConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`express_route_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: Union[_models.ExpressRouteConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(put_express_route_connection_parameters, (IOBase, bytes)): + _content = put_express_route_connection_parameters + else: + _json = self._serialize.body(put_express_route_connection_parameters, "ExpressRouteConnection") + + request = build_express_route_connections_create_or_update_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + 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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: _models.ExpressRouteConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Required. + :type put_express_route_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection + :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 ExpressRouteConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Required. + :type put_express_route_connection_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 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 ExpressRouteConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: Union[_models.ExpressRouteConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Is either a ExpressRouteConnection type or a IO type. + Required. + :type put_express_route_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExpressRouteConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteConnection] = 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, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_name, + put_express_route_connection_parameters=put_express_route_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, express_route_gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteConnection: + """Gets the specified ExpressRouteConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the ExpressRoute connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) + + request = build_express_route_connections_get_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_connections_delete_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, express_route_gateway_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a connection to a ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace_async + async def list( + self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any + ) -> _models.ExpressRouteConnectionList: + """Lists ExpressRouteConnections. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteConnectionList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnectionList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteConnectionList] = kwargs.pop("cls", None) + + request = build_express_route_connections_list_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteConnectionList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections" + } + + +class NetworkVirtualApplianceConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`network_virtual_appliance_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: Union[_models.NetworkVirtualApplianceConnection, IO], + **kwargs: Any + ) -> _models.NetworkVirtualApplianceConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(network_virtual_appliance_connection_parameters, (IOBase, bytes)): + _content = network_virtual_appliance_connection_parameters + else: + _json = self._serialize.body( + network_virtual_appliance_connection_parameters, "NetworkVirtualApplianceConnection" + ) + + request = build_network_virtual_appliance_connections_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: _models.NetworkVirtualApplianceConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Required. + :type network_virtual_appliance_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection + :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 NetworkVirtualApplianceConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Required. + :type network_virtual_appliance_connection_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 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 NetworkVirtualApplianceConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: Union[_models.NetworkVirtualApplianceConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Is either a NetworkVirtualApplianceConnection + type or a IO type. Required. + :type network_virtual_appliance_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkVirtualApplianceConnection or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_name, + network_virtual_appliance_connection_parameters=network_virtual_appliance_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, network_virtual_appliance_name: str, connection_name: str, **kwargs: Any + ) -> _models.NetworkVirtualApplianceConnection: + """Retrieves the details of specified NVA connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualApplianceConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) + + request = build_network_virtual_appliance_connections_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_virtual_appliance_connections_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a NVA connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkVirtualApplianceConnection"]: + """Lists NetworkVirtualApplianceConnections under the NVA. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualApplianceConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceConnectionList] = 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_network_virtual_appliance_connections_list_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceConnectionList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections" + } + + +class VirtualHubBgpConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_hub_bgp_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> _models.BgpConnection: + """Retrieves the details of a Virtual Hub Bgp Connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BgpConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BgpConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connection_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BgpConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: Union[_models.BgpConnection, IO], + **kwargs: Any + ) -> _models.BgpConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BgpConnection] = 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, "BgpConnection") + + request = build_virtual_hub_bgp_connection_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BgpConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BgpConnection", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: _models.BgpConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BgpConnection + :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 BgpConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. 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 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 BgpConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: Union[_models.BgpConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. Is either a BgpConnection type or a IO type. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BgpConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BgpConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BgpConnection] = 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BgpConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connection_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHubBgpConnection. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + +class VirtualHubBgpConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_hub_bgp_connections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BgpConnection"]: + """Retrieves the details of all VirtualHubBgpConnections. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BgpConnection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubBgpConnectionResults] = 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_virtual_hub_bgp_connections_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubBgpConnectionResults", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections" + } + + async def _list_learned_routes_initial( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> Optional[Dict[str, List[_models.PeerRoute]]]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connections_list_learned_routes_request( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_learned_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_learned_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes" + } + + @distributed_trace_async + async def begin_list_learned_routes( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[Dict[str, List[_models.PeerRoute]]]: + """Retrieves a list of routes the virtual hub bgp connection has learned. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param hub_name: The name of the virtual hub. Required. + :type hub_name: str + :param connection_name: The name of the virtual hub bgp connection. Required. + :type connection_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 dict mapping str to list of + PeerRoute or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[dict[str, + list[~azure.mgmt.network.v2023_09_01.models.PeerRoute]]] + :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._api_version or "2023-09-01")) + cls: ClsType[Dict[str, List[_models.PeerRoute]]] = 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._list_learned_routes_initial( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_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): + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_learned_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes" + } + + async def _list_advertised_routes_initial( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> Optional[Dict[str, List[_models.PeerRoute]]]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connections_list_advertised_routes_request( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_advertised_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_advertised_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes" + } + + @distributed_trace_async + async def begin_list_advertised_routes( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[Dict[str, List[_models.PeerRoute]]]: + """Retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param hub_name: The name of the virtual hub. Required. + :type hub_name: str + :param connection_name: The name of the virtual hub bgp connection. Required. + :type connection_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 dict mapping str to list of + PeerRoute or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[dict[str, + list[~azure.mgmt.network.v2023_09_01.models.PeerRoute]]] + :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._api_version or "2023-09-01")) + cls: ClsType[Dict[str, List[_models.PeerRoute]]] = 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._list_advertised_routes_initial( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_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): + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_advertised_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes" + } + + +class VirtualHubIpConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`virtual_hub_ip_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, ip_config_name: str, **kwargs: Any + ) -> _models.HubIpConfiguration: + """Retrieves the details of a Virtual Hub Ip configuration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubIpConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) + + request = build_virtual_hub_ip_configuration_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: Union[_models.HubIpConfiguration, IO], + **kwargs: Any + ) -> _models.HubIpConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubIpConfiguration] = 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, "HubIpConfiguration") + + request = build_virtual_hub_ip_configuration_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: _models.HubIpConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration + :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 HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. 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 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 HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: Union[_models.HubIpConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. Is either a HubIpConfiguration type or a IO + type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubIpConfiguration] = 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, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, ip_config_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_ip_configuration_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, ip_config_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHubBgpConnection. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HubIpConfiguration"]: + """Retrieves the details of all VirtualHubIpConfigurations. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubIpConfiguration or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubIpConfigurationResults] = 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_virtual_hub_ip_configuration_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubIpConfigurationResults", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations" + } + + +class HubRouteTablesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`hub_route_tables` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: Union[_models.HubRouteTable, IO], + **kwargs: Any + ) -> _models.HubRouteTable: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_table_parameters, (IOBase, bytes)): + _content = route_table_parameters + else: + _json = self._serialize.body(route_table_parameters, "HubRouteTable") + + request = build_hub_route_tables_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: _models.HubRouteTable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Required. + :type route_table_parameters: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable + :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 HubRouteTable or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Required. + :type route_table_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 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 HubRouteTable or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: Union[_models.HubRouteTable, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Is either a + HubRouteTable type or a IO type. Required. + :type route_table_parameters: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either HubRouteTable or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubRouteTable] = 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + route_table_parameters=route_table_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubRouteTable", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> _models.HubRouteTable: + """Retrieves the details of a RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubRouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) + + request = build_hub_route_tables_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_hub_route_tables_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a RouteTable. + + :param resource_group_name: The resource group name of the RouteTable. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HubRouteTable"]: + """Retrieves the details of all RouteTables. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubRouteTable or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListHubRouteTablesResult] = 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_hub_route_tables_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListHubRouteTablesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables" + } + + +class RoutingIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`routing_intent` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: Union[_models.RoutingIntent, IO], + **kwargs: Any + ) -> _models.RoutingIntent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(routing_intent_parameters, (IOBase, bytes)): + _content = routing_intent_parameters + else: + _json = self._serialize.body(routing_intent_parameters, "RoutingIntent") + + request = build_routing_intent_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: _models.RoutingIntent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. + Required. + :type routing_intent_parameters: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent + :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 RoutingIntent or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. + Required. + :type routing_intent_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 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 RoutingIntent or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: Union[_models.RoutingIntent, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. Is + either a RoutingIntent type or a IO type. Required. + :type routing_intent_parameters: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RoutingIntent or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutingIntent] = 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, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_name, + routing_intent_parameters=routing_intent_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutingIntent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, virtual_hub_name: str, routing_intent_name: str, **kwargs: Any + ) -> _models.RoutingIntent: + """Retrieves the details of a RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the RoutingIntent. Required. + :type routing_intent_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoutingIntent or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) + + request = build_routing_intent_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, routing_intent_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_routing_intent_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, routing_intent_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the RoutingIntent. Required. + :type routing_intent_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._api_version or "2023-09-01")) + 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, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RoutingIntent"]: + """Retrieves the details of all RoutingIntent child resources of the VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutingIntent or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListRoutingIntentResult] = 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_routing_intent_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListRoutingIntentResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent" + } + + +class WebApplicationFirewallPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.aio.NetworkManagementClient`'s + :attr:`web_application_firewall_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.WebApplicationFirewallPolicy"]: + """Lists all of the protection policies within a resource group. + + :param resource_group_name: The name of the resource group. 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 WebApplicationFirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = 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_web_application_firewall_policies_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebApplicationFirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.WebApplicationFirewallPolicy"]: + """Gets all the WAF policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebApplicationFirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = 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_web_application_firewall_policies_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebApplicationFirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, policy_name: str, **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Retrieve protection policy with specified name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) + + request = build_web_application_firewall_policies_get_request( + resource_group_name=resource_group_name, + policy_name=policy_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: _models.WebApplicationFirewallPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :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: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: Union[_models.WebApplicationFirewallPolicy, IO], + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Is either a WebApplicationFirewallPolicy type or a IO + type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebApplicationFirewallPolicy] = 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, "WebApplicationFirewallPolicy") + + request = build_web_application_firewall_policies_create_or_update_request( + resource_group_name=resource_group_name, + policy_name=policy_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_web_application_firewall_policies_delete_request( + resource_group_name=resource_group_name, + policy_name=policy_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_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._api_version or "2023-09-01")) + 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, + policy_name=policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_patch.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/__init__.py new file mode 100644 index 000000000000..4eba3021d4a0 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/__init__.py @@ -0,0 +1,1847 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import AadAuthenticationParameters +from ._models_py3 import Action +from ._models_py3 import ActiveBaseSecurityAdminRule +from ._models_py3 import ActiveConfigurationParameter +from ._models_py3 import ActiveConnectivityConfiguration +from ._models_py3 import ActiveConnectivityConfigurationsListResult +from ._models_py3 import ActiveDefaultSecurityAdminRule +from ._models_py3 import ActiveSecurityAdminRule +from ._models_py3 import ActiveSecurityAdminRulesListResult +from ._models_py3 import AddressPrefixItem +from ._models_py3 import AddressSpace +from ._models_py3 import AdminRule +from ._models_py3 import AdminRuleCollection +from ._models_py3 import AdminRuleCollectionListResult +from ._models_py3 import AdminRuleListResult +from ._models_py3 import ApplicationGateway +from ._models_py3 import ApplicationGatewayAuthenticationCertificate +from ._models_py3 import ApplicationGatewayAutoscaleConfiguration +from ._models_py3 import ApplicationGatewayAvailableSslOptions +from ._models_py3 import ApplicationGatewayAvailableSslPredefinedPolicies +from ._models_py3 import ApplicationGatewayAvailableWafRuleSetsResult +from ._models_py3 import ApplicationGatewayBackendAddress +from ._models_py3 import ApplicationGatewayBackendAddressPool +from ._models_py3 import ApplicationGatewayBackendHealth +from ._models_py3 import ApplicationGatewayBackendHealthHttpSettings +from ._models_py3 import ApplicationGatewayBackendHealthOnDemand +from ._models_py3 import ApplicationGatewayBackendHealthPool +from ._models_py3 import ApplicationGatewayBackendHealthServer +from ._models_py3 import ApplicationGatewayBackendHttpSettings +from ._models_py3 import ApplicationGatewayBackendSettings +from ._models_py3 import ApplicationGatewayClientAuthConfiguration +from ._models_py3 import ApplicationGatewayConnectionDraining +from ._models_py3 import ApplicationGatewayCustomError +from ._models_py3 import ApplicationGatewayFirewallDisabledRuleGroup +from ._models_py3 import ApplicationGatewayFirewallExclusion +from ._models_py3 import ApplicationGatewayFirewallManifestRuleSet +from ._models_py3 import ApplicationGatewayFirewallRule +from ._models_py3 import ApplicationGatewayFirewallRuleGroup +from ._models_py3 import ApplicationGatewayFirewallRuleSet +from ._models_py3 import ApplicationGatewayFrontendIPConfiguration +from ._models_py3 import ApplicationGatewayFrontendPort +from ._models_py3 import ApplicationGatewayGlobalConfiguration +from ._models_py3 import ApplicationGatewayHeaderConfiguration +from ._models_py3 import ApplicationGatewayHttpListener +from ._models_py3 import ApplicationGatewayIPConfiguration +from ._models_py3 import ApplicationGatewayListResult +from ._models_py3 import ApplicationGatewayListener +from ._models_py3 import ApplicationGatewayLoadDistributionPolicy +from ._models_py3 import ApplicationGatewayLoadDistributionTarget +from ._models_py3 import ApplicationGatewayOnDemandProbe +from ._models_py3 import ApplicationGatewayPathRule +from ._models_py3 import ApplicationGatewayPrivateEndpointConnection +from ._models_py3 import ApplicationGatewayPrivateEndpointConnectionListResult +from ._models_py3 import ApplicationGatewayPrivateLinkConfiguration +from ._models_py3 import ApplicationGatewayPrivateLinkIpConfiguration +from ._models_py3 import ApplicationGatewayPrivateLinkResource +from ._models_py3 import ApplicationGatewayPrivateLinkResourceListResult +from ._models_py3 import ApplicationGatewayProbe +from ._models_py3 import ApplicationGatewayProbeHealthResponseMatch +from ._models_py3 import ApplicationGatewayRedirectConfiguration +from ._models_py3 import ApplicationGatewayRequestRoutingRule +from ._models_py3 import ApplicationGatewayRewriteRule +from ._models_py3 import ApplicationGatewayRewriteRuleActionSet +from ._models_py3 import ApplicationGatewayRewriteRuleCondition +from ._models_py3 import ApplicationGatewayRewriteRuleSet +from ._models_py3 import ApplicationGatewayRoutingRule +from ._models_py3 import ApplicationGatewaySku +from ._models_py3 import ApplicationGatewaySslCertificate +from ._models_py3 import ApplicationGatewaySslPolicy +from ._models_py3 import ApplicationGatewaySslPredefinedPolicy +from ._models_py3 import ApplicationGatewaySslProfile +from ._models_py3 import ApplicationGatewayTrustedClientCertificate +from ._models_py3 import ApplicationGatewayTrustedRootCertificate +from ._models_py3 import ApplicationGatewayUrlConfiguration +from ._models_py3 import ApplicationGatewayUrlPathMap +from ._models_py3 import ApplicationGatewayWafDynamicManifestResult +from ._models_py3 import ApplicationGatewayWafDynamicManifestResultList +from ._models_py3 import ApplicationGatewayWebApplicationFirewallConfiguration +from ._models_py3 import ApplicationRule +from ._models_py3 import ApplicationSecurityGroup +from ._models_py3 import ApplicationSecurityGroupListResult +from ._models_py3 import AuthorizationListResult +from ._models_py3 import AutoApprovedPrivateLinkService +from ._models_py3 import AutoApprovedPrivateLinkServicesResult +from ._models_py3 import Availability +from ._models_py3 import AvailableDelegation +from ._models_py3 import AvailableDelegationsResult +from ._models_py3 import AvailablePrivateEndpointType +from ._models_py3 import AvailablePrivateEndpointTypesResult +from ._models_py3 import AvailableProvidersList +from ._models_py3 import AvailableProvidersListCity +from ._models_py3 import AvailableProvidersListCountry +from ._models_py3 import AvailableProvidersListParameters +from ._models_py3 import AvailableProvidersListState +from ._models_py3 import AvailableServiceAlias +from ._models_py3 import AvailableServiceAliasesResult +from ._models_py3 import AzureAsyncOperationResult +from ._models_py3 import AzureFirewall +from ._models_py3 import AzureFirewallApplicationRule +from ._models_py3 import AzureFirewallApplicationRuleCollection +from ._models_py3 import AzureFirewallApplicationRuleProtocol +from ._models_py3 import AzureFirewallFqdnTag +from ._models_py3 import AzureFirewallFqdnTagListResult +from ._models_py3 import AzureFirewallIPConfiguration +from ._models_py3 import AzureFirewallIpGroups +from ._models_py3 import AzureFirewallListResult +from ._models_py3 import AzureFirewallNatRCAction +from ._models_py3 import AzureFirewallNatRule +from ._models_py3 import AzureFirewallNatRuleCollection +from ._models_py3 import AzureFirewallNetworkRule +from ._models_py3 import AzureFirewallNetworkRuleCollection +from ._models_py3 import AzureFirewallPacketCaptureFlags +from ._models_py3 import AzureFirewallPacketCaptureRule +from ._models_py3 import AzureFirewallPublicIPAddress +from ._models_py3 import AzureFirewallRCAction +from ._models_py3 import AzureFirewallSku +from ._models_py3 import AzureReachabilityReport +from ._models_py3 import AzureReachabilityReportItem +from ._models_py3 import AzureReachabilityReportLatencyInfo +from ._models_py3 import AzureReachabilityReportLocation +from ._models_py3 import AzureReachabilityReportParameters +from ._models_py3 import AzureWebCategory +from ._models_py3 import AzureWebCategoryListResult +from ._models_py3 import BGPCommunity +from ._models_py3 import BackendAddressInboundNatRulePortMappings +from ._models_py3 import BackendAddressPool +from ._models_py3 import BaseAdminRule +from ._models_py3 import BastionActiveSession +from ._models_py3 import BastionActiveSessionListResult +from ._models_py3 import BastionHost +from ._models_py3 import BastionHostIPConfiguration +from ._models_py3 import BastionHostListResult +from ._models_py3 import BastionHostPropertiesFormatNetworkAcls +from ._models_py3 import BastionSessionDeleteResult +from ._models_py3 import BastionSessionState +from ._models_py3 import BastionShareableLink +from ._models_py3 import BastionShareableLinkListRequest +from ._models_py3 import BastionShareableLinkListResult +from ._models_py3 import BastionShareableLinkTokenListRequest +from ._models_py3 import BgpConnection +from ._models_py3 import BgpPeerStatus +from ._models_py3 import BgpPeerStatusListResult +from ._models_py3 import BgpServiceCommunity +from ._models_py3 import BgpServiceCommunityListResult +from ._models_py3 import BgpSettings +from ._models_py3 import BreakOutCategoryPolicies +from ._models_py3 import CheckPrivateLinkServiceVisibilityRequest +from ._models_py3 import ChildResource +from ._models_py3 import CloudErrorBody +from ._models_py3 import ( + Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties, +) +from ._models_py3 import ConfigurationGroup +from ._models_py3 import ConnectionMonitor +from ._models_py3 import ConnectionMonitorDestination +from ._models_py3 import ConnectionMonitorEndpoint +from ._models_py3 import ConnectionMonitorEndpointFilter +from ._models_py3 import ConnectionMonitorEndpointFilterItem +from ._models_py3 import ConnectionMonitorEndpointScope +from ._models_py3 import ConnectionMonitorEndpointScopeItem +from ._models_py3 import ConnectionMonitorHttpConfiguration +from ._models_py3 import ConnectionMonitorIcmpConfiguration +from ._models_py3 import ConnectionMonitorListResult +from ._models_py3 import ConnectionMonitorOutput +from ._models_py3 import ConnectionMonitorParameters +from ._models_py3 import ConnectionMonitorQueryResult +from ._models_py3 import ConnectionMonitorResult +from ._models_py3 import ConnectionMonitorResultProperties +from ._models_py3 import ConnectionMonitorSource +from ._models_py3 import ConnectionMonitorSuccessThreshold +from ._models_py3 import ConnectionMonitorTcpConfiguration +from ._models_py3 import ConnectionMonitorTestConfiguration +from ._models_py3 import ConnectionMonitorTestGroup +from ._models_py3 import ConnectionMonitorWorkspaceSettings +from ._models_py3 import ConnectionResetSharedKey +from ._models_py3 import ConnectionSharedKey +from ._models_py3 import ConnectionStateSnapshot +from ._models_py3 import ConnectivityConfiguration +from ._models_py3 import ConnectivityConfigurationListResult +from ._models_py3 import ConnectivityDestination +from ._models_py3 import ConnectivityGroupItem +from ._models_py3 import ConnectivityHop +from ._models_py3 import ConnectivityInformation +from ._models_py3 import ConnectivityIssue +from ._models_py3 import ConnectivityParameters +from ._models_py3 import ConnectivitySource +from ._models_py3 import Container +from ._models_py3 import ContainerNetworkInterface +from ._models_py3 import ContainerNetworkInterfaceConfiguration +from ._models_py3 import ContainerNetworkInterfaceIpConfiguration +from ._models_py3 import Criterion +from ._models_py3 import CrossTenantScopes +from ._models_py3 import CustomDnsConfigPropertiesFormat +from ._models_py3 import CustomIpPrefix +from ._models_py3 import CustomIpPrefixListResult +from ._models_py3 import DdosCustomPolicy +from ._models_py3 import DdosProtectionPlan +from ._models_py3 import DdosProtectionPlanListResult +from ._models_py3 import DdosSettings +from ._models_py3 import DefaultAdminRule +from ._models_py3 import Delegation +from ._models_py3 import DelegationProperties +from ._models_py3 import DeviceProperties +from ._models_py3 import DhcpOptions +from ._models_py3 import Dimension +from ._models_py3 import DnsNameAvailabilityResult +from ._models_py3 import DnsSettings +from ._models_py3 import DscpConfiguration +from ._models_py3 import DscpConfigurationListResult +from ._models_py3 import EffectiveBaseSecurityAdminRule +from ._models_py3 import EffectiveConnectivityConfiguration +from ._models_py3 import EffectiveDefaultSecurityAdminRule +from ._models_py3 import EffectiveNetworkSecurityGroup +from ._models_py3 import EffectiveNetworkSecurityGroupAssociation +from ._models_py3 import EffectiveNetworkSecurityGroupListResult +from ._models_py3 import EffectiveNetworkSecurityRule +from ._models_py3 import EffectiveRoute +from ._models_py3 import EffectiveRouteListResult +from ._models_py3 import EffectiveRouteMapRoute +from ._models_py3 import EffectiveRouteMapRouteList +from ._models_py3 import EffectiveRoutesParameters +from ._models_py3 import EffectiveSecurityAdminRule +from ._models_py3 import EndpointServiceResult +from ._models_py3 import EndpointServicesListResult +from ._models_py3 import Error +from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorResponse +from ._models_py3 import EvaluatedNetworkSecurityGroup +from ._models_py3 import ExclusionManagedRule +from ._models_py3 import ExclusionManagedRuleGroup +from ._models_py3 import ExclusionManagedRuleSet +from ._models_py3 import ExplicitProxy +from ._models_py3 import ExpressRouteCircuit +from ._models_py3 import ExpressRouteCircuitArpTable +from ._models_py3 import ExpressRouteCircuitAuthorization +from ._models_py3 import ExpressRouteCircuitConnection +from ._models_py3 import ExpressRouteCircuitConnectionListResult +from ._models_py3 import ExpressRouteCircuitListResult +from ._models_py3 import ExpressRouteCircuitPeering +from ._models_py3 import ExpressRouteCircuitPeeringConfig +from ._models_py3 import ExpressRouteCircuitPeeringId +from ._models_py3 import ExpressRouteCircuitPeeringListResult +from ._models_py3 import ExpressRouteCircuitReference +from ._models_py3 import ExpressRouteCircuitRoutesTable +from ._models_py3 import ExpressRouteCircuitRoutesTableSummary +from ._models_py3 import ExpressRouteCircuitServiceProviderProperties +from ._models_py3 import ExpressRouteCircuitSku +from ._models_py3 import ExpressRouteCircuitStats +from ._models_py3 import ExpressRouteCircuitsArpTableListResult +from ._models_py3 import ExpressRouteCircuitsRoutesTableListResult +from ._models_py3 import ExpressRouteCircuitsRoutesTableSummaryListResult +from ._models_py3 import ExpressRouteConnection +from ._models_py3 import ExpressRouteConnectionId +from ._models_py3 import ExpressRouteConnectionList +from ._models_py3 import ExpressRouteCrossConnection +from ._models_py3 import ExpressRouteCrossConnectionListResult +from ._models_py3 import ExpressRouteCrossConnectionPeering +from ._models_py3 import ExpressRouteCrossConnectionPeeringList +from ._models_py3 import ExpressRouteCrossConnectionRoutesTableSummary +from ._models_py3 import ExpressRouteCrossConnectionsRoutesTableSummaryListResult +from ._models_py3 import ExpressRouteGateway +from ._models_py3 import ExpressRouteGatewayList +from ._models_py3 import ExpressRouteGatewayPropertiesAutoScaleConfiguration +from ._models_py3 import ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds +from ._models_py3 import ExpressRouteLink +from ._models_py3 import ExpressRouteLinkListResult +from ._models_py3 import ExpressRouteLinkMacSecConfig +from ._models_py3 import ExpressRoutePort +from ._models_py3 import ExpressRoutePortAuthorization +from ._models_py3 import ExpressRoutePortAuthorizationListResult +from ._models_py3 import ExpressRoutePortListResult +from ._models_py3 import ExpressRoutePortsLocation +from ._models_py3 import ExpressRoutePortsLocationBandwidths +from ._models_py3 import ExpressRoutePortsLocationListResult +from ._models_py3 import ExpressRouteProviderPort +from ._models_py3 import ExpressRouteProviderPortListResult +from ._models_py3 import ExpressRouteServiceProvider +from ._models_py3 import ExpressRouteServiceProviderBandwidthsOffered +from ._models_py3 import ExpressRouteServiceProviderListResult +from ._models_py3 import ExtendedLocation +from ._models_py3 import FilterItems +from ._models_py3 import FirewallPacketCaptureParameters +from ._models_py3 import FirewallPolicy +from ._models_py3 import FirewallPolicyCertificateAuthority +from ._models_py3 import FirewallPolicyFilterRuleCollection +from ._models_py3 import FirewallPolicyFilterRuleCollectionAction +from ._models_py3 import FirewallPolicyHttpHeaderToInsert +from ._models_py3 import FirewallPolicyInsights +from ._models_py3 import FirewallPolicyIntrusionDetection +from ._models_py3 import FirewallPolicyIntrusionDetectionBypassTrafficSpecifications +from ._models_py3 import FirewallPolicyIntrusionDetectionConfiguration +from ._models_py3 import FirewallPolicyIntrusionDetectionSignatureSpecification +from ._models_py3 import FirewallPolicyListResult +from ._models_py3 import FirewallPolicyLogAnalyticsResources +from ._models_py3 import FirewallPolicyLogAnalyticsWorkspace +from ._models_py3 import FirewallPolicyNatRuleCollection +from ._models_py3 import FirewallPolicyNatRuleCollectionAction +from ._models_py3 import FirewallPolicyRule +from ._models_py3 import FirewallPolicyRuleApplicationProtocol +from ._models_py3 import FirewallPolicyRuleCollection +from ._models_py3 import FirewallPolicyRuleCollectionGroup +from ._models_py3 import FirewallPolicyRuleCollectionGroupListResult +from ._models_py3 import FirewallPolicySNAT +from ._models_py3 import FirewallPolicySQL +from ._models_py3 import FirewallPolicySku +from ._models_py3 import FirewallPolicyThreatIntelWhitelist +from ._models_py3 import FirewallPolicyTransportSecurity +from ._models_py3 import FlowLog +from ._models_py3 import FlowLogFormatParameters +from ._models_py3 import FlowLogInformation +from ._models_py3 import FlowLogListResult +from ._models_py3 import FlowLogStatusParameters +from ._models_py3 import FrontendIPConfiguration +from ._models_py3 import GatewayCustomBgpIpAddressIpConfiguration +from ._models_py3 import GatewayLoadBalancerTunnelInterface +from ._models_py3 import GatewayRoute +from ._models_py3 import GatewayRouteListResult +from ._models_py3 import GenerateExpressRoutePortsLOARequest +from ._models_py3 import GenerateExpressRoutePortsLOAResult +from ._models_py3 import GetInboundRoutesParameters +from ._models_py3 import GetOutboundRoutesParameters +from ._models_py3 import GetVpnSitesConfigurationRequest +from ._models_py3 import GroupByUserSession +from ._models_py3 import GroupByVariable +from ._models_py3 import HTTPConfiguration +from ._models_py3 import HTTPHeader +from ._models_py3 import HopLink +from ._models_py3 import Hub +from ._models_py3 import HubIPAddresses +from ._models_py3 import HubIpConfiguration +from ._models_py3 import HubPublicIPAddresses +from ._models_py3 import HubRoute +from ._models_py3 import HubRouteTable +from ._models_py3 import HubVirtualNetworkConnection +from ._models_py3 import IDPSQueryObject +from ._models_py3 import IPAddressAvailabilityResult +from ._models_py3 import IPConfiguration +from ._models_py3 import IPConfigurationBgpPeeringAddress +from ._models_py3 import IPConfigurationProfile +from ._models_py3 import IPPrefixesList +from ._models_py3 import IPRule +from ._models_py3 import InboundNatPool +from ._models_py3 import InboundNatRule +from ._models_py3 import InboundNatRuleListResult +from ._models_py3 import InboundNatRulePortMapping +from ._models_py3 import InboundSecurityRule +from ._models_py3 import InboundSecurityRules +from ._models_py3 import InternetIngressPublicIpsProperties +from ._models_py3 import IpAllocation +from ._models_py3 import IpAllocationListResult +from ._models_py3 import IpGroup +from ._models_py3 import IpGroupListResult +from ._models_py3 import IpTag +from ._models_py3 import IpsecPolicy +from ._models_py3 import Ipv6CircuitConnectionConfig +from ._models_py3 import Ipv6ExpressRouteCircuitPeeringConfig +from ._models_py3 import ListHubRouteTablesResult +from ._models_py3 import ListHubVirtualNetworkConnectionsResult +from ._models_py3 import ListP2SVpnGatewaysResult +from ._models_py3 import ListRouteMapsResult +from ._models_py3 import ListRoutingIntentResult +from ._models_py3 import ListVirtualHubBgpConnectionResults +from ._models_py3 import ListVirtualHubIpConfigurationResults +from ._models_py3 import ListVirtualHubRouteTableV2SResult +from ._models_py3 import ListVirtualHubsResult +from ._models_py3 import ListVirtualNetworkGatewayNatRulesResult +from ._models_py3 import ListVirtualWANsResult +from ._models_py3 import ListVpnConnectionsResult +from ._models_py3 import ListVpnGatewayNatRulesResult +from ._models_py3 import ListVpnGatewaysResult +from ._models_py3 import ListVpnServerConfigurationPolicyGroupsResult +from ._models_py3 import ListVpnServerConfigurationsResult +from ._models_py3 import ListVpnSiteLinkConnectionsResult +from ._models_py3 import ListVpnSiteLinksResult +from ._models_py3 import ListVpnSitesResult +from ._models_py3 import LoadBalancer +from ._models_py3 import LoadBalancerBackendAddress +from ._models_py3 import LoadBalancerBackendAddressPoolListResult +from ._models_py3 import LoadBalancerFrontendIPConfigurationListResult +from ._models_py3 import LoadBalancerListResult +from ._models_py3 import LoadBalancerLoadBalancingRuleListResult +from ._models_py3 import LoadBalancerOutboundRuleListResult +from ._models_py3 import LoadBalancerProbeListResult +from ._models_py3 import LoadBalancerSku +from ._models_py3 import LoadBalancerVipSwapRequest +from ._models_py3 import LoadBalancerVipSwapRequestFrontendIPConfiguration +from ._models_py3 import LoadBalancingRule +from ._models_py3 import LocalNetworkGateway +from ._models_py3 import LocalNetworkGatewayListResult +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedRuleGroupOverride +from ._models_py3 import ManagedRuleOverride +from ._models_py3 import ManagedRuleSet +from ._models_py3 import ManagedRulesDefinition +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MatchCondition +from ._models_py3 import MatchVariable +from ._models_py3 import MatchedRule +from ._models_py3 import MetricSpecification +from ._models_py3 import MigrateLoadBalancerToIpBasedRequest +from ._models_py3 import MigratedPools +from ._models_py3 import NatGateway +from ._models_py3 import NatGatewayListResult +from ._models_py3 import NatGatewaySku +from ._models_py3 import NatRule +from ._models_py3 import NatRulePortMapping +from ._models_py3 import NetworkConfigurationDiagnosticParameters +from ._models_py3 import NetworkConfigurationDiagnosticProfile +from ._models_py3 import NetworkConfigurationDiagnosticResponse +from ._models_py3 import NetworkConfigurationDiagnosticResult +from ._models_py3 import NetworkGroup +from ._models_py3 import NetworkGroupListResult +from ._models_py3 import NetworkIntentPolicy +from ._models_py3 import NetworkIntentPolicyConfiguration +from ._models_py3 import NetworkInterface +from ._models_py3 import NetworkInterfaceAssociation +from ._models_py3 import NetworkInterfaceDnsSettings +from ._models_py3 import NetworkInterfaceIPConfiguration +from ._models_py3 import NetworkInterfaceIPConfigurationListResult +from ._models_py3 import NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties +from ._models_py3 import NetworkInterfaceListResult +from ._models_py3 import NetworkInterfaceLoadBalancerListResult +from ._models_py3 import NetworkInterfaceTapConfiguration +from ._models_py3 import NetworkInterfaceTapConfigurationListResult +from ._models_py3 import NetworkManager +from ._models_py3 import NetworkManagerCommit +from ._models_py3 import NetworkManagerConnection +from ._models_py3 import NetworkManagerConnectionListResult +from ._models_py3 import NetworkManagerDeploymentStatus +from ._models_py3 import NetworkManagerDeploymentStatusListResult +from ._models_py3 import NetworkManagerDeploymentStatusParameter +from ._models_py3 import NetworkManagerEffectiveConnectivityConfigurationListResult +from ._models_py3 import NetworkManagerEffectiveSecurityAdminRulesListResult +from ._models_py3 import NetworkManagerListResult +from ._models_py3 import NetworkManagerPropertiesNetworkManagerScopes +from ._models_py3 import NetworkManagerSecurityGroupItem +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileListResult +from ._models_py3 import NetworkRule +from ._models_py3 import NetworkSecurityGroup +from ._models_py3 import NetworkSecurityGroupListResult +from ._models_py3 import NetworkSecurityGroupResult +from ._models_py3 import NetworkSecurityRulesEvaluationResult +from ._models_py3 import NetworkVirtualAppliance +from ._models_py3 import NetworkVirtualApplianceConnection +from ._models_py3 import NetworkVirtualApplianceConnectionList +from ._models_py3 import NetworkVirtualApplianceListResult +from ._models_py3 import NetworkVirtualApplianceSiteListResult +from ._models_py3 import NetworkVirtualApplianceSku +from ._models_py3 import NetworkVirtualApplianceSkuInstances +from ._models_py3 import NetworkVirtualApplianceSkuListResult +from ._models_py3 import NetworkWatcher +from ._models_py3 import NetworkWatcherListResult +from ._models_py3 import NextHopParameters +from ._models_py3 import NextHopResult +from ._models_py3 import O365BreakOutCategoryPolicies +from ._models_py3 import O365PolicyProperties +from ._models_py3 import Office365PolicyProperties +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationPropertiesFormatServiceSpecification +from ._models_py3 import OrderBy +from ._models_py3 import OutboundRule +from ._models_py3 import OwaspCrsExclusionEntry +from ._models_py3 import P2SConnectionConfiguration +from ._models_py3 import P2SVpnConnectionHealth +from ._models_py3 import P2SVpnConnectionHealthRequest +from ._models_py3 import P2SVpnConnectionRequest +from ._models_py3 import P2SVpnGateway +from ._models_py3 import P2SVpnProfileParameters +from ._models_py3 import PacketCapture +from ._models_py3 import PacketCaptureFilter +from ._models_py3 import PacketCaptureListResult +from ._models_py3 import PacketCaptureMachineScope +from ._models_py3 import PacketCaptureParameters +from ._models_py3 import PacketCaptureQueryStatusResult +from ._models_py3 import PacketCaptureResult +from ._models_py3 import PacketCaptureResultProperties +from ._models_py3 import PacketCaptureStorageLocation +from ._models_py3 import Parameter +from ._models_py3 import PartnerManagedResourceProperties +from ._models_py3 import PatchObject +from ._models_py3 import PatchRouteFilter +from ._models_py3 import PatchRouteFilterRule +from ._models_py3 import PeerExpressRouteCircuitConnection +from ._models_py3 import PeerExpressRouteCircuitConnectionListResult +from ._models_py3 import PeerRoute +from ._models_py3 import PolicySettings +from ._models_py3 import PolicySettingsLogScrubbing +from ._models_py3 import PrepareNetworkPoliciesRequest +from ._models_py3 import PrivateDnsZoneConfig +from ._models_py3 import PrivateDnsZoneGroup +from ._models_py3 import PrivateDnsZoneGroupListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateEndpointIPConfiguration +from ._models_py3 import PrivateEndpointListResult +from ._models_py3 import PrivateLinkService +from ._models_py3 import PrivateLinkServiceConnection +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import PrivateLinkServiceIpConfiguration +from ._models_py3 import PrivateLinkServiceListResult +from ._models_py3 import PrivateLinkServicePropertiesAutoApproval +from ._models_py3 import PrivateLinkServicePropertiesVisibility +from ._models_py3 import PrivateLinkServiceVisibility +from ._models_py3 import Probe +from ._models_py3 import PropagatedRouteTable +from ._models_py3 import ProtocolConfiguration +from ._models_py3 import PublicIPAddress +from ._models_py3 import PublicIPAddressDnsSettings +from ._models_py3 import PublicIPAddressListResult +from ._models_py3 import PublicIPAddressSku +from ._models_py3 import PublicIPPrefix +from ._models_py3 import PublicIPPrefixListResult +from ._models_py3 import PublicIPPrefixSku +from ._models_py3 import PublicIpDdosProtectionStatusResult +from ._models_py3 import QosDefinition +from ._models_py3 import QosIpRange +from ._models_py3 import QosPortRange +from ._models_py3 import QueryInboundNatRulePortMappingRequest +from ._models_py3 import QueryRequestOptions +from ._models_py3 import QueryResults +from ._models_py3 import QueryTroubleshootingParameters +from ._models_py3 import RadiusServer +from ._models_py3 import RecordSet +from ._models_py3 import ReferencedPublicIpAddress +from ._models_py3 import Resource +from ._models_py3 import ResourceNavigationLink +from ._models_py3 import ResourceNavigationLinksListResult +from ._models_py3 import ResourceSet +from ._models_py3 import RetentionPolicyParameters +from ._models_py3 import Route +from ._models_py3 import RouteFilter +from ._models_py3 import RouteFilterListResult +from ._models_py3 import RouteFilterRule +from ._models_py3 import RouteFilterRuleListResult +from ._models_py3 import RouteListResult +from ._models_py3 import RouteMap +from ._models_py3 import RouteMapRule +from ._models_py3 import RouteTable +from ._models_py3 import RouteTableListResult +from ._models_py3 import RoutingConfiguration +from ._models_py3 import RoutingIntent +from ._models_py3 import RoutingPolicy +from ._models_py3 import ScopeConnection +from ._models_py3 import ScopeConnectionListResult +from ._models_py3 import SecurityAdminConfiguration +from ._models_py3 import SecurityAdminConfigurationListResult +from ._models_py3 import SecurityGroupNetworkInterface +from ._models_py3 import SecurityGroupViewParameters +from ._models_py3 import SecurityGroupViewResult +from ._models_py3 import SecurityPartnerProvider +from ._models_py3 import SecurityPartnerProviderListResult +from ._models_py3 import SecurityRule +from ._models_py3 import SecurityRuleAssociations +from ._models_py3 import SecurityRuleListResult +from ._models_py3 import ServiceAssociationLink +from ._models_py3 import ServiceAssociationLinksListResult +from ._models_py3 import ServiceEndpointPolicy +from ._models_py3 import ServiceEndpointPolicyDefinition +from ._models_py3 import ServiceEndpointPolicyDefinitionListResult +from ._models_py3 import ServiceEndpointPolicyListResult +from ._models_py3 import ServiceEndpointPropertiesFormat +from ._models_py3 import ServiceTagInformation +from ._models_py3 import ServiceTagInformationListResult +from ._models_py3 import ServiceTagInformationPropertiesFormat +from ._models_py3 import ServiceTagsListResult +from ._models_py3 import SessionIds +from ._models_py3 import SignatureOverridesFilterValuesQuery +from ._models_py3 import SignatureOverridesFilterValuesResponse +from ._models_py3 import SignaturesOverrides +from ._models_py3 import SignaturesOverridesList +from ._models_py3 import SignaturesOverridesProperties +from ._models_py3 import SingleQueryResult +from ._models_py3 import Sku +from ._models_py3 import StaticMember +from ._models_py3 import StaticMemberListResult +from ._models_py3 import StaticRoute +from ._models_py3 import StaticRoutesConfig +from ._models_py3 import SubResource +from ._models_py3 import Subnet +from ._models_py3 import SubnetAssociation +from ._models_py3 import SubnetListResult +from ._models_py3 import SwapResource +from ._models_py3 import SwapResourceListResult +from ._models_py3 import SwapResourceProperties +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import Topology +from ._models_py3 import TopologyAssociation +from ._models_py3 import TopologyParameters +from ._models_py3 import TopologyResource +from ._models_py3 import TrafficAnalyticsConfigurationProperties +from ._models_py3 import TrafficAnalyticsProperties +from ._models_py3 import TrafficSelectorPolicy +from ._models_py3 import TroubleshootingDetails +from ._models_py3 import TroubleshootingParameters +from ._models_py3 import TroubleshootingRecommendedActions +from ._models_py3 import TroubleshootingResult +from ._models_py3 import TunnelConnectionHealth +from ._models_py3 import UnprepareNetworkPoliciesRequest +from ._models_py3 import Usage +from ._models_py3 import UsageName +from ._models_py3 import UsagesListResult +from ._models_py3 import VM +from ._models_py3 import VerificationIPFlowParameters +from ._models_py3 import VerificationIPFlowResult +from ._models_py3 import VirtualApplianceAdditionalNicProperties +from ._models_py3 import VirtualApplianceNicProperties +from ._models_py3 import VirtualApplianceSite +from ._models_py3 import VirtualApplianceSkuProperties +from ._models_py3 import VirtualHub +from ._models_py3 import VirtualHubEffectiveRoute +from ._models_py3 import VirtualHubEffectiveRouteList +from ._models_py3 import VirtualHubId +from ._models_py3 import VirtualHubRoute +from ._models_py3 import VirtualHubRouteTable +from ._models_py3 import VirtualHubRouteTableV2 +from ._models_py3 import VirtualHubRouteV2 +from ._models_py3 import VirtualNetwork +from ._models_py3 import VirtualNetworkBgpCommunities +from ._models_py3 import VirtualNetworkConnectionGatewayReference +from ._models_py3 import VirtualNetworkDdosProtectionStatusResult +from ._models_py3 import VirtualNetworkEncryption +from ._models_py3 import VirtualNetworkGateway +from ._models_py3 import VirtualNetworkGatewayAutoScaleBounds +from ._models_py3 import VirtualNetworkGatewayAutoScaleConfiguration +from ._models_py3 import VirtualNetworkGatewayConnection +from ._models_py3 import VirtualNetworkGatewayConnectionListEntity +from ._models_py3 import VirtualNetworkGatewayConnectionListResult +from ._models_py3 import VirtualNetworkGatewayIPConfiguration +from ._models_py3 import VirtualNetworkGatewayListConnectionsResult +from ._models_py3 import VirtualNetworkGatewayListResult +from ._models_py3 import VirtualNetworkGatewayNatRule +from ._models_py3 import VirtualNetworkGatewayPolicyGroup +from ._models_py3 import VirtualNetworkGatewayPolicyGroupMember +from ._models_py3 import VirtualNetworkGatewaySku +from ._models_py3 import VirtualNetworkListResult +from ._models_py3 import VirtualNetworkListUsageResult +from ._models_py3 import VirtualNetworkPeering +from ._models_py3 import VirtualNetworkPeeringListResult +from ._models_py3 import VirtualNetworkTap +from ._models_py3 import VirtualNetworkTapListResult +from ._models_py3 import VirtualNetworkUsage +from ._models_py3 import VirtualNetworkUsageName +from ._models_py3 import VirtualRouter +from ._models_py3 import VirtualRouterAutoScaleConfiguration +from ._models_py3 import VirtualRouterListResult +from ._models_py3 import VirtualRouterPeering +from ._models_py3 import VirtualRouterPeeringListResult +from ._models_py3 import VirtualWAN +from ._models_py3 import VirtualWanSecurityProvider +from ._models_py3 import VirtualWanSecurityProviders +from ._models_py3 import VirtualWanVpnProfileParameters +from ._models_py3 import VnetRoute +from ._models_py3 import VngClientConnectionConfiguration +from ._models_py3 import VpnClientConfiguration +from ._models_py3 import VpnClientConnectionHealth +from ._models_py3 import VpnClientConnectionHealthDetail +from ._models_py3 import VpnClientConnectionHealthDetailListResult +from ._models_py3 import VpnClientIPsecParameters +from ._models_py3 import VpnClientParameters +from ._models_py3 import VpnClientRevokedCertificate +from ._models_py3 import VpnClientRootCertificate +from ._models_py3 import VpnConnection +from ._models_py3 import VpnConnectionPacketCaptureStartParameters +from ._models_py3 import VpnConnectionPacketCaptureStopParameters +from ._models_py3 import VpnDeviceScriptParameters +from ._models_py3 import VpnGateway +from ._models_py3 import VpnGatewayIpConfiguration +from ._models_py3 import VpnGatewayNatRule +from ._models_py3 import VpnGatewayPacketCaptureStartParameters +from ._models_py3 import VpnGatewayPacketCaptureStopParameters +from ._models_py3 import VpnLinkBgpSettings +from ._models_py3 import VpnLinkProviderProperties +from ._models_py3 import VpnNatRuleMapping +from ._models_py3 import VpnPacketCaptureStartParameters +from ._models_py3 import VpnPacketCaptureStopParameters +from ._models_py3 import VpnProfileResponse +from ._models_py3 import VpnServerConfigRadiusClientRootCertificate +from ._models_py3 import VpnServerConfigRadiusServerRootCertificate +from ._models_py3 import VpnServerConfigVpnClientRevokedCertificate +from ._models_py3 import VpnServerConfigVpnClientRootCertificate +from ._models_py3 import VpnServerConfiguration +from ._models_py3 import VpnServerConfigurationPolicyGroup +from ._models_py3 import VpnServerConfigurationPolicyGroupMember +from ._models_py3 import VpnServerConfigurationsResponse +from ._models_py3 import VpnSite +from ._models_py3 import VpnSiteId +from ._models_py3 import VpnSiteLink +from ._models_py3 import VpnSiteLinkConnection +from ._models_py3 import WebApplicationFirewallCustomRule +from ._models_py3 import WebApplicationFirewallPolicy +from ._models_py3 import WebApplicationFirewallPolicyListResult +from ._models_py3 import WebApplicationFirewallScrubbingRules + +from ._network_management_client_enums import Access +from ._network_management_client_enums import ActionType +from ._network_management_client_enums import AddressPrefixType +from ._network_management_client_enums import AdminRuleKind +from ._network_management_client_enums import AdminState +from ._network_management_client_enums import ApplicationGatewayBackendHealthServerHealth +from ._network_management_client_enums import ApplicationGatewayClientRevocationOptions +from ._network_management_client_enums import ApplicationGatewayCookieBasedAffinity +from ._network_management_client_enums import ApplicationGatewayCustomErrorStatusCode +from ._network_management_client_enums import ApplicationGatewayFirewallMode +from ._network_management_client_enums import ApplicationGatewayFirewallRateLimitDuration +from ._network_management_client_enums import ApplicationGatewayFirewallUserSessionVariable +from ._network_management_client_enums import ApplicationGatewayLoadDistributionAlgorithm +from ._network_management_client_enums import ApplicationGatewayOperationalState +from ._network_management_client_enums import ApplicationGatewayProtocol +from ._network_management_client_enums import ApplicationGatewayRedirectType +from ._network_management_client_enums import ApplicationGatewayRequestRoutingRuleType +from ._network_management_client_enums import ApplicationGatewayRuleSetStatusOptions +from ._network_management_client_enums import ApplicationGatewaySkuName +from ._network_management_client_enums import ApplicationGatewaySslCipherSuite +from ._network_management_client_enums import ApplicationGatewaySslPolicyName +from ._network_management_client_enums import ApplicationGatewaySslPolicyType +from ._network_management_client_enums import ApplicationGatewaySslProtocol +from ._network_management_client_enums import ApplicationGatewayTier +from ._network_management_client_enums import ApplicationGatewayTierTypes +from ._network_management_client_enums import ApplicationGatewayWafRuleActionTypes +from ._network_management_client_enums import ApplicationGatewayWafRuleStateTypes +from ._network_management_client_enums import AssociationType +from ._network_management_client_enums import AuthenticationMethod +from ._network_management_client_enums import AuthorizationUseStatus +from ._network_management_client_enums import AutoLearnPrivateRangesMode +from ._network_management_client_enums import AzureFirewallApplicationRuleProtocolType +from ._network_management_client_enums import AzureFirewallNatRCActionType +from ._network_management_client_enums import AzureFirewallNetworkRuleProtocol +from ._network_management_client_enums import AzureFirewallPacketCaptureFlagsType +from ._network_management_client_enums import AzureFirewallRCActionType +from ._network_management_client_enums import AzureFirewallSkuName +from ._network_management_client_enums import AzureFirewallSkuTier +from ._network_management_client_enums import AzureFirewallThreatIntelMode +from ._network_management_client_enums import BastionConnectProtocol +from ._network_management_client_enums import BastionHostSkuName +from ._network_management_client_enums import BgpPeerState +from ._network_management_client_enums import CircuitConnectionStatus +from ._network_management_client_enums import CommissionedState +from ._network_management_client_enums import ConfigurationType +from ._network_management_client_enums import ConnectionMonitorEndpointFilterItemType +from ._network_management_client_enums import ConnectionMonitorEndpointFilterType +from ._network_management_client_enums import ConnectionMonitorSourceStatus +from ._network_management_client_enums import ConnectionMonitorTestConfigurationProtocol +from ._network_management_client_enums import ConnectionMonitorType +from ._network_management_client_enums import ConnectionState +from ._network_management_client_enums import ConnectionStatus +from ._network_management_client_enums import ConnectivityTopology +from ._network_management_client_enums import CoverageLevel +from ._network_management_client_enums import CreatedByType +from ._network_management_client_enums import CustomIpPrefixType +from ._network_management_client_enums import DdosSettingsProtectionMode +from ._network_management_client_enums import DeleteExistingPeering +from ._network_management_client_enums import DeleteOptions +from ._network_management_client_enums import DeploymentStatus +from ._network_management_client_enums import DestinationPortBehavior +from ._network_management_client_enums import DhGroup +from ._network_management_client_enums import Direction +from ._network_management_client_enums import EffectiveAdminRuleKind +from ._network_management_client_enums import EffectiveRouteSource +from ._network_management_client_enums import EffectiveRouteState +from ._network_management_client_enums import EffectiveSecurityRuleProtocol +from ._network_management_client_enums import EndpointType +from ._network_management_client_enums import EvaluationState +from ._network_management_client_enums import ExpressRouteCircuitPeeringAdvertisedPublicPrefixState +from ._network_management_client_enums import ExpressRouteCircuitPeeringState +from ._network_management_client_enums import ExpressRouteCircuitSkuFamily +from ._network_management_client_enums import ExpressRouteCircuitSkuTier +from ._network_management_client_enums import ExpressRouteLinkAdminState +from ._network_management_client_enums import ExpressRouteLinkConnectorType +from ._network_management_client_enums import ExpressRouteLinkMacSecCipher +from ._network_management_client_enums import ExpressRouteLinkMacSecSciState +from ._network_management_client_enums import ExpressRoutePeeringState +from ._network_management_client_enums import ExpressRoutePeeringType +from ._network_management_client_enums import ExpressRoutePortAuthorizationUseStatus +from ._network_management_client_enums import ExpressRoutePortsBillingType +from ._network_management_client_enums import ExpressRoutePortsEncapsulation +from ._network_management_client_enums import ExtendedLocationTypes +from ._network_management_client_enums import FirewallPolicyFilterRuleCollectionActionType +from ._network_management_client_enums import FirewallPolicyIDPSQuerySortOrder +from ._network_management_client_enums import FirewallPolicyIDPSSignatureDirection +from ._network_management_client_enums import FirewallPolicyIDPSSignatureMode +from ._network_management_client_enums import FirewallPolicyIDPSSignatureSeverity +from ._network_management_client_enums import FirewallPolicyIntrusionDetectionProfileType +from ._network_management_client_enums import FirewallPolicyIntrusionDetectionProtocol +from ._network_management_client_enums import FirewallPolicyIntrusionDetectionStateType +from ._network_management_client_enums import FirewallPolicyNatRuleCollectionActionType +from ._network_management_client_enums import FirewallPolicyRuleApplicationProtocolType +from ._network_management_client_enums import FirewallPolicyRuleCollectionType +from ._network_management_client_enums import FirewallPolicyRuleNetworkProtocol +from ._network_management_client_enums import FirewallPolicyRuleType +from ._network_management_client_enums import FirewallPolicySkuTier +from ._network_management_client_enums import FlowLogFormatType +from ._network_management_client_enums import GatewayLoadBalancerTunnelInterfaceType +from ._network_management_client_enums import GatewayLoadBalancerTunnelProtocol +from ._network_management_client_enums import Geo +from ._network_management_client_enums import GroupConnectivity +from ._network_management_client_enums import HTTPConfigurationMethod +from ._network_management_client_enums import HTTPMethod +from ._network_management_client_enums import HubBgpConnectionStatus +from ._network_management_client_enums import HubRoutingPreference +from ._network_management_client_enums import HubVirtualNetworkConnectionStatus +from ._network_management_client_enums import IPAllocationMethod +from ._network_management_client_enums import IPVersion +from ._network_management_client_enums import IkeEncryption +from ._network_management_client_enums import IkeIntegrity +from ._network_management_client_enums import InboundSecurityRulesProtocol +from ._network_management_client_enums import IpAllocationType +from ._network_management_client_enums import IpFlowProtocol +from ._network_management_client_enums import IpsecEncryption +from ._network_management_client_enums import IpsecIntegrity +from ._network_management_client_enums import IsGlobal +from ._network_management_client_enums import IsWorkloadProtected +from ._network_management_client_enums import IssueType +from ._network_management_client_enums import LoadBalancerBackendAddressAdminState +from ._network_management_client_enums import LoadBalancerOutboundRuleProtocol +from ._network_management_client_enums import LoadBalancerSkuName +from ._network_management_client_enums import LoadBalancerSkuTier +from ._network_management_client_enums import LoadDistribution +from ._network_management_client_enums import ManagedRuleEnabledState +from ._network_management_client_enums import NatGatewaySkuName +from ._network_management_client_enums import NetworkIntentPolicyBasedService +from ._network_management_client_enums import NetworkInterfaceAuxiliaryMode +from ._network_management_client_enums import NetworkInterfaceAuxiliarySku +from ._network_management_client_enums import NetworkInterfaceMigrationPhase +from ._network_management_client_enums import NetworkInterfaceNicType +from ._network_management_client_enums import NetworkOperationStatus +from ._network_management_client_enums import NextHopType +from ._network_management_client_enums import NextStep +from ._network_management_client_enums import OfficeTrafficCategory +from ._network_management_client_enums import Origin +from ._network_management_client_enums import OutputType +from ._network_management_client_enums import OwaspCrsExclusionEntryMatchVariable +from ._network_management_client_enums import OwaspCrsExclusionEntrySelectorMatchOperator +from ._network_management_client_enums import PacketCaptureTargetType +from ._network_management_client_enums import PcError +from ._network_management_client_enums import PcProtocol +from ._network_management_client_enums import PcStatus +from ._network_management_client_enums import PfsGroup +from ._network_management_client_enums import PreferredIPVersion +from ._network_management_client_enums import PreferredRoutingGateway +from ._network_management_client_enums import ProbeProtocol +from ._network_management_client_enums import ProcessorArchitecture +from ._network_management_client_enums import Protocol +from ._network_management_client_enums import ProtocolType +from ._network_management_client_enums import ProvisioningState +from ._network_management_client_enums import PublicIPAddressMigrationPhase +from ._network_management_client_enums import PublicIPAddressSkuName +from ._network_management_client_enums import PublicIPAddressSkuTier +from ._network_management_client_enums import PublicIPPrefixSkuName +from ._network_management_client_enums import PublicIPPrefixSkuTier +from ._network_management_client_enums import PublicIpAddressDnsSettingsDomainNameLabelScope +from ._network_management_client_enums import ResourceIdentityType +from ._network_management_client_enums import RouteFilterRuleType +from ._network_management_client_enums import RouteMapActionType +from ._network_management_client_enums import RouteMapMatchCondition +from ._network_management_client_enums import RouteNextHopType +from ._network_management_client_enums import RoutingState +from ._network_management_client_enums import ScopeConnectionState +from ._network_management_client_enums import ScrubbingRuleEntryMatchOperator +from ._network_management_client_enums import ScrubbingRuleEntryMatchVariable +from ._network_management_client_enums import ScrubbingRuleEntryState +from ._network_management_client_enums import SecurityConfigurationRuleAccess +from ._network_management_client_enums import SecurityConfigurationRuleDirection +from ._network_management_client_enums import SecurityConfigurationRuleProtocol +from ._network_management_client_enums import SecurityPartnerProviderConnectionStatus +from ._network_management_client_enums import SecurityProviderName +from ._network_management_client_enums import SecurityRuleAccess +from ._network_management_client_enums import SecurityRuleDirection +from ._network_management_client_enums import SecurityRuleProtocol +from ._network_management_client_enums import ServiceProviderProvisioningState +from ._network_management_client_enums import Severity +from ._network_management_client_enums import SlotType +from ._network_management_client_enums import SyncMode +from ._network_management_client_enums import SyncRemoteAddressSpace +from ._network_management_client_enums import TransportProtocol +from ._network_management_client_enums import TunnelConnectionStatus +from ._network_management_client_enums import UsageUnit +from ._network_management_client_enums import UseHubGateway +from ._network_management_client_enums import VerbosityLevel +from ._network_management_client_enums import VirtualNetworkEncryptionEnforcement +from ._network_management_client_enums import VirtualNetworkGatewayConnectionMode +from ._network_management_client_enums import VirtualNetworkGatewayConnectionProtocol +from ._network_management_client_enums import VirtualNetworkGatewayConnectionStatus +from ._network_management_client_enums import VirtualNetworkGatewayConnectionType +from ._network_management_client_enums import VirtualNetworkGatewaySkuName +from ._network_management_client_enums import VirtualNetworkGatewaySkuTier +from ._network_management_client_enums import VirtualNetworkGatewayType +from ._network_management_client_enums import VirtualNetworkPeeringLevel +from ._network_management_client_enums import VirtualNetworkPeeringState +from ._network_management_client_enums import VirtualNetworkPrivateEndpointNetworkPolicies +from ._network_management_client_enums import VirtualNetworkPrivateLinkServiceNetworkPolicies +from ._network_management_client_enums import VirtualWanSecurityProviderType +from ._network_management_client_enums import VnetLocalRouteOverrideCriteria +from ._network_management_client_enums import VpnAuthenticationType +from ._network_management_client_enums import VpnClientProtocol +from ._network_management_client_enums import VpnConnectionStatus +from ._network_management_client_enums import VpnGatewayGeneration +from ._network_management_client_enums import VpnGatewayTunnelingProtocol +from ._network_management_client_enums import VpnLinkConnectionMode +from ._network_management_client_enums import VpnNatRuleMode +from ._network_management_client_enums import VpnNatRuleType +from ._network_management_client_enums import VpnPolicyMemberAttributeType +from ._network_management_client_enums import VpnType +from ._network_management_client_enums import WebApplicationFirewallAction +from ._network_management_client_enums import WebApplicationFirewallEnabledState +from ._network_management_client_enums import WebApplicationFirewallMatchVariable +from ._network_management_client_enums import WebApplicationFirewallMode +from ._network_management_client_enums import WebApplicationFirewallOperator +from ._network_management_client_enums import WebApplicationFirewallPolicyResourceState +from ._network_management_client_enums import WebApplicationFirewallRuleType +from ._network_management_client_enums import WebApplicationFirewallScrubbingState +from ._network_management_client_enums import WebApplicationFirewallState +from ._network_management_client_enums import WebApplicationFirewallTransform +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AadAuthenticationParameters", + "Action", + "ActiveBaseSecurityAdminRule", + "ActiveConfigurationParameter", + "ActiveConnectivityConfiguration", + "ActiveConnectivityConfigurationsListResult", + "ActiveDefaultSecurityAdminRule", + "ActiveSecurityAdminRule", + "ActiveSecurityAdminRulesListResult", + "AddressPrefixItem", + "AddressSpace", + "AdminRule", + "AdminRuleCollection", + "AdminRuleCollectionListResult", + "AdminRuleListResult", + "ApplicationGateway", + "ApplicationGatewayAuthenticationCertificate", + "ApplicationGatewayAutoscaleConfiguration", + "ApplicationGatewayAvailableSslOptions", + "ApplicationGatewayAvailableSslPredefinedPolicies", + "ApplicationGatewayAvailableWafRuleSetsResult", + "ApplicationGatewayBackendAddress", + "ApplicationGatewayBackendAddressPool", + "ApplicationGatewayBackendHealth", + "ApplicationGatewayBackendHealthHttpSettings", + "ApplicationGatewayBackendHealthOnDemand", + "ApplicationGatewayBackendHealthPool", + "ApplicationGatewayBackendHealthServer", + "ApplicationGatewayBackendHttpSettings", + "ApplicationGatewayBackendSettings", + "ApplicationGatewayClientAuthConfiguration", + "ApplicationGatewayConnectionDraining", + "ApplicationGatewayCustomError", + "ApplicationGatewayFirewallDisabledRuleGroup", + "ApplicationGatewayFirewallExclusion", + "ApplicationGatewayFirewallManifestRuleSet", + "ApplicationGatewayFirewallRule", + "ApplicationGatewayFirewallRuleGroup", + "ApplicationGatewayFirewallRuleSet", + "ApplicationGatewayFrontendIPConfiguration", + "ApplicationGatewayFrontendPort", + "ApplicationGatewayGlobalConfiguration", + "ApplicationGatewayHeaderConfiguration", + "ApplicationGatewayHttpListener", + "ApplicationGatewayIPConfiguration", + "ApplicationGatewayListResult", + "ApplicationGatewayListener", + "ApplicationGatewayLoadDistributionPolicy", + "ApplicationGatewayLoadDistributionTarget", + "ApplicationGatewayOnDemandProbe", + "ApplicationGatewayPathRule", + "ApplicationGatewayPrivateEndpointConnection", + "ApplicationGatewayPrivateEndpointConnectionListResult", + "ApplicationGatewayPrivateLinkConfiguration", + "ApplicationGatewayPrivateLinkIpConfiguration", + "ApplicationGatewayPrivateLinkResource", + "ApplicationGatewayPrivateLinkResourceListResult", + "ApplicationGatewayProbe", + "ApplicationGatewayProbeHealthResponseMatch", + "ApplicationGatewayRedirectConfiguration", + "ApplicationGatewayRequestRoutingRule", + "ApplicationGatewayRewriteRule", + "ApplicationGatewayRewriteRuleActionSet", + "ApplicationGatewayRewriteRuleCondition", + "ApplicationGatewayRewriteRuleSet", + "ApplicationGatewayRoutingRule", + "ApplicationGatewaySku", + "ApplicationGatewaySslCertificate", + "ApplicationGatewaySslPolicy", + "ApplicationGatewaySslPredefinedPolicy", + "ApplicationGatewaySslProfile", + "ApplicationGatewayTrustedClientCertificate", + "ApplicationGatewayTrustedRootCertificate", + "ApplicationGatewayUrlConfiguration", + "ApplicationGatewayUrlPathMap", + "ApplicationGatewayWafDynamicManifestResult", + "ApplicationGatewayWafDynamicManifestResultList", + "ApplicationGatewayWebApplicationFirewallConfiguration", + "ApplicationRule", + "ApplicationSecurityGroup", + "ApplicationSecurityGroupListResult", + "AuthorizationListResult", + "AutoApprovedPrivateLinkService", + "AutoApprovedPrivateLinkServicesResult", + "Availability", + "AvailableDelegation", + "AvailableDelegationsResult", + "AvailablePrivateEndpointType", + "AvailablePrivateEndpointTypesResult", + "AvailableProvidersList", + "AvailableProvidersListCity", + "AvailableProvidersListCountry", + "AvailableProvidersListParameters", + "AvailableProvidersListState", + "AvailableServiceAlias", + "AvailableServiceAliasesResult", + "AzureAsyncOperationResult", + "AzureFirewall", + "AzureFirewallApplicationRule", + "AzureFirewallApplicationRuleCollection", + "AzureFirewallApplicationRuleProtocol", + "AzureFirewallFqdnTag", + "AzureFirewallFqdnTagListResult", + "AzureFirewallIPConfiguration", + "AzureFirewallIpGroups", + "AzureFirewallListResult", + "AzureFirewallNatRCAction", + "AzureFirewallNatRule", + "AzureFirewallNatRuleCollection", + "AzureFirewallNetworkRule", + "AzureFirewallNetworkRuleCollection", + "AzureFirewallPacketCaptureFlags", + "AzureFirewallPacketCaptureRule", + "AzureFirewallPublicIPAddress", + "AzureFirewallRCAction", + "AzureFirewallSku", + "AzureReachabilityReport", + "AzureReachabilityReportItem", + "AzureReachabilityReportLatencyInfo", + "AzureReachabilityReportLocation", + "AzureReachabilityReportParameters", + "AzureWebCategory", + "AzureWebCategoryListResult", + "BGPCommunity", + "BackendAddressInboundNatRulePortMappings", + "BackendAddressPool", + "BaseAdminRule", + "BastionActiveSession", + "BastionActiveSessionListResult", + "BastionHost", + "BastionHostIPConfiguration", + "BastionHostListResult", + "BastionHostPropertiesFormatNetworkAcls", + "BastionSessionDeleteResult", + "BastionSessionState", + "BastionShareableLink", + "BastionShareableLinkListRequest", + "BastionShareableLinkListResult", + "BastionShareableLinkTokenListRequest", + "BgpConnection", + "BgpPeerStatus", + "BgpPeerStatusListResult", + "BgpServiceCommunity", + "BgpServiceCommunityListResult", + "BgpSettings", + "BreakOutCategoryPolicies", + "CheckPrivateLinkServiceVisibilityRequest", + "ChildResource", + "CloudErrorBody", + "Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties", + "ConfigurationGroup", + "ConnectionMonitor", + "ConnectionMonitorDestination", + "ConnectionMonitorEndpoint", + "ConnectionMonitorEndpointFilter", + "ConnectionMonitorEndpointFilterItem", + "ConnectionMonitorEndpointScope", + "ConnectionMonitorEndpointScopeItem", + "ConnectionMonitorHttpConfiguration", + "ConnectionMonitorIcmpConfiguration", + "ConnectionMonitorListResult", + "ConnectionMonitorOutput", + "ConnectionMonitorParameters", + "ConnectionMonitorQueryResult", + "ConnectionMonitorResult", + "ConnectionMonitorResultProperties", + "ConnectionMonitorSource", + "ConnectionMonitorSuccessThreshold", + "ConnectionMonitorTcpConfiguration", + "ConnectionMonitorTestConfiguration", + "ConnectionMonitorTestGroup", + "ConnectionMonitorWorkspaceSettings", + "ConnectionResetSharedKey", + "ConnectionSharedKey", + "ConnectionStateSnapshot", + "ConnectivityConfiguration", + "ConnectivityConfigurationListResult", + "ConnectivityDestination", + "ConnectivityGroupItem", + "ConnectivityHop", + "ConnectivityInformation", + "ConnectivityIssue", + "ConnectivityParameters", + "ConnectivitySource", + "Container", + "ContainerNetworkInterface", + "ContainerNetworkInterfaceConfiguration", + "ContainerNetworkInterfaceIpConfiguration", + "Criterion", + "CrossTenantScopes", + "CustomDnsConfigPropertiesFormat", + "CustomIpPrefix", + "CustomIpPrefixListResult", + "DdosCustomPolicy", + "DdosProtectionPlan", + "DdosProtectionPlanListResult", + "DdosSettings", + "DefaultAdminRule", + "Delegation", + "DelegationProperties", + "DeviceProperties", + "DhcpOptions", + "Dimension", + "DnsNameAvailabilityResult", + "DnsSettings", + "DscpConfiguration", + "DscpConfigurationListResult", + "EffectiveBaseSecurityAdminRule", + "EffectiveConnectivityConfiguration", + "EffectiveDefaultSecurityAdminRule", + "EffectiveNetworkSecurityGroup", + "EffectiveNetworkSecurityGroupAssociation", + "EffectiveNetworkSecurityGroupListResult", + "EffectiveNetworkSecurityRule", + "EffectiveRoute", + "EffectiveRouteListResult", + "EffectiveRouteMapRoute", + "EffectiveRouteMapRouteList", + "EffectiveRoutesParameters", + "EffectiveSecurityAdminRule", + "EndpointServiceResult", + "EndpointServicesListResult", + "Error", + "ErrorDetails", + "ErrorResponse", + "EvaluatedNetworkSecurityGroup", + "ExclusionManagedRule", + "ExclusionManagedRuleGroup", + "ExclusionManagedRuleSet", + "ExplicitProxy", + "ExpressRouteCircuit", + "ExpressRouteCircuitArpTable", + "ExpressRouteCircuitAuthorization", + "ExpressRouteCircuitConnection", + "ExpressRouteCircuitConnectionListResult", + "ExpressRouteCircuitListResult", + "ExpressRouteCircuitPeering", + "ExpressRouteCircuitPeeringConfig", + "ExpressRouteCircuitPeeringId", + "ExpressRouteCircuitPeeringListResult", + "ExpressRouteCircuitReference", + "ExpressRouteCircuitRoutesTable", + "ExpressRouteCircuitRoutesTableSummary", + "ExpressRouteCircuitServiceProviderProperties", + "ExpressRouteCircuitSku", + "ExpressRouteCircuitStats", + "ExpressRouteCircuitsArpTableListResult", + "ExpressRouteCircuitsRoutesTableListResult", + "ExpressRouteCircuitsRoutesTableSummaryListResult", + "ExpressRouteConnection", + "ExpressRouteConnectionId", + "ExpressRouteConnectionList", + "ExpressRouteCrossConnection", + "ExpressRouteCrossConnectionListResult", + "ExpressRouteCrossConnectionPeering", + "ExpressRouteCrossConnectionPeeringList", + "ExpressRouteCrossConnectionRoutesTableSummary", + "ExpressRouteCrossConnectionsRoutesTableSummaryListResult", + "ExpressRouteGateway", + "ExpressRouteGatewayList", + "ExpressRouteGatewayPropertiesAutoScaleConfiguration", + "ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds", + "ExpressRouteLink", + "ExpressRouteLinkListResult", + "ExpressRouteLinkMacSecConfig", + "ExpressRoutePort", + "ExpressRoutePortAuthorization", + "ExpressRoutePortAuthorizationListResult", + "ExpressRoutePortListResult", + "ExpressRoutePortsLocation", + "ExpressRoutePortsLocationBandwidths", + "ExpressRoutePortsLocationListResult", + "ExpressRouteProviderPort", + "ExpressRouteProviderPortListResult", + "ExpressRouteServiceProvider", + "ExpressRouteServiceProviderBandwidthsOffered", + "ExpressRouteServiceProviderListResult", + "ExtendedLocation", + "FilterItems", + "FirewallPacketCaptureParameters", + "FirewallPolicy", + "FirewallPolicyCertificateAuthority", + "FirewallPolicyFilterRuleCollection", + "FirewallPolicyFilterRuleCollectionAction", + "FirewallPolicyHttpHeaderToInsert", + "FirewallPolicyInsights", + "FirewallPolicyIntrusionDetection", + "FirewallPolicyIntrusionDetectionBypassTrafficSpecifications", + "FirewallPolicyIntrusionDetectionConfiguration", + "FirewallPolicyIntrusionDetectionSignatureSpecification", + "FirewallPolicyListResult", + "FirewallPolicyLogAnalyticsResources", + "FirewallPolicyLogAnalyticsWorkspace", + "FirewallPolicyNatRuleCollection", + "FirewallPolicyNatRuleCollectionAction", + "FirewallPolicyRule", + "FirewallPolicyRuleApplicationProtocol", + "FirewallPolicyRuleCollection", + "FirewallPolicyRuleCollectionGroup", + "FirewallPolicyRuleCollectionGroupListResult", + "FirewallPolicySNAT", + "FirewallPolicySQL", + "FirewallPolicySku", + "FirewallPolicyThreatIntelWhitelist", + "FirewallPolicyTransportSecurity", + "FlowLog", + "FlowLogFormatParameters", + "FlowLogInformation", + "FlowLogListResult", + "FlowLogStatusParameters", + "FrontendIPConfiguration", + "GatewayCustomBgpIpAddressIpConfiguration", + "GatewayLoadBalancerTunnelInterface", + "GatewayRoute", + "GatewayRouteListResult", + "GenerateExpressRoutePortsLOARequest", + "GenerateExpressRoutePortsLOAResult", + "GetInboundRoutesParameters", + "GetOutboundRoutesParameters", + "GetVpnSitesConfigurationRequest", + "GroupByUserSession", + "GroupByVariable", + "HTTPConfiguration", + "HTTPHeader", + "HopLink", + "Hub", + "HubIPAddresses", + "HubIpConfiguration", + "HubPublicIPAddresses", + "HubRoute", + "HubRouteTable", + "HubVirtualNetworkConnection", + "IDPSQueryObject", + "IPAddressAvailabilityResult", + "IPConfiguration", + "IPConfigurationBgpPeeringAddress", + "IPConfigurationProfile", + "IPPrefixesList", + "IPRule", + "InboundNatPool", + "InboundNatRule", + "InboundNatRuleListResult", + "InboundNatRulePortMapping", + "InboundSecurityRule", + "InboundSecurityRules", + "InternetIngressPublicIpsProperties", + "IpAllocation", + "IpAllocationListResult", + "IpGroup", + "IpGroupListResult", + "IpTag", + "IpsecPolicy", + "Ipv6CircuitConnectionConfig", + "Ipv6ExpressRouteCircuitPeeringConfig", + "ListHubRouteTablesResult", + "ListHubVirtualNetworkConnectionsResult", + "ListP2SVpnGatewaysResult", + "ListRouteMapsResult", + "ListRoutingIntentResult", + "ListVirtualHubBgpConnectionResults", + "ListVirtualHubIpConfigurationResults", + "ListVirtualHubRouteTableV2SResult", + "ListVirtualHubsResult", + "ListVirtualNetworkGatewayNatRulesResult", + "ListVirtualWANsResult", + "ListVpnConnectionsResult", + "ListVpnGatewayNatRulesResult", + "ListVpnGatewaysResult", + "ListVpnServerConfigurationPolicyGroupsResult", + "ListVpnServerConfigurationsResult", + "ListVpnSiteLinkConnectionsResult", + "ListVpnSiteLinksResult", + "ListVpnSitesResult", + "LoadBalancer", + "LoadBalancerBackendAddress", + "LoadBalancerBackendAddressPoolListResult", + "LoadBalancerFrontendIPConfigurationListResult", + "LoadBalancerListResult", + "LoadBalancerLoadBalancingRuleListResult", + "LoadBalancerOutboundRuleListResult", + "LoadBalancerProbeListResult", + "LoadBalancerSku", + "LoadBalancerVipSwapRequest", + "LoadBalancerVipSwapRequestFrontendIPConfiguration", + "LoadBalancingRule", + "LocalNetworkGateway", + "LocalNetworkGatewayListResult", + "LogSpecification", + "ManagedRuleGroupOverride", + "ManagedRuleOverride", + "ManagedRuleSet", + "ManagedRulesDefinition", + "ManagedServiceIdentity", + "MatchCondition", + "MatchVariable", + "MatchedRule", + "MetricSpecification", + "MigrateLoadBalancerToIpBasedRequest", + "MigratedPools", + "NatGateway", + "NatGatewayListResult", + "NatGatewaySku", + "NatRule", + "NatRulePortMapping", + "NetworkConfigurationDiagnosticParameters", + "NetworkConfigurationDiagnosticProfile", + "NetworkConfigurationDiagnosticResponse", + "NetworkConfigurationDiagnosticResult", + "NetworkGroup", + "NetworkGroupListResult", + "NetworkIntentPolicy", + "NetworkIntentPolicyConfiguration", + "NetworkInterface", + "NetworkInterfaceAssociation", + "NetworkInterfaceDnsSettings", + "NetworkInterfaceIPConfiguration", + "NetworkInterfaceIPConfigurationListResult", + "NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties", + "NetworkInterfaceListResult", + "NetworkInterfaceLoadBalancerListResult", + "NetworkInterfaceTapConfiguration", + "NetworkInterfaceTapConfigurationListResult", + "NetworkManager", + "NetworkManagerCommit", + "NetworkManagerConnection", + "NetworkManagerConnectionListResult", + "NetworkManagerDeploymentStatus", + "NetworkManagerDeploymentStatusListResult", + "NetworkManagerDeploymentStatusParameter", + "NetworkManagerEffectiveConnectivityConfigurationListResult", + "NetworkManagerEffectiveSecurityAdminRulesListResult", + "NetworkManagerListResult", + "NetworkManagerPropertiesNetworkManagerScopes", + "NetworkManagerSecurityGroupItem", + "NetworkProfile", + "NetworkProfileListResult", + "NetworkRule", + "NetworkSecurityGroup", + "NetworkSecurityGroupListResult", + "NetworkSecurityGroupResult", + "NetworkSecurityRulesEvaluationResult", + "NetworkVirtualAppliance", + "NetworkVirtualApplianceConnection", + "NetworkVirtualApplianceConnectionList", + "NetworkVirtualApplianceListResult", + "NetworkVirtualApplianceSiteListResult", + "NetworkVirtualApplianceSku", + "NetworkVirtualApplianceSkuInstances", + "NetworkVirtualApplianceSkuListResult", + "NetworkWatcher", + "NetworkWatcherListResult", + "NextHopParameters", + "NextHopResult", + "O365BreakOutCategoryPolicies", + "O365PolicyProperties", + "Office365PolicyProperties", + "Operation", + "OperationDisplay", + "OperationListResult", + "OperationPropertiesFormatServiceSpecification", + "OrderBy", + "OutboundRule", + "OwaspCrsExclusionEntry", + "P2SConnectionConfiguration", + "P2SVpnConnectionHealth", + "P2SVpnConnectionHealthRequest", + "P2SVpnConnectionRequest", + "P2SVpnGateway", + "P2SVpnProfileParameters", + "PacketCapture", + "PacketCaptureFilter", + "PacketCaptureListResult", + "PacketCaptureMachineScope", + "PacketCaptureParameters", + "PacketCaptureQueryStatusResult", + "PacketCaptureResult", + "PacketCaptureResultProperties", + "PacketCaptureStorageLocation", + "Parameter", + "PartnerManagedResourceProperties", + "PatchObject", + "PatchRouteFilter", + "PatchRouteFilterRule", + "PeerExpressRouteCircuitConnection", + "PeerExpressRouteCircuitConnectionListResult", + "PeerRoute", + "PolicySettings", + "PolicySettingsLogScrubbing", + "PrepareNetworkPoliciesRequest", + "PrivateDnsZoneConfig", + "PrivateDnsZoneGroup", + "PrivateDnsZoneGroupListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateEndpointIPConfiguration", + "PrivateEndpointListResult", + "PrivateLinkService", + "PrivateLinkServiceConnection", + "PrivateLinkServiceConnectionState", + "PrivateLinkServiceIpConfiguration", + "PrivateLinkServiceListResult", + "PrivateLinkServicePropertiesAutoApproval", + "PrivateLinkServicePropertiesVisibility", + "PrivateLinkServiceVisibility", + "Probe", + "PropagatedRouteTable", + "ProtocolConfiguration", + "PublicIPAddress", + "PublicIPAddressDnsSettings", + "PublicIPAddressListResult", + "PublicIPAddressSku", + "PublicIPPrefix", + "PublicIPPrefixListResult", + "PublicIPPrefixSku", + "PublicIpDdosProtectionStatusResult", + "QosDefinition", + "QosIpRange", + "QosPortRange", + "QueryInboundNatRulePortMappingRequest", + "QueryRequestOptions", + "QueryResults", + "QueryTroubleshootingParameters", + "RadiusServer", + "RecordSet", + "ReferencedPublicIpAddress", + "Resource", + "ResourceNavigationLink", + "ResourceNavigationLinksListResult", + "ResourceSet", + "RetentionPolicyParameters", + "Route", + "RouteFilter", + "RouteFilterListResult", + "RouteFilterRule", + "RouteFilterRuleListResult", + "RouteListResult", + "RouteMap", + "RouteMapRule", + "RouteTable", + "RouteTableListResult", + "RoutingConfiguration", + "RoutingIntent", + "RoutingPolicy", + "ScopeConnection", + "ScopeConnectionListResult", + "SecurityAdminConfiguration", + "SecurityAdminConfigurationListResult", + "SecurityGroupNetworkInterface", + "SecurityGroupViewParameters", + "SecurityGroupViewResult", + "SecurityPartnerProvider", + "SecurityPartnerProviderListResult", + "SecurityRule", + "SecurityRuleAssociations", + "SecurityRuleListResult", + "ServiceAssociationLink", + "ServiceAssociationLinksListResult", + "ServiceEndpointPolicy", + "ServiceEndpointPolicyDefinition", + "ServiceEndpointPolicyDefinitionListResult", + "ServiceEndpointPolicyListResult", + "ServiceEndpointPropertiesFormat", + "ServiceTagInformation", + "ServiceTagInformationListResult", + "ServiceTagInformationPropertiesFormat", + "ServiceTagsListResult", + "SessionIds", + "SignatureOverridesFilterValuesQuery", + "SignatureOverridesFilterValuesResponse", + "SignaturesOverrides", + "SignaturesOverridesList", + "SignaturesOverridesProperties", + "SingleQueryResult", + "Sku", + "StaticMember", + "StaticMemberListResult", + "StaticRoute", + "StaticRoutesConfig", + "SubResource", + "Subnet", + "SubnetAssociation", + "SubnetListResult", + "SwapResource", + "SwapResourceListResult", + "SwapResourceProperties", + "SystemData", + "TagsObject", + "Topology", + "TopologyAssociation", + "TopologyParameters", + "TopologyResource", + "TrafficAnalyticsConfigurationProperties", + "TrafficAnalyticsProperties", + "TrafficSelectorPolicy", + "TroubleshootingDetails", + "TroubleshootingParameters", + "TroubleshootingRecommendedActions", + "TroubleshootingResult", + "TunnelConnectionHealth", + "UnprepareNetworkPoliciesRequest", + "Usage", + "UsageName", + "UsagesListResult", + "VM", + "VerificationIPFlowParameters", + "VerificationIPFlowResult", + "VirtualApplianceAdditionalNicProperties", + "VirtualApplianceNicProperties", + "VirtualApplianceSite", + "VirtualApplianceSkuProperties", + "VirtualHub", + "VirtualHubEffectiveRoute", + "VirtualHubEffectiveRouteList", + "VirtualHubId", + "VirtualHubRoute", + "VirtualHubRouteTable", + "VirtualHubRouteTableV2", + "VirtualHubRouteV2", + "VirtualNetwork", + "VirtualNetworkBgpCommunities", + "VirtualNetworkConnectionGatewayReference", + "VirtualNetworkDdosProtectionStatusResult", + "VirtualNetworkEncryption", + "VirtualNetworkGateway", + "VirtualNetworkGatewayAutoScaleBounds", + "VirtualNetworkGatewayAutoScaleConfiguration", + "VirtualNetworkGatewayConnection", + "VirtualNetworkGatewayConnectionListEntity", + "VirtualNetworkGatewayConnectionListResult", + "VirtualNetworkGatewayIPConfiguration", + "VirtualNetworkGatewayListConnectionsResult", + "VirtualNetworkGatewayListResult", + "VirtualNetworkGatewayNatRule", + "VirtualNetworkGatewayPolicyGroup", + "VirtualNetworkGatewayPolicyGroupMember", + "VirtualNetworkGatewaySku", + "VirtualNetworkListResult", + "VirtualNetworkListUsageResult", + "VirtualNetworkPeering", + "VirtualNetworkPeeringListResult", + "VirtualNetworkTap", + "VirtualNetworkTapListResult", + "VirtualNetworkUsage", + "VirtualNetworkUsageName", + "VirtualRouter", + "VirtualRouterAutoScaleConfiguration", + "VirtualRouterListResult", + "VirtualRouterPeering", + "VirtualRouterPeeringListResult", + "VirtualWAN", + "VirtualWanSecurityProvider", + "VirtualWanSecurityProviders", + "VirtualWanVpnProfileParameters", + "VnetRoute", + "VngClientConnectionConfiguration", + "VpnClientConfiguration", + "VpnClientConnectionHealth", + "VpnClientConnectionHealthDetail", + "VpnClientConnectionHealthDetailListResult", + "VpnClientIPsecParameters", + "VpnClientParameters", + "VpnClientRevokedCertificate", + "VpnClientRootCertificate", + "VpnConnection", + "VpnConnectionPacketCaptureStartParameters", + "VpnConnectionPacketCaptureStopParameters", + "VpnDeviceScriptParameters", + "VpnGateway", + "VpnGatewayIpConfiguration", + "VpnGatewayNatRule", + "VpnGatewayPacketCaptureStartParameters", + "VpnGatewayPacketCaptureStopParameters", + "VpnLinkBgpSettings", + "VpnLinkProviderProperties", + "VpnNatRuleMapping", + "VpnPacketCaptureStartParameters", + "VpnPacketCaptureStopParameters", + "VpnProfileResponse", + "VpnServerConfigRadiusClientRootCertificate", + "VpnServerConfigRadiusServerRootCertificate", + "VpnServerConfigVpnClientRevokedCertificate", + "VpnServerConfigVpnClientRootCertificate", + "VpnServerConfiguration", + "VpnServerConfigurationPolicyGroup", + "VpnServerConfigurationPolicyGroupMember", + "VpnServerConfigurationsResponse", + "VpnSite", + "VpnSiteId", + "VpnSiteLink", + "VpnSiteLinkConnection", + "WebApplicationFirewallCustomRule", + "WebApplicationFirewallPolicy", + "WebApplicationFirewallPolicyListResult", + "WebApplicationFirewallScrubbingRules", + "Access", + "ActionType", + "AddressPrefixType", + "AdminRuleKind", + "AdminState", + "ApplicationGatewayBackendHealthServerHealth", + "ApplicationGatewayClientRevocationOptions", + "ApplicationGatewayCookieBasedAffinity", + "ApplicationGatewayCustomErrorStatusCode", + "ApplicationGatewayFirewallMode", + "ApplicationGatewayFirewallRateLimitDuration", + "ApplicationGatewayFirewallUserSessionVariable", + "ApplicationGatewayLoadDistributionAlgorithm", + "ApplicationGatewayOperationalState", + "ApplicationGatewayProtocol", + "ApplicationGatewayRedirectType", + "ApplicationGatewayRequestRoutingRuleType", + "ApplicationGatewayRuleSetStatusOptions", + "ApplicationGatewaySkuName", + "ApplicationGatewaySslCipherSuite", + "ApplicationGatewaySslPolicyName", + "ApplicationGatewaySslPolicyType", + "ApplicationGatewaySslProtocol", + "ApplicationGatewayTier", + "ApplicationGatewayTierTypes", + "ApplicationGatewayWafRuleActionTypes", + "ApplicationGatewayWafRuleStateTypes", + "AssociationType", + "AuthenticationMethod", + "AuthorizationUseStatus", + "AutoLearnPrivateRangesMode", + "AzureFirewallApplicationRuleProtocolType", + "AzureFirewallNatRCActionType", + "AzureFirewallNetworkRuleProtocol", + "AzureFirewallPacketCaptureFlagsType", + "AzureFirewallRCActionType", + "AzureFirewallSkuName", + "AzureFirewallSkuTier", + "AzureFirewallThreatIntelMode", + "BastionConnectProtocol", + "BastionHostSkuName", + "BgpPeerState", + "CircuitConnectionStatus", + "CommissionedState", + "ConfigurationType", + "ConnectionMonitorEndpointFilterItemType", + "ConnectionMonitorEndpointFilterType", + "ConnectionMonitorSourceStatus", + "ConnectionMonitorTestConfigurationProtocol", + "ConnectionMonitorType", + "ConnectionState", + "ConnectionStatus", + "ConnectivityTopology", + "CoverageLevel", + "CreatedByType", + "CustomIpPrefixType", + "DdosSettingsProtectionMode", + "DeleteExistingPeering", + "DeleteOptions", + "DeploymentStatus", + "DestinationPortBehavior", + "DhGroup", + "Direction", + "EffectiveAdminRuleKind", + "EffectiveRouteSource", + "EffectiveRouteState", + "EffectiveSecurityRuleProtocol", + "EndpointType", + "EvaluationState", + "ExpressRouteCircuitPeeringAdvertisedPublicPrefixState", + "ExpressRouteCircuitPeeringState", + "ExpressRouteCircuitSkuFamily", + "ExpressRouteCircuitSkuTier", + "ExpressRouteLinkAdminState", + "ExpressRouteLinkConnectorType", + "ExpressRouteLinkMacSecCipher", + "ExpressRouteLinkMacSecSciState", + "ExpressRoutePeeringState", + "ExpressRoutePeeringType", + "ExpressRoutePortAuthorizationUseStatus", + "ExpressRoutePortsBillingType", + "ExpressRoutePortsEncapsulation", + "ExtendedLocationTypes", + "FirewallPolicyFilterRuleCollectionActionType", + "FirewallPolicyIDPSQuerySortOrder", + "FirewallPolicyIDPSSignatureDirection", + "FirewallPolicyIDPSSignatureMode", + "FirewallPolicyIDPSSignatureSeverity", + "FirewallPolicyIntrusionDetectionProfileType", + "FirewallPolicyIntrusionDetectionProtocol", + "FirewallPolicyIntrusionDetectionStateType", + "FirewallPolicyNatRuleCollectionActionType", + "FirewallPolicyRuleApplicationProtocolType", + "FirewallPolicyRuleCollectionType", + "FirewallPolicyRuleNetworkProtocol", + "FirewallPolicyRuleType", + "FirewallPolicySkuTier", + "FlowLogFormatType", + "GatewayLoadBalancerTunnelInterfaceType", + "GatewayLoadBalancerTunnelProtocol", + "Geo", + "GroupConnectivity", + "HTTPConfigurationMethod", + "HTTPMethod", + "HubBgpConnectionStatus", + "HubRoutingPreference", + "HubVirtualNetworkConnectionStatus", + "IPAllocationMethod", + "IPVersion", + "IkeEncryption", + "IkeIntegrity", + "InboundSecurityRulesProtocol", + "IpAllocationType", + "IpFlowProtocol", + "IpsecEncryption", + "IpsecIntegrity", + "IsGlobal", + "IsWorkloadProtected", + "IssueType", + "LoadBalancerBackendAddressAdminState", + "LoadBalancerOutboundRuleProtocol", + "LoadBalancerSkuName", + "LoadBalancerSkuTier", + "LoadDistribution", + "ManagedRuleEnabledState", + "NatGatewaySkuName", + "NetworkIntentPolicyBasedService", + "NetworkInterfaceAuxiliaryMode", + "NetworkInterfaceAuxiliarySku", + "NetworkInterfaceMigrationPhase", + "NetworkInterfaceNicType", + "NetworkOperationStatus", + "NextHopType", + "NextStep", + "OfficeTrafficCategory", + "Origin", + "OutputType", + "OwaspCrsExclusionEntryMatchVariable", + "OwaspCrsExclusionEntrySelectorMatchOperator", + "PacketCaptureTargetType", + "PcError", + "PcProtocol", + "PcStatus", + "PfsGroup", + "PreferredIPVersion", + "PreferredRoutingGateway", + "ProbeProtocol", + "ProcessorArchitecture", + "Protocol", + "ProtocolType", + "ProvisioningState", + "PublicIPAddressMigrationPhase", + "PublicIPAddressSkuName", + "PublicIPAddressSkuTier", + "PublicIPPrefixSkuName", + "PublicIPPrefixSkuTier", + "PublicIpAddressDnsSettingsDomainNameLabelScope", + "ResourceIdentityType", + "RouteFilterRuleType", + "RouteMapActionType", + "RouteMapMatchCondition", + "RouteNextHopType", + "RoutingState", + "ScopeConnectionState", + "ScrubbingRuleEntryMatchOperator", + "ScrubbingRuleEntryMatchVariable", + "ScrubbingRuleEntryState", + "SecurityConfigurationRuleAccess", + "SecurityConfigurationRuleDirection", + "SecurityConfigurationRuleProtocol", + "SecurityPartnerProviderConnectionStatus", + "SecurityProviderName", + "SecurityRuleAccess", + "SecurityRuleDirection", + "SecurityRuleProtocol", + "ServiceProviderProvisioningState", + "Severity", + "SlotType", + "SyncMode", + "SyncRemoteAddressSpace", + "TransportProtocol", + "TunnelConnectionStatus", + "UsageUnit", + "UseHubGateway", + "VerbosityLevel", + "VirtualNetworkEncryptionEnforcement", + "VirtualNetworkGatewayConnectionMode", + "VirtualNetworkGatewayConnectionProtocol", + "VirtualNetworkGatewayConnectionStatus", + "VirtualNetworkGatewayConnectionType", + "VirtualNetworkGatewaySkuName", + "VirtualNetworkGatewaySkuTier", + "VirtualNetworkGatewayType", + "VirtualNetworkPeeringLevel", + "VirtualNetworkPeeringState", + "VirtualNetworkPrivateEndpointNetworkPolicies", + "VirtualNetworkPrivateLinkServiceNetworkPolicies", + "VirtualWanSecurityProviderType", + "VnetLocalRouteOverrideCriteria", + "VpnAuthenticationType", + "VpnClientProtocol", + "VpnConnectionStatus", + "VpnGatewayGeneration", + "VpnGatewayTunnelingProtocol", + "VpnLinkConnectionMode", + "VpnNatRuleMode", + "VpnNatRuleType", + "VpnPolicyMemberAttributeType", + "VpnType", + "WebApplicationFirewallAction", + "WebApplicationFirewallEnabledState", + "WebApplicationFirewallMatchVariable", + "WebApplicationFirewallMode", + "WebApplicationFirewallOperator", + "WebApplicationFirewallPolicyResourceState", + "WebApplicationFirewallRuleType", + "WebApplicationFirewallScrubbingState", + "WebApplicationFirewallState", + "WebApplicationFirewallTransform", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_models_py3.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_models_py3.py new file mode 100644 index 000000000000..82cf323823e6 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_models_py3.py @@ -0,0 +1,39079 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class AadAuthenticationParameters(_serialization.Model): + """AAD Vpn authentication type related parameters. + + :ivar aad_tenant: AAD Vpn authentication parameter AAD tenant. + :vartype aad_tenant: str + :ivar aad_audience: AAD Vpn authentication parameter AAD audience. + :vartype aad_audience: str + :ivar aad_issuer: AAD Vpn authentication parameter AAD issuer. + :vartype aad_issuer: str + """ + + _attribute_map = { + "aad_tenant": {"key": "aadTenant", "type": "str"}, + "aad_audience": {"key": "aadAudience", "type": "str"}, + "aad_issuer": {"key": "aadIssuer", "type": "str"}, + } + + def __init__( + self, + *, + aad_tenant: Optional[str] = None, + aad_audience: Optional[str] = None, + aad_issuer: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword aad_tenant: AAD Vpn authentication parameter AAD tenant. + :paramtype aad_tenant: str + :keyword aad_audience: AAD Vpn authentication parameter AAD audience. + :paramtype aad_audience: str + :keyword aad_issuer: AAD Vpn authentication parameter AAD issuer. + :paramtype aad_issuer: str + """ + super().__init__(**kwargs) + self.aad_tenant = aad_tenant + self.aad_audience = aad_audience + self.aad_issuer = aad_issuer + + +class Action(_serialization.Model): + """Action to be taken on a route matching a RouteMap criterion. + + :ivar type: Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and + 'Drop.'. Known values are: "Unknown", "Remove", "Add", "Replace", and "Drop". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.RouteMapActionType + :ivar parameters: List of parameters relevant to the action.For instance if type is drop then + parameters has list of prefixes to be dropped.If type is add, parameters would have list of ASN + numbers to be added. + :vartype parameters: list[~azure.mgmt.network.v2023_09_01.models.Parameter] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "parameters": {"key": "parameters", "type": "[Parameter]"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.RouteMapActionType"]] = None, + parameters: Optional[List["_models.Parameter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and + 'Drop.'. Known values are: "Unknown", "Remove", "Add", "Replace", and "Drop". + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.RouteMapActionType + :keyword parameters: List of parameters relevant to the action.For instance if type is drop + then parameters has list of prefixes to be dropped.If type is add, parameters would have list + of ASN numbers to be added. + :paramtype parameters: list[~azure.mgmt.network.v2023_09_01.models.Parameter] + """ + super().__init__(**kwargs) + self.type = type + self.parameters = parameters + + +class ActiveBaseSecurityAdminRule(_serialization.Model): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ActiveSecurityAdminRule, ActiveDefaultSecurityAdminRule + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "commit_time": {"key": "commitTime", "type": "iso-8601"}, + "region": {"key": "region", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + } + + _subtype_map = {"kind": {"Custom": "ActiveSecurityAdminRule", "Default": "ActiveDefaultSecurityAdminRule"}} + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + """ + super().__init__(**kwargs) + self.id = id + self.commit_time = commit_time + self.region = region + self.configuration_description = configuration_description + self.rule_collection_description = rule_collection_description + self.rule_collection_applies_to_groups = rule_collection_applies_to_groups + self.rule_groups = rule_groups + self.kind: Optional[str] = None + + +class ActiveConfigurationParameter(_serialization.Model): + """Effective Virtual Networks Parameter. + + :ivar regions: List of regions. + :vartype regions: list[str] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "regions": {"key": "regions", "type": "[str]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__(self, *, regions: Optional[List[str]] = None, skip_token: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword regions: List of regions. + :paramtype regions: list[str] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.regions = regions + self.skip_token = skip_token + + +class EffectiveConnectivityConfiguration(_serialization.Model): + """The network manager effective connectivity configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Connectivity configuration ID. + :vartype id: str + :ivar configuration_groups: Effective configuration groups. + :vartype configuration_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :ivar is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :vartype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Known values + are: "False" and "True". + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "configuration_groups": {"key": "configurationGroups", "type": "[ConfigurationGroup]"}, + "description": {"key": "properties.description", "type": "str"}, + "connectivity_topology": {"key": "properties.connectivityTopology", "type": "str"}, + "hubs": {"key": "properties.hubs", "type": "[Hub]"}, + "is_global": {"key": "properties.isGlobal", "type": "str"}, + "applies_to_groups": {"key": "properties.appliesToGroups", "type": "[ConnectivityGroupItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "delete_existing_peering": {"key": "properties.deleteExistingPeering", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + configuration_groups: Optional[List["_models.ConfigurationGroup"]] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "_models.ConnectivityTopology"]] = None, + hubs: Optional[List["_models.Hub"]] = None, + is_global: Optional[Union[str, "_models.IsGlobal"]] = None, + applies_to_groups: Optional[List["_models.ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[Union[str, "_models.DeleteExistingPeering"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Connectivity configuration ID. + :paramtype id: str + :keyword configuration_groups: Effective configuration groups. + :paramtype configuration_groups: + list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :keyword is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :paramtype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Known + values are: "False" and "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + """ + super().__init__(**kwargs) + self.id = id + self.configuration_groups = configuration_groups + self.description = description + self.connectivity_topology = connectivity_topology + self.hubs = hubs + self.is_global = is_global + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.delete_existing_peering = delete_existing_peering + self.resource_guid = None + + +class ActiveConnectivityConfiguration( + EffectiveConnectivityConfiguration +): # pylint: disable=too-many-instance-attributes + """Active connectivity configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Connectivity configuration ID. + :vartype id: str + :ivar configuration_groups: Effective configuration groups. + :vartype configuration_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :ivar is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :vartype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Known values + are: "False" and "True". + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "configuration_groups": {"key": "configurationGroups", "type": "[ConfigurationGroup]"}, + "description": {"key": "properties.description", "type": "str"}, + "connectivity_topology": {"key": "properties.connectivityTopology", "type": "str"}, + "hubs": {"key": "properties.hubs", "type": "[Hub]"}, + "is_global": {"key": "properties.isGlobal", "type": "str"}, + "applies_to_groups": {"key": "properties.appliesToGroups", "type": "[ConnectivityGroupItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "delete_existing_peering": {"key": "properties.deleteExistingPeering", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "commit_time": {"key": "commitTime", "type": "iso-8601"}, + "region": {"key": "region", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + configuration_groups: Optional[List["_models.ConfigurationGroup"]] = None, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "_models.ConnectivityTopology"]] = None, + hubs: Optional[List["_models.Hub"]] = None, + is_global: Optional[Union[str, "_models.IsGlobal"]] = None, + applies_to_groups: Optional[List["_models.ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[Union[str, "_models.DeleteExistingPeering"]] = None, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Connectivity configuration ID. + :paramtype id: str + :keyword configuration_groups: Effective configuration groups. + :paramtype configuration_groups: + list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :keyword is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :paramtype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Known + values are: "False" and "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + """ + super().__init__( + id=id, + configuration_groups=configuration_groups, + description=description, + connectivity_topology=connectivity_topology, + hubs=hubs, + is_global=is_global, + applies_to_groups=applies_to_groups, + delete_existing_peering=delete_existing_peering, + **kwargs + ) + self.commit_time = commit_time + self.region = region + + +class ActiveConnectivityConfigurationsListResult(_serialization.Model): + """Result of the request to list active connectivity configurations. It contains a list of active + connectivity configurations and a skiptoken to get the next set of results. + + :ivar value: Gets a page of active connectivity configurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfiguration] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ActiveConnectivityConfiguration]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ActiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of active connectivity configurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfiguration] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class ActiveDefaultSecurityAdminRule(ActiveBaseSecurityAdminRule): # pylint: disable=too-many-instance-attributes + """Network default admin rule. + + 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: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar flag: Default rule flag. + :vartype flag: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "kind": {"required": True}, + "description": {"readonly": True}, + "protocol": {"readonly": True}, + "sources": {"readonly": True}, + "destinations": {"readonly": True}, + "source_port_ranges": {"readonly": True}, + "destination_port_ranges": {"readonly": True}, + "access": {"readonly": True}, + "priority": {"readonly": True}, + "direction": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "commit_time": {"key": "commitTime", "type": "iso-8601"}, + "region": {"key": "region", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "flag": {"key": "properties.flag", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + flag: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword flag: Default rule flag. + :paramtype flag: str + """ + super().__init__( + id=id, + commit_time=commit_time, + region=region, + configuration_description=configuration_description, + rule_collection_description=rule_collection_description, + rule_collection_applies_to_groups=rule_collection_applies_to_groups, + rule_groups=rule_groups, + **kwargs + ) + self.kind: str = "Default" + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + self.resource_guid = None + + +class ActiveSecurityAdminRule(ActiveBaseSecurityAdminRule): # pylint: disable=too-many-instance-attributes + """Network admin rule. + + 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: Resource ID. + :vartype id: str + :ivar commit_time: Deployment time string. + :vartype commit_time: ~datetime.datetime + :ivar region: Deployment region. + :vartype region: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "kind": {"required": True}, + "priority": {"maximum": 4096, "minimum": 1}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "commit_time": {"key": "commitTime", "type": "iso-8601"}, + "region": {"key": "region", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "_models.SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["_models.AddressPrefixItem"]] = None, + destinations: Optional[List["_models.AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "_models.SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "_models.SecurityConfigurationRuleDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword commit_time: Deployment time string. + :paramtype commit_time: ~datetime.datetime + :keyword region: Deployment region. + :paramtype region: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", + "Icmp", "Esp", "Any", and "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Known values are: + "Allow", "Deny", and "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + """ + super().__init__( + id=id, + commit_time=commit_time, + region=region, + configuration_description=configuration_description, + rule_collection_description=rule_collection_description, + rule_collection_applies_to_groups=rule_collection_applies_to_groups, + rule_groups=rule_groups, + **kwargs + ) + self.kind: str = "Custom" + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + self.resource_guid = None + + +class ActiveSecurityAdminRulesListResult(_serialization.Model): + """Result of the request to list active security admin rules. It contains a list of active + security admin rules and a skiptoken to get the next set of results. + + :ivar value: Gets a page of active security admin rules. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ActiveBaseSecurityAdminRule] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ActiveBaseSecurityAdminRule]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ActiveBaseSecurityAdminRule"]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of active security admin rules. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ActiveBaseSecurityAdminRule] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class AddressPrefixItem(_serialization.Model): + """Address prefix item. + + :ivar address_prefix: Address prefix. + :vartype address_prefix: str + :ivar address_prefix_type: Address prefix type. Known values are: "IPPrefix" and "ServiceTag". + :vartype address_prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.AddressPrefixType + """ + + _attribute_map = { + "address_prefix": {"key": "addressPrefix", "type": "str"}, + "address_prefix_type": {"key": "addressPrefixType", "type": "str"}, + } + + def __init__( + self, + *, + address_prefix: Optional[str] = None, + address_prefix_type: Optional[Union[str, "_models.AddressPrefixType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword address_prefix: Address prefix. + :paramtype address_prefix: str + :keyword address_prefix_type: Address prefix type. Known values are: "IPPrefix" and + "ServiceTag". + :paramtype address_prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.AddressPrefixType + """ + super().__init__(**kwargs) + self.address_prefix = address_prefix + self.address_prefix_type = address_prefix_type + + +class AddressSpace(_serialization.Model): + """AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual + network. + + :ivar address_prefixes: A list of address blocks reserved for this virtual network in CIDR + notation. + :vartype address_prefixes: list[str] + """ + + _attribute_map = { + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + } + + def __init__(self, *, address_prefixes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword address_prefixes: A list of address blocks reserved for this virtual network in CIDR + notation. + :paramtype address_prefixes: list[str] + """ + super().__init__(**kwargs) + self.address_prefixes = address_prefixes + + +class ChildResource(_serialization.Model): + """Proxy resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class BaseAdminRule(ChildResource): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AdminRule, DefaultAdminRule + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"required": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + _subtype_map = {"kind": {"Custom": "AdminRule", "Default": "DefaultAdminRule"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: Optional[str] = None + self.system_data = None + + +class AdminRule(BaseAdminRule): # pylint: disable=too-many-instance-attributes + """Network admin rule. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"required": True}, + "system_data": {"readonly": True}, + "priority": {"maximum": 4096, "minimum": 1}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + protocol: Optional[Union[str, "_models.SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["_models.AddressPrefixItem"]] = None, + destinations: Optional[List["_models.AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "_models.SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "_models.SecurityConfigurationRuleDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", + "Icmp", "Esp", "Any", and "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Known values are: + "Allow", "Deny", and "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + """ + super().__init__(**kwargs) + self.kind: str = "Custom" + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + self.resource_guid = None + + +class AdminRuleCollection(ChildResource): + """Defines the admin rule collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description of the admin rule collection. + :vartype description: str + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "applies_to_groups": {"key": "properties.appliesToGroups", "type": "[NetworkManagerSecurityGroupItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: A description of the admin rule collection. + :paramtype description: str + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + """ + super().__init__(**kwargs) + self.system_data = None + self.description = description + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.resource_guid = None + + +class AdminRuleCollectionListResult(_serialization.Model): + """Security admin configuration rule collection list result. + + :ivar value: A list of network manager security admin configuration rule collections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AdminRuleCollection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AdminRuleCollection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of network manager security admin configuration rule collections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AdminRuleListResult(_serialization.Model): + """security configuration admin rule list result. + + :ivar value: A list of admin rules. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BaseAdminRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BaseAdminRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BaseAdminRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of admin rules. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BaseAdminRule] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Resource(_serialization.Model): + """Common resource representation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = id + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ApplicationGateway(Resource): # pylint: disable=too-many-instance-attributes + """Application gateway resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar identity: The identity of the application gateway, if configured. + :vartype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :ivar sku: SKU of the application gateway resource. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySku + :ivar ssl_policy: SSL policy of the application gateway resource. + :vartype ssl_policy: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicy + :ivar operational_state: Operational state of the application gateway resource. Known values + are: "Stopped", "Starting", "Running", and "Stopping". + :vartype operational_state: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayOperationalState + :ivar gateway_ip_configurations: Subnets of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :vartype gateway_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayIPConfiguration] + :ivar authentication_certificates: Authentication certificates of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :vartype authentication_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAuthenticationCertificate] + :ivar trusted_root_certificates: Trusted Root certificates of the application gateway resource. + For default limits, see `Application Gateway limits + `_. + :vartype trusted_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTrustedRootCertificate] + :ivar trusted_client_certificates: Trusted client certificates of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :vartype trusted_client_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTrustedClientCertificate] + :ivar ssl_certificates: SSL certificates of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :vartype ssl_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCertificate] + :ivar frontend_ip_configurations: Frontend IP addresses of the application gateway resource. + For default limits, see `Application Gateway limits + `_. + :vartype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFrontendIPConfiguration] + :ivar frontend_ports: Frontend ports of the application gateway resource. For default limits, + see `Application Gateway limits + `_. + :vartype frontend_ports: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFrontendPort] + :ivar probes: Probes of the application gateway resource. + :vartype probes: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbe] + :ivar backend_address_pools: Backend address pool of the application gateway resource. For + default limits, see `Application Gateway limits + `_. + :vartype backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool] + :ivar backend_http_settings_collection: Backend http settings of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :vartype backend_http_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHttpSettings] + :ivar backend_settings_collection: Backend settings of the application gateway resource. For + default limits, see `Application Gateway limits + `_. + :vartype backend_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendSettings] + :ivar http_listeners: Http listeners of the application gateway resource. For default limits, + see `Application Gateway limits + `_. + :vartype http_listeners: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHttpListener] + :ivar listeners: Listeners of the application gateway resource. For default limits, see + `Application Gateway limits + `_. + :vartype listeners: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayListener] + :ivar ssl_profiles: SSL profiles of the application gateway resource. For default limits, see + `Application Gateway limits + `_. + :vartype ssl_profiles: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProfile] + :ivar url_path_maps: URL path map of the application gateway resource. For default limits, see + `Application Gateway limits + `_. + :vartype url_path_maps: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayUrlPathMap] + :ivar request_routing_rules: Request routing rules of the application gateway resource. + :vartype request_routing_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRule] + :ivar routing_rules: Routing rules of the application gateway resource. + :vartype routing_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRoutingRule] + :ivar rewrite_rule_sets: Rewrite rules for the application gateway resource. + :vartype rewrite_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleSet] + :ivar redirect_configurations: Redirect configurations of the application gateway resource. For + default limits, see `Application Gateway limits + `_. + :vartype redirect_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRedirectConfiguration] + :ivar web_application_firewall_configuration: Web application firewall configuration. + :vartype web_application_firewall_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWebApplicationFirewallConfiguration + :ivar firewall_policy: Reference to the FirewallPolicy resource. + :vartype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar enable_http2: Whether HTTP2 is enabled on the application gateway resource. + :vartype enable_http2: bool + :ivar enable_fips: Whether FIPS is enabled on the application gateway resource. + :vartype enable_fips: bool + :ivar autoscale_configuration: Autoscale Configuration. + :vartype autoscale_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAutoscaleConfiguration + :ivar private_link_configurations: PrivateLink configurations on application gateway. + :vartype private_link_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkConfiguration] + :ivar private_endpoint_connections: Private Endpoint connections on application gateway. + :vartype private_endpoint_connections: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :ivar resource_guid: The resource GUID property of the application gateway resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the application gateway resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar custom_error_configurations: Custom error configurations of the application gateway + resource. + :vartype custom_error_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomError] + :ivar force_firewall_policy_association: If true, associates a firewall policy with an + application gateway regardless whether the policy differs from the WAF Config. + :vartype force_firewall_policy_association: bool + :ivar load_distribution_policies: Load distribution policies of the application gateway + resource. + :vartype load_distribution_policies: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionPolicy] + :ivar global_configuration: Global Configuration. + :vartype global_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayGlobalConfiguration + :ivar default_predefined_ssl_policy: The default predefined SSL Policy applied on the + application gateway resource. Known values are: "AppGwSslPolicy20150501", + "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S", "AppGwSslPolicy20220101", and + "AppGwSslPolicy20220101S". + :vartype default_predefined_ssl_policy: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyName + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "operational_state": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "default_predefined_ssl_policy": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "properties.sku", "type": "ApplicationGatewaySku"}, + "ssl_policy": {"key": "properties.sslPolicy", "type": "ApplicationGatewaySslPolicy"}, + "operational_state": {"key": "properties.operationalState", "type": "str"}, + "gateway_ip_configurations": { + "key": "properties.gatewayIPConfigurations", + "type": "[ApplicationGatewayIPConfiguration]", + }, + "authentication_certificates": { + "key": "properties.authenticationCertificates", + "type": "[ApplicationGatewayAuthenticationCertificate]", + }, + "trusted_root_certificates": { + "key": "properties.trustedRootCertificates", + "type": "[ApplicationGatewayTrustedRootCertificate]", + }, + "trusted_client_certificates": { + "key": "properties.trustedClientCertificates", + "type": "[ApplicationGatewayTrustedClientCertificate]", + }, + "ssl_certificates": {"key": "properties.sslCertificates", "type": "[ApplicationGatewaySslCertificate]"}, + "frontend_ip_configurations": { + "key": "properties.frontendIPConfigurations", + "type": "[ApplicationGatewayFrontendIPConfiguration]", + }, + "frontend_ports": {"key": "properties.frontendPorts", "type": "[ApplicationGatewayFrontendPort]"}, + "probes": {"key": "properties.probes", "type": "[ApplicationGatewayProbe]"}, + "backend_address_pools": { + "key": "properties.backendAddressPools", + "type": "[ApplicationGatewayBackendAddressPool]", + }, + "backend_http_settings_collection": { + "key": "properties.backendHttpSettingsCollection", + "type": "[ApplicationGatewayBackendHttpSettings]", + }, + "backend_settings_collection": { + "key": "properties.backendSettingsCollection", + "type": "[ApplicationGatewayBackendSettings]", + }, + "http_listeners": {"key": "properties.httpListeners", "type": "[ApplicationGatewayHttpListener]"}, + "listeners": {"key": "properties.listeners", "type": "[ApplicationGatewayListener]"}, + "ssl_profiles": {"key": "properties.sslProfiles", "type": "[ApplicationGatewaySslProfile]"}, + "url_path_maps": {"key": "properties.urlPathMaps", "type": "[ApplicationGatewayUrlPathMap]"}, + "request_routing_rules": { + "key": "properties.requestRoutingRules", + "type": "[ApplicationGatewayRequestRoutingRule]", + }, + "routing_rules": {"key": "properties.routingRules", "type": "[ApplicationGatewayRoutingRule]"}, + "rewrite_rule_sets": {"key": "properties.rewriteRuleSets", "type": "[ApplicationGatewayRewriteRuleSet]"}, + "redirect_configurations": { + "key": "properties.redirectConfigurations", + "type": "[ApplicationGatewayRedirectConfiguration]", + }, + "web_application_firewall_configuration": { + "key": "properties.webApplicationFirewallConfiguration", + "type": "ApplicationGatewayWebApplicationFirewallConfiguration", + }, + "firewall_policy": {"key": "properties.firewallPolicy", "type": "SubResource"}, + "enable_http2": {"key": "properties.enableHttp2", "type": "bool"}, + "enable_fips": {"key": "properties.enableFips", "type": "bool"}, + "autoscale_configuration": { + "key": "properties.autoscaleConfiguration", + "type": "ApplicationGatewayAutoscaleConfiguration", + }, + "private_link_configurations": { + "key": "properties.privateLinkConfigurations", + "type": "[ApplicationGatewayPrivateLinkConfiguration]", + }, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[ApplicationGatewayPrivateEndpointConnection]", + }, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "custom_error_configurations": { + "key": "properties.customErrorConfigurations", + "type": "[ApplicationGatewayCustomError]", + }, + "force_firewall_policy_association": {"key": "properties.forceFirewallPolicyAssociation", "type": "bool"}, + "load_distribution_policies": { + "key": "properties.loadDistributionPolicies", + "type": "[ApplicationGatewayLoadDistributionPolicy]", + }, + "global_configuration": { + "key": "properties.globalConfiguration", + "type": "ApplicationGatewayGlobalConfiguration", + }, + "default_predefined_ssl_policy": {"key": "properties.defaultPredefinedSslPolicy", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.ApplicationGatewaySku"] = None, + ssl_policy: Optional["_models.ApplicationGatewaySslPolicy"] = None, + gateway_ip_configurations: Optional[List["_models.ApplicationGatewayIPConfiguration"]] = None, + authentication_certificates: Optional[List["_models.ApplicationGatewayAuthenticationCertificate"]] = None, + trusted_root_certificates: Optional[List["_models.ApplicationGatewayTrustedRootCertificate"]] = None, + trusted_client_certificates: Optional[List["_models.ApplicationGatewayTrustedClientCertificate"]] = None, + ssl_certificates: Optional[List["_models.ApplicationGatewaySslCertificate"]] = None, + frontend_ip_configurations: Optional[List["_models.ApplicationGatewayFrontendIPConfiguration"]] = None, + frontend_ports: Optional[List["_models.ApplicationGatewayFrontendPort"]] = None, + probes: Optional[List["_models.ApplicationGatewayProbe"]] = None, + backend_address_pools: Optional[List["_models.ApplicationGatewayBackendAddressPool"]] = None, + backend_http_settings_collection: Optional[List["_models.ApplicationGatewayBackendHttpSettings"]] = None, + backend_settings_collection: Optional[List["_models.ApplicationGatewayBackendSettings"]] = None, + http_listeners: Optional[List["_models.ApplicationGatewayHttpListener"]] = None, + listeners: Optional[List["_models.ApplicationGatewayListener"]] = None, + ssl_profiles: Optional[List["_models.ApplicationGatewaySslProfile"]] = None, + url_path_maps: Optional[List["_models.ApplicationGatewayUrlPathMap"]] = None, + request_routing_rules: Optional[List["_models.ApplicationGatewayRequestRoutingRule"]] = None, + routing_rules: Optional[List["_models.ApplicationGatewayRoutingRule"]] = None, + rewrite_rule_sets: Optional[List["_models.ApplicationGatewayRewriteRuleSet"]] = None, + redirect_configurations: Optional[List["_models.ApplicationGatewayRedirectConfiguration"]] = None, + web_application_firewall_configuration: Optional[ + "_models.ApplicationGatewayWebApplicationFirewallConfiguration" + ] = None, + firewall_policy: Optional["_models.SubResource"] = None, + enable_http2: Optional[bool] = None, + enable_fips: Optional[bool] = None, + autoscale_configuration: Optional["_models.ApplicationGatewayAutoscaleConfiguration"] = None, + private_link_configurations: Optional[List["_models.ApplicationGatewayPrivateLinkConfiguration"]] = None, + custom_error_configurations: Optional[List["_models.ApplicationGatewayCustomError"]] = None, + force_firewall_policy_association: Optional[bool] = None, + load_distribution_policies: Optional[List["_models.ApplicationGatewayLoadDistributionPolicy"]] = None, + global_configuration: Optional["_models.ApplicationGatewayGlobalConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword identity: The identity of the application gateway, if configured. + :paramtype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :keyword sku: SKU of the application gateway resource. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySku + :keyword ssl_policy: SSL policy of the application gateway resource. + :paramtype ssl_policy: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicy + :keyword gateway_ip_configurations: Subnets of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :paramtype gateway_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayIPConfiguration] + :keyword authentication_certificates: Authentication certificates of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :paramtype authentication_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAuthenticationCertificate] + :keyword trusted_root_certificates: Trusted Root certificates of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :paramtype trusted_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTrustedRootCertificate] + :keyword trusted_client_certificates: Trusted client certificates of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :paramtype trusted_client_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTrustedClientCertificate] + :keyword ssl_certificates: SSL certificates of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :paramtype ssl_certificates: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCertificate] + :keyword frontend_ip_configurations: Frontend IP addresses of the application gateway resource. + For default limits, see `Application Gateway limits + `_. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFrontendIPConfiguration] + :keyword frontend_ports: Frontend ports of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :paramtype frontend_ports: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFrontendPort] + :keyword probes: Probes of the application gateway resource. + :paramtype probes: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbe] + :keyword backend_address_pools: Backend address pool of the application gateway resource. For + default limits, see `Application Gateway limits + `_. + :paramtype backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool] + :keyword backend_http_settings_collection: Backend http settings of the application gateway + resource. For default limits, see `Application Gateway limits + `_. + :paramtype backend_http_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHttpSettings] + :keyword backend_settings_collection: Backend settings of the application gateway resource. For + default limits, see `Application Gateway limits + `_. + :paramtype backend_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendSettings] + :keyword http_listeners: Http listeners of the application gateway resource. For default + limits, see `Application Gateway limits + `_. + :paramtype http_listeners: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHttpListener] + :keyword listeners: Listeners of the application gateway resource. For default limits, see + `Application Gateway limits + `_. + :paramtype listeners: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayListener] + :keyword ssl_profiles: SSL profiles of the application gateway resource. For default limits, + see `Application Gateway limits + `_. + :paramtype ssl_profiles: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProfile] + :keyword url_path_maps: URL path map of the application gateway resource. For default limits, + see `Application Gateway limits + `_. + :paramtype url_path_maps: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayUrlPathMap] + :keyword request_routing_rules: Request routing rules of the application gateway resource. + :paramtype request_routing_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRule] + :keyword routing_rules: Routing rules of the application gateway resource. + :paramtype routing_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRoutingRule] + :keyword rewrite_rule_sets: Rewrite rules for the application gateway resource. + :paramtype rewrite_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleSet] + :keyword redirect_configurations: Redirect configurations of the application gateway resource. + For default limits, see `Application Gateway limits + `_. + :paramtype redirect_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRedirectConfiguration] + :keyword web_application_firewall_configuration: Web application firewall configuration. + :paramtype web_application_firewall_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWebApplicationFirewallConfiguration + :keyword firewall_policy: Reference to the FirewallPolicy resource. + :paramtype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword enable_http2: Whether HTTP2 is enabled on the application gateway resource. + :paramtype enable_http2: bool + :keyword enable_fips: Whether FIPS is enabled on the application gateway resource. + :paramtype enable_fips: bool + :keyword autoscale_configuration: Autoscale Configuration. + :paramtype autoscale_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAutoscaleConfiguration + :keyword private_link_configurations: PrivateLink configurations on application gateway. + :paramtype private_link_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkConfiguration] + :keyword custom_error_configurations: Custom error configurations of the application gateway + resource. + :paramtype custom_error_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomError] + :keyword force_firewall_policy_association: If true, associates a firewall policy with an + application gateway regardless whether the policy differs from the WAF Config. + :paramtype force_firewall_policy_association: bool + :keyword load_distribution_policies: Load distribution policies of the application gateway + resource. + :paramtype load_distribution_policies: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionPolicy] + :keyword global_configuration: Global Configuration. + :paramtype global_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayGlobalConfiguration + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.zones = zones + self.identity = identity + self.sku = sku + self.ssl_policy = ssl_policy + self.operational_state = None + self.gateway_ip_configurations = gateway_ip_configurations + self.authentication_certificates = authentication_certificates + self.trusted_root_certificates = trusted_root_certificates + self.trusted_client_certificates = trusted_client_certificates + self.ssl_certificates = ssl_certificates + self.frontend_ip_configurations = frontend_ip_configurations + self.frontend_ports = frontend_ports + self.probes = probes + self.backend_address_pools = backend_address_pools + self.backend_http_settings_collection = backend_http_settings_collection + self.backend_settings_collection = backend_settings_collection + self.http_listeners = http_listeners + self.listeners = listeners + self.ssl_profiles = ssl_profiles + self.url_path_maps = url_path_maps + self.request_routing_rules = request_routing_rules + self.routing_rules = routing_rules + self.rewrite_rule_sets = rewrite_rule_sets + self.redirect_configurations = redirect_configurations + self.web_application_firewall_configuration = web_application_firewall_configuration + self.firewall_policy = firewall_policy + self.enable_http2 = enable_http2 + self.enable_fips = enable_fips + self.autoscale_configuration = autoscale_configuration + self.private_link_configurations = private_link_configurations + self.private_endpoint_connections = None + self.resource_guid = None + self.provisioning_state = None + self.custom_error_configurations = custom_error_configurations + self.force_firewall_policy_association = force_firewall_policy_association + self.load_distribution_policies = load_distribution_policies + self.global_configuration = global_configuration + self.default_predefined_ssl_policy = None + + +class SubResource(_serialization.Model): + """Reference to another subresource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ApplicationGatewayAuthenticationCertificate(SubResource): + """Authentication certificates of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the authentication certificate that is unique within an Application + Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar data: Certificate public data. + :vartype data: str + :ivar provisioning_state: The provisioning state of the authentication certificate resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "data": {"key": "properties.data", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + data: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the authentication certificate that is unique within an Application + Gateway. + :paramtype name: str + :keyword data: Certificate public data. + :paramtype data: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.data = data + self.provisioning_state = None + + +class ApplicationGatewayAutoscaleConfiguration(_serialization.Model): + """Application Gateway autoscale configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar min_capacity: Lower bound on number of Application Gateway capacity. Required. + :vartype min_capacity: int + :ivar max_capacity: Upper bound on number of Application Gateway capacity. + :vartype max_capacity: int + """ + + _validation = { + "min_capacity": {"required": True, "minimum": 0}, + "max_capacity": {"minimum": 2}, + } + + _attribute_map = { + "min_capacity": {"key": "minCapacity", "type": "int"}, + "max_capacity": {"key": "maxCapacity", "type": "int"}, + } + + def __init__(self, *, min_capacity: int, max_capacity: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword min_capacity: Lower bound on number of Application Gateway capacity. Required. + :paramtype min_capacity: int + :keyword max_capacity: Upper bound on number of Application Gateway capacity. + :paramtype max_capacity: int + """ + super().__init__(**kwargs) + self.min_capacity = min_capacity + self.max_capacity = max_capacity + + +class ApplicationGatewayAvailableSslOptions(Resource): + """Response for ApplicationGatewayAvailableSslOptions API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar predefined_policies: List of available Ssl predefined policy. + :vartype predefined_policies: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar default_policy: Name of the Ssl predefined policy applied by default to application + gateway. Known values are: "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", + "AppGwSslPolicy20170401S", "AppGwSslPolicy20220101", and "AppGwSslPolicy20220101S". + :vartype default_policy: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyName + :ivar available_cipher_suites: List of available Ssl cipher suites. + :vartype available_cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :ivar available_protocols: List of available Ssl protocols. + :vartype available_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "predefined_policies": {"key": "properties.predefinedPolicies", "type": "[SubResource]"}, + "default_policy": {"key": "properties.defaultPolicy", "type": "str"}, + "available_cipher_suites": {"key": "properties.availableCipherSuites", "type": "[str]"}, + "available_protocols": {"key": "properties.availableProtocols", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + predefined_policies: Optional[List["_models.SubResource"]] = None, + default_policy: Optional[Union[str, "_models.ApplicationGatewaySslPolicyName"]] = None, + available_cipher_suites: Optional[List[Union[str, "_models.ApplicationGatewaySslCipherSuite"]]] = None, + available_protocols: Optional[List[Union[str, "_models.ApplicationGatewaySslProtocol"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword predefined_policies: List of available Ssl predefined policy. + :paramtype predefined_policies: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword default_policy: Name of the Ssl predefined policy applied by default to application + gateway. Known values are: "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", + "AppGwSslPolicy20170401S", "AppGwSslPolicy20220101", and "AppGwSslPolicy20220101S". + :paramtype default_policy: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyName + :keyword available_cipher_suites: List of available Ssl cipher suites. + :paramtype available_cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :keyword available_protocols: List of available Ssl protocols. + :paramtype available_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.predefined_policies = predefined_policies + self.default_policy = default_policy + self.available_cipher_suites = available_cipher_suites + self.available_protocols = available_protocols + + +class ApplicationGatewayAvailableSslPredefinedPolicies(_serialization.Model): + """Response for ApplicationGatewayAvailableSslOptions API service call. + + :ivar value: List of available Ssl predefined policy. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGatewaySslPredefinedPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationGatewaySslPredefinedPolicy"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of available Ssl predefined policy. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationGatewayAvailableWafRuleSetsResult(_serialization.Model): + """Response for ApplicationGatewayAvailableWafRuleSets API service call. + + :ivar value: The list of application gateway rule sets. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleSet] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGatewayFirewallRuleSet]"}, + } + + def __init__( + self, *, value: Optional[List["_models.ApplicationGatewayFirewallRuleSet"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of application gateway rule sets. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleSet] + """ + super().__init__(**kwargs) + self.value = value + + +class ApplicationGatewayBackendAddress(_serialization.Model): + """Backend address of an application gateway. + + :ivar fqdn: Fully qualified domain name (FQDN). + :vartype fqdn: str + :ivar ip_address: IP address. + :vartype ip_address: str + """ + + _attribute_map = { + "fqdn": {"key": "fqdn", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + } + + def __init__(self, *, fqdn: Optional[str] = None, ip_address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword fqdn: Fully qualified domain name (FQDN). + :paramtype fqdn: str + :keyword ip_address: IP address. + :paramtype ip_address: str + """ + super().__init__(**kwargs) + self.fqdn = fqdn + self.ip_address = ip_address + + +class ApplicationGatewayBackendAddressPool(SubResource): + """Backend Address Pool of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the backend address pool that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar backend_ip_configurations: Collection of references to IPs defined in network interfaces. + :vartype backend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :ivar backend_addresses: Backend addresses. + :vartype backend_addresses: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddress] + :ivar provisioning_state: The provisioning state of the backend address pool resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "backend_ip_configurations": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "backend_ip_configurations": { + "key": "properties.backendIPConfigurations", + "type": "[NetworkInterfaceIPConfiguration]", + }, + "backend_addresses": {"key": "properties.backendAddresses", "type": "[ApplicationGatewayBackendAddress]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + backend_addresses: Optional[List["_models.ApplicationGatewayBackendAddress"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the backend address pool that is unique within an Application Gateway. + :paramtype name: str + :keyword backend_addresses: Backend addresses. + :paramtype backend_addresses: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddress] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.backend_ip_configurations = None + self.backend_addresses = backend_addresses + self.provisioning_state = None + + +class ApplicationGatewayBackendHealth(_serialization.Model): + """Response for ApplicationGatewayBackendHealth API service call. + + :ivar backend_address_pools: A list of ApplicationGatewayBackendHealthPool resources. + :vartype backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthPool] + """ + + _attribute_map = { + "backend_address_pools": {"key": "backendAddressPools", "type": "[ApplicationGatewayBackendHealthPool]"}, + } + + def __init__( + self, + *, + backend_address_pools: Optional[List["_models.ApplicationGatewayBackendHealthPool"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword backend_address_pools: A list of ApplicationGatewayBackendHealthPool resources. + :paramtype backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthPool] + """ + super().__init__(**kwargs) + self.backend_address_pools = backend_address_pools + + +class ApplicationGatewayBackendHealthHttpSettings(_serialization.Model): + """Application gateway BackendHealthHttp settings. + + :ivar backend_http_settings: Reference to an ApplicationGatewayBackendHttpSettings resource. + :vartype backend_http_settings: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHttpSettings + :ivar servers: List of ApplicationGatewayBackendHealthServer resources. + :vartype servers: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthServer] + """ + + _attribute_map = { + "backend_http_settings": {"key": "backendHttpSettings", "type": "ApplicationGatewayBackendHttpSettings"}, + "servers": {"key": "servers", "type": "[ApplicationGatewayBackendHealthServer]"}, + } + + def __init__( + self, + *, + backend_http_settings: Optional["_models.ApplicationGatewayBackendHttpSettings"] = None, + servers: Optional[List["_models.ApplicationGatewayBackendHealthServer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword backend_http_settings: Reference to an ApplicationGatewayBackendHttpSettings resource. + :paramtype backend_http_settings: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHttpSettings + :keyword servers: List of ApplicationGatewayBackendHealthServer resources. + :paramtype servers: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthServer] + """ + super().__init__(**kwargs) + self.backend_http_settings = backend_http_settings + self.servers = servers + + +class ApplicationGatewayBackendHealthOnDemand(_serialization.Model): + """Result of on demand test probe. + + :ivar backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. + :vartype backend_address_pool: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool + :ivar backend_health_http_settings: Application gateway BackendHealthHttp settings. + :vartype backend_health_http_settings: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthHttpSettings + """ + + _attribute_map = { + "backend_address_pool": {"key": "backendAddressPool", "type": "ApplicationGatewayBackendAddressPool"}, + "backend_health_http_settings": { + "key": "backendHealthHttpSettings", + "type": "ApplicationGatewayBackendHealthHttpSettings", + }, + } + + def __init__( + self, + *, + backend_address_pool: Optional["_models.ApplicationGatewayBackendAddressPool"] = None, + backend_health_http_settings: Optional["_models.ApplicationGatewayBackendHealthHttpSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. + :paramtype backend_address_pool: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool + :keyword backend_health_http_settings: Application gateway BackendHealthHttp settings. + :paramtype backend_health_http_settings: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthHttpSettings + """ + super().__init__(**kwargs) + self.backend_address_pool = backend_address_pool + self.backend_health_http_settings = backend_health_http_settings + + +class ApplicationGatewayBackendHealthPool(_serialization.Model): + """Application gateway BackendHealth pool. + + :ivar backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. + :vartype backend_address_pool: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool + :ivar backend_http_settings_collection: List of ApplicationGatewayBackendHealthHttpSettings + resources. + :vartype backend_http_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthHttpSettings] + """ + + _attribute_map = { + "backend_address_pool": {"key": "backendAddressPool", "type": "ApplicationGatewayBackendAddressPool"}, + "backend_http_settings_collection": { + "key": "backendHttpSettingsCollection", + "type": "[ApplicationGatewayBackendHealthHttpSettings]", + }, + } + + def __init__( + self, + *, + backend_address_pool: Optional["_models.ApplicationGatewayBackendAddressPool"] = None, + backend_http_settings_collection: Optional[List["_models.ApplicationGatewayBackendHealthHttpSettings"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword backend_address_pool: Reference to an ApplicationGatewayBackendAddressPool resource. + :paramtype backend_address_pool: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool + :keyword backend_http_settings_collection: List of ApplicationGatewayBackendHealthHttpSettings + resources. + :paramtype backend_http_settings_collection: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthHttpSettings] + """ + super().__init__(**kwargs) + self.backend_address_pool = backend_address_pool + self.backend_http_settings_collection = backend_http_settings_collection + + +class ApplicationGatewayBackendHealthServer(_serialization.Model): + """Application gateway backendhealth http settings. + + :ivar address: IP address or FQDN of backend server. + :vartype address: str + :ivar ip_configuration: Reference to IP configuration of backend server. + :vartype ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :ivar health: Health of backend server. Known values are: "Unknown", "Up", "Down", "Partial", + and "Draining". + :vartype health: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthServerHealth + :ivar health_probe_log: Health Probe Log. + :vartype health_probe_log: str + """ + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + "ip_configuration": {"key": "ipConfiguration", "type": "NetworkInterfaceIPConfiguration"}, + "health": {"key": "health", "type": "str"}, + "health_probe_log": {"key": "healthProbeLog", "type": "str"}, + } + + def __init__( + self, + *, + address: Optional[str] = None, + ip_configuration: Optional["_models.NetworkInterfaceIPConfiguration"] = None, + health: Optional[Union[str, "_models.ApplicationGatewayBackendHealthServerHealth"]] = None, + health_probe_log: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword address: IP address or FQDN of backend server. + :paramtype address: str + :keyword ip_configuration: Reference to IP configuration of backend server. + :paramtype ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :keyword health: Health of backend server. Known values are: "Unknown", "Up", "Down", + "Partial", and "Draining". + :paramtype health: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthServerHealth + :keyword health_probe_log: Health Probe Log. + :paramtype health_probe_log: str + """ + super().__init__(**kwargs) + self.address = address + self.ip_configuration = ip_configuration + self.health = health + self.health_probe_log = health_probe_log + + +class ApplicationGatewayBackendHttpSettings(SubResource): # pylint: disable=too-many-instance-attributes + """Backend address pool settings of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the backend http settings that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar port: The destination port on the backend. + :vartype port: int + :ivar protocol: The protocol used to communicate with the backend. Known values are: "Http", + "Https", "Tcp", and "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar cookie_based_affinity: Cookie based affinity. Known values are: "Enabled" and "Disabled". + :vartype cookie_based_affinity: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCookieBasedAffinity + :ivar request_timeout: Request timeout in seconds. Application Gateway will fail the request if + response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 + seconds. + :vartype request_timeout: int + :ivar probe: Probe resource of an application gateway. + :vartype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar authentication_certificates: Array of references to application gateway authentication + certificates. + :vartype authentication_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar trusted_root_certificates: Array of references to application gateway trusted root + certificates. + :vartype trusted_root_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar connection_draining: Connection draining of the backend http settings resource. + :vartype connection_draining: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayConnectionDraining + :ivar host_name: Host header to be sent to the backend servers. + :vartype host_name: str + :ivar pick_host_name_from_backend_address: Whether to pick host header should be picked from + the host name of the backend server. Default value is false. + :vartype pick_host_name_from_backend_address: bool + :ivar affinity_cookie_name: Cookie name to use for the affinity cookie. + :vartype affinity_cookie_name: str + :ivar probe_enabled: Whether the probe is enabled. Default value is false. + :vartype probe_enabled: bool + :ivar path: Path which should be used as a prefix for all HTTP requests. Null means no path + will be prefixed. Default value is null. + :vartype path: str + :ivar provisioning_state: The provisioning state of the backend HTTP settings resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "cookie_based_affinity": {"key": "properties.cookieBasedAffinity", "type": "str"}, + "request_timeout": {"key": "properties.requestTimeout", "type": "int"}, + "probe": {"key": "properties.probe", "type": "SubResource"}, + "authentication_certificates": {"key": "properties.authenticationCertificates", "type": "[SubResource]"}, + "trusted_root_certificates": {"key": "properties.trustedRootCertificates", "type": "[SubResource]"}, + "connection_draining": {"key": "properties.connectionDraining", "type": "ApplicationGatewayConnectionDraining"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "pick_host_name_from_backend_address": {"key": "properties.pickHostNameFromBackendAddress", "type": "bool"}, + "affinity_cookie_name": {"key": "properties.affinityCookieName", "type": "str"}, + "probe_enabled": {"key": "properties.probeEnabled", "type": "bool"}, + "path": {"key": "properties.path", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + cookie_based_affinity: Optional[Union[str, "_models.ApplicationGatewayCookieBasedAffinity"]] = None, + request_timeout: Optional[int] = None, + probe: Optional["_models.SubResource"] = None, + authentication_certificates: Optional[List["_models.SubResource"]] = None, + trusted_root_certificates: Optional[List["_models.SubResource"]] = None, + connection_draining: Optional["_models.ApplicationGatewayConnectionDraining"] = None, + host_name: Optional[str] = None, + pick_host_name_from_backend_address: Optional[bool] = None, + affinity_cookie_name: Optional[str] = None, + probe_enabled: Optional[bool] = None, + path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the backend http settings that is unique within an Application Gateway. + :paramtype name: str + :keyword port: The destination port on the backend. + :paramtype port: int + :keyword protocol: The protocol used to communicate with the backend. Known values are: "Http", + "Https", "Tcp", and "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword cookie_based_affinity: Cookie based affinity. Known values are: "Enabled" and + "Disabled". + :paramtype cookie_based_affinity: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCookieBasedAffinity + :keyword request_timeout: Request timeout in seconds. Application Gateway will fail the request + if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 + seconds. + :paramtype request_timeout: int + :keyword probe: Probe resource of an application gateway. + :paramtype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword authentication_certificates: Array of references to application gateway authentication + certificates. + :paramtype authentication_certificates: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword trusted_root_certificates: Array of references to application gateway trusted root + certificates. + :paramtype trusted_root_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword connection_draining: Connection draining of the backend http settings resource. + :paramtype connection_draining: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayConnectionDraining + :keyword host_name: Host header to be sent to the backend servers. + :paramtype host_name: str + :keyword pick_host_name_from_backend_address: Whether to pick host header should be picked from + the host name of the backend server. Default value is false. + :paramtype pick_host_name_from_backend_address: bool + :keyword affinity_cookie_name: Cookie name to use for the affinity cookie. + :paramtype affinity_cookie_name: str + :keyword probe_enabled: Whether the probe is enabled. Default value is false. + :paramtype probe_enabled: bool + :keyword path: Path which should be used as a prefix for all HTTP requests. Null means no path + will be prefixed. Default value is null. + :paramtype path: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.port = port + self.protocol = protocol + self.cookie_based_affinity = cookie_based_affinity + self.request_timeout = request_timeout + self.probe = probe + self.authentication_certificates = authentication_certificates + self.trusted_root_certificates = trusted_root_certificates + self.connection_draining = connection_draining + self.host_name = host_name + self.pick_host_name_from_backend_address = pick_host_name_from_backend_address + self.affinity_cookie_name = affinity_cookie_name + self.probe_enabled = probe_enabled + self.path = path + self.provisioning_state = None + + +class ApplicationGatewayBackendSettings(SubResource): # pylint: disable=too-many-instance-attributes + """Backend address pool settings of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the backend settings that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar port: The destination port on the backend. + :vartype port: int + :ivar protocol: The protocol used to communicate with the backend. Known values are: "Http", + "Https", "Tcp", and "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar timeout: Connection timeout in seconds. Application Gateway will fail the request if + response is not received within ConnectionTimeout. Acceptable values are from 1 second to 86400 + seconds. + :vartype timeout: int + :ivar probe: Probe resource of an application gateway. + :vartype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar trusted_root_certificates: Array of references to application gateway trusted root + certificates. + :vartype trusted_root_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar host_name: Server name indication to be sent to the backend servers for Tls protocol. + :vartype host_name: str + :ivar pick_host_name_from_backend_address: Whether to pick server name indication from the host + name of the backend server for Tls protocol. Default value is false. + :vartype pick_host_name_from_backend_address: bool + :ivar provisioning_state: The provisioning state of the backend HTTP settings resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "timeout": {"key": "properties.timeout", "type": "int"}, + "probe": {"key": "properties.probe", "type": "SubResource"}, + "trusted_root_certificates": {"key": "properties.trustedRootCertificates", "type": "[SubResource]"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "pick_host_name_from_backend_address": {"key": "properties.pickHostNameFromBackendAddress", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + timeout: Optional[int] = None, + probe: Optional["_models.SubResource"] = None, + trusted_root_certificates: Optional[List["_models.SubResource"]] = None, + host_name: Optional[str] = None, + pick_host_name_from_backend_address: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the backend settings that is unique within an Application Gateway. + :paramtype name: str + :keyword port: The destination port on the backend. + :paramtype port: int + :keyword protocol: The protocol used to communicate with the backend. Known values are: "Http", + "Https", "Tcp", and "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword timeout: Connection timeout in seconds. Application Gateway will fail the request if + response is not received within ConnectionTimeout. Acceptable values are from 1 second to 86400 + seconds. + :paramtype timeout: int + :keyword probe: Probe resource of an application gateway. + :paramtype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword trusted_root_certificates: Array of references to application gateway trusted root + certificates. + :paramtype trusted_root_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword host_name: Server name indication to be sent to the backend servers for Tls protocol. + :paramtype host_name: str + :keyword pick_host_name_from_backend_address: Whether to pick server name indication from the + host name of the backend server for Tls protocol. Default value is false. + :paramtype pick_host_name_from_backend_address: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.port = port + self.protocol = protocol + self.timeout = timeout + self.probe = probe + self.trusted_root_certificates = trusted_root_certificates + self.host_name = host_name + self.pick_host_name_from_backend_address = pick_host_name_from_backend_address + self.provisioning_state = None + + +class ApplicationGatewayClientAuthConfiguration(_serialization.Model): + """Application gateway client authentication configuration. + + :ivar verify_client_cert_issuer_dn: Verify client certificate issuer name on the application + gateway. + :vartype verify_client_cert_issuer_dn: bool + :ivar verify_client_revocation: Verify client certificate revocation status. Known values are: + "None" and "OCSP". + :vartype verify_client_revocation: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayClientRevocationOptions + """ + + _attribute_map = { + "verify_client_cert_issuer_dn": {"key": "verifyClientCertIssuerDN", "type": "bool"}, + "verify_client_revocation": {"key": "verifyClientRevocation", "type": "str"}, + } + + def __init__( + self, + *, + verify_client_cert_issuer_dn: Optional[bool] = None, + verify_client_revocation: Optional[Union[str, "_models.ApplicationGatewayClientRevocationOptions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword verify_client_cert_issuer_dn: Verify client certificate issuer name on the application + gateway. + :paramtype verify_client_cert_issuer_dn: bool + :keyword verify_client_revocation: Verify client certificate revocation status. Known values + are: "None" and "OCSP". + :paramtype verify_client_revocation: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayClientRevocationOptions + """ + super().__init__(**kwargs) + self.verify_client_cert_issuer_dn = verify_client_cert_issuer_dn + self.verify_client_revocation = verify_client_revocation + + +class ApplicationGatewayConnectionDraining(_serialization.Model): + """Connection draining allows open connections to a backend server to be active for a specified + time after the backend server got removed from the configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether connection draining is enabled or not. Required. + :vartype enabled: bool + :ivar drain_timeout_in_sec: The number of seconds connection draining is active. Acceptable + values are from 1 second to 3600 seconds. Required. + :vartype drain_timeout_in_sec: int + """ + + _validation = { + "enabled": {"required": True}, + "drain_timeout_in_sec": {"required": True, "maximum": 3600, "minimum": 1}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "drain_timeout_in_sec": {"key": "drainTimeoutInSec", "type": "int"}, + } + + def __init__(self, *, enabled: bool, drain_timeout_in_sec: int, **kwargs: Any) -> None: + """ + :keyword enabled: Whether connection draining is enabled or not. Required. + :paramtype enabled: bool + :keyword drain_timeout_in_sec: The number of seconds connection draining is active. Acceptable + values are from 1 second to 3600 seconds. Required. + :paramtype drain_timeout_in_sec: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.drain_timeout_in_sec = drain_timeout_in_sec + + +class ApplicationGatewayCustomError(_serialization.Model): + """Custom error of an application gateway. + + :ivar status_code: Status code of the application gateway custom error. Known values are: + "HttpStatus400", "HttpStatus403", "HttpStatus404", "HttpStatus405", "HttpStatus408", + "HttpStatus500", "HttpStatus502", "HttpStatus503", and "HttpStatus504". + :vartype status_code: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomErrorStatusCode + :ivar custom_error_page_url: Error page URL of the application gateway custom error. + :vartype custom_error_page_url: str + """ + + _attribute_map = { + "status_code": {"key": "statusCode", "type": "str"}, + "custom_error_page_url": {"key": "customErrorPageUrl", "type": "str"}, + } + + def __init__( + self, + *, + status_code: Optional[Union[str, "_models.ApplicationGatewayCustomErrorStatusCode"]] = None, + custom_error_page_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status_code: Status code of the application gateway custom error. Known values are: + "HttpStatus400", "HttpStatus403", "HttpStatus404", "HttpStatus405", "HttpStatus408", + "HttpStatus500", "HttpStatus502", "HttpStatus503", and "HttpStatus504". + :paramtype status_code: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomErrorStatusCode + :keyword custom_error_page_url: Error page URL of the application gateway custom error. + :paramtype custom_error_page_url: str + """ + super().__init__(**kwargs) + self.status_code = status_code + self.custom_error_page_url = custom_error_page_url + + +class ApplicationGatewayFirewallDisabledRuleGroup(_serialization.Model): + """Allows to disable rules within a rule group or an entire rule group. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_group_name: The name of the rule group that will be disabled. Required. + :vartype rule_group_name: str + :ivar rules: The list of rules that will be disabled. If null, all rules of the rule group will + be disabled. + :vartype rules: list[int] + """ + + _validation = { + "rule_group_name": {"required": True}, + } + + _attribute_map = { + "rule_group_name": {"key": "ruleGroupName", "type": "str"}, + "rules": {"key": "rules", "type": "[int]"}, + } + + def __init__(self, *, rule_group_name: str, rules: Optional[List[int]] = None, **kwargs: Any) -> None: + """ + :keyword rule_group_name: The name of the rule group that will be disabled. Required. + :paramtype rule_group_name: str + :keyword rules: The list of rules that will be disabled. If null, all rules of the rule group + will be disabled. + :paramtype rules: list[int] + """ + super().__init__(**kwargs) + self.rule_group_name = rule_group_name + self.rules = rules + + +class ApplicationGatewayFirewallExclusion(_serialization.Model): + """Allow to exclude some variable satisfy the condition for the WAF check. + + All required parameters must be populated in order to send to Azure. + + :ivar match_variable: The variable to be excluded. Required. + :vartype match_variable: str + :ivar selector_match_operator: When matchVariable is a collection, operate on the selector to + specify which elements in the collection this exclusion applies to. Required. + :vartype selector_match_operator: str + :ivar selector: When matchVariable is a collection, operator used to specify which elements in + the collection this exclusion applies to. Required. + :vartype selector: str + """ + + _validation = { + "match_variable": {"required": True}, + "selector_match_operator": {"required": True}, + "selector": {"required": True}, + } + + _attribute_map = { + "match_variable": {"key": "matchVariable", "type": "str"}, + "selector_match_operator": {"key": "selectorMatchOperator", "type": "str"}, + "selector": {"key": "selector", "type": "str"}, + } + + def __init__(self, *, match_variable: str, selector_match_operator: str, selector: str, **kwargs: Any) -> None: + """ + :keyword match_variable: The variable to be excluded. Required. + :paramtype match_variable: str + :keyword selector_match_operator: When matchVariable is a collection, operate on the selector + to specify which elements in the collection this exclusion applies to. Required. + :paramtype selector_match_operator: str + :keyword selector: When matchVariable is a collection, operator used to specify which elements + in the collection this exclusion applies to. Required. + :paramtype selector: str + """ + super().__init__(**kwargs) + self.match_variable = match_variable + self.selector_match_operator = selector_match_operator + self.selector = selector + + +class ApplicationGatewayFirewallManifestRuleSet(_serialization.Model): + """Properties of the web application firewall rule set. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_set_type: The type of the web application firewall rule set. Required. + :vartype rule_set_type: str + :ivar rule_set_version: The version of the web application firewall rule set type. Required. + :vartype rule_set_version: str + :ivar status: The rule set status. Known values are: "Preview", "GA", "Supported", and + "Deprecated". + :vartype status: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRuleSetStatusOptions + :ivar tiers: Tier of an application gateway that support the rule set. + :vartype tiers: list[str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTierTypes] + :ivar rule_groups: The rule groups of the web application firewall rule set. Required. + :vartype rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleGroup] + """ + + _validation = { + "rule_set_type": {"required": True}, + "rule_set_version": {"required": True}, + "rule_groups": {"required": True}, + } + + _attribute_map = { + "rule_set_type": {"key": "ruleSetType", "type": "str"}, + "rule_set_version": {"key": "ruleSetVersion", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "tiers": {"key": "tiers", "type": "[str]"}, + "rule_groups": {"key": "ruleGroups", "type": "[ApplicationGatewayFirewallRuleGroup]"}, + } + + def __init__( + self, + *, + rule_set_type: str, + rule_set_version: str, + rule_groups: List["_models.ApplicationGatewayFirewallRuleGroup"], + status: Optional[Union[str, "_models.ApplicationGatewayRuleSetStatusOptions"]] = None, + tiers: Optional[List[Union[str, "_models.ApplicationGatewayTierTypes"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_set_type: The type of the web application firewall rule set. Required. + :paramtype rule_set_type: str + :keyword rule_set_version: The version of the web application firewall rule set type. Required. + :paramtype rule_set_version: str + :keyword status: The rule set status. Known values are: "Preview", "GA", "Supported", and + "Deprecated". + :paramtype status: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRuleSetStatusOptions + :keyword tiers: Tier of an application gateway that support the rule set. + :paramtype tiers: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTierTypes] + :keyword rule_groups: The rule groups of the web application firewall rule set. Required. + :paramtype rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleGroup] + """ + super().__init__(**kwargs) + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.status = status + self.tiers = tiers + self.rule_groups = rule_groups + + +class ApplicationGatewayFirewallRule(_serialization.Model): + """A web application firewall rule. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_id: The identifier of the web application firewall rule. Required. + :vartype rule_id: int + :ivar rule_id_string: The string representation of the web application firewall rule + identifier. + :vartype rule_id_string: str + :ivar state: The string representation of the web application firewall rule state. Known values + are: "Enabled" and "Disabled". + :vartype state: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafRuleStateTypes + :ivar action: The string representation of the web application firewall rule action. Known + values are: "None", "AnomalyScoring", "Allow", "Block", and "Log". + :vartype action: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafRuleActionTypes + :ivar description: The description of the web application firewall rule. + :vartype description: str + """ + + _validation = { + "rule_id": {"required": True}, + } + + _attribute_map = { + "rule_id": {"key": "ruleId", "type": "int"}, + "rule_id_string": {"key": "ruleIdString", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + rule_id: int, + rule_id_string: Optional[str] = None, + state: Optional[Union[str, "_models.ApplicationGatewayWafRuleStateTypes"]] = None, + action: Optional[Union[str, "_models.ApplicationGatewayWafRuleActionTypes"]] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_id: The identifier of the web application firewall rule. Required. + :paramtype rule_id: int + :keyword rule_id_string: The string representation of the web application firewall rule + identifier. + :paramtype rule_id_string: str + :keyword state: The string representation of the web application firewall rule state. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafRuleStateTypes + :keyword action: The string representation of the web application firewall rule action. Known + values are: "None", "AnomalyScoring", "Allow", "Block", and "Log". + :paramtype action: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafRuleActionTypes + :keyword description: The description of the web application firewall rule. + :paramtype description: str + """ + super().__init__(**kwargs) + self.rule_id = rule_id + self.rule_id_string = rule_id_string + self.state = state + self.action = action + self.description = description + + +class ApplicationGatewayFirewallRuleGroup(_serialization.Model): + """A web application firewall rule group. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_group_name: The name of the web application firewall rule group. Required. + :vartype rule_group_name: str + :ivar description: The description of the web application firewall rule group. + :vartype description: str + :ivar rules: The rules of the web application firewall rule group. Required. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRule] + """ + + _validation = { + "rule_group_name": {"required": True}, + "rules": {"required": True}, + } + + _attribute_map = { + "rule_group_name": {"key": "ruleGroupName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "rules": {"key": "rules", "type": "[ApplicationGatewayFirewallRule]"}, + } + + def __init__( + self, + *, + rule_group_name: str, + rules: List["_models.ApplicationGatewayFirewallRule"], + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_group_name: The name of the web application firewall rule group. Required. + :paramtype rule_group_name: str + :keyword description: The description of the web application firewall rule group. + :paramtype description: str + :keyword rules: The rules of the web application firewall rule group. Required. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRule] + """ + super().__init__(**kwargs) + self.rule_group_name = rule_group_name + self.description = description + self.rules = rules + + +class ApplicationGatewayFirewallRuleSet(Resource): + """A web application firewall rule set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar provisioning_state: The provisioning state of the web application firewall rule set. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar rule_set_type: The type of the web application firewall rule set. + :vartype rule_set_type: str + :ivar rule_set_version: The version of the web application firewall rule set type. + :vartype rule_set_version: str + :ivar rule_groups: The rule groups of the web application firewall rule set. + :vartype rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleGroup] + :ivar tiers: Tier of an application gateway that support the rule set. + :vartype tiers: list[str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTierTypes] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "rule_set_type": {"key": "properties.ruleSetType", "type": "str"}, + "rule_set_version": {"key": "properties.ruleSetVersion", "type": "str"}, + "rule_groups": {"key": "properties.ruleGroups", "type": "[ApplicationGatewayFirewallRuleGroup]"}, + "tiers": {"key": "properties.tiers", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + rule_set_type: Optional[str] = None, + rule_set_version: Optional[str] = None, + rule_groups: Optional[List["_models.ApplicationGatewayFirewallRuleGroup"]] = None, + tiers: Optional[List[Union[str, "_models.ApplicationGatewayTierTypes"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword rule_set_type: The type of the web application firewall rule set. + :paramtype rule_set_type: str + :keyword rule_set_version: The version of the web application firewall rule set type. + :paramtype rule_set_version: str + :keyword rule_groups: The rule groups of the web application firewall rule set. + :paramtype rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRuleGroup] + :keyword tiers: Tier of an application gateway that support the rule set. + :paramtype tiers: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTierTypes] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.rule_groups = rule_groups + self.tiers = tiers + + +class ApplicationGatewayFrontendIPConfiguration(SubResource): + """Frontend IP configuration of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the frontend IP configuration that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar private_ip_address: PrivateIPAddress of the network interface IP Configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: Reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar public_ip_address: Reference to the PublicIP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar private_link_configuration: Reference to the application gateway private link + configuration. + :vartype private_link_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the frontend IP configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "SubResource"}, + "private_link_configuration": {"key": "properties.privateLinkConfiguration", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.SubResource"] = None, + public_ip_address: Optional["_models.SubResource"] = None, + private_link_configuration: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the frontend IP configuration that is unique within an Application + Gateway. + :paramtype name: str + :keyword private_ip_address: PrivateIPAddress of the network interface IP Configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: Reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword public_ip_address: Reference to the PublicIP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword private_link_configuration: Reference to the application gateway private link + configuration. + :paramtype private_link_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.public_ip_address = public_ip_address + self.private_link_configuration = private_link_configuration + self.provisioning_state = None + + +class ApplicationGatewayFrontendPort(SubResource): + """Frontend port of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the frontend port that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar port: Frontend port. + :vartype port: int + :ivar provisioning_state: The provisioning state of the frontend port resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the frontend port that is unique within an Application Gateway. + :paramtype name: str + :keyword port: Frontend port. + :paramtype port: int + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.port = port + self.provisioning_state = None + + +class ApplicationGatewayGlobalConfiguration(_serialization.Model): + """Application Gateway global configuration. + + :ivar enable_request_buffering: Enable request buffering. + :vartype enable_request_buffering: bool + :ivar enable_response_buffering: Enable response buffering. + :vartype enable_response_buffering: bool + """ + + _attribute_map = { + "enable_request_buffering": {"key": "enableRequestBuffering", "type": "bool"}, + "enable_response_buffering": {"key": "enableResponseBuffering", "type": "bool"}, + } + + def __init__( + self, + *, + enable_request_buffering: Optional[bool] = None, + enable_response_buffering: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_request_buffering: Enable request buffering. + :paramtype enable_request_buffering: bool + :keyword enable_response_buffering: Enable response buffering. + :paramtype enable_response_buffering: bool + """ + super().__init__(**kwargs) + self.enable_request_buffering = enable_request_buffering + self.enable_response_buffering = enable_response_buffering + + +class ApplicationGatewayHeaderConfiguration(_serialization.Model): + """Header configuration of the Actions set in Application Gateway. + + :ivar header_name: Header name of the header configuration. + :vartype header_name: str + :ivar header_value: Header value of the header configuration. + :vartype header_value: str + """ + + _attribute_map = { + "header_name": {"key": "headerName", "type": "str"}, + "header_value": {"key": "headerValue", "type": "str"}, + } + + def __init__(self, *, header_name: Optional[str] = None, header_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword header_name: Header name of the header configuration. + :paramtype header_name: str + :keyword header_value: Header value of the header configuration. + :paramtype header_value: str + """ + super().__init__(**kwargs) + self.header_name = header_name + self.header_value = header_value + + +class ApplicationGatewayHttpListener(SubResource): # pylint: disable=too-many-instance-attributes + """Http listener of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the HTTP listener that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar frontend_ip_configuration: Frontend IP configuration resource of an application gateway. + :vartype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar frontend_port: Frontend port resource of an application gateway. + :vartype frontend_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar protocol: Protocol of the HTTP listener. Known values are: "Http", "Https", "Tcp", and + "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar host_name: Host name of HTTP listener. + :vartype host_name: str + :ivar ssl_certificate: SSL certificate resource of an application gateway. + :vartype ssl_certificate: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar ssl_profile: SSL profile resource of the application gateway. + :vartype ssl_profile: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar require_server_name_indication: Applicable only if protocol is https. Enables SNI for + multi-hosting. + :vartype require_server_name_indication: bool + :ivar provisioning_state: The provisioning state of the HTTP listener resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar custom_error_configurations: Custom error configurations of the HTTP listener. + :vartype custom_error_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomError] + :ivar firewall_policy: Reference to the FirewallPolicy resource. + :vartype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar host_names: List of Host names for HTTP Listener that allows special wildcard characters + as well. + :vartype host_names: list[str] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "frontend_ip_configuration": {"key": "properties.frontendIPConfiguration", "type": "SubResource"}, + "frontend_port": {"key": "properties.frontendPort", "type": "SubResource"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "ssl_certificate": {"key": "properties.sslCertificate", "type": "SubResource"}, + "ssl_profile": {"key": "properties.sslProfile", "type": "SubResource"}, + "require_server_name_indication": {"key": "properties.requireServerNameIndication", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "custom_error_configurations": { + "key": "properties.customErrorConfigurations", + "type": "[ApplicationGatewayCustomError]", + }, + "firewall_policy": {"key": "properties.firewallPolicy", "type": "SubResource"}, + "host_names": {"key": "properties.hostNames", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + frontend_ip_configuration: Optional["_models.SubResource"] = None, + frontend_port: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + host_name: Optional[str] = None, + ssl_certificate: Optional["_models.SubResource"] = None, + ssl_profile: Optional["_models.SubResource"] = None, + require_server_name_indication: Optional[bool] = None, + custom_error_configurations: Optional[List["_models.ApplicationGatewayCustomError"]] = None, + firewall_policy: Optional["_models.SubResource"] = None, + host_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the HTTP listener that is unique within an Application Gateway. + :paramtype name: str + :keyword frontend_ip_configuration: Frontend IP configuration resource of an application + gateway. + :paramtype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword frontend_port: Frontend port resource of an application gateway. + :paramtype frontend_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: Protocol of the HTTP listener. Known values are: "Http", "Https", "Tcp", and + "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword host_name: Host name of HTTP listener. + :paramtype host_name: str + :keyword ssl_certificate: SSL certificate resource of an application gateway. + :paramtype ssl_certificate: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword ssl_profile: SSL profile resource of the application gateway. + :paramtype ssl_profile: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword require_server_name_indication: Applicable only if protocol is https. Enables SNI for + multi-hosting. + :paramtype require_server_name_indication: bool + :keyword custom_error_configurations: Custom error configurations of the HTTP listener. + :paramtype custom_error_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayCustomError] + :keyword firewall_policy: Reference to the FirewallPolicy resource. + :paramtype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword host_names: List of Host names for HTTP Listener that allows special wildcard + characters as well. + :paramtype host_names: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.frontend_ip_configuration = frontend_ip_configuration + self.frontend_port = frontend_port + self.protocol = protocol + self.host_name = host_name + self.ssl_certificate = ssl_certificate + self.ssl_profile = ssl_profile + self.require_server_name_indication = require_server_name_indication + self.provisioning_state = None + self.custom_error_configurations = custom_error_configurations + self.firewall_policy = firewall_policy + self.host_names = host_names + + +class ApplicationGatewayIPConfiguration(SubResource): + """IP configuration of an application gateway. Currently 1 public and 1 private IP configuration + is allowed. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the IP configuration that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar subnet: Reference to the subnet resource. A subnet from where application gateway gets + its private address. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the application gateway IP configuration + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + subnet: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the IP configuration that is unique within an Application Gateway. + :paramtype name: str + :keyword subnet: Reference to the subnet resource. A subnet from where application gateway gets + its private address. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.subnet = subnet + self.provisioning_state = None + + +class ApplicationGatewayListener(SubResource): # pylint: disable=too-many-instance-attributes + """Listener of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the listener that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar frontend_ip_configuration: Frontend IP configuration resource of an application gateway. + :vartype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar frontend_port: Frontend port resource of an application gateway. + :vartype frontend_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar protocol: Protocol of the listener. Known values are: "Http", "Https", "Tcp", and "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar ssl_certificate: SSL certificate resource of an application gateway. + :vartype ssl_certificate: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar ssl_profile: SSL profile resource of the application gateway. + :vartype ssl_profile: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the listener resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar host_names: List of Server Name Indications(SNI) for TLS Multi-site Listener that allows + special wildcard characters as well. + :vartype host_names: list[str] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "frontend_ip_configuration": {"key": "properties.frontendIPConfiguration", "type": "SubResource"}, + "frontend_port": {"key": "properties.frontendPort", "type": "SubResource"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "ssl_certificate": {"key": "properties.sslCertificate", "type": "SubResource"}, + "ssl_profile": {"key": "properties.sslProfile", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "host_names": {"key": "properties.hostNames", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + frontend_ip_configuration: Optional["_models.SubResource"] = None, + frontend_port: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + ssl_certificate: Optional["_models.SubResource"] = None, + ssl_profile: Optional["_models.SubResource"] = None, + host_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the listener that is unique within an Application Gateway. + :paramtype name: str + :keyword frontend_ip_configuration: Frontend IP configuration resource of an application + gateway. + :paramtype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword frontend_port: Frontend port resource of an application gateway. + :paramtype frontend_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: Protocol of the listener. Known values are: "Http", "Https", "Tcp", and + "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword ssl_certificate: SSL certificate resource of an application gateway. + :paramtype ssl_certificate: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword ssl_profile: SSL profile resource of the application gateway. + :paramtype ssl_profile: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword host_names: List of Server Name Indications(SNI) for TLS Multi-site Listener that + allows special wildcard characters as well. + :paramtype host_names: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.frontend_ip_configuration = frontend_ip_configuration + self.frontend_port = frontend_port + self.protocol = protocol + self.ssl_certificate = ssl_certificate + self.ssl_profile = ssl_profile + self.provisioning_state = None + self.host_names = host_names + + +class ApplicationGatewayListResult(_serialization.Model): + """Response for ListApplicationGateways API service call. + + :ivar value: List of an application gateways in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationGateway"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of an application gateways in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationGatewayLoadDistributionPolicy(SubResource): + """Load Distribution Policy of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the load distribution policy that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar load_distribution_targets: Load Distribution Targets resource of an application gateway. + :vartype load_distribution_targets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionTarget] + :ivar load_distribution_algorithm: Load Distribution Targets resource of an application + gateway. Known values are: "RoundRobin", "LeastConnections", and "IpHash". + :vartype load_distribution_algorithm: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionAlgorithm + :ivar provisioning_state: The provisioning state of the Load Distribution Policy resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "load_distribution_targets": { + "key": "properties.loadDistributionTargets", + "type": "[ApplicationGatewayLoadDistributionTarget]", + }, + "load_distribution_algorithm": {"key": "properties.loadDistributionAlgorithm", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + load_distribution_targets: Optional[List["_models.ApplicationGatewayLoadDistributionTarget"]] = None, + load_distribution_algorithm: Optional[Union[str, "_models.ApplicationGatewayLoadDistributionAlgorithm"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the load distribution policy that is unique within an Application + Gateway. + :paramtype name: str + :keyword load_distribution_targets: Load Distribution Targets resource of an application + gateway. + :paramtype load_distribution_targets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionTarget] + :keyword load_distribution_algorithm: Load Distribution Targets resource of an application + gateway. Known values are: "RoundRobin", "LeastConnections", and "IpHash". + :paramtype load_distribution_algorithm: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayLoadDistributionAlgorithm + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.load_distribution_targets = load_distribution_targets + self.load_distribution_algorithm = load_distribution_algorithm + self.provisioning_state = None + + +class ApplicationGatewayLoadDistributionTarget(SubResource): + """Load Distribution Target of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the load distribution policy that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar weight_per_server: Weight per server. Range between 1 and 100. + :vartype weight_per_server: int + :ivar backend_address_pool: Backend address pool resource of the application gateway. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "weight_per_server": {"maximum": 100, "minimum": 1}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "weight_per_server": {"key": "properties.weightPerServer", "type": "int"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + weight_per_server: Optional[int] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the load distribution policy that is unique within an Application + Gateway. + :paramtype name: str + :keyword weight_per_server: Weight per server. Range between 1 and 100. + :paramtype weight_per_server: int + :keyword backend_address_pool: Backend address pool resource of the application gateway. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.weight_per_server = weight_per_server + self.backend_address_pool = backend_address_pool + + +class ApplicationGatewayOnDemandProbe(_serialization.Model): + """Details of on demand test probe request. + + :ivar protocol: The protocol used for the probe. Known values are: "Http", "Https", "Tcp", and + "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar host: Host name to send the probe to. + :vartype host: str + :ivar path: Relative path of probe. Valid path starts from '/'. Probe is sent to + :code:``://:code:``::code:``:code:``. + :vartype path: str + :ivar timeout: The probe timeout in seconds. Probe marked as failed if valid response is not + received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + :vartype timeout: int + :ivar pick_host_name_from_backend_http_settings: Whether the host header should be picked from + the backend http settings. Default value is false. + :vartype pick_host_name_from_backend_http_settings: bool + :ivar match: Criterion for classifying a healthy probe response. + :vartype match: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbeHealthResponseMatch + :ivar backend_address_pool: Reference to backend pool of application gateway to which probe + request will be sent. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_http_settings: Reference to backend http setting of application gateway to be + used for test probe. + :vartype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "protocol": {"key": "protocol", "type": "str"}, + "host": {"key": "host", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "timeout": {"key": "timeout", "type": "int"}, + "pick_host_name_from_backend_http_settings": {"key": "pickHostNameFromBackendHttpSettings", "type": "bool"}, + "match": {"key": "match", "type": "ApplicationGatewayProbeHealthResponseMatch"}, + "backend_address_pool": {"key": "backendAddressPool", "type": "SubResource"}, + "backend_http_settings": {"key": "backendHttpSettings", "type": "SubResource"}, + } + + def __init__( + self, + *, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + host: Optional[str] = None, + path: Optional[str] = None, + timeout: Optional[int] = None, + pick_host_name_from_backend_http_settings: Optional[bool] = None, + match: Optional["_models.ApplicationGatewayProbeHealthResponseMatch"] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + backend_http_settings: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword protocol: The protocol used for the probe. Known values are: "Http", "Https", "Tcp", + and "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword host: Host name to send the probe to. + :paramtype host: str + :keyword path: Relative path of probe. Valid path starts from '/'. Probe is sent to + :code:``://:code:``::code:``:code:``. + :paramtype path: str + :keyword timeout: The probe timeout in seconds. Probe marked as failed if valid response is not + received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + :paramtype timeout: int + :keyword pick_host_name_from_backend_http_settings: Whether the host header should be picked + from the backend http settings. Default value is false. + :paramtype pick_host_name_from_backend_http_settings: bool + :keyword match: Criterion for classifying a healthy probe response. + :paramtype match: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbeHealthResponseMatch + :keyword backend_address_pool: Reference to backend pool of application gateway to which probe + request will be sent. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_http_settings: Reference to backend http setting of application gateway to be + used for test probe. + :paramtype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.protocol = protocol + self.host = host + self.path = path + self.timeout = timeout + self.pick_host_name_from_backend_http_settings = pick_host_name_from_backend_http_settings + self.match = match + self.backend_address_pool = backend_address_pool + self.backend_http_settings = backend_http_settings + + +class ApplicationGatewayPathRule(SubResource): # pylint: disable=too-many-instance-attributes + """Path rule of URL path map of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the path rule that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar paths: Path rules of URL path map. + :vartype paths: list[str] + :ivar backend_address_pool: Backend address pool resource of URL path map path rule. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_http_settings: Backend http settings resource of URL path map path rule. + :vartype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar redirect_configuration: Redirect configuration resource of URL path map path rule. + :vartype redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar rewrite_rule_set: Rewrite rule set resource of URL path map path rule. + :vartype rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar load_distribution_policy: Load Distribution Policy resource of URL path map path rule. + :vartype load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the path rule resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar firewall_policy: Reference to the FirewallPolicy resource. + :vartype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "paths": {"key": "properties.paths", "type": "[str]"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "backend_http_settings": {"key": "properties.backendHttpSettings", "type": "SubResource"}, + "redirect_configuration": {"key": "properties.redirectConfiguration", "type": "SubResource"}, + "rewrite_rule_set": {"key": "properties.rewriteRuleSet", "type": "SubResource"}, + "load_distribution_policy": {"key": "properties.loadDistributionPolicy", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "firewall_policy": {"key": "properties.firewallPolicy", "type": "SubResource"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + paths: Optional[List[str]] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + backend_http_settings: Optional["_models.SubResource"] = None, + redirect_configuration: Optional["_models.SubResource"] = None, + rewrite_rule_set: Optional["_models.SubResource"] = None, + load_distribution_policy: Optional["_models.SubResource"] = None, + firewall_policy: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the path rule that is unique within an Application Gateway. + :paramtype name: str + :keyword paths: Path rules of URL path map. + :paramtype paths: list[str] + :keyword backend_address_pool: Backend address pool resource of URL path map path rule. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_http_settings: Backend http settings resource of URL path map path rule. + :paramtype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword redirect_configuration: Redirect configuration resource of URL path map path rule. + :paramtype redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword rewrite_rule_set: Rewrite rule set resource of URL path map path rule. + :paramtype rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword load_distribution_policy: Load Distribution Policy resource of URL path map path rule. + :paramtype load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword firewall_policy: Reference to the FirewallPolicy resource. + :paramtype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.paths = paths + self.backend_address_pool = backend_address_pool + self.backend_http_settings = backend_http_settings + self.redirect_configuration = redirect_configuration + self.rewrite_rule_set = rewrite_rule_set + self.load_distribution_policy = load_distribution_policy + self.provisioning_state = None + self.firewall_policy = firewall_policy + + +class ApplicationGatewayPrivateEndpointConnection(SubResource): + """Private Endpoint connection on an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the private endpoint connection on an application gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.network.v2023_09_01.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.network.v2023_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the application gateway private endpoint + connection resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar link_identifier: The consumer link id. + :vartype link_identifier: str + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "link_identifier": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "link_identifier": {"key": "properties.linkIdentifier", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the private endpoint connection on an application gateway. + :paramtype name: str + :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.network.v2023_09_01.models.PrivateLinkServiceConnectionState + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_endpoint = None + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + self.link_identifier = None + + +class ApplicationGatewayPrivateEndpointConnectionListResult(_serialization.Model): + """Response for ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private + endpoint connections for an application gateway. + + :ivar value: List of private endpoint connections on an application gateway. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGatewayPrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationGatewayPrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of private endpoint connections on an application gateway. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationGatewayPrivateLinkConfiguration(SubResource): + """Private Link Configuration on an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the private link configuration that is unique within an Application + Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar ip_configurations: An array of application gateway private link ip configurations. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkIpConfiguration] + :ivar provisioning_state: The provisioning state of the application gateway private link + configuration. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "ip_configurations": { + "key": "properties.ipConfigurations", + "type": "[ApplicationGatewayPrivateLinkIpConfiguration]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + ip_configurations: Optional[List["_models.ApplicationGatewayPrivateLinkIpConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the private link configuration that is unique within an Application + Gateway. + :paramtype name: str + :keyword ip_configurations: An array of application gateway private link ip configurations. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkIpConfiguration] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.ip_configurations = ip_configurations + self.provisioning_state = None + + +class ApplicationGatewayPrivateLinkIpConfiguration(SubResource): + """The application gateway private link ip configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of application gateway private link ip configuration. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + :ivar private_ip_address: The private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: Reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar primary: Whether the ip configuration is primary or not. + :vartype primary: bool + :ivar provisioning_state: The provisioning state of the application gateway private link IP + configuration. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "primary": {"key": "properties.primary", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.SubResource"] = None, + primary: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of application gateway private link ip configuration. + :paramtype name: str + :keyword private_ip_address: The private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: Reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword primary: Whether the ip configuration is primary or not. + :paramtype primary: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.primary = primary + self.provisioning_state = None + + +class ApplicationGatewayPrivateLinkResource(SubResource): + """PrivateLink Resource of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the private link resource that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "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, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the private link resource that is unique within an Application Gateway. + :paramtype name: str + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class ApplicationGatewayPrivateLinkResourceListResult(_serialization.Model): + """Response for ListApplicationGatewayPrivateLinkResources API service call. Gets all private link + resources for an application gateway. + + :ivar value: List of private link resources of an application gateway. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkResource] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGatewayPrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationGatewayPrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of private link resources of an application gateway. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkResource] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationGatewayProbe(SubResource): # pylint: disable=too-many-instance-attributes + """Probe of the application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the probe that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar protocol: The protocol used for the probe. Known values are: "Http", "Https", "Tcp", and + "Tls". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :ivar host: Host name to send the probe to. + :vartype host: str + :ivar path: Relative path of probe. Valid path starts from '/'. Probe is sent to + :code:``://:code:``::code:``:code:``. + :vartype path: str + :ivar interval: The probing interval in seconds. This is the time interval between two + consecutive probes. Acceptable values are from 1 second to 86400 seconds. + :vartype interval: int + :ivar timeout: The probe timeout in seconds. Probe marked as failed if valid response is not + received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + :vartype timeout: int + :ivar unhealthy_threshold: The probe retry count. Backend server is marked down after + consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second + to 20. + :vartype unhealthy_threshold: int + :ivar pick_host_name_from_backend_http_settings: Whether the host header should be picked from + the backend http settings. Default value is false. + :vartype pick_host_name_from_backend_http_settings: bool + :ivar pick_host_name_from_backend_settings: Whether the server name indication should be picked + from the backend settings for Tls protocol. Default value is false. + :vartype pick_host_name_from_backend_settings: bool + :ivar min_servers: Minimum number of servers that are always marked healthy. Default value is + 0. + :vartype min_servers: int + :ivar match: Criterion for classifying a healthy probe response. + :vartype match: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbeHealthResponseMatch + :ivar provisioning_state: The provisioning state of the probe resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar port: Custom port which will be used for probing the backend servers. The valid value + ranges from 1 to 65535. In case not set, port from http settings will be used. This property is + valid for Basic, Standard_v2 and WAF_v2 only. + :vartype port: int + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "port": {"maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "host": {"key": "properties.host", "type": "str"}, + "path": {"key": "properties.path", "type": "str"}, + "interval": {"key": "properties.interval", "type": "int"}, + "timeout": {"key": "properties.timeout", "type": "int"}, + "unhealthy_threshold": {"key": "properties.unhealthyThreshold", "type": "int"}, + "pick_host_name_from_backend_http_settings": { + "key": "properties.pickHostNameFromBackendHttpSettings", + "type": "bool", + }, + "pick_host_name_from_backend_settings": {"key": "properties.pickHostNameFromBackendSettings", "type": "bool"}, + "min_servers": {"key": "properties.minServers", "type": "int"}, + "match": {"key": "properties.match", "type": "ApplicationGatewayProbeHealthResponseMatch"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + protocol: Optional[Union[str, "_models.ApplicationGatewayProtocol"]] = None, + host: Optional[str] = None, + path: Optional[str] = None, + interval: Optional[int] = None, + timeout: Optional[int] = None, + unhealthy_threshold: Optional[int] = None, + pick_host_name_from_backend_http_settings: Optional[bool] = None, + pick_host_name_from_backend_settings: Optional[bool] = None, + min_servers: Optional[int] = None, + match: Optional["_models.ApplicationGatewayProbeHealthResponseMatch"] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the probe that is unique within an Application Gateway. + :paramtype name: str + :keyword protocol: The protocol used for the probe. Known values are: "Http", "Https", "Tcp", + and "Tls". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProtocol + :keyword host: Host name to send the probe to. + :paramtype host: str + :keyword path: Relative path of probe. Valid path starts from '/'. Probe is sent to + :code:``://:code:``::code:``:code:``. + :paramtype path: str + :keyword interval: The probing interval in seconds. This is the time interval between two + consecutive probes. Acceptable values are from 1 second to 86400 seconds. + :paramtype interval: int + :keyword timeout: The probe timeout in seconds. Probe marked as failed if valid response is not + received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + :paramtype timeout: int + :keyword unhealthy_threshold: The probe retry count. Backend server is marked down after + consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second + to 20. + :paramtype unhealthy_threshold: int + :keyword pick_host_name_from_backend_http_settings: Whether the host header should be picked + from the backend http settings. Default value is false. + :paramtype pick_host_name_from_backend_http_settings: bool + :keyword pick_host_name_from_backend_settings: Whether the server name indication should be + picked from the backend settings for Tls protocol. Default value is false. + :paramtype pick_host_name_from_backend_settings: bool + :keyword min_servers: Minimum number of servers that are always marked healthy. Default value + is 0. + :paramtype min_servers: int + :keyword match: Criterion for classifying a healthy probe response. + :paramtype match: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayProbeHealthResponseMatch + :keyword port: Custom port which will be used for probing the backend servers. The valid value + ranges from 1 to 65535. In case not set, port from http settings will be used. This property is + valid for Basic, Standard_v2 and WAF_v2 only. + :paramtype port: int + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.protocol = protocol + self.host = host + self.path = path + self.interval = interval + self.timeout = timeout + self.unhealthy_threshold = unhealthy_threshold + self.pick_host_name_from_backend_http_settings = pick_host_name_from_backend_http_settings + self.pick_host_name_from_backend_settings = pick_host_name_from_backend_settings + self.min_servers = min_servers + self.match = match + self.provisioning_state = None + self.port = port + + +class ApplicationGatewayProbeHealthResponseMatch(_serialization.Model): + """Application gateway probe health response match. + + :ivar body: Body that must be contained in the health response. Default value is empty. + :vartype body: str + :ivar status_codes: Allowed ranges of healthy status codes. Default range of healthy status + codes is 200-399. + :vartype status_codes: list[str] + """ + + _attribute_map = { + "body": {"key": "body", "type": "str"}, + "status_codes": {"key": "statusCodes", "type": "[str]"}, + } + + def __init__(self, *, body: Optional[str] = None, status_codes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword body: Body that must be contained in the health response. Default value is empty. + :paramtype body: str + :keyword status_codes: Allowed ranges of healthy status codes. Default range of healthy status + codes is 200-399. + :paramtype status_codes: list[str] + """ + super().__init__(**kwargs) + self.body = body + self.status_codes = status_codes + + +class ApplicationGatewayRedirectConfiguration(SubResource): # pylint: disable=too-many-instance-attributes + """Redirect configuration of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the redirect configuration that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar redirect_type: HTTP redirection type. Known values are: "Permanent", "Found", "SeeOther", + and "Temporary". + :vartype redirect_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRedirectType + :ivar target_listener: Reference to a listener to redirect the request to. + :vartype target_listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar target_url: Url to redirect the request to. + :vartype target_url: str + :ivar include_path: Include path in the redirected url. + :vartype include_path: bool + :ivar include_query_string: Include query string in the redirected url. + :vartype include_query_string: bool + :ivar request_routing_rules: Request routing specifying redirect configuration. + :vartype request_routing_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar url_path_maps: Url path maps specifying default redirect configuration. + :vartype url_path_maps: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar path_rules: Path rules specifying redirect configuration. + :vartype path_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "redirect_type": {"key": "properties.redirectType", "type": "str"}, + "target_listener": {"key": "properties.targetListener", "type": "SubResource"}, + "target_url": {"key": "properties.targetUrl", "type": "str"}, + "include_path": {"key": "properties.includePath", "type": "bool"}, + "include_query_string": {"key": "properties.includeQueryString", "type": "bool"}, + "request_routing_rules": {"key": "properties.requestRoutingRules", "type": "[SubResource]"}, + "url_path_maps": {"key": "properties.urlPathMaps", "type": "[SubResource]"}, + "path_rules": {"key": "properties.pathRules", "type": "[SubResource]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + redirect_type: Optional[Union[str, "_models.ApplicationGatewayRedirectType"]] = None, + target_listener: Optional["_models.SubResource"] = None, + target_url: Optional[str] = None, + include_path: Optional[bool] = None, + include_query_string: Optional[bool] = None, + request_routing_rules: Optional[List["_models.SubResource"]] = None, + url_path_maps: Optional[List["_models.SubResource"]] = None, + path_rules: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the redirect configuration that is unique within an Application Gateway. + :paramtype name: str + :keyword redirect_type: HTTP redirection type. Known values are: "Permanent", "Found", + "SeeOther", and "Temporary". + :paramtype redirect_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRedirectType + :keyword target_listener: Reference to a listener to redirect the request to. + :paramtype target_listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword target_url: Url to redirect the request to. + :paramtype target_url: str + :keyword include_path: Include path in the redirected url. + :paramtype include_path: bool + :keyword include_query_string: Include query string in the redirected url. + :paramtype include_query_string: bool + :keyword request_routing_rules: Request routing specifying redirect configuration. + :paramtype request_routing_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword url_path_maps: Url path maps specifying default redirect configuration. + :paramtype url_path_maps: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword path_rules: Path rules specifying redirect configuration. + :paramtype path_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.redirect_type = redirect_type + self.target_listener = target_listener + self.target_url = target_url + self.include_path = include_path + self.include_query_string = include_query_string + self.request_routing_rules = request_routing_rules + self.url_path_maps = url_path_maps + self.path_rules = path_rules + + +class ApplicationGatewayRequestRoutingRule(SubResource): # pylint: disable=too-many-instance-attributes + """Request routing rule of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the request routing rule that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar rule_type: Rule type. Known values are: "Basic" and "PathBasedRouting". + :vartype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRuleType + :ivar priority: Priority of the request routing rule. + :vartype priority: int + :ivar backend_address_pool: Backend address pool resource of the application gateway. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_http_settings: Backend http settings resource of the application gateway. + :vartype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar http_listener: Http listener resource of the application gateway. + :vartype http_listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar url_path_map: URL path map resource of the application gateway. + :vartype url_path_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar rewrite_rule_set: Rewrite Rule Set resource in Basic rule of the application gateway. + :vartype rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar redirect_configuration: Redirect configuration resource of the application gateway. + :vartype redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar load_distribution_policy: Load Distribution Policy resource of the application gateway. + :vartype load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the request routing rule resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "priority": {"maximum": 20000, "minimum": 1}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rule_type": {"key": "properties.ruleType", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "backend_http_settings": {"key": "properties.backendHttpSettings", "type": "SubResource"}, + "http_listener": {"key": "properties.httpListener", "type": "SubResource"}, + "url_path_map": {"key": "properties.urlPathMap", "type": "SubResource"}, + "rewrite_rule_set": {"key": "properties.rewriteRuleSet", "type": "SubResource"}, + "redirect_configuration": {"key": "properties.redirectConfiguration", "type": "SubResource"}, + "load_distribution_policy": {"key": "properties.loadDistributionPolicy", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + rule_type: Optional[Union[str, "_models.ApplicationGatewayRequestRoutingRuleType"]] = None, + priority: Optional[int] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + backend_http_settings: Optional["_models.SubResource"] = None, + http_listener: Optional["_models.SubResource"] = None, + url_path_map: Optional["_models.SubResource"] = None, + rewrite_rule_set: Optional["_models.SubResource"] = None, + redirect_configuration: Optional["_models.SubResource"] = None, + load_distribution_policy: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the request routing rule that is unique within an Application Gateway. + :paramtype name: str + :keyword rule_type: Rule type. Known values are: "Basic" and "PathBasedRouting". + :paramtype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRuleType + :keyword priority: Priority of the request routing rule. + :paramtype priority: int + :keyword backend_address_pool: Backend address pool resource of the application gateway. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_http_settings: Backend http settings resource of the application gateway. + :paramtype backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword http_listener: Http listener resource of the application gateway. + :paramtype http_listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword url_path_map: URL path map resource of the application gateway. + :paramtype url_path_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword rewrite_rule_set: Rewrite Rule Set resource in Basic rule of the application gateway. + :paramtype rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword redirect_configuration: Redirect configuration resource of the application gateway. + :paramtype redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword load_distribution_policy: Load Distribution Policy resource of the application + gateway. + :paramtype load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.rule_type = rule_type + self.priority = priority + self.backend_address_pool = backend_address_pool + self.backend_http_settings = backend_http_settings + self.http_listener = http_listener + self.url_path_map = url_path_map + self.rewrite_rule_set = rewrite_rule_set + self.redirect_configuration = redirect_configuration + self.load_distribution_policy = load_distribution_policy + self.provisioning_state = None + + +class ApplicationGatewayRewriteRule(_serialization.Model): + """Rewrite rule of an application gateway. + + :ivar name: Name of the rewrite rule that is unique within an Application Gateway. + :vartype name: str + :ivar rule_sequence: Rule Sequence of the rewrite rule that determines the order of execution + of a particular rule in a RewriteRuleSet. + :vartype rule_sequence: int + :ivar conditions: Conditions based on which the action set execution will be evaluated. + :vartype conditions: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleCondition] + :ivar action_set: Set of actions to be done as part of the rewrite Rule. + :vartype action_set: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleActionSet + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "rule_sequence": {"key": "ruleSequence", "type": "int"}, + "conditions": {"key": "conditions", "type": "[ApplicationGatewayRewriteRuleCondition]"}, + "action_set": {"key": "actionSet", "type": "ApplicationGatewayRewriteRuleActionSet"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + rule_sequence: Optional[int] = None, + conditions: Optional[List["_models.ApplicationGatewayRewriteRuleCondition"]] = None, + action_set: Optional["_models.ApplicationGatewayRewriteRuleActionSet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the rewrite rule that is unique within an Application Gateway. + :paramtype name: str + :keyword rule_sequence: Rule Sequence of the rewrite rule that determines the order of + execution of a particular rule in a RewriteRuleSet. + :paramtype rule_sequence: int + :keyword conditions: Conditions based on which the action set execution will be evaluated. + :paramtype conditions: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleCondition] + :keyword action_set: Set of actions to be done as part of the rewrite Rule. + :paramtype action_set: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRuleActionSet + """ + super().__init__(**kwargs) + self.name = name + self.rule_sequence = rule_sequence + self.conditions = conditions + self.action_set = action_set + + +class ApplicationGatewayRewriteRuleActionSet(_serialization.Model): + """Set of actions in the Rewrite Rule in Application Gateway. + + :ivar request_header_configurations: Request Header Actions in the Action Set. + :vartype request_header_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHeaderConfiguration] + :ivar response_header_configurations: Response Header Actions in the Action Set. + :vartype response_header_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHeaderConfiguration] + :ivar url_configuration: Url Configuration Action in the Action Set. + :vartype url_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayUrlConfiguration + """ + + _attribute_map = { + "request_header_configurations": { + "key": "requestHeaderConfigurations", + "type": "[ApplicationGatewayHeaderConfiguration]", + }, + "response_header_configurations": { + "key": "responseHeaderConfigurations", + "type": "[ApplicationGatewayHeaderConfiguration]", + }, + "url_configuration": {"key": "urlConfiguration", "type": "ApplicationGatewayUrlConfiguration"}, + } + + def __init__( + self, + *, + request_header_configurations: Optional[List["_models.ApplicationGatewayHeaderConfiguration"]] = None, + response_header_configurations: Optional[List["_models.ApplicationGatewayHeaderConfiguration"]] = None, + url_configuration: Optional["_models.ApplicationGatewayUrlConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword request_header_configurations: Request Header Actions in the Action Set. + :paramtype request_header_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHeaderConfiguration] + :keyword response_header_configurations: Response Header Actions in the Action Set. + :paramtype response_header_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayHeaderConfiguration] + :keyword url_configuration: Url Configuration Action in the Action Set. + :paramtype url_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayUrlConfiguration + """ + super().__init__(**kwargs) + self.request_header_configurations = request_header_configurations + self.response_header_configurations = response_header_configurations + self.url_configuration = url_configuration + + +class ApplicationGatewayRewriteRuleCondition(_serialization.Model): + """Set of conditions in the Rewrite Rule in Application Gateway. + + :ivar variable: The condition parameter of the RewriteRuleCondition. + :vartype variable: str + :ivar pattern: The pattern, either fixed string or regular expression, that evaluates the + truthfulness of the condition. + :vartype pattern: str + :ivar ignore_case: Setting this parameter to truth value with force the pattern to do a case + in-sensitive comparison. + :vartype ignore_case: bool + :ivar negate: Setting this value as truth will force to check the negation of the condition + given by the user. + :vartype negate: bool + """ + + _attribute_map = { + "variable": {"key": "variable", "type": "str"}, + "pattern": {"key": "pattern", "type": "str"}, + "ignore_case": {"key": "ignoreCase", "type": "bool"}, + "negate": {"key": "negate", "type": "bool"}, + } + + def __init__( + self, + *, + variable: Optional[str] = None, + pattern: Optional[str] = None, + ignore_case: Optional[bool] = None, + negate: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword variable: The condition parameter of the RewriteRuleCondition. + :paramtype variable: str + :keyword pattern: The pattern, either fixed string or regular expression, that evaluates the + truthfulness of the condition. + :paramtype pattern: str + :keyword ignore_case: Setting this parameter to truth value with force the pattern to do a case + in-sensitive comparison. + :paramtype ignore_case: bool + :keyword negate: Setting this value as truth will force to check the negation of the condition + given by the user. + :paramtype negate: bool + """ + super().__init__(**kwargs) + self.variable = variable + self.pattern = pattern + self.ignore_case = ignore_case + self.negate = negate + + +class ApplicationGatewayRewriteRuleSet(SubResource): + """Rewrite rule set of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the rewrite rule set that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar rewrite_rules: Rewrite rules in the rewrite rule set. + :vartype rewrite_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRule] + :ivar provisioning_state: The provisioning state of the rewrite rule set resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "rewrite_rules": {"key": "properties.rewriteRules", "type": "[ApplicationGatewayRewriteRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + rewrite_rules: Optional[List["_models.ApplicationGatewayRewriteRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the rewrite rule set that is unique within an Application Gateway. + :paramtype name: str + :keyword rewrite_rules: Rewrite rules in the rewrite rule set. + :paramtype rewrite_rules: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRewriteRule] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.rewrite_rules = rewrite_rules + self.provisioning_state = None + + +class ApplicationGatewayRoutingRule(SubResource): + """Routing rule of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the routing rule that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar rule_type: Rule type. Known values are: "Basic" and "PathBasedRouting". + :vartype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRuleType + :ivar priority: Priority of the routing rule. + :vartype priority: int + :ivar backend_address_pool: Backend address pool resource of the application gateway. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_settings: Backend settings resource of the application gateway. + :vartype backend_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar listener: Listener resource of the application gateway. + :vartype listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the request routing rule resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "priority": {"maximum": 20000, "minimum": 1}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rule_type": {"key": "properties.ruleType", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "backend_settings": {"key": "properties.backendSettings", "type": "SubResource"}, + "listener": {"key": "properties.listener", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + rule_type: Optional[Union[str, "_models.ApplicationGatewayRequestRoutingRuleType"]] = None, + priority: Optional[int] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + backend_settings: Optional["_models.SubResource"] = None, + listener: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the routing rule that is unique within an Application Gateway. + :paramtype name: str + :keyword rule_type: Rule type. Known values are: "Basic" and "PathBasedRouting". + :paramtype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayRequestRoutingRuleType + :keyword priority: Priority of the routing rule. + :paramtype priority: int + :keyword backend_address_pool: Backend address pool resource of the application gateway. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_settings: Backend settings resource of the application gateway. + :paramtype backend_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword listener: Listener resource of the application gateway. + :paramtype listener: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.rule_type = rule_type + self.priority = priority + self.backend_address_pool = backend_address_pool + self.backend_settings = backend_settings + self.listener = listener + self.provisioning_state = None + + +class ApplicationGatewaySku(_serialization.Model): + """SKU of an application gateway. + + :ivar name: Name of an application gateway SKU. Known values are: "Standard_Small", + "Standard_Medium", "Standard_Large", "WAF_Medium", "WAF_Large", "Standard_v2", "WAF_v2", and + "Basic". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySkuName + :ivar tier: Tier of an application gateway. Known values are: "Standard", "WAF", "Standard_v2", + "WAF_v2", and "Basic". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTier + :ivar capacity: Capacity (instance count) of an application gateway. + :vartype capacity: int + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.ApplicationGatewaySkuName"]] = None, + tier: Optional[Union[str, "_models.ApplicationGatewayTier"]] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of an application gateway SKU. Known values are: "Standard_Small", + "Standard_Medium", "Standard_Large", "WAF_Medium", "WAF_Large", "Standard_v2", "WAF_v2", and + "Basic". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySkuName + :keyword tier: Tier of an application gateway. Known values are: "Standard", "WAF", + "Standard_v2", "WAF_v2", and "Basic". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayTier + :keyword capacity: Capacity (instance count) of an application gateway. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class ApplicationGatewaySslCertificate(SubResource): + """SSL certificates of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the SSL certificate that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar data: Base-64 encoded pfx certificate. Only applicable in PUT Request. + :vartype data: str + :ivar password: Password for the pfx file specified in data. Only applicable in PUT request. + :vartype password: str + :ivar public_cert_data: Base-64 encoded Public cert data corresponding to pfx specified in + data. Only applicable in GET request. + :vartype public_cert_data: str + :ivar key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :vartype key_vault_secret_id: str + :ivar provisioning_state: The provisioning state of the SSL certificate resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "public_cert_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "data": {"key": "properties.data", "type": "str"}, + "password": {"key": "properties.password", "type": "str"}, + "public_cert_data": {"key": "properties.publicCertData", "type": "str"}, + "key_vault_secret_id": {"key": "properties.keyVaultSecretId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + data: Optional[str] = None, + password: Optional[str] = None, + key_vault_secret_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the SSL certificate that is unique within an Application Gateway. + :paramtype name: str + :keyword data: Base-64 encoded pfx certificate. Only applicable in PUT Request. + :paramtype data: str + :keyword password: Password for the pfx file specified in data. Only applicable in PUT request. + :paramtype password: str + :keyword key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :paramtype key_vault_secret_id: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.data = data + self.password = password + self.public_cert_data = None + self.key_vault_secret_id = key_vault_secret_id + self.provisioning_state = None + + +class ApplicationGatewaySslPolicy(_serialization.Model): + """Application Gateway Ssl policy. + + :ivar disabled_ssl_protocols: Ssl protocols to be disabled on application gateway. + :vartype disabled_ssl_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol] + :ivar policy_type: Type of Ssl Policy. Known values are: "Predefined", "Custom", and + "CustomV2". + :vartype policy_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyType + :ivar policy_name: Name of Ssl predefined policy. Known values are: "AppGwSslPolicy20150501", + "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S", "AppGwSslPolicy20220101", and + "AppGwSslPolicy20220101S". + :vartype policy_name: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyName + :ivar cipher_suites: Ssl cipher suites to be enabled in the specified order to application + gateway. + :vartype cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :ivar min_protocol_version: Minimum version of Ssl protocol to be supported on application + gateway. Known values are: "TLSv1_0", "TLSv1_1", "TLSv1_2", and "TLSv1_3". + :vartype min_protocol_version: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol + """ + + _attribute_map = { + "disabled_ssl_protocols": {"key": "disabledSslProtocols", "type": "[str]"}, + "policy_type": {"key": "policyType", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "cipher_suites": {"key": "cipherSuites", "type": "[str]"}, + "min_protocol_version": {"key": "minProtocolVersion", "type": "str"}, + } + + def __init__( + self, + *, + disabled_ssl_protocols: Optional[List[Union[str, "_models.ApplicationGatewaySslProtocol"]]] = None, + policy_type: Optional[Union[str, "_models.ApplicationGatewaySslPolicyType"]] = None, + policy_name: Optional[Union[str, "_models.ApplicationGatewaySslPolicyName"]] = None, + cipher_suites: Optional[List[Union[str, "_models.ApplicationGatewaySslCipherSuite"]]] = None, + min_protocol_version: Optional[Union[str, "_models.ApplicationGatewaySslProtocol"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword disabled_ssl_protocols: Ssl protocols to be disabled on application gateway. + :paramtype disabled_ssl_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol] + :keyword policy_type: Type of Ssl Policy. Known values are: "Predefined", "Custom", and + "CustomV2". + :paramtype policy_type: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyType + :keyword policy_name: Name of Ssl predefined policy. Known values are: + "AppGwSslPolicy20150501", "AppGwSslPolicy20170401", "AppGwSslPolicy20170401S", + "AppGwSslPolicy20220101", and "AppGwSslPolicy20220101S". + :paramtype policy_name: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicyName + :keyword cipher_suites: Ssl cipher suites to be enabled in the specified order to application + gateway. + :paramtype cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :keyword min_protocol_version: Minimum version of Ssl protocol to be supported on application + gateway. Known values are: "TLSv1_0", "TLSv1_1", "TLSv1_2", and "TLSv1_3". + :paramtype min_protocol_version: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol + """ + super().__init__(**kwargs) + self.disabled_ssl_protocols = disabled_ssl_protocols + self.policy_type = policy_type + self.policy_name = policy_name + self.cipher_suites = cipher_suites + self.min_protocol_version = min_protocol_version + + +class ApplicationGatewaySslPredefinedPolicy(SubResource): + """An Ssl predefined policy. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the Ssl predefined policy. + :vartype name: str + :ivar cipher_suites: Ssl cipher suites to be enabled in the specified order for application + gateway. + :vartype cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :ivar min_protocol_version: Minimum version of Ssl protocol to be supported on application + gateway. Known values are: "TLSv1_0", "TLSv1_1", "TLSv1_2", and "TLSv1_3". + :vartype min_protocol_version: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "cipher_suites": {"key": "properties.cipherSuites", "type": "[str]"}, + "min_protocol_version": {"key": "properties.minProtocolVersion", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + cipher_suites: Optional[List[Union[str, "_models.ApplicationGatewaySslCipherSuite"]]] = None, + min_protocol_version: Optional[Union[str, "_models.ApplicationGatewaySslProtocol"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the Ssl predefined policy. + :paramtype name: str + :keyword cipher_suites: Ssl cipher suites to be enabled in the specified order for application + gateway. + :paramtype cipher_suites: list[str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslCipherSuite] + :keyword min_protocol_version: Minimum version of Ssl protocol to be supported on application + gateway. Known values are: "TLSv1_0", "TLSv1_1", "TLSv1_2", and "TLSv1_3". + :paramtype min_protocol_version: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslProtocol + """ + super().__init__(id=id, **kwargs) + self.name = name + self.cipher_suites = cipher_suites + self.min_protocol_version = min_protocol_version + + +class ApplicationGatewaySslProfile(SubResource): + """SSL profile of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the SSL profile that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar trusted_client_certificates: Array of references to application gateway trusted client + certificates. + :vartype trusted_client_certificates: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar ssl_policy: SSL policy of the application gateway resource. + :vartype ssl_policy: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicy + :ivar client_auth_configuration: Client authentication configuration of the application gateway + resource. + :vartype client_auth_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayClientAuthConfiguration + :ivar provisioning_state: The provisioning state of the HTTP listener resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "trusted_client_certificates": {"key": "properties.trustedClientCertificates", "type": "[SubResource]"}, + "ssl_policy": {"key": "properties.sslPolicy", "type": "ApplicationGatewaySslPolicy"}, + "client_auth_configuration": { + "key": "properties.clientAuthConfiguration", + "type": "ApplicationGatewayClientAuthConfiguration", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + trusted_client_certificates: Optional[List["_models.SubResource"]] = None, + ssl_policy: Optional["_models.ApplicationGatewaySslPolicy"] = None, + client_auth_configuration: Optional["_models.ApplicationGatewayClientAuthConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the SSL profile that is unique within an Application Gateway. + :paramtype name: str + :keyword trusted_client_certificates: Array of references to application gateway trusted client + certificates. + :paramtype trusted_client_certificates: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword ssl_policy: SSL policy of the application gateway resource. + :paramtype ssl_policy: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPolicy + :keyword client_auth_configuration: Client authentication configuration of the application + gateway resource. + :paramtype client_auth_configuration: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayClientAuthConfiguration + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.trusted_client_certificates = trusted_client_certificates + self.ssl_policy = ssl_policy + self.client_auth_configuration = client_auth_configuration + self.provisioning_state = None + + +class ApplicationGatewayTrustedClientCertificate(SubResource): + """Trusted client certificates of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the trusted client certificate that is unique within an Application + Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar data: Certificate public data. + :vartype data: str + :ivar validated_cert_data: Validated certificate data. + :vartype validated_cert_data: str + :ivar client_cert_issuer_dn: Distinguished name of client certificate issuer. + :vartype client_cert_issuer_dn: str + :ivar provisioning_state: The provisioning state of the trusted client certificate resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "validated_cert_data": {"readonly": True}, + "client_cert_issuer_dn": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "data": {"key": "properties.data", "type": "str"}, + "validated_cert_data": {"key": "properties.validatedCertData", "type": "str"}, + "client_cert_issuer_dn": {"key": "properties.clientCertIssuerDN", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + data: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the trusted client certificate that is unique within an Application + Gateway. + :paramtype name: str + :keyword data: Certificate public data. + :paramtype data: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.data = data + self.validated_cert_data = None + self.client_cert_issuer_dn = None + self.provisioning_state = None + + +class ApplicationGatewayTrustedRootCertificate(SubResource): + """Trusted Root certificates of an application gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the trusted root certificate that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar data: Certificate public data. + :vartype data: str + :ivar key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :vartype key_vault_secret_id: str + :ivar provisioning_state: The provisioning state of the trusted root certificate resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "data": {"key": "properties.data", "type": "str"}, + "key_vault_secret_id": {"key": "properties.keyVaultSecretId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + data: Optional[str] = None, + key_vault_secret_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the trusted root certificate that is unique within an Application + Gateway. + :paramtype name: str + :keyword data: Certificate public data. + :paramtype data: str + :keyword key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :paramtype key_vault_secret_id: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.data = data + self.key_vault_secret_id = key_vault_secret_id + self.provisioning_state = None + + +class ApplicationGatewayUrlConfiguration(_serialization.Model): + """Url configuration of the Actions set in Application Gateway. + + :ivar modified_path: Url path which user has provided for url rewrite. Null means no path will + be updated. Default value is null. + :vartype modified_path: str + :ivar modified_query_string: Query string which user has provided for url rewrite. Null means + no query string will be updated. Default value is null. + :vartype modified_query_string: str + :ivar reroute: If set as true, it will re-evaluate the url path map provided in path based + request routing rules using modified path. Default value is false. + :vartype reroute: bool + """ + + _attribute_map = { + "modified_path": {"key": "modifiedPath", "type": "str"}, + "modified_query_string": {"key": "modifiedQueryString", "type": "str"}, + "reroute": {"key": "reroute", "type": "bool"}, + } + + def __init__( + self, + *, + modified_path: Optional[str] = None, + modified_query_string: Optional[str] = None, + reroute: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword modified_path: Url path which user has provided for url rewrite. Null means no path + will be updated. Default value is null. + :paramtype modified_path: str + :keyword modified_query_string: Query string which user has provided for url rewrite. Null + means no query string will be updated. Default value is null. + :paramtype modified_query_string: str + :keyword reroute: If set as true, it will re-evaluate the url path map provided in path based + request routing rules using modified path. Default value is false. + :paramtype reroute: bool + """ + super().__init__(**kwargs) + self.modified_path = modified_path + self.modified_query_string = modified_query_string + self.reroute = reroute + + +class ApplicationGatewayUrlPathMap(SubResource): # pylint: disable=too-many-instance-attributes + """UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the URL path map that is unique within an Application Gateway. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar default_backend_address_pool: Default backend address pool resource of URL path map. + :vartype default_backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar default_backend_http_settings: Default backend http settings resource of URL path map. + :vartype default_backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar default_rewrite_rule_set: Default Rewrite rule set resource of URL path map. + :vartype default_rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar default_redirect_configuration: Default redirect configuration resource of URL path map. + :vartype default_redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar default_load_distribution_policy: Default Load Distribution Policy resource of URL path + map. + :vartype default_load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar path_rules: Path rule of URL path map resource. + :vartype path_rules: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPathRule] + :ivar provisioning_state: The provisioning state of the URL path map resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "default_backend_address_pool": {"key": "properties.defaultBackendAddressPool", "type": "SubResource"}, + "default_backend_http_settings": {"key": "properties.defaultBackendHttpSettings", "type": "SubResource"}, + "default_rewrite_rule_set": {"key": "properties.defaultRewriteRuleSet", "type": "SubResource"}, + "default_redirect_configuration": {"key": "properties.defaultRedirectConfiguration", "type": "SubResource"}, + "default_load_distribution_policy": {"key": "properties.defaultLoadDistributionPolicy", "type": "SubResource"}, + "path_rules": {"key": "properties.pathRules", "type": "[ApplicationGatewayPathRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + default_backend_address_pool: Optional["_models.SubResource"] = None, + default_backend_http_settings: Optional["_models.SubResource"] = None, + default_rewrite_rule_set: Optional["_models.SubResource"] = None, + default_redirect_configuration: Optional["_models.SubResource"] = None, + default_load_distribution_policy: Optional["_models.SubResource"] = None, + path_rules: Optional[List["_models.ApplicationGatewayPathRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the URL path map that is unique within an Application Gateway. + :paramtype name: str + :keyword default_backend_address_pool: Default backend address pool resource of URL path map. + :paramtype default_backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword default_backend_http_settings: Default backend http settings resource of URL path map. + :paramtype default_backend_http_settings: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword default_rewrite_rule_set: Default Rewrite rule set resource of URL path map. + :paramtype default_rewrite_rule_set: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword default_redirect_configuration: Default redirect configuration resource of URL path + map. + :paramtype default_redirect_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword default_load_distribution_policy: Default Load Distribution Policy resource of URL + path map. + :paramtype default_load_distribution_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword path_rules: Path rule of URL path map resource. + :paramtype path_rules: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPathRule] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.default_backend_address_pool = default_backend_address_pool + self.default_backend_http_settings = default_backend_http_settings + self.default_rewrite_rule_set = default_rewrite_rule_set + self.default_redirect_configuration = default_redirect_configuration + self.default_load_distribution_policy = default_load_distribution_policy + self.path_rules = path_rules + self.provisioning_state = None + + +class ApplicationGatewayWafDynamicManifestResult(_serialization.Model): + """Response for ApplicationGatewayWafDynamicManifest API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar available_rule_sets: The available rulesets. + :vartype available_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallManifestRuleSet] + :ivar rule_set_type: The type of the web application firewall rule set. + :vartype rule_set_type: str + :ivar rule_set_version: The version of the web application firewall rule set type. + :vartype rule_set_version: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "available_rule_sets": { + "key": "properties.availableRuleSets", + "type": "[ApplicationGatewayFirewallManifestRuleSet]", + }, + "rule_set_type": {"key": "properties.defaultRuleSet.ruleSetType", "type": "str"}, + "rule_set_version": {"key": "properties.defaultRuleSet.ruleSetVersion", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + available_rule_sets: Optional[List["_models.ApplicationGatewayFirewallManifestRuleSet"]] = None, + rule_set_type: Optional[str] = None, + rule_set_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword available_rule_sets: The available rulesets. + :paramtype available_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallManifestRuleSet] + :keyword rule_set_type: The type of the web application firewall rule set. + :paramtype rule_set_type: str + :keyword rule_set_version: The version of the web application firewall rule set type. + :paramtype rule_set_version: str + """ + super().__init__(**kwargs) + self.id = id + self.name = None + self.type = None + self.available_rule_sets = available_rule_sets + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + + +class ApplicationGatewayWafDynamicManifestResultList(_serialization.Model): + """Response for ApplicationGatewayWafDynamicManifests API service call. + + :ivar value: The list of application gateway waf manifest. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationGatewayWafDynamicManifestResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ApplicationGatewayWafDynamicManifestResult"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of application gateway waf manifest. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationGatewayWebApplicationFirewallConfiguration(_serialization.Model): + """Application gateway web application firewall configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether the web application firewall is enabled or not. Required. + :vartype enabled: bool + :ivar firewall_mode: Web application firewall mode. Required. Known values are: "Detection" and + "Prevention". + :vartype firewall_mode: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallMode + :ivar rule_set_type: The type of the web application firewall rule set. Possible values are: + 'OWASP'. Required. + :vartype rule_set_type: str + :ivar rule_set_version: The version of the rule set type. Required. + :vartype rule_set_version: str + :ivar disabled_rule_groups: The disabled rule groups. + :vartype disabled_rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallDisabledRuleGroup] + :ivar request_body_check: Whether allow WAF to check request Body. + :vartype request_body_check: bool + :ivar max_request_body_size: Maximum request body size for WAF. + :vartype max_request_body_size: int + :ivar max_request_body_size_in_kb: Maximum request body size in Kb for WAF. + :vartype max_request_body_size_in_kb: int + :ivar file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. + :vartype file_upload_limit_in_mb: int + :ivar exclusions: The exclusion list. + :vartype exclusions: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallExclusion] + """ + + _validation = { + "enabled": {"required": True}, + "firewall_mode": {"required": True}, + "rule_set_type": {"required": True}, + "rule_set_version": {"required": True}, + "max_request_body_size": {"maximum": 128, "minimum": 8}, + "max_request_body_size_in_kb": {"maximum": 128, "minimum": 8}, + "file_upload_limit_in_mb": {"minimum": 0}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "firewall_mode": {"key": "firewallMode", "type": "str"}, + "rule_set_type": {"key": "ruleSetType", "type": "str"}, + "rule_set_version": {"key": "ruleSetVersion", "type": "str"}, + "disabled_rule_groups": {"key": "disabledRuleGroups", "type": "[ApplicationGatewayFirewallDisabledRuleGroup]"}, + "request_body_check": {"key": "requestBodyCheck", "type": "bool"}, + "max_request_body_size": {"key": "maxRequestBodySize", "type": "int"}, + "max_request_body_size_in_kb": {"key": "maxRequestBodySizeInKb", "type": "int"}, + "file_upload_limit_in_mb": {"key": "fileUploadLimitInMb", "type": "int"}, + "exclusions": {"key": "exclusions", "type": "[ApplicationGatewayFirewallExclusion]"}, + } + + def __init__( + self, + *, + enabled: bool, + firewall_mode: Union[str, "_models.ApplicationGatewayFirewallMode"], + rule_set_type: str, + rule_set_version: str, + disabled_rule_groups: Optional[List["_models.ApplicationGatewayFirewallDisabledRuleGroup"]] = None, + request_body_check: Optional[bool] = None, + max_request_body_size: Optional[int] = None, + max_request_body_size_in_kb: Optional[int] = None, + file_upload_limit_in_mb: Optional[int] = None, + exclusions: Optional[List["_models.ApplicationGatewayFirewallExclusion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Whether the web application firewall is enabled or not. Required. + :paramtype enabled: bool + :keyword firewall_mode: Web application firewall mode. Required. Known values are: "Detection" + and "Prevention". + :paramtype firewall_mode: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallMode + :keyword rule_set_type: The type of the web application firewall rule set. Possible values are: + 'OWASP'. Required. + :paramtype rule_set_type: str + :keyword rule_set_version: The version of the rule set type. Required. + :paramtype rule_set_version: str + :keyword disabled_rule_groups: The disabled rule groups. + :paramtype disabled_rule_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallDisabledRuleGroup] + :keyword request_body_check: Whether allow WAF to check request Body. + :paramtype request_body_check: bool + :keyword max_request_body_size: Maximum request body size for WAF. + :paramtype max_request_body_size: int + :keyword max_request_body_size_in_kb: Maximum request body size in Kb for WAF. + :paramtype max_request_body_size_in_kb: int + :keyword file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. + :paramtype file_upload_limit_in_mb: int + :keyword exclusions: The exclusion list. + :paramtype exclusions: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallExclusion] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.firewall_mode = firewall_mode + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.disabled_rule_groups = disabled_rule_groups + self.request_body_check = request_body_check + self.max_request_body_size = max_request_body_size + self.max_request_body_size_in_kb = max_request_body_size_in_kb + self.file_upload_limit_in_mb = file_upload_limit_in_mb + self.exclusions = exclusions + + +class FirewallPolicyRule(_serialization.Model): + """Properties of a rule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ApplicationRule, NatRule, NetworkRule + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar rule_type: Rule Type. Required. Known values are: "ApplicationRule", "NetworkRule", and + "NatRule". + :vartype rule_type: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleType + """ + + _validation = { + "rule_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "rule_type": {"key": "ruleType", "type": "str"}, + } + + _subtype_map = { + "rule_type": {"ApplicationRule": "ApplicationRule", "NatRule": "NatRule", "NetworkRule": "NetworkRule"} + } + + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.rule_type: Optional[str] = None + + +class ApplicationRule(FirewallPolicyRule): # pylint: disable=too-many-instance-attributes + """Rule of type application. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar rule_type: Rule Type. Required. Known values are: "ApplicationRule", "NetworkRule", and + "NatRule". + :vartype rule_type: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleType + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses or Service Tags. + :vartype destination_addresses: list[str] + :ivar protocols: Array of Application Protocols. + :vartype protocols: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleApplicationProtocol] + :ivar target_fqdns: List of FQDNs for this rule. + :vartype target_fqdns: list[str] + :ivar target_urls: List of Urls for this rule condition. + :vartype target_urls: list[str] + :ivar fqdn_tags: List of FQDN Tags for this rule. + :vartype fqdn_tags: list[str] + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + :ivar terminate_tls: Terminate TLS connections for this rule. + :vartype terminate_tls: bool + :ivar web_categories: List of destination azure web categories. + :vartype web_categories: list[str] + :ivar http_headers_to_insert: List of HTTP/S headers to insert. + :vartype http_headers_to_insert: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyHttpHeaderToInsert] + """ + + _validation = { + "rule_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "rule_type": {"key": "ruleType", "type": "str"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "protocols": {"key": "protocols", "type": "[FirewallPolicyRuleApplicationProtocol]"}, + "target_fqdns": {"key": "targetFqdns", "type": "[str]"}, + "target_urls": {"key": "targetUrls", "type": "[str]"}, + "fqdn_tags": {"key": "fqdnTags", "type": "[str]"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + "terminate_tls": {"key": "terminateTLS", "type": "bool"}, + "web_categories": {"key": "webCategories", "type": "[str]"}, + "http_headers_to_insert": {"key": "httpHeadersToInsert", "type": "[FirewallPolicyHttpHeaderToInsert]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + protocols: Optional[List["_models.FirewallPolicyRuleApplicationProtocol"]] = None, + target_fqdns: Optional[List[str]] = None, + target_urls: Optional[List[str]] = None, + fqdn_tags: Optional[List[str]] = None, + source_ip_groups: Optional[List[str]] = None, + terminate_tls: Optional[bool] = None, + web_categories: Optional[List[str]] = None, + http_headers_to_insert: Optional[List["_models.FirewallPolicyHttpHeaderToInsert"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses or Service Tags. + :paramtype destination_addresses: list[str] + :keyword protocols: Array of Application Protocols. + :paramtype protocols: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleApplicationProtocol] + :keyword target_fqdns: List of FQDNs for this rule. + :paramtype target_fqdns: list[str] + :keyword target_urls: List of Urls for this rule condition. + :paramtype target_urls: list[str] + :keyword fqdn_tags: List of FQDN Tags for this rule. + :paramtype fqdn_tags: list[str] + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + :keyword terminate_tls: Terminate TLS connections for this rule. + :paramtype terminate_tls: bool + :keyword web_categories: List of destination azure web categories. + :paramtype web_categories: list[str] + :keyword http_headers_to_insert: List of HTTP/S headers to insert. + :paramtype http_headers_to_insert: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyHttpHeaderToInsert] + """ + super().__init__(name=name, description=description, **kwargs) + self.rule_type: str = "ApplicationRule" + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.protocols = protocols + self.target_fqdns = target_fqdns + self.target_urls = target_urls + self.fqdn_tags = fqdn_tags + self.source_ip_groups = source_ip_groups + self.terminate_tls = terminate_tls + self.web_categories = web_categories + self.http_headers_to_insert = http_headers_to_insert + + +class ApplicationSecurityGroup(Resource): + """An application security group in a resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar resource_guid: The resource GUID property of the application security group resource. It + uniquely identifies a resource, even if the user changes its name or migrate the resource + across subscriptions or resource groups. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the application security group resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.resource_guid = None + self.provisioning_state = None + + +class ApplicationSecurityGroupListResult(_serialization.Model): + """A list of application security groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of application security groups. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationSecurityGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ApplicationSecurityGroup"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of application security groups. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AuthorizationListResult(_serialization.Model): + """Response for ListAuthorizations API service call retrieves all authorizations that belongs to + an ExpressRouteCircuit. + + :ivar value: The authorizations in an ExpressRoute Circuit. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitAuthorization]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitAuthorization"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The authorizations in an ExpressRoute Circuit. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AutoApprovedPrivateLinkService(_serialization.Model): + """The information of an AutoApprovedPrivateLinkService. + + :ivar private_link_service: The id of the private link service resource. + :vartype private_link_service: str + """ + + _attribute_map = { + "private_link_service": {"key": "privateLinkService", "type": "str"}, + } + + def __init__(self, *, private_link_service: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword private_link_service: The id of the private link service resource. + :paramtype private_link_service: str + """ + super().__init__(**kwargs) + self.private_link_service = private_link_service + + +class AutoApprovedPrivateLinkServicesResult(_serialization.Model): + """An array of private link service id that can be linked to a private end point with auto + approved. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of auto approved private link service. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutoApprovedPrivateLinkService]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AutoApprovedPrivateLinkService"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: An array of auto approved private link service. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class Availability(_serialization.Model): + """Availability of the metric. + + :ivar time_grain: The time grain of the availability. + :vartype time_grain: str + :ivar retention: The retention of the availability. + :vartype retention: str + :ivar blob_duration: Duration of the availability blob. + :vartype blob_duration: str + """ + + _attribute_map = { + "time_grain": {"key": "timeGrain", "type": "str"}, + "retention": {"key": "retention", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, + } + + def __init__( + self, + *, + time_grain: Optional[str] = None, + retention: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword time_grain: The time grain of the availability. + :paramtype time_grain: str + :keyword retention: The retention of the availability. + :paramtype retention: str + :keyword blob_duration: Duration of the availability blob. + :paramtype blob_duration: str + """ + super().__init__(**kwargs) + self.time_grain = time_grain + self.retention = retention + self.blob_duration = blob_duration + + +class AvailableDelegation(_serialization.Model): + """The serviceName of an AvailableDelegation indicates a possible delegation for a subnet. + + :ivar name: The name of the AvailableDelegation resource. + :vartype name: str + :ivar id: A unique identifier of the AvailableDelegation resource. + :vartype id: str + :ivar type: Resource type. + :vartype type: str + :ivar service_name: The name of the service and resource. + :vartype service_name: str + :ivar actions: The actions permitted to the service upon delegation. + :vartype actions: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "service_name": {"key": "serviceName", "type": "str"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + service_name: Optional[str] = None, + actions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the AvailableDelegation resource. + :paramtype name: str + :keyword id: A unique identifier of the AvailableDelegation resource. + :paramtype id: str + :keyword type: Resource type. + :paramtype type: str + :keyword service_name: The name of the service and resource. + :paramtype service_name: str + :keyword actions: The actions permitted to the service upon delegation. + :paramtype actions: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.service_name = service_name + self.actions = actions + + +class AvailableDelegationsResult(_serialization.Model): + """An array of available delegations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of available delegations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AvailableDelegation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AvailableDelegation"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of available delegations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AvailablePrivateEndpointType(_serialization.Model): + """The information of an AvailablePrivateEndpointType. + + :ivar name: The name of the service and resource. + :vartype name: str + :ivar id: A unique identifier of the AvailablePrivateEndpoint Type resource. + :vartype id: str + :ivar type: Resource type. + :vartype type: str + :ivar resource_name: The name of the service and resource. + :vartype resource_name: str + :ivar display_name: Display name of the resource. + :vartype display_name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + resource_name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the service and resource. + :paramtype name: str + :keyword id: A unique identifier of the AvailablePrivateEndpoint Type resource. + :paramtype id: str + :keyword type: Resource type. + :paramtype type: str + :keyword resource_name: The name of the service and resource. + :paramtype resource_name: str + :keyword display_name: Display name of the resource. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.resource_name = resource_name + self.display_name = display_name + + +class AvailablePrivateEndpointTypesResult(_serialization.Model): + """An array of available PrivateEndpoint types. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of available privateEndpoint type. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AvailablePrivateEndpointType]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AvailablePrivateEndpointType"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of available privateEndpoint type. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AvailableProvidersList(_serialization.Model): + """List of available countries with details. + + All required parameters must be populated in order to send to Azure. + + :ivar countries: List of available countries. Required. + :vartype countries: list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListCountry] + """ + + _validation = { + "countries": {"required": True}, + } + + _attribute_map = { + "countries": {"key": "countries", "type": "[AvailableProvidersListCountry]"}, + } + + def __init__(self, *, countries: List["_models.AvailableProvidersListCountry"], **kwargs: Any) -> None: + """ + :keyword countries: List of available countries. Required. + :paramtype countries: + list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListCountry] + """ + super().__init__(**kwargs) + self.countries = countries + + +class AvailableProvidersListCity(_serialization.Model): + """City or town details. + + :ivar city_name: The city or town name. + :vartype city_name: str + :ivar providers: A list of Internet service providers. + :vartype providers: list[str] + """ + + _attribute_map = { + "city_name": {"key": "cityName", "type": "str"}, + "providers": {"key": "providers", "type": "[str]"}, + } + + def __init__( + self, *, city_name: Optional[str] = None, providers: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword city_name: The city or town name. + :paramtype city_name: str + :keyword providers: A list of Internet service providers. + :paramtype providers: list[str] + """ + super().__init__(**kwargs) + self.city_name = city_name + self.providers = providers + + +class AvailableProvidersListCountry(_serialization.Model): + """Country details. + + :ivar country_name: The country name. + :vartype country_name: str + :ivar providers: A list of Internet service providers. + :vartype providers: list[str] + :ivar states: List of available states in the country. + :vartype states: list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListState] + """ + + _attribute_map = { + "country_name": {"key": "countryName", "type": "str"}, + "providers": {"key": "providers", "type": "[str]"}, + "states": {"key": "states", "type": "[AvailableProvidersListState]"}, + } + + def __init__( + self, + *, + country_name: Optional[str] = None, + providers: Optional[List[str]] = None, + states: Optional[List["_models.AvailableProvidersListState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword country_name: The country name. + :paramtype country_name: str + :keyword providers: A list of Internet service providers. + :paramtype providers: list[str] + :keyword states: List of available states in the country. + :paramtype states: list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListState] + """ + super().__init__(**kwargs) + self.country_name = country_name + self.providers = providers + self.states = states + + +class AvailableProvidersListParameters(_serialization.Model): + """Constraints that determine the list of available Internet service providers. + + :ivar azure_locations: A list of Azure regions. + :vartype azure_locations: list[str] + :ivar country: The country for available providers list. + :vartype country: str + :ivar state: The state for available providers list. + :vartype state: str + :ivar city: The city or town for available providers list. + :vartype city: str + """ + + _attribute_map = { + "azure_locations": {"key": "azureLocations", "type": "[str]"}, + "country": {"key": "country", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "city": {"key": "city", "type": "str"}, + } + + def __init__( + self, + *, + azure_locations: Optional[List[str]] = None, + country: Optional[str] = None, + state: Optional[str] = None, + city: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_locations: A list of Azure regions. + :paramtype azure_locations: list[str] + :keyword country: The country for available providers list. + :paramtype country: str + :keyword state: The state for available providers list. + :paramtype state: str + :keyword city: The city or town for available providers list. + :paramtype city: str + """ + super().__init__(**kwargs) + self.azure_locations = azure_locations + self.country = country + self.state = state + self.city = city + + +class AvailableProvidersListState(_serialization.Model): + """State details. + + :ivar state_name: The state name. + :vartype state_name: str + :ivar providers: A list of Internet service providers. + :vartype providers: list[str] + :ivar cities: List of available cities or towns in the state. + :vartype cities: list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListCity] + """ + + _attribute_map = { + "state_name": {"key": "stateName", "type": "str"}, + "providers": {"key": "providers", "type": "[str]"}, + "cities": {"key": "cities", "type": "[AvailableProvidersListCity]"}, + } + + def __init__( + self, + *, + state_name: Optional[str] = None, + providers: Optional[List[str]] = None, + cities: Optional[List["_models.AvailableProvidersListCity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword state_name: The state name. + :paramtype state_name: str + :keyword providers: A list of Internet service providers. + :paramtype providers: list[str] + :keyword cities: List of available cities or towns in the state. + :paramtype cities: list[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListCity] + """ + super().__init__(**kwargs) + self.state_name = state_name + self.providers = providers + self.cities = cities + + +class AvailableServiceAlias(_serialization.Model): + """The available service alias. + + :ivar name: The name of the service alias. + :vartype name: str + :ivar id: The ID of the service alias. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :ivar resource_name: The resource name of the service alias. + :vartype resource_name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the service alias. + :paramtype name: str + :keyword id: The ID of the service alias. + :paramtype id: str + :keyword type: The type of the resource. + :paramtype type: str + :keyword resource_name: The resource name of the service alias. + :paramtype resource_name: str + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.resource_name = resource_name + + +class AvailableServiceAliasesResult(_serialization.Model): + """An array of available service aliases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of available service aliases. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AvailableServiceAlias]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AvailableServiceAlias"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of available service aliases. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AzureAsyncOperationResult(_serialization.Model): + """The response body contains the status of the specified asynchronous operation, indicating + whether it has succeeded, is in progress, or has failed. Note that this status is distinct from + the HTTP status code returned for the Get Operation Status operation itself. If the + asynchronous operation succeeded, the response body includes the HTTP status code for the + successful request. If the asynchronous operation failed, the response body includes the HTTP + status code for the failed request and error information regarding the failure. + + :ivar status: Status of the Azure async operation. Known values are: "InProgress", "Succeeded", + and "Failed". + :vartype status: str or ~azure.mgmt.network.v2023_09_01.models.NetworkOperationStatus + :ivar error: Details of the error occurred during specified asynchronous operation. + :vartype error: ~azure.mgmt.network.v2023_09_01.models.Error + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "Error"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.NetworkOperationStatus"]] = None, + error: Optional["_models.Error"] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Status of the Azure async operation. Known values are: "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.network.v2023_09_01.models.NetworkOperationStatus + :keyword error: Details of the error occurred during specified asynchronous operation. + :paramtype error: ~azure.mgmt.network.v2023_09_01.models.Error + """ + super().__init__(**kwargs) + self.status = status + self.error = error + + +class AzureFirewall(Resource): # pylint: disable=too-many-instance-attributes + """Azure Firewall resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar application_rule_collections: Collection of application rule collections used by Azure + Firewall. + :vartype application_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleCollection] + :ivar nat_rule_collections: Collection of NAT rule collections used by Azure Firewall. + :vartype nat_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRuleCollection] + :ivar network_rule_collections: Collection of network rule collections used by Azure Firewall. + :vartype network_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleCollection] + :ivar ip_configurations: IP configuration of the Azure Firewall resource. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallIPConfiguration] + :ivar management_ip_configuration: IP configuration of the Azure Firewall used for management + traffic. + :vartype management_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallIPConfiguration + :ivar provisioning_state: The provisioning state of the Azure firewall resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar threat_intel_mode: The operation mode for Threat Intelligence. Known values are: "Alert", + "Deny", and "Off". + :vartype threat_intel_mode: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallThreatIntelMode + :ivar virtual_hub: The virtualHub to which the firewall belongs. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar firewall_policy: The firewallPolicy associated with this azure firewall. + :vartype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar hub_ip_addresses: IP addresses associated with AzureFirewall. + :vartype hub_ip_addresses: ~azure.mgmt.network.v2023_09_01.models.HubIPAddresses + :ivar ip_groups: IpGroups associated with AzureFirewall. + :vartype ip_groups: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallIpGroups] + :ivar sku: The Azure Firewall Resource SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSku + :ivar additional_properties: The additional properties used to further config this azure + firewall. + :vartype additional_properties: dict[str, str] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "ip_groups": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "zones": {"key": "zones", "type": "[str]"}, + "etag": {"key": "etag", "type": "str"}, + "application_rule_collections": { + "key": "properties.applicationRuleCollections", + "type": "[AzureFirewallApplicationRuleCollection]", + }, + "nat_rule_collections": {"key": "properties.natRuleCollections", "type": "[AzureFirewallNatRuleCollection]"}, + "network_rule_collections": { + "key": "properties.networkRuleCollections", + "type": "[AzureFirewallNetworkRuleCollection]", + }, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[AzureFirewallIPConfiguration]"}, + "management_ip_configuration": { + "key": "properties.managementIpConfiguration", + "type": "AzureFirewallIPConfiguration", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "threat_intel_mode": {"key": "properties.threatIntelMode", "type": "str"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "SubResource"}, + "firewall_policy": {"key": "properties.firewallPolicy", "type": "SubResource"}, + "hub_ip_addresses": {"key": "properties.hubIPAddresses", "type": "HubIPAddresses"}, + "ip_groups": {"key": "properties.ipGroups", "type": "[AzureFirewallIpGroups]"}, + "sku": {"key": "properties.sku", "type": "AzureFirewallSku"}, + "additional_properties": {"key": "properties.additionalProperties", "type": "{str}"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + application_rule_collections: Optional[List["_models.AzureFirewallApplicationRuleCollection"]] = None, + nat_rule_collections: Optional[List["_models.AzureFirewallNatRuleCollection"]] = None, + network_rule_collections: Optional[List["_models.AzureFirewallNetworkRuleCollection"]] = None, + ip_configurations: Optional[List["_models.AzureFirewallIPConfiguration"]] = None, + management_ip_configuration: Optional["_models.AzureFirewallIPConfiguration"] = None, + threat_intel_mode: Optional[Union[str, "_models.AzureFirewallThreatIntelMode"]] = None, + virtual_hub: Optional["_models.SubResource"] = None, + firewall_policy: Optional["_models.SubResource"] = None, + hub_ip_addresses: Optional["_models.HubIPAddresses"] = None, + sku: Optional["_models.AzureFirewallSku"] = None, + additional_properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword application_rule_collections: Collection of application rule collections used by Azure + Firewall. + :paramtype application_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleCollection] + :keyword nat_rule_collections: Collection of NAT rule collections used by Azure Firewall. + :paramtype nat_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRuleCollection] + :keyword network_rule_collections: Collection of network rule collections used by Azure + Firewall. + :paramtype network_rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleCollection] + :keyword ip_configurations: IP configuration of the Azure Firewall resource. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallIPConfiguration] + :keyword management_ip_configuration: IP configuration of the Azure Firewall used for + management traffic. + :paramtype management_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallIPConfiguration + :keyword threat_intel_mode: The operation mode for Threat Intelligence. Known values are: + "Alert", "Deny", and "Off". + :paramtype threat_intel_mode: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallThreatIntelMode + :keyword virtual_hub: The virtualHub to which the firewall belongs. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword firewall_policy: The firewallPolicy associated with this azure firewall. + :paramtype firewall_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword hub_ip_addresses: IP addresses associated with AzureFirewall. + :paramtype hub_ip_addresses: ~azure.mgmt.network.v2023_09_01.models.HubIPAddresses + :keyword sku: The Azure Firewall Resource SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSku + :keyword additional_properties: The additional properties used to further config this azure + firewall. + :paramtype additional_properties: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.zones = zones + self.etag = None + self.application_rule_collections = application_rule_collections + self.nat_rule_collections = nat_rule_collections + self.network_rule_collections = network_rule_collections + self.ip_configurations = ip_configurations + self.management_ip_configuration = management_ip_configuration + self.provisioning_state = None + self.threat_intel_mode = threat_intel_mode + self.virtual_hub = virtual_hub + self.firewall_policy = firewall_policy + self.hub_ip_addresses = hub_ip_addresses + self.ip_groups = None + self.sku = sku + self.additional_properties = additional_properties + + +class AzureFirewallApplicationRule(_serialization.Model): + """Properties of an application rule. + + :ivar name: Name of the application rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar protocols: Array of ApplicationRuleProtocols. + :vartype protocols: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleProtocol] + :ivar target_fqdns: List of FQDNs for this rule. + :vartype target_fqdns: list[str] + :ivar fqdn_tags: List of FQDN Tags for this rule. + :vartype fqdn_tags: list[str] + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "protocols": {"key": "protocols", "type": "[AzureFirewallApplicationRuleProtocol]"}, + "target_fqdns": {"key": "targetFqdns", "type": "[str]"}, + "fqdn_tags": {"key": "fqdnTags", "type": "[str]"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + source_addresses: Optional[List[str]] = None, + protocols: Optional[List["_models.AzureFirewallApplicationRuleProtocol"]] = None, + target_fqdns: Optional[List[str]] = None, + fqdn_tags: Optional[List[str]] = None, + source_ip_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the application rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword protocols: Array of ApplicationRuleProtocols. + :paramtype protocols: + list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleProtocol] + :keyword target_fqdns: List of FQDNs for this rule. + :paramtype target_fqdns: list[str] + :keyword fqdn_tags: List of FQDN Tags for this rule. + :paramtype fqdn_tags: list[str] + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.source_addresses = source_addresses + self.protocols = protocols + self.target_fqdns = target_fqdns + self.fqdn_tags = fqdn_tags + self.source_ip_groups = source_ip_groups + + +class AzureFirewallApplicationRuleCollection(SubResource): + """Application rule collection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the Azure firewall. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar priority: Priority of the application rule collection resource. + :vartype priority: int + :ivar action: The action type of a rule collection. + :vartype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCAction + :ivar rules: Collection of rules used by a application rule collection. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRule] + :ivar provisioning_state: The provisioning state of the application rule collection resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "priority": {"maximum": 65000, "minimum": 100}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "action": {"key": "properties.action", "type": "AzureFirewallRCAction"}, + "rules": {"key": "properties.rules", "type": "[AzureFirewallApplicationRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + priority: Optional[int] = None, + action: Optional["_models.AzureFirewallRCAction"] = None, + rules: Optional[List["_models.AzureFirewallApplicationRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the Azure firewall. This name can + be used to access the resource. + :paramtype name: str + :keyword priority: Priority of the application rule collection resource. + :paramtype priority: int + :keyword action: The action type of a rule collection. + :paramtype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCAction + :keyword rules: Collection of rules used by a application rule collection. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRule] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.priority = priority + self.action = action + self.rules = rules + self.provisioning_state = None + + +class AzureFirewallApplicationRuleProtocol(_serialization.Model): + """Properties of the application rule protocol. + + :ivar protocol_type: Protocol type. Known values are: "Http", "Https", and "Mssql". + :vartype protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleProtocolType + :ivar port: Port number for the protocol, cannot be greater than 64000. This field is optional. + :vartype port: int + """ + + _validation = { + "port": {"maximum": 64000, "minimum": 0}, + } + + _attribute_map = { + "protocol_type": {"key": "protocolType", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__( + self, + *, + protocol_type: Optional[Union[str, "_models.AzureFirewallApplicationRuleProtocolType"]] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword protocol_type: Protocol type. Known values are: "Http", "Https", and "Mssql". + :paramtype protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallApplicationRuleProtocolType + :keyword port: Port number for the protocol, cannot be greater than 64000. This field is + optional. + :paramtype port: int + """ + super().__init__(**kwargs) + self.protocol_type = protocol_type + self.port = port + + +class AzureFirewallFqdnTag(Resource): + """Azure Firewall FQDN Tag Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the Azure firewall FQDN tag resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar fqdn_tag_name: The name of this FQDN Tag. + :vartype fqdn_tag_name: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "fqdn_tag_name": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "fqdn_tag_name": {"key": "properties.fqdnTagName", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.provisioning_state = None + self.fqdn_tag_name = None + + +class AzureFirewallFqdnTagListResult(_serialization.Model): + """Response for ListAzureFirewallFqdnTags API service call. + + :ivar value: List of Azure Firewall FQDN Tags in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallFqdnTag] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AzureFirewallFqdnTag]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AzureFirewallFqdnTag"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Azure Firewall FQDN Tags in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallFqdnTag] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureFirewallIPConfiguration(SubResource): + """IP configuration of an Azure Firewall. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar private_ip_address: The Firewall Internal Load Balancer IP to be used as the next hop in + User Defined Routes. + :vartype private_ip_address: str + :ivar subnet: Reference to the subnet resource. This resource must be named + 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar public_ip_address: Reference to the PublicIP resource. This field is a mandatory input if + subnet is not null. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the Azure firewall IP configuration + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "private_ip_address": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + subnet: Optional["_models.SubResource"] = None, + public_ip_address: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword subnet: Reference to the subnet resource. This resource must be named + 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword public_ip_address: Reference to the PublicIP resource. This field is a mandatory input + if subnet is not null. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_ip_address = None + self.subnet = subnet + self.public_ip_address = public_ip_address + self.provisioning_state = None + + +class AzureFirewallIpGroups(_serialization.Model): + """IpGroups associated with azure firewall. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar change_number: The iteration number. + :vartype change_number: str + """ + + _validation = { + "id": {"readonly": True}, + "change_number": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "change_number": {"key": "changeNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.change_number = None + + +class AzureFirewallListResult(_serialization.Model): + """Response for ListAzureFirewalls API service call. + + :ivar value: List of Azure Firewalls in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AzureFirewall]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AzureFirewall"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Azure Firewalls in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureFirewallNatRCAction(_serialization.Model): + """AzureFirewall NAT Rule Collection Action. + + :ivar type: The type of action. Known values are: "Snat" and "Dnat". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRCActionType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, *, type: Optional[Union[str, "_models.AzureFirewallNatRCActionType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword type: The type of action. Known values are: "Snat" and "Dnat". + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRCActionType + """ + super().__init__(**kwargs) + self.type = type + + +class AzureFirewallNatRule(_serialization.Model): + """Properties of a NAT rule. + + :ivar name: Name of the NAT rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses for this rule. Supports IP + ranges, prefixes, and service tags. + :vartype destination_addresses: list[str] + :ivar destination_ports: List of destination ports. + :vartype destination_ports: list[str] + :ivar protocols: Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + :vartype protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol] + :ivar translated_address: The translated address for this NAT rule. + :vartype translated_address: str + :ivar translated_port: The translated port for this NAT rule. + :vartype translated_port: str + :ivar translated_fqdn: The translated FQDN for this NAT rule. + :vartype translated_fqdn: str + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "protocols": {"key": "protocols", "type": "[str]"}, + "translated_address": {"key": "translatedAddress", "type": "str"}, + "translated_port": {"key": "translatedPort", "type": "str"}, + "translated_fqdn": {"key": "translatedFqdn", "type": "str"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + protocols: Optional[List[Union[str, "_models.AzureFirewallNetworkRuleProtocol"]]] = None, + translated_address: Optional[str] = None, + translated_port: Optional[str] = None, + translated_fqdn: Optional[str] = None, + source_ip_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the NAT rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses for this rule. Supports IP + ranges, prefixes, and service tags. + :paramtype destination_addresses: list[str] + :keyword destination_ports: List of destination ports. + :paramtype destination_ports: list[str] + :keyword protocols: Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + :paramtype protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol] + :keyword translated_address: The translated address for this NAT rule. + :paramtype translated_address: str + :keyword translated_port: The translated port for this NAT rule. + :paramtype translated_port: str + :keyword translated_fqdn: The translated FQDN for this NAT rule. + :paramtype translated_fqdn: str + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.destination_ports = destination_ports + self.protocols = protocols + self.translated_address = translated_address + self.translated_port = translated_port + self.translated_fqdn = translated_fqdn + self.source_ip_groups = source_ip_groups + + +class AzureFirewallNatRuleCollection(SubResource): + """NAT rule collection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the Azure firewall. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar priority: Priority of the NAT rule collection resource. + :vartype priority: int + :ivar action: The action type of a NAT rule collection. + :vartype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRCAction + :ivar rules: Collection of rules used by a NAT rule collection. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRule] + :ivar provisioning_state: The provisioning state of the NAT rule collection resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "priority": {"maximum": 65000, "minimum": 100}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "action": {"key": "properties.action", "type": "AzureFirewallNatRCAction"}, + "rules": {"key": "properties.rules", "type": "[AzureFirewallNatRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + priority: Optional[int] = None, + action: Optional["_models.AzureFirewallNatRCAction"] = None, + rules: Optional[List["_models.AzureFirewallNatRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the Azure firewall. This name can + be used to access the resource. + :paramtype name: str + :keyword priority: Priority of the NAT rule collection resource. + :paramtype priority: int + :keyword action: The action type of a NAT rule collection. + :paramtype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRCAction + :keyword rules: Collection of rules used by a NAT rule collection. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNatRule] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.priority = priority + self.action = action + self.rules = rules + self.provisioning_state = None + + +class AzureFirewallNetworkRule(_serialization.Model): + """Properties of the network rule. + + :ivar name: Name of the network rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar protocols: Array of AzureFirewallNetworkRuleProtocols. + :vartype protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol] + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses. + :vartype destination_addresses: list[str] + :ivar destination_ports: List of destination ports. + :vartype destination_ports: list[str] + :ivar destination_fqdns: List of destination FQDNs. + :vartype destination_fqdns: list[str] + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + :ivar destination_ip_groups: List of destination IpGroups for this rule. + :vartype destination_ip_groups: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "protocols": {"key": "protocols", "type": "[str]"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "destination_fqdns": {"key": "destinationFqdns", "type": "[str]"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + "destination_ip_groups": {"key": "destinationIpGroups", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + protocols: Optional[List[Union[str, "_models.AzureFirewallNetworkRuleProtocol"]]] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + destination_fqdns: Optional[List[str]] = None, + source_ip_groups: Optional[List[str]] = None, + destination_ip_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the network rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword protocols: Array of AzureFirewallNetworkRuleProtocols. + :paramtype protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol] + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses. + :paramtype destination_addresses: list[str] + :keyword destination_ports: List of destination ports. + :paramtype destination_ports: list[str] + :keyword destination_fqdns: List of destination FQDNs. + :paramtype destination_fqdns: list[str] + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + :keyword destination_ip_groups: List of destination IpGroups for this rule. + :paramtype destination_ip_groups: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.protocols = protocols + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.destination_ports = destination_ports + self.destination_fqdns = destination_fqdns + self.source_ip_groups = source_ip_groups + self.destination_ip_groups = destination_ip_groups + + +class AzureFirewallNetworkRuleCollection(SubResource): + """Network rule collection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the Azure firewall. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar priority: Priority of the network rule collection resource. + :vartype priority: int + :ivar action: The action type of a rule collection. + :vartype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCAction + :ivar rules: Collection of rules used by a network rule collection. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRule] + :ivar provisioning_state: The provisioning state of the network rule collection resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "priority": {"maximum": 65000, "minimum": 100}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "action": {"key": "properties.action", "type": "AzureFirewallRCAction"}, + "rules": {"key": "properties.rules", "type": "[AzureFirewallNetworkRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + priority: Optional[int] = None, + action: Optional["_models.AzureFirewallRCAction"] = None, + rules: Optional[List["_models.AzureFirewallNetworkRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the Azure firewall. This name can + be used to access the resource. + :paramtype name: str + :keyword priority: Priority of the network rule collection resource. + :paramtype priority: int + :keyword action: The action type of a rule collection. + :paramtype action: ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCAction + :keyword rules: Collection of rules used by a network rule collection. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRule] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.priority = priority + self.action = action + self.rules = rules + self.provisioning_state = None + + +class AzureFirewallPacketCaptureFlags(_serialization.Model): + """Properties of the AzureFirewallRCAction. + + :ivar type: Flags to capture. Known values are: "fin", "syn", "rst", "push", "ack", and "urg". + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureFlagsType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, *, type: Optional[Union[str, "_models.AzureFirewallPacketCaptureFlagsType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword type: Flags to capture. Known values are: "fin", "syn", "rst", "push", "ack", and + "urg". + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureFlagsType + """ + super().__init__(**kwargs) + self.type = type + + +class AzureFirewallPacketCaptureRule(_serialization.Model): + """Group of src/dest ips and ports to be captured. + + :ivar sources: List of source IP addresses/subnets to be captured. + :vartype sources: list[str] + :ivar destinations: List of destination IP addresses/subnets to be captured. + :vartype destinations: list[str] + :ivar destination_ports: List of ports to be captured. + :vartype destination_ports: list[str] + """ + + _attribute_map = { + "sources": {"key": "sources", "type": "[str]"}, + "destinations": {"key": "destinations", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + } + + def __init__( + self, + *, + sources: Optional[List[str]] = None, + destinations: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword sources: List of source IP addresses/subnets to be captured. + :paramtype sources: list[str] + :keyword destinations: List of destination IP addresses/subnets to be captured. + :paramtype destinations: list[str] + :keyword destination_ports: List of ports to be captured. + :paramtype destination_ports: list[str] + """ + super().__init__(**kwargs) + self.sources = sources + self.destinations = destinations + self.destination_ports = destination_ports + + +class AzureFirewallPublicIPAddress(_serialization.Model): + """Public IP Address associated with azure firewall. + + :ivar address: Public IP Address value. + :vartype address: str + """ + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + } + + def __init__(self, *, address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address: Public IP Address value. + :paramtype address: str + """ + super().__init__(**kwargs) + self.address = address + + +class AzureFirewallRCAction(_serialization.Model): + """Properties of the AzureFirewallRCAction. + + :ivar type: The type of action. Known values are: "Allow" and "Deny". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCActionType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, *, type: Optional[Union[str, "_models.AzureFirewallRCActionType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword type: The type of action. Known values are: "Allow" and "Deny". + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallRCActionType + """ + super().__init__(**kwargs) + self.type = type + + +class AzureFirewallSku(_serialization.Model): + """SKU of an Azure Firewall. + + :ivar name: Name of an Azure Firewall SKU. Known values are: "AZFW_VNet" and "AZFW_Hub". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSkuName + :ivar tier: Tier of an Azure Firewall. Known values are: "Standard", "Premium", and "Basic". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSkuTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.AzureFirewallSkuName"]] = None, + tier: Optional[Union[str, "_models.AzureFirewallSkuTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of an Azure Firewall SKU. Known values are: "AZFW_VNet" and "AZFW_Hub". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSkuName + :keyword tier: Tier of an Azure Firewall. Known values are: "Standard", "Premium", and "Basic". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.AzureFirewallSkuTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class AzureReachabilityReport(_serialization.Model): + """Azure reachability report details. + + All required parameters must be populated in order to send to Azure. + + :ivar aggregation_level: The aggregation level of Azure reachability report. Can be Country, + State or City. Required. + :vartype aggregation_level: str + :ivar provider_location: Parameters that define a geographic location. Required. + :vartype provider_location: + ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLocation + :ivar reachability_report: List of Azure reachability report items. Required. + :vartype reachability_report: + list[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportItem] + """ + + _validation = { + "aggregation_level": {"required": True}, + "provider_location": {"required": True}, + "reachability_report": {"required": True}, + } + + _attribute_map = { + "aggregation_level": {"key": "aggregationLevel", "type": "str"}, + "provider_location": {"key": "providerLocation", "type": "AzureReachabilityReportLocation"}, + "reachability_report": {"key": "reachabilityReport", "type": "[AzureReachabilityReportItem]"}, + } + + def __init__( + self, + *, + aggregation_level: str, + provider_location: "_models.AzureReachabilityReportLocation", + reachability_report: List["_models.AzureReachabilityReportItem"], + **kwargs: Any + ) -> None: + """ + :keyword aggregation_level: The aggregation level of Azure reachability report. Can be Country, + State or City. Required. + :paramtype aggregation_level: str + :keyword provider_location: Parameters that define a geographic location. Required. + :paramtype provider_location: + ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLocation + :keyword reachability_report: List of Azure reachability report items. Required. + :paramtype reachability_report: + list[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportItem] + """ + super().__init__(**kwargs) + self.aggregation_level = aggregation_level + self.provider_location = provider_location + self.reachability_report = reachability_report + + +class AzureReachabilityReportItem(_serialization.Model): + """Azure reachability report details for a given provider location. + + :ivar provider: The Internet service provider. + :vartype provider: str + :ivar azure_location: The Azure region. + :vartype azure_location: str + :ivar latencies: List of latency details for each of the time series. + :vartype latencies: + list[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLatencyInfo] + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "azure_location": {"key": "azureLocation", "type": "str"}, + "latencies": {"key": "latencies", "type": "[AzureReachabilityReportLatencyInfo]"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + azure_location: Optional[str] = None, + latencies: Optional[List["_models.AzureReachabilityReportLatencyInfo"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: The Internet service provider. + :paramtype provider: str + :keyword azure_location: The Azure region. + :paramtype azure_location: str + :keyword latencies: List of latency details for each of the time series. + :paramtype latencies: + list[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLatencyInfo] + """ + super().__init__(**kwargs) + self.provider = provider + self.azure_location = azure_location + self.latencies = latencies + + +class AzureReachabilityReportLatencyInfo(_serialization.Model): + """Details on latency for a time series. + + :ivar time_stamp: The time stamp. + :vartype time_stamp: ~datetime.datetime + :ivar score: The relative latency score between 1 and 100, higher values indicating a faster + connection. + :vartype score: int + """ + + _validation = { + "score": {"maximum": 100, "minimum": 1}, + } + + _attribute_map = { + "time_stamp": {"key": "timeStamp", "type": "iso-8601"}, + "score": {"key": "score", "type": "int"}, + } + + def __init__( + self, *, time_stamp: Optional[datetime.datetime] = None, score: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword time_stamp: The time stamp. + :paramtype time_stamp: ~datetime.datetime + :keyword score: The relative latency score between 1 and 100, higher values indicating a faster + connection. + :paramtype score: int + """ + super().__init__(**kwargs) + self.time_stamp = time_stamp + self.score = score + + +class AzureReachabilityReportLocation(_serialization.Model): + """Parameters that define a geographic location. + + All required parameters must be populated in order to send to Azure. + + :ivar country: The name of the country. Required. + :vartype country: str + :ivar state: The name of the state. + :vartype state: str + :ivar city: The name of the city or town. + :vartype city: str + """ + + _validation = { + "country": {"required": True}, + } + + _attribute_map = { + "country": {"key": "country", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "city": {"key": "city", "type": "str"}, + } + + def __init__(self, *, country: str, state: Optional[str] = None, city: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword country: The name of the country. Required. + :paramtype country: str + :keyword state: The name of the state. + :paramtype state: str + :keyword city: The name of the city or town. + :paramtype city: str + """ + super().__init__(**kwargs) + self.country = country + self.state = state + self.city = city + + +class AzureReachabilityReportParameters(_serialization.Model): + """Geographic and time constraints for Azure reachability report. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_location: Parameters that define a geographic location. Required. + :vartype provider_location: + ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLocation + :ivar providers: List of Internet service providers. + :vartype providers: list[str] + :ivar azure_locations: Optional Azure regions to scope the query to. + :vartype azure_locations: list[str] + :ivar start_time: The start time for the Azure reachability report. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the Azure reachability report. Required. + :vartype end_time: ~datetime.datetime + """ + + _validation = { + "provider_location": {"required": True}, + "start_time": {"required": True}, + "end_time": {"required": True}, + } + + _attribute_map = { + "provider_location": {"key": "providerLocation", "type": "AzureReachabilityReportLocation"}, + "providers": {"key": "providers", "type": "[str]"}, + "azure_locations": {"key": "azureLocations", "type": "[str]"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + } + + def __init__( + self, + *, + provider_location: "_models.AzureReachabilityReportLocation", + start_time: datetime.datetime, + end_time: datetime.datetime, + providers: Optional[List[str]] = None, + azure_locations: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider_location: Parameters that define a geographic location. Required. + :paramtype provider_location: + ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportLocation + :keyword providers: List of Internet service providers. + :paramtype providers: list[str] + :keyword azure_locations: Optional Azure regions to scope the query to. + :paramtype azure_locations: list[str] + :keyword start_time: The start time for the Azure reachability report. Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time for the Azure reachability report. Required. + :paramtype end_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.provider_location = provider_location + self.providers = providers + self.azure_locations = azure_locations + self.start_time = start_time + self.end_time = end_time + + +class AzureWebCategory(_serialization.Model): + """Azure Web Category Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar group: The name of the group that the category belongs to. + :vartype group: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "group": {"key": "properties.group", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + self.name = None + self.type = None + self.etag = None + self.group = None + + +class AzureWebCategoryListResult(_serialization.Model): + """Response for ListAzureWebCategories API service call. + + :ivar value: List of Azure Web Categories for a given Subscription. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.AzureWebCategory] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[AzureWebCategory]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AzureWebCategory"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Azure Web Categories for a given Subscription. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.AzureWebCategory] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BackendAddressInboundNatRulePortMappings(_serialization.Model): + """The response for a QueryInboundNatRulePortMapping API. + + :ivar inbound_nat_rule_port_mappings: Collection of inbound NAT rule port mappings. + :vartype inbound_nat_rule_port_mappings: + list[~azure.mgmt.network.v2023_09_01.models.InboundNatRulePortMapping] + """ + + _attribute_map = { + "inbound_nat_rule_port_mappings": {"key": "inboundNatRulePortMappings", "type": "[InboundNatRulePortMapping]"}, + } + + def __init__( + self, + *, + inbound_nat_rule_port_mappings: Optional[List["_models.InboundNatRulePortMapping"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_nat_rule_port_mappings: Collection of inbound NAT rule port mappings. + :paramtype inbound_nat_rule_port_mappings: + list[~azure.mgmt.network.v2023_09_01.models.InboundNatRulePortMapping] + """ + super().__init__(**kwargs) + self.inbound_nat_rule_port_mappings = inbound_nat_rule_port_mappings + + +class BackendAddressPool(SubResource): # pylint: disable=too-many-instance-attributes + """Pool of backend IP addresses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of backend address pools + used by the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar location: The location of the backend address pool. + :vartype location: str + :ivar tunnel_interfaces: An array of gateway load balancer tunnel interfaces. + :vartype tunnel_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelInterface] + :ivar load_balancer_backend_addresses: An array of backend addresses. + :vartype load_balancer_backend_addresses: + list[~azure.mgmt.network.v2023_09_01.models.LoadBalancerBackendAddress] + :ivar backend_ip_configurations: An array of references to IP addresses defined in network + interfaces. + :vartype backend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :ivar load_balancing_rules: An array of references to load balancing rules that use this + backend address pool. + :vartype load_balancing_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar outbound_rule: A reference to an outbound rule that uses this backend address pool. + :vartype outbound_rule: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar outbound_rules: An array of references to outbound rules that use this backend address + pool. + :vartype outbound_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar inbound_nat_rules: An array of references to inbound NAT rules that use this backend + address pool. + :vartype inbound_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the backend address pool resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar drain_period_in_seconds: Amount of seconds Load Balancer waits for before sending RESET + to client and backend address. + :vartype drain_period_in_seconds: int + :ivar virtual_network: A reference to a virtual network. + :vartype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar sync_mode: Backend address synchronous mode for the backend pool. Known values are: + "Automatic" and "Manual". + :vartype sync_mode: str or ~azure.mgmt.network.v2023_09_01.models.SyncMode + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "backend_ip_configurations": {"readonly": True}, + "load_balancing_rules": {"readonly": True}, + "outbound_rule": {"readonly": True}, + "outbound_rules": {"readonly": True}, + "inbound_nat_rules": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "properties.location", "type": "str"}, + "tunnel_interfaces": {"key": "properties.tunnelInterfaces", "type": "[GatewayLoadBalancerTunnelInterface]"}, + "load_balancer_backend_addresses": { + "key": "properties.loadBalancerBackendAddresses", + "type": "[LoadBalancerBackendAddress]", + }, + "backend_ip_configurations": { + "key": "properties.backendIPConfigurations", + "type": "[NetworkInterfaceIPConfiguration]", + }, + "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[SubResource]"}, + "outbound_rule": {"key": "properties.outboundRule", "type": "SubResource"}, + "outbound_rules": {"key": "properties.outboundRules", "type": "[SubResource]"}, + "inbound_nat_rules": {"key": "properties.inboundNatRules", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "drain_period_in_seconds": {"key": "properties.drainPeriodInSeconds", "type": "int"}, + "virtual_network": {"key": "properties.virtualNetwork", "type": "SubResource"}, + "sync_mode": {"key": "properties.syncMode", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + location: Optional[str] = None, + tunnel_interfaces: Optional[List["_models.GatewayLoadBalancerTunnelInterface"]] = None, + load_balancer_backend_addresses: Optional[List["_models.LoadBalancerBackendAddress"]] = None, + drain_period_in_seconds: Optional[int] = None, + virtual_network: Optional["_models.SubResource"] = None, + sync_mode: Optional[Union[str, "_models.SyncMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of backend address pools + used by the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword location: The location of the backend address pool. + :paramtype location: str + :keyword tunnel_interfaces: An array of gateway load balancer tunnel interfaces. + :paramtype tunnel_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelInterface] + :keyword load_balancer_backend_addresses: An array of backend addresses. + :paramtype load_balancer_backend_addresses: + list[~azure.mgmt.network.v2023_09_01.models.LoadBalancerBackendAddress] + :keyword drain_period_in_seconds: Amount of seconds Load Balancer waits for before sending + RESET to client and backend address. + :paramtype drain_period_in_seconds: int + :keyword virtual_network: A reference to a virtual network. + :paramtype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword sync_mode: Backend address synchronous mode for the backend pool. Known values are: + "Automatic" and "Manual". + :paramtype sync_mode: str or ~azure.mgmt.network.v2023_09_01.models.SyncMode + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.location = location + self.tunnel_interfaces = tunnel_interfaces + self.load_balancer_backend_addresses = load_balancer_backend_addresses + self.backend_ip_configurations = None + self.load_balancing_rules = None + self.outbound_rule = None + self.outbound_rules = None + self.inbound_nat_rules = None + self.provisioning_state = None + self.drain_period_in_seconds = drain_period_in_seconds + self.virtual_network = virtual_network + self.sync_mode = sync_mode + + +class BastionActiveSession(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The session detail for a target. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar start_time: The time when the session started. + :vartype start_time: JSON + :ivar target_subscription_id: The subscription id for the target virtual machine. + :vartype target_subscription_id: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar target_host_name: The host name of the target. + :vartype target_host_name: str + :ivar target_resource_group: The resource group of the target. + :vartype target_resource_group: str + :ivar user_name: The user name who is active on this session. + :vartype user_name: str + :ivar target_ip_address: The IP Address of the target. + :vartype target_ip_address: str + :ivar protocol: The protocol used to connect to the target. Known values are: "SSH" and "RDP". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.BastionConnectProtocol + :ivar target_resource_id: The resource id of the target. + :vartype target_resource_id: str + :ivar session_duration_in_mins: Duration in mins the session has been active. + :vartype session_duration_in_mins: float + """ + + _validation = { + "session_id": {"readonly": True}, + "start_time": {"readonly": True}, + "target_subscription_id": {"readonly": True}, + "resource_type": {"readonly": True}, + "target_host_name": {"readonly": True}, + "target_resource_group": {"readonly": True}, + "user_name": {"readonly": True}, + "target_ip_address": {"readonly": True}, + "protocol": {"readonly": True}, + "target_resource_id": {"readonly": True}, + "session_duration_in_mins": {"readonly": True}, + } + + _attribute_map = { + "session_id": {"key": "sessionId", "type": "str"}, + "start_time": {"key": "startTime", "type": "object"}, + "target_subscription_id": {"key": "targetSubscriptionId", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "target_host_name": {"key": "targetHostName", "type": "str"}, + "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "target_ip_address": {"key": "targetIpAddress", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "session_duration_in_mins": {"key": "sessionDurationInMins", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.session_id = None + self.start_time = None + self.target_subscription_id = None + self.resource_type = None + self.target_host_name = None + self.target_resource_group = None + self.user_name = None + self.target_ip_address = None + self.protocol = None + self.target_resource_id = None + self.session_duration_in_mins = None + + +class BastionActiveSessionListResult(_serialization.Model): + """Response for GetActiveSessions. + + :ivar value: List of active sessions on the bastion. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BastionActiveSession]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BastionActiveSession"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of active sessions on the bastion. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BastionHost(Resource): # pylint: disable=too-many-instance-attributes + """Bastion Host resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar sku: The sku of this Bastion Host. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.Sku + :ivar ip_configurations: IP configuration of the Bastion Host resource. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.BastionHostIPConfiguration] + :ivar dns_name: FQDN for the endpoint on which bastion host is accessible. + :vartype dns_name: str + :ivar virtual_network: Reference to an existing virtual network required for Developer Bastion + Host only. + :vartype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar network_acls: + :vartype network_acls: + ~azure.mgmt.network.v2023_09_01.models.BastionHostPropertiesFormatNetworkAcls + :ivar provisioning_state: The provisioning state of the bastion host resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar scale_units: The scale units for the Bastion Host resource. + :vartype scale_units: int + :ivar disable_copy_paste: Enable/Disable Copy/Paste feature of the Bastion Host resource. + :vartype disable_copy_paste: bool + :ivar enable_file_copy: Enable/Disable File Copy feature of the Bastion Host resource. + :vartype enable_file_copy: bool + :ivar enable_ip_connect: Enable/Disable IP Connect feature of the Bastion Host resource. + :vartype enable_ip_connect: bool + :ivar enable_shareable_link: Enable/Disable Shareable Link of the Bastion Host resource. + :vartype enable_shareable_link: bool + :ivar enable_tunneling: Enable/Disable Tunneling feature of the Bastion Host resource. + :vartype enable_tunneling: bool + :ivar enable_kerberos: Enable/Disable Kerberos feature of the Bastion Host resource. + :vartype enable_kerberos: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "scale_units": {"maximum": 50, "minimum": 2}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "zones": {"key": "zones", "type": "[str]"}, + "etag": {"key": "etag", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[BastionHostIPConfiguration]"}, + "dns_name": {"key": "properties.dnsName", "type": "str"}, + "virtual_network": {"key": "properties.virtualNetwork", "type": "SubResource"}, + "network_acls": {"key": "properties.networkAcls", "type": "BastionHostPropertiesFormatNetworkAcls"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "scale_units": {"key": "properties.scaleUnits", "type": "int"}, + "disable_copy_paste": {"key": "properties.disableCopyPaste", "type": "bool"}, + "enable_file_copy": {"key": "properties.enableFileCopy", "type": "bool"}, + "enable_ip_connect": {"key": "properties.enableIpConnect", "type": "bool"}, + "enable_shareable_link": {"key": "properties.enableShareableLink", "type": "bool"}, + "enable_tunneling": {"key": "properties.enableTunneling", "type": "bool"}, + "enable_kerberos": {"key": "properties.enableKerberos", "type": "bool"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + sku: Optional["_models.Sku"] = None, + ip_configurations: Optional[List["_models.BastionHostIPConfiguration"]] = None, + dns_name: Optional[str] = None, + virtual_network: Optional["_models.SubResource"] = None, + network_acls: Optional["_models.BastionHostPropertiesFormatNetworkAcls"] = None, + scale_units: Optional[int] = None, + disable_copy_paste: bool = False, + enable_file_copy: bool = False, + enable_ip_connect: bool = False, + enable_shareable_link: bool = False, + enable_tunneling: bool = False, + enable_kerberos: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword sku: The sku of this Bastion Host. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.Sku + :keyword ip_configurations: IP configuration of the Bastion Host resource. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.BastionHostIPConfiguration] + :keyword dns_name: FQDN for the endpoint on which bastion host is accessible. + :paramtype dns_name: str + :keyword virtual_network: Reference to an existing virtual network required for Developer + Bastion Host only. + :paramtype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword network_acls: + :paramtype network_acls: + ~azure.mgmt.network.v2023_09_01.models.BastionHostPropertiesFormatNetworkAcls + :keyword scale_units: The scale units for the Bastion Host resource. + :paramtype scale_units: int + :keyword disable_copy_paste: Enable/Disable Copy/Paste feature of the Bastion Host resource. + :paramtype disable_copy_paste: bool + :keyword enable_file_copy: Enable/Disable File Copy feature of the Bastion Host resource. + :paramtype enable_file_copy: bool + :keyword enable_ip_connect: Enable/Disable IP Connect feature of the Bastion Host resource. + :paramtype enable_ip_connect: bool + :keyword enable_shareable_link: Enable/Disable Shareable Link of the Bastion Host resource. + :paramtype enable_shareable_link: bool + :keyword enable_tunneling: Enable/Disable Tunneling feature of the Bastion Host resource. + :paramtype enable_tunneling: bool + :keyword enable_kerberos: Enable/Disable Kerberos feature of the Bastion Host resource. + :paramtype enable_kerberos: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.zones = zones + self.etag = None + self.sku = sku + self.ip_configurations = ip_configurations + self.dns_name = dns_name + self.virtual_network = virtual_network + self.network_acls = network_acls + self.provisioning_state = None + self.scale_units = scale_units + self.disable_copy_paste = disable_copy_paste + self.enable_file_copy = enable_file_copy + self.enable_ip_connect = enable_ip_connect + self.enable_shareable_link = enable_shareable_link + self.enable_tunneling = enable_tunneling + self.enable_kerberos = enable_kerberos + + +class BastionHostIPConfiguration(SubResource): + """IP configuration of an Bastion Host. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Ip configuration type. + :vartype type: str + :ivar subnet: Reference of the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar public_ip_address: Reference of the PublicIP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the bastion host IP configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_ip_allocation_method: Private IP allocation method. Known values are: "Static" + and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + subnet: Optional["_models.SubResource"] = None, + public_ip_address: Optional["_models.SubResource"] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword subnet: Reference of the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword public_ip_address: Reference of the PublicIP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword private_ip_allocation_method: Private IP allocation method. Known values are: "Static" + and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.subnet = subnet + self.public_ip_address = public_ip_address + self.provisioning_state = None + self.private_ip_allocation_method = private_ip_allocation_method + + +class BastionHostListResult(_serialization.Model): + """Response for ListBastionHosts API service call. + + :ivar value: List of Bastion Hosts in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BastionHost]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BastionHost"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Bastion Hosts in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BastionHostPropertiesFormatNetworkAcls(_serialization.Model): + """BastionHostPropertiesFormatNetworkAcls. + + :ivar ip_rules: Sets the IP ACL rules for Developer Bastion Host. + :vartype ip_rules: list[~azure.mgmt.network.v2023_09_01.models.IPRule] + """ + + _attribute_map = { + "ip_rules": {"key": "ipRules", "type": "[IPRule]"}, + } + + def __init__(self, *, ip_rules: Optional[List["_models.IPRule"]] = None, **kwargs: Any) -> None: + """ + :keyword ip_rules: Sets the IP ACL rules for Developer Bastion Host. + :paramtype ip_rules: list[~azure.mgmt.network.v2023_09_01.models.IPRule] + """ + super().__init__(**kwargs) + self.ip_rules = ip_rules + + +class BastionSessionDeleteResult(_serialization.Model): + """Response for DisconnectActiveSessions. + + :ivar value: List of sessions with their corresponding state. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BastionSessionState]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BastionSessionState"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of sessions with their corresponding state. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BastionSessionState(_serialization.Model): + """The session state detail for a target. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar message: Used for extra information. + :vartype message: str + :ivar state: The state of the session. Disconnected/Failed/NotFound. + :vartype state: str + """ + + _validation = { + "session_id": {"readonly": True}, + "message": {"readonly": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "session_id": {"key": "sessionId", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.session_id = None + self.message = None + self.state = None + + +class BastionShareableLink(_serialization.Model): + """Bastion Shareable Link. + + 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 vm: Reference of the virtual machine resource. Required. + :vartype vm: ~azure.mgmt.network.v2023_09_01.models.VM + :ivar bsl: The unique Bastion Shareable Link to the virtual machine. + :vartype bsl: str + :ivar created_at: The time when the link was created. + :vartype created_at: str + :ivar message: Optional field indicating the warning or error message related to the vm in case + of partial failure. + :vartype message: str + """ + + _validation = { + "vm": {"required": True}, + "bsl": {"readonly": True}, + "created_at": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "vm": {"key": "vm", "type": "VM"}, + "bsl": {"key": "bsl", "type": "str"}, + "created_at": {"key": "createdAt", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, vm: "_models.VM", **kwargs: Any) -> None: + """ + :keyword vm: Reference of the virtual machine resource. Required. + :paramtype vm: ~azure.mgmt.network.v2023_09_01.models.VM + """ + super().__init__(**kwargs) + self.vm = vm + self.bsl = None + self.created_at = None + self.message = None + + +class BastionShareableLinkListRequest(_serialization.Model): + """Post request for Create/Delete/Get Bastion Shareable Link endpoints. + + :ivar vms: List of VM references. + :vartype vms: list[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + """ + + _attribute_map = { + "vms": {"key": "vms", "type": "[BastionShareableLink]"}, + } + + def __init__(self, *, vms: Optional[List["_models.BastionShareableLink"]] = None, **kwargs: Any) -> None: + """ + :keyword vms: List of VM references. + :paramtype vms: list[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + """ + super().__init__(**kwargs) + self.vms = vms + + +class BastionShareableLinkListResult(_serialization.Model): + """Response for all the Bastion Shareable Link endpoints. + + :ivar value: List of Bastion Shareable Links for the request. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BastionShareableLink]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BastionShareableLink"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Bastion Shareable Links for the request. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BastionShareableLinkTokenListRequest(_serialization.Model): + """Post request for Delete Bastion Shareable Link By Token endpoint. + + :ivar tokens: List of Bastion Shareable Link Token. + :vartype tokens: list[str] + """ + + _attribute_map = { + "tokens": {"key": "tokens", "type": "[str]"}, + } + + def __init__(self, *, tokens: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword tokens: List of Bastion Shareable Link Token. + :paramtype tokens: list[str] + """ + super().__init__(**kwargs) + self.tokens = tokens + + +class BGPCommunity(_serialization.Model): + """Contains bgp community information offered in Service Community resources. + + :ivar service_supported_region: The region which the service support. e.g. For O365, region is + Global. + :vartype service_supported_region: str + :ivar community_name: The name of the bgp community. e.g. Skype. + :vartype community_name: str + :ivar community_value: The value of the bgp community. For more information: + https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + :vartype community_value: str + :ivar community_prefixes: The prefixes that the bgp community contains. + :vartype community_prefixes: list[str] + :ivar is_authorized_to_use: Customer is authorized to use bgp community or not. + :vartype is_authorized_to_use: bool + :ivar service_group: The service group of the bgp community contains. + :vartype service_group: str + """ + + _attribute_map = { + "service_supported_region": {"key": "serviceSupportedRegion", "type": "str"}, + "community_name": {"key": "communityName", "type": "str"}, + "community_value": {"key": "communityValue", "type": "str"}, + "community_prefixes": {"key": "communityPrefixes", "type": "[str]"}, + "is_authorized_to_use": {"key": "isAuthorizedToUse", "type": "bool"}, + "service_group": {"key": "serviceGroup", "type": "str"}, + } + + def __init__( + self, + *, + service_supported_region: Optional[str] = None, + community_name: Optional[str] = None, + community_value: Optional[str] = None, + community_prefixes: Optional[List[str]] = None, + is_authorized_to_use: Optional[bool] = None, + service_group: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_supported_region: The region which the service support. e.g. For O365, region + is Global. + :paramtype service_supported_region: str + :keyword community_name: The name of the bgp community. e.g. Skype. + :paramtype community_name: str + :keyword community_value: The value of the bgp community. For more information: + https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + :paramtype community_value: str + :keyword community_prefixes: The prefixes that the bgp community contains. + :paramtype community_prefixes: list[str] + :keyword is_authorized_to_use: Customer is authorized to use bgp community or not. + :paramtype is_authorized_to_use: bool + :keyword service_group: The service group of the bgp community contains. + :paramtype service_group: str + """ + super().__init__(**kwargs) + self.service_supported_region = service_supported_region + self.community_name = community_name + self.community_value = community_value + self.community_prefixes = community_prefixes + self.is_authorized_to_use = is_authorized_to_use + self.service_group = service_group + + +class BgpConnection(SubResource): + """Virtual Appliance Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the connection. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Connection type. + :vartype type: str + :ivar peer_asn: Peer ASN. + :vartype peer_asn: int + :ivar peer_ip: Peer IP. + :vartype peer_ip: str + :ivar hub_virtual_network_connection: The reference to the HubVirtualNetworkConnection + resource. + :vartype hub_virtual_network_connection: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar connection_state: The current state of the VirtualHub to Peer. Known values are: + "Unknown", "Connecting", "Connected", and "NotConnected". + :vartype connection_state: str or ~azure.mgmt.network.v2023_09_01.models.HubBgpConnectionStatus + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "peer_asn": {"maximum": 4294967295, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "connection_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "peer_asn": {"key": "properties.peerAsn", "type": "int"}, + "peer_ip": {"key": "properties.peerIp", "type": "str"}, + "hub_virtual_network_connection": {"key": "properties.hubVirtualNetworkConnection", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "connection_state": {"key": "properties.connectionState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + peer_asn: Optional[int] = None, + peer_ip: Optional[str] = None, + hub_virtual_network_connection: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the connection. + :paramtype name: str + :keyword peer_asn: Peer ASN. + :paramtype peer_asn: int + :keyword peer_ip: Peer IP. + :paramtype peer_ip: str + :keyword hub_virtual_network_connection: The reference to the HubVirtualNetworkConnection + resource. + :paramtype hub_virtual_network_connection: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.peer_asn = peer_asn + self.peer_ip = peer_ip + self.hub_virtual_network_connection = hub_virtual_network_connection + self.provisioning_state = None + self.connection_state = None + + +class BgpPeerStatus(_serialization.Model): + """BGP peer status details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar local_address: The virtual network gateway's local address. + :vartype local_address: str + :ivar neighbor: The remote BGP peer. + :vartype neighbor: str + :ivar asn: The autonomous system number of the remote BGP peer. + :vartype asn: int + :ivar state: The BGP peer state. Known values are: "Unknown", "Stopped", "Idle", "Connecting", + and "Connected". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.BgpPeerState + :ivar connected_duration: For how long the peering has been up. + :vartype connected_duration: str + :ivar routes_received: The number of routes learned from this peer. + :vartype routes_received: int + :ivar messages_sent: The number of BGP messages sent. + :vartype messages_sent: int + :ivar messages_received: The number of BGP messages received. + :vartype messages_received: int + """ + + _validation = { + "local_address": {"readonly": True}, + "neighbor": {"readonly": True}, + "asn": {"readonly": True, "maximum": 4294967295, "minimum": 0}, + "state": {"readonly": True}, + "connected_duration": {"readonly": True}, + "routes_received": {"readonly": True}, + "messages_sent": {"readonly": True}, + "messages_received": {"readonly": True}, + } + + _attribute_map = { + "local_address": {"key": "localAddress", "type": "str"}, + "neighbor": {"key": "neighbor", "type": "str"}, + "asn": {"key": "asn", "type": "int"}, + "state": {"key": "state", "type": "str"}, + "connected_duration": {"key": "connectedDuration", "type": "str"}, + "routes_received": {"key": "routesReceived", "type": "int"}, + "messages_sent": {"key": "messagesSent", "type": "int"}, + "messages_received": {"key": "messagesReceived", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.local_address = None + self.neighbor = None + self.asn = None + self.state = None + self.connected_duration = None + self.routes_received = None + self.messages_sent = None + self.messages_received = None + + +class BgpPeerStatusListResult(_serialization.Model): + """Response for list BGP peer status API service call. + + :ivar value: List of BGP peers. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BgpPeerStatus] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BgpPeerStatus]"}, + } + + def __init__(self, *, value: Optional[List["_models.BgpPeerStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of BGP peers. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BgpPeerStatus] + """ + super().__init__(**kwargs) + self.value = value + + +class BgpServiceCommunity(Resource): + """Service Community Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar service_name: The name of the bgp community. e.g. Skype. + :vartype service_name: str + :ivar bgp_communities: A list of bgp communities. + :vartype bgp_communities: list[~azure.mgmt.network.v2023_09_01.models.BGPCommunity] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "service_name": {"key": "properties.serviceName", "type": "str"}, + "bgp_communities": {"key": "properties.bgpCommunities", "type": "[BGPCommunity]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + service_name: Optional[str] = None, + bgp_communities: Optional[List["_models.BGPCommunity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword service_name: The name of the bgp community. e.g. Skype. + :paramtype service_name: str + :keyword bgp_communities: A list of bgp communities. + :paramtype bgp_communities: list[~azure.mgmt.network.v2023_09_01.models.BGPCommunity] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.service_name = service_name + self.bgp_communities = bgp_communities + + +class BgpServiceCommunityListResult(_serialization.Model): + """Response for the ListServiceCommunity API service call. + + :ivar value: A list of service community resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BgpServiceCommunity] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BgpServiceCommunity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.BgpServiceCommunity"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of service community resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BgpServiceCommunity] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BgpSettings(_serialization.Model): + """BGP settings details. + + :ivar asn: The BGP speaker's ASN. + :vartype asn: int + :ivar bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. + :vartype bgp_peering_address: str + :ivar peer_weight: The weight added to routes learned from this BGP speaker. + :vartype peer_weight: int + :ivar bgp_peering_addresses: BGP peering address with IP configuration ID for virtual network + gateway. + :vartype bgp_peering_addresses: + list[~azure.mgmt.network.v2023_09_01.models.IPConfigurationBgpPeeringAddress] + """ + + _validation = { + "asn": {"maximum": 4294967295, "minimum": 0}, + } + + _attribute_map = { + "asn": {"key": "asn", "type": "int"}, + "bgp_peering_address": {"key": "bgpPeeringAddress", "type": "str"}, + "peer_weight": {"key": "peerWeight", "type": "int"}, + "bgp_peering_addresses": {"key": "bgpPeeringAddresses", "type": "[IPConfigurationBgpPeeringAddress]"}, + } + + def __init__( + self, + *, + asn: Optional[int] = None, + bgp_peering_address: Optional[str] = None, + peer_weight: Optional[int] = None, + bgp_peering_addresses: Optional[List["_models.IPConfigurationBgpPeeringAddress"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword asn: The BGP speaker's ASN. + :paramtype asn: int + :keyword bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. + :paramtype bgp_peering_address: str + :keyword peer_weight: The weight added to routes learned from this BGP speaker. + :paramtype peer_weight: int + :keyword bgp_peering_addresses: BGP peering address with IP configuration ID for virtual + network gateway. + :paramtype bgp_peering_addresses: + list[~azure.mgmt.network.v2023_09_01.models.IPConfigurationBgpPeeringAddress] + """ + super().__init__(**kwargs) + self.asn = asn + self.bgp_peering_address = bgp_peering_address + self.peer_weight = peer_weight + self.bgp_peering_addresses = bgp_peering_addresses + + +class BreakOutCategoryPolicies(_serialization.Model): + """Network Virtual Appliance Sku Properties. + + :ivar allow: Flag to control breakout of o365 allow category. + :vartype allow: bool + :ivar optimize: Flag to control breakout of o365 optimize category. + :vartype optimize: bool + :ivar default: Flag to control breakout of o365 default category. + :vartype default: bool + """ + + _attribute_map = { + "allow": {"key": "allow", "type": "bool"}, + "optimize": {"key": "optimize", "type": "bool"}, + "default": {"key": "default", "type": "bool"}, + } + + def __init__( + self, + *, + allow: Optional[bool] = None, + optimize: Optional[bool] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword allow: Flag to control breakout of o365 allow category. + :paramtype allow: bool + :keyword optimize: Flag to control breakout of o365 optimize category. + :paramtype optimize: bool + :keyword default: Flag to control breakout of o365 default category. + :paramtype default: bool + """ + super().__init__(**kwargs) + self.allow = allow + self.optimize = optimize + self.default = default + + +class CheckPrivateLinkServiceVisibilityRequest(_serialization.Model): + """Request body of the CheckPrivateLinkServiceVisibility API service call. + + :ivar private_link_service_alias: The alias of the private link service. + :vartype private_link_service_alias: str + """ + + _attribute_map = { + "private_link_service_alias": {"key": "privateLinkServiceAlias", "type": "str"}, + } + + def __init__(self, *, private_link_service_alias: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword private_link_service_alias: The alias of the private link service. + :paramtype private_link_service_alias: str + """ + super().__init__(**kwargs) + self.private_link_service_alias = private_link_service_alias + + +class CloudErrorBody(_serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.network.v2023_09_01.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.network.v2023_09_01.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): + """Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ConfigurationGroup(_serialization.Model): + """The network configuration group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Network group ID. + :vartype id: str + :ivar description: A description of the network group. + :vartype description: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Network group ID. + :paramtype id: str + :keyword description: A description of the network group. + :paramtype description: str + """ + super().__init__(**kwargs) + self.id = id + self.description = description + self.provisioning_state = None + self.resource_guid = None + + +class ConnectionMonitor(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Parameters that define the operation to create a connection monitor. + + :ivar location: Connection monitor location. + :vartype location: str + :ivar tags: Connection monitor tags. + :vartype tags: dict[str, str] + :ivar source: Describes the source of connection monitor. + :vartype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :ivar destination: Describes the destination of connection monitor. + :vartype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :ivar auto_start: Determines if the connection monitor will start automatically once created. + :vartype auto_start: bool + :ivar monitoring_interval_in_seconds: Monitoring interval in seconds. + :vartype monitoring_interval_in_seconds: int + :ivar endpoints: List of connection monitor endpoints. + :vartype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :ivar test_configurations: List of connection monitor test configurations. + :vartype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :ivar test_groups: List of connection monitor test groups. + :vartype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :ivar outputs: List of connection monitor outputs. + :vartype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :ivar notes: Optional notes to be associated with the connection monitor. + :vartype notes: str + """ + + _validation = { + "monitoring_interval_in_seconds": {"maximum": 1800, "minimum": 30}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "source": {"key": "properties.source", "type": "ConnectionMonitorSource"}, + "destination": {"key": "properties.destination", "type": "ConnectionMonitorDestination"}, + "auto_start": {"key": "properties.autoStart", "type": "bool"}, + "monitoring_interval_in_seconds": {"key": "properties.monitoringIntervalInSeconds", "type": "int"}, + "endpoints": {"key": "properties.endpoints", "type": "[ConnectionMonitorEndpoint]"}, + "test_configurations": {"key": "properties.testConfigurations", "type": "[ConnectionMonitorTestConfiguration]"}, + "test_groups": {"key": "properties.testGroups", "type": "[ConnectionMonitorTestGroup]"}, + "outputs": {"key": "properties.outputs", "type": "[ConnectionMonitorOutput]"}, + "notes": {"key": "properties.notes", "type": "str"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + source: Optional["_models.ConnectionMonitorSource"] = None, + destination: Optional["_models.ConnectionMonitorDestination"] = None, + auto_start: bool = True, + monitoring_interval_in_seconds: int = 60, + endpoints: Optional[List["_models.ConnectionMonitorEndpoint"]] = None, + test_configurations: Optional[List["_models.ConnectionMonitorTestConfiguration"]] = None, + test_groups: Optional[List["_models.ConnectionMonitorTestGroup"]] = None, + outputs: Optional[List["_models.ConnectionMonitorOutput"]] = None, + notes: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Connection monitor location. + :paramtype location: str + :keyword tags: Connection monitor tags. + :paramtype tags: dict[str, str] + :keyword source: Describes the source of connection monitor. + :paramtype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :keyword destination: Describes the destination of connection monitor. + :paramtype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :keyword auto_start: Determines if the connection monitor will start automatically once + created. + :paramtype auto_start: bool + :keyword monitoring_interval_in_seconds: Monitoring interval in seconds. + :paramtype monitoring_interval_in_seconds: int + :keyword endpoints: List of connection monitor endpoints. + :paramtype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :keyword test_configurations: List of connection monitor test configurations. + :paramtype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :keyword test_groups: List of connection monitor test groups. + :paramtype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :keyword outputs: List of connection monitor outputs. + :paramtype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :keyword notes: Optional notes to be associated with the connection monitor. + :paramtype notes: str + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds + self.endpoints = endpoints + self.test_configurations = test_configurations + self.test_groups = test_groups + self.outputs = outputs + self.notes = notes + + +class ConnectionMonitorDestination(_serialization.Model): + """Describes the destination of connection monitor. + + :ivar resource_id: The ID of the resource used as the destination by connection monitor. + :vartype resource_id: str + :ivar address: Address of the connection monitor destination (IP or domain name). + :vartype address: str + :ivar port: The destination port used by connection monitor. + :vartype port: int + """ + + _validation = { + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + address: Optional[str] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The ID of the resource used as the destination by connection monitor. + :paramtype resource_id: str + :keyword address: Address of the connection monitor destination (IP or domain name). + :paramtype address: str + :keyword port: The destination port used by connection monitor. + :paramtype port: int + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.address = address + self.port = port + + +class ConnectionMonitorEndpoint(_serialization.Model): + """Describes the connection monitor endpoint. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the connection monitor endpoint. Required. + :vartype name: str + :ivar type: The endpoint type. Known values are: "AzureVM", "AzureVNet", "AzureSubnet", + "ExternalAddress", "MMAWorkspaceMachine", "MMAWorkspaceNetwork", "AzureArcVM", and "AzureVMSS". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.EndpointType + :ivar resource_id: Resource ID of the connection monitor endpoint. + :vartype resource_id: str + :ivar address: Address of the connection monitor endpoint (IP or domain name). + :vartype address: str + :ivar filter: Filter for sub-items within the endpoint. + :vartype filter: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilter + :ivar scope: Endpoint scope. + :vartype scope: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScope + :ivar coverage_level: Test coverage for the endpoint. Known values are: "Default", "Low", + "BelowAverage", "Average", "AboveAverage", and "Full". + :vartype coverage_level: str or ~azure.mgmt.network.v2023_09_01.models.CoverageLevel + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "filter": {"key": "filter", "type": "ConnectionMonitorEndpointFilter"}, + "scope": {"key": "scope", "type": "ConnectionMonitorEndpointScope"}, + "coverage_level": {"key": "coverageLevel", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + type: Optional[Union[str, "_models.EndpointType"]] = None, + resource_id: Optional[str] = None, + address: Optional[str] = None, + filter: Optional["_models.ConnectionMonitorEndpointFilter"] = None, # pylint: disable=redefined-builtin + scope: Optional["_models.ConnectionMonitorEndpointScope"] = None, + coverage_level: Optional[Union[str, "_models.CoverageLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the connection monitor endpoint. Required. + :paramtype name: str + :keyword type: The endpoint type. Known values are: "AzureVM", "AzureVNet", "AzureSubnet", + "ExternalAddress", "MMAWorkspaceMachine", "MMAWorkspaceNetwork", "AzureArcVM", and "AzureVMSS". + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.EndpointType + :keyword resource_id: Resource ID of the connection monitor endpoint. + :paramtype resource_id: str + :keyword address: Address of the connection monitor endpoint (IP or domain name). + :paramtype address: str + :keyword filter: Filter for sub-items within the endpoint. + :paramtype filter: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilter + :keyword scope: Endpoint scope. + :paramtype scope: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScope + :keyword coverage_level: Test coverage for the endpoint. Known values are: "Default", "Low", + "BelowAverage", "Average", "AboveAverage", and "Full". + :paramtype coverage_level: str or ~azure.mgmt.network.v2023_09_01.models.CoverageLevel + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.resource_id = resource_id + self.address = address + self.filter = filter + self.scope = scope + self.coverage_level = coverage_level + + +class ConnectionMonitorEndpointFilter(_serialization.Model): + """Describes the connection monitor endpoint filter. + + :ivar type: The behavior of the endpoint filter. Currently only 'Include' is supported. + "Include" + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterType + :ivar items: List of items in the filter. + :vartype items: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterItem] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "items": {"key": "items", "type": "[ConnectionMonitorEndpointFilterItem]"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ConnectionMonitorEndpointFilterType"]] = None, + items: Optional[List["_models.ConnectionMonitorEndpointFilterItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The behavior of the endpoint filter. Currently only 'Include' is supported. + "Include" + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterType + :keyword items: List of items in the filter. + :paramtype items: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterItem] + """ + super().__init__(**kwargs) + self.type = type + self.items = items + + +class ConnectionMonitorEndpointFilterItem(_serialization.Model): + """Describes the connection monitor endpoint filter item. + + :ivar type: The type of item included in the filter. Currently only 'AgentAddress' is + supported. "AgentAddress" + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterItemType + :ivar address: The address of the filter item. + :vartype address: str + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "address": {"key": "address", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ConnectionMonitorEndpointFilterItemType"]] = None, + address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of item included in the filter. Currently only 'AgentAddress' is + supported. "AgentAddress" + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointFilterItemType + :keyword address: The address of the filter item. + :paramtype address: str + """ + super().__init__(**kwargs) + self.type = type + self.address = address + + +class ConnectionMonitorEndpointScope(_serialization.Model): + """Describes the connection monitor endpoint scope. + + :ivar include: List of items which needs to be included to the endpoint scope. + :vartype include: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScopeItem] + :ivar exclude: List of items which needs to be excluded from the endpoint scope. + :vartype exclude: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScopeItem] + """ + + _attribute_map = { + "include": {"key": "include", "type": "[ConnectionMonitorEndpointScopeItem]"}, + "exclude": {"key": "exclude", "type": "[ConnectionMonitorEndpointScopeItem]"}, + } + + def __init__( + self, + *, + include: Optional[List["_models.ConnectionMonitorEndpointScopeItem"]] = None, + exclude: Optional[List["_models.ConnectionMonitorEndpointScopeItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword include: List of items which needs to be included to the endpoint scope. + :paramtype include: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScopeItem] + :keyword exclude: List of items which needs to be excluded from the endpoint scope. + :paramtype exclude: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpointScopeItem] + """ + super().__init__(**kwargs) + self.include = include + self.exclude = exclude + + +class ConnectionMonitorEndpointScopeItem(_serialization.Model): + """Describes the connection monitor endpoint scope item. + + :ivar address: The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or + IPv4/IPv6 IP address. + :vartype address: str + """ + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + } + + def __init__(self, *, address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address: The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask + or IPv4/IPv6 IP address. + :paramtype address: str + """ + super().__init__(**kwargs) + self.address = address + + +class ConnectionMonitorHttpConfiguration(_serialization.Model): + """Describes the HTTP configuration. + + :ivar port: The port to connect to. + :vartype port: int + :ivar method: The HTTP method to use. Known values are: "Get" and "Post". + :vartype method: str or ~azure.mgmt.network.v2023_09_01.models.HTTPConfigurationMethod + :ivar path: The path component of the URI. For instance, "/dir1/dir2". + :vartype path: str + :ivar request_headers: The HTTP headers to transmit with the request. + :vartype request_headers: list[~azure.mgmt.network.v2023_09_01.models.HTTPHeader] + :ivar valid_status_code_ranges: HTTP status codes to consider successful. For instance, + "2xx,301-304,418". + :vartype valid_status_code_ranges: list[str] + :ivar prefer_https: Value indicating whether HTTPS is preferred over HTTP in cases where the + choice is not explicit. + :vartype prefer_https: bool + """ + + _validation = { + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "method": {"key": "method", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "request_headers": {"key": "requestHeaders", "type": "[HTTPHeader]"}, + "valid_status_code_ranges": {"key": "validStatusCodeRanges", "type": "[str]"}, + "prefer_https": {"key": "preferHTTPS", "type": "bool"}, + } + + def __init__( + self, + *, + port: Optional[int] = None, + method: Optional[Union[str, "_models.HTTPConfigurationMethod"]] = None, + path: Optional[str] = None, + request_headers: Optional[List["_models.HTTPHeader"]] = None, + valid_status_code_ranges: Optional[List[str]] = None, + prefer_https: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword port: The port to connect to. + :paramtype port: int + :keyword method: The HTTP method to use. Known values are: "Get" and "Post". + :paramtype method: str or ~azure.mgmt.network.v2023_09_01.models.HTTPConfigurationMethod + :keyword path: The path component of the URI. For instance, "/dir1/dir2". + :paramtype path: str + :keyword request_headers: The HTTP headers to transmit with the request. + :paramtype request_headers: list[~azure.mgmt.network.v2023_09_01.models.HTTPHeader] + :keyword valid_status_code_ranges: HTTP status codes to consider successful. For instance, + "2xx,301-304,418". + :paramtype valid_status_code_ranges: list[str] + :keyword prefer_https: Value indicating whether HTTPS is preferred over HTTP in cases where the + choice is not explicit. + :paramtype prefer_https: bool + """ + super().__init__(**kwargs) + self.port = port + self.method = method + self.path = path + self.request_headers = request_headers + self.valid_status_code_ranges = valid_status_code_ranges + self.prefer_https = prefer_https + + +class ConnectionMonitorIcmpConfiguration(_serialization.Model): + """Describes the ICMP configuration. + + :ivar disable_trace_route: Value indicating whether path evaluation with trace route should be + disabled. + :vartype disable_trace_route: bool + """ + + _attribute_map = { + "disable_trace_route": {"key": "disableTraceRoute", "type": "bool"}, + } + + def __init__(self, *, disable_trace_route: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword disable_trace_route: Value indicating whether path evaluation with trace route should + be disabled. + :paramtype disable_trace_route: bool + """ + super().__init__(**kwargs) + self.disable_trace_route = disable_trace_route + + +class ConnectionMonitorListResult(_serialization.Model): + """List of connection monitors. + + :ivar value: Information about connection monitors. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ConnectionMonitorResult]"}, + } + + def __init__(self, *, value: Optional[List["_models.ConnectionMonitorResult"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Information about connection monitors. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + """ + super().__init__(**kwargs) + self.value = value + + +class ConnectionMonitorOutput(_serialization.Model): + """Describes a connection monitor output destination. + + :ivar type: Connection monitor output destination type. Currently, only "Workspace" is + supported. "Workspace" + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.OutputType + :ivar workspace_settings: Describes the settings for producing output into a log analytics + workspace. + :vartype workspace_settings: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorWorkspaceSettings + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "workspace_settings": {"key": "workspaceSettings", "type": "ConnectionMonitorWorkspaceSettings"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.OutputType"]] = None, + workspace_settings: Optional["_models.ConnectionMonitorWorkspaceSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Connection monitor output destination type. Currently, only "Workspace" is + supported. "Workspace" + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.OutputType + :keyword workspace_settings: Describes the settings for producing output into a log analytics + workspace. + :paramtype workspace_settings: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorWorkspaceSettings + """ + super().__init__(**kwargs) + self.type = type + self.workspace_settings = workspace_settings + + +class ConnectionMonitorParameters(_serialization.Model): + """Parameters that define the operation to create a connection monitor. + + :ivar source: Describes the source of connection monitor. + :vartype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :ivar destination: Describes the destination of connection monitor. + :vartype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :ivar auto_start: Determines if the connection monitor will start automatically once created. + :vartype auto_start: bool + :ivar monitoring_interval_in_seconds: Monitoring interval in seconds. + :vartype monitoring_interval_in_seconds: int + :ivar endpoints: List of connection monitor endpoints. + :vartype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :ivar test_configurations: List of connection monitor test configurations. + :vartype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :ivar test_groups: List of connection monitor test groups. + :vartype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :ivar outputs: List of connection monitor outputs. + :vartype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :ivar notes: Optional notes to be associated with the connection monitor. + :vartype notes: str + """ + + _validation = { + "monitoring_interval_in_seconds": {"maximum": 1800, "minimum": 30}, + } + + _attribute_map = { + "source": {"key": "source", "type": "ConnectionMonitorSource"}, + "destination": {"key": "destination", "type": "ConnectionMonitorDestination"}, + "auto_start": {"key": "autoStart", "type": "bool"}, + "monitoring_interval_in_seconds": {"key": "monitoringIntervalInSeconds", "type": "int"}, + "endpoints": {"key": "endpoints", "type": "[ConnectionMonitorEndpoint]"}, + "test_configurations": {"key": "testConfigurations", "type": "[ConnectionMonitorTestConfiguration]"}, + "test_groups": {"key": "testGroups", "type": "[ConnectionMonitorTestGroup]"}, + "outputs": {"key": "outputs", "type": "[ConnectionMonitorOutput]"}, + "notes": {"key": "notes", "type": "str"}, + } + + def __init__( + self, + *, + source: Optional["_models.ConnectionMonitorSource"] = None, + destination: Optional["_models.ConnectionMonitorDestination"] = None, + auto_start: bool = True, + monitoring_interval_in_seconds: int = 60, + endpoints: Optional[List["_models.ConnectionMonitorEndpoint"]] = None, + test_configurations: Optional[List["_models.ConnectionMonitorTestConfiguration"]] = None, + test_groups: Optional[List["_models.ConnectionMonitorTestGroup"]] = None, + outputs: Optional[List["_models.ConnectionMonitorOutput"]] = None, + notes: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: Describes the source of connection monitor. + :paramtype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :keyword destination: Describes the destination of connection monitor. + :paramtype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :keyword auto_start: Determines if the connection monitor will start automatically once + created. + :paramtype auto_start: bool + :keyword monitoring_interval_in_seconds: Monitoring interval in seconds. + :paramtype monitoring_interval_in_seconds: int + :keyword endpoints: List of connection monitor endpoints. + :paramtype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :keyword test_configurations: List of connection monitor test configurations. + :paramtype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :keyword test_groups: List of connection monitor test groups. + :paramtype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :keyword outputs: List of connection monitor outputs. + :paramtype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :keyword notes: Optional notes to be associated with the connection monitor. + :paramtype notes: str + """ + super().__init__(**kwargs) + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds + self.endpoints = endpoints + self.test_configurations = test_configurations + self.test_groups = test_groups + self.outputs = outputs + self.notes = notes + + +class ConnectionMonitorQueryResult(_serialization.Model): + """List of connection states snapshots. + + :ivar source_status: Status of connection monitor source. Known values are: "Unknown", + "Active", and "Inactive". + :vartype source_status: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSourceStatus + :ivar states: Information about connection states. + :vartype states: list[~azure.mgmt.network.v2023_09_01.models.ConnectionStateSnapshot] + """ + + _attribute_map = { + "source_status": {"key": "sourceStatus", "type": "str"}, + "states": {"key": "states", "type": "[ConnectionStateSnapshot]"}, + } + + def __init__( + self, + *, + source_status: Optional[Union[str, "_models.ConnectionMonitorSourceStatus"]] = None, + states: Optional[List["_models.ConnectionStateSnapshot"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source_status: Status of connection monitor source. Known values are: "Unknown", + "Active", and "Inactive". + :paramtype source_status: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSourceStatus + :keyword states: Information about connection states. + :paramtype states: list[~azure.mgmt.network.v2023_09_01.models.ConnectionStateSnapshot] + """ + super().__init__(**kwargs) + self.source_status = source_status + self.states = states + + +class ConnectionMonitorResult(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Information about the connection monitor. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the connection monitor. + :vartype name: str + :ivar id: ID of the connection monitor. + :vartype id: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Connection monitor type. + :vartype type: str + :ivar location: Connection monitor location. + :vartype location: str + :ivar tags: Connection monitor tags. + :vartype tags: dict[str, str] + :ivar source: Describes the source of connection monitor. + :vartype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :ivar destination: Describes the destination of connection monitor. + :vartype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :ivar auto_start: Determines if the connection monitor will start automatically once created. + :vartype auto_start: bool + :ivar monitoring_interval_in_seconds: Monitoring interval in seconds. + :vartype monitoring_interval_in_seconds: int + :ivar endpoints: List of connection monitor endpoints. + :vartype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :ivar test_configurations: List of connection monitor test configurations. + :vartype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :ivar test_groups: List of connection monitor test groups. + :vartype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :ivar outputs: List of connection monitor outputs. + :vartype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :ivar notes: Optional notes to be associated with the connection monitor. + :vartype notes: str + :ivar provisioning_state: The provisioning state of the connection monitor. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar start_time: The date and time when the connection monitor was started. + :vartype start_time: ~datetime.datetime + :ivar monitoring_status: The monitoring status of the connection monitor. + :vartype monitoring_status: str + :ivar connection_monitor_type: Type of connection monitor. Known values are: "MultiEndpoint" + and "SingleSourceDestination". + :vartype connection_monitor_type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorType + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "etag": {"readonly": True}, + "type": {"readonly": True}, + "monitoring_interval_in_seconds": {"maximum": 1800, "minimum": 30}, + "provisioning_state": {"readonly": True}, + "start_time": {"readonly": True}, + "monitoring_status": {"readonly": True}, + "connection_monitor_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "source": {"key": "properties.source", "type": "ConnectionMonitorSource"}, + "destination": {"key": "properties.destination", "type": "ConnectionMonitorDestination"}, + "auto_start": {"key": "properties.autoStart", "type": "bool"}, + "monitoring_interval_in_seconds": {"key": "properties.monitoringIntervalInSeconds", "type": "int"}, + "endpoints": {"key": "properties.endpoints", "type": "[ConnectionMonitorEndpoint]"}, + "test_configurations": {"key": "properties.testConfigurations", "type": "[ConnectionMonitorTestConfiguration]"}, + "test_groups": {"key": "properties.testGroups", "type": "[ConnectionMonitorTestGroup]"}, + "outputs": {"key": "properties.outputs", "type": "[ConnectionMonitorOutput]"}, + "notes": {"key": "properties.notes", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "monitoring_status": {"key": "properties.monitoringStatus", "type": "str"}, + "connection_monitor_type": {"key": "properties.connectionMonitorType", "type": "str"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + source: Optional["_models.ConnectionMonitorSource"] = None, + destination: Optional["_models.ConnectionMonitorDestination"] = None, + auto_start: bool = True, + monitoring_interval_in_seconds: int = 60, + endpoints: Optional[List["_models.ConnectionMonitorEndpoint"]] = None, + test_configurations: Optional[List["_models.ConnectionMonitorTestConfiguration"]] = None, + test_groups: Optional[List["_models.ConnectionMonitorTestGroup"]] = None, + outputs: Optional[List["_models.ConnectionMonitorOutput"]] = None, + notes: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Connection monitor location. + :paramtype location: str + :keyword tags: Connection monitor tags. + :paramtype tags: dict[str, str] + :keyword source: Describes the source of connection monitor. + :paramtype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :keyword destination: Describes the destination of connection monitor. + :paramtype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :keyword auto_start: Determines if the connection monitor will start automatically once + created. + :paramtype auto_start: bool + :keyword monitoring_interval_in_seconds: Monitoring interval in seconds. + :paramtype monitoring_interval_in_seconds: int + :keyword endpoints: List of connection monitor endpoints. + :paramtype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :keyword test_configurations: List of connection monitor test configurations. + :paramtype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :keyword test_groups: List of connection monitor test groups. + :paramtype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :keyword outputs: List of connection monitor outputs. + :paramtype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :keyword notes: Optional notes to be associated with the connection monitor. + :paramtype notes: str + """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.etag = None + self.type = None + self.location = location + self.tags = tags + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds + self.endpoints = endpoints + self.test_configurations = test_configurations + self.test_groups = test_groups + self.outputs = outputs + self.notes = notes + self.provisioning_state = None + self.start_time = None + self.monitoring_status = None + self.connection_monitor_type = None + + +class ConnectionMonitorResultProperties(ConnectionMonitorParameters): # pylint: disable=too-many-instance-attributes + """Describes the properties of a connection monitor. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source: Describes the source of connection monitor. + :vartype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :ivar destination: Describes the destination of connection monitor. + :vartype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :ivar auto_start: Determines if the connection monitor will start automatically once created. + :vartype auto_start: bool + :ivar monitoring_interval_in_seconds: Monitoring interval in seconds. + :vartype monitoring_interval_in_seconds: int + :ivar endpoints: List of connection monitor endpoints. + :vartype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :ivar test_configurations: List of connection monitor test configurations. + :vartype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :ivar test_groups: List of connection monitor test groups. + :vartype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :ivar outputs: List of connection monitor outputs. + :vartype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :ivar notes: Optional notes to be associated with the connection monitor. + :vartype notes: str + :ivar provisioning_state: The provisioning state of the connection monitor. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar start_time: The date and time when the connection monitor was started. + :vartype start_time: ~datetime.datetime + :ivar monitoring_status: The monitoring status of the connection monitor. + :vartype monitoring_status: str + :ivar connection_monitor_type: Type of connection monitor. Known values are: "MultiEndpoint" + and "SingleSourceDestination". + :vartype connection_monitor_type: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorType + """ + + _validation = { + "monitoring_interval_in_seconds": {"maximum": 1800, "minimum": 30}, + "provisioning_state": {"readonly": True}, + "start_time": {"readonly": True}, + "monitoring_status": {"readonly": True}, + "connection_monitor_type": {"readonly": True}, + } + + _attribute_map = { + "source": {"key": "source", "type": "ConnectionMonitorSource"}, + "destination": {"key": "destination", "type": "ConnectionMonitorDestination"}, + "auto_start": {"key": "autoStart", "type": "bool"}, + "monitoring_interval_in_seconds": {"key": "monitoringIntervalInSeconds", "type": "int"}, + "endpoints": {"key": "endpoints", "type": "[ConnectionMonitorEndpoint]"}, + "test_configurations": {"key": "testConfigurations", "type": "[ConnectionMonitorTestConfiguration]"}, + "test_groups": {"key": "testGroups", "type": "[ConnectionMonitorTestGroup]"}, + "outputs": {"key": "outputs", "type": "[ConnectionMonitorOutput]"}, + "notes": {"key": "notes", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "monitoring_status": {"key": "monitoringStatus", "type": "str"}, + "connection_monitor_type": {"key": "connectionMonitorType", "type": "str"}, + } + + def __init__( + self, + *, + source: Optional["_models.ConnectionMonitorSource"] = None, + destination: Optional["_models.ConnectionMonitorDestination"] = None, + auto_start: bool = True, + monitoring_interval_in_seconds: int = 60, + endpoints: Optional[List["_models.ConnectionMonitorEndpoint"]] = None, + test_configurations: Optional[List["_models.ConnectionMonitorTestConfiguration"]] = None, + test_groups: Optional[List["_models.ConnectionMonitorTestGroup"]] = None, + outputs: Optional[List["_models.ConnectionMonitorOutput"]] = None, + notes: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: Describes the source of connection monitor. + :paramtype source: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSource + :keyword destination: Describes the destination of connection monitor. + :paramtype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorDestination + :keyword auto_start: Determines if the connection monitor will start automatically once + created. + :paramtype auto_start: bool + :keyword monitoring_interval_in_seconds: Monitoring interval in seconds. + :paramtype monitoring_interval_in_seconds: int + :keyword endpoints: List of connection monitor endpoints. + :paramtype endpoints: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorEndpoint] + :keyword test_configurations: List of connection monitor test configurations. + :paramtype test_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfiguration] + :keyword test_groups: List of connection monitor test groups. + :paramtype test_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestGroup] + :keyword outputs: List of connection monitor outputs. + :paramtype outputs: list[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorOutput] + :keyword notes: Optional notes to be associated with the connection monitor. + :paramtype notes: str + """ + super().__init__( + source=source, + destination=destination, + auto_start=auto_start, + monitoring_interval_in_seconds=monitoring_interval_in_seconds, + endpoints=endpoints, + test_configurations=test_configurations, + test_groups=test_groups, + outputs=outputs, + notes=notes, + **kwargs + ) + self.provisioning_state = None + self.start_time = None + self.monitoring_status = None + self.connection_monitor_type = None + + +class ConnectionMonitorSource(_serialization.Model): + """Describes the source of connection monitor. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: The ID of the resource used as the source by connection monitor. Required. + :vartype resource_id: str + :ivar port: The source port used by connection monitor. + :vartype port: int + """ + + _validation = { + "resource_id": {"required": True}, + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, resource_id: str, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The ID of the resource used as the source by connection monitor. + Required. + :paramtype resource_id: str + :keyword port: The source port used by connection monitor. + :paramtype port: int + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.port = port + + +class ConnectionMonitorSuccessThreshold(_serialization.Model): + """Describes the threshold for declaring a test successful. + + :ivar checks_failed_percent: The maximum percentage of failed checks permitted for a test to + evaluate as successful. + :vartype checks_failed_percent: int + :ivar round_trip_time_ms: The maximum round-trip time in milliseconds permitted for a test to + evaluate as successful. + :vartype round_trip_time_ms: float + """ + + _attribute_map = { + "checks_failed_percent": {"key": "checksFailedPercent", "type": "int"}, + "round_trip_time_ms": {"key": "roundTripTimeMs", "type": "float"}, + } + + def __init__( + self, *, checks_failed_percent: Optional[int] = None, round_trip_time_ms: Optional[float] = None, **kwargs: Any + ) -> None: + """ + :keyword checks_failed_percent: The maximum percentage of failed checks permitted for a test to + evaluate as successful. + :paramtype checks_failed_percent: int + :keyword round_trip_time_ms: The maximum round-trip time in milliseconds permitted for a test + to evaluate as successful. + :paramtype round_trip_time_ms: float + """ + super().__init__(**kwargs) + self.checks_failed_percent = checks_failed_percent + self.round_trip_time_ms = round_trip_time_ms + + +class ConnectionMonitorTcpConfiguration(_serialization.Model): + """Describes the TCP configuration. + + :ivar port: The port to connect to. + :vartype port: int + :ivar disable_trace_route: Value indicating whether path evaluation with trace route should be + disabled. + :vartype disable_trace_route: bool + :ivar destination_port_behavior: Destination port behavior. Known values are: "None" and + "ListenIfAvailable". + :vartype destination_port_behavior: str or + ~azure.mgmt.network.v2023_09_01.models.DestinationPortBehavior + """ + + _validation = { + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "disable_trace_route": {"key": "disableTraceRoute", "type": "bool"}, + "destination_port_behavior": {"key": "destinationPortBehavior", "type": "str"}, + } + + def __init__( + self, + *, + port: Optional[int] = None, + disable_trace_route: Optional[bool] = None, + destination_port_behavior: Optional[Union[str, "_models.DestinationPortBehavior"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword port: The port to connect to. + :paramtype port: int + :keyword disable_trace_route: Value indicating whether path evaluation with trace route should + be disabled. + :paramtype disable_trace_route: bool + :keyword destination_port_behavior: Destination port behavior. Known values are: "None" and + "ListenIfAvailable". + :paramtype destination_port_behavior: str or + ~azure.mgmt.network.v2023_09_01.models.DestinationPortBehavior + """ + super().__init__(**kwargs) + self.port = port + self.disable_trace_route = disable_trace_route + self.destination_port_behavior = destination_port_behavior + + +class ConnectionMonitorTestConfiguration(_serialization.Model): + """Describes a connection monitor test configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the connection monitor test configuration. Required. + :vartype name: str + :ivar test_frequency_sec: The frequency of test evaluation, in seconds. + :vartype test_frequency_sec: int + :ivar protocol: The protocol to use in test evaluation. Required. Known values are: "Tcp", + "Http", and "Icmp". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfigurationProtocol + :ivar preferred_ip_version: The preferred IP version to use in test evaluation. The connection + monitor may choose to use a different version depending on other parameters. Known values are: + "IPv4" and "IPv6". + :vartype preferred_ip_version: str or ~azure.mgmt.network.v2023_09_01.models.PreferredIPVersion + :ivar http_configuration: The parameters used to perform test evaluation over HTTP. + :vartype http_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorHttpConfiguration + :ivar tcp_configuration: The parameters used to perform test evaluation over TCP. + :vartype tcp_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTcpConfiguration + :ivar icmp_configuration: The parameters used to perform test evaluation over ICMP. + :vartype icmp_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorIcmpConfiguration + :ivar success_threshold: The threshold for declaring a test successful. + :vartype success_threshold: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSuccessThreshold + """ + + _validation = { + "name": {"required": True}, + "protocol": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "test_frequency_sec": {"key": "testFrequencySec", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "preferred_ip_version": {"key": "preferredIPVersion", "type": "str"}, + "http_configuration": {"key": "httpConfiguration", "type": "ConnectionMonitorHttpConfiguration"}, + "tcp_configuration": {"key": "tcpConfiguration", "type": "ConnectionMonitorTcpConfiguration"}, + "icmp_configuration": {"key": "icmpConfiguration", "type": "ConnectionMonitorIcmpConfiguration"}, + "success_threshold": {"key": "successThreshold", "type": "ConnectionMonitorSuccessThreshold"}, + } + + def __init__( + self, + *, + name: str, + protocol: Union[str, "_models.ConnectionMonitorTestConfigurationProtocol"], + test_frequency_sec: Optional[int] = None, + preferred_ip_version: Optional[Union[str, "_models.PreferredIPVersion"]] = None, + http_configuration: Optional["_models.ConnectionMonitorHttpConfiguration"] = None, + tcp_configuration: Optional["_models.ConnectionMonitorTcpConfiguration"] = None, + icmp_configuration: Optional["_models.ConnectionMonitorIcmpConfiguration"] = None, + success_threshold: Optional["_models.ConnectionMonitorSuccessThreshold"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the connection monitor test configuration. Required. + :paramtype name: str + :keyword test_frequency_sec: The frequency of test evaluation, in seconds. + :paramtype test_frequency_sec: int + :keyword protocol: The protocol to use in test evaluation. Required. Known values are: "Tcp", + "Http", and "Icmp". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTestConfigurationProtocol + :keyword preferred_ip_version: The preferred IP version to use in test evaluation. The + connection monitor may choose to use a different version depending on other parameters. Known + values are: "IPv4" and "IPv6". + :paramtype preferred_ip_version: str or + ~azure.mgmt.network.v2023_09_01.models.PreferredIPVersion + :keyword http_configuration: The parameters used to perform test evaluation over HTTP. + :paramtype http_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorHttpConfiguration + :keyword tcp_configuration: The parameters used to perform test evaluation over TCP. + :paramtype tcp_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorTcpConfiguration + :keyword icmp_configuration: The parameters used to perform test evaluation over ICMP. + :paramtype icmp_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorIcmpConfiguration + :keyword success_threshold: The threshold for declaring a test successful. + :paramtype success_threshold: + ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorSuccessThreshold + """ + super().__init__(**kwargs) + self.name = name + self.test_frequency_sec = test_frequency_sec + self.protocol = protocol + self.preferred_ip_version = preferred_ip_version + self.http_configuration = http_configuration + self.tcp_configuration = tcp_configuration + self.icmp_configuration = icmp_configuration + self.success_threshold = success_threshold + + +class ConnectionMonitorTestGroup(_serialization.Model): + """Describes the connection monitor test group. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the connection monitor test group. Required. + :vartype name: str + :ivar disable: Value indicating whether test group is disabled. + :vartype disable: bool + :ivar test_configurations: List of test configuration names. Required. + :vartype test_configurations: list[str] + :ivar sources: List of source endpoint names. Required. + :vartype sources: list[str] + :ivar destinations: List of destination endpoint names. Required. + :vartype destinations: list[str] + """ + + _validation = { + "name": {"required": True}, + "test_configurations": {"required": True}, + "sources": {"required": True}, + "destinations": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "disable": {"key": "disable", "type": "bool"}, + "test_configurations": {"key": "testConfigurations", "type": "[str]"}, + "sources": {"key": "sources", "type": "[str]"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, + *, + name: str, + test_configurations: List[str], + sources: List[str], + destinations: List[str], + disable: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the connection monitor test group. Required. + :paramtype name: str + :keyword disable: Value indicating whether test group is disabled. + :paramtype disable: bool + :keyword test_configurations: List of test configuration names. Required. + :paramtype test_configurations: list[str] + :keyword sources: List of source endpoint names. Required. + :paramtype sources: list[str] + :keyword destinations: List of destination endpoint names. Required. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.disable = disable + self.test_configurations = test_configurations + self.sources = sources + self.destinations = destinations + + +class ConnectionMonitorWorkspaceSettings(_serialization.Model): + """Describes the settings for producing output into a log analytics workspace. + + :ivar workspace_resource_id: Log analytics workspace resource ID. + :vartype workspace_resource_id: str + """ + + _attribute_map = { + "workspace_resource_id": {"key": "workspaceResourceId", "type": "str"}, + } + + def __init__(self, *, workspace_resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword workspace_resource_id: Log analytics workspace resource ID. + :paramtype workspace_resource_id: str + """ + super().__init__(**kwargs) + self.workspace_resource_id = workspace_resource_id + + +class ConnectionResetSharedKey(_serialization.Model): + """The virtual network connection reset shared key. + + All required parameters must be populated in order to send to Azure. + + :ivar key_length: The virtual network connection reset shared key length, should between 1 and + 128. Required. + :vartype key_length: int + """ + + _validation = { + "key_length": {"required": True, "maximum": 128, "minimum": 1}, + } + + _attribute_map = { + "key_length": {"key": "keyLength", "type": "int"}, + } + + def __init__(self, *, key_length: int, **kwargs: Any) -> None: + """ + :keyword key_length: The virtual network connection reset shared key length, should between 1 + and 128. Required. + :paramtype key_length: int + """ + super().__init__(**kwargs) + self.key_length = key_length + + +class ConnectionSharedKey(SubResource): + """Response for GetConnectionSharedKey API service call. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar value: The virtual network connection shared key value. Required. + :vartype value: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, *, value: str, id: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword value: The virtual network connection shared key value. Required. + :paramtype value: str + """ + super().__init__(id=id, **kwargs) + self.value = value + + +class ConnectionStateSnapshot(_serialization.Model): + """Connection state snapshot. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar connection_state: The connection state. Known values are: "Reachable", "Unreachable", and + "Unknown". + :vartype connection_state: str or ~azure.mgmt.network.v2023_09_01.models.ConnectionState + :ivar start_time: The start time of the connection snapshot. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the connection snapshot. + :vartype end_time: ~datetime.datetime + :ivar evaluation_state: Connectivity analysis evaluation state. Known values are: "NotStarted", + "InProgress", and "Completed". + :vartype evaluation_state: str or ~azure.mgmt.network.v2023_09_01.models.EvaluationState + :ivar avg_latency_in_ms: Average latency in ms. + :vartype avg_latency_in_ms: int + :ivar min_latency_in_ms: Minimum latency in ms. + :vartype min_latency_in_ms: int + :ivar max_latency_in_ms: Maximum latency in ms. + :vartype max_latency_in_ms: int + :ivar probes_sent: The number of sent probes. + :vartype probes_sent: int + :ivar probes_failed: The number of failed probes. + :vartype probes_failed: int + :ivar hops: List of hops between the source and the destination. + :vartype hops: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityHop] + """ + + _validation = { + "avg_latency_in_ms": {"maximum": 4294967295, "minimum": 0}, + "min_latency_in_ms": {"maximum": 4294967295, "minimum": 0}, + "max_latency_in_ms": {"maximum": 4294967295, "minimum": 0}, + "probes_sent": {"maximum": 4294967295, "minimum": 0}, + "probes_failed": {"maximum": 4294967295, "minimum": 0}, + "hops": {"readonly": True}, + } + + _attribute_map = { + "connection_state": {"key": "connectionState", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "evaluation_state": {"key": "evaluationState", "type": "str"}, + "avg_latency_in_ms": {"key": "avgLatencyInMs", "type": "int"}, + "min_latency_in_ms": {"key": "minLatencyInMs", "type": "int"}, + "max_latency_in_ms": {"key": "maxLatencyInMs", "type": "int"}, + "probes_sent": {"key": "probesSent", "type": "int"}, + "probes_failed": {"key": "probesFailed", "type": "int"}, + "hops": {"key": "hops", "type": "[ConnectivityHop]"}, + } + + def __init__( + self, + *, + connection_state: Optional[Union[str, "_models.ConnectionState"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + evaluation_state: Optional[Union[str, "_models.EvaluationState"]] = None, + avg_latency_in_ms: Optional[int] = None, + min_latency_in_ms: Optional[int] = None, + max_latency_in_ms: Optional[int] = None, + probes_sent: Optional[int] = None, + probes_failed: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword connection_state: The connection state. Known values are: "Reachable", "Unreachable", + and "Unknown". + :paramtype connection_state: str or ~azure.mgmt.network.v2023_09_01.models.ConnectionState + :keyword start_time: The start time of the connection snapshot. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the connection snapshot. + :paramtype end_time: ~datetime.datetime + :keyword evaluation_state: Connectivity analysis evaluation state. Known values are: + "NotStarted", "InProgress", and "Completed". + :paramtype evaluation_state: str or ~azure.mgmt.network.v2023_09_01.models.EvaluationState + :keyword avg_latency_in_ms: Average latency in ms. + :paramtype avg_latency_in_ms: int + :keyword min_latency_in_ms: Minimum latency in ms. + :paramtype min_latency_in_ms: int + :keyword max_latency_in_ms: Maximum latency in ms. + :paramtype max_latency_in_ms: int + :keyword probes_sent: The number of sent probes. + :paramtype probes_sent: int + :keyword probes_failed: The number of failed probes. + :paramtype probes_failed: int + """ + super().__init__(**kwargs) + self.connection_state = connection_state + self.start_time = start_time + self.end_time = end_time + self.evaluation_state = evaluation_state + self.avg_latency_in_ms = avg_latency_in_ms + self.min_latency_in_ms = min_latency_in_ms + self.max_latency_in_ms = max_latency_in_ms + self.probes_sent = probes_sent + self.probes_failed = probes_failed + self.hops = None + + +class ConnectivityConfiguration(ChildResource): # pylint: disable=too-many-instance-attributes + """The network manager connectivity configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description of the connectivity configuration. + :vartype description: str + :ivar connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :vartype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :ivar hubs: List of hubItems. + :vartype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :ivar is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :vartype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :ivar applies_to_groups: Groups for configuration. + :vartype applies_to_groups: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :ivar provisioning_state: The provisioning state of the connectivity configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar delete_existing_peering: Flag if need to remove current existing peerings. Known values + are: "False" and "True". + :vartype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "connectivity_topology": {"key": "properties.connectivityTopology", "type": "str"}, + "hubs": {"key": "properties.hubs", "type": "[Hub]"}, + "is_global": {"key": "properties.isGlobal", "type": "str"}, + "applies_to_groups": {"key": "properties.appliesToGroups", "type": "[ConnectivityGroupItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "delete_existing_peering": {"key": "properties.deleteExistingPeering", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + connectivity_topology: Optional[Union[str, "_models.ConnectivityTopology"]] = None, + hubs: Optional[List["_models.Hub"]] = None, + is_global: Optional[Union[str, "_models.IsGlobal"]] = None, + applies_to_groups: Optional[List["_models.ConnectivityGroupItem"]] = None, + delete_existing_peering: Optional[Union[str, "_models.DeleteExistingPeering"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: A description of the connectivity configuration. + :paramtype description: str + :keyword connectivity_topology: Connectivity topology type. Known values are: "HubAndSpoke" and + "Mesh". + :paramtype connectivity_topology: str or + ~azure.mgmt.network.v2023_09_01.models.ConnectivityTopology + :keyword hubs: List of hubItems. + :paramtype hubs: list[~azure.mgmt.network.v2023_09_01.models.Hub] + :keyword is_global: Flag if global mesh is supported. Known values are: "False" and "True". + :paramtype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :keyword applies_to_groups: Groups for configuration. + :paramtype applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.ConnectivityGroupItem] + :keyword delete_existing_peering: Flag if need to remove current existing peerings. Known + values are: "False" and "True". + :paramtype delete_existing_peering: str or + ~azure.mgmt.network.v2023_09_01.models.DeleteExistingPeering + """ + super().__init__(**kwargs) + self.system_data = None + self.description = description + self.connectivity_topology = connectivity_topology + self.hubs = hubs + self.is_global = is_global + self.applies_to_groups = applies_to_groups + self.provisioning_state = None + self.delete_existing_peering = delete_existing_peering + self.resource_guid = None + + +class ConnectivityConfigurationListResult(_serialization.Model): + """Result of the request to list network manager connectivity configurations. It contains a list + of configurations and a link to get the next set of results. + + :ivar value: Gets a page of Connectivity Configurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ConnectivityConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ConnectivityConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of Connectivity Configurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConnectivityDestination(_serialization.Model): + """Parameters that define destination of connection. + + :ivar resource_id: The ID of the resource to which a connection attempt will be made. + :vartype resource_id: str + :ivar address: The IP address or URI the resource to which a connection attempt will be made. + :vartype address: str + :ivar port: Port on which check connectivity will be performed. + :vartype port: int + """ + + _validation = { + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + address: Optional[str] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The ID of the resource to which a connection attempt will be made. + :paramtype resource_id: str + :keyword address: The IP address or URI the resource to which a connection attempt will be + made. + :paramtype address: str + :keyword port: Port on which check connectivity will be performed. + :paramtype port: int + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.address = address + self.port = port + + +class ConnectivityGroupItem(_serialization.Model): + """Connectivity group item. + + All required parameters must be populated in order to send to Azure. + + :ivar network_group_id: Network group Id. Required. + :vartype network_group_id: str + :ivar use_hub_gateway: Flag if need to use hub gateway. Known values are: "False" and "True". + :vartype use_hub_gateway: str or ~azure.mgmt.network.v2023_09_01.models.UseHubGateway + :ivar is_global: Flag if global is supported. Known values are: "False" and "True". + :vartype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :ivar group_connectivity: Group connectivity type. Required. Known values are: "None" and + "DirectlyConnected". + :vartype group_connectivity: str or ~azure.mgmt.network.v2023_09_01.models.GroupConnectivity + """ + + _validation = { + "network_group_id": {"required": True}, + "group_connectivity": {"required": True}, + } + + _attribute_map = { + "network_group_id": {"key": "networkGroupId", "type": "str"}, + "use_hub_gateway": {"key": "useHubGateway", "type": "str"}, + "is_global": {"key": "isGlobal", "type": "str"}, + "group_connectivity": {"key": "groupConnectivity", "type": "str"}, + } + + def __init__( + self, + *, + network_group_id: str, + group_connectivity: Union[str, "_models.GroupConnectivity"], + use_hub_gateway: Optional[Union[str, "_models.UseHubGateway"]] = None, + is_global: Optional[Union[str, "_models.IsGlobal"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_group_id: Network group Id. Required. + :paramtype network_group_id: str + :keyword use_hub_gateway: Flag if need to use hub gateway. Known values are: "False" and + "True". + :paramtype use_hub_gateway: str or ~azure.mgmt.network.v2023_09_01.models.UseHubGateway + :keyword is_global: Flag if global is supported. Known values are: "False" and "True". + :paramtype is_global: str or ~azure.mgmt.network.v2023_09_01.models.IsGlobal + :keyword group_connectivity: Group connectivity type. Required. Known values are: "None" and + "DirectlyConnected". + :paramtype group_connectivity: str or ~azure.mgmt.network.v2023_09_01.models.GroupConnectivity + """ + super().__init__(**kwargs) + self.network_group_id = network_group_id + self.use_hub_gateway = use_hub_gateway + self.is_global = is_global + self.group_connectivity = group_connectivity + + +class ConnectivityHop(_serialization.Model): + """Information about a hop between the source and the destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the hop. + :vartype type: str + :ivar id: The ID of the hop. + :vartype id: str + :ivar address: The IP address of the hop. + :vartype address: str + :ivar resource_id: The ID of the resource corresponding to this hop. + :vartype resource_id: str + :ivar next_hop_ids: List of next hop identifiers. + :vartype next_hop_ids: list[str] + :ivar previous_hop_ids: List of previous hop identifiers. + :vartype previous_hop_ids: list[str] + :ivar links: List of hop links. + :vartype links: list[~azure.mgmt.network.v2023_09_01.models.HopLink] + :ivar previous_links: List of previous hop links. + :vartype previous_links: list[~azure.mgmt.network.v2023_09_01.models.HopLink] + :ivar issues: List of issues. + :vartype issues: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityIssue] + """ + + _validation = { + "type": {"readonly": True}, + "id": {"readonly": True}, + "address": {"readonly": True}, + "resource_id": {"readonly": True}, + "next_hop_ids": {"readonly": True}, + "previous_hop_ids": {"readonly": True}, + "links": {"readonly": True}, + "previous_links": {"readonly": True}, + "issues": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "next_hop_ids": {"key": "nextHopIds", "type": "[str]"}, + "previous_hop_ids": {"key": "previousHopIds", "type": "[str]"}, + "links": {"key": "links", "type": "[HopLink]"}, + "previous_links": {"key": "previousLinks", "type": "[HopLink]"}, + "issues": {"key": "issues", "type": "[ConnectivityIssue]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.id = None + self.address = None + self.resource_id = None + self.next_hop_ids = None + self.previous_hop_ids = None + self.links = None + self.previous_links = None + self.issues = None + + +class ConnectivityInformation(_serialization.Model): + """Information on the connectivity status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hops: List of hops between the source and the destination. + :vartype hops: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityHop] + :ivar connection_status: The connection status. Known values are: "Unknown", "Connected", + "Disconnected", and "Degraded". + :vartype connection_status: str or ~azure.mgmt.network.v2023_09_01.models.ConnectionStatus + :ivar avg_latency_in_ms: Average latency in milliseconds. + :vartype avg_latency_in_ms: int + :ivar min_latency_in_ms: Minimum latency in milliseconds. + :vartype min_latency_in_ms: int + :ivar max_latency_in_ms: Maximum latency in milliseconds. + :vartype max_latency_in_ms: int + :ivar probes_sent: Total number of probes sent. + :vartype probes_sent: int + :ivar probes_failed: Number of failed probes. + :vartype probes_failed: int + """ + + _validation = { + "hops": {"readonly": True}, + "connection_status": {"readonly": True}, + "avg_latency_in_ms": {"readonly": True}, + "min_latency_in_ms": {"readonly": True}, + "max_latency_in_ms": {"readonly": True}, + "probes_sent": {"readonly": True}, + "probes_failed": {"readonly": True}, + } + + _attribute_map = { + "hops": {"key": "hops", "type": "[ConnectivityHop]"}, + "connection_status": {"key": "connectionStatus", "type": "str"}, + "avg_latency_in_ms": {"key": "avgLatencyInMs", "type": "int"}, + "min_latency_in_ms": {"key": "minLatencyInMs", "type": "int"}, + "max_latency_in_ms": {"key": "maxLatencyInMs", "type": "int"}, + "probes_sent": {"key": "probesSent", "type": "int"}, + "probes_failed": {"key": "probesFailed", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.hops = None + self.connection_status = None + self.avg_latency_in_ms = None + self.min_latency_in_ms = None + self.max_latency_in_ms = None + self.probes_sent = None + self.probes_failed = None + + +class ConnectivityIssue(_serialization.Model): + """Information about an issue encountered in the process of checking for connectivity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the issue. Known values are: "Local", "Inbound", and "Outbound". + :vartype origin: str or ~azure.mgmt.network.v2023_09_01.models.Origin + :ivar severity: The severity of the issue. Known values are: "Error" and "Warning". + :vartype severity: str or ~azure.mgmt.network.v2023_09_01.models.Severity + :ivar type: The type of issue. Known values are: "Unknown", "AgentStopped", "GuestFirewall", + "DnsResolution", "SocketBind", "NetworkSecurityRule", "UserDefinedRoute", "PortThrottled", and + "Platform". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.IssueType + :ivar context: Provides additional context on the issue. + :vartype context: list[dict[str, str]] + """ + + _validation = { + "origin": {"readonly": True}, + "severity": {"readonly": True}, + "type": {"readonly": True}, + "context": {"readonly": True}, + } + + _attribute_map = { + "origin": {"key": "origin", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "context": {"key": "context", "type": "[{str}]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.origin = None + self.severity = None + self.type = None + self.context = None + + +class ConnectivityParameters(_serialization.Model): + """Parameters that determine how the connectivity check will be performed. + + All required parameters must be populated in order to send to Azure. + + :ivar source: The source of the connection. Required. + :vartype source: ~azure.mgmt.network.v2023_09_01.models.ConnectivitySource + :ivar destination: The destination of connection. Required. + :vartype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectivityDestination + :ivar protocol: Network protocol. Known values are: "Tcp", "Http", "Https", and "Icmp". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.Protocol + :ivar protocol_configuration: Configuration of the protocol. + :vartype protocol_configuration: ~azure.mgmt.network.v2023_09_01.models.ProtocolConfiguration + :ivar preferred_ip_version: Preferred IP version of the connection. Known values are: "IPv4" + and "IPv6". + :vartype preferred_ip_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + """ + + _validation = { + "source": {"required": True}, + "destination": {"required": True}, + } + + _attribute_map = { + "source": {"key": "source", "type": "ConnectivitySource"}, + "destination": {"key": "destination", "type": "ConnectivityDestination"}, + "protocol": {"key": "protocol", "type": "str"}, + "protocol_configuration": {"key": "protocolConfiguration", "type": "ProtocolConfiguration"}, + "preferred_ip_version": {"key": "preferredIPVersion", "type": "str"}, + } + + def __init__( + self, + *, + source: "_models.ConnectivitySource", + destination: "_models.ConnectivityDestination", + protocol: Optional[Union[str, "_models.Protocol"]] = None, + protocol_configuration: Optional["_models.ProtocolConfiguration"] = None, + preferred_ip_version: Optional[Union[str, "_models.IPVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: The source of the connection. Required. + :paramtype source: ~azure.mgmt.network.v2023_09_01.models.ConnectivitySource + :keyword destination: The destination of connection. Required. + :paramtype destination: ~azure.mgmt.network.v2023_09_01.models.ConnectivityDestination + :keyword protocol: Network protocol. Known values are: "Tcp", "Http", "Https", and "Icmp". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.Protocol + :keyword protocol_configuration: Configuration of the protocol. + :paramtype protocol_configuration: ~azure.mgmt.network.v2023_09_01.models.ProtocolConfiguration + :keyword preferred_ip_version: Preferred IP version of the connection. Known values are: "IPv4" + and "IPv6". + :paramtype preferred_ip_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + """ + super().__init__(**kwargs) + self.source = source + self.destination = destination + self.protocol = protocol + self.protocol_configuration = protocol_configuration + self.preferred_ip_version = preferred_ip_version + + +class ConnectivitySource(_serialization.Model): + """Parameters that define the source of the connection. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: The ID of the resource from which a connectivity check will be initiated. + Required. + :vartype resource_id: str + :ivar port: The source port from which a connectivity check will be performed. + :vartype port: int + """ + + _validation = { + "resource_id": {"required": True}, + "port": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, resource_id: str, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The ID of the resource from which a connectivity check will be initiated. + Required. + :paramtype resource_id: str + :keyword port: The source port from which a connectivity check will be performed. + :paramtype port: int + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.port = port + + +class Container(SubResource): + """Reference to container resource in remote resource provider. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(id=id, **kwargs) + + +class ContainerNetworkInterface(SubResource): + """Container network interface child resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource. This name can be used to access the resource. + :vartype name: str + :ivar type: Sub Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar container_network_interface_configuration: Container network interface configuration from + which this container network interface is created. + :vartype container_network_interface_configuration: + ~azure.mgmt.network.v2023_09_01.models.ContainerNetworkInterfaceConfiguration + :ivar container: Reference to the container to which this container network interface is + attached. + :vartype container: ~azure.mgmt.network.v2023_09_01.models.Container + :ivar ip_configurations: Reference to the ip configuration on this container nic. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ContainerNetworkInterfaceIpConfiguration] + :ivar provisioning_state: The provisioning state of the container network interface resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "container_network_interface_configuration": {"readonly": True}, + "ip_configurations": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "container_network_interface_configuration": { + "key": "properties.containerNetworkInterfaceConfiguration", + "type": "ContainerNetworkInterfaceConfiguration", + }, + "container": {"key": "properties.container", "type": "Container"}, + "ip_configurations": { + "key": "properties.ipConfigurations", + "type": "[ContainerNetworkInterfaceIpConfiguration]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + container: Optional["_models.Container"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource. This name can be used to access the resource. + :paramtype name: str + :keyword container: Reference to the container to which this container network interface is + attached. + :paramtype container: ~azure.mgmt.network.v2023_09_01.models.Container + """ + super().__init__(id=id, **kwargs) + self.name = name + self.type = None + self.etag = None + self.container_network_interface_configuration = None + self.container = container + self.ip_configurations = None + self.provisioning_state = None + + +class ContainerNetworkInterfaceConfiguration(SubResource): + """Container network interface configuration child resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource. This name can be used to access the resource. + :vartype name: str + :ivar type: Sub Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar ip_configurations: A list of ip configurations of the container network interface + configuration. + :vartype ip_configurations: list[~azure.mgmt.network.v2023_09_01.models.IPConfigurationProfile] + :ivar container_network_interfaces: A list of container network interfaces created from this + container network interface configuration. + :vartype container_network_interfaces: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the container network interface + configuration resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[IPConfigurationProfile]"}, + "container_network_interfaces": {"key": "properties.containerNetworkInterfaces", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + ip_configurations: Optional[List["_models.IPConfigurationProfile"]] = None, + container_network_interfaces: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource. This name can be used to access the resource. + :paramtype name: str + :keyword ip_configurations: A list of ip configurations of the container network interface + configuration. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.IPConfigurationProfile] + :keyword container_network_interfaces: A list of container network interfaces created from this + container network interface configuration. + :paramtype container_network_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.type = None + self.etag = None + self.ip_configurations = ip_configurations + self.container_network_interfaces = container_network_interfaces + self.provisioning_state = None + + +class ContainerNetworkInterfaceIpConfiguration(_serialization.Model): + """The ip configuration for a container network interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the resource. This name can be used to access the resource. + :vartype name: str + :ivar type: Sub Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the container network interface IP + configuration resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the resource. This name can be used to access the resource. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.type = None + self.etag = None + self.provisioning_state = None + + +class Criterion(_serialization.Model): + """A matching criteria which matches routes based on route prefix, community, and AS path. + + :ivar route_prefix: List of route prefixes which this criteria matches. + :vartype route_prefix: list[str] + :ivar community: List of BGP communities which this criteria matches. + :vartype community: list[str] + :ivar as_path: List of AS paths which this criteria matches. + :vartype as_path: list[str] + :ivar match_condition: Match condition to apply RouteMap rules. Known values are: "Unknown", + "Contains", "Equals", "NotContains", and "NotEquals". + :vartype match_condition: str or ~azure.mgmt.network.v2023_09_01.models.RouteMapMatchCondition + """ + + _attribute_map = { + "route_prefix": {"key": "routePrefix", "type": "[str]"}, + "community": {"key": "community", "type": "[str]"}, + "as_path": {"key": "asPath", "type": "[str]"}, + "match_condition": {"key": "matchCondition", "type": "str"}, + } + + def __init__( + self, + *, + route_prefix: Optional[List[str]] = None, + community: Optional[List[str]] = None, + as_path: Optional[List[str]] = None, + match_condition: Optional[Union[str, "_models.RouteMapMatchCondition"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword route_prefix: List of route prefixes which this criteria matches. + :paramtype route_prefix: list[str] + :keyword community: List of BGP communities which this criteria matches. + :paramtype community: list[str] + :keyword as_path: List of AS paths which this criteria matches. + :paramtype as_path: list[str] + :keyword match_condition: Match condition to apply RouteMap rules. Known values are: "Unknown", + "Contains", "Equals", "NotContains", and "NotEquals". + :paramtype match_condition: str or + ~azure.mgmt.network.v2023_09_01.models.RouteMapMatchCondition + """ + super().__init__(**kwargs) + self.route_prefix = route_prefix + self.community = community + self.as_path = as_path + self.match_condition = match_condition + + +class CrossTenantScopes(_serialization.Model): + """Cross tenant scopes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: Tenant ID. + :vartype tenant_id: str + :ivar management_groups: List of management groups. + :vartype management_groups: list[str] + :ivar subscriptions: List of subscriptions. + :vartype subscriptions: list[str] + """ + + _validation = { + "tenant_id": {"readonly": True}, + "management_groups": {"readonly": True}, + "subscriptions": {"readonly": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "management_groups": {"key": "managementGroups", "type": "[str]"}, + "subscriptions": {"key": "subscriptions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tenant_id = None + self.management_groups = None + self.subscriptions = None + + +class CustomDnsConfigPropertiesFormat(_serialization.Model): + """Contains custom Dns resolution configuration from customer. + + :ivar fqdn: Fqdn that resolves to private endpoint ip address. + :vartype fqdn: str + :ivar ip_addresses: A list of private ip addresses of the private endpoint. + :vartype ip_addresses: list[str] + """ + + _attribute_map = { + "fqdn": {"key": "fqdn", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + } + + def __init__(self, *, fqdn: Optional[str] = None, ip_addresses: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword fqdn: Fqdn that resolves to private endpoint ip address. + :paramtype fqdn: str + :keyword ip_addresses: A list of private ip addresses of the private endpoint. + :paramtype ip_addresses: list[str] + """ + super().__init__(**kwargs) + self.fqdn = fqdn + self.ip_addresses = ip_addresses + + +class CustomIpPrefix(Resource): # pylint: disable=too-many-instance-attributes + """Custom IP prefix resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the custom IP prefix. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar zones: A list of availability zones denoting the IP allocated for the resource needs to + come from. + :vartype zones: list[str] + :ivar asn: The ASN for CIDR advertising. Should be an integer as string. + :vartype asn: str + :ivar cidr: The prefix range in CIDR notation. Should include the start address and the prefix + length. + :vartype cidr: str + :ivar signed_message: Signed message for WAN validation. + :vartype signed_message: str + :ivar authorization_message: Authorization message for WAN validation. + :vartype authorization_message: str + :ivar custom_ip_prefix_parent: The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + :vartype custom_ip_prefix_parent: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar child_custom_ip_prefixes: The list of all Children for IPv6 /48 CustomIpPrefix. + :vartype child_custom_ip_prefixes: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar commissioned_state: The commissioned state of the Custom IP Prefix. Known values are: + "Provisioning", "Provisioned", "Commissioning", "CommissionedNoInternetAdvertise", + "Commissioned", "Decommissioning", "Deprovisioning", and "Deprovisioned". + :vartype commissioned_state: str or ~azure.mgmt.network.v2023_09_01.models.CommissionedState + :ivar express_route_advertise: Whether to do express route advertise. + :vartype express_route_advertise: bool + :ivar geo: The Geo for CIDR advertising. Should be an Geo code. Known values are: "GLOBAL", + "AFRI", "APAC", "EURO", "LATAM", "NAM", "ME", "OCEANIA", "AQ", and "GLOBAL". + :vartype geo: str or ~azure.mgmt.network.v2023_09_01.models.Geo + :ivar no_internet_advertise: Whether to Advertise the range to Internet. + :vartype no_internet_advertise: bool + :ivar prefix_type: Type of custom IP prefix. Should be Singular, Parent, or Child. Known values + are: "Singular", "Parent", and "Child". + :vartype prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefixType + :ivar public_ip_prefixes: The list of all referenced PublicIpPrefixes. + :vartype public_ip_prefixes: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar resource_guid: The resource GUID property of the custom IP prefix resource. + :vartype resource_guid: str + :ivar failed_reason: The reason why resource is in failed state. + :vartype failed_reason: str + :ivar provisioning_state: The provisioning state of the custom IP prefix resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "child_custom_ip_prefixes": {"readonly": True}, + "public_ip_prefixes": {"readonly": True}, + "resource_guid": {"readonly": True}, + "failed_reason": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "asn": {"key": "properties.asn", "type": "str"}, + "cidr": {"key": "properties.cidr", "type": "str"}, + "signed_message": {"key": "properties.signedMessage", "type": "str"}, + "authorization_message": {"key": "properties.authorizationMessage", "type": "str"}, + "custom_ip_prefix_parent": {"key": "properties.customIpPrefixParent", "type": "SubResource"}, + "child_custom_ip_prefixes": {"key": "properties.childCustomIpPrefixes", "type": "[SubResource]"}, + "commissioned_state": {"key": "properties.commissionedState", "type": "str"}, + "express_route_advertise": {"key": "properties.expressRouteAdvertise", "type": "bool"}, + "geo": {"key": "properties.geo", "type": "str"}, + "no_internet_advertise": {"key": "properties.noInternetAdvertise", "type": "bool"}, + "prefix_type": {"key": "properties.prefixType", "type": "str"}, + "public_ip_prefixes": {"key": "properties.publicIpPrefixes", "type": "[SubResource]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "failed_reason": {"key": "properties.failedReason", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + zones: Optional[List[str]] = None, + asn: Optional[str] = None, + cidr: Optional[str] = None, + signed_message: Optional[str] = None, + authorization_message: Optional[str] = None, + custom_ip_prefix_parent: Optional["_models.SubResource"] = None, + commissioned_state: Optional[Union[str, "_models.CommissionedState"]] = None, + express_route_advertise: Optional[bool] = None, + geo: Optional[Union[str, "_models.Geo"]] = None, + no_internet_advertise: Optional[bool] = None, + prefix_type: Optional[Union[str, "_models.CustomIpPrefixType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the custom IP prefix. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword zones: A list of availability zones denoting the IP allocated for the resource needs + to come from. + :paramtype zones: list[str] + :keyword asn: The ASN for CIDR advertising. Should be an integer as string. + :paramtype asn: str + :keyword cidr: The prefix range in CIDR notation. Should include the start address and the + prefix length. + :paramtype cidr: str + :keyword signed_message: Signed message for WAN validation. + :paramtype signed_message: str + :keyword authorization_message: Authorization message for WAN validation. + :paramtype authorization_message: str + :keyword custom_ip_prefix_parent: The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + :paramtype custom_ip_prefix_parent: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword commissioned_state: The commissioned state of the Custom IP Prefix. Known values are: + "Provisioning", "Provisioned", "Commissioning", "CommissionedNoInternetAdvertise", + "Commissioned", "Decommissioning", "Deprovisioning", and "Deprovisioned". + :paramtype commissioned_state: str or ~azure.mgmt.network.v2023_09_01.models.CommissionedState + :keyword express_route_advertise: Whether to do express route advertise. + :paramtype express_route_advertise: bool + :keyword geo: The Geo for CIDR advertising. Should be an Geo code. Known values are: "GLOBAL", + "AFRI", "APAC", "EURO", "LATAM", "NAM", "ME", "OCEANIA", "AQ", and "GLOBAL". + :paramtype geo: str or ~azure.mgmt.network.v2023_09_01.models.Geo + :keyword no_internet_advertise: Whether to Advertise the range to Internet. + :paramtype no_internet_advertise: bool + :keyword prefix_type: Type of custom IP prefix. Should be Singular, Parent, or Child. Known + values are: "Singular", "Parent", and "Child". + :paramtype prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefixType + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.zones = zones + self.asn = asn + self.cidr = cidr + self.signed_message = signed_message + self.authorization_message = authorization_message + self.custom_ip_prefix_parent = custom_ip_prefix_parent + self.child_custom_ip_prefixes = None + self.commissioned_state = commissioned_state + self.express_route_advertise = express_route_advertise + self.geo = geo + self.no_internet_advertise = no_internet_advertise + self.prefix_type = prefix_type + self.public_ip_prefixes = None + self.resource_guid = None + self.failed_reason = None + self.provisioning_state = None + + +class CustomIpPrefixListResult(_serialization.Model): + """Response for ListCustomIpPrefixes API service call. + + :ivar value: A list of Custom IP prefixes that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CustomIpPrefix]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.CustomIpPrefix"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of Custom IP prefixes that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DdosCustomPolicy(Resource): + """A DDoS custom policy in a resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar resource_guid: The resource GUID property of the DDoS custom policy resource. It uniquely + identifies the resource, even if the user changes its name or migrate the resource across + subscriptions or resource groups. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the DDoS custom policy resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.resource_guid = None + self.provisioning_state = None + + +class DdosProtectionPlan(_serialization.Model): + """A DDoS protection plan in a resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar resource_guid: The resource GUID property of the DDoS protection plan resource. It + uniquely identifies the resource, even if the user changes its name or migrate the resource + across subscriptions or resource groups. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the DDoS protection plan resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar public_ip_addresses: The list of public IPs associated with the DDoS protection plan + resource. This list is read-only. + :vartype public_ip_addresses: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar virtual_networks: The list of virtual networks associated with the DDoS protection plan + resource. This list is read-only. + :vartype virtual_networks: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "public_ip_addresses": {"readonly": True}, + "virtual_networks": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "public_ip_addresses": {"key": "properties.publicIPAddresses", "type": "[SubResource]"}, + "virtual_networks": {"key": "properties.virtualNetworks", "type": "[SubResource]"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.etag = None + self.resource_guid = None + self.provisioning_state = None + self.public_ip_addresses = None + self.virtual_networks = None + + +class DdosProtectionPlanListResult(_serialization.Model): + """A list of DDoS protection plans. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of DDoS protection plans. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DdosProtectionPlan]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DdosProtectionPlan"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of DDoS protection plans. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DdosSettings(_serialization.Model): + """Contains the DDoS protection settings of the public IP. + + :ivar protection_mode: The DDoS protection mode of the public IP. Known values are: + "VirtualNetworkInherited", "Enabled", and "Disabled". + :vartype protection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.DdosSettingsProtectionMode + :ivar ddos_protection_plan: The DDoS protection plan associated with the public IP. Can only be + set if ProtectionMode is Enabled. + :vartype ddos_protection_plan: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "protection_mode": {"key": "protectionMode", "type": "str"}, + "ddos_protection_plan": {"key": "ddosProtectionPlan", "type": "SubResource"}, + } + + def __init__( + self, + *, + protection_mode: Optional[Union[str, "_models.DdosSettingsProtectionMode"]] = None, + ddos_protection_plan: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword protection_mode: The DDoS protection mode of the public IP. Known values are: + "VirtualNetworkInherited", "Enabled", and "Disabled". + :paramtype protection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.DdosSettingsProtectionMode + :keyword ddos_protection_plan: The DDoS protection plan associated with the public IP. Can only + be set if ProtectionMode is Enabled. + :paramtype ddos_protection_plan: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.protection_mode = protection_mode + self.ddos_protection_plan = ddos_protection_plan + + +class DefaultAdminRule(BaseAdminRule): # pylint: disable=too-many-instance-attributes + """Network default admin rule. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.AdminRuleKind + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar flag: Default rule flag. + :vartype flag: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"required": True}, + "system_data": {"readonly": True}, + "description": {"readonly": True}, + "protocol": {"readonly": True}, + "sources": {"readonly": True}, + "destinations": {"readonly": True}, + "source_port_ranges": {"readonly": True}, + "destination_port_ranges": {"readonly": True}, + "access": {"readonly": True}, + "priority": {"readonly": True}, + "direction": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "flag": {"key": "properties.flag", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__(self, *, flag: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword flag: Default rule flag. + :paramtype flag: str + """ + super().__init__(**kwargs) + self.kind: str = "Default" + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + self.resource_guid = None + + +class Delegation(SubResource): + """Details the service to which the subnet is delegated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a subnet. This name can be used to + access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar service_name: The name of the service to whom the subnet should be delegated (e.g. + Microsoft.Sql/servers). + :vartype service_name: str + :ivar actions: The actions permitted to the service upon delegation. + :vartype actions: list[str] + :ivar provisioning_state: The provisioning state of the service delegation resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "actions": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "service_name": {"key": "properties.serviceName", "type": "str"}, + "actions": {"key": "properties.actions", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + service_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a subnet. This name can be used + to access the resource. + :paramtype name: str + :keyword type: Resource type. + :paramtype type: str + :keyword service_name: The name of the service to whom the subnet should be delegated (e.g. + Microsoft.Sql/servers). + :paramtype service_name: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.service_name = service_name + self.actions = None + self.provisioning_state = None + + +class DelegationProperties(_serialization.Model): + """Properties of the delegation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_name: The service name to which the NVA is delegated. + :vartype service_name: str + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", + "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "service_name": {"key": "serviceName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, service_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword service_name: The service name to which the NVA is delegated. + :paramtype service_name: str + """ + super().__init__(**kwargs) + self.service_name = service_name + self.provisioning_state = None + + +class DeviceProperties(_serialization.Model): + """List of properties of the device. + + :ivar device_vendor: Name of the device Vendor. + :vartype device_vendor: str + :ivar device_model: Model of the device. + :vartype device_model: str + :ivar link_speed_in_mbps: Link speed. + :vartype link_speed_in_mbps: int + """ + + _attribute_map = { + "device_vendor": {"key": "deviceVendor", "type": "str"}, + "device_model": {"key": "deviceModel", "type": "str"}, + "link_speed_in_mbps": {"key": "linkSpeedInMbps", "type": "int"}, + } + + def __init__( + self, + *, + device_vendor: Optional[str] = None, + device_model: Optional[str] = None, + link_speed_in_mbps: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword device_vendor: Name of the device Vendor. + :paramtype device_vendor: str + :keyword device_model: Model of the device. + :paramtype device_model: str + :keyword link_speed_in_mbps: Link speed. + :paramtype link_speed_in_mbps: int + """ + super().__init__(**kwargs) + self.device_vendor = device_vendor + self.device_model = device_model + self.link_speed_in_mbps = link_speed_in_mbps + + +class DhcpOptions(_serialization.Model): + """DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. + Standard DHCP option for a subnet overrides VNET DHCP options. + + :ivar dns_servers: The list of DNS servers IP addresses. + :vartype dns_servers: list[str] + """ + + _attribute_map = { + "dns_servers": {"key": "dnsServers", "type": "[str]"}, + } + + def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword dns_servers: The list of DNS servers IP addresses. + :paramtype dns_servers: list[str] + """ + super().__init__(**kwargs) + self.dns_servers = dns_servers + + +class Dimension(_serialization.Model): + """Dimension of the metric. + + :ivar name: The name of the dimension. + :vartype name: str + :ivar display_name: The display name of the dimension. + :vartype display_name: str + :ivar internal_name: The internal name of the dimension. + :vartype internal_name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "internal_name": {"key": "internalName", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the dimension. + :paramtype name: str + :keyword display_name: The display name of the dimension. + :paramtype display_name: str + :keyword internal_name: The internal name of the dimension. + :paramtype internal_name: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.internal_name = internal_name + + +class DnsNameAvailabilityResult(_serialization.Model): + """Response for the CheckDnsNameAvailability API service call. + + :ivar available: Domain availability (True/False). + :vartype available: bool + """ + + _attribute_map = { + "available": {"key": "available", "type": "bool"}, + } + + def __init__(self, *, available: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword available: Domain availability (True/False). + :paramtype available: bool + """ + super().__init__(**kwargs) + self.available = available + + +class DnsSettings(_serialization.Model): + """DNS Proxy Settings in Firewall Policy. + + :ivar servers: List of Custom DNS Servers. + :vartype servers: list[str] + :ivar enable_proxy: Enable DNS Proxy on Firewalls attached to the Firewall Policy. + :vartype enable_proxy: bool + :ivar require_proxy_for_network_rules: FQDNs in Network Rules are supported when set to true. + :vartype require_proxy_for_network_rules: bool + """ + + _attribute_map = { + "servers": {"key": "servers", "type": "[str]"}, + "enable_proxy": {"key": "enableProxy", "type": "bool"}, + "require_proxy_for_network_rules": {"key": "requireProxyForNetworkRules", "type": "bool"}, + } + + def __init__( + self, + *, + servers: Optional[List[str]] = None, + enable_proxy: Optional[bool] = None, + require_proxy_for_network_rules: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword servers: List of Custom DNS Servers. + :paramtype servers: list[str] + :keyword enable_proxy: Enable DNS Proxy on Firewalls attached to the Firewall Policy. + :paramtype enable_proxy: bool + :keyword require_proxy_for_network_rules: FQDNs in Network Rules are supported when set to + true. + :paramtype require_proxy_for_network_rules: bool + """ + super().__init__(**kwargs) + self.servers = servers + self.enable_proxy = enable_proxy + self.require_proxy_for_network_rules = require_proxy_for_network_rules + + +class DscpConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Differentiated Services Code Point configuration for any given network interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar markings: List of markings to be used in the configuration. + :vartype markings: list[int] + :ivar source_ip_ranges: Source IP ranges. + :vartype source_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :ivar destination_ip_ranges: Destination IP ranges. + :vartype destination_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :ivar source_port_ranges: Sources port ranges. + :vartype source_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :ivar destination_port_ranges: Destination port ranges. + :vartype destination_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :ivar protocol: RNM supported protocol types. Known values are: "DoNotUse", "Icmp", "Tcp", + "Udp", "Gre", "Esp", "Ah", "Vxlan", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProtocolType + :ivar qos_definition_collection: QoS object definitions. + :vartype qos_definition_collection: list[~azure.mgmt.network.v2023_09_01.models.QosDefinition] + :ivar qos_collection_id: Qos Collection ID generated by RNM. + :vartype qos_collection_id: str + :ivar associated_network_interfaces: Associated Network Interfaces to the DSCP Configuration. + :vartype associated_network_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :ivar resource_guid: The resource GUID property of the DSCP Configuration resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the DSCP Configuration resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "qos_collection_id": {"readonly": True}, + "associated_network_interfaces": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "markings": {"key": "properties.markings", "type": "[int]"}, + "source_ip_ranges": {"key": "properties.sourceIpRanges", "type": "[QosIpRange]"}, + "destination_ip_ranges": {"key": "properties.destinationIpRanges", "type": "[QosIpRange]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[QosPortRange]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[QosPortRange]"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "qos_definition_collection": {"key": "properties.qosDefinitionCollection", "type": "[QosDefinition]"}, + "qos_collection_id": {"key": "properties.qosCollectionId", "type": "str"}, + "associated_network_interfaces": { + "key": "properties.associatedNetworkInterfaces", + "type": "[NetworkInterface]", + }, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + markings: Optional[List[int]] = None, + source_ip_ranges: Optional[List["_models.QosIpRange"]] = None, + destination_ip_ranges: Optional[List["_models.QosIpRange"]] = None, + source_port_ranges: Optional[List["_models.QosPortRange"]] = None, + destination_port_ranges: Optional[List["_models.QosPortRange"]] = None, + protocol: Optional[Union[str, "_models.ProtocolType"]] = None, + qos_definition_collection: Optional[List["_models.QosDefinition"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword markings: List of markings to be used in the configuration. + :paramtype markings: list[int] + :keyword source_ip_ranges: Source IP ranges. + :paramtype source_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :keyword destination_ip_ranges: Destination IP ranges. + :paramtype destination_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :keyword source_port_ranges: Sources port ranges. + :paramtype source_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :keyword destination_port_ranges: Destination port ranges. + :paramtype destination_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :keyword protocol: RNM supported protocol types. Known values are: "DoNotUse", "Icmp", "Tcp", + "Udp", "Gre", "Esp", "Ah", "Vxlan", and "All". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProtocolType + :keyword qos_definition_collection: QoS object definitions. + :paramtype qos_definition_collection: + list[~azure.mgmt.network.v2023_09_01.models.QosDefinition] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.markings = markings + self.source_ip_ranges = source_ip_ranges + self.destination_ip_ranges = destination_ip_ranges + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.protocol = protocol + self.qos_definition_collection = qos_definition_collection + self.qos_collection_id = None + self.associated_network_interfaces = None + self.resource_guid = None + self.provisioning_state = None + + +class DscpConfigurationListResult(_serialization.Model): + """Response for the DscpConfigurationList API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of dscp configurations in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DscpConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DscpConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of dscp configurations in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class EffectiveBaseSecurityAdminRule(_serialization.Model): + """Network base admin rule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + EffectiveSecurityAdminRule, EffectiveDefaultSecurityAdminRule + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + } + + _subtype_map = {"kind": {"Custom": "EffectiveSecurityAdminRule", "Default": "EffectiveDefaultSecurityAdminRule"}} + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + """ + super().__init__(**kwargs) + self.id = id + self.configuration_description = configuration_description + self.rule_collection_description = rule_collection_description + self.rule_collection_applies_to_groups = rule_collection_applies_to_groups + self.rule_groups = rule_groups + self.kind: Optional[str] = None + + +class EffectiveDefaultSecurityAdminRule(EffectiveBaseSecurityAdminRule): # pylint: disable=too-many-instance-attributes + """Network default admin rule. + + 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: Resource ID. + :vartype id: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar flag: Default rule flag. + :vartype flag: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "kind": {"required": True}, + "description": {"readonly": True}, + "protocol": {"readonly": True}, + "sources": {"readonly": True}, + "destinations": {"readonly": True}, + "source_port_ranges": {"readonly": True}, + "destination_port_ranges": {"readonly": True}, + "access": {"readonly": True}, + "priority": {"readonly": True}, + "direction": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "flag": {"key": "properties.flag", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + flag: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword flag: Default rule flag. + :paramtype flag: str + """ + super().__init__( + id=id, + configuration_description=configuration_description, + rule_collection_description=rule_collection_description, + rule_collection_applies_to_groups=rule_collection_applies_to_groups, + rule_groups=rule_groups, + **kwargs + ) + self.kind: str = "Default" + self.description = None + self.flag = flag + self.protocol = None + self.sources = None + self.destinations = None + self.source_port_ranges = None + self.destination_port_ranges = None + self.access = None + self.priority = None + self.direction = None + self.provisioning_state = None + self.resource_guid = None + + +class EffectiveNetworkSecurityGroup(_serialization.Model): + """Effective network security group. + + :ivar network_security_group: The ID of network security group that is applied. + :vartype network_security_group: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar association: Associated resources. + :vartype association: + ~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroupAssociation + :ivar effective_security_rules: A collection of effective security rules. + :vartype effective_security_rules: + list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityRule] + :ivar tag_map: Mapping of tags to list of IP Addresses included within the tag. + :vartype tag_map: str + """ + + _attribute_map = { + "network_security_group": {"key": "networkSecurityGroup", "type": "SubResource"}, + "association": {"key": "association", "type": "EffectiveNetworkSecurityGroupAssociation"}, + "effective_security_rules": {"key": "effectiveSecurityRules", "type": "[EffectiveNetworkSecurityRule]"}, + "tag_map": {"key": "tagMap", "type": "str"}, + } + + def __init__( + self, + *, + network_security_group: Optional["_models.SubResource"] = None, + association: Optional["_models.EffectiveNetworkSecurityGroupAssociation"] = None, + effective_security_rules: Optional[List["_models.EffectiveNetworkSecurityRule"]] = None, + tag_map: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_security_group: The ID of network security group that is applied. + :paramtype network_security_group: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword association: Associated resources. + :paramtype association: + ~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroupAssociation + :keyword effective_security_rules: A collection of effective security rules. + :paramtype effective_security_rules: + list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityRule] + :keyword tag_map: Mapping of tags to list of IP Addresses included within the tag. + :paramtype tag_map: str + """ + super().__init__(**kwargs) + self.network_security_group = network_security_group + self.association = association + self.effective_security_rules = effective_security_rules + self.tag_map = tag_map + + +class EffectiveNetworkSecurityGroupAssociation(_serialization.Model): + """The effective network security group association. + + :ivar network_manager: The ID of the Azure network manager if assigned. + :vartype network_manager: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar subnet: The ID of the subnet if assigned. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar network_interface: The ID of the network interface if assigned. + :vartype network_interface: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "network_manager": {"key": "networkManager", "type": "SubResource"}, + "subnet": {"key": "subnet", "type": "SubResource"}, + "network_interface": {"key": "networkInterface", "type": "SubResource"}, + } + + def __init__( + self, + *, + network_manager: Optional["_models.SubResource"] = None, + subnet: Optional["_models.SubResource"] = None, + network_interface: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_manager: The ID of the Azure network manager if assigned. + :paramtype network_manager: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword subnet: The ID of the subnet if assigned. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword network_interface: The ID of the network interface if assigned. + :paramtype network_interface: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.network_manager = network_manager + self.subnet = subnet + self.network_interface = network_interface + + +class EffectiveNetworkSecurityGroupListResult(_serialization.Model): + """Response for list effective network security groups API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of effective network security groups. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[EffectiveNetworkSecurityGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.EffectiveNetworkSecurityGroup"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of effective network security groups. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class EffectiveNetworkSecurityRule(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Effective network security rules. + + :ivar name: The name of the security rule specified by the user (if created by the user). + :vartype name: str + :ivar protocol: The network protocol this rule applies to. Known values are: "Tcp", "Udp", and + "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveSecurityRuleProtocol + :ivar source_port_range: The source port or range. + :vartype source_port_range: str + :ivar destination_port_range: The destination port or range. + :vartype destination_port_range: str + :ivar source_port_ranges: The source port ranges. Expected values include a single integer + between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. Expected values include a single + integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + :vartype destination_port_ranges: list[str] + :ivar source_address_prefix: The source address prefix. + :vartype source_address_prefix: str + :ivar destination_address_prefix: The destination address prefix. + :vartype destination_address_prefix: str + :ivar source_address_prefixes: The source address prefixes. Expected values include CIDR IP + ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the + asterisk (*). + :vartype source_address_prefixes: list[str] + :ivar destination_address_prefixes: The destination address prefixes. Expected values include + CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and + the asterisk (*). + :vartype destination_address_prefixes: list[str] + :ivar expanded_source_address_prefix: The expanded source address prefix. + :vartype expanded_source_address_prefix: list[str] + :ivar expanded_destination_address_prefix: Expanded destination address prefix. + :vartype expanded_destination_address_prefix: list[str] + :ivar access: Whether network traffic is allowed or denied. Known values are: "Allow" and + "Deny". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + :ivar priority: The priority of the rule. + :vartype priority: int + :ivar direction: The direction of the rule. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleDirection + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "source_port_range": {"key": "sourcePortRange", "type": "str"}, + "destination_port_range": {"key": "destinationPortRange", "type": "str"}, + "source_port_ranges": {"key": "sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "destinationPortRanges", "type": "[str]"}, + "source_address_prefix": {"key": "sourceAddressPrefix", "type": "str"}, + "destination_address_prefix": {"key": "destinationAddressPrefix", "type": "str"}, + "source_address_prefixes": {"key": "sourceAddressPrefixes", "type": "[str]"}, + "destination_address_prefixes": {"key": "destinationAddressPrefixes", "type": "[str]"}, + "expanded_source_address_prefix": {"key": "expandedSourceAddressPrefix", "type": "[str]"}, + "expanded_destination_address_prefix": {"key": "expandedDestinationAddressPrefix", "type": "[str]"}, + "access": {"key": "access", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + "direction": {"key": "direction", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + protocol: Optional[Union[str, "_models.EffectiveSecurityRuleProtocol"]] = None, + source_port_range: Optional[str] = None, + destination_port_range: Optional[str] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + source_address_prefix: Optional[str] = None, + destination_address_prefix: Optional[str] = None, + source_address_prefixes: Optional[List[str]] = None, + destination_address_prefixes: Optional[List[str]] = None, + expanded_source_address_prefix: Optional[List[str]] = None, + expanded_destination_address_prefix: Optional[List[str]] = None, + access: Optional[Union[str, "_models.SecurityRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "_models.SecurityRuleDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the security rule specified by the user (if created by the user). + :paramtype name: str + :keyword protocol: The network protocol this rule applies to. Known values are: "Tcp", "Udp", + and "All". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.EffectiveSecurityRuleProtocol + :keyword source_port_range: The source port or range. + :paramtype source_port_range: str + :keyword destination_port_range: The destination port or range. + :paramtype destination_port_range: str + :keyword source_port_ranges: The source port ranges. Expected values include a single integer + between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. Expected values include a single + integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + :paramtype destination_port_ranges: list[str] + :keyword source_address_prefix: The source address prefix. + :paramtype source_address_prefix: str + :keyword destination_address_prefix: The destination address prefix. + :paramtype destination_address_prefix: str + :keyword source_address_prefixes: The source address prefixes. Expected values include CIDR IP + ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the + asterisk (*). + :paramtype source_address_prefixes: list[str] + :keyword destination_address_prefixes: The destination address prefixes. Expected values + include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System + Tags, and the asterisk (*). + :paramtype destination_address_prefixes: list[str] + :keyword expanded_source_address_prefix: The expanded source address prefix. + :paramtype expanded_source_address_prefix: list[str] + :keyword expanded_destination_address_prefix: Expanded destination address prefix. + :paramtype expanded_destination_address_prefix: list[str] + :keyword access: Whether network traffic is allowed or denied. Known values are: "Allow" and + "Deny". + :paramtype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + :keyword priority: The priority of the rule. + :paramtype priority: int + :keyword direction: The direction of the rule. Known values are: "Inbound" and "Outbound". + :paramtype direction: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleDirection + """ + super().__init__(**kwargs) + self.name = name + self.protocol = protocol + self.source_port_range = source_port_range + self.destination_port_range = destination_port_range + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.source_address_prefix = source_address_prefix + self.destination_address_prefix = destination_address_prefix + self.source_address_prefixes = source_address_prefixes + self.destination_address_prefixes = destination_address_prefixes + self.expanded_source_address_prefix = expanded_source_address_prefix + self.expanded_destination_address_prefix = expanded_destination_address_prefix + self.access = access + self.priority = priority + self.direction = direction + + +class EffectiveRoute(_serialization.Model): + """Effective Route. + + :ivar name: The name of the user defined route. This is optional. + :vartype name: str + :ivar disable_bgp_route_propagation: If true, on-premises routes are not propagated to the + network interfaces in the subnet. + :vartype disable_bgp_route_propagation: bool + :ivar source: Who created the route. Known values are: "Unknown", "User", + "VirtualNetworkGateway", and "Default". + :vartype source: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveRouteSource + :ivar state: The value of effective route. Known values are: "Active" and "Invalid". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveRouteState + :ivar address_prefix: The address prefixes of the effective routes in CIDR notation. + :vartype address_prefix: list[str] + :ivar next_hop_ip_address: The IP address of the next hop of the effective route. + :vartype next_hop_ip_address: list[str] + :ivar next_hop_type: The type of Azure hop the packet should be sent to. Known values are: + "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", and "None". + :vartype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.RouteNextHopType + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "disable_bgp_route_propagation": {"key": "disableBgpRoutePropagation", "type": "bool"}, + "source": {"key": "source", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "address_prefix": {"key": "addressPrefix", "type": "[str]"}, + "next_hop_ip_address": {"key": "nextHopIpAddress", "type": "[str]"}, + "next_hop_type": {"key": "nextHopType", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + disable_bgp_route_propagation: Optional[bool] = None, + source: Optional[Union[str, "_models.EffectiveRouteSource"]] = None, + state: Optional[Union[str, "_models.EffectiveRouteState"]] = None, + address_prefix: Optional[List[str]] = None, + next_hop_ip_address: Optional[List[str]] = None, + next_hop_type: Optional[Union[str, "_models.RouteNextHopType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the user defined route. This is optional. + :paramtype name: str + :keyword disable_bgp_route_propagation: If true, on-premises routes are not propagated to the + network interfaces in the subnet. + :paramtype disable_bgp_route_propagation: bool + :keyword source: Who created the route. Known values are: "Unknown", "User", + "VirtualNetworkGateway", and "Default". + :paramtype source: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveRouteSource + :keyword state: The value of effective route. Known values are: "Active" and "Invalid". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveRouteState + :keyword address_prefix: The address prefixes of the effective routes in CIDR notation. + :paramtype address_prefix: list[str] + :keyword next_hop_ip_address: The IP address of the next hop of the effective route. + :paramtype next_hop_ip_address: list[str] + :keyword next_hop_type: The type of Azure hop the packet should be sent to. Known values are: + "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", and "None". + :paramtype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.RouteNextHopType + """ + super().__init__(**kwargs) + self.name = name + self.disable_bgp_route_propagation = disable_bgp_route_propagation + self.source = source + self.state = state + self.address_prefix = address_prefix + self.next_hop_ip_address = next_hop_ip_address + self.next_hop_type = next_hop_type + + +class EffectiveRouteListResult(_serialization.Model): + """Response for list effective route API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of effective routes. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveRoute] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[EffectiveRoute]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.EffectiveRoute"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of effective routes. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveRoute] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class EffectiveRouteMapRoute(_serialization.Model): + """The effective RouteMap route configured on the connection resource. + + :ivar prefix: The address prefix of the route. + :vartype prefix: str + :ivar bgp_communities: BGP communities of the route. + :vartype bgp_communities: str + :ivar as_path: The ASPath of this route. + :vartype as_path: str + """ + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + "bgp_communities": {"key": "bgpCommunities", "type": "str"}, + "as_path": {"key": "asPath", "type": "str"}, + } + + def __init__( + self, + *, + prefix: Optional[str] = None, + bgp_communities: Optional[str] = None, + as_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword prefix: The address prefix of the route. + :paramtype prefix: str + :keyword bgp_communities: BGP communities of the route. + :paramtype bgp_communities: str + :keyword as_path: The ASPath of this route. + :paramtype as_path: str + """ + super().__init__(**kwargs) + self.prefix = prefix + self.bgp_communities = bgp_communities + self.as_path = as_path + + +class EffectiveRouteMapRouteList(_serialization.Model): + """EffectiveRouteMapRoute List. + + :ivar value: The list of Effective RouteMap Routes configured on the connection resource. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRoute] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EffectiveRouteMapRoute]"}, + } + + def __init__(self, *, value: Optional[List["_models.EffectiveRouteMapRoute"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of Effective RouteMap Routes configured on the connection resource. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRoute] + """ + super().__init__(**kwargs) + self.value = value + + +class EffectiveRoutesParameters(_serialization.Model): + """The parameters specifying the resource whose effective routes are being requested. + + :ivar resource_id: The resource whose effective routes are being requested. + :vartype resource_id: str + :ivar virtual_wan_resource_type: The type of the specified resource like RouteTable, + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :vartype virtual_wan_resource_type: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "virtual_wan_resource_type": {"key": "virtualWanResourceType", "type": "str"}, + } + + def __init__( + self, *, resource_id: Optional[str] = None, virtual_wan_resource_type: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_id: The resource whose effective routes are being requested. + :paramtype resource_id: str + :keyword virtual_wan_resource_type: The type of the specified resource like RouteTable, + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :paramtype virtual_wan_resource_type: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.virtual_wan_resource_type = virtual_wan_resource_type + + +class EffectiveSecurityAdminRule(EffectiveBaseSecurityAdminRule): # pylint: disable=too-many-instance-attributes + """Network admin rule. + + 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: Resource ID. + :vartype id: str + :ivar configuration_description: A description of the security admin configuration. + :vartype configuration_description: str + :ivar rule_collection_description: A description of the rule collection. + :vartype rule_collection_description: str + :ivar rule_collection_applies_to_groups: Groups for rule collection. + :vartype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :ivar rule_groups: Effective configuration groups. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :ivar kind: Whether the rule is custom or default. Required. Known values are: "Custom" and + "Default". + :vartype kind: str or ~azure.mgmt.network.v2023_09_01.models.EffectiveAdminRuleKind + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "Any", and "Ah". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :ivar sources: The CIDR or source IP ranges. + :vartype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar destinations: The destination address prefixes. CIDR or destination IP ranges. + :vartype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: Indicates the access allowed for this particular rule. Known values are: "Allow", + "Deny", and "AlwaysAllow". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :ivar priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :vartype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "kind": {"required": True}, + "priority": {"maximum": 4096, "minimum": 1}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "configuration_description": {"key": "configurationDescription", "type": "str"}, + "rule_collection_description": {"key": "ruleCollectionDescription", "type": "str"}, + "rule_collection_applies_to_groups": { + "key": "ruleCollectionAppliesToGroups", + "type": "[NetworkManagerSecurityGroupItem]", + }, + "rule_groups": {"key": "ruleGroups", "type": "[ConfigurationGroup]"}, + "kind": {"key": "kind", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "sources": {"key": "properties.sources", "type": "[AddressPrefixItem]"}, + "destinations": {"key": "properties.destinations", "type": "[AddressPrefixItem]"}, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + configuration_description: Optional[str] = None, + rule_collection_description: Optional[str] = None, + rule_collection_applies_to_groups: Optional[List["_models.NetworkManagerSecurityGroupItem"]] = None, + rule_groups: Optional[List["_models.ConfigurationGroup"]] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "_models.SecurityConfigurationRuleProtocol"]] = None, + sources: Optional[List["_models.AddressPrefixItem"]] = None, + destinations: Optional[List["_models.AddressPrefixItem"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "_models.SecurityConfigurationRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "_models.SecurityConfigurationRuleDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword configuration_description: A description of the security admin configuration. + :paramtype configuration_description: str + :keyword rule_collection_description: A description of the rule collection. + :paramtype rule_collection_description: str + :keyword rule_collection_applies_to_groups: Groups for rule collection. + :paramtype rule_collection_applies_to_groups: + list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerSecurityGroupItem] + :keyword rule_groups: Effective configuration groups. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ConfigurationGroup] + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", + "Icmp", "Esp", "Any", and "Ah". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleProtocol + :keyword sources: The CIDR or source IP ranges. + :paramtype sources: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword destinations: The destination address prefixes. CIDR or destination IP ranges. + :paramtype destinations: list[~azure.mgmt.network.v2023_09_01.models.AddressPrefixItem] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: Indicates the access allowed for this particular rule. Known values are: + "Allow", "Deny", and "AlwaysAllow". + :paramtype access: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleAccess + :keyword priority: The priority of the rule. The value can be between 1 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :paramtype priority: int + :keyword direction: Indicates if the traffic matched against the rule in inbound or outbound. + Known values are: "Inbound" and "Outbound". + :paramtype direction: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityConfigurationRuleDirection + """ + super().__init__( + id=id, + configuration_description=configuration_description, + rule_collection_description=rule_collection_description, + rule_collection_applies_to_groups=rule_collection_applies_to_groups, + rule_groups=rule_groups, + **kwargs + ) + self.kind: str = "Custom" + self.description = description + self.protocol = protocol + self.sources = sources + self.destinations = destinations + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + self.resource_guid = None + + +class EndpointServiceResult(SubResource): + """Endpoint service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the endpoint service. + :vartype name: str + :ivar type: Type of the endpoint service. + :vartype type: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(id=id, **kwargs) + self.name = None + self.type = None + + +class EndpointServicesListResult(_serialization.Model): + """Response for the ListAvailableEndpointServices API service call. + + :ivar value: List of available endpoint services in a region. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EndpointServiceResult] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EndpointServiceResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.EndpointServiceResult"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of available endpoint services in a region. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.EndpointServiceResult] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Error(_serialization.Model): + """Common error representation. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error details. + :vartype details: list[~azure.mgmt.network.v2023_09_01.models.ErrorDetails] + :ivar inner_error: Inner error message. + :vartype inner_error: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetails]"}, + "inner_error": {"key": "innerError", "type": "str"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.ErrorDetails"]] = None, + inner_error: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message. + :paramtype message: str + :keyword target: Error target. + :paramtype target: str + :keyword details: Error details. + :paramtype details: list[~azure.mgmt.network.v2023_09_01.models.ErrorDetails] + :keyword inner_error: Inner error message. + :paramtype inner_error: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.inner_error = inner_error + + +class ErrorDetails(_serialization.Model): + """Common error details representation. + + :ivar code: Error code. + :vartype code: str + :ivar target: Error target. + :vartype target: str + :ivar message: Error message. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, target: Optional[str] = None, message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword target: Error target. + :paramtype target: str + :keyword message: Error message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class ErrorResponse(_serialization.Model): + """The error object. + + :ivar error: The error details object. + :vartype error: ~azure.mgmt.network.v2023_09_01.models.ErrorDetails + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetails"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error details object. + :paramtype error: ~azure.mgmt.network.v2023_09_01.models.ErrorDetails + """ + super().__init__(**kwargs) + self.error = error + + +class EvaluatedNetworkSecurityGroup(_serialization.Model): + """Results of network security group evaluation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_security_group_id: Network security group ID. + :vartype network_security_group_id: str + :ivar applied_to: Resource ID of nic or subnet to which network security group is applied. + :vartype applied_to: str + :ivar matched_rule: Matched network security rule. + :vartype matched_rule: ~azure.mgmt.network.v2023_09_01.models.MatchedRule + :ivar rules_evaluation_result: List of network security rules evaluation results. + :vartype rules_evaluation_result: + list[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityRulesEvaluationResult] + """ + + _validation = { + "rules_evaluation_result": {"readonly": True}, + } + + _attribute_map = { + "network_security_group_id": {"key": "networkSecurityGroupId", "type": "str"}, + "applied_to": {"key": "appliedTo", "type": "str"}, + "matched_rule": {"key": "matchedRule", "type": "MatchedRule"}, + "rules_evaluation_result": {"key": "rulesEvaluationResult", "type": "[NetworkSecurityRulesEvaluationResult]"}, + } + + def __init__( + self, + *, + network_security_group_id: Optional[str] = None, + applied_to: Optional[str] = None, + matched_rule: Optional["_models.MatchedRule"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_security_group_id: Network security group ID. + :paramtype network_security_group_id: str + :keyword applied_to: Resource ID of nic or subnet to which network security group is applied. + :paramtype applied_to: str + :keyword matched_rule: Matched network security rule. + :paramtype matched_rule: ~azure.mgmt.network.v2023_09_01.models.MatchedRule + """ + super().__init__(**kwargs) + self.network_security_group_id = network_security_group_id + self.applied_to = applied_to + self.matched_rule = matched_rule + self.rules_evaluation_result = None + + +class ExclusionManagedRule(_serialization.Model): + """Defines a managed rule to use for exclusion. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_id: Identifier for the managed rule. Required. + :vartype rule_id: str + """ + + _validation = { + "rule_id": {"required": True}, + } + + _attribute_map = { + "rule_id": {"key": "ruleId", "type": "str"}, + } + + def __init__(self, *, rule_id: str, **kwargs: Any) -> None: + """ + :keyword rule_id: Identifier for the managed rule. Required. + :paramtype rule_id: str + """ + super().__init__(**kwargs) + self.rule_id = rule_id + + +class ExclusionManagedRuleGroup(_serialization.Model): + """Defines a managed rule group to use for exclusion. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_group_name: The managed rule group for exclusion. Required. + :vartype rule_group_name: str + :ivar rules: List of rules that will be excluded. If none specified, all rules in the group + will be excluded. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRule] + """ + + _validation = { + "rule_group_name": {"required": True}, + } + + _attribute_map = { + "rule_group_name": {"key": "ruleGroupName", "type": "str"}, + "rules": {"key": "rules", "type": "[ExclusionManagedRule]"}, + } + + def __init__( + self, *, rule_group_name: str, rules: Optional[List["_models.ExclusionManagedRule"]] = None, **kwargs: Any + ) -> None: + """ + :keyword rule_group_name: The managed rule group for exclusion. Required. + :paramtype rule_group_name: str + :keyword rules: List of rules that will be excluded. If none specified, all rules in the group + will be excluded. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRule] + """ + super().__init__(**kwargs) + self.rule_group_name = rule_group_name + self.rules = rules + + +class ExclusionManagedRuleSet(_serialization.Model): + """Defines a managed rule set for Exclusions. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_set_type: Defines the rule set type to use. Required. + :vartype rule_set_type: str + :ivar rule_set_version: Defines the version of the rule set to use. Required. + :vartype rule_set_version: str + :ivar rule_groups: Defines the rule groups to apply to the rule set. + :vartype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRuleGroup] + """ + + _validation = { + "rule_set_type": {"required": True}, + "rule_set_version": {"required": True}, + } + + _attribute_map = { + "rule_set_type": {"key": "ruleSetType", "type": "str"}, + "rule_set_version": {"key": "ruleSetVersion", "type": "str"}, + "rule_groups": {"key": "ruleGroups", "type": "[ExclusionManagedRuleGroup]"}, + } + + def __init__( + self, + *, + rule_set_type: str, + rule_set_version: str, + rule_groups: Optional[List["_models.ExclusionManagedRuleGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_set_type: Defines the rule set type to use. Required. + :paramtype rule_set_type: str + :keyword rule_set_version: Defines the version of the rule set to use. Required. + :paramtype rule_set_version: str + :keyword rule_groups: Defines the rule groups to apply to the rule set. + :paramtype rule_groups: list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRuleGroup] + """ + super().__init__(**kwargs) + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.rule_groups = rule_groups + + +class ExplicitProxy(_serialization.Model): + """Explicit Proxy Settings in Firewall Policy. + + :ivar enable_explicit_proxy: When set to true, explicit proxy mode is enabled. + :vartype enable_explicit_proxy: bool + :ivar http_port: Port number for explicit proxy http protocol, cannot be greater than 64000. + :vartype http_port: int + :ivar https_port: Port number for explicit proxy https protocol, cannot be greater than 64000. + :vartype https_port: int + :ivar enable_pac_file: When set to true, pac file port and url needs to be provided. + :vartype enable_pac_file: bool + :ivar pac_file_port: Port number for firewall to serve PAC file. + :vartype pac_file_port: int + :ivar pac_file: SAS URL for PAC file. + :vartype pac_file: str + """ + + _validation = { + "http_port": {"maximum": 64000, "minimum": 0}, + "https_port": {"maximum": 64000, "minimum": 0}, + "pac_file_port": {"maximum": 64000, "minimum": 0}, + } + + _attribute_map = { + "enable_explicit_proxy": {"key": "enableExplicitProxy", "type": "bool"}, + "http_port": {"key": "httpPort", "type": "int"}, + "https_port": {"key": "httpsPort", "type": "int"}, + "enable_pac_file": {"key": "enablePacFile", "type": "bool"}, + "pac_file_port": {"key": "pacFilePort", "type": "int"}, + "pac_file": {"key": "pacFile", "type": "str"}, + } + + def __init__( + self, + *, + enable_explicit_proxy: Optional[bool] = None, + http_port: Optional[int] = None, + https_port: Optional[int] = None, + enable_pac_file: Optional[bool] = None, + pac_file_port: Optional[int] = None, + pac_file: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_explicit_proxy: When set to true, explicit proxy mode is enabled. + :paramtype enable_explicit_proxy: bool + :keyword http_port: Port number for explicit proxy http protocol, cannot be greater than 64000. + :paramtype http_port: int + :keyword https_port: Port number for explicit proxy https protocol, cannot be greater than + 64000. + :paramtype https_port: int + :keyword enable_pac_file: When set to true, pac file port and url needs to be provided. + :paramtype enable_pac_file: bool + :keyword pac_file_port: Port number for firewall to serve PAC file. + :paramtype pac_file_port: int + :keyword pac_file: SAS URL for PAC file. + :paramtype pac_file: str + """ + super().__init__(**kwargs) + self.enable_explicit_proxy = enable_explicit_proxy + self.http_port = http_port + self.https_port = https_port + self.enable_pac_file = enable_pac_file + self.pac_file_port = pac_file_port + self.pac_file = pac_file + + +class ExpressRouteCircuit(Resource): # pylint: disable=too-many-instance-attributes + """ExpressRouteCircuit resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar allow_classic_operations: Allow classic operations. + :vartype allow_classic_operations: bool + :ivar circuit_provisioning_state: The CircuitProvisioningState state of the resource. + :vartype circuit_provisioning_state: str + :ivar service_provider_provisioning_state: The ServiceProviderProvisioningState state of the + resource. Known values are: "NotProvisioned", "Provisioning", "Provisioned", and + "Deprovisioning". + :vartype service_provider_provisioning_state: str or + ~azure.mgmt.network.v2023_09_01.models.ServiceProviderProvisioningState + :ivar authorizations: The list of authorizations. + :vartype authorizations: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :ivar peerings: The list of peerings. + :vartype peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar service_key: The ServiceKey. + :vartype service_key: str + :ivar service_provider_notes: The ServiceProviderNotes. + :vartype service_provider_notes: str + :ivar service_provider_properties: The ServiceProviderProperties. + :vartype service_provider_properties: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitServiceProviderProperties + :ivar express_route_port: The reference to the ExpressRoutePort resource when the circuit is + provisioned on an ExpressRoutePort resource. + :vartype express_route_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar bandwidth_in_gbps: The bandwidth of the circuit when the circuit is provisioned on an + ExpressRoutePort resource. + :vartype bandwidth_in_gbps: float + :ivar stag: The identifier of the circuit traffic. Outer tag for QinQ encapsulation. + :vartype stag: int + :ivar provisioning_state: The provisioning state of the express route circuit resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar gateway_manager_etag: The GatewayManager Etag. + :vartype gateway_manager_etag: str + :ivar global_reach_enabled: Flag denoting global reach status. + :vartype global_reach_enabled: bool + :ivar authorization_key: The authorizationKey. + :vartype authorization_key: str + :ivar authorization_status: The authorization status of the Circuit. + :vartype authorization_status: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "stag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "authorization_status": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ExpressRouteCircuitSku"}, + "etag": {"key": "etag", "type": "str"}, + "allow_classic_operations": {"key": "properties.allowClassicOperations", "type": "bool"}, + "circuit_provisioning_state": {"key": "properties.circuitProvisioningState", "type": "str"}, + "service_provider_provisioning_state": {"key": "properties.serviceProviderProvisioningState", "type": "str"}, + "authorizations": {"key": "properties.authorizations", "type": "[ExpressRouteCircuitAuthorization]"}, + "peerings": {"key": "properties.peerings", "type": "[ExpressRouteCircuitPeering]"}, + "service_key": {"key": "properties.serviceKey", "type": "str"}, + "service_provider_notes": {"key": "properties.serviceProviderNotes", "type": "str"}, + "service_provider_properties": { + "key": "properties.serviceProviderProperties", + "type": "ExpressRouteCircuitServiceProviderProperties", + }, + "express_route_port": {"key": "properties.expressRoutePort", "type": "SubResource"}, + "bandwidth_in_gbps": {"key": "properties.bandwidthInGbps", "type": "float"}, + "stag": {"key": "properties.stag", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "gateway_manager_etag": {"key": "properties.gatewayManagerEtag", "type": "str"}, + "global_reach_enabled": {"key": "properties.globalReachEnabled", "type": "bool"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "authorization_status": {"key": "properties.authorizationStatus", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ExpressRouteCircuitSku"] = None, + allow_classic_operations: Optional[bool] = None, + circuit_provisioning_state: Optional[str] = None, + service_provider_provisioning_state: Optional[Union[str, "_models.ServiceProviderProvisioningState"]] = None, + authorizations: Optional[List["_models.ExpressRouteCircuitAuthorization"]] = None, + peerings: Optional[List["_models.ExpressRouteCircuitPeering"]] = None, + service_key: Optional[str] = None, + service_provider_notes: Optional[str] = None, + service_provider_properties: Optional["_models.ExpressRouteCircuitServiceProviderProperties"] = None, + express_route_port: Optional["_models.SubResource"] = None, + bandwidth_in_gbps: Optional[float] = None, + gateway_manager_etag: Optional[str] = None, + global_reach_enabled: Optional[bool] = None, + authorization_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSku + :keyword allow_classic_operations: Allow classic operations. + :paramtype allow_classic_operations: bool + :keyword circuit_provisioning_state: The CircuitProvisioningState state of the resource. + :paramtype circuit_provisioning_state: str + :keyword service_provider_provisioning_state: The ServiceProviderProvisioningState state of the + resource. Known values are: "NotProvisioned", "Provisioning", "Provisioned", and + "Deprovisioning". + :paramtype service_provider_provisioning_state: str or + ~azure.mgmt.network.v2023_09_01.models.ServiceProviderProvisioningState + :keyword authorizations: The list of authorizations. + :paramtype authorizations: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :keyword peerings: The list of peerings. + :paramtype peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :keyword service_key: The ServiceKey. + :paramtype service_key: str + :keyword service_provider_notes: The ServiceProviderNotes. + :paramtype service_provider_notes: str + :keyword service_provider_properties: The ServiceProviderProperties. + :paramtype service_provider_properties: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitServiceProviderProperties + :keyword express_route_port: The reference to the ExpressRoutePort resource when the circuit is + provisioned on an ExpressRoutePort resource. + :paramtype express_route_port: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword bandwidth_in_gbps: The bandwidth of the circuit when the circuit is provisioned on an + ExpressRoutePort resource. + :paramtype bandwidth_in_gbps: float + :keyword gateway_manager_etag: The GatewayManager Etag. + :paramtype gateway_manager_etag: str + :keyword global_reach_enabled: Flag denoting global reach status. + :paramtype global_reach_enabled: bool + :keyword authorization_key: The authorizationKey. + :paramtype authorization_key: str + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.sku = sku + self.etag = None + self.allow_classic_operations = allow_classic_operations + self.circuit_provisioning_state = circuit_provisioning_state + self.service_provider_provisioning_state = service_provider_provisioning_state + self.authorizations = authorizations + self.peerings = peerings + self.service_key = service_key + self.service_provider_notes = service_provider_notes + self.service_provider_properties = service_provider_properties + self.express_route_port = express_route_port + self.bandwidth_in_gbps = bandwidth_in_gbps + self.stag = None + self.provisioning_state = None + self.gateway_manager_etag = gateway_manager_etag + self.global_reach_enabled = global_reach_enabled + self.authorization_key = authorization_key + self.authorization_status = None + + +class ExpressRouteCircuitArpTable(_serialization.Model): + """The ARP table associated with the ExpressRouteCircuit. + + :ivar age: Entry age in minutes. + :vartype age: int + :ivar interface: Interface address. + :vartype interface: str + :ivar ip_address: The IP address. + :vartype ip_address: str + :ivar mac_address: The MAC address. + :vartype mac_address: str + """ + + _attribute_map = { + "age": {"key": "age", "type": "int"}, + "interface": {"key": "interface", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + } + + def __init__( + self, + *, + age: Optional[int] = None, + interface: Optional[str] = None, + ip_address: Optional[str] = None, + mac_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword age: Entry age in minutes. + :paramtype age: int + :keyword interface: Interface address. + :paramtype interface: str + :keyword ip_address: The IP address. + :paramtype ip_address: str + :keyword mac_address: The MAC address. + :paramtype mac_address: str + """ + super().__init__(**kwargs) + self.age = age + self.interface = interface + self.ip_address = ip_address + self.mac_address = mac_address + + +class ExpressRouteCircuitAuthorization(SubResource): + """Authorization in an ExpressRouteCircuit resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar authorization_key: The authorization key. + :vartype authorization_key: str + :ivar authorization_use_status: The authorization use status. Known values are: "Available" and + "InUse". + :vartype authorization_use_status: str or + ~azure.mgmt.network.v2023_09_01.models.AuthorizationUseStatus + :ivar provisioning_state: The provisioning state of the authorization resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "authorization_use_status": {"key": "properties.authorizationUseStatus", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + authorization_key: Optional[str] = None, + authorization_use_status: Optional[Union[str, "_models.AuthorizationUseStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword authorization_key: The authorization key. + :paramtype authorization_key: str + :keyword authorization_use_status: The authorization use status. Known values are: "Available" + and "InUse". + :paramtype authorization_use_status: str or + ~azure.mgmt.network.v2023_09_01.models.AuthorizationUseStatus + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.authorization_key = authorization_key + self.authorization_use_status = authorization_use_status + self.provisioning_state = None + + +class ExpressRouteCircuitConnection(SubResource): # pylint: disable=too-many-instance-attributes + """Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the circuit initiating connection. + :vartype express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the peered circuit. + :vartype peer_express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar address_prefix: /29 IP address space to carve out Customer addresses for tunnels. + :vartype address_prefix: str + :ivar authorization_key: The authorization key. + :vartype authorization_key: str + :ivar ipv6_circuit_connection_config: IPv6 Address PrefixProperties of the express route + circuit connection. + :vartype ipv6_circuit_connection_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6CircuitConnectionConfig + :ivar circuit_connection_status: Express Route Circuit connection state. Known values are: + "Connected", "Connecting", and "Disconnected". + :vartype circuit_connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.CircuitConnectionStatus + :ivar provisioning_state: The provisioning state of the express route circuit connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "circuit_connection_status": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "express_route_circuit_peering": {"key": "properties.expressRouteCircuitPeering", "type": "SubResource"}, + "peer_express_route_circuit_peering": { + "key": "properties.peerExpressRouteCircuitPeering", + "type": "SubResource", + }, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "ipv6_circuit_connection_config": { + "key": "properties.ipv6CircuitConnectionConfig", + "type": "Ipv6CircuitConnectionConfig", + }, + "circuit_connection_status": {"key": "properties.circuitConnectionStatus", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + express_route_circuit_peering: Optional["_models.SubResource"] = None, + peer_express_route_circuit_peering: Optional["_models.SubResource"] = None, + address_prefix: Optional[str] = None, + authorization_key: Optional[str] = None, + ipv6_circuit_connection_config: Optional["_models.Ipv6CircuitConnectionConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the circuit initiating connection. + :paramtype express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the peered circuit. + :paramtype peer_express_route_circuit_peering: + ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword address_prefix: /29 IP address space to carve out Customer addresses for tunnels. + :paramtype address_prefix: str + :keyword authorization_key: The authorization key. + :paramtype authorization_key: str + :keyword ipv6_circuit_connection_config: IPv6 Address PrefixProperties of the express route + circuit connection. + :paramtype ipv6_circuit_connection_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6CircuitConnectionConfig + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.express_route_circuit_peering = express_route_circuit_peering + self.peer_express_route_circuit_peering = peer_express_route_circuit_peering + self.address_prefix = address_prefix + self.authorization_key = authorization_key + self.ipv6_circuit_connection_config = ipv6_circuit_connection_config + self.circuit_connection_status = None + self.provisioning_state = None + + +class ExpressRouteCircuitConnectionListResult(_serialization.Model): + """Response for ListConnections API service call retrieves all global reach connections that + belongs to a Private Peering for an ExpressRouteCircuit. + + :ivar value: The global reach connection associated with Private Peering in an ExpressRoute + Circuit. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The global reach connection associated with Private Peering in an ExpressRoute + Circuit. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitListResult(_serialization.Model): + """Response for ListExpressRouteCircuit API service call. + + :ivar value: A list of ExpressRouteCircuits in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuit]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuit"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of ExpressRouteCircuits in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitPeering(SubResource): # pylint: disable=too-many-instance-attributes + """Peering in an ExpressRouteCircuit resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar peering_type: The peering type. Known values are: "AzurePublicPeering", + "AzurePrivatePeering", and "MicrosoftPeering". + :vartype peering_type: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringType + :ivar state: The peering state. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringState + :ivar azure_asn: The Azure ASN. + :vartype azure_asn: int + :ivar peer_asn: The peer ASN. + :vartype peer_asn: int + :ivar primary_peer_address_prefix: The primary address prefix. + :vartype primary_peer_address_prefix: str + :ivar secondary_peer_address_prefix: The secondary address prefix. + :vartype secondary_peer_address_prefix: str + :ivar primary_azure_port: The primary port. + :vartype primary_azure_port: str + :ivar secondary_azure_port: The secondary port. + :vartype secondary_azure_port: str + :ivar shared_key: The shared key. + :vartype shared_key: str + :ivar vlan_id: The VLAN ID. + :vartype vlan_id: int + :ivar microsoft_peering_config: The Microsoft peering configuration. + :vartype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :ivar stats: The peering stats of express route circuit. + :vartype stats: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :ivar provisioning_state: The provisioning state of the express route circuit peering resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar gateway_manager_etag: The GatewayManager Etag. + :vartype gateway_manager_etag: str + :ivar last_modified_by: Who was the last to modify the peering. + :vartype last_modified_by: str + :ivar route_filter: The reference to the RouteFilter resource. + :vartype route_filter: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar ipv6_peering_config: The IPv6 peering configuration. + :vartype ipv6_peering_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6ExpressRouteCircuitPeeringConfig + :ivar express_route_connection: The ExpressRoute connection. + :vartype express_route_connection: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnectionId + :ivar connections: The list of circuit connections associated with Azure Private Peering for + this circuit. + :vartype connections: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :ivar peered_connections: The list of peered circuit connections associated with Azure Private + Peering for this circuit. + :vartype peered_connections: + list[~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "peer_asn": {"maximum": 4294967295, "minimum": 1}, + "provisioning_state": {"readonly": True}, + "last_modified_by": {"readonly": True}, + "peered_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "peering_type": {"key": "properties.peeringType", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "azure_asn": {"key": "properties.azureASN", "type": "int"}, + "peer_asn": {"key": "properties.peerASN", "type": "int"}, + "primary_peer_address_prefix": {"key": "properties.primaryPeerAddressPrefix", "type": "str"}, + "secondary_peer_address_prefix": {"key": "properties.secondaryPeerAddressPrefix", "type": "str"}, + "primary_azure_port": {"key": "properties.primaryAzurePort", "type": "str"}, + "secondary_azure_port": {"key": "properties.secondaryAzurePort", "type": "str"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "vlan_id": {"key": "properties.vlanId", "type": "int"}, + "microsoft_peering_config": { + "key": "properties.microsoftPeeringConfig", + "type": "ExpressRouteCircuitPeeringConfig", + }, + "stats": {"key": "properties.stats", "type": "ExpressRouteCircuitStats"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "gateway_manager_etag": {"key": "properties.gatewayManagerEtag", "type": "str"}, + "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, + "route_filter": {"key": "properties.routeFilter", "type": "SubResource"}, + "ipv6_peering_config": {"key": "properties.ipv6PeeringConfig", "type": "Ipv6ExpressRouteCircuitPeeringConfig"}, + "express_route_connection": {"key": "properties.expressRouteConnection", "type": "ExpressRouteConnectionId"}, + "connections": {"key": "properties.connections", "type": "[ExpressRouteCircuitConnection]"}, + "peered_connections": {"key": "properties.peeredConnections", "type": "[PeerExpressRouteCircuitConnection]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + peering_type: Optional[Union[str, "_models.ExpressRoutePeeringType"]] = None, + state: Optional[Union[str, "_models.ExpressRoutePeeringState"]] = None, + azure_asn: Optional[int] = None, + peer_asn: Optional[int] = None, + primary_peer_address_prefix: Optional[str] = None, + secondary_peer_address_prefix: Optional[str] = None, + primary_azure_port: Optional[str] = None, + secondary_azure_port: Optional[str] = None, + shared_key: Optional[str] = None, + vlan_id: Optional[int] = None, + microsoft_peering_config: Optional["_models.ExpressRouteCircuitPeeringConfig"] = None, + stats: Optional["_models.ExpressRouteCircuitStats"] = None, + gateway_manager_etag: Optional[str] = None, + route_filter: Optional["_models.SubResource"] = None, + ipv6_peering_config: Optional["_models.Ipv6ExpressRouteCircuitPeeringConfig"] = None, + express_route_connection: Optional["_models.ExpressRouteConnectionId"] = None, + connections: Optional[List["_models.ExpressRouteCircuitConnection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword peering_type: The peering type. Known values are: "AzurePublicPeering", + "AzurePrivatePeering", and "MicrosoftPeering". + :paramtype peering_type: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringType + :keyword state: The peering state. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringState + :keyword azure_asn: The Azure ASN. + :paramtype azure_asn: int + :keyword peer_asn: The peer ASN. + :paramtype peer_asn: int + :keyword primary_peer_address_prefix: The primary address prefix. + :paramtype primary_peer_address_prefix: str + :keyword secondary_peer_address_prefix: The secondary address prefix. + :paramtype secondary_peer_address_prefix: str + :keyword primary_azure_port: The primary port. + :paramtype primary_azure_port: str + :keyword secondary_azure_port: The secondary port. + :paramtype secondary_azure_port: str + :keyword shared_key: The shared key. + :paramtype shared_key: str + :keyword vlan_id: The VLAN ID. + :paramtype vlan_id: int + :keyword microsoft_peering_config: The Microsoft peering configuration. + :paramtype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :keyword stats: The peering stats of express route circuit. + :paramtype stats: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :keyword gateway_manager_etag: The GatewayManager Etag. + :paramtype gateway_manager_etag: str + :keyword route_filter: The reference to the RouteFilter resource. + :paramtype route_filter: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword ipv6_peering_config: The IPv6 peering configuration. + :paramtype ipv6_peering_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6ExpressRouteCircuitPeeringConfig + :keyword express_route_connection: The ExpressRoute connection. + :paramtype express_route_connection: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnectionId + :keyword connections: The list of circuit connections associated with Azure Private Peering for + this circuit. + :paramtype connections: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.peering_type = peering_type + self.state = state + self.azure_asn = azure_asn + self.peer_asn = peer_asn + self.primary_peer_address_prefix = primary_peer_address_prefix + self.secondary_peer_address_prefix = secondary_peer_address_prefix + self.primary_azure_port = primary_azure_port + self.secondary_azure_port = secondary_azure_port + self.shared_key = shared_key + self.vlan_id = vlan_id + self.microsoft_peering_config = microsoft_peering_config + self.stats = stats + self.provisioning_state = None + self.gateway_manager_etag = gateway_manager_etag + self.last_modified_by = None + self.route_filter = route_filter + self.ipv6_peering_config = ipv6_peering_config + self.express_route_connection = express_route_connection + self.connections = connections + self.peered_connections = None + + +class ExpressRouteCircuitPeeringConfig(_serialization.Model): + """Specifies the peering configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar advertised_public_prefixes: The reference to AdvertisedPublicPrefixes. + :vartype advertised_public_prefixes: list[str] + :ivar advertised_communities: The communities of bgp peering. Specified for microsoft peering. + :vartype advertised_communities: list[str] + :ivar advertised_public_prefixes_state: The advertised public prefix state of the Peering + resource. Known values are: "NotConfigured", "Configuring", "Configured", and + "ValidationNeeded". + :vartype advertised_public_prefixes_state: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringAdvertisedPublicPrefixState + :ivar legacy_mode: The legacy mode of the peering. + :vartype legacy_mode: int + :ivar customer_asn: The CustomerASN of the peering. + :vartype customer_asn: int + :ivar routing_registry_name: The RoutingRegistryName of the configuration. + :vartype routing_registry_name: str + """ + + _validation = { + "advertised_public_prefixes_state": {"readonly": True}, + } + + _attribute_map = { + "advertised_public_prefixes": {"key": "advertisedPublicPrefixes", "type": "[str]"}, + "advertised_communities": {"key": "advertisedCommunities", "type": "[str]"}, + "advertised_public_prefixes_state": {"key": "advertisedPublicPrefixesState", "type": "str"}, + "legacy_mode": {"key": "legacyMode", "type": "int"}, + "customer_asn": {"key": "customerASN", "type": "int"}, + "routing_registry_name": {"key": "routingRegistryName", "type": "str"}, + } + + def __init__( + self, + *, + advertised_public_prefixes: Optional[List[str]] = None, + advertised_communities: Optional[List[str]] = None, + legacy_mode: Optional[int] = None, + customer_asn: Optional[int] = None, + routing_registry_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword advertised_public_prefixes: The reference to AdvertisedPublicPrefixes. + :paramtype advertised_public_prefixes: list[str] + :keyword advertised_communities: The communities of bgp peering. Specified for microsoft + peering. + :paramtype advertised_communities: list[str] + :keyword legacy_mode: The legacy mode of the peering. + :paramtype legacy_mode: int + :keyword customer_asn: The CustomerASN of the peering. + :paramtype customer_asn: int + :keyword routing_registry_name: The RoutingRegistryName of the configuration. + :paramtype routing_registry_name: str + """ + super().__init__(**kwargs) + self.advertised_public_prefixes = advertised_public_prefixes + self.advertised_communities = advertised_communities + self.advertised_public_prefixes_state = None + self.legacy_mode = legacy_mode + self.customer_asn = customer_asn + self.routing_registry_name = routing_registry_name + + +class ExpressRouteCircuitPeeringId(_serialization.Model): + """ExpressRoute circuit peering identifier. + + :ivar id: The ID of the ExpressRoute circuit peering. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The ID of the ExpressRoute circuit peering. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ExpressRouteCircuitPeeringListResult(_serialization.Model): + """Response for ListPeering API service call retrieves all peerings that belong to an + ExpressRouteCircuit. + + :ivar value: The peerings in an express route circuit. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitPeering]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitPeering"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The peerings in an express route circuit. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitReference(_serialization.Model): + """Reference to an express route circuit. + + :ivar id: Corresponding Express Route Circuit Id. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Corresponding Express Route Circuit Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ExpressRouteCircuitRoutesTable(_serialization.Model): + """The routes table associated with the ExpressRouteCircuit. + + :ivar network: IP address of a network entity. + :vartype network: str + :ivar next_hop: NextHop address. + :vartype next_hop: str + :ivar loc_prf: Local preference value as set with the set local-preference route-map + configuration command. + :vartype loc_prf: str + :ivar weight: Route Weight. + :vartype weight: int + :ivar path: Autonomous system paths to the destination network. + :vartype path: str + """ + + _attribute_map = { + "network": {"key": "network", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "str"}, + "loc_prf": {"key": "locPrf", "type": "str"}, + "weight": {"key": "weight", "type": "int"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__( + self, + *, + network: Optional[str] = None, + next_hop: Optional[str] = None, + loc_prf: Optional[str] = None, + weight: Optional[int] = None, + path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword network: IP address of a network entity. + :paramtype network: str + :keyword next_hop: NextHop address. + :paramtype next_hop: str + :keyword loc_prf: Local preference value as set with the set local-preference route-map + configuration command. + :paramtype loc_prf: str + :keyword weight: Route Weight. + :paramtype weight: int + :keyword path: Autonomous system paths to the destination network. + :paramtype path: str + """ + super().__init__(**kwargs) + self.network = network + self.next_hop = next_hop + self.loc_prf = loc_prf + self.weight = weight + self.path = path + + +class ExpressRouteCircuitRoutesTableSummary(_serialization.Model): + """The routes table associated with the ExpressRouteCircuit. + + :ivar neighbor: IP address of the neighbor. + :vartype neighbor: str + :ivar v: BGP version number spoken to the neighbor. + :vartype v: int + :ivar as_property: Autonomous system number. + :vartype as_property: int + :ivar up_down: The length of time that the BGP session has been in the Established state, or + the current status if not in the Established state. + :vartype up_down: str + :ivar state_pfx_rcd: Current state of the BGP session, and the number of prefixes that have + been received from a neighbor or peer group. + :vartype state_pfx_rcd: str + """ + + _attribute_map = { + "neighbor": {"key": "neighbor", "type": "str"}, + "v": {"key": "v", "type": "int"}, + "as_property": {"key": "as", "type": "int"}, + "up_down": {"key": "upDown", "type": "str"}, + "state_pfx_rcd": {"key": "statePfxRcd", "type": "str"}, + } + + def __init__( + self, + *, + neighbor: Optional[str] = None, + v: Optional[int] = None, + as_property: Optional[int] = None, + up_down: Optional[str] = None, + state_pfx_rcd: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword neighbor: IP address of the neighbor. + :paramtype neighbor: str + :keyword v: BGP version number spoken to the neighbor. + :paramtype v: int + :keyword as_property: Autonomous system number. + :paramtype as_property: int + :keyword up_down: The length of time that the BGP session has been in the Established state, or + the current status if not in the Established state. + :paramtype up_down: str + :keyword state_pfx_rcd: Current state of the BGP session, and the number of prefixes that have + been received from a neighbor or peer group. + :paramtype state_pfx_rcd: str + """ + super().__init__(**kwargs) + self.neighbor = neighbor + self.v = v + self.as_property = as_property + self.up_down = up_down + self.state_pfx_rcd = state_pfx_rcd + + +class ExpressRouteCircuitsArpTableListResult(_serialization.Model): + """Response for ListArpTable associated with the Express Route Circuits API. + + :ivar value: A list of the ARP tables. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitArpTable] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitArpTable]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitArpTable"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of the ARP tables. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitArpTable] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitServiceProviderProperties(_serialization.Model): + """Contains ServiceProviderProperties in an ExpressRouteCircuit. + + :ivar service_provider_name: The serviceProviderName. + :vartype service_provider_name: str + :ivar peering_location: The peering location. + :vartype peering_location: str + :ivar bandwidth_in_mbps: The BandwidthInMbps. + :vartype bandwidth_in_mbps: int + """ + + _attribute_map = { + "service_provider_name": {"key": "serviceProviderName", "type": "str"}, + "peering_location": {"key": "peeringLocation", "type": "str"}, + "bandwidth_in_mbps": {"key": "bandwidthInMbps", "type": "int"}, + } + + def __init__( + self, + *, + service_provider_name: Optional[str] = None, + peering_location: Optional[str] = None, + bandwidth_in_mbps: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_provider_name: The serviceProviderName. + :paramtype service_provider_name: str + :keyword peering_location: The peering location. + :paramtype peering_location: str + :keyword bandwidth_in_mbps: The BandwidthInMbps. + :paramtype bandwidth_in_mbps: int + """ + super().__init__(**kwargs) + self.service_provider_name = service_provider_name + self.peering_location = peering_location + self.bandwidth_in_mbps = bandwidth_in_mbps + + +class ExpressRouteCircuitSku(_serialization.Model): + """Contains SKU in an ExpressRouteCircuit. + + :ivar name: The name of the SKU. + :vartype name: str + :ivar tier: The tier of the SKU. Known values are: "Standard", "Premium", "Basic", and "Local". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSkuTier + :ivar family: The family of the SKU. Known values are: "UnlimitedData" and "MeteredData". + :vartype family: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSkuFamily + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[Union[str, "_models.ExpressRouteCircuitSkuTier"]] = None, + family: Optional[Union[str, "_models.ExpressRouteCircuitSkuFamily"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the SKU. + :paramtype name: str + :keyword tier: The tier of the SKU. Known values are: "Standard", "Premium", "Basic", and + "Local". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSkuTier + :keyword family: The family of the SKU. Known values are: "UnlimitedData" and "MeteredData". + :paramtype family: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitSkuFamily + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.family = family + + +class ExpressRouteCircuitsRoutesTableListResult(_serialization.Model): + """Response for ListRoutesTable associated with the Express Route Circuits API. + + :ivar value: The list of routes table. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitRoutesTable] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitRoutesTable]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitRoutesTable"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of routes table. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitRoutesTable] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitsRoutesTableSummaryListResult(_serialization.Model): + """Response for ListRoutesTable associated with the Express Route Circuits API. + + :ivar value: A list of the routes table. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitRoutesTableSummary] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCircuitRoutesTableSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteCircuitRoutesTableSummary"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of the routes table. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitRoutesTableSummary] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteCircuitStats(_serialization.Model): + """Contains stats associated with the peering. + + :ivar primarybytes_in: The Primary BytesIn of the peering. + :vartype primarybytes_in: int + :ivar primarybytes_out: The primary BytesOut of the peering. + :vartype primarybytes_out: int + :ivar secondarybytes_in: The secondary BytesIn of the peering. + :vartype secondarybytes_in: int + :ivar secondarybytes_out: The secondary BytesOut of the peering. + :vartype secondarybytes_out: int + """ + + _attribute_map = { + "primarybytes_in": {"key": "primarybytesIn", "type": "int"}, + "primarybytes_out": {"key": "primarybytesOut", "type": "int"}, + "secondarybytes_in": {"key": "secondarybytesIn", "type": "int"}, + "secondarybytes_out": {"key": "secondarybytesOut", "type": "int"}, + } + + def __init__( + self, + *, + primarybytes_in: Optional[int] = None, + primarybytes_out: Optional[int] = None, + secondarybytes_in: Optional[int] = None, + secondarybytes_out: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword primarybytes_in: The Primary BytesIn of the peering. + :paramtype primarybytes_in: int + :keyword primarybytes_out: The primary BytesOut of the peering. + :paramtype primarybytes_out: int + :keyword secondarybytes_in: The secondary BytesIn of the peering. + :paramtype secondarybytes_in: int + :keyword secondarybytes_out: The secondary BytesOut of the peering. + :paramtype secondarybytes_out: int + """ + super().__init__(**kwargs) + self.primarybytes_in = primarybytes_in + self.primarybytes_out = primarybytes_out + self.secondarybytes_in = secondarybytes_in + self.secondarybytes_out = secondarybytes_out + + +class ExpressRouteConnection(SubResource): + """ExpressRouteConnection 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: Resource ID. + :vartype id: str + :ivar name: The name of the resource. Required. + :vartype name: str + :ivar provisioning_state: The provisioning state of the express route connection resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar express_route_circuit_peering: The ExpressRoute circuit peering. + :vartype express_route_circuit_peering: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringId + :ivar authorization_key: Authorization key to establish the connection. + :vartype authorization_key: str + :ivar routing_weight: The routing weight associated to the connection. + :vartype routing_weight: int + :ivar enable_internet_security: Enable internet security. + :vartype enable_internet_security: bool + :ivar express_route_gateway_bypass: Enable FastPath to vWan Firewall hub. + :vartype express_route_gateway_bypass: bool + :ivar enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :vartype enable_private_link_fast_path: bool + :ivar routing_configuration: The Routing Configuration indicating the associated and propagated + route tables on this connection. + :vartype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + + _validation = { + "name": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "express_route_circuit_peering": { + "key": "properties.expressRouteCircuitPeering", + "type": "ExpressRouteCircuitPeeringId", + }, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "routing_weight": {"key": "properties.routingWeight", "type": "int"}, + "enable_internet_security": {"key": "properties.enableInternetSecurity", "type": "bool"}, + "express_route_gateway_bypass": {"key": "properties.expressRouteGatewayBypass", "type": "bool"}, + "enable_private_link_fast_path": {"key": "properties.enablePrivateLinkFastPath", "type": "bool"}, + "routing_configuration": {"key": "properties.routingConfiguration", "type": "RoutingConfiguration"}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + express_route_circuit_peering: Optional["_models.ExpressRouteCircuitPeeringId"] = None, + authorization_key: Optional[str] = None, + routing_weight: Optional[int] = None, + enable_internet_security: Optional[bool] = None, + express_route_gateway_bypass: Optional[bool] = None, + enable_private_link_fast_path: Optional[bool] = None, + routing_configuration: Optional["_models.RoutingConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource. Required. + :paramtype name: str + :keyword express_route_circuit_peering: The ExpressRoute circuit peering. + :paramtype express_route_circuit_peering: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringId + :keyword authorization_key: Authorization key to establish the connection. + :paramtype authorization_key: str + :keyword routing_weight: The routing weight associated to the connection. + :paramtype routing_weight: int + :keyword enable_internet_security: Enable internet security. + :paramtype enable_internet_security: bool + :keyword express_route_gateway_bypass: Enable FastPath to vWan Firewall hub. + :paramtype express_route_gateway_bypass: bool + :keyword enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :paramtype enable_private_link_fast_path: bool + :keyword routing_configuration: The Routing Configuration indicating the associated and + propagated route tables on this connection. + :paramtype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + super().__init__(id=id, **kwargs) + self.name = name + self.provisioning_state = None + self.express_route_circuit_peering = express_route_circuit_peering + self.authorization_key = authorization_key + self.routing_weight = routing_weight + self.enable_internet_security = enable_internet_security + self.express_route_gateway_bypass = express_route_gateway_bypass + self.enable_private_link_fast_path = enable_private_link_fast_path + self.routing_configuration = routing_configuration + + +class ExpressRouteConnectionId(_serialization.Model): + """The ID of the ExpressRouteConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the ExpressRouteConnection. + :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 ExpressRouteConnectionList(_serialization.Model): + """ExpressRouteConnection list. + + :ivar value: The list of ExpressRoute connections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteConnection]"}, + } + + def __init__(self, *, value: Optional[List["_models.ExpressRouteConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of ExpressRoute connections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + """ + super().__init__(**kwargs) + self.value = value + + +class ExpressRouteCrossConnection(Resource): # pylint: disable=too-many-instance-attributes + """ExpressRouteCrossConnection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar primary_azure_port: The name of the primary port. + :vartype primary_azure_port: str + :ivar secondary_azure_port: The name of the secondary port. + :vartype secondary_azure_port: str + :ivar s_tag: The identifier of the circuit traffic. + :vartype s_tag: int + :ivar peering_location: The peering location of the ExpressRoute circuit. + :vartype peering_location: str + :ivar bandwidth_in_mbps: The circuit bandwidth In Mbps. + :vartype bandwidth_in_mbps: int + :ivar express_route_circuit: The ExpressRouteCircuit. + :vartype express_route_circuit: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitReference + :ivar service_provider_provisioning_state: The provisioning state of the circuit in the + connectivity provider system. Known values are: "NotProvisioned", "Provisioning", + "Provisioned", and "Deprovisioning". + :vartype service_provider_provisioning_state: str or + ~azure.mgmt.network.v2023_09_01.models.ServiceProviderProvisioningState + :ivar service_provider_notes: Additional read only notes set by the connectivity provider. + :vartype service_provider_notes: str + :ivar provisioning_state: The provisioning state of the express route cross connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar peerings: The list of peerings. + :vartype peerings: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "primary_azure_port": {"readonly": True}, + "secondary_azure_port": {"readonly": True}, + "s_tag": {"readonly": True}, + "peering_location": {"readonly": True}, + "bandwidth_in_mbps": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "primary_azure_port": {"key": "properties.primaryAzurePort", "type": "str"}, + "secondary_azure_port": {"key": "properties.secondaryAzurePort", "type": "str"}, + "s_tag": {"key": "properties.sTag", "type": "int"}, + "peering_location": {"key": "properties.peeringLocation", "type": "str"}, + "bandwidth_in_mbps": {"key": "properties.bandwidthInMbps", "type": "int"}, + "express_route_circuit": {"key": "properties.expressRouteCircuit", "type": "ExpressRouteCircuitReference"}, + "service_provider_provisioning_state": {"key": "properties.serviceProviderProvisioningState", "type": "str"}, + "service_provider_notes": {"key": "properties.serviceProviderNotes", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "peerings": {"key": "properties.peerings", "type": "[ExpressRouteCrossConnectionPeering]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + express_route_circuit: Optional["_models.ExpressRouteCircuitReference"] = None, + service_provider_provisioning_state: Optional[Union[str, "_models.ServiceProviderProvisioningState"]] = None, + service_provider_notes: Optional[str] = None, + peerings: Optional[List["_models.ExpressRouteCrossConnectionPeering"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword express_route_circuit: The ExpressRouteCircuit. + :paramtype express_route_circuit: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitReference + :keyword service_provider_provisioning_state: The provisioning state of the circuit in the + connectivity provider system. Known values are: "NotProvisioned", "Provisioning", + "Provisioned", and "Deprovisioning". + :paramtype service_provider_provisioning_state: str or + ~azure.mgmt.network.v2023_09_01.models.ServiceProviderProvisioningState + :keyword service_provider_notes: Additional read only notes set by the connectivity provider. + :paramtype service_provider_notes: str + :keyword peerings: The list of peerings. + :paramtype peerings: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.primary_azure_port = None + self.secondary_azure_port = None + self.s_tag = None + self.peering_location = None + self.bandwidth_in_mbps = None + self.express_route_circuit = express_route_circuit + self.service_provider_provisioning_state = service_provider_provisioning_state + self.service_provider_notes = service_provider_notes + self.provisioning_state = None + self.peerings = peerings + + +class ExpressRouteCrossConnectionListResult(_serialization.Model): + """Response for ListExpressRouteCrossConnection API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of ExpressRouteCrossConnection resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCrossConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ExpressRouteCrossConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of ExpressRouteCrossConnection resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ExpressRouteCrossConnectionPeering(SubResource): # pylint: disable=too-many-instance-attributes + """Peering in an ExpressRoute Cross Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar peering_type: The peering type. Known values are: "AzurePublicPeering", + "AzurePrivatePeering", and "MicrosoftPeering". + :vartype peering_type: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringType + :ivar state: The peering state. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringState + :ivar azure_asn: The Azure ASN. + :vartype azure_asn: int + :ivar peer_asn: The peer ASN. + :vartype peer_asn: int + :ivar primary_peer_address_prefix: The primary address prefix. + :vartype primary_peer_address_prefix: str + :ivar secondary_peer_address_prefix: The secondary address prefix. + :vartype secondary_peer_address_prefix: str + :ivar primary_azure_port: The primary port. + :vartype primary_azure_port: str + :ivar secondary_azure_port: The secondary port. + :vartype secondary_azure_port: str + :ivar shared_key: The shared key. + :vartype shared_key: str + :ivar vlan_id: The VLAN ID. + :vartype vlan_id: int + :ivar microsoft_peering_config: The Microsoft peering configuration. + :vartype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :ivar provisioning_state: The provisioning state of the express route cross connection peering + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar gateway_manager_etag: The GatewayManager Etag. + :vartype gateway_manager_etag: str + :ivar last_modified_by: Who was the last to modify the peering. + :vartype last_modified_by: str + :ivar ipv6_peering_config: The IPv6 peering configuration. + :vartype ipv6_peering_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6ExpressRouteCircuitPeeringConfig + """ + + _validation = { + "etag": {"readonly": True}, + "azure_asn": {"readonly": True}, + "peer_asn": {"maximum": 4294967295, "minimum": 1}, + "primary_azure_port": {"readonly": True}, + "secondary_azure_port": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "last_modified_by": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "peering_type": {"key": "properties.peeringType", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "azure_asn": {"key": "properties.azureASN", "type": "int"}, + "peer_asn": {"key": "properties.peerASN", "type": "int"}, + "primary_peer_address_prefix": {"key": "properties.primaryPeerAddressPrefix", "type": "str"}, + "secondary_peer_address_prefix": {"key": "properties.secondaryPeerAddressPrefix", "type": "str"}, + "primary_azure_port": {"key": "properties.primaryAzurePort", "type": "str"}, + "secondary_azure_port": {"key": "properties.secondaryAzurePort", "type": "str"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "vlan_id": {"key": "properties.vlanId", "type": "int"}, + "microsoft_peering_config": { + "key": "properties.microsoftPeeringConfig", + "type": "ExpressRouteCircuitPeeringConfig", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "gateway_manager_etag": {"key": "properties.gatewayManagerEtag", "type": "str"}, + "last_modified_by": {"key": "properties.lastModifiedBy", "type": "str"}, + "ipv6_peering_config": {"key": "properties.ipv6PeeringConfig", "type": "Ipv6ExpressRouteCircuitPeeringConfig"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + peering_type: Optional[Union[str, "_models.ExpressRoutePeeringType"]] = None, + state: Optional[Union[str, "_models.ExpressRoutePeeringState"]] = None, + peer_asn: Optional[int] = None, + primary_peer_address_prefix: Optional[str] = None, + secondary_peer_address_prefix: Optional[str] = None, + shared_key: Optional[str] = None, + vlan_id: Optional[int] = None, + microsoft_peering_config: Optional["_models.ExpressRouteCircuitPeeringConfig"] = None, + gateway_manager_etag: Optional[str] = None, + ipv6_peering_config: Optional["_models.Ipv6ExpressRouteCircuitPeeringConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword peering_type: The peering type. Known values are: "AzurePublicPeering", + "AzurePrivatePeering", and "MicrosoftPeering". + :paramtype peering_type: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringType + :keyword state: The peering state. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePeeringState + :keyword peer_asn: The peer ASN. + :paramtype peer_asn: int + :keyword primary_peer_address_prefix: The primary address prefix. + :paramtype primary_peer_address_prefix: str + :keyword secondary_peer_address_prefix: The secondary address prefix. + :paramtype secondary_peer_address_prefix: str + :keyword shared_key: The shared key. + :paramtype shared_key: str + :keyword vlan_id: The VLAN ID. + :paramtype vlan_id: int + :keyword microsoft_peering_config: The Microsoft peering configuration. + :paramtype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :keyword gateway_manager_etag: The GatewayManager Etag. + :paramtype gateway_manager_etag: str + :keyword ipv6_peering_config: The IPv6 peering configuration. + :paramtype ipv6_peering_config: + ~azure.mgmt.network.v2023_09_01.models.Ipv6ExpressRouteCircuitPeeringConfig + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.peering_type = peering_type + self.state = state + self.azure_asn = None + self.peer_asn = peer_asn + self.primary_peer_address_prefix = primary_peer_address_prefix + self.secondary_peer_address_prefix = secondary_peer_address_prefix + self.primary_azure_port = None + self.secondary_azure_port = None + self.shared_key = shared_key + self.vlan_id = vlan_id + self.microsoft_peering_config = microsoft_peering_config + self.provisioning_state = None + self.gateway_manager_etag = gateway_manager_etag + self.last_modified_by = None + self.ipv6_peering_config = ipv6_peering_config + + +class ExpressRouteCrossConnectionPeeringList(_serialization.Model): + """Response for ListPeering API service call retrieves all peerings that belong to an + ExpressRouteCrossConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The peerings in an express route cross connection. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCrossConnectionPeering]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ExpressRouteCrossConnectionPeering"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The peerings in an express route cross connection. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ExpressRouteCrossConnectionRoutesTableSummary(_serialization.Model): + """The routes table associated with the ExpressRouteCircuit. + + :ivar neighbor: IP address of Neighbor router. + :vartype neighbor: str + :ivar asn: Autonomous system number. + :vartype asn: int + :ivar up_down: The length of time that the BGP session has been in the Established state, or + the current status if not in the Established state. + :vartype up_down: str + :ivar state_or_prefixes_received: Current state of the BGP session, and the number of prefixes + that have been received from a neighbor or peer group. + :vartype state_or_prefixes_received: str + """ + + _attribute_map = { + "neighbor": {"key": "neighbor", "type": "str"}, + "asn": {"key": "asn", "type": "int"}, + "up_down": {"key": "upDown", "type": "str"}, + "state_or_prefixes_received": {"key": "stateOrPrefixesReceived", "type": "str"}, + } + + def __init__( + self, + *, + neighbor: Optional[str] = None, + asn: Optional[int] = None, + up_down: Optional[str] = None, + state_or_prefixes_received: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword neighbor: IP address of Neighbor router. + :paramtype neighbor: str + :keyword asn: Autonomous system number. + :paramtype asn: int + :keyword up_down: The length of time that the BGP session has been in the Established state, or + the current status if not in the Established state. + :paramtype up_down: str + :keyword state_or_prefixes_received: Current state of the BGP session, and the number of + prefixes that have been received from a neighbor or peer group. + :paramtype state_or_prefixes_received: str + """ + super().__init__(**kwargs) + self.neighbor = neighbor + self.asn = asn + self.up_down = up_down + self.state_or_prefixes_received = state_or_prefixes_received + + +class ExpressRouteCrossConnectionsRoutesTableSummaryListResult(_serialization.Model): + """Response for ListRoutesTable associated with the Express Route Cross Connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of the routes table. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionRoutesTableSummary] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteCrossConnectionRoutesTableSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ExpressRouteCrossConnectionRoutesTableSummary"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of the routes table. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionRoutesTableSummary] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ExpressRouteGateway(Resource): # pylint: disable=too-many-instance-attributes + """ExpressRoute gateway resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar auto_scale_configuration: Configuration for auto scaling. + :vartype auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayPropertiesAutoScaleConfiguration + :ivar express_route_connections: List of ExpressRoute connections to the ExpressRoute gateway. + :vartype express_route_connections: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :ivar provisioning_state: The provisioning state of the express route gateway resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar virtual_hub: The Virtual Hub where the ExpressRoute gateway is or will be deployed. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.VirtualHubId + :ivar allow_non_virtual_wan_traffic: Configures this gateway to accept traffic from non Virtual + WAN networks. + :vartype allow_non_virtual_wan_traffic: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "auto_scale_configuration": { + "key": "properties.autoScaleConfiguration", + "type": "ExpressRouteGatewayPropertiesAutoScaleConfiguration", + }, + "express_route_connections": {"key": "properties.expressRouteConnections", "type": "[ExpressRouteConnection]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "VirtualHubId"}, + "allow_non_virtual_wan_traffic": {"key": "properties.allowNonVirtualWanTraffic", "type": "bool"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + auto_scale_configuration: Optional["_models.ExpressRouteGatewayPropertiesAutoScaleConfiguration"] = None, + express_route_connections: Optional[List["_models.ExpressRouteConnection"]] = None, + virtual_hub: Optional["_models.VirtualHubId"] = None, + allow_non_virtual_wan_traffic: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword auto_scale_configuration: Configuration for auto scaling. + :paramtype auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayPropertiesAutoScaleConfiguration + :keyword express_route_connections: List of ExpressRoute connections to the ExpressRoute + gateway. + :paramtype express_route_connections: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :keyword virtual_hub: The Virtual Hub where the ExpressRoute gateway is or will be deployed. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.VirtualHubId + :keyword allow_non_virtual_wan_traffic: Configures this gateway to accept traffic from non + Virtual WAN networks. + :paramtype allow_non_virtual_wan_traffic: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.auto_scale_configuration = auto_scale_configuration + self.express_route_connections = express_route_connections + self.provisioning_state = None + self.virtual_hub = virtual_hub + self.allow_non_virtual_wan_traffic = allow_non_virtual_wan_traffic + + +class ExpressRouteGatewayList(_serialization.Model): + """List of ExpressRoute gateways. + + :ivar value: List of ExpressRoute gateways. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteGateway]"}, + } + + def __init__(self, *, value: Optional[List["_models.ExpressRouteGateway"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of ExpressRoute gateways. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + """ + super().__init__(**kwargs) + self.value = value + + +class ExpressRouteGatewayPropertiesAutoScaleConfiguration(_serialization.Model): + """Configuration for auto scaling. + + :ivar bounds: Minimum and maximum number of scale units to deploy. + :vartype bounds: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds + """ + + _attribute_map = { + "bounds": {"key": "bounds", "type": "ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds"}, + } + + def __init__( + self, + *, + bounds: Optional["_models.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds"] = None, + **kwargs: Any + ) -> None: + """ + :keyword bounds: Minimum and maximum number of scale units to deploy. + :paramtype bounds: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds + """ + super().__init__(**kwargs) + self.bounds = bounds + + +class ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds(_serialization.Model): + """Minimum and maximum number of scale units to deploy. + + :ivar min: Minimum number of scale units deployed for ExpressRoute gateway. + :vartype min: int + :ivar max: Maximum number of scale units deployed for ExpressRoute gateway. + :vartype max: int + """ + + _attribute_map = { + "min": {"key": "min", "type": "int"}, + "max": {"key": "max", "type": "int"}, + } + + def __init__( + self, + *, + min: Optional[int] = None, # pylint: disable=redefined-builtin + max: Optional[int] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: Minimum number of scale units deployed for ExpressRoute gateway. + :paramtype min: int + :keyword max: Maximum number of scale units deployed for ExpressRoute gateway. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + +class ExpressRouteLink(SubResource): # pylint: disable=too-many-instance-attributes + """ExpressRouteLink child resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of child port resource that is unique among child port resources of the + parent. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar router_name: Name of Azure router associated with physical port. + :vartype router_name: str + :ivar interface_name: Name of Azure router interface. + :vartype interface_name: str + :ivar patch_panel_id: Mapping between physical port to patch panel port. + :vartype patch_panel_id: str + :ivar rack_id: Mapping of physical patch panel to rack. + :vartype rack_id: str + :ivar colo_location: Cololocation for ExpressRoute Hybrid Direct. + :vartype colo_location: str + :ivar connector_type: Physical fiber port type. Known values are: "LC" and "SC". + :vartype connector_type: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkConnectorType + :ivar admin_state: Administrative state of the physical port. Known values are: "Enabled" and + "Disabled". + :vartype admin_state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkAdminState + :ivar provisioning_state: The provisioning state of the express route link resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar mac_sec_config: MacSec configuration. + :vartype mac_sec_config: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecConfig + """ + + _validation = { + "etag": {"readonly": True}, + "router_name": {"readonly": True}, + "interface_name": {"readonly": True}, + "patch_panel_id": {"readonly": True}, + "rack_id": {"readonly": True}, + "colo_location": {"readonly": True}, + "connector_type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "router_name": {"key": "properties.routerName", "type": "str"}, + "interface_name": {"key": "properties.interfaceName", "type": "str"}, + "patch_panel_id": {"key": "properties.patchPanelId", "type": "str"}, + "rack_id": {"key": "properties.rackId", "type": "str"}, + "colo_location": {"key": "properties.coloLocation", "type": "str"}, + "connector_type": {"key": "properties.connectorType", "type": "str"}, + "admin_state": {"key": "properties.adminState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "mac_sec_config": {"key": "properties.macSecConfig", "type": "ExpressRouteLinkMacSecConfig"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + admin_state: Optional[Union[str, "_models.ExpressRouteLinkAdminState"]] = None, + mac_sec_config: Optional["_models.ExpressRouteLinkMacSecConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of child port resource that is unique among child port resources of the + parent. + :paramtype name: str + :keyword admin_state: Administrative state of the physical port. Known values are: "Enabled" + and "Disabled". + :paramtype admin_state: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkAdminState + :keyword mac_sec_config: MacSec configuration. + :paramtype mac_sec_config: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecConfig + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.router_name = None + self.interface_name = None + self.patch_panel_id = None + self.rack_id = None + self.colo_location = None + self.connector_type = None + self.admin_state = admin_state + self.provisioning_state = None + self.mac_sec_config = mac_sec_config + + +class ExpressRouteLinkListResult(_serialization.Model): + """Response for ListExpressRouteLinks API service call. + + :ivar value: The list of ExpressRouteLink sub-resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteLink]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteLink"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of ExpressRouteLink sub-resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteLinkMacSecConfig(_serialization.Model): + """ExpressRouteLink Mac Security Configuration. + + :ivar ckn_secret_identifier: Keyvault Secret Identifier URL containing Mac security CKN key. + :vartype ckn_secret_identifier: str + :ivar cak_secret_identifier: Keyvault Secret Identifier URL containing Mac security CAK key. + :vartype cak_secret_identifier: str + :ivar cipher: Mac security cipher. Known values are: "GcmAes256", "GcmAes128", "GcmAesXpn128", + and "GcmAesXpn256". + :vartype cipher: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecCipher + :ivar sci_state: Sci mode enabled/disabled. Known values are: "Disabled" and "Enabled". + :vartype sci_state: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecSciState + """ + + _attribute_map = { + "ckn_secret_identifier": {"key": "cknSecretIdentifier", "type": "str"}, + "cak_secret_identifier": {"key": "cakSecretIdentifier", "type": "str"}, + "cipher": {"key": "cipher", "type": "str"}, + "sci_state": {"key": "sciState", "type": "str"}, + } + + def __init__( + self, + *, + ckn_secret_identifier: Optional[str] = None, + cak_secret_identifier: Optional[str] = None, + cipher: Optional[Union[str, "_models.ExpressRouteLinkMacSecCipher"]] = None, + sci_state: Optional[Union[str, "_models.ExpressRouteLinkMacSecSciState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword ckn_secret_identifier: Keyvault Secret Identifier URL containing Mac security CKN key. + :paramtype ckn_secret_identifier: str + :keyword cak_secret_identifier: Keyvault Secret Identifier URL containing Mac security CAK key. + :paramtype cak_secret_identifier: str + :keyword cipher: Mac security cipher. Known values are: "GcmAes256", "GcmAes128", + "GcmAesXpn128", and "GcmAesXpn256". + :paramtype cipher: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecCipher + :keyword sci_state: Sci mode enabled/disabled. Known values are: "Disabled" and "Enabled". + :paramtype sci_state: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLinkMacSecSciState + """ + super().__init__(**kwargs) + self.ckn_secret_identifier = ckn_secret_identifier + self.cak_secret_identifier = cak_secret_identifier + self.cipher = cipher + self.sci_state = sci_state + + +class ExpressRoutePort(Resource): # pylint: disable=too-many-instance-attributes + """ExpressRoutePort resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar identity: The identity of ExpressRoutePort, if configured. + :vartype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :ivar peering_location: The name of the peering location that the ExpressRoutePort is mapped to + physically. + :vartype peering_location: str + :ivar bandwidth_in_gbps: Bandwidth of procured ports in Gbps. + :vartype bandwidth_in_gbps: int + :ivar provisioned_bandwidth_in_gbps: Aggregate Gbps of associated circuit bandwidths. + :vartype provisioned_bandwidth_in_gbps: float + :ivar mtu: Maximum transmission unit of the physical port pair(s). + :vartype mtu: str + :ivar encapsulation: Encapsulation method on physical ports. Known values are: "Dot1Q" and + "QinQ". + :vartype encapsulation: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsEncapsulation + :ivar ether_type: Ether type of the physical port. + :vartype ether_type: str + :ivar allocation_date: Date of the physical port allocation to be used in Letter of + Authorization. + :vartype allocation_date: str + :ivar links: The set of physical links of the ExpressRoutePort resource. + :vartype links: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :ivar circuits: Reference the ExpressRoute circuit(s) that are provisioned on this + ExpressRoutePort resource. + :vartype circuits: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the express route port resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: The resource GUID property of the express route port resource. + :vartype resource_guid: str + :ivar billing_type: The billing type of the ExpressRoutePort resource. Known values are: + "MeteredData" and "UnlimitedData". + :vartype billing_type: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsBillingType + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioned_bandwidth_in_gbps": {"readonly": True}, + "mtu": {"readonly": True}, + "ether_type": {"readonly": True}, + "allocation_date": {"readonly": True}, + "circuits": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "peering_location": {"key": "properties.peeringLocation", "type": "str"}, + "bandwidth_in_gbps": {"key": "properties.bandwidthInGbps", "type": "int"}, + "provisioned_bandwidth_in_gbps": {"key": "properties.provisionedBandwidthInGbps", "type": "float"}, + "mtu": {"key": "properties.mtu", "type": "str"}, + "encapsulation": {"key": "properties.encapsulation", "type": "str"}, + "ether_type": {"key": "properties.etherType", "type": "str"}, + "allocation_date": {"key": "properties.allocationDate", "type": "str"}, + "links": {"key": "properties.links", "type": "[ExpressRouteLink]"}, + "circuits": {"key": "properties.circuits", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "billing_type": {"key": "properties.billingType", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + peering_location: Optional[str] = None, + bandwidth_in_gbps: Optional[int] = None, + encapsulation: Optional[Union[str, "_models.ExpressRoutePortsEncapsulation"]] = None, + links: Optional[List["_models.ExpressRouteLink"]] = None, + billing_type: Optional[Union[str, "_models.ExpressRoutePortsBillingType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identity of ExpressRoutePort, if configured. + :paramtype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :keyword peering_location: The name of the peering location that the ExpressRoutePort is mapped + to physically. + :paramtype peering_location: str + :keyword bandwidth_in_gbps: Bandwidth of procured ports in Gbps. + :paramtype bandwidth_in_gbps: int + :keyword encapsulation: Encapsulation method on physical ports. Known values are: "Dot1Q" and + "QinQ". + :paramtype encapsulation: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsEncapsulation + :keyword links: The set of physical links of the ExpressRoutePort resource. + :paramtype links: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :keyword billing_type: The billing type of the ExpressRoutePort resource. Known values are: + "MeteredData" and "UnlimitedData". + :paramtype billing_type: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsBillingType + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.identity = identity + self.peering_location = peering_location + self.bandwidth_in_gbps = bandwidth_in_gbps + self.provisioned_bandwidth_in_gbps = None + self.mtu = None + self.encapsulation = encapsulation + self.ether_type = None + self.allocation_date = None + self.links = links + self.circuits = None + self.provisioning_state = None + self.resource_guid = None + self.billing_type = billing_type + + +class ExpressRoutePortAuthorization(SubResource): + """ExpressRoutePort Authorization resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar authorization_key: The authorization key. + :vartype authorization_key: str + :ivar authorization_use_status: The authorization use status. Known values are: "Available" and + "InUse". + :vartype authorization_use_status: str or + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorizationUseStatus + :ivar circuit_resource_uri: The reference to the ExpressRoute circuit resource using the + authorization. + :vartype circuit_resource_uri: str + :ivar provisioning_state: The provisioning state of the authorization resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "authorization_key": {"readonly": True}, + "authorization_use_status": {"readonly": True}, + "circuit_resource_uri": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "authorization_use_status": {"key": "properties.authorizationUseStatus", "type": "str"}, + "circuit_resource_uri": {"key": "properties.circuitResourceUri", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.authorization_key = None + self.authorization_use_status = None + self.circuit_resource_uri = None + self.provisioning_state = None + + +class ExpressRoutePortAuthorizationListResult(_serialization.Model): + """Response for ListExpressRoutePortAuthorizations API service call. + + :ivar value: The authorizations in an ExpressRoute Port. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRoutePortAuthorization]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRoutePortAuthorization"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The authorizations in an ExpressRoute Port. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRoutePortListResult(_serialization.Model): + """Response for ListExpressRoutePorts API service call. + + :ivar value: A list of ExpressRoutePort resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRoutePort]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRoutePort"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of ExpressRoutePort resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRoutePortsLocation(Resource): + """Definition of the ExpressRoutePorts peering location resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar address: Address of peering location. + :vartype address: str + :ivar contact: Contact details of peering locations. + :vartype contact: str + :ivar available_bandwidths: The inventory of available ExpressRoutePort bandwidths. + :vartype available_bandwidths: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocationBandwidths] + :ivar provisioning_state: The provisioning state of the express route port location resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "address": {"readonly": True}, + "contact": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "address": {"key": "properties.address", "type": "str"}, + "contact": {"key": "properties.contact", "type": "str"}, + "available_bandwidths": { + "key": "properties.availableBandwidths", + "type": "[ExpressRoutePortsLocationBandwidths]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + available_bandwidths: Optional[List["_models.ExpressRoutePortsLocationBandwidths"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword available_bandwidths: The inventory of available ExpressRoutePort bandwidths. + :paramtype available_bandwidths: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocationBandwidths] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.address = None + self.contact = None + self.available_bandwidths = available_bandwidths + self.provisioning_state = None + + +class ExpressRoutePortsLocationBandwidths(_serialization.Model): + """Real-time inventory of available ExpressRoute port bandwidths. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar offer_name: Bandwidth descriptive name. + :vartype offer_name: str + :ivar value_in_gbps: Bandwidth value in Gbps. + :vartype value_in_gbps: int + """ + + _validation = { + "offer_name": {"readonly": True}, + "value_in_gbps": {"readonly": True}, + } + + _attribute_map = { + "offer_name": {"key": "offerName", "type": "str"}, + "value_in_gbps": {"key": "valueInGbps", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.offer_name = None + self.value_in_gbps = None + + +class ExpressRoutePortsLocationListResult(_serialization.Model): + """Response for ListExpressRoutePortsLocations API service call. + + :ivar value: The list of all ExpressRoutePort peering locations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRoutePortsLocation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRoutePortsLocation"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of all ExpressRoutePort peering locations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpressRouteProviderPort(Resource): # pylint: disable=too-many-instance-attributes + """ExpressRouteProviderPort resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar port_pair_descriptor: The name of the port pair. + :vartype port_pair_descriptor: str + :ivar primary_azure_port: The name of the primary port. + :vartype primary_azure_port: str + :ivar secondary_azure_port: The name of the secondary port. + :vartype secondary_azure_port: str + :ivar peering_location: The peering location of the port pair. + :vartype peering_location: str + :ivar overprovision_factor: Overprovisioning factor for the port pair. + :vartype overprovision_factor: int + :ivar port_bandwidth_in_mbps: Bandwidth of the port in Mbps. + :vartype port_bandwidth_in_mbps: int + :ivar used_bandwidth_in_mbps: Used Bandwidth of the port in Mbps. + :vartype used_bandwidth_in_mbps: int + :ivar remaining_bandwidth_in_mbps: Remaining Bandwidth of the port in Mbps. + :vartype remaining_bandwidth_in_mbps: int + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "port_pair_descriptor": {"readonly": True}, + "primary_azure_port": {"readonly": True}, + "secondary_azure_port": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "port_pair_descriptor": {"key": "properties.portPairDescriptor", "type": "str"}, + "primary_azure_port": {"key": "properties.primaryAzurePort", "type": "str"}, + "secondary_azure_port": {"key": "properties.secondaryAzurePort", "type": "str"}, + "peering_location": {"key": "properties.peeringLocation", "type": "str"}, + "overprovision_factor": {"key": "properties.overprovisionFactor", "type": "int"}, + "port_bandwidth_in_mbps": {"key": "properties.portBandwidthInMbps", "type": "int"}, + "used_bandwidth_in_mbps": {"key": "properties.usedBandwidthInMbps", "type": "int"}, + "remaining_bandwidth_in_mbps": {"key": "properties.remainingBandwidthInMbps", "type": "int"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + peering_location: Optional[str] = None, + overprovision_factor: Optional[int] = None, + port_bandwidth_in_mbps: Optional[int] = None, + used_bandwidth_in_mbps: Optional[int] = None, + remaining_bandwidth_in_mbps: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword peering_location: The peering location of the port pair. + :paramtype peering_location: str + :keyword overprovision_factor: Overprovisioning factor for the port pair. + :paramtype overprovision_factor: int + :keyword port_bandwidth_in_mbps: Bandwidth of the port in Mbps. + :paramtype port_bandwidth_in_mbps: int + :keyword used_bandwidth_in_mbps: Used Bandwidth of the port in Mbps. + :paramtype used_bandwidth_in_mbps: int + :keyword remaining_bandwidth_in_mbps: Remaining Bandwidth of the port in Mbps. + :paramtype remaining_bandwidth_in_mbps: int + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.port_pair_descriptor = None + self.primary_azure_port = None + self.secondary_azure_port = None + self.peering_location = peering_location + self.overprovision_factor = overprovision_factor + self.port_bandwidth_in_mbps = port_bandwidth_in_mbps + self.used_bandwidth_in_mbps = used_bandwidth_in_mbps + self.remaining_bandwidth_in_mbps = remaining_bandwidth_in_mbps + + +class ExpressRouteProviderPortListResult(_serialization.Model): + """Response for ListExpressRouteProviderPort API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of ExpressRouteProviderPort resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteProviderPort]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ExpressRouteProviderPort"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of ExpressRouteProviderPort resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ExpressRouteServiceProvider(Resource): + """A ExpressRouteResourceProvider object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar peering_locations: A list of peering locations. + :vartype peering_locations: list[str] + :ivar bandwidths_offered: A list of bandwidths offered. + :vartype bandwidths_offered: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProviderBandwidthsOffered] + :ivar provisioning_state: The provisioning state of the express route service provider + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "peering_locations": {"key": "properties.peeringLocations", "type": "[str]"}, + "bandwidths_offered": { + "key": "properties.bandwidthsOffered", + "type": "[ExpressRouteServiceProviderBandwidthsOffered]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + peering_locations: Optional[List[str]] = None, + bandwidths_offered: Optional[List["_models.ExpressRouteServiceProviderBandwidthsOffered"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword peering_locations: A list of peering locations. + :paramtype peering_locations: list[str] + :keyword bandwidths_offered: A list of bandwidths offered. + :paramtype bandwidths_offered: + list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProviderBandwidthsOffered] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.peering_locations = peering_locations + self.bandwidths_offered = bandwidths_offered + self.provisioning_state = None + + +class ExpressRouteServiceProviderBandwidthsOffered(_serialization.Model): + """Contains bandwidths offered in ExpressRouteServiceProvider resources. + + :ivar offer_name: The OfferName. + :vartype offer_name: str + :ivar value_in_mbps: The ValueInMbps. + :vartype value_in_mbps: int + """ + + _attribute_map = { + "offer_name": {"key": "offerName", "type": "str"}, + "value_in_mbps": {"key": "valueInMbps", "type": "int"}, + } + + def __init__(self, *, offer_name: Optional[str] = None, value_in_mbps: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword offer_name: The OfferName. + :paramtype offer_name: str + :keyword value_in_mbps: The ValueInMbps. + :paramtype value_in_mbps: int + """ + super().__init__(**kwargs) + self.offer_name = offer_name + self.value_in_mbps = value_in_mbps + + +class ExpressRouteServiceProviderListResult(_serialization.Model): + """Response for the ListExpressRouteServiceProvider API service call. + + :ivar value: A list of ExpressRouteResourceProvider resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProvider] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ExpressRouteServiceProvider]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ExpressRouteServiceProvider"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of ExpressRouteResourceProvider resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProvider] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExtendedLocation(_serialization.Model): + """ExtendedLocation complex type. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class FilterItems(_serialization.Model): + """Will contain the filter name and values to operate on. + + :ivar field: The name of the field we would like to filter. + :vartype field: str + :ivar values: List of values to filter the current field by. + :vartype values: list[str] + """ + + _attribute_map = { + "field": {"key": "field", "type": "str"}, + "values": {"key": "values", "type": "[str]"}, + } + + def __init__(self, *, field: Optional[str] = None, values: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword field: The name of the field we would like to filter. + :paramtype field: str + :keyword values: List of values to filter the current field by. + :paramtype values: list[str] + """ + super().__init__(**kwargs) + self.field = field + self.values = values + + +class FirewallPacketCaptureParameters(SubResource): + """Azure Firewall Packet Capture Parameters resource. + + :ivar id: Resource ID. + :vartype id: str + :ivar duration_in_seconds: Duration of packet capture in seconds. + :vartype duration_in_seconds: int + :ivar number_of_packets_to_capture: Number of packets to be captured. + :vartype number_of_packets_to_capture: int + :ivar sas_url: Upload capture location. + :vartype sas_url: str + :ivar file_name: Name of file to be uploaded to sasURL. + :vartype file_name: str + :ivar protocol: The protocol of packets to capture. Known values are: "TCP", "UDP", "Any", and + "ICMP". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol + :ivar flags: The tcp-flag type to be captured. Used with protocol TCP. + :vartype flags: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureFlags] + :ivar filters: Rules to filter packet captures. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureRule] + """ + + _validation = { + "duration_in_seconds": {"maximum": 1800, "minimum": 30}, + "number_of_packets_to_capture": {"maximum": 90000, "minimum": 100}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "duration_in_seconds": {"key": "properties.durationInSeconds", "type": "int"}, + "number_of_packets_to_capture": {"key": "properties.numberOfPacketsToCapture", "type": "int"}, + "sas_url": {"key": "properties.sasUrl", "type": "str"}, + "file_name": {"key": "properties.fileName", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "flags": {"key": "properties.flags", "type": "[AzureFirewallPacketCaptureFlags]"}, + "filters": {"key": "properties.filters", "type": "[AzureFirewallPacketCaptureRule]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + duration_in_seconds: Optional[int] = None, + number_of_packets_to_capture: Optional[int] = None, + sas_url: Optional[str] = None, + file_name: Optional[str] = None, + protocol: Optional[Union[str, "_models.AzureFirewallNetworkRuleProtocol"]] = None, + flags: Optional[List["_models.AzureFirewallPacketCaptureFlags"]] = None, + filters: Optional[List["_models.AzureFirewallPacketCaptureRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword duration_in_seconds: Duration of packet capture in seconds. + :paramtype duration_in_seconds: int + :keyword number_of_packets_to_capture: Number of packets to be captured. + :paramtype number_of_packets_to_capture: int + :keyword sas_url: Upload capture location. + :paramtype sas_url: str + :keyword file_name: Name of file to be uploaded to sasURL. + :paramtype file_name: str + :keyword protocol: The protocol of packets to capture. Known values are: "TCP", "UDP", "Any", + and "ICMP". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallNetworkRuleProtocol + :keyword flags: The tcp-flag type to be captured. Used with protocol TCP. + :paramtype flags: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureFlags] + :keyword filters: Rules to filter packet captures. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPacketCaptureRule] + """ + super().__init__(id=id, **kwargs) + self.duration_in_seconds = duration_in_seconds + self.number_of_packets_to_capture = number_of_packets_to_capture + self.sas_url = sas_url + self.file_name = file_name + self.protocol = protocol + self.flags = flags + self.filters = filters + + +class FirewallPolicy(Resource): # pylint: disable=too-many-instance-attributes + """FirewallPolicy Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar identity: The identity of the firewall policy. + :vartype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :ivar size: A read-only string that represents the size of the FirewallPolicyPropertiesFormat + in MB. (ex 0.5MB). + :vartype size: str + :ivar rule_collection_groups: List of references to FirewallPolicyRuleCollectionGroups. + :vartype rule_collection_groups: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the firewall policy resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar base_policy: The parent firewall policy from which rules are inherited. + :vartype base_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar firewalls: List of references to Azure Firewalls that this Firewall Policy is associated + with. + :vartype firewalls: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar child_policies: List of references to Child Firewall Policies. + :vartype child_policies: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar threat_intel_mode: The operation mode for Threat Intelligence. Known values are: "Alert", + "Deny", and "Off". + :vartype threat_intel_mode: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallThreatIntelMode + :ivar threat_intel_whitelist: ThreatIntel Whitelist for Firewall Policy. + :vartype threat_intel_whitelist: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyThreatIntelWhitelist + :ivar insights: Insights on Firewall Policy. + :vartype insights: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyInsights + :ivar snat: The private IP addresses/IP ranges to which traffic will not be SNAT. + :vartype snat: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySNAT + :ivar sql: SQL Settings definition. + :vartype sql: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySQL + :ivar dns_settings: DNS Proxy Settings definition. + :vartype dns_settings: ~azure.mgmt.network.v2023_09_01.models.DnsSettings + :ivar explicit_proxy: Explicit Proxy Settings definition. + :vartype explicit_proxy: ~azure.mgmt.network.v2023_09_01.models.ExplicitProxy + :ivar intrusion_detection: The configuration for Intrusion detection. + :vartype intrusion_detection: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetection + :ivar transport_security: TLS Configuration definition. + :vartype transport_security: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyTransportSecurity + :ivar sku: The Firewall Policy SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySku + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "size": {"readonly": True}, + "rule_collection_groups": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "firewalls": {"readonly": True}, + "child_policies": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "size": {"key": "properties.size", "type": "str"}, + "rule_collection_groups": {"key": "properties.ruleCollectionGroups", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "base_policy": {"key": "properties.basePolicy", "type": "SubResource"}, + "firewalls": {"key": "properties.firewalls", "type": "[SubResource]"}, + "child_policies": {"key": "properties.childPolicies", "type": "[SubResource]"}, + "threat_intel_mode": {"key": "properties.threatIntelMode", "type": "str"}, + "threat_intel_whitelist": { + "key": "properties.threatIntelWhitelist", + "type": "FirewallPolicyThreatIntelWhitelist", + }, + "insights": {"key": "properties.insights", "type": "FirewallPolicyInsights"}, + "snat": {"key": "properties.snat", "type": "FirewallPolicySNAT"}, + "sql": {"key": "properties.sql", "type": "FirewallPolicySQL"}, + "dns_settings": {"key": "properties.dnsSettings", "type": "DnsSettings"}, + "explicit_proxy": {"key": "properties.explicitProxy", "type": "ExplicitProxy"}, + "intrusion_detection": {"key": "properties.intrusionDetection", "type": "FirewallPolicyIntrusionDetection"}, + "transport_security": {"key": "properties.transportSecurity", "type": "FirewallPolicyTransportSecurity"}, + "sku": {"key": "properties.sku", "type": "FirewallPolicySku"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + base_policy: Optional["_models.SubResource"] = None, + threat_intel_mode: Optional[Union[str, "_models.AzureFirewallThreatIntelMode"]] = None, + threat_intel_whitelist: Optional["_models.FirewallPolicyThreatIntelWhitelist"] = None, + insights: Optional["_models.FirewallPolicyInsights"] = None, + snat: Optional["_models.FirewallPolicySNAT"] = None, + sql: Optional["_models.FirewallPolicySQL"] = None, + dns_settings: Optional["_models.DnsSettings"] = None, + explicit_proxy: Optional["_models.ExplicitProxy"] = None, + intrusion_detection: Optional["_models.FirewallPolicyIntrusionDetection"] = None, + transport_security: Optional["_models.FirewallPolicyTransportSecurity"] = None, + sku: Optional["_models.FirewallPolicySku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the firewall policy. + :paramtype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :keyword base_policy: The parent firewall policy from which rules are inherited. + :paramtype base_policy: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword threat_intel_mode: The operation mode for Threat Intelligence. Known values are: + "Alert", "Deny", and "Off". + :paramtype threat_intel_mode: str or + ~azure.mgmt.network.v2023_09_01.models.AzureFirewallThreatIntelMode + :keyword threat_intel_whitelist: ThreatIntel Whitelist for Firewall Policy. + :paramtype threat_intel_whitelist: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyThreatIntelWhitelist + :keyword insights: Insights on Firewall Policy. + :paramtype insights: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyInsights + :keyword snat: The private IP addresses/IP ranges to which traffic will not be SNAT. + :paramtype snat: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySNAT + :keyword sql: SQL Settings definition. + :paramtype sql: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySQL + :keyword dns_settings: DNS Proxy Settings definition. + :paramtype dns_settings: ~azure.mgmt.network.v2023_09_01.models.DnsSettings + :keyword explicit_proxy: Explicit Proxy Settings definition. + :paramtype explicit_proxy: ~azure.mgmt.network.v2023_09_01.models.ExplicitProxy + :keyword intrusion_detection: The configuration for Intrusion detection. + :paramtype intrusion_detection: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetection + :keyword transport_security: TLS Configuration definition. + :paramtype transport_security: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyTransportSecurity + :keyword sku: The Firewall Policy SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySku + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.identity = identity + self.size = None + self.rule_collection_groups = None + self.provisioning_state = None + self.base_policy = base_policy + self.firewalls = None + self.child_policies = None + self.threat_intel_mode = threat_intel_mode + self.threat_intel_whitelist = threat_intel_whitelist + self.insights = insights + self.snat = snat + self.sql = sql + self.dns_settings = dns_settings + self.explicit_proxy = explicit_proxy + self.intrusion_detection = intrusion_detection + self.transport_security = transport_security + self.sku = sku + + +class FirewallPolicyCertificateAuthority(_serialization.Model): + """Trusted Root certificates properties for tls. + + :ivar key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :vartype key_vault_secret_id: str + :ivar name: Name of the CA certificate. + :vartype name: str + """ + + _attribute_map = { + "key_vault_secret_id": {"key": "keyVaultSecretId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, key_vault_secret_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key_vault_secret_id: Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or + 'Certificate' object stored in KeyVault. + :paramtype key_vault_secret_id: str + :keyword name: Name of the CA certificate. + :paramtype name: str + """ + super().__init__(**kwargs) + self.key_vault_secret_id = key_vault_secret_id + self.name = name + + +class FirewallPolicyRuleCollection(_serialization.Model): + """Properties of the rule collection. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FirewallPolicyFilterRuleCollection, FirewallPolicyNatRuleCollection + + All required parameters must be populated in order to send to Azure. + + :ivar rule_collection_type: The type of the rule collection. Required. Known values are: + "FirewallPolicyNatRuleCollection" and "FirewallPolicyFilterRuleCollection". + :vartype rule_collection_type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionType + :ivar name: The name of the rule collection. + :vartype name: str + :ivar priority: Priority of the Firewall Policy Rule Collection resource. + :vartype priority: int + """ + + _validation = { + "rule_collection_type": {"required": True}, + "priority": {"maximum": 65000, "minimum": 100}, + } + + _attribute_map = { + "rule_collection_type": {"key": "ruleCollectionType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + } + + _subtype_map = { + "rule_collection_type": { + "FirewallPolicyFilterRuleCollection": "FirewallPolicyFilterRuleCollection", + "FirewallPolicyNatRuleCollection": "FirewallPolicyNatRuleCollection", + } + } + + def __init__(self, *, name: Optional[str] = None, priority: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the rule collection. + :paramtype name: str + :keyword priority: Priority of the Firewall Policy Rule Collection resource. + :paramtype priority: int + """ + super().__init__(**kwargs) + self.rule_collection_type: Optional[str] = None + self.name = name + self.priority = priority + + +class FirewallPolicyFilterRuleCollection(FirewallPolicyRuleCollection): + """Firewall Policy Filter Rule Collection. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_collection_type: The type of the rule collection. Required. Known values are: + "FirewallPolicyNatRuleCollection" and "FirewallPolicyFilterRuleCollection". + :vartype rule_collection_type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionType + :ivar name: The name of the rule collection. + :vartype name: str + :ivar priority: Priority of the Firewall Policy Rule Collection resource. + :vartype priority: int + :ivar action: The action type of a Filter rule collection. + :vartype action: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyFilterRuleCollectionAction + :ivar rules: List of rules included in a rule collection. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRule] + """ + + _validation = { + "rule_collection_type": {"required": True}, + "priority": {"maximum": 65000, "minimum": 100}, + } + + _attribute_map = { + "rule_collection_type": {"key": "ruleCollectionType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + "action": {"key": "action", "type": "FirewallPolicyFilterRuleCollectionAction"}, + "rules": {"key": "rules", "type": "[FirewallPolicyRule]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + priority: Optional[int] = None, + action: Optional["_models.FirewallPolicyFilterRuleCollectionAction"] = None, + rules: Optional[List["_models.FirewallPolicyRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the rule collection. + :paramtype name: str + :keyword priority: Priority of the Firewall Policy Rule Collection resource. + :paramtype priority: int + :keyword action: The action type of a Filter rule collection. + :paramtype action: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyFilterRuleCollectionAction + :keyword rules: List of rules included in a rule collection. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRule] + """ + super().__init__(name=name, priority=priority, **kwargs) + self.rule_collection_type: str = "FirewallPolicyFilterRuleCollection" + self.action = action + self.rules = rules + + +class FirewallPolicyFilterRuleCollectionAction(_serialization.Model): + """Properties of the FirewallPolicyFilterRuleCollectionAction. + + :ivar type: The type of action. Known values are: "Allow" and "Deny". + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyFilterRuleCollectionActionType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.FirewallPolicyFilterRuleCollectionActionType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of action. Known values are: "Allow" and "Deny". + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyFilterRuleCollectionActionType + """ + super().__init__(**kwargs) + self.type = type + + +class FirewallPolicyHttpHeaderToInsert(_serialization.Model): + """name and value of HTTP/S header to insert. + + :ivar header_name: Contains the name of the header. + :vartype header_name: str + :ivar header_value: Contains the value of the header. + :vartype header_value: str + """ + + _attribute_map = { + "header_name": {"key": "headerName", "type": "str"}, + "header_value": {"key": "headerValue", "type": "str"}, + } + + def __init__(self, *, header_name: Optional[str] = None, header_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword header_name: Contains the name of the header. + :paramtype header_name: str + :keyword header_value: Contains the value of the header. + :paramtype header_value: str + """ + super().__init__(**kwargs) + self.header_name = header_name + self.header_value = header_value + + +class FirewallPolicyInsights(_serialization.Model): + """Firewall Policy Insights. + + :ivar is_enabled: A flag to indicate if the insights are enabled on the policy. + :vartype is_enabled: bool + :ivar retention_days: Number of days the insights should be enabled on the policy. + :vartype retention_days: int + :ivar log_analytics_resources: Workspaces needed to configure the Firewall Policy Insights. + :vartype log_analytics_resources: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyLogAnalyticsResources + """ + + _attribute_map = { + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "retention_days": {"key": "retentionDays", "type": "int"}, + "log_analytics_resources": {"key": "logAnalyticsResources", "type": "FirewallPolicyLogAnalyticsResources"}, + } + + def __init__( + self, + *, + is_enabled: Optional[bool] = None, + retention_days: Optional[int] = None, + log_analytics_resources: Optional["_models.FirewallPolicyLogAnalyticsResources"] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_enabled: A flag to indicate if the insights are enabled on the policy. + :paramtype is_enabled: bool + :keyword retention_days: Number of days the insights should be enabled on the policy. + :paramtype retention_days: int + :keyword log_analytics_resources: Workspaces needed to configure the Firewall Policy Insights. + :paramtype log_analytics_resources: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyLogAnalyticsResources + """ + super().__init__(**kwargs) + self.is_enabled = is_enabled + self.retention_days = retention_days + self.log_analytics_resources = log_analytics_resources + + +class FirewallPolicyIntrusionDetection(_serialization.Model): + """Configuration for intrusion detection mode and rules. + + :ivar mode: Intrusion detection general state. When attached to a parent policy, the firewall's + effective IDPS mode is the stricter mode of the two. Known values are: "Off", "Alert", and + "Deny". + :vartype mode: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionStateType + :ivar profile: IDPS profile name. When attached to a parent policy, the firewall's effective + profile is the profile name of the parent policy. Known values are: "Basic", "Standard", + "Advanced", and "Extended". + :vartype profile: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionProfileType + :ivar configuration: Intrusion detection configuration properties. + :vartype configuration: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionConfiguration + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "profile": {"key": "profile", "type": "str"}, + "configuration": {"key": "configuration", "type": "FirewallPolicyIntrusionDetectionConfiguration"}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "_models.FirewallPolicyIntrusionDetectionStateType"]] = None, + profile: Optional[Union[str, "_models.FirewallPolicyIntrusionDetectionProfileType"]] = None, + configuration: Optional["_models.FirewallPolicyIntrusionDetectionConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: Intrusion detection general state. When attached to a parent policy, the + firewall's effective IDPS mode is the stricter mode of the two. Known values are: "Off", + "Alert", and "Deny". + :paramtype mode: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionStateType + :keyword profile: IDPS profile name. When attached to a parent policy, the firewall's effective + profile is the profile name of the parent policy. Known values are: "Basic", "Standard", + "Advanced", and "Extended". + :paramtype profile: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionProfileType + :keyword configuration: Intrusion detection configuration properties. + :paramtype configuration: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionConfiguration + """ + super().__init__(**kwargs) + self.mode = mode + self.profile = profile + self.configuration = configuration + + +class FirewallPolicyIntrusionDetectionBypassTrafficSpecifications(_serialization.Model): + """Intrusion detection bypass traffic specification. + + :ivar name: Name of the bypass traffic rule. + :vartype name: str + :ivar description: Description of the bypass traffic rule. + :vartype description: str + :ivar protocol: The rule bypass protocol. Known values are: "TCP", "UDP", "ICMP", and "ANY". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionProtocol + :ivar source_addresses: List of source IP addresses or ranges for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses or ranges for this rule. + :vartype destination_addresses: list[str] + :ivar destination_ports: List of destination ports or ranges. + :vartype destination_ports: list[str] + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + :ivar destination_ip_groups: List of destination IpGroups for this rule. + :vartype destination_ip_groups: list[str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + "destination_ip_groups": {"key": "destinationIpGroups", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "_models.FirewallPolicyIntrusionDetectionProtocol"]] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + source_ip_groups: Optional[List[str]] = None, + destination_ip_groups: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the bypass traffic rule. + :paramtype name: str + :keyword description: Description of the bypass traffic rule. + :paramtype description: str + :keyword protocol: The rule bypass protocol. Known values are: "TCP", "UDP", "ICMP", and "ANY". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionProtocol + :keyword source_addresses: List of source IP addresses or ranges for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses or ranges for this rule. + :paramtype destination_addresses: list[str] + :keyword destination_ports: List of destination ports or ranges. + :paramtype destination_ports: list[str] + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + :keyword destination_ip_groups: List of destination IpGroups for this rule. + :paramtype destination_ip_groups: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.protocol = protocol + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.destination_ports = destination_ports + self.source_ip_groups = source_ip_groups + self.destination_ip_groups = destination_ip_groups + + +class FirewallPolicyIntrusionDetectionConfiguration(_serialization.Model): + """The operation for configuring intrusion detection. + + :ivar signature_overrides: List of specific signatures states. + :vartype signature_overrides: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionSignatureSpecification] + :ivar bypass_traffic_settings: List of rules for traffic to bypass. + :vartype bypass_traffic_settings: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications] + :ivar private_ranges: IDPS Private IP address ranges are used to identify traffic direction + (i.e. inbound, outbound, etc.). By default, only ranges defined by IANA RFC 1918 are considered + private IP addresses. To modify default ranges, specify your Private IP address ranges with + this property. + :vartype private_ranges: list[str] + """ + + _attribute_map = { + "signature_overrides": { + "key": "signatureOverrides", + "type": "[FirewallPolicyIntrusionDetectionSignatureSpecification]", + }, + "bypass_traffic_settings": { + "key": "bypassTrafficSettings", + "type": "[FirewallPolicyIntrusionDetectionBypassTrafficSpecifications]", + }, + "private_ranges": {"key": "privateRanges", "type": "[str]"}, + } + + def __init__( + self, + *, + signature_overrides: Optional[List["_models.FirewallPolicyIntrusionDetectionSignatureSpecification"]] = None, + bypass_traffic_settings: Optional[ + List["_models.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications"] + ] = None, + private_ranges: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword signature_overrides: List of specific signatures states. + :paramtype signature_overrides: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionSignatureSpecification] + :keyword bypass_traffic_settings: List of rules for traffic to bypass. + :paramtype bypass_traffic_settings: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications] + :keyword private_ranges: IDPS Private IP address ranges are used to identify traffic direction + (i.e. inbound, outbound, etc.). By default, only ranges defined by IANA RFC 1918 are considered + private IP addresses. To modify default ranges, specify your Private IP address ranges with + this property. + :paramtype private_ranges: list[str] + """ + super().__init__(**kwargs) + self.signature_overrides = signature_overrides + self.bypass_traffic_settings = bypass_traffic_settings + self.private_ranges = private_ranges + + +class FirewallPolicyIntrusionDetectionSignatureSpecification(_serialization.Model): + """Intrusion detection signatures specification states. + + :ivar id: Signature id. + :vartype id: str + :ivar mode: The signature state. Known values are: "Off", "Alert", and "Deny". + :vartype mode: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionStateType + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + mode: Optional[Union[str, "_models.FirewallPolicyIntrusionDetectionStateType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Signature id. + :paramtype id: str + :keyword mode: The signature state. Known values are: "Off", "Alert", and "Deny". + :paramtype mode: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIntrusionDetectionStateType + """ + super().__init__(**kwargs) + self.id = id + self.mode = mode + + +class FirewallPolicyListResult(_serialization.Model): + """Response for ListFirewallPolicies API service call. + + :ivar value: List of Firewall Policies in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[FirewallPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.FirewallPolicy"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Firewall Policies in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class FirewallPolicyLogAnalyticsResources(_serialization.Model): + """Log Analytics Resources for Firewall Policy Insights. + + :ivar workspaces: List of workspaces for Firewall Policy Insights. + :vartype workspaces: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyLogAnalyticsWorkspace] + :ivar default_workspace_id: The default workspace Id for Firewall Policy Insights. + :vartype default_workspace_id: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "workspaces": {"key": "workspaces", "type": "[FirewallPolicyLogAnalyticsWorkspace]"}, + "default_workspace_id": {"key": "defaultWorkspaceId", "type": "SubResource"}, + } + + def __init__( + self, + *, + workspaces: Optional[List["_models.FirewallPolicyLogAnalyticsWorkspace"]] = None, + default_workspace_id: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword workspaces: List of workspaces for Firewall Policy Insights. + :paramtype workspaces: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyLogAnalyticsWorkspace] + :keyword default_workspace_id: The default workspace Id for Firewall Policy Insights. + :paramtype default_workspace_id: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.workspaces = workspaces + self.default_workspace_id = default_workspace_id + + +class FirewallPolicyLogAnalyticsWorkspace(_serialization.Model): + """Log Analytics Workspace for Firewall Policy Insights. + + :ivar region: Region to configure the Workspace. + :vartype region: str + :ivar workspace_id: The workspace Id for Firewall Policy Insights. + :vartype workspace_id: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "region": {"key": "region", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "SubResource"}, + } + + def __init__( + self, *, region: Optional[str] = None, workspace_id: Optional["_models.SubResource"] = None, **kwargs: Any + ) -> None: + """ + :keyword region: Region to configure the Workspace. + :paramtype region: str + :keyword workspace_id: The workspace Id for Firewall Policy Insights. + :paramtype workspace_id: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.region = region + self.workspace_id = workspace_id + + +class FirewallPolicyNatRuleCollection(FirewallPolicyRuleCollection): + """Firewall Policy NAT Rule Collection. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_collection_type: The type of the rule collection. Required. Known values are: + "FirewallPolicyNatRuleCollection" and "FirewallPolicyFilterRuleCollection". + :vartype rule_collection_type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionType + :ivar name: The name of the rule collection. + :vartype name: str + :ivar priority: Priority of the Firewall Policy Rule Collection resource. + :vartype priority: int + :ivar action: The action type of a Nat rule collection. + :vartype action: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyNatRuleCollectionAction + :ivar rules: List of rules included in a rule collection. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRule] + """ + + _validation = { + "rule_collection_type": {"required": True}, + "priority": {"maximum": 65000, "minimum": 100}, + } + + _attribute_map = { + "rule_collection_type": {"key": "ruleCollectionType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + "action": {"key": "action", "type": "FirewallPolicyNatRuleCollectionAction"}, + "rules": {"key": "rules", "type": "[FirewallPolicyRule]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + priority: Optional[int] = None, + action: Optional["_models.FirewallPolicyNatRuleCollectionAction"] = None, + rules: Optional[List["_models.FirewallPolicyRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the rule collection. + :paramtype name: str + :keyword priority: Priority of the Firewall Policy Rule Collection resource. + :paramtype priority: int + :keyword action: The action type of a Nat rule collection. + :paramtype action: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyNatRuleCollectionAction + :keyword rules: List of rules included in a rule collection. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRule] + """ + super().__init__(name=name, priority=priority, **kwargs) + self.rule_collection_type: str = "FirewallPolicyNatRuleCollection" + self.action = action + self.rules = rules + + +class FirewallPolicyNatRuleCollectionAction(_serialization.Model): + """Properties of the FirewallPolicyNatRuleCollectionAction. + + :ivar type: The type of action. "DNAT" + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyNatRuleCollectionActionType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, *, type: Optional[Union[str, "_models.FirewallPolicyNatRuleCollectionActionType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword type: The type of action. "DNAT" + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyNatRuleCollectionActionType + """ + super().__init__(**kwargs) + self.type = type + + +class FirewallPolicyRuleApplicationProtocol(_serialization.Model): + """Properties of the application rule protocol. + + :ivar protocol_type: Protocol type. Known values are: "Http" and "Https". + :vartype protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleApplicationProtocolType + :ivar port: Port number for the protocol, cannot be greater than 64000. + :vartype port: int + """ + + _validation = { + "port": {"maximum": 64000, "minimum": 0}, + } + + _attribute_map = { + "protocol_type": {"key": "protocolType", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__( + self, + *, + protocol_type: Optional[Union[str, "_models.FirewallPolicyRuleApplicationProtocolType"]] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword protocol_type: Protocol type. Known values are: "Http" and "Https". + :paramtype protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleApplicationProtocolType + :keyword port: Port number for the protocol, cannot be greater than 64000. + :paramtype port: int + """ + super().__init__(**kwargs) + self.protocol_type = protocol_type + self.port = port + + +class FirewallPolicyRuleCollectionGroup(SubResource): + """Rule Collection Group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Rule Group type. + :vartype type: str + :ivar size: A read-only string that represents the size of the + FirewallPolicyRuleCollectionGroupProperties in MB. (ex 1.2MB). + :vartype size: str + :ivar priority: Priority of the Firewall Policy Rule Collection Group resource. + :vartype priority: int + :ivar rule_collections: Group of Firewall Policy rule collections. + :vartype rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollection] + :ivar provisioning_state: The provisioning state of the firewall policy rule collection group + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "size": {"readonly": True}, + "priority": {"maximum": 65000, "minimum": 100}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "size": {"key": "properties.size", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "rule_collections": {"key": "properties.ruleCollections", "type": "[FirewallPolicyRuleCollection]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + priority: Optional[int] = None, + rule_collections: Optional[List["_models.FirewallPolicyRuleCollection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword priority: Priority of the Firewall Policy Rule Collection Group resource. + :paramtype priority: int + :keyword rule_collections: Group of Firewall Policy rule collections. + :paramtype rule_collections: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollection] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.size = None + self.priority = priority + self.rule_collections = rule_collections + self.provisioning_state = None + + +class FirewallPolicyRuleCollectionGroupListResult(_serialization.Model): + """Response for ListFirewallPolicyRuleCollectionGroups API service call. + + :ivar value: List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[FirewallPolicyRuleCollectionGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.FirewallPolicyRuleCollectionGroup"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class FirewallPolicySku(_serialization.Model): + """SKU of Firewall policy. + + :ivar tier: Tier of Firewall Policy. Known values are: "Standard", "Premium", and "Basic". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySkuTier + """ + + _attribute_map = { + "tier": {"key": "tier", "type": "str"}, + } + + def __init__(self, *, tier: Optional[Union[str, "_models.FirewallPolicySkuTier"]] = None, **kwargs: Any) -> None: + """ + :keyword tier: Tier of Firewall Policy. Known values are: "Standard", "Premium", and "Basic". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicySkuTier + """ + super().__init__(**kwargs) + self.tier = tier + + +class FirewallPolicySNAT(_serialization.Model): + """The private IP addresses/IP ranges to which traffic will not be SNAT. + + :ivar private_ranges: List of private IP addresses/IP address ranges to not be SNAT. + :vartype private_ranges: list[str] + :ivar auto_learn_private_ranges: The operation mode for automatically learning private ranges + to not be SNAT. Known values are: "Enabled" and "Disabled". + :vartype auto_learn_private_ranges: str or + ~azure.mgmt.network.v2023_09_01.models.AutoLearnPrivateRangesMode + """ + + _attribute_map = { + "private_ranges": {"key": "privateRanges", "type": "[str]"}, + "auto_learn_private_ranges": {"key": "autoLearnPrivateRanges", "type": "str"}, + } + + def __init__( + self, + *, + private_ranges: Optional[List[str]] = None, + auto_learn_private_ranges: Optional[Union[str, "_models.AutoLearnPrivateRangesMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword private_ranges: List of private IP addresses/IP address ranges to not be SNAT. + :paramtype private_ranges: list[str] + :keyword auto_learn_private_ranges: The operation mode for automatically learning private + ranges to not be SNAT. Known values are: "Enabled" and "Disabled". + :paramtype auto_learn_private_ranges: str or + ~azure.mgmt.network.v2023_09_01.models.AutoLearnPrivateRangesMode + """ + super().__init__(**kwargs) + self.private_ranges = private_ranges + self.auto_learn_private_ranges = auto_learn_private_ranges + + +class FirewallPolicySQL(_serialization.Model): + """SQL Settings in Firewall Policy. + + :ivar allow_sql_redirect: A flag to indicate if SQL Redirect traffic filtering is enabled. + Turning on the flag requires no rule using port 11000-11999. + :vartype allow_sql_redirect: bool + """ + + _attribute_map = { + "allow_sql_redirect": {"key": "allowSqlRedirect", "type": "bool"}, + } + + def __init__(self, *, allow_sql_redirect: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword allow_sql_redirect: A flag to indicate if SQL Redirect traffic filtering is enabled. + Turning on the flag requires no rule using port 11000-11999. + :paramtype allow_sql_redirect: bool + """ + super().__init__(**kwargs) + self.allow_sql_redirect = allow_sql_redirect + + +class FirewallPolicyThreatIntelWhitelist(_serialization.Model): + """ThreatIntel Whitelist for Firewall Policy. + + :ivar ip_addresses: List of IP addresses for the ThreatIntel Whitelist. + :vartype ip_addresses: list[str] + :ivar fqdns: List of FQDNs for the ThreatIntel Whitelist. + :vartype fqdns: list[str] + """ + + _attribute_map = { + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "fqdns": {"key": "fqdns", "type": "[str]"}, + } + + def __init__( + self, *, ip_addresses: Optional[List[str]] = None, fqdns: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword ip_addresses: List of IP addresses for the ThreatIntel Whitelist. + :paramtype ip_addresses: list[str] + :keyword fqdns: List of FQDNs for the ThreatIntel Whitelist. + :paramtype fqdns: list[str] + """ + super().__init__(**kwargs) + self.ip_addresses = ip_addresses + self.fqdns = fqdns + + +class FirewallPolicyTransportSecurity(_serialization.Model): + """Configuration needed to perform TLS termination & initiation. + + :ivar certificate_authority: The CA used for intermediate CA generation. + :vartype certificate_authority: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyCertificateAuthority + """ + + _attribute_map = { + "certificate_authority": {"key": "certificateAuthority", "type": "FirewallPolicyCertificateAuthority"}, + } + + def __init__( + self, *, certificate_authority: Optional["_models.FirewallPolicyCertificateAuthority"] = None, **kwargs: Any + ) -> None: + """ + :keyword certificate_authority: The CA used for intermediate CA generation. + :paramtype certificate_authority: + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyCertificateAuthority + """ + super().__init__(**kwargs) + self.certificate_authority = certificate_authority + + +class FlowLog(Resource): # pylint: disable=too-many-instance-attributes + """A flow log resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar target_resource_id: ID of network security group to which flow log will be applied. + :vartype target_resource_id: str + :ivar target_resource_guid: Guid of network security group to which flow log will be applied. + :vartype target_resource_guid: str + :ivar storage_id: ID of the storage account which is used to store the flow log. + :vartype storage_id: str + :ivar enabled: Flag to enable/disable flow logging. + :vartype enabled: bool + :ivar retention_policy: Parameters that define the retention policy for flow log. + :vartype retention_policy: ~azure.mgmt.network.v2023_09_01.models.RetentionPolicyParameters + :ivar format: Parameters that define the flow log format. + :vartype format: ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatParameters + :ivar flow_analytics_configuration: Parameters that define the configuration of traffic + analytics. + :vartype flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsProperties + :ivar provisioning_state: The provisioning state of the flow log. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "target_resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, + "target_resource_guid": {"key": "properties.targetResourceGuid", "type": "str"}, + "storage_id": {"key": "properties.storageId", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "retention_policy": {"key": "properties.retentionPolicy", "type": "RetentionPolicyParameters"}, + "format": {"key": "properties.format", "type": "FlowLogFormatParameters"}, + "flow_analytics_configuration": { + "key": "properties.flowAnalyticsConfiguration", + "type": "TrafficAnalyticsProperties", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + target_resource_id: Optional[str] = None, + storage_id: Optional[str] = None, + enabled: Optional[bool] = None, + retention_policy: Optional["_models.RetentionPolicyParameters"] = None, + format: Optional["_models.FlowLogFormatParameters"] = None, + flow_analytics_configuration: Optional["_models.TrafficAnalyticsProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword target_resource_id: ID of network security group to which flow log will be applied. + :paramtype target_resource_id: str + :keyword storage_id: ID of the storage account which is used to store the flow log. + :paramtype storage_id: str + :keyword enabled: Flag to enable/disable flow logging. + :paramtype enabled: bool + :keyword retention_policy: Parameters that define the retention policy for flow log. + :paramtype retention_policy: ~azure.mgmt.network.v2023_09_01.models.RetentionPolicyParameters + :keyword format: Parameters that define the flow log format. + :paramtype format: ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatParameters + :keyword flow_analytics_configuration: Parameters that define the configuration of traffic + analytics. + :paramtype flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsProperties + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.target_resource_id = target_resource_id + self.target_resource_guid = None + self.storage_id = storage_id + self.enabled = enabled + self.retention_policy = retention_policy + self.format = format + self.flow_analytics_configuration = flow_analytics_configuration + self.provisioning_state = None + + +class FlowLogFormatParameters(_serialization.Model): + """Parameters that define the flow log format. + + :ivar type: The file type of flow log. "JSON" + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatType + :ivar version: The version (revision) of the flow log. + :vartype version: int + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "int"}, + } + + def __init__( + self, *, type: Optional[Union[str, "_models.FlowLogFormatType"]] = None, version: int = 0, **kwargs: Any + ) -> None: + """ + :keyword type: The file type of flow log. "JSON" + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatType + :keyword version: The version (revision) of the flow log. + :paramtype version: int + """ + super().__init__(**kwargs) + self.type = type + self.version = version + + +class FlowLogInformation(_serialization.Model): + """Information on the configuration of flow log and traffic analytics (optional) . + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The ID of the resource to configure for flow log and traffic + analytics (optional) . Required. + :vartype target_resource_id: str + :ivar flow_analytics_configuration: Parameters that define the configuration of traffic + analytics. + :vartype flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsProperties + :ivar storage_id: ID of the storage account which is used to store the flow log. Required. + :vartype storage_id: str + :ivar enabled: Flag to enable/disable flow logging. Required. + :vartype enabled: bool + :ivar retention_policy: Parameters that define the retention policy for flow log. + :vartype retention_policy: ~azure.mgmt.network.v2023_09_01.models.RetentionPolicyParameters + :ivar format: Parameters that define the flow log format. + :vartype format: ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatParameters + """ + + _validation = { + "target_resource_id": {"required": True}, + "storage_id": {"required": True}, + "enabled": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "flow_analytics_configuration": {"key": "flowAnalyticsConfiguration", "type": "TrafficAnalyticsProperties"}, + "storage_id": {"key": "properties.storageId", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "retention_policy": {"key": "properties.retentionPolicy", "type": "RetentionPolicyParameters"}, + "format": {"key": "properties.format", "type": "FlowLogFormatParameters"}, + } + + def __init__( + self, + *, + target_resource_id: str, + storage_id: str, + enabled: bool, + flow_analytics_configuration: Optional["_models.TrafficAnalyticsProperties"] = None, + retention_policy: Optional["_models.RetentionPolicyParameters"] = None, + format: Optional["_models.FlowLogFormatParameters"] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_resource_id: The ID of the resource to configure for flow log and traffic + analytics (optional) . Required. + :paramtype target_resource_id: str + :keyword flow_analytics_configuration: Parameters that define the configuration of traffic + analytics. + :paramtype flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsProperties + :keyword storage_id: ID of the storage account which is used to store the flow log. Required. + :paramtype storage_id: str + :keyword enabled: Flag to enable/disable flow logging. Required. + :paramtype enabled: bool + :keyword retention_policy: Parameters that define the retention policy for flow log. + :paramtype retention_policy: ~azure.mgmt.network.v2023_09_01.models.RetentionPolicyParameters + :keyword format: Parameters that define the flow log format. + :paramtype format: ~azure.mgmt.network.v2023_09_01.models.FlowLogFormatParameters + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + self.flow_analytics_configuration = flow_analytics_configuration + self.storage_id = storage_id + self.enabled = enabled + self.retention_policy = retention_policy + self.format = format + + +class FlowLogListResult(_serialization.Model): + """List of flow logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Information about flow log resource. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FlowLog]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FlowLog"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Information about flow log resource. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.FlowLog] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FlowLogStatusParameters(_serialization.Model): + """Parameters that define a resource to query flow log and traffic analytics (optional) status. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The target resource where getting the flow log and traffic analytics + (optional) status. Required. + :vartype target_resource_id: str + """ + + _validation = { + "target_resource_id": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + } + + def __init__(self, *, target_resource_id: str, **kwargs: Any) -> None: + """ + :keyword target_resource_id: The target resource where getting the flow log and traffic + analytics (optional) status. Required. + :paramtype target_resource_id: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + + +class FrontendIPConfiguration(SubResource): # pylint: disable=too-many-instance-attributes + """Frontend IP address of the load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar zones: A list of availability zones denoting the IP allocated for the resource needs to + come from. + :vartype zones: list[str] + :ivar inbound_nat_rules: An array of references to inbound rules that use this frontend IP. + :vartype inbound_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar inbound_nat_pools: An array of references to inbound pools that use this frontend IP. + :vartype inbound_nat_pools: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar outbound_rules: An array of references to outbound rules that use this frontend IP. + :vartype outbound_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar load_balancing_rules: An array of references to load balancing rules that use this + frontend IP. + :vartype load_balancing_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar private_ip_address: The private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The Private IP allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar private_ip_address_version: Whether the specific ipconfiguration is IPv4 or IPv6. Default + is taken as IPv4. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :ivar subnet: The reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar public_ip_address: The reference to the Public IP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar public_ip_prefix: The reference to the Public IP Prefix resource. + :vartype public_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar gateway_load_balancer: The reference to gateway load balancer frontend IP. + :vartype gateway_load_balancer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the frontend IP configuration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "inbound_nat_rules": {"readonly": True}, + "inbound_nat_pools": {"readonly": True}, + "outbound_rules": {"readonly": True}, + "load_balancing_rules": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "inbound_nat_rules": {"key": "properties.inboundNatRules", "type": "[SubResource]"}, + "inbound_nat_pools": {"key": "properties.inboundNatPools", "type": "[SubResource]"}, + "outbound_rules": {"key": "properties.outboundRules", "type": "[SubResource]"}, + "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[SubResource]"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "private_ip_address_version": {"key": "properties.privateIPAddressVersion", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "PublicIPAddress"}, + "public_ip_prefix": {"key": "properties.publicIPPrefix", "type": "SubResource"}, + "gateway_load_balancer": {"key": "properties.gatewayLoadBalancer", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + zones: Optional[List[str]] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + subnet: Optional["_models.Subnet"] = None, + public_ip_address: Optional["_models.PublicIPAddress"] = None, + public_ip_prefix: Optional["_models.SubResource"] = None, + gateway_load_balancer: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword zones: A list of availability zones denoting the IP allocated for the resource needs + to come from. + :paramtype zones: list[str] + :keyword private_ip_address: The private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The Private IP allocation method. Known values are: + "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword private_ip_address_version: Whether the specific ipconfiguration is IPv4 or IPv6. + Default is taken as IPv4. Known values are: "IPv4" and "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :keyword subnet: The reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword public_ip_address: The reference to the Public IP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :keyword public_ip_prefix: The reference to the Public IP Prefix resource. + :paramtype public_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword gateway_load_balancer: The reference to gateway load balancer frontend IP. + :paramtype gateway_load_balancer: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.zones = zones + self.inbound_nat_rules = None + self.inbound_nat_pools = None + self.outbound_rules = None + self.load_balancing_rules = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.private_ip_address_version = private_ip_address_version + self.subnet = subnet + self.public_ip_address = public_ip_address + self.public_ip_prefix = public_ip_prefix + self.gateway_load_balancer = gateway_load_balancer + self.provisioning_state = None + + +class GatewayCustomBgpIpAddressIpConfiguration(_serialization.Model): + """GatewayCustomBgpIpAddressIpConfiguration for a virtual network gateway connection. + + All required parameters must be populated in order to send to Azure. + + :ivar ip_configuration_id: The IpconfigurationId of ipconfiguration which belongs to gateway. + Required. + :vartype ip_configuration_id: str + :ivar custom_bgp_ip_address: The custom BgpPeeringAddress which belongs to IpconfigurationId. + Required. + :vartype custom_bgp_ip_address: str + """ + + _validation = { + "ip_configuration_id": {"required": True}, + "custom_bgp_ip_address": {"required": True}, + } + + _attribute_map = { + "ip_configuration_id": {"key": "ipConfigurationId", "type": "str"}, + "custom_bgp_ip_address": {"key": "customBgpIpAddress", "type": "str"}, + } + + def __init__(self, *, ip_configuration_id: str, custom_bgp_ip_address: str, **kwargs: Any) -> None: + """ + :keyword ip_configuration_id: The IpconfigurationId of ipconfiguration which belongs to + gateway. Required. + :paramtype ip_configuration_id: str + :keyword custom_bgp_ip_address: The custom BgpPeeringAddress which belongs to + IpconfigurationId. Required. + :paramtype custom_bgp_ip_address: str + """ + super().__init__(**kwargs) + self.ip_configuration_id = ip_configuration_id + self.custom_bgp_ip_address = custom_bgp_ip_address + + +class GatewayLoadBalancerTunnelInterface(_serialization.Model): + """Gateway load balancer tunnel interface of a load balancer backend address pool. + + :ivar port: Port of gateway load balancer tunnel interface. + :vartype port: int + :ivar identifier: Identifier of gateway load balancer tunnel interface. + :vartype identifier: int + :ivar protocol: Protocol of gateway load balancer tunnel interface. Known values are: "None", + "Native", and "VXLAN". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelProtocol + :ivar type: Traffic type of gateway load balancer tunnel interface. Known values are: "None", + "Internal", and "External". + :vartype type: str or + ~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelInterfaceType + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "identifier": {"key": "identifier", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + port: Optional[int] = None, + identifier: Optional[int] = None, + protocol: Optional[Union[str, "_models.GatewayLoadBalancerTunnelProtocol"]] = None, + type: Optional[Union[str, "_models.GatewayLoadBalancerTunnelInterfaceType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword port: Port of gateway load balancer tunnel interface. + :paramtype port: int + :keyword identifier: Identifier of gateway load balancer tunnel interface. + :paramtype identifier: int + :keyword protocol: Protocol of gateway load balancer tunnel interface. Known values are: + "None", "Native", and "VXLAN". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelProtocol + :keyword type: Traffic type of gateway load balancer tunnel interface. Known values are: + "None", "Internal", and "External". + :paramtype type: str or + ~azure.mgmt.network.v2023_09_01.models.GatewayLoadBalancerTunnelInterfaceType + """ + super().__init__(**kwargs) + self.port = port + self.identifier = identifier + self.protocol = protocol + self.type = type + + +class GatewayRoute(_serialization.Model): + """Gateway routing details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar local_address: The gateway's local address. + :vartype local_address: str + :ivar network: The route's network prefix. + :vartype network: str + :ivar next_hop: The route's next hop. + :vartype next_hop: str + :ivar source_peer: The peer this route was learned from. + :vartype source_peer: str + :ivar origin: The source this route was learned from. + :vartype origin: str + :ivar as_path: The route's AS path sequence. + :vartype as_path: str + :ivar weight: The route's weight. + :vartype weight: int + """ + + _validation = { + "local_address": {"readonly": True}, + "network": {"readonly": True}, + "next_hop": {"readonly": True}, + "source_peer": {"readonly": True}, + "origin": {"readonly": True}, + "as_path": {"readonly": True}, + "weight": {"readonly": True}, + } + + _attribute_map = { + "local_address": {"key": "localAddress", "type": "str"}, + "network": {"key": "network", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "str"}, + "source_peer": {"key": "sourcePeer", "type": "str"}, + "origin": {"key": "origin", "type": "str"}, + "as_path": {"key": "asPath", "type": "str"}, + "weight": {"key": "weight", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.local_address = None + self.network = None + self.next_hop = None + self.source_peer = None + self.origin = None + self.as_path = None + self.weight = None + + +class GatewayRouteListResult(_serialization.Model): + """List of virtual network gateway routes. + + :ivar value: List of gateway routes. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.GatewayRoute] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[GatewayRoute]"}, + } + + def __init__(self, *, value: Optional[List["_models.GatewayRoute"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of gateway routes. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.GatewayRoute] + """ + super().__init__(**kwargs) + self.value = value + + +class GenerateExpressRoutePortsLOARequest(_serialization.Model): + """The customer name to be printed on a letter of authorization. + + All required parameters must be populated in order to send to Azure. + + :ivar customer_name: The customer name. Required. + :vartype customer_name: str + """ + + _validation = { + "customer_name": {"required": True}, + } + + _attribute_map = { + "customer_name": {"key": "customerName", "type": "str"}, + } + + def __init__(self, *, customer_name: str, **kwargs: Any) -> None: + """ + :keyword customer_name: The customer name. Required. + :paramtype customer_name: str + """ + super().__init__(**kwargs) + self.customer_name = customer_name + + +class GenerateExpressRoutePortsLOAResult(_serialization.Model): + """Response for GenerateExpressRoutePortsLOA API service call. + + :ivar encoded_content: The content as a base64 encoded string. + :vartype encoded_content: str + """ + + _attribute_map = { + "encoded_content": {"key": "encodedContent", "type": "str"}, + } + + def __init__(self, *, encoded_content: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword encoded_content: The content as a base64 encoded string. + :paramtype encoded_content: str + """ + super().__init__(**kwargs) + self.encoded_content = encoded_content + + +class GetInboundRoutesParameters(_serialization.Model): + """The parameters specifying the connection resource whose inbound routes are being requested. + + :ivar resource_uri: The connection resource whose inbound routes are being requested. + :vartype resource_uri: str + :ivar connection_type: The type of the specified connection resource like + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :vartype connection_type: str + """ + + _attribute_map = { + "resource_uri": {"key": "resourceUri", "type": "str"}, + "connection_type": {"key": "connectionType", "type": "str"}, + } + + def __init__( + self, *, resource_uri: Optional[str] = None, connection_type: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_uri: The connection resource whose inbound routes are being requested. + :paramtype resource_uri: str + :keyword connection_type: The type of the specified connection resource like + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :paramtype connection_type: str + """ + super().__init__(**kwargs) + self.resource_uri = resource_uri + self.connection_type = connection_type + + +class GetOutboundRoutesParameters(_serialization.Model): + """The parameters specifying the connection resource whose outbound routes are being requested. + + :ivar resource_uri: The connection resource whose outbound routes are being requested. + :vartype resource_uri: str + :ivar connection_type: The type of the specified connection resource like + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :vartype connection_type: str + """ + + _attribute_map = { + "resource_uri": {"key": "resourceUri", "type": "str"}, + "connection_type": {"key": "connectionType", "type": "str"}, + } + + def __init__( + self, *, resource_uri: Optional[str] = None, connection_type: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_uri: The connection resource whose outbound routes are being requested. + :paramtype resource_uri: str + :keyword connection_type: The type of the specified connection resource like + ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + :paramtype connection_type: str + """ + super().__init__(**kwargs) + self.resource_uri = resource_uri + self.connection_type = connection_type + + +class GetVpnSitesConfigurationRequest(_serialization.Model): + """List of Vpn-Sites. + + All required parameters must be populated in order to send to Azure. + + :ivar vpn_sites: List of resource-ids of the vpn-sites for which config is to be downloaded. + :vartype vpn_sites: list[str] + :ivar output_blob_sas_url: The sas-url to download the configurations for vpn-sites. Required. + :vartype output_blob_sas_url: str + """ + + _validation = { + "output_blob_sas_url": {"required": True}, + } + + _attribute_map = { + "vpn_sites": {"key": "vpnSites", "type": "[str]"}, + "output_blob_sas_url": {"key": "outputBlobSasUrl", "type": "str"}, + } + + def __init__(self, *, output_blob_sas_url: str, vpn_sites: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword vpn_sites: List of resource-ids of the vpn-sites for which config is to be downloaded. + :paramtype vpn_sites: list[str] + :keyword output_blob_sas_url: The sas-url to download the configurations for vpn-sites. + Required. + :paramtype output_blob_sas_url: str + """ + super().__init__(**kwargs) + self.vpn_sites = vpn_sites + self.output_blob_sas_url = output_blob_sas_url + + +class GroupByUserSession(_serialization.Model): + """Define user session identifier group by clauses. + + All required parameters must be populated in order to send to Azure. + + :ivar group_by_variables: List of group by clause variables. Required. + :vartype group_by_variables: list[~azure.mgmt.network.v2023_09_01.models.GroupByVariable] + """ + + _validation = { + "group_by_variables": {"required": True}, + } + + _attribute_map = { + "group_by_variables": {"key": "groupByVariables", "type": "[GroupByVariable]"}, + } + + def __init__(self, *, group_by_variables: List["_models.GroupByVariable"], **kwargs: Any) -> None: + """ + :keyword group_by_variables: List of group by clause variables. Required. + :paramtype group_by_variables: list[~azure.mgmt.network.v2023_09_01.models.GroupByVariable] + """ + super().__init__(**kwargs) + self.group_by_variables = group_by_variables + + +class GroupByVariable(_serialization.Model): + """Define user session group by clause variables. + + All required parameters must be populated in order to send to Azure. + + :ivar variable_name: User Session clause variable. Required. Known values are: "ClientAddr", + "GeoLocation", and "None". + :vartype variable_name: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallUserSessionVariable + """ + + _validation = { + "variable_name": {"required": True}, + } + + _attribute_map = { + "variable_name": {"key": "variableName", "type": "str"}, + } + + def __init__( + self, *, variable_name: Union[str, "_models.ApplicationGatewayFirewallUserSessionVariable"], **kwargs: Any + ) -> None: + """ + :keyword variable_name: User Session clause variable. Required. Known values are: "ClientAddr", + "GeoLocation", and "None". + :paramtype variable_name: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallUserSessionVariable + """ + super().__init__(**kwargs) + self.variable_name = variable_name + + +class HopLink(_serialization.Model): + """Hop link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_hop_id: The ID of the next hop. + :vartype next_hop_id: str + :ivar link_type: Link type. + :vartype link_type: str + :ivar issues: List of issues. + :vartype issues: list[~azure.mgmt.network.v2023_09_01.models.ConnectivityIssue] + :ivar context: Provides additional context on links. + :vartype context: dict[str, str] + :ivar resource_id: Resource ID. + :vartype resource_id: str + :ivar round_trip_time_min: Minimum roundtrip time in milliseconds. + :vartype round_trip_time_min: int + :ivar round_trip_time_avg: Average roundtrip time in milliseconds. + :vartype round_trip_time_avg: int + :ivar round_trip_time_max: Maximum roundtrip time in milliseconds. + :vartype round_trip_time_max: int + """ + + _validation = { + "next_hop_id": {"readonly": True}, + "link_type": {"readonly": True}, + "issues": {"readonly": True}, + "context": {"readonly": True}, + "resource_id": {"readonly": True}, + "round_trip_time_min": {"readonly": True, "maximum": 4294967295, "minimum": 0}, + "round_trip_time_avg": {"readonly": True, "maximum": 4294967295, "minimum": 0}, + "round_trip_time_max": {"readonly": True, "maximum": 4294967295, "minimum": 0}, + } + + _attribute_map = { + "next_hop_id": {"key": "nextHopId", "type": "str"}, + "link_type": {"key": "linkType", "type": "str"}, + "issues": {"key": "issues", "type": "[ConnectivityIssue]"}, + "context": {"key": "context", "type": "{str}"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "round_trip_time_min": {"key": "properties.roundTripTimeMin", "type": "int"}, + "round_trip_time_avg": {"key": "properties.roundTripTimeAvg", "type": "int"}, + "round_trip_time_max": {"key": "properties.roundTripTimeMax", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.next_hop_id = None + self.link_type = None + self.issues = None + self.context = None + self.resource_id = None + self.round_trip_time_min = None + self.round_trip_time_avg = None + self.round_trip_time_max = None + + +class HTTPConfiguration(_serialization.Model): + """HTTP configuration of the connectivity check. + + :ivar method: HTTP method. "Get" + :vartype method: str or ~azure.mgmt.network.v2023_09_01.models.HTTPMethod + :ivar headers: List of HTTP headers. + :vartype headers: list[~azure.mgmt.network.v2023_09_01.models.HTTPHeader] + :ivar valid_status_codes: Valid status codes. + :vartype valid_status_codes: list[int] + """ + + _attribute_map = { + "method": {"key": "method", "type": "str"}, + "headers": {"key": "headers", "type": "[HTTPHeader]"}, + "valid_status_codes": {"key": "validStatusCodes", "type": "[int]"}, + } + + def __init__( + self, + *, + method: Optional[Union[str, "_models.HTTPMethod"]] = None, + headers: Optional[List["_models.HTTPHeader"]] = None, + valid_status_codes: Optional[List[int]] = None, + **kwargs: Any + ) -> None: + """ + :keyword method: HTTP method. "Get" + :paramtype method: str or ~azure.mgmt.network.v2023_09_01.models.HTTPMethod + :keyword headers: List of HTTP headers. + :paramtype headers: list[~azure.mgmt.network.v2023_09_01.models.HTTPHeader] + :keyword valid_status_codes: Valid status codes. + :paramtype valid_status_codes: list[int] + """ + super().__init__(**kwargs) + self.method = method + self.headers = headers + self.valid_status_codes = valid_status_codes + + +class HTTPHeader(_serialization.Model): + """The HTTP header. + + :ivar name: The name in HTTP header. + :vartype name: str + :ivar value: The value in HTTP header. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name in HTTP header. + :paramtype name: str + :keyword value: The value in HTTP header. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class Hub(_serialization.Model): + """Hub Item. + + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar resource_type: Resource Type. + :vartype resource_type: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + } + + def __init__( + self, *, resource_id: Optional[str] = None, resource_type: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_id: Resource Id. + :paramtype resource_id: str + :keyword resource_type: Resource Type. + :paramtype resource_type: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.resource_type = resource_type + + +class HubIPAddresses(_serialization.Model): + """IP addresses associated with azure firewall. + + :ivar public_i_ps: Public IP addresses associated with azure firewall. + :vartype public_i_ps: ~azure.mgmt.network.v2023_09_01.models.HubPublicIPAddresses + :ivar private_ip_address: Private IP Address associated with azure firewall. + :vartype private_ip_address: str + """ + + _attribute_map = { + "public_i_ps": {"key": "publicIPs", "type": "HubPublicIPAddresses"}, + "private_ip_address": {"key": "privateIPAddress", "type": "str"}, + } + + def __init__( + self, + *, + public_i_ps: Optional["_models.HubPublicIPAddresses"] = None, + private_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword public_i_ps: Public IP addresses associated with azure firewall. + :paramtype public_i_ps: ~azure.mgmt.network.v2023_09_01.models.HubPublicIPAddresses + :keyword private_ip_address: Private IP Address associated with azure firewall. + :paramtype private_ip_address: str + """ + super().__init__(**kwargs) + self.public_i_ps = public_i_ps + self.private_ip_address = private_ip_address + + +class HubIpConfiguration(SubResource): + """IpConfigurations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the Ip Configuration. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Ipconfiguration type. + :vartype type: str + :ivar private_ip_address: The private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: The reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar public_ip_address: The reference to the public IP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar provisioning_state: The provisioning state of the IP configuration resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "PublicIPAddress"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.Subnet"] = None, + public_ip_address: Optional["_models.PublicIPAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the Ip Configuration. + :paramtype name: str + :keyword private_ip_address: The private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: The reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword public_ip_address: The reference to the public IP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.public_ip_address = public_ip_address + self.provisioning_state = None + + +class HubPublicIPAddresses(_serialization.Model): + """Public IP addresses associated with azure firewall. + + :ivar addresses: The list of Public IP addresses associated with azure firewall or IP addresses + to be retained. + :vartype addresses: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPublicIPAddress] + :ivar count: The number of Public IP addresses associated with azure firewall. + :vartype count: int + """ + + _attribute_map = { + "addresses": {"key": "addresses", "type": "[AzureFirewallPublicIPAddress]"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__( + self, + *, + addresses: Optional[List["_models.AzureFirewallPublicIPAddress"]] = None, + count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword addresses: The list of Public IP addresses associated with azure firewall or IP + addresses to be retained. + :paramtype addresses: list[~azure.mgmt.network.v2023_09_01.models.AzureFirewallPublicIPAddress] + :keyword count: The number of Public IP addresses associated with azure firewall. + :paramtype count: int + """ + super().__init__(**kwargs) + self.addresses = addresses + self.count = count + + +class HubRoute(_serialization.Model): + """RouteTable route. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the Route that is unique within a RouteTable. This name can be used to + access this route. Required. + :vartype name: str + :ivar destination_type: The type of destinations (eg: CIDR, ResourceId, Service). Required. + :vartype destination_type: str + :ivar destinations: List of all destinations. Required. + :vartype destinations: list[str] + :ivar next_hop_type: The type of next hop (eg: ResourceId). Required. + :vartype next_hop_type: str + :ivar next_hop: NextHop resource ID. Required. + :vartype next_hop: str + """ + + _validation = { + "name": {"required": True}, + "destination_type": {"required": True}, + "destinations": {"required": True}, + "next_hop_type": {"required": True}, + "next_hop": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "destination_type": {"key": "destinationType", "type": "str"}, + "destinations": {"key": "destinations", "type": "[str]"}, + "next_hop_type": {"key": "nextHopType", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + destination_type: str, + destinations: List[str], + next_hop_type: str, + next_hop: str, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the Route that is unique within a RouteTable. This name can be used + to access this route. Required. + :paramtype name: str + :keyword destination_type: The type of destinations (eg: CIDR, ResourceId, Service). Required. + :paramtype destination_type: str + :keyword destinations: List of all destinations. Required. + :paramtype destinations: list[str] + :keyword next_hop_type: The type of next hop (eg: ResourceId). Required. + :paramtype next_hop_type: str + :keyword next_hop: NextHop resource ID. Required. + :paramtype next_hop: str + """ + super().__init__(**kwargs) + self.name = name + self.destination_type = destination_type + self.destinations = destinations + self.next_hop_type = next_hop_type + self.next_hop = next_hop + + +class HubRouteTable(SubResource): + """RouteTable resource in a virtual hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar routes: List of all routes. + :vartype routes: list[~azure.mgmt.network.v2023_09_01.models.HubRoute] + :ivar labels: List of labels associated with this route table. + :vartype labels: list[str] + :ivar associated_connections: List of all connections associated with this route table. + :vartype associated_connections: list[str] + :ivar propagating_connections: List of all connections that advertise to this route table. + :vartype propagating_connections: list[str] + :ivar provisioning_state: The provisioning state of the RouteTable resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "associated_connections": {"readonly": True}, + "propagating_connections": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "routes": {"key": "properties.routes", "type": "[HubRoute]"}, + "labels": {"key": "properties.labels", "type": "[str]"}, + "associated_connections": {"key": "properties.associatedConnections", "type": "[str]"}, + "propagating_connections": {"key": "properties.propagatingConnections", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + routes: Optional[List["_models.HubRoute"]] = None, + labels: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword routes: List of all routes. + :paramtype routes: list[~azure.mgmt.network.v2023_09_01.models.HubRoute] + :keyword labels: List of labels associated with this route table. + :paramtype labels: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.routes = routes + self.labels = labels + self.associated_connections = None + self.propagating_connections = None + self.provisioning_state = None + + +class HubVirtualNetworkConnection(SubResource): + """HubVirtualNetworkConnection Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar remote_virtual_network: Reference to the remote virtual network. + :vartype remote_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar allow_hub_to_remote_vnet_transit: Deprecated: VirtualHub to RemoteVnet transit to enabled + or not. + :vartype allow_hub_to_remote_vnet_transit: bool + :ivar allow_remote_vnet_to_use_hub_vnet_gateways: Deprecated: Allow RemoteVnet to use Virtual + Hub's gateways. + :vartype allow_remote_vnet_to_use_hub_vnet_gateways: bool + :ivar enable_internet_security: Enable internet security. + :vartype enable_internet_security: bool + :ivar routing_configuration: The Routing Configuration indicating the associated and propagated + route tables on this connection. + :vartype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + :ivar provisioning_state: The provisioning state of the hub virtual network connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "remote_virtual_network": {"key": "properties.remoteVirtualNetwork", "type": "SubResource"}, + "allow_hub_to_remote_vnet_transit": {"key": "properties.allowHubToRemoteVnetTransit", "type": "bool"}, + "allow_remote_vnet_to_use_hub_vnet_gateways": { + "key": "properties.allowRemoteVnetToUseHubVnetGateways", + "type": "bool", + }, + "enable_internet_security": {"key": "properties.enableInternetSecurity", "type": "bool"}, + "routing_configuration": {"key": "properties.routingConfiguration", "type": "RoutingConfiguration"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + remote_virtual_network: Optional["_models.SubResource"] = None, + allow_hub_to_remote_vnet_transit: Optional[bool] = None, + allow_remote_vnet_to_use_hub_vnet_gateways: Optional[bool] = None, + enable_internet_security: Optional[bool] = None, + routing_configuration: Optional["_models.RoutingConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword remote_virtual_network: Reference to the remote virtual network. + :paramtype remote_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword allow_hub_to_remote_vnet_transit: Deprecated: VirtualHub to RemoteVnet transit to + enabled or not. + :paramtype allow_hub_to_remote_vnet_transit: bool + :keyword allow_remote_vnet_to_use_hub_vnet_gateways: Deprecated: Allow RemoteVnet to use + Virtual Hub's gateways. + :paramtype allow_remote_vnet_to_use_hub_vnet_gateways: bool + :keyword enable_internet_security: Enable internet security. + :paramtype enable_internet_security: bool + :keyword routing_configuration: The Routing Configuration indicating the associated and + propagated route tables on this connection. + :paramtype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.remote_virtual_network = remote_virtual_network + self.allow_hub_to_remote_vnet_transit = allow_hub_to_remote_vnet_transit + self.allow_remote_vnet_to_use_hub_vnet_gateways = allow_remote_vnet_to_use_hub_vnet_gateways + self.enable_internet_security = enable_internet_security + self.routing_configuration = routing_configuration + self.provisioning_state = None + + +class IDPSQueryObject(_serialization.Model): + """Will describe the query to run against the IDPS signatures DB. + + :ivar filters: Contain all filters names and values. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.FilterItems] + :ivar search: Search term in all columns. + :vartype search: str + :ivar order_by: Column to sort response by. + :vartype order_by: ~azure.mgmt.network.v2023_09_01.models.OrderBy + :ivar results_per_page: The number of the results to return in each page. + :vartype results_per_page: int + :ivar skip: The number of records matching the filter to skip. + :vartype skip: int + """ + + _validation = { + "results_per_page": {"maximum": 1000, "minimum": 1}, + } + + _attribute_map = { + "filters": {"key": "filters", "type": "[FilterItems]"}, + "search": {"key": "search", "type": "str"}, + "order_by": {"key": "orderBy", "type": "OrderBy"}, + "results_per_page": {"key": "resultsPerPage", "type": "int"}, + "skip": {"key": "skip", "type": "int"}, + } + + def __init__( + self, + *, + filters: Optional[List["_models.FilterItems"]] = None, + search: Optional[str] = None, + order_by: Optional["_models.OrderBy"] = None, + results_per_page: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword filters: Contain all filters names and values. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.FilterItems] + :keyword search: Search term in all columns. + :paramtype search: str + :keyword order_by: Column to sort response by. + :paramtype order_by: ~azure.mgmt.network.v2023_09_01.models.OrderBy + :keyword results_per_page: The number of the results to return in each page. + :paramtype results_per_page: int + :keyword skip: The number of records matching the filter to skip. + :paramtype skip: int + """ + super().__init__(**kwargs) + self.filters = filters + self.search = search + self.order_by = order_by + self.results_per_page = results_per_page + self.skip = skip + + +class InboundNatPool(SubResource): # pylint: disable=too-many-instance-attributes + """Inbound NAT pool of the load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of inbound NAT pools used by + the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar frontend_ip_configuration: A reference to frontend IP addresses. + :vartype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar protocol: The reference to the transport protocol used by the inbound NAT pool. Known + values are: "Udp", "Tcp", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :ivar frontend_port_range_start: The first port number in the range of external ports that will + be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range + between 1 and 65534. + :vartype frontend_port_range_start: int + :ivar frontend_port_range_end: The last port number in the range of external ports that will be + used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range + between 1 and 65535. + :vartype frontend_port_range_end: int + :ivar backend_port: The port used for internal connections on the endpoint. Acceptable values + are between 1 and 65535. + :vartype backend_port: int + :ivar idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :vartype idle_timeout_in_minutes: int + :ivar enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :vartype enable_floating_ip: bool + :ivar enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected + connection termination. This element is only used when the protocol is set to TCP. + :vartype enable_tcp_reset: bool + :ivar provisioning_state: The provisioning state of the inbound NAT pool resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "frontend_ip_configuration": {"key": "properties.frontendIPConfiguration", "type": "SubResource"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "frontend_port_range_start": {"key": "properties.frontendPortRangeStart", "type": "int"}, + "frontend_port_range_end": {"key": "properties.frontendPortRangeEnd", "type": "int"}, + "backend_port": {"key": "properties.backendPort", "type": "int"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + "enable_floating_ip": {"key": "properties.enableFloatingIP", "type": "bool"}, + "enable_tcp_reset": {"key": "properties.enableTcpReset", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + frontend_ip_configuration: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, + frontend_port_range_start: Optional[int] = None, + frontend_port_range_end: Optional[int] = None, + backend_port: Optional[int] = None, + idle_timeout_in_minutes: Optional[int] = None, + enable_floating_ip: Optional[bool] = None, + enable_tcp_reset: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of inbound NAT pools used + by the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword frontend_ip_configuration: A reference to frontend IP addresses. + :paramtype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: The reference to the transport protocol used by the inbound NAT pool. Known + values are: "Udp", "Tcp", and "All". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :keyword frontend_port_range_start: The first port number in the range of external ports that + will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values + range between 1 and 65534. + :paramtype frontend_port_range_start: int + :keyword frontend_port_range_end: The last port number in the range of external ports that will + be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range + between 1 and 65535. + :paramtype frontend_port_range_end: int + :keyword backend_port: The port used for internal connections on the endpoint. Acceptable + values are between 1 and 65535. + :paramtype backend_port: int + :keyword idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :paramtype idle_timeout_in_minutes: int + :keyword enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :paramtype enable_floating_ip: bool + :keyword enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or + unexpected connection termination. This element is only used when the protocol is set to TCP. + :paramtype enable_tcp_reset: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.frontend_ip_configuration = frontend_ip_configuration + self.protocol = protocol + self.frontend_port_range_start = frontend_port_range_start + self.frontend_port_range_end = frontend_port_range_end + self.backend_port = backend_port + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_floating_ip = enable_floating_ip + self.enable_tcp_reset = enable_tcp_reset + self.provisioning_state = None + + +class InboundNatRule(SubResource): # pylint: disable=too-many-instance-attributes + """Inbound NAT rule of the load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of inbound NAT rules used by + the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar frontend_ip_configuration: A reference to frontend IP addresses. + :vartype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_ip_configuration: A reference to a private IP address defined on a network + interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations + is forwarded to the backend IP. + :vartype backend_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :ivar protocol: The reference to the transport protocol used by the load balancing rule. Known + values are: "Udp", "Tcp", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :ivar frontend_port: The port for the external endpoint. Port numbers for each rule must be + unique within the Load Balancer. Acceptable values range from 1 to 65534. + :vartype frontend_port: int + :ivar backend_port: The port used for the internal endpoint. Acceptable values range from 1 to + 65535. + :vartype backend_port: int + :ivar idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :vartype idle_timeout_in_minutes: int + :ivar enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :vartype enable_floating_ip: bool + :ivar enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected + connection termination. This element is only used when the protocol is set to TCP. + :vartype enable_tcp_reset: bool + :ivar frontend_port_range_start: The port range start for the external endpoint. This property + is used together with BackendAddressPool and FrontendPortRangeEnd. Individual inbound NAT rule + port mappings will be created for each backend address from BackendAddressPool. Acceptable + values range from 1 to 65534. + :vartype frontend_port_range_start: int + :ivar frontend_port_range_end: The port range end for the external endpoint. This property is + used together with BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT rule + port mappings will be created for each backend address from BackendAddressPool. Acceptable + values range from 1 to 65534. + :vartype frontend_port_range_end: int + :ivar backend_address_pool: A reference to backendAddressPool resource. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the inbound NAT rule resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "backend_ip_configuration": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "frontend_ip_configuration": {"key": "properties.frontendIPConfiguration", "type": "SubResource"}, + "backend_ip_configuration": { + "key": "properties.backendIPConfiguration", + "type": "NetworkInterfaceIPConfiguration", + }, + "protocol": {"key": "properties.protocol", "type": "str"}, + "frontend_port": {"key": "properties.frontendPort", "type": "int"}, + "backend_port": {"key": "properties.backendPort", "type": "int"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + "enable_floating_ip": {"key": "properties.enableFloatingIP", "type": "bool"}, + "enable_tcp_reset": {"key": "properties.enableTcpReset", "type": "bool"}, + "frontend_port_range_start": {"key": "properties.frontendPortRangeStart", "type": "int"}, + "frontend_port_range_end": {"key": "properties.frontendPortRangeEnd", "type": "int"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + frontend_ip_configuration: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, + frontend_port: Optional[int] = None, + backend_port: Optional[int] = None, + idle_timeout_in_minutes: Optional[int] = None, + enable_floating_ip: Optional[bool] = None, + enable_tcp_reset: Optional[bool] = None, + frontend_port_range_start: Optional[int] = None, + frontend_port_range_end: Optional[int] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of inbound NAT rules used + by the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword frontend_ip_configuration: A reference to frontend IP addresses. + :paramtype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: The reference to the transport protocol used by the load balancing rule. + Known values are: "Udp", "Tcp", and "All". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :keyword frontend_port: The port for the external endpoint. Port numbers for each rule must be + unique within the Load Balancer. Acceptable values range from 1 to 65534. + :paramtype frontend_port: int + :keyword backend_port: The port used for the internal endpoint. Acceptable values range from 1 + to 65535. + :paramtype backend_port: int + :keyword idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :paramtype idle_timeout_in_minutes: int + :keyword enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :paramtype enable_floating_ip: bool + :keyword enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or + unexpected connection termination. This element is only used when the protocol is set to TCP. + :paramtype enable_tcp_reset: bool + :keyword frontend_port_range_start: The port range start for the external endpoint. This + property is used together with BackendAddressPool and FrontendPortRangeEnd. Individual inbound + NAT rule port mappings will be created for each backend address from BackendAddressPool. + Acceptable values range from 1 to 65534. + :paramtype frontend_port_range_start: int + :keyword frontend_port_range_end: The port range end for the external endpoint. This property + is used together with BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT + rule port mappings will be created for each backend address from BackendAddressPool. Acceptable + values range from 1 to 65534. + :paramtype frontend_port_range_end: int + :keyword backend_address_pool: A reference to backendAddressPool resource. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.frontend_ip_configuration = frontend_ip_configuration + self.backend_ip_configuration = None + self.protocol = protocol + self.frontend_port = frontend_port + self.backend_port = backend_port + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_floating_ip = enable_floating_ip + self.enable_tcp_reset = enable_tcp_reset + self.frontend_port_range_start = frontend_port_range_start + self.frontend_port_range_end = frontend_port_range_end + self.backend_address_pool = backend_address_pool + self.provisioning_state = None + + +class InboundNatRuleListResult(_serialization.Model): + """Response for ListInboundNatRule API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of inbound NAT rules in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[InboundNatRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.InboundNatRule"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of inbound NAT rules in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class InboundNatRulePortMapping(_serialization.Model): + """Individual port mappings for inbound NAT rule created for backend pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar inbound_nat_rule_name: Name of inbound NAT rule. + :vartype inbound_nat_rule_name: str + :ivar protocol: The reference to the transport protocol used by the inbound NAT rule. Known + values are: "Udp", "Tcp", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :ivar frontend_port: Frontend port. + :vartype frontend_port: int + :ivar backend_port: Backend port. + :vartype backend_port: int + """ + + _validation = { + "inbound_nat_rule_name": {"readonly": True}, + "protocol": {"readonly": True}, + "frontend_port": {"readonly": True}, + "backend_port": {"readonly": True}, + } + + _attribute_map = { + "inbound_nat_rule_name": {"key": "inboundNatRuleName", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "frontend_port": {"key": "frontendPort", "type": "int"}, + "backend_port": {"key": "backendPort", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.inbound_nat_rule_name = None + self.protocol = None + self.frontend_port = None + self.backend_port = None + + +class InboundSecurityRule(SubResource): + """NVA Inbound Security Rule resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of security rule collection. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: NVA inbound security rule type. + :vartype type: str + :ivar rules: List of allowed rules. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRules] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "rules": {"key": "properties.rules", "type": "[InboundSecurityRules]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + rules: Optional[List["_models.InboundSecurityRules"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of security rule collection. + :paramtype name: str + :keyword rules: List of allowed rules. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRules] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.rules = rules + self.provisioning_state = None + + +class InboundSecurityRules(_serialization.Model): + """Properties of the Inbound Security Rules resource. + + :ivar protocol: Protocol. This should be either TCP or UDP. Known values are: "TCP" and "UDP". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRulesProtocol + :ivar source_address_prefix: The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are + allowed. + :vartype source_address_prefix: str + :ivar destination_port_range: NVA port ranges to be opened up. One needs to provide specific + ports. + :vartype destination_port_range: int + """ + + _validation = { + "destination_port_range": {"maximum": 65535, "minimum": 0}, + } + + _attribute_map = { + "protocol": {"key": "protocol", "type": "str"}, + "source_address_prefix": {"key": "sourceAddressPrefix", "type": "str"}, + "destination_port_range": {"key": "destinationPortRange", "type": "int"}, + } + + def __init__( + self, + *, + protocol: Optional[Union[str, "_models.InboundSecurityRulesProtocol"]] = None, + source_address_prefix: Optional[str] = None, + destination_port_range: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword protocol: Protocol. This should be either TCP or UDP. Known values are: "TCP" and + "UDP". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRulesProtocol + :keyword source_address_prefix: The CIDR or source IP range. Only /30, /31 and /32 Ip ranges + are allowed. + :paramtype source_address_prefix: str + :keyword destination_port_range: NVA port ranges to be opened up. One needs to provide specific + ports. + :paramtype destination_port_range: int + """ + super().__init__(**kwargs) + self.protocol = protocol + self.source_address_prefix = source_address_prefix + self.destination_port_range = destination_port_range + + +class InternetIngressPublicIpsProperties(_serialization.Model): + """Resource Uri of Public Ip for Standard Load Balancer Frontend End. + + :ivar id: Resource Uri of Public Ip. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource Uri of Public Ip. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class IPAddressAvailabilityResult(_serialization.Model): + """Response for CheckIPAddressAvailability API service call. + + :ivar available: Private IP address availability. + :vartype available: bool + :ivar available_ip_addresses: Contains other available private IP addresses if the asked for + address is taken. + :vartype available_ip_addresses: list[str] + :ivar is_platform_reserved: Private IP address platform reserved. + :vartype is_platform_reserved: bool + """ + + _attribute_map = { + "available": {"key": "available", "type": "bool"}, + "available_ip_addresses": {"key": "availableIPAddresses", "type": "[str]"}, + "is_platform_reserved": {"key": "isPlatformReserved", "type": "bool"}, + } + + def __init__( + self, + *, + available: Optional[bool] = None, + available_ip_addresses: Optional[List[str]] = None, + is_platform_reserved: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword available: Private IP address availability. + :paramtype available: bool + :keyword available_ip_addresses: Contains other available private IP addresses if the asked for + address is taken. + :paramtype available_ip_addresses: list[str] + :keyword is_platform_reserved: Private IP address platform reserved. + :paramtype is_platform_reserved: bool + """ + super().__init__(**kwargs) + self.available = available + self.available_ip_addresses = available_ip_addresses + self.is_platform_reserved = is_platform_reserved + + +class IpAllocation(Resource): # pylint: disable=too-many-instance-attributes + """IpAllocation resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar subnet: The Subnet that using the prefix of this IpAllocation resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar virtual_network: The VirtualNetwork that using the prefix of this IpAllocation resource. + :vartype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar type_properties_type: The type for the IpAllocation. Known values are: "Undefined" and + "Hypernet". + :vartype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.IpAllocationType + :ivar prefix: The address prefix for the IpAllocation. + :vartype prefix: str + :ivar prefix_length: The address prefix length for the IpAllocation. + :vartype prefix_length: int + :ivar prefix_type: The address prefix Type for the IpAllocation. Known values are: "IPv4" and + "IPv6". + :vartype prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :ivar ipam_allocation_id: The IPAM allocation ID. + :vartype ipam_allocation_id: str + :ivar allocation_tags: IpAllocation tags. + :vartype allocation_tags: dict[str, str] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "subnet": {"readonly": True}, + "virtual_network": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "virtual_network": {"key": "properties.virtualNetwork", "type": "SubResource"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "prefix": {"key": "properties.prefix", "type": "str"}, + "prefix_length": {"key": "properties.prefixLength", "type": "int"}, + "prefix_type": {"key": "properties.prefixType", "type": "str"}, + "ipam_allocation_id": {"key": "properties.ipamAllocationId", "type": "str"}, + "allocation_tags": {"key": "properties.allocationTags", "type": "{str}"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + type_properties_type: Optional[Union[str, "_models.IpAllocationType"]] = None, + prefix: Optional[str] = None, + prefix_length: int = 0, + prefix_type: Optional[Union[str, "_models.IPVersion"]] = None, + ipam_allocation_id: Optional[str] = None, + allocation_tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword type_properties_type: The type for the IpAllocation. Known values are: "Undefined" and + "Hypernet". + :paramtype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.IpAllocationType + :keyword prefix: The address prefix for the IpAllocation. + :paramtype prefix: str + :keyword prefix_length: The address prefix length for the IpAllocation. + :paramtype prefix_length: int + :keyword prefix_type: The address prefix Type for the IpAllocation. Known values are: "IPv4" + and "IPv6". + :paramtype prefix_type: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :keyword ipam_allocation_id: The IPAM allocation ID. + :paramtype ipam_allocation_id: str + :keyword allocation_tags: IpAllocation tags. + :paramtype allocation_tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.subnet = None + self.virtual_network = None + self.type_properties_type = type_properties_type + self.prefix = prefix + self.prefix_length = prefix_length + self.prefix_type = prefix_type + self.ipam_allocation_id = ipam_allocation_id + self.allocation_tags = allocation_tags + + +class IpAllocationListResult(_serialization.Model): + """Response for the ListIpAllocations API service call. + + :ivar value: A list of IpAllocation resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IpAllocation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.IpAllocation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of IpAllocation resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IPConfiguration(SubResource): + """IP configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar private_ip_address: The private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: The reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar public_ip_address: The reference to the public IP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar provisioning_state: The provisioning state of the IP configuration resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "PublicIPAddress"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.Subnet"] = None, + public_ip_address: Optional["_models.PublicIPAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword private_ip_address: The private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: The reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword public_ip_address: The reference to the public IP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.public_ip_address = public_ip_address + self.provisioning_state = None + + +class IPConfigurationBgpPeeringAddress(_serialization.Model): + """Properties of IPConfigurationBgpPeeringAddress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ipconfiguration_id: The ID of IP configuration which belongs to gateway. + :vartype ipconfiguration_id: str + :ivar default_bgp_ip_addresses: The list of default BGP peering addresses which belong to IP + configuration. + :vartype default_bgp_ip_addresses: list[str] + :ivar custom_bgp_ip_addresses: The list of custom BGP peering addresses which belong to IP + configuration. + :vartype custom_bgp_ip_addresses: list[str] + :ivar tunnel_ip_addresses: The list of tunnel public IP addresses which belong to IP + configuration. + :vartype tunnel_ip_addresses: list[str] + """ + + _validation = { + "default_bgp_ip_addresses": {"readonly": True}, + "tunnel_ip_addresses": {"readonly": True}, + } + + _attribute_map = { + "ipconfiguration_id": {"key": "ipconfigurationId", "type": "str"}, + "default_bgp_ip_addresses": {"key": "defaultBgpIpAddresses", "type": "[str]"}, + "custom_bgp_ip_addresses": {"key": "customBgpIpAddresses", "type": "[str]"}, + "tunnel_ip_addresses": {"key": "tunnelIpAddresses", "type": "[str]"}, + } + + def __init__( + self, + *, + ipconfiguration_id: Optional[str] = None, + custom_bgp_ip_addresses: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword ipconfiguration_id: The ID of IP configuration which belongs to gateway. + :paramtype ipconfiguration_id: str + :keyword custom_bgp_ip_addresses: The list of custom BGP peering addresses which belong to IP + configuration. + :paramtype custom_bgp_ip_addresses: list[str] + """ + super().__init__(**kwargs) + self.ipconfiguration_id = ipconfiguration_id + self.default_bgp_ip_addresses = None + self.custom_bgp_ip_addresses = custom_bgp_ip_addresses + self.tunnel_ip_addresses = None + + +class IPConfigurationProfile(SubResource): + """IP configuration profile child resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource. This name can be used to access the resource. + :vartype name: str + :ivar type: Sub Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar subnet: The reference to the subnet resource to create a container network interface ip + configuration. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar provisioning_state: The provisioning state of the IP configuration profile resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + subnet: Optional["_models.Subnet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource. This name can be used to access the resource. + :paramtype name: str + :keyword subnet: The reference to the subnet resource to create a container network interface + ip configuration. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + """ + super().__init__(id=id, **kwargs) + self.name = name + self.type = None + self.etag = None + self.subnet = subnet + self.provisioning_state = None + + +class IpGroup(Resource): + """The IpGroups resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the IpGroups resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar ip_addresses: IpAddresses/IpAddressPrefixes in the IpGroups resource. + :vartype ip_addresses: list[str] + :ivar firewalls: List of references to Firewall resources that this IpGroups is associated + with. + :vartype firewalls: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar firewall_policies: List of references to Firewall Policies resources that this IpGroups + is associated with. + :vartype firewall_policies: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "firewalls": {"readonly": True}, + "firewall_policies": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "ip_addresses": {"key": "properties.ipAddresses", "type": "[str]"}, + "firewalls": {"key": "properties.firewalls", "type": "[SubResource]"}, + "firewall_policies": {"key": "properties.firewallPolicies", "type": "[SubResource]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + ip_addresses: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword ip_addresses: IpAddresses/IpAddressPrefixes in the IpGroups resource. + :paramtype ip_addresses: list[str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.provisioning_state = None + self.ip_addresses = ip_addresses + self.firewalls = None + self.firewall_policies = None + + +class IpGroupListResult(_serialization.Model): + """Response for the ListIpGroups API service call. + + :ivar value: The list of IpGroups information resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IpGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.IpGroup"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of IpGroups information resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class IPPrefixesList(_serialization.Model): + """List of SNAT IP Prefixes learnt by firewall to not SNAT. + + :ivar ip_prefixes: IP Prefix value. + :vartype ip_prefixes: list[str] + """ + + _attribute_map = { + "ip_prefixes": {"key": "ipPrefixes", "type": "[str]"}, + } + + def __init__(self, *, ip_prefixes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword ip_prefixes: IP Prefix value. + :paramtype ip_prefixes: list[str] + """ + super().__init__(**kwargs) + self.ip_prefixes = ip_prefixes + + +class IPRule(_serialization.Model): + """IPRule. + + :ivar address_prefix: Specifies the IP or IP range in CIDR format. Only IPV4 address is + allowed. + :vartype address_prefix: str + """ + + _attribute_map = { + "address_prefix": {"key": "addressPrefix", "type": "str"}, + } + + def __init__(self, *, address_prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address_prefix: Specifies the IP or IP range in CIDR format. Only IPV4 address is + allowed. + :paramtype address_prefix: str + """ + super().__init__(**kwargs) + self.address_prefix = address_prefix + + +class IpsecPolicy(_serialization.Model): + """An IPSec Policy configuration for a virtual network gateway connection. + + All required parameters must be populated in order to send to Azure. + + :ivar sa_life_time_seconds: The IPSec Security Association (also called Quick Mode or Phase 2 + SA) lifetime in seconds for a site to site VPN tunnel. Required. + :vartype sa_life_time_seconds: int + :ivar sa_data_size_kilobytes: The IPSec Security Association (also called Quick Mode or Phase 2 + SA) payload size in KB for a site to site VPN tunnel. Required. + :vartype sa_data_size_kilobytes: int + :ivar ipsec_encryption: The IPSec encryption algorithm (IKE phase 1). Required. Known values + are: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", and + "GCMAES256". + :vartype ipsec_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IpsecEncryption + :ivar ipsec_integrity: The IPSec integrity algorithm (IKE phase 1). Required. Known values are: + "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", and "GCMAES256". + :vartype ipsec_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IpsecIntegrity + :ivar ike_encryption: The IKE encryption algorithm (IKE phase 2). Required. Known values are: + "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", and "GCMAES128". + :vartype ike_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IkeEncryption + :ivar ike_integrity: The IKE integrity algorithm (IKE phase 2). Required. Known values are: + "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", and "GCMAES128". + :vartype ike_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IkeIntegrity + :ivar dh_group: The DH Group used in IKE Phase 1 for initial SA. Required. Known values are: + "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", and + "DHGroup24". + :vartype dh_group: str or ~azure.mgmt.network.v2023_09_01.models.DhGroup + :ivar pfs_group: The Pfs Group used in IKE Phase 2 for new child SA. Required. Known values + are: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", and "PFSMM". + :vartype pfs_group: str or ~azure.mgmt.network.v2023_09_01.models.PfsGroup + """ + + _validation = { + "sa_life_time_seconds": {"required": True}, + "sa_data_size_kilobytes": {"required": True}, + "ipsec_encryption": {"required": True}, + "ipsec_integrity": {"required": True}, + "ike_encryption": {"required": True}, + "ike_integrity": {"required": True}, + "dh_group": {"required": True}, + "pfs_group": {"required": True}, + } + + _attribute_map = { + "sa_life_time_seconds": {"key": "saLifeTimeSeconds", "type": "int"}, + "sa_data_size_kilobytes": {"key": "saDataSizeKilobytes", "type": "int"}, + "ipsec_encryption": {"key": "ipsecEncryption", "type": "str"}, + "ipsec_integrity": {"key": "ipsecIntegrity", "type": "str"}, + "ike_encryption": {"key": "ikeEncryption", "type": "str"}, + "ike_integrity": {"key": "ikeIntegrity", "type": "str"}, + "dh_group": {"key": "dhGroup", "type": "str"}, + "pfs_group": {"key": "pfsGroup", "type": "str"}, + } + + def __init__( + self, + *, + sa_life_time_seconds: int, + sa_data_size_kilobytes: int, + ipsec_encryption: Union[str, "_models.IpsecEncryption"], + ipsec_integrity: Union[str, "_models.IpsecIntegrity"], + ike_encryption: Union[str, "_models.IkeEncryption"], + ike_integrity: Union[str, "_models.IkeIntegrity"], + dh_group: Union[str, "_models.DhGroup"], + pfs_group: Union[str, "_models.PfsGroup"], + **kwargs: Any + ) -> None: + """ + :keyword sa_life_time_seconds: The IPSec Security Association (also called Quick Mode or Phase + 2 SA) lifetime in seconds for a site to site VPN tunnel. Required. + :paramtype sa_life_time_seconds: int + :keyword sa_data_size_kilobytes: The IPSec Security Association (also called Quick Mode or + Phase 2 SA) payload size in KB for a site to site VPN tunnel. Required. + :paramtype sa_data_size_kilobytes: int + :keyword ipsec_encryption: The IPSec encryption algorithm (IKE phase 1). Required. Known values + are: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", and + "GCMAES256". + :paramtype ipsec_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IpsecEncryption + :keyword ipsec_integrity: The IPSec integrity algorithm (IKE phase 1). Required. Known values + are: "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", and "GCMAES256". + :paramtype ipsec_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IpsecIntegrity + :keyword ike_encryption: The IKE encryption algorithm (IKE phase 2). Required. Known values + are: "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", and "GCMAES128". + :paramtype ike_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IkeEncryption + :keyword ike_integrity: The IKE integrity algorithm (IKE phase 2). Required. Known values are: + "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", and "GCMAES128". + :paramtype ike_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IkeIntegrity + :keyword dh_group: The DH Group used in IKE Phase 1 for initial SA. Required. Known values are: + "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", and + "DHGroup24". + :paramtype dh_group: str or ~azure.mgmt.network.v2023_09_01.models.DhGroup + :keyword pfs_group: The Pfs Group used in IKE Phase 2 for new child SA. Required. Known values + are: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", and "PFSMM". + :paramtype pfs_group: str or ~azure.mgmt.network.v2023_09_01.models.PfsGroup + """ + super().__init__(**kwargs) + self.sa_life_time_seconds = sa_life_time_seconds + self.sa_data_size_kilobytes = sa_data_size_kilobytes + self.ipsec_encryption = ipsec_encryption + self.ipsec_integrity = ipsec_integrity + self.ike_encryption = ike_encryption + self.ike_integrity = ike_integrity + self.dh_group = dh_group + self.pfs_group = pfs_group + + +class IpTag(_serialization.Model): + """Contains the IpTag associated with the object. + + :ivar ip_tag_type: The IP tag type. Example: FirstPartyUsage. + :vartype ip_tag_type: str + :ivar tag: The value of the IP tag associated with the public IP. Example: SQL. + :vartype tag: str + """ + + _attribute_map = { + "ip_tag_type": {"key": "ipTagType", "type": "str"}, + "tag": {"key": "tag", "type": "str"}, + } + + def __init__(self, *, ip_tag_type: Optional[str] = None, tag: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ip_tag_type: The IP tag type. Example: FirstPartyUsage. + :paramtype ip_tag_type: str + :keyword tag: The value of the IP tag associated with the public IP. Example: SQL. + :paramtype tag: str + """ + super().__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag + + +class Ipv6CircuitConnectionConfig(_serialization.Model): + """IPv6 Circuit Connection properties for global reach. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address_prefix: /125 IP address space to carve out customer addresses for global reach. + :vartype address_prefix: str + :ivar circuit_connection_status: Express Route Circuit connection state. Known values are: + "Connected", "Connecting", and "Disconnected". + :vartype circuit_connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.CircuitConnectionStatus + """ + + _validation = { + "circuit_connection_status": {"readonly": True}, + } + + _attribute_map = { + "address_prefix": {"key": "addressPrefix", "type": "str"}, + "circuit_connection_status": {"key": "circuitConnectionStatus", "type": "str"}, + } + + def __init__(self, *, address_prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address_prefix: /125 IP address space to carve out customer addresses for global + reach. + :paramtype address_prefix: str + """ + super().__init__(**kwargs) + self.address_prefix = address_prefix + self.circuit_connection_status = None + + +class Ipv6ExpressRouteCircuitPeeringConfig(_serialization.Model): + """Contains IPv6 peering config. + + :ivar primary_peer_address_prefix: The primary address prefix. + :vartype primary_peer_address_prefix: str + :ivar secondary_peer_address_prefix: The secondary address prefix. + :vartype secondary_peer_address_prefix: str + :ivar microsoft_peering_config: The Microsoft peering configuration. + :vartype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :ivar route_filter: The reference to the RouteFilter resource. + :vartype route_filter: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar state: The state of peering. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringState + """ + + _attribute_map = { + "primary_peer_address_prefix": {"key": "primaryPeerAddressPrefix", "type": "str"}, + "secondary_peer_address_prefix": {"key": "secondaryPeerAddressPrefix", "type": "str"}, + "microsoft_peering_config": {"key": "microsoftPeeringConfig", "type": "ExpressRouteCircuitPeeringConfig"}, + "route_filter": {"key": "routeFilter", "type": "SubResource"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, + *, + primary_peer_address_prefix: Optional[str] = None, + secondary_peer_address_prefix: Optional[str] = None, + microsoft_peering_config: Optional["_models.ExpressRouteCircuitPeeringConfig"] = None, + route_filter: Optional["_models.SubResource"] = None, + state: Optional[Union[str, "_models.ExpressRouteCircuitPeeringState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword primary_peer_address_prefix: The primary address prefix. + :paramtype primary_peer_address_prefix: str + :keyword secondary_peer_address_prefix: The secondary address prefix. + :paramtype secondary_peer_address_prefix: str + :keyword microsoft_peering_config: The Microsoft peering configuration. + :paramtype microsoft_peering_config: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringConfig + :keyword route_filter: The reference to the RouteFilter resource. + :paramtype route_filter: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword state: The state of peering. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeeringState + """ + super().__init__(**kwargs) + self.primary_peer_address_prefix = primary_peer_address_prefix + self.secondary_peer_address_prefix = secondary_peer_address_prefix + self.microsoft_peering_config = microsoft_peering_config + self.route_filter = route_filter + self.state = state + + +class ListHubRouteTablesResult(_serialization.Model): + """List of RouteTables and a URL nextLink to get the next set of results. + + :ivar value: List of RouteTables. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[HubRouteTable]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.HubRouteTable"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of RouteTables. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListHubVirtualNetworkConnectionsResult(_serialization.Model): + """List of HubVirtualNetworkConnections and a URL nextLink to get the next set of results. + + :ivar value: List of HubVirtualNetworkConnections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[HubVirtualNetworkConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.HubVirtualNetworkConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of HubVirtualNetworkConnections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListP2SVpnGatewaysResult(_serialization.Model): + """Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL + nextLink to get the next set of results. + + :ivar value: List of P2SVpnGateways. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[P2SVpnGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.P2SVpnGateway"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of P2SVpnGateways. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListRouteMapsResult(_serialization.Model): + """List of RouteMaps and a URL nextLink to get the next set of results. + + :ivar value: List of RouteMaps. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RouteMap]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RouteMap"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of RouteMaps. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListRoutingIntentResult(_serialization.Model): + """List of the routing intent result and a URL nextLink to get the next set of results. + + :ivar value: List of RoutingIntent resource. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RoutingIntent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RoutingIntent"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of RoutingIntent resource. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualHubBgpConnectionResults(_serialization.Model): + """VirtualHubBgpConnections list. + + :ivar value: The list of VirtualHubBgpConnections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BgpConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BgpConnection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of VirtualHubBgpConnections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualHubIpConfigurationResults(_serialization.Model): + """VirtualHubIpConfigurations list. + + :ivar value: The list of VirtualHubIpConfigurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[HubIpConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.HubIpConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of VirtualHubIpConfigurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualHubRouteTableV2SResult(_serialization.Model): + """List of VirtualHubRouteTableV2s and a URL nextLink to get the next set of results. + + :ivar value: List of VirtualHubRouteTableV2s. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualHubRouteTableV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualHubRouteTableV2"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of VirtualHubRouteTableV2s. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualHubsResult(_serialization.Model): + """Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink + to get the next set of results. + + :ivar value: List of VirtualHubs. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualHub]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualHub"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of VirtualHubs. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualNetworkGatewayNatRulesResult(_serialization.Model): + """Result of the request to list all nat rules to a virtual network gateway. It contains a list of + Nat rules and a URL nextLink to get the next set of results. + + :ivar value: List of Nat Rules. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkGatewayNatRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualNetworkGatewayNatRule"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Nat Rules. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVirtualWANsResult(_serialization.Model): + """Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink + to get the next set of results. + + :ivar value: List of VirtualWANs. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualWAN]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualWAN"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of VirtualWANs. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnConnectionsResult(_serialization.Model): + """Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a + list of Vpn Connections and a URL nextLink to get the next set of results. + + :ivar value: List of Vpn Connections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VpnConnection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Vpn Connections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnGatewayNatRulesResult(_serialization.Model): + """Result of the request to list all nat rules to a virtual wan vpn gateway. It contains a list of + Nat rules and a URL nextLink to get the next set of results. + + :ivar value: List of Nat Rules. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnGatewayNatRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VpnGatewayNatRule"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Nat Rules. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnGatewaysResult(_serialization.Model): + """Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink + to get the next set of results. + + :ivar value: List of VpnGateways. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VpnGateway"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnGateways. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnServerConfigurationPolicyGroupsResult(_serialization.Model): + """Result of the request to list VpnServerConfigurationPolicyGroups. It contains a list of + VpnServerConfigurationPolicyGroups and a URL nextLink to get the next set of results. + + :ivar value: List of VpnServerConfigurationPolicyGroups. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnServerConfigurationPolicyGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VpnServerConfigurationPolicyGroup"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnServerConfigurationPolicyGroups. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnServerConfigurationsResult(_serialization.Model): + """Result of the request to list all VpnServerConfigurations. It contains a list of + VpnServerConfigurations and a URL nextLink to get the next set of results. + + :ivar value: List of VpnServerConfigurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnServerConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VpnServerConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnServerConfigurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnSiteLinkConnectionsResult(_serialization.Model): + """Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a + list of Vpn Connections and a URL nextLink to get the next set of results. + + :ivar value: List of VpnSiteLinkConnections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnSiteLinkConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VpnSiteLinkConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnSiteLinkConnections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnSiteLinksResult(_serialization.Model): + """Result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks and a URL + nextLink to get the next set of results. + + :ivar value: List of VpnSitesLinks. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnSiteLink]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VpnSiteLink"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnSitesLinks. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListVpnSitesResult(_serialization.Model): + """Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to + get the next set of results. + + :ivar value: List of VpnSites. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnSite]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VpnSite"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of VpnSites. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LoadBalancer(Resource): # pylint: disable=too-many-instance-attributes + """LoadBalancer resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the load balancer. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar sku: The load balancer SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar frontend_ip_configurations: Object representing the frontend IPs to be used for the load + balancer. + :vartype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :ivar backend_address_pools: Collection of backend address pools used by a load balancer. + :vartype backend_address_pools: list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :ivar load_balancing_rules: Object collection representing the load balancing rules Gets the + provisioning. + :vartype load_balancing_rules: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + :ivar probes: Collection of probe objects used in the load balancer. + :vartype probes: list[~azure.mgmt.network.v2023_09_01.models.Probe] + :ivar inbound_nat_rules: Collection of inbound NAT Rules used by a load balancer. Defining + inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT + pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are + associated with individual virtual machines cannot reference an Inbound NAT pool. They have to + reference individual inbound NAT rules. + :vartype inbound_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :ivar inbound_nat_pools: Defines an external port range for inbound NAT to a single backend + port on NICs associated with a load balancer. Inbound NAT rules are created automatically for + each NIC associated with the Load Balancer using an external port from this range. Defining an + Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT rules. + Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with + individual virtual machines cannot reference an inbound NAT pool. They have to reference + individual inbound NAT rules. + :vartype inbound_nat_pools: list[~azure.mgmt.network.v2023_09_01.models.InboundNatPool] + :ivar outbound_rules: The outbound rules. + :vartype outbound_rules: list[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + :ivar resource_guid: The resource GUID property of the load balancer resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the load balancer resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "sku": {"key": "sku", "type": "LoadBalancerSku"}, + "etag": {"key": "etag", "type": "str"}, + "frontend_ip_configurations": { + "key": "properties.frontendIPConfigurations", + "type": "[FrontendIPConfiguration]", + }, + "backend_address_pools": {"key": "properties.backendAddressPools", "type": "[BackendAddressPool]"}, + "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[LoadBalancingRule]"}, + "probes": {"key": "properties.probes", "type": "[Probe]"}, + "inbound_nat_rules": {"key": "properties.inboundNatRules", "type": "[InboundNatRule]"}, + "inbound_nat_pools": {"key": "properties.inboundNatPools", "type": "[InboundNatPool]"}, + "outbound_rules": {"key": "properties.outboundRules", "type": "[OutboundRule]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + sku: Optional["_models.LoadBalancerSku"] = None, + frontend_ip_configurations: Optional[List["_models.FrontendIPConfiguration"]] = None, + backend_address_pools: Optional[List["_models.BackendAddressPool"]] = None, + load_balancing_rules: Optional[List["_models.LoadBalancingRule"]] = None, + probes: Optional[List["_models.Probe"]] = None, + inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, + inbound_nat_pools: Optional[List["_models.InboundNatPool"]] = None, + outbound_rules: Optional[List["_models.OutboundRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the load balancer. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword sku: The load balancer SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSku + :keyword frontend_ip_configurations: Object representing the frontend IPs to be used for the + load balancer. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :keyword backend_address_pools: Collection of backend address pools used by a load balancer. + :paramtype backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :keyword load_balancing_rules: Object collection representing the load balancing rules Gets the + provisioning. + :paramtype load_balancing_rules: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + :keyword probes: Collection of probe objects used in the load balancer. + :paramtype probes: list[~azure.mgmt.network.v2023_09_01.models.Probe] + :keyword inbound_nat_rules: Collection of inbound NAT Rules used by a load balancer. Defining + inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT + pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are + associated with individual virtual machines cannot reference an Inbound NAT pool. They have to + reference individual inbound NAT rules. + :paramtype inbound_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :keyword inbound_nat_pools: Defines an external port range for inbound NAT to a single backend + port on NICs associated with a load balancer. Inbound NAT rules are created automatically for + each NIC associated with the Load Balancer using an external port from this range. Defining an + Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT rules. + Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with + individual virtual machines cannot reference an inbound NAT pool. They have to reference + individual inbound NAT rules. + :paramtype inbound_nat_pools: list[~azure.mgmt.network.v2023_09_01.models.InboundNatPool] + :keyword outbound_rules: The outbound rules. + :paramtype outbound_rules: list[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.sku = sku + self.etag = None + self.frontend_ip_configurations = frontend_ip_configurations + self.backend_address_pools = backend_address_pools + self.load_balancing_rules = load_balancing_rules + self.probes = probes + self.inbound_nat_rules = inbound_nat_rules + self.inbound_nat_pools = inbound_nat_pools + self.outbound_rules = outbound_rules + self.resource_guid = None + self.provisioning_state = None + + +class LoadBalancerBackendAddress(_serialization.Model): + """Load balancer backend addresses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the backend address. + :vartype name: str + :ivar virtual_network: Reference to an existing virtual network. + :vartype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar subnet: Reference to an existing subnet. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar ip_address: IP Address belonging to the referenced virtual network. + :vartype ip_address: str + :ivar network_interface_ip_configuration: Reference to IP address defined in network + interfaces. + :vartype network_interface_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar load_balancer_frontend_ip_configuration: Reference to the frontend ip address + configuration defined in regional loadbalancer. + :vartype load_balancer_frontend_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar inbound_nat_rules_port_mapping: Collection of inbound NAT rule port mappings. + :vartype inbound_nat_rules_port_mapping: + list[~azure.mgmt.network.v2023_09_01.models.NatRulePortMapping] + :ivar admin_state: A list of administrative states which once set can override health probe so + that Load Balancer will always forward new connections to backend, or deny new connections and + reset existing connections. Known values are: "None", "Up", and "Down". + :vartype admin_state: str or + ~azure.mgmt.network.v2023_09_01.models.LoadBalancerBackendAddressAdminState + """ + + _validation = { + "network_interface_ip_configuration": {"readonly": True}, + "inbound_nat_rules_port_mapping": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "virtual_network": {"key": "properties.virtualNetwork", "type": "SubResource"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "network_interface_ip_configuration": { + "key": "properties.networkInterfaceIPConfiguration", + "type": "SubResource", + }, + "load_balancer_frontend_ip_configuration": { + "key": "properties.loadBalancerFrontendIPConfiguration", + "type": "SubResource", + }, + "inbound_nat_rules_port_mapping": { + "key": "properties.inboundNatRulesPortMapping", + "type": "[NatRulePortMapping]", + }, + "admin_state": {"key": "properties.adminState", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + virtual_network: Optional["_models.SubResource"] = None, + subnet: Optional["_models.SubResource"] = None, + ip_address: Optional[str] = None, + load_balancer_frontend_ip_configuration: Optional["_models.SubResource"] = None, + admin_state: Optional[Union[str, "_models.LoadBalancerBackendAddressAdminState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the backend address. + :paramtype name: str + :keyword virtual_network: Reference to an existing virtual network. + :paramtype virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword subnet: Reference to an existing subnet. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword ip_address: IP Address belonging to the referenced virtual network. + :paramtype ip_address: str + :keyword load_balancer_frontend_ip_configuration: Reference to the frontend ip address + configuration defined in regional loadbalancer. + :paramtype load_balancer_frontend_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword admin_state: A list of administrative states which once set can override health probe + so that Load Balancer will always forward new connections to backend, or deny new connections + and reset existing connections. Known values are: "None", "Up", and "Down". + :paramtype admin_state: str or + ~azure.mgmt.network.v2023_09_01.models.LoadBalancerBackendAddressAdminState + """ + super().__init__(**kwargs) + self.name = name + self.virtual_network = virtual_network + self.subnet = subnet + self.ip_address = ip_address + self.network_interface_ip_configuration = None + self.load_balancer_frontend_ip_configuration = load_balancer_frontend_ip_configuration + self.inbound_nat_rules_port_mapping = None + self.admin_state = admin_state + + +class LoadBalancerBackendAddressPoolListResult(_serialization.Model): + """Response for ListBackendAddressPool API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of backend address pools in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BackendAddressPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.BackendAddressPool"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of backend address pools in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerFrontendIPConfigurationListResult(_serialization.Model): + """Response for ListFrontendIPConfiguration API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of frontend IP configurations in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FrontendIPConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FrontendIPConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of frontend IP configurations in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerListResult(_serialization.Model): + """Response for ListLoadBalancers API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of load balancers in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LoadBalancer]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.LoadBalancer"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of load balancers in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerLoadBalancingRuleListResult(_serialization.Model): + """Response for ListLoadBalancingRule API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of load balancing rules in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LoadBalancingRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.LoadBalancingRule"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of load balancing rules in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerOutboundRuleListResult(_serialization.Model): + """Response for ListOutboundRule API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of outbound rules in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OutboundRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.OutboundRule"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of outbound rules in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerProbeListResult(_serialization.Model): + """Response for ListProbe API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of probes in a load balancer. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.Probe] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Probe]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Probe"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of probes in a load balancer. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.Probe] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LoadBalancerSku(_serialization.Model): + """SKU of a load balancer. + + :ivar name: Name of a load balancer SKU. Known values are: "Basic", "Standard", and "Gateway". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSkuName + :ivar tier: Tier of a load balancer SKU. Known values are: "Regional", "Global", and "Global". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSkuTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.LoadBalancerSkuName"]] = None, + tier: Optional[Union[str, "_models.LoadBalancerSkuTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of a load balancer SKU. Known values are: "Basic", "Standard", and + "Gateway". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSkuName + :keyword tier: Tier of a load balancer SKU. Known values are: "Regional", "Global", and + "Global". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.LoadBalancerSkuTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class LoadBalancerVipSwapRequest(_serialization.Model): + """The request for a VIP swap. + + :ivar frontend_ip_configurations: A list of frontend IP configuration resources that should + swap VIPs. + :vartype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequestFrontendIPConfiguration] + """ + + _attribute_map = { + "frontend_ip_configurations": { + "key": "frontendIPConfigurations", + "type": "[LoadBalancerVipSwapRequestFrontendIPConfiguration]", + }, + } + + def __init__( + self, + *, + frontend_ip_configurations: Optional[List["_models.LoadBalancerVipSwapRequestFrontendIPConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword frontend_ip_configurations: A list of frontend IP configuration resources that should + swap VIPs. + :paramtype frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequestFrontendIPConfiguration] + """ + super().__init__(**kwargs) + self.frontend_ip_configurations = frontend_ip_configurations + + +class LoadBalancerVipSwapRequestFrontendIPConfiguration(_serialization.Model): + """VIP swap request's frontend IP configuration object. + + :ivar id: The ID of frontend IP configuration resource. + :vartype id: str + :ivar public_ip_address: A reference to public IP address resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "SubResource"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + public_ip_address: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The ID of frontend IP configuration resource. + :paramtype id: str + :keyword public_ip_address: A reference to public IP address resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.id = id + self.public_ip_address = public_ip_address + + +class LoadBalancingRule(SubResource): # pylint: disable=too-many-instance-attributes + """A load balancing rule for a load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of load balancing rules used + by the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar frontend_ip_configuration: A reference to frontend IP addresses. + :vartype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_address_pool: A reference to a pool of DIPs. Inbound traffic is randomly load + balanced across IPs in the backend IPs. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar backend_address_pools: An array of references to pool of DIPs. + :vartype backend_address_pools: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar probe: The reference to the load balancer probe used by the load balancing rule. + :vartype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar protocol: The reference to the transport protocol used by the load balancing rule. Known + values are: "Udp", "Tcp", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :ivar load_distribution: The load distribution policy for this rule. Known values are: + "Default", "SourceIP", and "SourceIPProtocol". + :vartype load_distribution: str or ~azure.mgmt.network.v2023_09_01.models.LoadDistribution + :ivar frontend_port: The port for the external endpoint. Port numbers for each rule must be + unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 + enables "Any Port". + :vartype frontend_port: int + :ivar backend_port: The port used for internal connections on the endpoint. Acceptable values + are between 0 and 65535. Note that value 0 enables "Any Port". + :vartype backend_port: int + :ivar idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :vartype idle_timeout_in_minutes: int + :ivar enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :vartype enable_floating_ip: bool + :ivar enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected + connection termination. This element is only used when the protocol is set to TCP. + :vartype enable_tcp_reset: bool + :ivar disable_outbound_snat: Configures SNAT for the VMs in the backend pool to use the + publicIP address specified in the frontend of the load balancing rule. + :vartype disable_outbound_snat: bool + :ivar provisioning_state: The provisioning state of the load balancing rule resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "frontend_ip_configuration": {"key": "properties.frontendIPConfiguration", "type": "SubResource"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "backend_address_pools": {"key": "properties.backendAddressPools", "type": "[SubResource]"}, + "probe": {"key": "properties.probe", "type": "SubResource"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "load_distribution": {"key": "properties.loadDistribution", "type": "str"}, + "frontend_port": {"key": "properties.frontendPort", "type": "int"}, + "backend_port": {"key": "properties.backendPort", "type": "int"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + "enable_floating_ip": {"key": "properties.enableFloatingIP", "type": "bool"}, + "enable_tcp_reset": {"key": "properties.enableTcpReset", "type": "bool"}, + "disable_outbound_snat": {"key": "properties.disableOutboundSnat", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + frontend_ip_configuration: Optional["_models.SubResource"] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + backend_address_pools: Optional[List["_models.SubResource"]] = None, + probe: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, + load_distribution: Optional[Union[str, "_models.LoadDistribution"]] = None, + frontend_port: Optional[int] = None, + backend_port: Optional[int] = None, + idle_timeout_in_minutes: Optional[int] = None, + enable_floating_ip: Optional[bool] = None, + enable_tcp_reset: Optional[bool] = None, + disable_outbound_snat: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of load balancing rules + used by the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword frontend_ip_configuration: A reference to frontend IP addresses. + :paramtype frontend_ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_address_pool: A reference to a pool of DIPs. Inbound traffic is randomly load + balanced across IPs in the backend IPs. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword backend_address_pools: An array of references to pool of DIPs. + :paramtype backend_address_pools: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword probe: The reference to the load balancer probe used by the load balancing rule. + :paramtype probe: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: The reference to the transport protocol used by the load balancing rule. + Known values are: "Udp", "Tcp", and "All". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.TransportProtocol + :keyword load_distribution: The load distribution policy for this rule. Known values are: + "Default", "SourceIP", and "SourceIPProtocol". + :paramtype load_distribution: str or ~azure.mgmt.network.v2023_09_01.models.LoadDistribution + :keyword frontend_port: The port for the external endpoint. Port numbers for each rule must be + unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 + enables "Any Port". + :paramtype frontend_port: int + :keyword backend_port: The port used for internal connections on the endpoint. Acceptable + values are between 0 and 65535. Note that value 0 enables "Any Port". + :paramtype backend_port: int + :keyword idle_timeout_in_minutes: The timeout for the TCP idle connection. The value can be set + between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the + protocol is set to TCP. + :paramtype idle_timeout_in_minutes: int + :keyword enable_floating_ip: Configures a virtual machine's endpoint for the floating IP + capability required to configure a SQL AlwaysOn Availability Group. This setting is required + when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed + after you create the endpoint. + :paramtype enable_floating_ip: bool + :keyword enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or + unexpected connection termination. This element is only used when the protocol is set to TCP. + :paramtype enable_tcp_reset: bool + :keyword disable_outbound_snat: Configures SNAT for the VMs in the backend pool to use the + publicIP address specified in the frontend of the load balancing rule. + :paramtype disable_outbound_snat: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.frontend_ip_configuration = frontend_ip_configuration + self.backend_address_pool = backend_address_pool + self.backend_address_pools = backend_address_pools + self.probe = probe + self.protocol = protocol + self.load_distribution = load_distribution + self.frontend_port = frontend_port + self.backend_port = backend_port + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_floating_ip = enable_floating_ip + self.enable_tcp_reset = enable_tcp_reset + self.disable_outbound_snat = disable_outbound_snat + self.provisioning_state = None + + +class LocalNetworkGateway(Resource): # pylint: disable=too-many-instance-attributes + """A common class for general resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar local_network_address_space: Local network site address space. + :vartype local_network_address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar gateway_ip_address: IP address of local network gateway. + :vartype gateway_ip_address: str + :ivar fqdn: FQDN of local network gateway. + :vartype fqdn: str + :ivar bgp_settings: Local network gateway's BGP speaker settings. + :vartype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :ivar resource_guid: The resource GUID property of the local network gateway resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the local network gateway resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "local_network_address_space": {"key": "properties.localNetworkAddressSpace", "type": "AddressSpace"}, + "gateway_ip_address": {"key": "properties.gatewayIpAddress", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "bgp_settings": {"key": "properties.bgpSettings", "type": "BgpSettings"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + local_network_address_space: Optional["_models.AddressSpace"] = None, + gateway_ip_address: Optional[str] = None, + fqdn: Optional[str] = None, + bgp_settings: Optional["_models.BgpSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword local_network_address_space: Local network site address space. + :paramtype local_network_address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword gateway_ip_address: IP address of local network gateway. + :paramtype gateway_ip_address: str + :keyword fqdn: FQDN of local network gateway. + :paramtype fqdn: str + :keyword bgp_settings: Local network gateway's BGP speaker settings. + :paramtype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.local_network_address_space = local_network_address_space + self.gateway_ip_address = gateway_ip_address + self.fqdn = fqdn + self.bgp_settings = bgp_settings + self.resource_guid = None + self.provisioning_state = None + + +class LocalNetworkGatewayListResult(_serialization.Model): + """Response for ListLocalNetworkGateways API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of local network gateways that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LocalNetworkGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.LocalNetworkGateway"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of local network gateways that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LogSpecification(_serialization.Model): + """Description of logging specification. + + :ivar name: The name of the specification. + :vartype name: str + :ivar display_name: The display name of the specification. + :vartype display_name: str + :ivar blob_duration: Duration of the blob. + :vartype blob_duration: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the specification. + :paramtype name: str + :keyword display_name: The display name of the specification. + :paramtype display_name: str + :keyword blob_duration: Duration of the blob. + :paramtype blob_duration: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedRuleGroupOverride(_serialization.Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_group_name: The managed rule group to override. Required. + :vartype rule_group_name: str + :ivar rules: List of rules that will be disabled. If none specified, all rules in the group + will be disabled. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleOverride] + """ + + _validation = { + "rule_group_name": {"required": True}, + } + + _attribute_map = { + "rule_group_name": {"key": "ruleGroupName", "type": "str"}, + "rules": {"key": "rules", "type": "[ManagedRuleOverride]"}, + } + + def __init__( + self, *, rule_group_name: str, rules: Optional[List["_models.ManagedRuleOverride"]] = None, **kwargs: Any + ) -> None: + """ + :keyword rule_group_name: The managed rule group to override. Required. + :paramtype rule_group_name: str + :keyword rules: List of rules that will be disabled. If none specified, all rules in the group + will be disabled. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleOverride] + """ + super().__init__(**kwargs) + self.rule_group_name = rule_group_name + self.rules = rules + + +class ManagedRuleOverride(_serialization.Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_id: Identifier for the managed rule. Required. + :vartype rule_id: str + :ivar state: The state of the managed rule. Defaults to Disabled if not specified. Known values + are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.ManagedRuleEnabledState + :ivar action: Describes the override action to be applied when rule matches. Known values are: + "AnomalyScoring", "Allow", "Block", "Log", and "JSChallenge". + :vartype action: str or ~azure.mgmt.network.v2023_09_01.models.ActionType + """ + + _validation = { + "rule_id": {"required": True}, + } + + _attribute_map = { + "rule_id": {"key": "ruleId", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__( + self, + *, + rule_id: str, + state: Optional[Union[str, "_models.ManagedRuleEnabledState"]] = None, + action: Optional[Union[str, "_models.ActionType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_id: Identifier for the managed rule. Required. + :paramtype rule_id: str + :keyword state: The state of the managed rule. Defaults to Disabled if not specified. Known + values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.ManagedRuleEnabledState + :keyword action: Describes the override action to be applied when rule matches. Known values + are: "AnomalyScoring", "Allow", "Block", "Log", and "JSChallenge". + :paramtype action: str or ~azure.mgmt.network.v2023_09_01.models.ActionType + """ + super().__init__(**kwargs) + self.rule_id = rule_id + self.state = state + self.action = action + + +class ManagedRulesDefinition(_serialization.Model): + """Allow to exclude some variable satisfy the condition for the WAF check. + + All required parameters must be populated in order to send to Azure. + + :ivar exclusions: The Exclusions that are applied on the policy. + :vartype exclusions: list[~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntry] + :ivar managed_rule_sets: The managed rule sets that are associated with the policy. Required. + :vartype managed_rule_sets: list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleSet] + """ + + _validation = { + "managed_rule_sets": {"required": True}, + } + + _attribute_map = { + "exclusions": {"key": "exclusions", "type": "[OwaspCrsExclusionEntry]"}, + "managed_rule_sets": {"key": "managedRuleSets", "type": "[ManagedRuleSet]"}, + } + + def __init__( + self, + *, + managed_rule_sets: List["_models.ManagedRuleSet"], + exclusions: Optional[List["_models.OwaspCrsExclusionEntry"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword exclusions: The Exclusions that are applied on the policy. + :paramtype exclusions: list[~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntry] + :keyword managed_rule_sets: The managed rule sets that are associated with the policy. + Required. + :paramtype managed_rule_sets: list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleSet] + """ + super().__init__(**kwargs) + self.exclusions = exclusions + self.managed_rule_sets = managed_rule_sets + + +class ManagedRuleSet(_serialization.Model): + """Defines a managed rule set. + + All required parameters must be populated in order to send to Azure. + + :ivar rule_set_type: Defines the rule set type to use. Required. + :vartype rule_set_type: str + :ivar rule_set_version: Defines the version of the rule set to use. Required. + :vartype rule_set_version: str + :ivar rule_group_overrides: Defines the rule group overrides to apply to the rule set. + :vartype rule_group_overrides: + list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleGroupOverride] + """ + + _validation = { + "rule_set_type": {"required": True}, + "rule_set_version": {"required": True}, + } + + _attribute_map = { + "rule_set_type": {"key": "ruleSetType", "type": "str"}, + "rule_set_version": {"key": "ruleSetVersion", "type": "str"}, + "rule_group_overrides": {"key": "ruleGroupOverrides", "type": "[ManagedRuleGroupOverride]"}, + } + + def __init__( + self, + *, + rule_set_type: str, + rule_set_version: str, + rule_group_overrides: Optional[List["_models.ManagedRuleGroupOverride"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword rule_set_type: Defines the rule set type to use. Required. + :paramtype rule_set_type: str + :keyword rule_set_version: Defines the version of the rule set to use. Required. + :paramtype rule_set_version: str + :keyword rule_group_overrides: Defines the rule group overrides to apply to the rule set. + :paramtype rule_group_overrides: + list[~azure.mgmt.network.v2023_09_01.models.ManagedRuleGroupOverride] + """ + super().__init__(**kwargs) + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.rule_group_overrides = rule_group_overrides + + +class ManagedServiceIdentity(_serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The 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: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the virtual machine. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.network.v2023_09_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": 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": "{Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the virtual machine. Known values + are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :paramtype type: str or ~azure.mgmt.network.v2023_09_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.network.v2023_09_01.models.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MatchCondition(_serialization.Model): + """Define match conditions. + + All required parameters must be populated in order to send to Azure. + + :ivar match_variables: List of match variables. Required. + :vartype match_variables: list[~azure.mgmt.network.v2023_09_01.models.MatchVariable] + :ivar operator: The operator to be matched. Required. Known values are: "IPMatch", "Equal", + "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", + "EndsWith", "Regex", "GeoMatch", and "Any". + :vartype operator: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallOperator + :ivar negation_conditon: Whether this is negate condition or not. + :vartype negation_conditon: bool + :ivar match_values: Match value. Required. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallTransform] + """ + + _validation = { + "match_variables": {"required": True}, + "operator": {"required": True}, + "match_values": {"required": True}, + } + + _attribute_map = { + "match_variables": {"key": "matchVariables", "type": "[MatchVariable]"}, + "operator": {"key": "operator", "type": "str"}, + "negation_conditon": {"key": "negationConditon", "type": "bool"}, + "match_values": {"key": "matchValues", "type": "[str]"}, + "transforms": {"key": "transforms", "type": "[str]"}, + } + + def __init__( + self, + *, + match_variables: List["_models.MatchVariable"], + operator: Union[str, "_models.WebApplicationFirewallOperator"], + match_values: List[str], + negation_conditon: Optional[bool] = None, + transforms: Optional[List[Union[str, "_models.WebApplicationFirewallTransform"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword match_variables: List of match variables. Required. + :paramtype match_variables: list[~azure.mgmt.network.v2023_09_01.models.MatchVariable] + :keyword operator: The operator to be matched. Required. Known values are: "IPMatch", "Equal", + "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", + "EndsWith", "Regex", "GeoMatch", and "Any". + :paramtype operator: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallOperator + :keyword negation_conditon: Whether this is negate condition or not. + :paramtype negation_conditon: bool + :keyword match_values: Match value. Required. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallTransform] + """ + super().__init__(**kwargs) + self.match_variables = match_variables + self.operator = operator + self.negation_conditon = negation_conditon + self.match_values = match_values + self.transforms = transforms + + +class MatchedRule(_serialization.Model): + """Matched rule. + + :ivar rule_name: Name of the matched network security rule. + :vartype rule_name: str + :ivar action: The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. + :vartype action: str + """ + + _attribute_map = { + "rule_name": {"key": "ruleName", "type": "str"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__(self, *, rule_name: Optional[str] = None, action: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword rule_name: Name of the matched network security rule. + :paramtype rule_name: str + :keyword action: The network traffic is allowed or denied. Possible values are 'Allow' and + 'Deny'. + :paramtype action: str + """ + super().__init__(**kwargs) + self.rule_name = rule_name + self.action = action + + +class MatchVariable(_serialization.Model): + """Define match variables. + + All required parameters must be populated in order to send to Azure. + + :ivar variable_name: Match Variable. Required. Known values are: "RemoteAddr", "RequestMethod", + "QueryString", "PostArgs", "RequestUri", "RequestHeaders", "RequestBody", and "RequestCookies". + :vartype variable_name: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallMatchVariable + :ivar selector: The selector of match variable. + :vartype selector: str + """ + + _validation = { + "variable_name": {"required": True}, + } + + _attribute_map = { + "variable_name": {"key": "variableName", "type": "str"}, + "selector": {"key": "selector", "type": "str"}, + } + + def __init__( + self, + *, + variable_name: Union[str, "_models.WebApplicationFirewallMatchVariable"], + selector: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword variable_name: Match Variable. Required. Known values are: "RemoteAddr", + "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeaders", "RequestBody", and + "RequestCookies". + :paramtype variable_name: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallMatchVariable + :keyword selector: The selector of match variable. + :paramtype selector: str + """ + super().__init__(**kwargs) + self.variable_name = variable_name + self.selector = selector + + +class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Description of metrics specification. + + :ivar name: The name of the metric. + :vartype name: str + :ivar display_name: The display name of the metric. + :vartype display_name: str + :ivar display_description: The description of the metric. + :vartype display_description: str + :ivar unit: Units the metric to be displayed in. + :vartype unit: str + :ivar aggregation_type: The aggregation type. + :vartype aggregation_type: str + :ivar availabilities: List of availability. + :vartype availabilities: list[~azure.mgmt.network.v2023_09_01.models.Availability] + :ivar enable_regional_mdm_account: Whether regional MDM account enabled. + :vartype enable_regional_mdm_account: bool + :ivar fill_gap_with_zero: Whether gaps would be filled with zeros. + :vartype fill_gap_with_zero: bool + :ivar metric_filter_pattern: Pattern for the filter of the metric. + :vartype metric_filter_pattern: str + :ivar dimensions: List of dimensions. + :vartype dimensions: list[~azure.mgmt.network.v2023_09_01.models.Dimension] + :ivar is_internal: Whether the metric is internal. + :vartype is_internal: bool + :ivar source_mdm_account: The source MDM account. + :vartype source_mdm_account: str + :ivar source_mdm_namespace: The source MDM namespace. + :vartype source_mdm_namespace: str + :ivar resource_id_dimension_name_override: The resource Id dimension name override. + :vartype resource_id_dimension_name_override: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "display_description": {"key": "displayDescription", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "aggregation_type": {"key": "aggregationType", "type": "str"}, + "availabilities": {"key": "availabilities", "type": "[Availability]"}, + "enable_regional_mdm_account": {"key": "enableRegionalMdmAccount", "type": "bool"}, + "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, + "metric_filter_pattern": {"key": "metricFilterPattern", "type": "str"}, + "dimensions": {"key": "dimensions", "type": "[Dimension]"}, + "is_internal": {"key": "isInternal", "type": "bool"}, + "source_mdm_account": {"key": "sourceMdmAccount", "type": "str"}, + "source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"}, + "resource_id_dimension_name_override": {"key": "resourceIdDimensionNameOverride", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + availabilities: Optional[List["_models.Availability"]] = None, + enable_regional_mdm_account: Optional[bool] = None, + fill_gap_with_zero: Optional[bool] = None, + metric_filter_pattern: Optional[str] = None, + dimensions: Optional[List["_models.Dimension"]] = None, + is_internal: Optional[bool] = None, + source_mdm_account: Optional[str] = None, + source_mdm_namespace: Optional[str] = None, + resource_id_dimension_name_override: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the metric. + :paramtype name: str + :keyword display_name: The display name of the metric. + :paramtype display_name: str + :keyword display_description: The description of the metric. + :paramtype display_description: str + :keyword unit: Units the metric to be displayed in. + :paramtype unit: str + :keyword aggregation_type: The aggregation type. + :paramtype aggregation_type: str + :keyword availabilities: List of availability. + :paramtype availabilities: list[~azure.mgmt.network.v2023_09_01.models.Availability] + :keyword enable_regional_mdm_account: Whether regional MDM account enabled. + :paramtype enable_regional_mdm_account: bool + :keyword fill_gap_with_zero: Whether gaps would be filled with zeros. + :paramtype fill_gap_with_zero: bool + :keyword metric_filter_pattern: Pattern for the filter of the metric. + :paramtype metric_filter_pattern: str + :keyword dimensions: List of dimensions. + :paramtype dimensions: list[~azure.mgmt.network.v2023_09_01.models.Dimension] + :keyword is_internal: Whether the metric is internal. + :paramtype is_internal: bool + :keyword source_mdm_account: The source MDM account. + :paramtype source_mdm_account: str + :keyword source_mdm_namespace: The source MDM namespace. + :paramtype source_mdm_namespace: str + :keyword resource_id_dimension_name_override: The resource Id dimension name override. + :paramtype resource_id_dimension_name_override: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.availabilities = availabilities + self.enable_regional_mdm_account = enable_regional_mdm_account + self.fill_gap_with_zero = fill_gap_with_zero + self.metric_filter_pattern = metric_filter_pattern + self.dimensions = dimensions + self.is_internal = is_internal + self.source_mdm_account = source_mdm_account + self.source_mdm_namespace = source_mdm_namespace + self.resource_id_dimension_name_override = resource_id_dimension_name_override + + +class MigratedPools(_serialization.Model): + """The response for a migrateToIpBased API. + + :ivar migrated_pools: A list of pools migrated from Nic based to IP based pool. + :vartype migrated_pools: list[str] + """ + + _attribute_map = { + "migrated_pools": {"key": "migratedPools", "type": "[str]"}, + } + + def __init__(self, *, migrated_pools: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword migrated_pools: A list of pools migrated from Nic based to IP based pool. + :paramtype migrated_pools: list[str] + """ + super().__init__(**kwargs) + self.migrated_pools = migrated_pools + + +class MigrateLoadBalancerToIpBasedRequest(_serialization.Model): + """The request for a migrateToIpBased API. + + :ivar pools: A list of pool names that should be migrated from Nic based to IP based pool. + :vartype pools: list[str] + """ + + _attribute_map = { + "pools": {"key": "pools", "type": "[str]"}, + } + + def __init__(self, *, pools: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword pools: A list of pool names that should be migrated from Nic based to IP based pool. + :paramtype pools: list[str] + """ + super().__init__(**kwargs) + self.pools = pools + + +class NatGateway(Resource): # pylint: disable=too-many-instance-attributes + """Nat Gateway resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The nat gateway SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.NatGatewaySku + :ivar zones: A list of availability zones denoting the zone in which Nat Gateway should be + deployed. + :vartype zones: list[str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar idle_timeout_in_minutes: The idle timeout of the nat gateway. + :vartype idle_timeout_in_minutes: int + :ivar public_ip_addresses: An array of public ip addresses associated with the nat gateway + resource. + :vartype public_ip_addresses: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar public_ip_prefixes: An array of public ip prefixes associated with the nat gateway + resource. + :vartype public_ip_prefixes: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar subnets: An array of references to the subnets using this nat gateway resource. + :vartype subnets: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar resource_guid: The resource GUID property of the NAT gateway resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the NAT gateway resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "subnets": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "NatGatewaySku"}, + "zones": {"key": "zones", "type": "[str]"}, + "etag": {"key": "etag", "type": "str"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + "public_ip_addresses": {"key": "properties.publicIpAddresses", "type": "[SubResource]"}, + "public_ip_prefixes": {"key": "properties.publicIpPrefixes", "type": "[SubResource]"}, + "subnets": {"key": "properties.subnets", "type": "[SubResource]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.NatGatewaySku"] = None, + zones: Optional[List[str]] = None, + idle_timeout_in_minutes: Optional[int] = None, + public_ip_addresses: Optional[List["_models.SubResource"]] = None, + public_ip_prefixes: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The nat gateway SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.NatGatewaySku + :keyword zones: A list of availability zones denoting the zone in which Nat Gateway should be + deployed. + :paramtype zones: list[str] + :keyword idle_timeout_in_minutes: The idle timeout of the nat gateway. + :paramtype idle_timeout_in_minutes: int + :keyword public_ip_addresses: An array of public ip addresses associated with the nat gateway + resource. + :paramtype public_ip_addresses: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword public_ip_prefixes: An array of public ip prefixes associated with the nat gateway + resource. + :paramtype public_ip_prefixes: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.sku = sku + self.zones = zones + self.etag = None + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.public_ip_addresses = public_ip_addresses + self.public_ip_prefixes = public_ip_prefixes + self.subnets = None + self.resource_guid = None + self.provisioning_state = None + + +class NatGatewayListResult(_serialization.Model): + """Response for ListNatGateways API service call. + + :ivar value: A list of Nat Gateways that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NatGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NatGateway"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of Nat Gateways that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NatGatewaySku(_serialization.Model): + """SKU of nat gateway. + + :ivar name: Name of Nat Gateway SKU. "Standard" + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.NatGatewaySkuName + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[Union[str, "_models.NatGatewaySkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of Nat Gateway SKU. "Standard" + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.NatGatewaySkuName + """ + super().__init__(**kwargs) + self.name = name + + +class NatRule(FirewallPolicyRule): # pylint: disable=too-many-instance-attributes + """Rule of type nat. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar rule_type: Rule Type. Required. Known values are: "ApplicationRule", "NetworkRule", and + "NatRule". + :vartype rule_type: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleType + :ivar ip_protocols: Array of FirewallPolicyRuleNetworkProtocols. + :vartype ip_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleNetworkProtocol] + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses or Service Tags. + :vartype destination_addresses: list[str] + :ivar destination_ports: List of destination ports. + :vartype destination_ports: list[str] + :ivar translated_address: The translated address for this NAT rule. + :vartype translated_address: str + :ivar translated_port: The translated port for this NAT rule. + :vartype translated_port: str + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + :ivar translated_fqdn: The translated FQDN for this NAT rule. + :vartype translated_fqdn: str + """ + + _validation = { + "rule_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "rule_type": {"key": "ruleType", "type": "str"}, + "ip_protocols": {"key": "ipProtocols", "type": "[str]"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "translated_address": {"key": "translatedAddress", "type": "str"}, + "translated_port": {"key": "translatedPort", "type": "str"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + "translated_fqdn": {"key": "translatedFqdn", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + ip_protocols: Optional[List[Union[str, "_models.FirewallPolicyRuleNetworkProtocol"]]] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + translated_address: Optional[str] = None, + translated_port: Optional[str] = None, + source_ip_groups: Optional[List[str]] = None, + translated_fqdn: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword ip_protocols: Array of FirewallPolicyRuleNetworkProtocols. + :paramtype ip_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleNetworkProtocol] + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses or Service Tags. + :paramtype destination_addresses: list[str] + :keyword destination_ports: List of destination ports. + :paramtype destination_ports: list[str] + :keyword translated_address: The translated address for this NAT rule. + :paramtype translated_address: str + :keyword translated_port: The translated port for this NAT rule. + :paramtype translated_port: str + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + :keyword translated_fqdn: The translated FQDN for this NAT rule. + :paramtype translated_fqdn: str + """ + super().__init__(name=name, description=description, **kwargs) + self.rule_type: str = "NatRule" + self.ip_protocols = ip_protocols + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.destination_ports = destination_ports + self.translated_address = translated_address + self.translated_port = translated_port + self.source_ip_groups = source_ip_groups + self.translated_fqdn = translated_fqdn + + +class NatRulePortMapping(_serialization.Model): + """Individual port mappings for inbound NAT rule created for backend pool. + + :ivar inbound_nat_rule_name: Name of inbound NAT rule. + :vartype inbound_nat_rule_name: str + :ivar frontend_port: Frontend port. + :vartype frontend_port: int + :ivar backend_port: Backend port. + :vartype backend_port: int + """ + + _attribute_map = { + "inbound_nat_rule_name": {"key": "inboundNatRuleName", "type": "str"}, + "frontend_port": {"key": "frontendPort", "type": "int"}, + "backend_port": {"key": "backendPort", "type": "int"}, + } + + def __init__( + self, + *, + inbound_nat_rule_name: Optional[str] = None, + frontend_port: Optional[int] = None, + backend_port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_nat_rule_name: Name of inbound NAT rule. + :paramtype inbound_nat_rule_name: str + :keyword frontend_port: Frontend port. + :paramtype frontend_port: int + :keyword backend_port: Backend port. + :paramtype backend_port: int + """ + super().__init__(**kwargs) + self.inbound_nat_rule_name = inbound_nat_rule_name + self.frontend_port = frontend_port + self.backend_port = backend_port + + +class NetworkConfigurationDiagnosticParameters(_serialization.Model): + """Parameters to get network configuration diagnostic. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The ID of the target resource to perform network configuration + diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application + Gateway. Required. + :vartype target_resource_id: str + :ivar verbosity_level: Verbosity level. Known values are: "Normal", "Minimum", and "Full". + :vartype verbosity_level: str or ~azure.mgmt.network.v2023_09_01.models.VerbosityLevel + :ivar profiles: List of network configuration diagnostic profiles. Required. + :vartype profiles: + list[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticProfile] + """ + + _validation = { + "target_resource_id": {"required": True}, + "profiles": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "verbosity_level": {"key": "verbosityLevel", "type": "str"}, + "profiles": {"key": "profiles", "type": "[NetworkConfigurationDiagnosticProfile]"}, + } + + def __init__( + self, + *, + target_resource_id: str, + profiles: List["_models.NetworkConfigurationDiagnosticProfile"], + verbosity_level: Optional[Union[str, "_models.VerbosityLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_resource_id: The ID of the target resource to perform network configuration + diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application + Gateway. Required. + :paramtype target_resource_id: str + :keyword verbosity_level: Verbosity level. Known values are: "Normal", "Minimum", and "Full". + :paramtype verbosity_level: str or ~azure.mgmt.network.v2023_09_01.models.VerbosityLevel + :keyword profiles: List of network configuration diagnostic profiles. Required. + :paramtype profiles: + list[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticProfile] + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + self.verbosity_level = verbosity_level + self.profiles = profiles + + +class NetworkConfigurationDiagnosticProfile(_serialization.Model): + """Parameters to compare with network configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar direction: The direction of the traffic. Required. Known values are: "Inbound" and + "Outbound". + :vartype direction: str or ~azure.mgmt.network.v2023_09_01.models.Direction + :ivar protocol: Protocol to be verified on. Accepted values are '*', TCP, UDP. Required. + :vartype protocol: str + :ivar source: Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. Required. + :vartype source: str + :ivar destination: Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. + Required. + :vartype destination: str + :ivar destination_port: Traffic destination port. Accepted values are '*' and a single port in + the range (0 - 65535). Required. + :vartype destination_port: str + """ + + _validation = { + "direction": {"required": True}, + "protocol": {"required": True}, + "source": {"required": True}, + "destination": {"required": True}, + "destination_port": {"required": True}, + } + + _attribute_map = { + "direction": {"key": "direction", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "destination": {"key": "destination", "type": "str"}, + "destination_port": {"key": "destinationPort", "type": "str"}, + } + + def __init__( + self, + *, + direction: Union[str, "_models.Direction"], + protocol: str, + source: str, + destination: str, + destination_port: str, + **kwargs: Any + ) -> None: + """ + :keyword direction: The direction of the traffic. Required. Known values are: "Inbound" and + "Outbound". + :paramtype direction: str or ~azure.mgmt.network.v2023_09_01.models.Direction + :keyword protocol: Protocol to be verified on. Accepted values are '*', TCP, UDP. Required. + :paramtype protocol: str + :keyword source: Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. + Required. + :paramtype source: str + :keyword destination: Traffic destination. Accepted values are: '*', IP Address/CIDR, Service + Tag. Required. + :paramtype destination: str + :keyword destination_port: Traffic destination port. Accepted values are '*' and a single port + in the range (0 - 65535). Required. + :paramtype destination_port: str + """ + super().__init__(**kwargs) + self.direction = direction + self.protocol = protocol + self.source = source + self.destination = destination + self.destination_port = destination_port + + +class NetworkConfigurationDiagnosticResponse(_serialization.Model): + """Results of network configuration diagnostic on the target resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: List of network configuration diagnostic results. + :vartype results: + list[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResult] + """ + + _validation = { + "results": {"readonly": True}, + } + + _attribute_map = { + "results": {"key": "results", "type": "[NetworkConfigurationDiagnosticResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.results = None + + +class NetworkConfigurationDiagnosticResult(_serialization.Model): + """Network configuration diagnostic result corresponded to provided traffic query. + + :ivar profile: Network configuration diagnostic profile. + :vartype profile: ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticProfile + :ivar network_security_group_result: Network security group result. + :vartype network_security_group_result: + ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroupResult + """ + + _attribute_map = { + "profile": {"key": "profile", "type": "NetworkConfigurationDiagnosticProfile"}, + "network_security_group_result": {"key": "networkSecurityGroupResult", "type": "NetworkSecurityGroupResult"}, + } + + def __init__( + self, + *, + profile: Optional["_models.NetworkConfigurationDiagnosticProfile"] = None, + network_security_group_result: Optional["_models.NetworkSecurityGroupResult"] = None, + **kwargs: Any + ) -> None: + """ + :keyword profile: Network configuration diagnostic profile. + :paramtype profile: + ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticProfile + :keyword network_security_group_result: Network security group result. + :paramtype network_security_group_result: + ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroupResult + """ + super().__init__(**kwargs) + self.profile = profile + self.network_security_group_result = network_security_group_result + + +class NetworkGroup(ChildResource): + """The network group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description of the network group. + :vartype description: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: A description of the network group. + :paramtype description: str + """ + super().__init__(**kwargs) + self.system_data = None + self.description = description + self.provisioning_state = None + self.resource_guid = None + + +class NetworkGroupListResult(_serialization.Model): + """Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get + the next set of results. + + :ivar value: Gets a page of NetworkGroup. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkGroup] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkGroup"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of NetworkGroup. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkGroup] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkIntentPolicy(Resource): + """Network Intent Policy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + + +class NetworkIntentPolicyConfiguration(_serialization.Model): + """Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. + + :ivar network_intent_policy_name: The name of the Network Intent Policy for storing in target + subscription. + :vartype network_intent_policy_name: str + :ivar source_network_intent_policy: Source network intent policy. + :vartype source_network_intent_policy: + ~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicy + """ + + _attribute_map = { + "network_intent_policy_name": {"key": "networkIntentPolicyName", "type": "str"}, + "source_network_intent_policy": {"key": "sourceNetworkIntentPolicy", "type": "NetworkIntentPolicy"}, + } + + def __init__( + self, + *, + network_intent_policy_name: Optional[str] = None, + source_network_intent_policy: Optional["_models.NetworkIntentPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_intent_policy_name: The name of the Network Intent Policy for storing in + target subscription. + :paramtype network_intent_policy_name: str + :keyword source_network_intent_policy: Source network intent policy. + :paramtype source_network_intent_policy: + ~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicy + """ + super().__init__(**kwargs) + self.network_intent_policy_name = network_intent_policy_name + self.source_network_intent_policy = source_network_intent_policy + + +class NetworkInterface(Resource): # pylint: disable=too-many-instance-attributes + """A network interface in a resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the network interface. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar virtual_machine: The reference to a virtual machine. + :vartype virtual_machine: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar network_security_group: The reference to the NetworkSecurityGroup resource. + :vartype network_security_group: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :ivar private_endpoint: A reference to the private endpoint to which the network interface is + linked. + :vartype private_endpoint: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint + :ivar ip_configurations: A list of IPConfigurations of the network interface. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :ivar tap_configurations: A list of TapConfigurations of the network interface. + :vartype tap_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :ivar dns_settings: The DNS settings in network interface. + :vartype dns_settings: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceDnsSettings + :ivar mac_address: The MAC address of the network interface. + :vartype mac_address: str + :ivar primary: Whether this is a primary network interface on a virtual machine. + :vartype primary: bool + :ivar vnet_encryption_supported: Whether the virtual machine this nic is attached to supports + encryption. + :vartype vnet_encryption_supported: bool + :ivar enable_accelerated_networking: If the network interface is configured for accelerated + networking. Not applicable to VM sizes which require accelerated networking. + :vartype enable_accelerated_networking: bool + :ivar disable_tcp_state_tracking: Indicates whether to disable tcp state tracking. + :vartype disable_tcp_state_tracking: bool + :ivar enable_ip_forwarding: Indicates whether IP forwarding is enabled on this network + interface. + :vartype enable_ip_forwarding: bool + :ivar hosted_workloads: A list of references to linked BareMetal resources. + :vartype hosted_workloads: list[str] + :ivar dscp_configuration: A reference to the dscp configuration to which the network interface + is linked. + :vartype dscp_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar resource_guid: The resource GUID property of the network interface resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the network interface resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar workload_type: WorkloadType of the NetworkInterface for BareMetal resources. + :vartype workload_type: str + :ivar nic_type: Type of Network Interface resource. Known values are: "Standard" and "Elastic". + :vartype nic_type: str or ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceNicType + :ivar private_link_service: Privatelinkservice of the network interface resource. + :vartype private_link_service: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :ivar migration_phase: Migration phase of Network Interface resource. Known values are: "None", + "Prepare", "Commit", "Abort", and "Committed". + :vartype migration_phase: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceMigrationPhase + :ivar auxiliary_mode: Auxiliary mode of Network Interface resource. Known values are: "None", + "MaxConnections", "Floating", and "AcceleratedConnections". + :vartype auxiliary_mode: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAuxiliaryMode + :ivar auxiliary_sku: Auxiliary sku of Network Interface resource. Known values are: "None", + "A1", "A2", "A4", and "A8". + :vartype auxiliary_sku: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAuxiliarySku + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "virtual_machine": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "tap_configurations": {"readonly": True}, + "mac_address": {"readonly": True}, + "primary": {"readonly": True}, + "vnet_encryption_supported": {"readonly": True}, + "hosted_workloads": {"readonly": True}, + "dscp_configuration": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "virtual_machine": {"key": "properties.virtualMachine", "type": "SubResource"}, + "network_security_group": {"key": "properties.networkSecurityGroup", "type": "NetworkSecurityGroup"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[NetworkInterfaceIPConfiguration]"}, + "tap_configurations": {"key": "properties.tapConfigurations", "type": "[NetworkInterfaceTapConfiguration]"}, + "dns_settings": {"key": "properties.dnsSettings", "type": "NetworkInterfaceDnsSettings"}, + "mac_address": {"key": "properties.macAddress", "type": "str"}, + "primary": {"key": "properties.primary", "type": "bool"}, + "vnet_encryption_supported": {"key": "properties.vnetEncryptionSupported", "type": "bool"}, + "enable_accelerated_networking": {"key": "properties.enableAcceleratedNetworking", "type": "bool"}, + "disable_tcp_state_tracking": {"key": "properties.disableTcpStateTracking", "type": "bool"}, + "enable_ip_forwarding": {"key": "properties.enableIPForwarding", "type": "bool"}, + "hosted_workloads": {"key": "properties.hostedWorkloads", "type": "[str]"}, + "dscp_configuration": {"key": "properties.dscpConfiguration", "type": "SubResource"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "workload_type": {"key": "properties.workloadType", "type": "str"}, + "nic_type": {"key": "properties.nicType", "type": "str"}, + "private_link_service": {"key": "properties.privateLinkService", "type": "PrivateLinkService"}, + "migration_phase": {"key": "properties.migrationPhase", "type": "str"}, + "auxiliary_mode": {"key": "properties.auxiliaryMode", "type": "str"}, + "auxiliary_sku": {"key": "properties.auxiliarySku", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + network_security_group: Optional["_models.NetworkSecurityGroup"] = None, + ip_configurations: Optional[List["_models.NetworkInterfaceIPConfiguration"]] = None, + dns_settings: Optional["_models.NetworkInterfaceDnsSettings"] = None, + enable_accelerated_networking: Optional[bool] = None, + disable_tcp_state_tracking: Optional[bool] = None, + enable_ip_forwarding: Optional[bool] = None, + workload_type: Optional[str] = None, + nic_type: Optional[Union[str, "_models.NetworkInterfaceNicType"]] = None, + private_link_service: Optional["_models.PrivateLinkService"] = None, + migration_phase: Optional[Union[str, "_models.NetworkInterfaceMigrationPhase"]] = None, + auxiliary_mode: Optional[Union[str, "_models.NetworkInterfaceAuxiliaryMode"]] = None, + auxiliary_sku: Optional[Union[str, "_models.NetworkInterfaceAuxiliarySku"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the network interface. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword network_security_group: The reference to the NetworkSecurityGroup resource. + :paramtype network_security_group: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :keyword ip_configurations: A list of IPConfigurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :keyword dns_settings: The DNS settings in network interface. + :paramtype dns_settings: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceDnsSettings + :keyword enable_accelerated_networking: If the network interface is configured for accelerated + networking. Not applicable to VM sizes which require accelerated networking. + :paramtype enable_accelerated_networking: bool + :keyword disable_tcp_state_tracking: Indicates whether to disable tcp state tracking. + :paramtype disable_tcp_state_tracking: bool + :keyword enable_ip_forwarding: Indicates whether IP forwarding is enabled on this network + interface. + :paramtype enable_ip_forwarding: bool + :keyword workload_type: WorkloadType of the NetworkInterface for BareMetal resources. + :paramtype workload_type: str + :keyword nic_type: Type of Network Interface resource. Known values are: "Standard" and + "Elastic". + :paramtype nic_type: str or ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceNicType + :keyword private_link_service: Privatelinkservice of the network interface resource. + :paramtype private_link_service: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :keyword migration_phase: Migration phase of Network Interface resource. Known values are: + "None", "Prepare", "Commit", "Abort", and "Committed". + :paramtype migration_phase: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceMigrationPhase + :keyword auxiliary_mode: Auxiliary mode of Network Interface resource. Known values are: + "None", "MaxConnections", "Floating", and "AcceleratedConnections". + :paramtype auxiliary_mode: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAuxiliaryMode + :keyword auxiliary_sku: Auxiliary sku of Network Interface resource. Known values are: "None", + "A1", "A2", "A4", and "A8". + :paramtype auxiliary_sku: str or + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAuxiliarySku + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.virtual_machine = None + self.network_security_group = network_security_group + self.private_endpoint = None + self.ip_configurations = ip_configurations + self.tap_configurations = None + self.dns_settings = dns_settings + self.mac_address = None + self.primary = None + self.vnet_encryption_supported = None + self.enable_accelerated_networking = enable_accelerated_networking + self.disable_tcp_state_tracking = disable_tcp_state_tracking + self.enable_ip_forwarding = enable_ip_forwarding + self.hosted_workloads = None + self.dscp_configuration = None + self.resource_guid = None + self.provisioning_state = None + self.workload_type = workload_type + self.nic_type = nic_type + self.private_link_service = private_link_service + self.migration_phase = migration_phase + self.auxiliary_mode = auxiliary_mode + self.auxiliary_sku = auxiliary_sku + + +class NetworkInterfaceAssociation(_serialization.Model): + """Network interface and its custom security rules. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Network interface ID. + :vartype id: str + :ivar security_rules: Collection of custom security rules. + :vartype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "security_rules": {"key": "securityRules", "type": "[SecurityRule]"}, + } + + def __init__(self, *, security_rules: Optional[List["_models.SecurityRule"]] = None, **kwargs: Any) -> None: + """ + :keyword security_rules: Collection of custom security rules. + :paramtype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + """ + super().__init__(**kwargs) + self.id = None + self.security_rules = security_rules + + +class NetworkInterfaceDnsSettings(_serialization.Model): + """DNS settings of a network interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar dns_servers: List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure + provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it must be + the only value in dnsServers collection. + :vartype dns_servers: list[str] + :ivar applied_dns_servers: If the VM that uses this NIC is part of an Availability Set, then + this list will have the union of all DNS servers from all NICs that are part of the + Availability Set. This property is what is configured on each of those VMs. + :vartype applied_dns_servers: list[str] + :ivar internal_dns_name_label: Relative DNS name for this NIC used for internal communications + between VMs in the same virtual network. + :vartype internal_dns_name_label: str + :ivar internal_fqdn: Fully qualified DNS name supporting internal communications between VMs in + the same virtual network. + :vartype internal_fqdn: str + :ivar internal_domain_name_suffix: Even if internalDnsNameLabel is not specified, a DNS entry + is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the + VM name with the value of internalDomainNameSuffix. + :vartype internal_domain_name_suffix: str + """ + + _validation = { + "applied_dns_servers": {"readonly": True}, + "internal_fqdn": {"readonly": True}, + "internal_domain_name_suffix": {"readonly": True}, + } + + _attribute_map = { + "dns_servers": {"key": "dnsServers", "type": "[str]"}, + "applied_dns_servers": {"key": "appliedDnsServers", "type": "[str]"}, + "internal_dns_name_label": {"key": "internalDnsNameLabel", "type": "str"}, + "internal_fqdn": {"key": "internalFqdn", "type": "str"}, + "internal_domain_name_suffix": {"key": "internalDomainNameSuffix", "type": "str"}, + } + + def __init__( + self, *, dns_servers: Optional[List[str]] = None, internal_dns_name_label: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword dns_servers: List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to + azure provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + must be the only value in dnsServers collection. + :paramtype dns_servers: list[str] + :keyword internal_dns_name_label: Relative DNS name for this NIC used for internal + communications between VMs in the same virtual network. + :paramtype internal_dns_name_label: str + """ + super().__init__(**kwargs) + self.dns_servers = dns_servers + self.applied_dns_servers = None + self.internal_dns_name_label = internal_dns_name_label + self.internal_fqdn = None + self.internal_domain_name_suffix = None + + +class NetworkInterfaceIPConfiguration(SubResource): # pylint: disable=too-many-instance-attributes + """IPConfiguration in a network interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar gateway_load_balancer: The reference to gateway load balancer frontend IP. + :vartype gateway_load_balancer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar virtual_network_taps: The reference to Virtual Network Taps. + :vartype virtual_network_taps: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :ivar application_gateway_backend_address_pools: The reference to + ApplicationGatewayBackendAddressPool resource. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool] + :ivar load_balancer_backend_address_pools: The reference to LoadBalancerBackendAddressPool + resource. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :ivar load_balancer_inbound_nat_rules: A list of references of LoadBalancerInboundNatRules. + :vartype load_balancer_inbound_nat_rules: + list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :ivar private_ip_address: Private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. + Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :ivar subnet: Subnet bound to the IP configuration. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar primary: Whether this is a primary customer address on the network interface. + :vartype primary: bool + :ivar public_ip_address: Public IP address bound to the IP configuration. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar application_security_groups: Application security groups in which the IP configuration is + included. + :vartype application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :ivar provisioning_state: The provisioning state of the network interface IP configuration. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_link_connection_properties: PrivateLinkConnection properties for the network + interface. + :vartype private_link_connection_properties: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "private_link_connection_properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "gateway_load_balancer": {"key": "properties.gatewayLoadBalancer", "type": "SubResource"}, + "virtual_network_taps": {"key": "properties.virtualNetworkTaps", "type": "[VirtualNetworkTap]"}, + "application_gateway_backend_address_pools": { + "key": "properties.applicationGatewayBackendAddressPools", + "type": "[ApplicationGatewayBackendAddressPool]", + }, + "load_balancer_backend_address_pools": { + "key": "properties.loadBalancerBackendAddressPools", + "type": "[BackendAddressPool]", + }, + "load_balancer_inbound_nat_rules": { + "key": "properties.loadBalancerInboundNatRules", + "type": "[InboundNatRule]", + }, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "private_ip_address_version": {"key": "properties.privateIPAddressVersion", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "primary": {"key": "properties.primary", "type": "bool"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "PublicIPAddress"}, + "application_security_groups": { + "key": "properties.applicationSecurityGroups", + "type": "[ApplicationSecurityGroup]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_link_connection_properties": { + "key": "properties.privateLinkConnectionProperties", + "type": "NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties", + }, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + gateway_load_balancer: Optional["_models.SubResource"] = None, + virtual_network_taps: Optional[List["_models.VirtualNetworkTap"]] = None, + application_gateway_backend_address_pools: Optional[ + List["_models.ApplicationGatewayBackendAddressPool"] + ] = None, + load_balancer_backend_address_pools: Optional[List["_models.BackendAddressPool"]] = None, + load_balancer_inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + subnet: Optional["_models.Subnet"] = None, + primary: Optional[bool] = None, + public_ip_address: Optional["_models.PublicIPAddress"] = None, + application_security_groups: Optional[List["_models.ApplicationSecurityGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: Resource type. + :paramtype type: str + :keyword gateway_load_balancer: The reference to gateway load balancer frontend IP. + :paramtype gateway_load_balancer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword virtual_network_taps: The reference to Virtual Network Taps. + :paramtype virtual_network_taps: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :keyword application_gateway_backend_address_pools: The reference to + ApplicationGatewayBackendAddressPool resource. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendAddressPool] + :keyword load_balancer_backend_address_pools: The reference to LoadBalancerBackendAddressPool + resource. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :keyword load_balancer_inbound_nat_rules: A list of references of LoadBalancerInboundNatRules. + :paramtype load_balancer_inbound_nat_rules: + list[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :keyword private_ip_address: Private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. + Default is IPv4. Known values are: "IPv4" and "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :keyword subnet: Subnet bound to the IP configuration. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword primary: Whether this is a primary customer address on the network interface. + :paramtype primary: bool + :keyword public_ip_address: Public IP address bound to the IP configuration. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :keyword application_security_groups: Application security groups in which the IP configuration + is included. + :paramtype application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.gateway_load_balancer = gateway_load_balancer + self.virtual_network_taps = virtual_network_taps + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_rules = load_balancer_inbound_nat_rules + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.private_ip_address_version = private_ip_address_version + self.subnet = subnet + self.primary = primary + self.public_ip_address = public_ip_address + self.application_security_groups = application_security_groups + self.provisioning_state = None + self.private_link_connection_properties = None + + +class NetworkInterfaceIPConfigurationListResult(_serialization.Model): + """Response for list ip configurations API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of ip configurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkInterfaceIPConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkInterfaceIPConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of ip configurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties(_serialization.Model): + """PrivateLinkConnection properties for the network interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_id: The group ID for current private link connection. + :vartype group_id: str + :ivar required_member_name: The required member name for current private link connection. + :vartype required_member_name: str + :ivar fqdns: List of FQDNs for current private link connection. + :vartype fqdns: list[str] + """ + + _validation = { + "group_id": {"readonly": True}, + "required_member_name": {"readonly": True}, + "fqdns": {"readonly": True}, + } + + _attribute_map = { + "group_id": {"key": "groupId", "type": "str"}, + "required_member_name": {"key": "requiredMemberName", "type": "str"}, + "fqdns": {"key": "fqdns", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.group_id = None + self.required_member_name = None + self.fqdns = None + + +class NetworkInterfaceListResult(_serialization.Model): + """Response for the ListNetworkInterface API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of network interfaces in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkInterface]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of network interfaces in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkInterfaceLoadBalancerListResult(_serialization.Model): + """Response for list ip configurations API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of load balancers. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LoadBalancer]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.LoadBalancer"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of load balancers. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkInterfaceTapConfiguration(SubResource): + """Tap configuration in a Network Interface. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Sub Resource type. + :vartype type: str + :ivar virtual_network_tap: The reference to the Virtual Network Tap resource. + :vartype virtual_network_tap: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :ivar provisioning_state: The provisioning state of the network interface tap configuration + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "virtual_network_tap": {"key": "properties.virtualNetworkTap", "type": "VirtualNetworkTap"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + virtual_network_tap: Optional["_models.VirtualNetworkTap"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword virtual_network_tap: The reference to the Virtual Network Tap resource. + :paramtype virtual_network_tap: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.virtual_network_tap = virtual_network_tap + self.provisioning_state = None + + +class NetworkInterfaceTapConfigurationListResult(_serialization.Model): + """Response for list tap configurations API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of tap configurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkInterfaceTapConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkInterfaceTapConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of tap configurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkManager(Resource): # pylint: disable=too-many-instance-attributes + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description of the network manager. + :vartype description: str + :ivar network_manager_scopes: Scope of Network Manager. + :vartype network_manager_scopes: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerPropertiesNetworkManagerScopes + :ivar network_manager_scope_accesses: Scope Access. + :vartype network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2023_09_01.models.ConfigurationType] + :ivar provisioning_state: The provisioning state of the network manager resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "network_manager_scopes": { + "key": "properties.networkManagerScopes", + "type": "NetworkManagerPropertiesNetworkManagerScopes", + }, + "network_manager_scope_accesses": {"key": "properties.networkManagerScopeAccesses", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + network_manager_scopes: Optional["_models.NetworkManagerPropertiesNetworkManagerScopes"] = None, + network_manager_scope_accesses: Optional[List[Union[str, "_models.ConfigurationType"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword description: A description of the network manager. + :paramtype description: str + :keyword network_manager_scopes: Scope of Network Manager. + :paramtype network_manager_scopes: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerPropertiesNetworkManagerScopes + :keyword network_manager_scope_accesses: Scope Access. + :paramtype network_manager_scope_accesses: list[str or + ~azure.mgmt.network.v2023_09_01.models.ConfigurationType] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.system_data = None + self.description = description + self.network_manager_scopes = network_manager_scopes + self.network_manager_scope_accesses = network_manager_scope_accesses + self.provisioning_state = None + self.resource_guid = None + + +class NetworkManagerCommit(_serialization.Model): + """Network Manager Commit. + + 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 commit_id: Commit Id. + :vartype commit_id: str + :ivar target_locations: List of target locations. Required. + :vartype target_locations: list[str] + :ivar configuration_ids: List of configuration ids. + :vartype configuration_ids: list[str] + :ivar commit_type: Commit Type. Required. Known values are: "SecurityAdmin" and "Connectivity". + :vartype commit_type: str or ~azure.mgmt.network.v2023_09_01.models.ConfigurationType + """ + + _validation = { + "commit_id": {"readonly": True}, + "target_locations": {"required": True}, + "commit_type": {"required": True}, + } + + _attribute_map = { + "commit_id": {"key": "commitId", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + "configuration_ids": {"key": "configurationIds", "type": "[str]"}, + "commit_type": {"key": "commitType", "type": "str"}, + } + + def __init__( + self, + *, + target_locations: List[str], + commit_type: Union[str, "_models.ConfigurationType"], + configuration_ids: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_locations: List of target locations. Required. + :paramtype target_locations: list[str] + :keyword configuration_ids: List of configuration ids. + :paramtype configuration_ids: list[str] + :keyword commit_type: Commit Type. Required. Known values are: "SecurityAdmin" and + "Connectivity". + :paramtype commit_type: str or ~azure.mgmt.network.v2023_09_01.models.ConfigurationType + """ + super().__init__(**kwargs) + self.commit_id = None + self.target_locations = target_locations + self.configuration_ids = configuration_ids + self.commit_type = commit_type + + +class NetworkManagerConnection(ChildResource): + """The Network Manager Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar network_manager_id: Network Manager Id. + :vartype network_manager_id: str + :ivar connection_state: Connection state. Known values are: "Connected", "Pending", "Conflict", + "Revoked", and "Rejected". + :vartype connection_state: str or ~azure.mgmt.network.v2023_09_01.models.ScopeConnectionState + :ivar description: A description of the network manager connection. + :vartype description: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "connection_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "network_manager_id": {"key": "properties.networkManagerId", "type": "str"}, + "connection_state": {"key": "properties.connectionState", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + } + + def __init__( + self, *, network_manager_id: Optional[str] = None, description: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword network_manager_id: Network Manager Id. + :paramtype network_manager_id: str + :keyword description: A description of the network manager connection. + :paramtype description: str + """ + super().__init__(**kwargs) + self.system_data = None + self.network_manager_id = network_manager_id + self.connection_state = None + self.description = description + + +class NetworkManagerConnectionListResult(_serialization.Model): + """List of network manager connections. + + :ivar value: List of network manager connections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkManagerConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkManagerConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of network manager connections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkManagerDeploymentStatus(_serialization.Model): + """Network Manager Deployment Status. + + :ivar commit_time: Commit Time. + :vartype commit_time: ~datetime.datetime + :ivar region: Region Name. + :vartype region: str + :ivar deployment_status: Deployment Status. Known values are: "NotStarted", "Deploying", + "Deployed", and "Failed". + :vartype deployment_status: str or ~azure.mgmt.network.v2023_09_01.models.DeploymentStatus + :ivar configuration_ids: List of configuration ids. + :vartype configuration_ids: list[str] + :ivar deployment_type: Configuration Deployment Type. Known values are: "SecurityAdmin" and + "Connectivity". + :vartype deployment_type: str or ~azure.mgmt.network.v2023_09_01.models.ConfigurationType + :ivar error_message: Error Message. + :vartype error_message: str + """ + + _attribute_map = { + "commit_time": {"key": "commitTime", "type": "iso-8601"}, + "region": {"key": "region", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "configuration_ids": {"key": "configurationIds", "type": "[str]"}, + "deployment_type": {"key": "deploymentType", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + } + + def __init__( + self, + *, + commit_time: Optional[datetime.datetime] = None, + region: Optional[str] = None, + deployment_status: Optional[Union[str, "_models.DeploymentStatus"]] = None, + configuration_ids: Optional[List[str]] = None, + deployment_type: Optional[Union[str, "_models.ConfigurationType"]] = None, + error_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword commit_time: Commit Time. + :paramtype commit_time: ~datetime.datetime + :keyword region: Region Name. + :paramtype region: str + :keyword deployment_status: Deployment Status. Known values are: "NotStarted", "Deploying", + "Deployed", and "Failed". + :paramtype deployment_status: str or ~azure.mgmt.network.v2023_09_01.models.DeploymentStatus + :keyword configuration_ids: List of configuration ids. + :paramtype configuration_ids: list[str] + :keyword deployment_type: Configuration Deployment Type. Known values are: "SecurityAdmin" and + "Connectivity". + :paramtype deployment_type: str or ~azure.mgmt.network.v2023_09_01.models.ConfigurationType + :keyword error_message: Error Message. + :paramtype error_message: str + """ + super().__init__(**kwargs) + self.commit_time = commit_time + self.region = region + self.deployment_status = deployment_status + self.configuration_ids = configuration_ids + self.deployment_type = deployment_type + self.error_message = error_message + + +class NetworkManagerDeploymentStatusListResult(_serialization.Model): + """A list of Network Manager Deployment Status. + + :ivar value: Gets a page of Network Manager Deployment Status. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatus] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkManagerDeploymentStatus]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkManagerDeploymentStatus"]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of Network Manager Deployment Status. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatus] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class NetworkManagerDeploymentStatusParameter(_serialization.Model): + """Network Manager Deployment Status Parameter. + + :ivar regions: List of locations. + :vartype regions: list[str] + :ivar deployment_types: List of deployment types. + :vartype deployment_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.ConfigurationType] + :ivar skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. + :vartype skip_token: str + """ + + _attribute_map = { + "regions": {"key": "regions", "type": "[str]"}, + "deployment_types": {"key": "deploymentTypes", "type": "[str]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + regions: Optional[List[str]] = None, + deployment_types: Optional[List[Union[str, "_models.ConfigurationType"]]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword regions: List of locations. + :paramtype regions: list[str] + :keyword deployment_types: List of deployment types. + :paramtype deployment_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.ConfigurationType] + :keyword skip_token: Continuation token for pagination, capturing the next page size and + offset, as well as the context of the query. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.regions = regions + self.deployment_types = deployment_types + self.skip_token = skip_token + + +class NetworkManagerEffectiveConnectivityConfigurationListResult(_serialization.Model): + """Result of the request to list networkManagerEffectiveConnectivityConfiguration. It contains a + list of groups and a skiptoken to get the next set of results. + + :ivar value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveConnectivityConfiguration] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EffectiveConnectivityConfiguration]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.EffectiveConnectivityConfiguration"]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of NetworkManagerEffectiveConnectivityConfiguration. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.EffectiveConnectivityConfiguration] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class NetworkManagerEffectiveSecurityAdminRulesListResult(_serialization.Model): + """Result of the request to list networkManagerEffectiveSecurityAdminRules. It contains a list of + groups and a skiptoken to get the next set of results. + + :ivar value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveBaseSecurityAdminRule] + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[EffectiveBaseSecurityAdminRule]"}, + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.EffectiveBaseSecurityAdminRule"]] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of NetworkManagerEffectiveSecurityAdminRules. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.EffectiveBaseSecurityAdminRule] + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.value = value + self.skip_token = skip_token + + +class NetworkManagerListResult(_serialization.Model): + """Result of the request to list NetworkManager. It contains a list of network managers and a URL + link to get the next set of results. + + :ivar value: Gets a page of NetworkManager. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkManager]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkManager"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of NetworkManager. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkManagerPropertiesNetworkManagerScopes(_serialization.Model): + """Scope of Network Manager. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar management_groups: List of management groups. + :vartype management_groups: list[str] + :ivar subscriptions: List of subscriptions. + :vartype subscriptions: list[str] + :ivar cross_tenant_scopes: List of cross tenant scopes. + :vartype cross_tenant_scopes: list[~azure.mgmt.network.v2023_09_01.models.CrossTenantScopes] + """ + + _validation = { + "cross_tenant_scopes": {"readonly": True}, + } + + _attribute_map = { + "management_groups": {"key": "managementGroups", "type": "[str]"}, + "subscriptions": {"key": "subscriptions", "type": "[str]"}, + "cross_tenant_scopes": {"key": "crossTenantScopes", "type": "[CrossTenantScopes]"}, + } + + def __init__( + self, *, management_groups: Optional[List[str]] = None, subscriptions: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword management_groups: List of management groups. + :paramtype management_groups: list[str] + :keyword subscriptions: List of subscriptions. + :paramtype subscriptions: list[str] + """ + super().__init__(**kwargs) + self.management_groups = management_groups + self.subscriptions = subscriptions + self.cross_tenant_scopes = None + + +class NetworkManagerSecurityGroupItem(_serialization.Model): + """Network manager security group item. + + All required parameters must be populated in order to send to Azure. + + :ivar network_group_id: Network manager group Id. Required. + :vartype network_group_id: str + """ + + _validation = { + "network_group_id": {"required": True}, + } + + _attribute_map = { + "network_group_id": {"key": "networkGroupId", "type": "str"}, + } + + def __init__(self, *, network_group_id: str, **kwargs: Any) -> None: + """ + :keyword network_group_id: Network manager group Id. Required. + :paramtype network_group_id: str + """ + super().__init__(**kwargs) + self.network_group_id = network_group_id + + +class NetworkProfile(Resource): + """Network profile resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar container_network_interfaces: List of child container network interfaces. + :vartype container_network_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.ContainerNetworkInterface] + :ivar container_network_interface_configurations: List of chid container network interface + configurations. + :vartype container_network_interface_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ContainerNetworkInterfaceConfiguration] + :ivar resource_guid: The resource GUID property of the network profile resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the network profile resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "container_network_interfaces": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "container_network_interfaces": { + "key": "properties.containerNetworkInterfaces", + "type": "[ContainerNetworkInterface]", + }, + "container_network_interface_configurations": { + "key": "properties.containerNetworkInterfaceConfigurations", + "type": "[ContainerNetworkInterfaceConfiguration]", + }, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + container_network_interface_configurations: Optional[ + List["_models.ContainerNetworkInterfaceConfiguration"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword container_network_interface_configurations: List of chid container network interface + configurations. + :paramtype container_network_interface_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ContainerNetworkInterfaceConfiguration] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.container_network_interfaces = None + self.container_network_interface_configurations = container_network_interface_configurations + self.resource_guid = None + self.provisioning_state = None + + +class NetworkProfileListResult(_serialization.Model): + """Response for ListNetworkProfiles API service call. + + :ivar value: A list of network profiles that exist in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NetworkProfile"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of network profiles that exist in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkRule(FirewallPolicyRule): + """Rule of type network. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the rule. + :vartype name: str + :ivar description: Description of the rule. + :vartype description: str + :ivar rule_type: Rule Type. Required. Known values are: "ApplicationRule", "NetworkRule", and + "NatRule". + :vartype rule_type: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleType + :ivar ip_protocols: Array of FirewallPolicyRuleNetworkProtocols. + :vartype ip_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleNetworkProtocol] + :ivar source_addresses: List of source IP addresses for this rule. + :vartype source_addresses: list[str] + :ivar destination_addresses: List of destination IP addresses or Service Tags. + :vartype destination_addresses: list[str] + :ivar destination_ports: List of destination ports. + :vartype destination_ports: list[str] + :ivar source_ip_groups: List of source IpGroups for this rule. + :vartype source_ip_groups: list[str] + :ivar destination_ip_groups: List of destination IpGroups for this rule. + :vartype destination_ip_groups: list[str] + :ivar destination_fqdns: List of destination FQDNs. + :vartype destination_fqdns: list[str] + """ + + _validation = { + "rule_type": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "rule_type": {"key": "ruleType", "type": "str"}, + "ip_protocols": {"key": "ipProtocols", "type": "[str]"}, + "source_addresses": {"key": "sourceAddresses", "type": "[str]"}, + "destination_addresses": {"key": "destinationAddresses", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "source_ip_groups": {"key": "sourceIpGroups", "type": "[str]"}, + "destination_ip_groups": {"key": "destinationIpGroups", "type": "[str]"}, + "destination_fqdns": {"key": "destinationFqdns", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + ip_protocols: Optional[List[Union[str, "_models.FirewallPolicyRuleNetworkProtocol"]]] = None, + source_addresses: Optional[List[str]] = None, + destination_addresses: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + source_ip_groups: Optional[List[str]] = None, + destination_ip_groups: Optional[List[str]] = None, + destination_fqdns: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the rule. + :paramtype name: str + :keyword description: Description of the rule. + :paramtype description: str + :keyword ip_protocols: Array of FirewallPolicyRuleNetworkProtocols. + :paramtype ip_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleNetworkProtocol] + :keyword source_addresses: List of source IP addresses for this rule. + :paramtype source_addresses: list[str] + :keyword destination_addresses: List of destination IP addresses or Service Tags. + :paramtype destination_addresses: list[str] + :keyword destination_ports: List of destination ports. + :paramtype destination_ports: list[str] + :keyword source_ip_groups: List of source IpGroups for this rule. + :paramtype source_ip_groups: list[str] + :keyword destination_ip_groups: List of destination IpGroups for this rule. + :paramtype destination_ip_groups: list[str] + :keyword destination_fqdns: List of destination FQDNs. + :paramtype destination_fqdns: list[str] + """ + super().__init__(name=name, description=description, **kwargs) + self.rule_type: str = "NetworkRule" + self.ip_protocols = ip_protocols + self.source_addresses = source_addresses + self.destination_addresses = destination_addresses + self.destination_ports = destination_ports + self.source_ip_groups = source_ip_groups + self.destination_ip_groups = destination_ip_groups + self.destination_fqdns = destination_fqdns + + +class NetworkSecurityGroup(Resource): # pylint: disable=too-many-instance-attributes + """NetworkSecurityGroup resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar flush_connection: When enabled, flows created from Network Security Group connections + will be re-evaluated when rules are updates. Initial enablement will trigger re-evaluation. + :vartype flush_connection: bool + :ivar security_rules: A collection of security rules of the network security group. + :vartype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :ivar default_security_rules: The default security rules of network security group. + :vartype default_security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :ivar network_interfaces: A collection of references to network interfaces. + :vartype network_interfaces: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :ivar subnets: A collection of references to subnets. + :vartype subnets: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :ivar flow_logs: A collection of references to flow log resources. + :vartype flow_logs: list[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :ivar resource_guid: The resource GUID property of the network security group resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the network security group resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "default_security_rules": {"readonly": True}, + "network_interfaces": {"readonly": True}, + "subnets": {"readonly": True}, + "flow_logs": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "flush_connection": {"key": "properties.flushConnection", "type": "bool"}, + "security_rules": {"key": "properties.securityRules", "type": "[SecurityRule]"}, + "default_security_rules": {"key": "properties.defaultSecurityRules", "type": "[SecurityRule]"}, + "network_interfaces": {"key": "properties.networkInterfaces", "type": "[NetworkInterface]"}, + "subnets": {"key": "properties.subnets", "type": "[Subnet]"}, + "flow_logs": {"key": "properties.flowLogs", "type": "[FlowLog]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + flush_connection: Optional[bool] = None, + security_rules: Optional[List["_models.SecurityRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword flush_connection: When enabled, flows created from Network Security Group connections + will be re-evaluated when rules are updates. Initial enablement will trigger re-evaluation. + :paramtype flush_connection: bool + :keyword security_rules: A collection of security rules of the network security group. + :paramtype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.flush_connection = flush_connection + self.security_rules = security_rules + self.default_security_rules = None + self.network_interfaces = None + self.subnets = None + self.flow_logs = None + self.resource_guid = None + self.provisioning_state = None + + +class NetworkSecurityGroupListResult(_serialization.Model): + """Response for ListNetworkSecurityGroups API service call. + + :ivar value: A list of NetworkSecurityGroup resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkSecurityGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkSecurityGroup"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of NetworkSecurityGroup resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkSecurityGroupResult(_serialization.Model): + """Network configuration diagnostic result corresponded provided traffic query. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar security_rule_access_result: The network traffic is allowed or denied. Known values are: + "Allow" and "Deny". + :vartype security_rule_access_result: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + :ivar evaluated_network_security_groups: List of results network security groups diagnostic. + :vartype evaluated_network_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.EvaluatedNetworkSecurityGroup] + """ + + _validation = { + "evaluated_network_security_groups": {"readonly": True}, + } + + _attribute_map = { + "security_rule_access_result": {"key": "securityRuleAccessResult", "type": "str"}, + "evaluated_network_security_groups": { + "key": "evaluatedNetworkSecurityGroups", + "type": "[EvaluatedNetworkSecurityGroup]", + }, + } + + def __init__( + self, *, security_rule_access_result: Optional[Union[str, "_models.SecurityRuleAccess"]] = None, **kwargs: Any + ) -> None: + """ + :keyword security_rule_access_result: The network traffic is allowed or denied. Known values + are: "Allow" and "Deny". + :paramtype security_rule_access_result: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + """ + super().__init__(**kwargs) + self.security_rule_access_result = security_rule_access_result + self.evaluated_network_security_groups = None + + +class NetworkSecurityRulesEvaluationResult(_serialization.Model): + """Network security rules evaluation result. + + :ivar name: Name of the network security rule. + :vartype name: str + :ivar protocol_matched: Value indicating whether protocol is matched. + :vartype protocol_matched: bool + :ivar source_matched: Value indicating whether source is matched. + :vartype source_matched: bool + :ivar source_port_matched: Value indicating whether source port is matched. + :vartype source_port_matched: bool + :ivar destination_matched: Value indicating whether destination is matched. + :vartype destination_matched: bool + :ivar destination_port_matched: Value indicating whether destination port is matched. + :vartype destination_port_matched: bool + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "protocol_matched": {"key": "protocolMatched", "type": "bool"}, + "source_matched": {"key": "sourceMatched", "type": "bool"}, + "source_port_matched": {"key": "sourcePortMatched", "type": "bool"}, + "destination_matched": {"key": "destinationMatched", "type": "bool"}, + "destination_port_matched": {"key": "destinationPortMatched", "type": "bool"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + protocol_matched: Optional[bool] = None, + source_matched: Optional[bool] = None, + source_port_matched: Optional[bool] = None, + destination_matched: Optional[bool] = None, + destination_port_matched: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the network security rule. + :paramtype name: str + :keyword protocol_matched: Value indicating whether protocol is matched. + :paramtype protocol_matched: bool + :keyword source_matched: Value indicating whether source is matched. + :paramtype source_matched: bool + :keyword source_port_matched: Value indicating whether source port is matched. + :paramtype source_port_matched: bool + :keyword destination_matched: Value indicating whether destination is matched. + :paramtype destination_matched: bool + :keyword destination_port_matched: Value indicating whether destination port is matched. + :paramtype destination_port_matched: bool + """ + super().__init__(**kwargs) + self.name = name + self.protocol_matched = protocol_matched + self.source_matched = source_matched + self.source_port_matched = source_port_matched + self.destination_matched = destination_matched + self.destination_port_matched = destination_port_matched + + +class NetworkVirtualAppliance(Resource): # pylint: disable=too-many-instance-attributes + """NetworkVirtualAppliance Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The service principal that has read access to cloud-init and config blob. + :vartype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar nva_sku: Network Virtual Appliance SKU. + :vartype nva_sku: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSkuProperties + :ivar address_prefix: Address Prefix. + :vartype address_prefix: str + :ivar boot_strap_configuration_blobs: BootStrapConfigurationBlobs storage URLs. + :vartype boot_strap_configuration_blobs: list[str] + :ivar virtual_hub: The Virtual Hub where Network Virtual Appliance is being deployed. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar cloud_init_configuration_blobs: CloudInitConfigurationBlob storage URLs. + :vartype cloud_init_configuration_blobs: list[str] + :ivar cloud_init_configuration: CloudInitConfiguration string in plain text. + :vartype cloud_init_configuration: str + :ivar virtual_appliance_asn: VirtualAppliance ASN. Microsoft private, public and IANA reserved + ASN are not supported. + :vartype virtual_appliance_asn: int + :ivar ssh_public_key: Public key for SSH login. + :vartype ssh_public_key: str + :ivar virtual_appliance_nics: List of Virtual Appliance Network Interfaces. + :vartype virtual_appliance_nics: + list[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceNicProperties] + :ivar additional_nics: Details required for Additional Network Interface. + :vartype additional_nics: + list[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceAdditionalNicProperties] + :ivar internet_ingress_public_ips: List of Resource Uri of Public IPs for Internet Ingress + Scenario. + :vartype internet_ingress_public_ips: + list[~azure.mgmt.network.v2023_09_01.models.InternetIngressPublicIpsProperties] + :ivar virtual_appliance_sites: List of references to VirtualApplianceSite. + :vartype virtual_appliance_sites: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar virtual_appliance_connections: List of references to VirtualApplianceConnections. + :vartype virtual_appliance_connections: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar inbound_security_rules: List of references to InboundSecurityRules. + :vartype inbound_security_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar deployment_type: The deployment type. PartnerManaged for the SaaS NVA. + :vartype deployment_type: str + :ivar delegation: The delegation for the Virtual Appliance. + :vartype delegation: ~azure.mgmt.network.v2023_09_01.models.DelegationProperties + :ivar partner_managed_resource: The delegation for the Virtual Appliance. + :vartype partner_managed_resource: + ~azure.mgmt.network.v2023_09_01.models.PartnerManagedResourceProperties + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "address_prefix": {"readonly": True}, + "virtual_appliance_asn": {"maximum": 4294967295, "minimum": 0}, + "virtual_appliance_nics": {"readonly": True}, + "virtual_appliance_sites": {"readonly": True}, + "virtual_appliance_connections": {"readonly": True}, + "inbound_security_rules": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "deployment_type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "etag": {"key": "etag", "type": "str"}, + "nva_sku": {"key": "properties.nvaSku", "type": "VirtualApplianceSkuProperties"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "boot_strap_configuration_blobs": {"key": "properties.bootStrapConfigurationBlobs", "type": "[str]"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "SubResource"}, + "cloud_init_configuration_blobs": {"key": "properties.cloudInitConfigurationBlobs", "type": "[str]"}, + "cloud_init_configuration": {"key": "properties.cloudInitConfiguration", "type": "str"}, + "virtual_appliance_asn": {"key": "properties.virtualApplianceAsn", "type": "int"}, + "ssh_public_key": {"key": "properties.sshPublicKey", "type": "str"}, + "virtual_appliance_nics": {"key": "properties.virtualApplianceNics", "type": "[VirtualApplianceNicProperties]"}, + "additional_nics": {"key": "properties.additionalNics", "type": "[VirtualApplianceAdditionalNicProperties]"}, + "internet_ingress_public_ips": { + "key": "properties.internetIngressPublicIps", + "type": "[InternetIngressPublicIpsProperties]", + }, + "virtual_appliance_sites": {"key": "properties.virtualApplianceSites", "type": "[SubResource]"}, + "virtual_appliance_connections": {"key": "properties.virtualApplianceConnections", "type": "[SubResource]"}, + "inbound_security_rules": {"key": "properties.inboundSecurityRules", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "deployment_type": {"key": "properties.deploymentType", "type": "str"}, + "delegation": {"key": "properties.delegation", "type": "DelegationProperties"}, + "partner_managed_resource": { + "key": "properties.partnerManagedResource", + "type": "PartnerManagedResourceProperties", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + nva_sku: Optional["_models.VirtualApplianceSkuProperties"] = None, + boot_strap_configuration_blobs: Optional[List[str]] = None, + virtual_hub: Optional["_models.SubResource"] = None, + cloud_init_configuration_blobs: Optional[List[str]] = None, + cloud_init_configuration: Optional[str] = None, + virtual_appliance_asn: Optional[int] = None, + ssh_public_key: Optional[str] = None, + additional_nics: Optional[List["_models.VirtualApplianceAdditionalNicProperties"]] = None, + internet_ingress_public_ips: Optional[List["_models.InternetIngressPublicIpsProperties"]] = None, + delegation: Optional["_models.DelegationProperties"] = None, + partner_managed_resource: Optional["_models.PartnerManagedResourceProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The service principal that has read access to cloud-init and config blob. + :paramtype identity: ~azure.mgmt.network.v2023_09_01.models.ManagedServiceIdentity + :keyword nva_sku: Network Virtual Appliance SKU. + :paramtype nva_sku: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSkuProperties + :keyword boot_strap_configuration_blobs: BootStrapConfigurationBlobs storage URLs. + :paramtype boot_strap_configuration_blobs: list[str] + :keyword virtual_hub: The Virtual Hub where Network Virtual Appliance is being deployed. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword cloud_init_configuration_blobs: CloudInitConfigurationBlob storage URLs. + :paramtype cloud_init_configuration_blobs: list[str] + :keyword cloud_init_configuration: CloudInitConfiguration string in plain text. + :paramtype cloud_init_configuration: str + :keyword virtual_appliance_asn: VirtualAppliance ASN. Microsoft private, public and IANA + reserved ASN are not supported. + :paramtype virtual_appliance_asn: int + :keyword ssh_public_key: Public key for SSH login. + :paramtype ssh_public_key: str + :keyword additional_nics: Details required for Additional Network Interface. + :paramtype additional_nics: + list[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceAdditionalNicProperties] + :keyword internet_ingress_public_ips: List of Resource Uri of Public IPs for Internet Ingress + Scenario. + :paramtype internet_ingress_public_ips: + list[~azure.mgmt.network.v2023_09_01.models.InternetIngressPublicIpsProperties] + :keyword delegation: The delegation for the Virtual Appliance. + :paramtype delegation: ~azure.mgmt.network.v2023_09_01.models.DelegationProperties + :keyword partner_managed_resource: The delegation for the Virtual Appliance. + :paramtype partner_managed_resource: + ~azure.mgmt.network.v2023_09_01.models.PartnerManagedResourceProperties + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.identity = identity + self.etag = None + self.nva_sku = nva_sku + self.address_prefix = None + self.boot_strap_configuration_blobs = boot_strap_configuration_blobs + self.virtual_hub = virtual_hub + self.cloud_init_configuration_blobs = cloud_init_configuration_blobs + self.cloud_init_configuration = cloud_init_configuration + self.virtual_appliance_asn = virtual_appliance_asn + self.ssh_public_key = ssh_public_key + self.virtual_appliance_nics = None + self.additional_nics = additional_nics + self.internet_ingress_public_ips = internet_ingress_public_ips + self.virtual_appliance_sites = None + self.virtual_appliance_connections = None + self.inbound_security_rules = None + self.provisioning_state = None + self.deployment_type = None + self.delegation = delegation + self.partner_managed_resource = partner_managed_resource + + +class NetworkVirtualApplianceConnection(SubResource): + """NetworkVirtualApplianceConnection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar name_properties_name: The name of the resource. + :vartype name_properties_name: str + :ivar provisioning_state: The provisioning state of the NetworkVirtualApplianceConnection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar asn: Network Virtual Appliance ASN. + :vartype asn: int + :ivar tunnel_identifier: Unique identifier for the connection. + :vartype tunnel_identifier: int + :ivar bgp_peer_address: List of bgpPeerAddresses for the NVA instances. + :vartype bgp_peer_address: list[str] + :ivar enable_internet_security: Enable internet security. + :vartype enable_internet_security: bool + :ivar routing_configuration: The Routing Configuration indicating the associated and propagated + route tables on this connection. + :vartype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "asn": {"maximum": 4294967295, "minimum": 0}, + "tunnel_identifier": {"maximum": 4294967295, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "name_properties_name": {"key": "properties.name", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "asn": {"key": "properties.asn", "type": "int"}, + "tunnel_identifier": {"key": "properties.tunnelIdentifier", "type": "int"}, + "bgp_peer_address": {"key": "properties.bgpPeerAddress", "type": "[str]"}, + "enable_internet_security": {"key": "properties.enableInternetSecurity", "type": "bool"}, + "routing_configuration": {"key": "properties.routingConfiguration", "type": "RoutingConfiguration"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + name_properties_name: Optional[str] = None, + asn: Optional[int] = None, + tunnel_identifier: Optional[int] = None, + bgp_peer_address: Optional[List[str]] = None, + enable_internet_security: Optional[bool] = None, + routing_configuration: Optional["_models.RoutingConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword name_properties_name: The name of the resource. + :paramtype name_properties_name: str + :keyword asn: Network Virtual Appliance ASN. + :paramtype asn: int + :keyword tunnel_identifier: Unique identifier for the connection. + :paramtype tunnel_identifier: int + :keyword bgp_peer_address: List of bgpPeerAddresses for the NVA instances. + :paramtype bgp_peer_address: list[str] + :keyword enable_internet_security: Enable internet security. + :paramtype enable_internet_security: bool + :keyword routing_configuration: The Routing Configuration indicating the associated and + propagated route tables on this connection. + :paramtype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + super().__init__(id=id, **kwargs) + self.name = name + self.name_properties_name = name_properties_name + self.provisioning_state = None + self.asn = asn + self.tunnel_identifier = tunnel_identifier + self.bgp_peer_address = bgp_peer_address + self.enable_internet_security = enable_internet_security + self.routing_configuration = routing_configuration + + +class NetworkVirtualApplianceConnectionList(_serialization.Model): + """NetworkVirtualApplianceConnection list. + + :ivar value: The list of NetworkVirtualAppliance connections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkVirtualApplianceConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkVirtualApplianceConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of NetworkVirtualAppliance connections. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkVirtualApplianceListResult(_serialization.Model): + """Response for ListNetworkVirtualAppliances API service call. + + :ivar value: List of Network Virtual Appliances. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkVirtualAppliance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkVirtualAppliance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Network Virtual Appliances. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkVirtualApplianceSiteListResult(_serialization.Model): + """Response for ListNetworkVirtualApplianceSites API service call. + + :ivar value: List of Network Virtual Appliance sites. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualApplianceSite]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualApplianceSite"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Network Virtual Appliance sites. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkVirtualApplianceSku(Resource): + """Definition of the NetworkVirtualApplianceSkus resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar vendor: Network Virtual Appliance Sku vendor. + :vartype vendor: str + :ivar available_versions: Available Network Virtual Appliance versions. + :vartype available_versions: list[str] + :ivar available_scale_units: The list of scale units available. + :vartype available_scale_units: + list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSkuInstances] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "vendor": {"readonly": True}, + "available_versions": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "vendor": {"key": "properties.vendor", "type": "str"}, + "available_versions": {"key": "properties.availableVersions", "type": "[str]"}, + "available_scale_units": { + "key": "properties.availableScaleUnits", + "type": "[NetworkVirtualApplianceSkuInstances]", + }, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + available_scale_units: Optional[List["_models.NetworkVirtualApplianceSkuInstances"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword available_scale_units: The list of scale units available. + :paramtype available_scale_units: + list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSkuInstances] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.vendor = None + self.available_versions = None + self.available_scale_units = available_scale_units + + +class NetworkVirtualApplianceSkuInstances(_serialization.Model): + """List of available Sku and instances. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar scale_unit: Scale Unit. + :vartype scale_unit: str + :ivar instance_count: Instance Count. + :vartype instance_count: int + """ + + _validation = { + "scale_unit": {"readonly": True}, + "instance_count": {"readonly": True}, + } + + _attribute_map = { + "scale_unit": {"key": "scaleUnit", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.scale_unit = None + self.instance_count = None + + +class NetworkVirtualApplianceSkuListResult(_serialization.Model): + """Response for ListNetworkVirtualApplianceSkus API service call. + + :ivar value: List of Network Virtual Appliance Skus that are available. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkVirtualApplianceSku]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkVirtualApplianceSku"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Network Virtual Appliance Skus that are available. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkWatcher(Resource): + """Network watcher in a resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the network watcher resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.provisioning_state = None + + +class NetworkWatcherListResult(_serialization.Model): + """Response for ListNetworkWatchers API service call. + + :ivar value: List of network watcher resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkWatcher]"}, + } + + def __init__(self, *, value: Optional[List["_models.NetworkWatcher"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of network watcher resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + """ + super().__init__(**kwargs) + self.value = value + + +class NextHopParameters(_serialization.Model): + """Parameters that define the source and destination endpoint. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The resource identifier of the target resource against which the + action is to be performed. Required. + :vartype target_resource_id: str + :ivar source_ip_address: The source IP address. Required. + :vartype source_ip_address: str + :ivar destination_ip_address: The destination IP address. Required. + :vartype destination_ip_address: str + :ivar target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is enabled + on any of the nics, then this parameter must be specified. Otherwise optional). + :vartype target_nic_resource_id: str + """ + + _validation = { + "target_resource_id": {"required": True}, + "source_ip_address": {"required": True}, + "destination_ip_address": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "source_ip_address": {"key": "sourceIPAddress", "type": "str"}, + "destination_ip_address": {"key": "destinationIPAddress", "type": "str"}, + "target_nic_resource_id": {"key": "targetNicResourceId", "type": "str"}, + } + + def __init__( + self, + *, + target_resource_id: str, + source_ip_address: str, + destination_ip_address: str, + target_nic_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_resource_id: The resource identifier of the target resource against which the + action is to be performed. Required. + :paramtype target_resource_id: str + :keyword source_ip_address: The source IP address. Required. + :paramtype source_ip_address: str + :keyword destination_ip_address: The destination IP address. Required. + :paramtype destination_ip_address: str + :keyword target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is + enabled on any of the nics, then this parameter must be specified. Otherwise optional). + :paramtype target_nic_resource_id: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + self.source_ip_address = source_ip_address + self.destination_ip_address = destination_ip_address + self.target_nic_resource_id = target_nic_resource_id + + +class NextHopResult(_serialization.Model): + """The information about next hop from the specified VM. + + :ivar next_hop_type: Next hop type. Known values are: "Internet", "VirtualAppliance", + "VirtualNetworkGateway", "VnetLocal", "HyperNetGateway", and "None". + :vartype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.NextHopType + :ivar next_hop_ip_address: Next hop IP Address. + :vartype next_hop_ip_address: str + :ivar route_table_id: The resource identifier for the route table associated with the route + being returned. If the route being returned does not correspond to any user created routes then + this field will be the string 'System Route'. + :vartype route_table_id: str + """ + + _attribute_map = { + "next_hop_type": {"key": "nextHopType", "type": "str"}, + "next_hop_ip_address": {"key": "nextHopIpAddress", "type": "str"}, + "route_table_id": {"key": "routeTableId", "type": "str"}, + } + + def __init__( + self, + *, + next_hop_type: Optional[Union[str, "_models.NextHopType"]] = None, + next_hop_ip_address: Optional[str] = None, + route_table_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_hop_type: Next hop type. Known values are: "Internet", "VirtualAppliance", + "VirtualNetworkGateway", "VnetLocal", "HyperNetGateway", and "None". + :paramtype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.NextHopType + :keyword next_hop_ip_address: Next hop IP Address. + :paramtype next_hop_ip_address: str + :keyword route_table_id: The resource identifier for the route table associated with the route + being returned. If the route being returned does not correspond to any user created routes then + this field will be the string 'System Route'. + :paramtype route_table_id: str + """ + super().__init__(**kwargs) + self.next_hop_type = next_hop_type + self.next_hop_ip_address = next_hop_ip_address + self.route_table_id = route_table_id + + +class O365BreakOutCategoryPolicies(_serialization.Model): + """Office365 breakout categories. + + :ivar allow: Flag to control allow category. + :vartype allow: bool + :ivar optimize: Flag to control optimize category. + :vartype optimize: bool + :ivar default: Flag to control default category. + :vartype default: bool + """ + + _attribute_map = { + "allow": {"key": "allow", "type": "bool"}, + "optimize": {"key": "optimize", "type": "bool"}, + "default": {"key": "default", "type": "bool"}, + } + + def __init__( + self, + *, + allow: Optional[bool] = None, + optimize: Optional[bool] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword allow: Flag to control allow category. + :paramtype allow: bool + :keyword optimize: Flag to control optimize category. + :paramtype optimize: bool + :keyword default: Flag to control default category. + :paramtype default: bool + """ + super().__init__(**kwargs) + self.allow = allow + self.optimize = optimize + self.default = default + + +class O365PolicyProperties(_serialization.Model): + """The Office365 breakout policy. + + :ivar break_out_categories: Office365 breakout categories. + :vartype break_out_categories: + ~azure.mgmt.network.v2023_09_01.models.O365BreakOutCategoryPolicies + """ + + _attribute_map = { + "break_out_categories": {"key": "breakOutCategories", "type": "O365BreakOutCategoryPolicies"}, + } + + def __init__( + self, *, break_out_categories: Optional["_models.O365BreakOutCategoryPolicies"] = None, **kwargs: Any + ) -> None: + """ + :keyword break_out_categories: Office365 breakout categories. + :paramtype break_out_categories: + ~azure.mgmt.network.v2023_09_01.models.O365BreakOutCategoryPolicies + """ + super().__init__(**kwargs) + self.break_out_categories = break_out_categories + + +class Office365PolicyProperties(_serialization.Model): + """Network Virtual Appliance Sku Properties. + + :ivar break_out_categories: Office 365 breakout categories. + :vartype break_out_categories: ~azure.mgmt.network.v2023_09_01.models.BreakOutCategoryPolicies + """ + + _attribute_map = { + "break_out_categories": {"key": "breakOutCategories", "type": "BreakOutCategoryPolicies"}, + } + + def __init__( + self, *, break_out_categories: Optional["_models.BreakOutCategoryPolicies"] = None, **kwargs: Any + ) -> None: + """ + :keyword break_out_categories: Office 365 breakout categories. + :paramtype break_out_categories: + ~azure.mgmt.network.v2023_09_01.models.BreakOutCategoryPolicies + """ + super().__init__(**kwargs) + self.break_out_categories = break_out_categories + + +class Operation(_serialization.Model): + """Network REST API operation definition. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.network.v2023_09_01.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar service_specification: Specification of the service. + :vartype service_specification: + ~azure.mgmt.network.v2023_09_01.models.OperationPropertiesFormatServiceSpecification + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "service_specification": { + "key": "properties.serviceSpecification", + "type": "OperationPropertiesFormatServiceSpecification", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["_models.OperationPropertiesFormatServiceSpecification"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.network.v2023_09_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword service_specification: Specification of the service. + :paramtype service_specification: + ~azure.mgmt.network.v2023_09_01.models.OperationPropertiesFormatServiceSpecification + """ + super().__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.service_specification = service_specification + + +class OperationDisplay(_serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Service provider: Microsoft Network. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of the operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of 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: Service provider: Microsoft Network. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of the operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(_serialization.Model): + """Result of the request to list Network operations. It contains a list of operations and a URL + link to get the next set of results. + + :ivar value: List of Network operations supported by the Network resource provider. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Network operations supported by the Network resource provider. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationPropertiesFormatServiceSpecification(_serialization.Model): + """Specification of the service. + + :ivar metric_specifications: Operation service specification. + :vartype metric_specifications: + list[~azure.mgmt.network.v2023_09_01.models.MetricSpecification] + :ivar log_specifications: Operation log specification. + :vartype log_specifications: list[~azure.mgmt.network.v2023_09_01.models.LogSpecification] + """ + + _attribute_map = { + "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword metric_specifications: Operation service specification. + :paramtype metric_specifications: + list[~azure.mgmt.network.v2023_09_01.models.MetricSpecification] + :keyword log_specifications: Operation log specification. + :paramtype log_specifications: list[~azure.mgmt.network.v2023_09_01.models.LogSpecification] + """ + super().__init__(**kwargs) + self.metric_specifications = metric_specifications + self.log_specifications = log_specifications + + +class OrderBy(_serialization.Model): + """Describes a column to sort. + + :ivar field: Describes the actual column name to sort by. + :vartype field: str + :ivar order: Describes if results should be in ascending/descending order. Known values are: + "Ascending" and "Descending". + :vartype order: str or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSQuerySortOrder + """ + + _attribute_map = { + "field": {"key": "field", "type": "str"}, + "order": {"key": "order", "type": "str"}, + } + + def __init__( + self, + *, + field: Optional[str] = None, + order: Optional[Union[str, "_models.FirewallPolicyIDPSQuerySortOrder"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword field: Describes the actual column name to sort by. + :paramtype field: str + :keyword order: Describes if results should be in ascending/descending order. Known values are: + "Ascending" and "Descending". + :paramtype order: str or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSQuerySortOrder + """ + super().__init__(**kwargs) + self.field = field + self.order = order + + +class OutboundRule(SubResource): # pylint: disable=too-many-instance-attributes + """Outbound rule of the load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of outbound rules used by + the load balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar allocated_outbound_ports: The number of outbound ports to be used for NAT. + :vartype allocated_outbound_ports: int + :ivar frontend_ip_configurations: The Frontend IP addresses of the load balancer. + :vartype frontend_ip_configurations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar backend_address_pool: A reference to a pool of DIPs. Outbound traffic is randomly load + balanced across IPs in the backend IPs. + :vartype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar provisioning_state: The provisioning state of the outbound rule resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar protocol: The protocol for the outbound rule in load balancer. Known values are: "Tcp", + "Udp", and "All". + :vartype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.LoadBalancerOutboundRuleProtocol + :ivar enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected + connection termination. This element is only used when the protocol is set to TCP. + :vartype enable_tcp_reset: bool + :ivar idle_timeout_in_minutes: The timeout for the TCP idle connection. + :vartype idle_timeout_in_minutes: int + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "allocated_outbound_ports": {"key": "properties.allocatedOutboundPorts", "type": "int"}, + "frontend_ip_configurations": {"key": "properties.frontendIPConfigurations", "type": "[SubResource]"}, + "backend_address_pool": {"key": "properties.backendAddressPool", "type": "SubResource"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "enable_tcp_reset": {"key": "properties.enableTcpReset", "type": "bool"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + allocated_outbound_ports: Optional[int] = None, + frontend_ip_configurations: Optional[List["_models.SubResource"]] = None, + backend_address_pool: Optional["_models.SubResource"] = None, + protocol: Optional[Union[str, "_models.LoadBalancerOutboundRuleProtocol"]] = None, + enable_tcp_reset: Optional[bool] = None, + idle_timeout_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of outbound rules used by + the load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword allocated_outbound_ports: The number of outbound ports to be used for NAT. + :paramtype allocated_outbound_ports: int + :keyword frontend_ip_configurations: The Frontend IP addresses of the load balancer. + :paramtype frontend_ip_configurations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword backend_address_pool: A reference to a pool of DIPs. Outbound traffic is randomly load + balanced across IPs in the backend IPs. + :paramtype backend_address_pool: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword protocol: The protocol for the outbound rule in load balancer. Known values are: + "Tcp", "Udp", and "All". + :paramtype protocol: str or + ~azure.mgmt.network.v2023_09_01.models.LoadBalancerOutboundRuleProtocol + :keyword enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or + unexpected connection termination. This element is only used when the protocol is set to TCP. + :paramtype enable_tcp_reset: bool + :keyword idle_timeout_in_minutes: The timeout for the TCP idle connection. + :paramtype idle_timeout_in_minutes: int + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.allocated_outbound_ports = allocated_outbound_ports + self.frontend_ip_configurations = frontend_ip_configurations + self.backend_address_pool = backend_address_pool + self.provisioning_state = None + self.protocol = protocol + self.enable_tcp_reset = enable_tcp_reset + self.idle_timeout_in_minutes = idle_timeout_in_minutes + + +class OwaspCrsExclusionEntry(_serialization.Model): + """Allow to exclude some variable satisfy the condition for the WAF check. + + All required parameters must be populated in order to send to Azure. + + :ivar match_variable: The variable to be excluded. Required. Known values are: + "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestHeaderKeys", + "RequestHeaderValues", "RequestCookieKeys", "RequestCookieValues", "RequestArgKeys", and + "RequestArgValues". + :vartype match_variable: str or + ~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntryMatchVariable + :ivar selector_match_operator: When matchVariable is a collection, operate on the selector to + specify which elements in the collection this exclusion applies to. Required. Known values are: + "Equals", "Contains", "StartsWith", "EndsWith", and "EqualsAny". + :vartype selector_match_operator: str or + ~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntrySelectorMatchOperator + :ivar selector: When matchVariable is a collection, operator used to specify which elements in + the collection this exclusion applies to. Required. + :vartype selector: str + :ivar exclusion_managed_rule_sets: The managed rule sets that are associated with the + exclusion. + :vartype exclusion_managed_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRuleSet] + """ + + _validation = { + "match_variable": {"required": True}, + "selector_match_operator": {"required": True}, + "selector": {"required": True}, + } + + _attribute_map = { + "match_variable": {"key": "matchVariable", "type": "str"}, + "selector_match_operator": {"key": "selectorMatchOperator", "type": "str"}, + "selector": {"key": "selector", "type": "str"}, + "exclusion_managed_rule_sets": {"key": "exclusionManagedRuleSets", "type": "[ExclusionManagedRuleSet]"}, + } + + def __init__( + self, + *, + match_variable: Union[str, "_models.OwaspCrsExclusionEntryMatchVariable"], + selector_match_operator: Union[str, "_models.OwaspCrsExclusionEntrySelectorMatchOperator"], + selector: str, + exclusion_managed_rule_sets: Optional[List["_models.ExclusionManagedRuleSet"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword match_variable: The variable to be excluded. Required. Known values are: + "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestHeaderKeys", + "RequestHeaderValues", "RequestCookieKeys", "RequestCookieValues", "RequestArgKeys", and + "RequestArgValues". + :paramtype match_variable: str or + ~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntryMatchVariable + :keyword selector_match_operator: When matchVariable is a collection, operate on the selector + to specify which elements in the collection this exclusion applies to. Required. Known values + are: "Equals", "Contains", "StartsWith", "EndsWith", and "EqualsAny". + :paramtype selector_match_operator: str or + ~azure.mgmt.network.v2023_09_01.models.OwaspCrsExclusionEntrySelectorMatchOperator + :keyword selector: When matchVariable is a collection, operator used to specify which elements + in the collection this exclusion applies to. Required. + :paramtype selector: str + :keyword exclusion_managed_rule_sets: The managed rule sets that are associated with the + exclusion. + :paramtype exclusion_managed_rule_sets: + list[~azure.mgmt.network.v2023_09_01.models.ExclusionManagedRuleSet] + """ + super().__init__(**kwargs) + self.match_variable = match_variable + self.selector_match_operator = selector_match_operator + self.selector = selector + self.exclusion_managed_rule_sets = exclusion_managed_rule_sets + + +class P2SConnectionConfiguration(SubResource): + """P2SConnectionConfiguration Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :vartype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar routing_configuration: The Routing Configuration indicating the associated and propagated + route tables on this connection. + :vartype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + :ivar enable_internet_security: Flag indicating whether the enable internet security flag is + turned on for the P2S Connections or not. + :vartype enable_internet_security: bool + :ivar configuration_policy_group_associations: List of Configuration Policy Groups that this + P2SConnectionConfiguration is attached to. + :vartype configuration_policy_group_associations: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar previous_configuration_policy_group_associations: List of previous Configuration Policy + Groups that this P2SConnectionConfiguration was attached to. + :vartype previous_configuration_policy_group_associations: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :ivar provisioning_state: The provisioning state of the P2SConnectionConfiguration resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "configuration_policy_group_associations": {"readonly": True}, + "previous_configuration_policy_group_associations": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "vpn_client_address_pool": {"key": "properties.vpnClientAddressPool", "type": "AddressSpace"}, + "routing_configuration": {"key": "properties.routingConfiguration", "type": "RoutingConfiguration"}, + "enable_internet_security": {"key": "properties.enableInternetSecurity", "type": "bool"}, + "configuration_policy_group_associations": { + "key": "properties.configurationPolicyGroupAssociations", + "type": "[SubResource]", + }, + "previous_configuration_policy_group_associations": { + "key": "properties.previousConfigurationPolicyGroupAssociations", + "type": "[VpnServerConfigurationPolicyGroup]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + vpn_client_address_pool: Optional["_models.AddressSpace"] = None, + routing_configuration: Optional["_models.RoutingConfiguration"] = None, + enable_internet_security: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :paramtype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword routing_configuration: The Routing Configuration indicating the associated and + propagated route tables on this connection. + :paramtype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + :keyword enable_internet_security: Flag indicating whether the enable internet security flag is + turned on for the P2S Connections or not. + :paramtype enable_internet_security: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.vpn_client_address_pool = vpn_client_address_pool + self.routing_configuration = routing_configuration + self.enable_internet_security = enable_internet_security + self.configuration_policy_group_associations = None + self.previous_configuration_policy_group_associations = None + self.provisioning_state = None + + +class P2SVpnConnectionHealth(_serialization.Model): + """P2S Vpn connection detailed health written to sas url. + + :ivar sas_url: Returned sas url of the blob to which the p2s vpn connection detailed health + will be written. + :vartype sas_url: str + """ + + _attribute_map = { + "sas_url": {"key": "sasUrl", "type": "str"}, + } + + def __init__(self, *, sas_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword sas_url: Returned sas url of the blob to which the p2s vpn connection detailed health + will be written. + :paramtype sas_url: str + """ + super().__init__(**kwargs) + self.sas_url = sas_url + + +class P2SVpnConnectionHealthRequest(_serialization.Model): + """List of P2S Vpn connection health request. + + :ivar vpn_user_names_filter: The list of p2s vpn user names whose p2s vpn connection detailed + health to retrieve for. + :vartype vpn_user_names_filter: list[str] + :ivar output_blob_sas_url: The sas-url to download the P2S Vpn connection health detail. + :vartype output_blob_sas_url: str + """ + + _attribute_map = { + "vpn_user_names_filter": {"key": "vpnUserNamesFilter", "type": "[str]"}, + "output_blob_sas_url": {"key": "outputBlobSasUrl", "type": "str"}, + } + + def __init__( + self, + *, + vpn_user_names_filter: Optional[List[str]] = None, + output_blob_sas_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword vpn_user_names_filter: The list of p2s vpn user names whose p2s vpn connection + detailed health to retrieve for. + :paramtype vpn_user_names_filter: list[str] + :keyword output_blob_sas_url: The sas-url to download the P2S Vpn connection health detail. + :paramtype output_blob_sas_url: str + """ + super().__init__(**kwargs) + self.vpn_user_names_filter = vpn_user_names_filter + self.output_blob_sas_url = output_blob_sas_url + + +class P2SVpnConnectionRequest(_serialization.Model): + """List of p2s vpn connections to be disconnected. + + :ivar vpn_connection_ids: List of p2s vpn connection Ids. + :vartype vpn_connection_ids: list[str] + """ + + _attribute_map = { + "vpn_connection_ids": {"key": "vpnConnectionIds", "type": "[str]"}, + } + + def __init__(self, *, vpn_connection_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword vpn_connection_ids: List of p2s vpn connection Ids. + :paramtype vpn_connection_ids: list[str] + """ + super().__init__(**kwargs) + self.vpn_connection_ids = vpn_connection_ids + + +class P2SVpnGateway(Resource): # pylint: disable=too-many-instance-attributes + """P2SVpnGateway Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar virtual_hub: The VirtualHub to which the gateway belongs. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar p2_s_connection_configurations: List of all p2s connection configurations of the gateway. + :vartype p2_s_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.P2SConnectionConfiguration] + :ivar provisioning_state: The provisioning state of the P2S VPN gateway resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar vpn_gateway_scale_unit: The scale unit for this p2s vpn gateway. + :vartype vpn_gateway_scale_unit: int + :ivar vpn_server_configuration: The VpnServerConfiguration to which the p2sVpnGateway is + attached to. + :vartype vpn_server_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar vpn_client_connection_health: All P2S VPN clients' connection health status. + :vartype vpn_client_connection_health: + ~azure.mgmt.network.v2023_09_01.models.VpnClientConnectionHealth + :ivar custom_dns_servers: List of all customer specified DNS servers IP addresses. + :vartype custom_dns_servers: list[str] + :ivar is_routing_preference_internet: Enable Routing Preference property for the Public IP + Interface of the P2SVpnGateway. + :vartype is_routing_preference_internet: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "vpn_client_connection_health": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "SubResource"}, + "p2_s_connection_configurations": { + "key": "properties.p2SConnectionConfigurations", + "type": "[P2SConnectionConfiguration]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vpn_gateway_scale_unit": {"key": "properties.vpnGatewayScaleUnit", "type": "int"}, + "vpn_server_configuration": {"key": "properties.vpnServerConfiguration", "type": "SubResource"}, + "vpn_client_connection_health": { + "key": "properties.vpnClientConnectionHealth", + "type": "VpnClientConnectionHealth", + }, + "custom_dns_servers": {"key": "properties.customDnsServers", "type": "[str]"}, + "is_routing_preference_internet": {"key": "properties.isRoutingPreferenceInternet", "type": "bool"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + virtual_hub: Optional["_models.SubResource"] = None, + p2_s_connection_configurations: Optional[List["_models.P2SConnectionConfiguration"]] = None, + vpn_gateway_scale_unit: Optional[int] = None, + vpn_server_configuration: Optional["_models.SubResource"] = None, + custom_dns_servers: Optional[List[str]] = None, + is_routing_preference_internet: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword virtual_hub: The VirtualHub to which the gateway belongs. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword p2_s_connection_configurations: List of all p2s connection configurations of the + gateway. + :paramtype p2_s_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.P2SConnectionConfiguration] + :keyword vpn_gateway_scale_unit: The scale unit for this p2s vpn gateway. + :paramtype vpn_gateway_scale_unit: int + :keyword vpn_server_configuration: The VpnServerConfiguration to which the p2sVpnGateway is + attached to. + :paramtype vpn_server_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword custom_dns_servers: List of all customer specified DNS servers IP addresses. + :paramtype custom_dns_servers: list[str] + :keyword is_routing_preference_internet: Enable Routing Preference property for the Public IP + Interface of the P2SVpnGateway. + :paramtype is_routing_preference_internet: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.virtual_hub = virtual_hub + self.p2_s_connection_configurations = p2_s_connection_configurations + self.provisioning_state = None + self.vpn_gateway_scale_unit = vpn_gateway_scale_unit + self.vpn_server_configuration = vpn_server_configuration + self.vpn_client_connection_health = None + self.custom_dns_servers = custom_dns_servers + self.is_routing_preference_internet = is_routing_preference_internet + + +class P2SVpnProfileParameters(_serialization.Model): + """Vpn Client Parameters for package generation. + + :ivar authentication_method: VPN client authentication method. Known values are: "EAPTLS" and + "EAPMSCHAPv2". + :vartype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + """ + + _attribute_map = { + "authentication_method": {"key": "authenticationMethod", "type": "str"}, + } + + def __init__( + self, *, authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = None, **kwargs: Any + ) -> None: + """ + :keyword authentication_method: VPN client authentication method. Known values are: "EAPTLS" + and "EAPMSCHAPv2". + :paramtype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + """ + super().__init__(**kwargs) + self.authentication_method = authentication_method + + +class PacketCapture(_serialization.Model): + """Parameters that define the create packet capture operation. + + All required parameters must be populated in order to send to Azure. + + :ivar target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :vartype target: str + :ivar scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :vartype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :ivar target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :vartype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :ivar bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are + truncated. + :vartype bytes_to_capture_per_packet: int + :ivar total_bytes_per_session: Maximum size of the capture output. + :vartype total_bytes_per_session: int + :ivar time_limit_in_seconds: Maximum duration of the capture session in seconds. + :vartype time_limit_in_seconds: int + :ivar storage_location: The storage location for a packet capture session. Required. + :vartype storage_location: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :ivar filters: A list of packet capture filters. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + + _validation = { + "target": {"required": True}, + "bytes_to_capture_per_packet": {"maximum": 4294967295, "minimum": 0}, + "total_bytes_per_session": {"maximum": 4294967295, "minimum": 0}, + "time_limit_in_seconds": {"maximum": 18000, "minimum": 0}, + "storage_location": {"required": True}, + } + + _attribute_map = { + "target": {"key": "properties.target", "type": "str"}, + "scope": {"key": "properties.scope", "type": "PacketCaptureMachineScope"}, + "target_type": {"key": "properties.targetType", "type": "str"}, + "bytes_to_capture_per_packet": {"key": "properties.bytesToCapturePerPacket", "type": "int"}, + "total_bytes_per_session": {"key": "properties.totalBytesPerSession", "type": "int"}, + "time_limit_in_seconds": {"key": "properties.timeLimitInSeconds", "type": "int"}, + "storage_location": {"key": "properties.storageLocation", "type": "PacketCaptureStorageLocation"}, + "filters": {"key": "properties.filters", "type": "[PacketCaptureFilter]"}, + } + + def __init__( + self, + *, + target: str, + storage_location: "_models.PacketCaptureStorageLocation", + scope: Optional["_models.PacketCaptureMachineScope"] = None, + target_type: Optional[Union[str, "_models.PacketCaptureTargetType"]] = None, + bytes_to_capture_per_packet: int = 0, + total_bytes_per_session: int = 1073741824, + time_limit_in_seconds: int = 18000, + filters: Optional[List["_models.PacketCaptureFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :paramtype target: str + :keyword scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :paramtype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :keyword target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :paramtype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :keyword bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes + are truncated. + :paramtype bytes_to_capture_per_packet: int + :keyword total_bytes_per_session: Maximum size of the capture output. + :paramtype total_bytes_per_session: int + :keyword time_limit_in_seconds: Maximum duration of the capture session in seconds. + :paramtype time_limit_in_seconds: int + :keyword storage_location: The storage location for a packet capture session. Required. + :paramtype storage_location: + ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :keyword filters: A list of packet capture filters. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + super().__init__(**kwargs) + self.target = target + self.scope = scope + self.target_type = target_type + self.bytes_to_capture_per_packet = bytes_to_capture_per_packet + self.total_bytes_per_session = total_bytes_per_session + self.time_limit_in_seconds = time_limit_in_seconds + self.storage_location = storage_location + self.filters = filters + + +class PacketCaptureFilter(_serialization.Model): + """Filter that is applied to packet capture request. Multiple filters can be applied. + + :ivar protocol: Protocol to be filtered on. Known values are: "TCP", "UDP", and "Any". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.PcProtocol + :ivar local_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for single + address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. + Multiple ranges not currently supported. Mixing ranges with multiple entries not currently + supported. Default = null. + :vartype local_ip_address: str + :ivar remote_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for single + address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5;" for multiple entries. + Multiple ranges not currently supported. Mixing ranges with multiple entries not currently + supported. Default = null. + :vartype remote_ip_address: str + :ivar local_port: Local port to be filtered on. Notation: "80" for single port entry."80-85" + for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing + ranges with multiple entries not currently supported. Default = null. + :vartype local_port: str + :ivar remote_port: Remote port to be filtered on. Notation: "80" for single port entry."80-85" + for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing + ranges with multiple entries not currently supported. Default = null. + :vartype remote_port: str + """ + + _attribute_map = { + "protocol": {"key": "protocol", "type": "str"}, + "local_ip_address": {"key": "localIPAddress", "type": "str"}, + "remote_ip_address": {"key": "remoteIPAddress", "type": "str"}, + "local_port": {"key": "localPort", "type": "str"}, + "remote_port": {"key": "remotePort", "type": "str"}, + } + + def __init__( + self, + *, + protocol: Union[str, "_models.PcProtocol"] = "Any", + local_ip_address: Optional[str] = None, + remote_ip_address: Optional[str] = None, + local_port: Optional[str] = None, + remote_port: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword protocol: Protocol to be filtered on. Known values are: "TCP", "UDP", and "Any". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.PcProtocol + :keyword local_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for single + address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. + Multiple ranges not currently supported. Mixing ranges with multiple entries not currently + supported. Default = null. + :paramtype local_ip_address: str + :keyword remote_ip_address: Local IP Address to be filtered on. Notation: "127.0.0.1" for + single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5;" for multiple + entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not + currently supported. Default = null. + :paramtype remote_ip_address: str + :keyword local_port: Local port to be filtered on. Notation: "80" for single port entry."80-85" + for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing + ranges with multiple entries not currently supported. Default = null. + :paramtype local_port: str + :keyword remote_port: Remote port to be filtered on. Notation: "80" for single port + entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently + supported. Mixing ranges with multiple entries not currently supported. Default = null. + :paramtype remote_port: str + """ + super().__init__(**kwargs) + self.protocol = protocol + self.local_ip_address = local_ip_address + self.remote_ip_address = remote_ip_address + self.local_port = local_port + self.remote_port = remote_port + + +class PacketCaptureListResult(_serialization.Model): + """List of packet capture sessions. + + :ivar value: Information about packet capture sessions. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PacketCaptureResult]"}, + } + + def __init__(self, *, value: Optional[List["_models.PacketCaptureResult"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Information about packet capture sessions. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + """ + super().__init__(**kwargs) + self.value = value + + +class PacketCaptureMachineScope(_serialization.Model): + """A list of AzureVMSS instances which can be included or excluded to run packet capture. If both + included and excluded are empty, then the packet capture will run on all instances of + AzureVMSS. + + :ivar include: List of AzureVMSS instances to run packet capture on. + :vartype include: list[str] + :ivar exclude: List of AzureVMSS instances which has to be excluded from the AzureVMSS from + running packet capture. + :vartype exclude: list[str] + """ + + _attribute_map = { + "include": {"key": "include", "type": "[str]"}, + "exclude": {"key": "exclude", "type": "[str]"}, + } + + def __init__( + self, *, include: Optional[List[str]] = None, exclude: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include: List of AzureVMSS instances to run packet capture on. + :paramtype include: list[str] + :keyword exclude: List of AzureVMSS instances which has to be excluded from the AzureVMSS from + running packet capture. + :paramtype exclude: list[str] + """ + super().__init__(**kwargs) + self.include = include + self.exclude = exclude + + +class PacketCaptureParameters(_serialization.Model): + """Parameters that define the create packet capture operation. + + All required parameters must be populated in order to send to Azure. + + :ivar target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :vartype target: str + :ivar scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :vartype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :ivar target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :vartype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :ivar bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are + truncated. + :vartype bytes_to_capture_per_packet: int + :ivar total_bytes_per_session: Maximum size of the capture output. + :vartype total_bytes_per_session: int + :ivar time_limit_in_seconds: Maximum duration of the capture session in seconds. + :vartype time_limit_in_seconds: int + :ivar storage_location: The storage location for a packet capture session. Required. + :vartype storage_location: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :ivar filters: A list of packet capture filters. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + + _validation = { + "target": {"required": True}, + "bytes_to_capture_per_packet": {"maximum": 4294967295, "minimum": 0}, + "total_bytes_per_session": {"maximum": 4294967295, "minimum": 0}, + "time_limit_in_seconds": {"maximum": 18000, "minimum": 0}, + "storage_location": {"required": True}, + } + + _attribute_map = { + "target": {"key": "target", "type": "str"}, + "scope": {"key": "scope", "type": "PacketCaptureMachineScope"}, + "target_type": {"key": "targetType", "type": "str"}, + "bytes_to_capture_per_packet": {"key": "bytesToCapturePerPacket", "type": "int"}, + "total_bytes_per_session": {"key": "totalBytesPerSession", "type": "int"}, + "time_limit_in_seconds": {"key": "timeLimitInSeconds", "type": "int"}, + "storage_location": {"key": "storageLocation", "type": "PacketCaptureStorageLocation"}, + "filters": {"key": "filters", "type": "[PacketCaptureFilter]"}, + } + + def __init__( + self, + *, + target: str, + storage_location: "_models.PacketCaptureStorageLocation", + scope: Optional["_models.PacketCaptureMachineScope"] = None, + target_type: Optional[Union[str, "_models.PacketCaptureTargetType"]] = None, + bytes_to_capture_per_packet: int = 0, + total_bytes_per_session: int = 1073741824, + time_limit_in_seconds: int = 18000, + filters: Optional[List["_models.PacketCaptureFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :paramtype target: str + :keyword scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :paramtype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :keyword target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :paramtype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :keyword bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes + are truncated. + :paramtype bytes_to_capture_per_packet: int + :keyword total_bytes_per_session: Maximum size of the capture output. + :paramtype total_bytes_per_session: int + :keyword time_limit_in_seconds: Maximum duration of the capture session in seconds. + :paramtype time_limit_in_seconds: int + :keyword storage_location: The storage location for a packet capture session. Required. + :paramtype storage_location: + ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :keyword filters: A list of packet capture filters. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + super().__init__(**kwargs) + self.target = target + self.scope = scope + self.target_type = target_type + self.bytes_to_capture_per_packet = bytes_to_capture_per_packet + self.total_bytes_per_session = total_bytes_per_session + self.time_limit_in_seconds = time_limit_in_seconds + self.storage_location = storage_location + self.filters = filters + + +class PacketCaptureQueryStatusResult(_serialization.Model): + """Status of packet capture session. + + :ivar name: The name of the packet capture resource. + :vartype name: str + :ivar id: The ID of the packet capture resource. + :vartype id: str + :ivar capture_start_time: The start time of the packet capture session. + :vartype capture_start_time: ~datetime.datetime + :ivar packet_capture_status: The status of the packet capture session. Known values are: + "NotStarted", "Running", "Stopped", "Error", and "Unknown". + :vartype packet_capture_status: str or ~azure.mgmt.network.v2023_09_01.models.PcStatus + :ivar stop_reason: The reason the current packet capture session was stopped. + :vartype stop_reason: str + :ivar packet_capture_error: List of errors of packet capture session. + :vartype packet_capture_error: list[str or ~azure.mgmt.network.v2023_09_01.models.PcError] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "capture_start_time": {"key": "captureStartTime", "type": "iso-8601"}, + "packet_capture_status": {"key": "packetCaptureStatus", "type": "str"}, + "stop_reason": {"key": "stopReason", "type": "str"}, + "packet_capture_error": {"key": "packetCaptureError", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + capture_start_time: Optional[datetime.datetime] = None, + packet_capture_status: Optional[Union[str, "_models.PcStatus"]] = None, + stop_reason: Optional[str] = None, + packet_capture_error: Optional[List[Union[str, "_models.PcError"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the packet capture resource. + :paramtype name: str + :keyword id: The ID of the packet capture resource. + :paramtype id: str + :keyword capture_start_time: The start time of the packet capture session. + :paramtype capture_start_time: ~datetime.datetime + :keyword packet_capture_status: The status of the packet capture session. Known values are: + "NotStarted", "Running", "Stopped", "Error", and "Unknown". + :paramtype packet_capture_status: str or ~azure.mgmt.network.v2023_09_01.models.PcStatus + :keyword stop_reason: The reason the current packet capture session was stopped. + :paramtype stop_reason: str + :keyword packet_capture_error: List of errors of packet capture session. + :paramtype packet_capture_error: list[str or ~azure.mgmt.network.v2023_09_01.models.PcError] + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.capture_start_time = capture_start_time + self.packet_capture_status = packet_capture_status + self.stop_reason = stop_reason + self.packet_capture_error = packet_capture_error + + +class PacketCaptureResult(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Information about packet capture session. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the packet capture session. + :vartype name: str + :ivar id: ID of the packet capture operation. + :vartype id: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. + :vartype target: str + :ivar scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :vartype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :ivar target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :vartype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :ivar bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are + truncated. + :vartype bytes_to_capture_per_packet: int + :ivar total_bytes_per_session: Maximum size of the capture output. + :vartype total_bytes_per_session: int + :ivar time_limit_in_seconds: Maximum duration of the capture session in seconds. + :vartype time_limit_in_seconds: int + :ivar storage_location: The storage location for a packet capture session. + :vartype storage_location: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :ivar filters: A list of packet capture filters. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + :ivar provisioning_state: The provisioning state of the packet capture session. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "etag": {"readonly": True}, + "bytes_to_capture_per_packet": {"maximum": 4294967295, "minimum": 0}, + "total_bytes_per_session": {"maximum": 4294967295, "minimum": 0}, + "time_limit_in_seconds": {"maximum": 18000, "minimum": 0}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "target": {"key": "properties.target", "type": "str"}, + "scope": {"key": "properties.scope", "type": "PacketCaptureMachineScope"}, + "target_type": {"key": "properties.targetType", "type": "str"}, + "bytes_to_capture_per_packet": {"key": "properties.bytesToCapturePerPacket", "type": "int"}, + "total_bytes_per_session": {"key": "properties.totalBytesPerSession", "type": "int"}, + "time_limit_in_seconds": {"key": "properties.timeLimitInSeconds", "type": "int"}, + "storage_location": {"key": "properties.storageLocation", "type": "PacketCaptureStorageLocation"}, + "filters": {"key": "properties.filters", "type": "[PacketCaptureFilter]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + target: Optional[str] = None, + scope: Optional["_models.PacketCaptureMachineScope"] = None, + target_type: Optional[Union[str, "_models.PacketCaptureTargetType"]] = None, + bytes_to_capture_per_packet: int = 0, + total_bytes_per_session: int = 1073741824, + time_limit_in_seconds: int = 18000, + storage_location: Optional["_models.PacketCaptureStorageLocation"] = None, + filters: Optional[List["_models.PacketCaptureFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. + :paramtype target: str + :keyword scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :paramtype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :keyword target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :paramtype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :keyword bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes + are truncated. + :paramtype bytes_to_capture_per_packet: int + :keyword total_bytes_per_session: Maximum size of the capture output. + :paramtype total_bytes_per_session: int + :keyword time_limit_in_seconds: Maximum duration of the capture session in seconds. + :paramtype time_limit_in_seconds: int + :keyword storage_location: The storage location for a packet capture session. + :paramtype storage_location: + ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :keyword filters: A list of packet capture filters. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.etag = None + self.target = target + self.scope = scope + self.target_type = target_type + self.bytes_to_capture_per_packet = bytes_to_capture_per_packet + self.total_bytes_per_session = total_bytes_per_session + self.time_limit_in_seconds = time_limit_in_seconds + self.storage_location = storage_location + self.filters = filters + self.provisioning_state = None + + +class PacketCaptureResultProperties(PacketCaptureParameters): + """The properties of a packet capture session. + + 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 target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :vartype target: str + :ivar scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :vartype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :ivar target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :vartype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :ivar bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are + truncated. + :vartype bytes_to_capture_per_packet: int + :ivar total_bytes_per_session: Maximum size of the capture output. + :vartype total_bytes_per_session: int + :ivar time_limit_in_seconds: Maximum duration of the capture session in seconds. + :vartype time_limit_in_seconds: int + :ivar storage_location: The storage location for a packet capture session. Required. + :vartype storage_location: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :ivar filters: A list of packet capture filters. + :vartype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + :ivar provisioning_state: The provisioning state of the packet capture session. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "target": {"required": True}, + "bytes_to_capture_per_packet": {"maximum": 4294967295, "minimum": 0}, + "total_bytes_per_session": {"maximum": 4294967295, "minimum": 0}, + "time_limit_in_seconds": {"maximum": 18000, "minimum": 0}, + "storage_location": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "target": {"key": "target", "type": "str"}, + "scope": {"key": "scope", "type": "PacketCaptureMachineScope"}, + "target_type": {"key": "targetType", "type": "str"}, + "bytes_to_capture_per_packet": {"key": "bytesToCapturePerPacket", "type": "int"}, + "total_bytes_per_session": {"key": "totalBytesPerSession", "type": "int"}, + "time_limit_in_seconds": {"key": "timeLimitInSeconds", "type": "int"}, + "storage_location": {"key": "storageLocation", "type": "PacketCaptureStorageLocation"}, + "filters": {"key": "filters", "type": "[PacketCaptureFilter]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + target: str, + storage_location: "_models.PacketCaptureStorageLocation", + scope: Optional["_models.PacketCaptureMachineScope"] = None, + target_type: Optional[Union[str, "_models.PacketCaptureTargetType"]] = None, + bytes_to_capture_per_packet: int = 0, + total_bytes_per_session: int = 1073741824, + time_limit_in_seconds: int = 18000, + filters: Optional[List["_models.PacketCaptureFilter"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target: The ID of the targeted resource, only AzureVM and AzureVMSS as target type are + currently supported. Required. + :paramtype target: str + :keyword scope: A list of AzureVMSS instances which can be included or excluded to run packet + capture. If both included and excluded are empty, then the packet capture will run on all + instances of AzureVMSS. + :paramtype scope: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureMachineScope + :keyword target_type: Target type of the resource provided. Known values are: "AzureVM" and + "AzureVMSS". + :paramtype target_type: str or ~azure.mgmt.network.v2023_09_01.models.PacketCaptureTargetType + :keyword bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes + are truncated. + :paramtype bytes_to_capture_per_packet: int + :keyword total_bytes_per_session: Maximum size of the capture output. + :paramtype total_bytes_per_session: int + :keyword time_limit_in_seconds: Maximum duration of the capture session in seconds. + :paramtype time_limit_in_seconds: int + :keyword storage_location: The storage location for a packet capture session. Required. + :paramtype storage_location: + ~azure.mgmt.network.v2023_09_01.models.PacketCaptureStorageLocation + :keyword filters: A list of packet capture filters. + :paramtype filters: list[~azure.mgmt.network.v2023_09_01.models.PacketCaptureFilter] + """ + super().__init__( + target=target, + scope=scope, + target_type=target_type, + bytes_to_capture_per_packet=bytes_to_capture_per_packet, + total_bytes_per_session=total_bytes_per_session, + time_limit_in_seconds=time_limit_in_seconds, + storage_location=storage_location, + filters=filters, + **kwargs + ) + self.provisioning_state = None + + +class PacketCaptureStorageLocation(_serialization.Model): + """The storage location for a packet capture session. + + :ivar storage_id: The ID of the storage account to save the packet capture session. Required if + no local file path is provided. + :vartype storage_id: str + :ivar storage_path: The URI of the storage path to save the packet capture. Must be a + well-formed URI describing the location to save the packet capture. + :vartype storage_path: str + :ivar file_path: A valid local path on the targeting VM. Must include the name of the capture + file (*.cap). For linux virtual machine it must start with /var/captures. Required if no + storage ID is provided, otherwise optional. + :vartype file_path: str + """ + + _attribute_map = { + "storage_id": {"key": "storageId", "type": "str"}, + "storage_path": {"key": "storagePath", "type": "str"}, + "file_path": {"key": "filePath", "type": "str"}, + } + + def __init__( + self, + *, + storage_id: Optional[str] = None, + storage_path: Optional[str] = None, + file_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_id: The ID of the storage account to save the packet capture session. Required + if no local file path is provided. + :paramtype storage_id: str + :keyword storage_path: The URI of the storage path to save the packet capture. Must be a + well-formed URI describing the location to save the packet capture. + :paramtype storage_path: str + :keyword file_path: A valid local path on the targeting VM. Must include the name of the + capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if + no storage ID is provided, otherwise optional. + :paramtype file_path: str + """ + super().__init__(**kwargs) + self.storage_id = storage_id + self.storage_path = storage_path + self.file_path = file_path + + +class Parameter(_serialization.Model): + """Parameters for an Action. + + :ivar route_prefix: List of route prefixes. + :vartype route_prefix: list[str] + :ivar community: List of BGP communities. + :vartype community: list[str] + :ivar as_path: List of AS paths. + :vartype as_path: list[str] + """ + + _attribute_map = { + "route_prefix": {"key": "routePrefix", "type": "[str]"}, + "community": {"key": "community", "type": "[str]"}, + "as_path": {"key": "asPath", "type": "[str]"}, + } + + def __init__( + self, + *, + route_prefix: Optional[List[str]] = None, + community: Optional[List[str]] = None, + as_path: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword route_prefix: List of route prefixes. + :paramtype route_prefix: list[str] + :keyword community: List of BGP communities. + :paramtype community: list[str] + :keyword as_path: List of AS paths. + :paramtype as_path: list[str] + """ + super().__init__(**kwargs) + self.route_prefix = route_prefix + self.community = community + self.as_path = as_path + + +class PartnerManagedResourceProperties(_serialization.Model): + """Properties of the partner managed resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The partner managed resource id. + :vartype id: str + :ivar internal_load_balancer_id: The partner managed ILB resource id. + :vartype internal_load_balancer_id: str + :ivar standard_load_balancer_id: The partner managed SLB resource id. + :vartype standard_load_balancer_id: str + """ + + _validation = { + "id": {"readonly": True}, + "internal_load_balancer_id": {"readonly": True}, + "standard_load_balancer_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "internal_load_balancer_id": {"key": "internalLoadBalancerId", "type": "str"}, + "standard_load_balancer_id": {"key": "standardLoadBalancerId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.internal_load_balancer_id = None + self.standard_load_balancer_id = None + + +class PatchObject(_serialization.Model): + """Object for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 PatchRouteFilter(SubResource): + """Route Filter Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar rules: Collection of RouteFilterRules contained within a route filter. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :ivar peerings: A collection of references to express route circuit peerings. + :vartype peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar ipv6_peerings: A collection of references to express route circuit ipv6 peerings. + :vartype ipv6_peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar provisioning_state: The provisioning state of the route filter resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "etag": {"readonly": True}, + "type": {"readonly": True}, + "peerings": {"readonly": True}, + "ipv6_peerings": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "rules": {"key": "properties.rules", "type": "[RouteFilterRule]"}, + "peerings": {"key": "properties.peerings", "type": "[ExpressRouteCircuitPeering]"}, + "ipv6_peerings": {"key": "properties.ipv6Peerings", "type": "[ExpressRouteCircuitPeering]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + tags: Optional[Dict[str, str]] = None, + rules: Optional[List["_models.RouteFilterRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword rules: Collection of RouteFilterRules contained within a route filter. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + """ + super().__init__(id=id, **kwargs) + self.name = None + self.etag = None + self.type = None + self.tags = tags + self.rules = rules + self.peerings = None + self.ipv6_peerings = None + self.provisioning_state = None + + +class PatchRouteFilterRule(SubResource): + """Route Filter Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar access: The access type of the rule. Known values are: "Allow" and "Deny". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :ivar route_filter_rule_type: The rule type of the rule. "Community" + :vartype route_filter_rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.RouteFilterRuleType + :ivar communities: The collection for bgp community values to filter on. e.g. + ['12076:5010','12076:5020']. + :vartype communities: list[str] + :ivar provisioning_state: The provisioning state of the route filter rule resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "access": {"key": "properties.access", "type": "str"}, + "route_filter_rule_type": {"key": "properties.routeFilterRuleType", "type": "str"}, + "communities": {"key": "properties.communities", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + access: Optional[Union[str, "_models.Access"]] = None, + route_filter_rule_type: Optional[Union[str, "_models.RouteFilterRuleType"]] = None, + communities: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword access: The access type of the rule. Known values are: "Allow" and "Deny". + :paramtype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :keyword route_filter_rule_type: The rule type of the rule. "Community" + :paramtype route_filter_rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.RouteFilterRuleType + :keyword communities: The collection for bgp community values to filter on. e.g. + ['12076:5010','12076:5020']. + :paramtype communities: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = None + self.etag = None + self.access = access + self.route_filter_rule_type = route_filter_rule_type + self.communities = communities + self.provisioning_state = None + + +class PeerExpressRouteCircuitConnection(SubResource): # pylint: disable=too-many-instance-attributes + """Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the circuit. + :vartype express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the peered circuit. + :vartype peer_express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar address_prefix: /29 IP address space to carve out Customer addresses for tunnels. + :vartype address_prefix: str + :ivar circuit_connection_status: Express Route Circuit connection state. Known values are: + "Connected", "Connecting", and "Disconnected". + :vartype circuit_connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.CircuitConnectionStatus + :ivar connection_name: The name of the express route circuit connection resource. + :vartype connection_name: str + :ivar auth_resource_guid: The resource guid of the authorization used for the express route + circuit connection. + :vartype auth_resource_guid: str + :ivar provisioning_state: The provisioning state of the peer express route circuit connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "circuit_connection_status": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "express_route_circuit_peering": {"key": "properties.expressRouteCircuitPeering", "type": "SubResource"}, + "peer_express_route_circuit_peering": { + "key": "properties.peerExpressRouteCircuitPeering", + "type": "SubResource", + }, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "circuit_connection_status": {"key": "properties.circuitConnectionStatus", "type": "str"}, + "connection_name": {"key": "properties.connectionName", "type": "str"}, + "auth_resource_guid": {"key": "properties.authResourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + express_route_circuit_peering: Optional["_models.SubResource"] = None, + peer_express_route_circuit_peering: Optional["_models.SubResource"] = None, + address_prefix: Optional[str] = None, + connection_name: Optional[str] = None, + auth_resource_guid: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the circuit. + :paramtype express_route_circuit_peering: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword peer_express_route_circuit_peering: Reference to Express Route Circuit Private Peering + Resource of the peered circuit. + :paramtype peer_express_route_circuit_peering: + ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword address_prefix: /29 IP address space to carve out Customer addresses for tunnels. + :paramtype address_prefix: str + :keyword connection_name: The name of the express route circuit connection resource. + :paramtype connection_name: str + :keyword auth_resource_guid: The resource guid of the authorization used for the express route + circuit connection. + :paramtype auth_resource_guid: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.express_route_circuit_peering = express_route_circuit_peering + self.peer_express_route_circuit_peering = peer_express_route_circuit_peering + self.address_prefix = address_prefix + self.circuit_connection_status = None + self.connection_name = connection_name + self.auth_resource_guid = auth_resource_guid + self.provisioning_state = None + + +class PeerExpressRouteCircuitConnectionListResult(_serialization.Model): + """Response for ListPeeredConnections API service call retrieves all global reach peer circuit + connections that belongs to a Private Peering for an ExpressRouteCircuit. + + :ivar value: The global reach peer circuit connection associated with Private Peering in an + ExpressRoute Circuit. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PeerExpressRouteCircuitConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PeerExpressRouteCircuitConnection"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The global reach peer circuit connection associated with Private Peering in an + ExpressRoute Circuit. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PeerRoute(_serialization.Model): + """Peer routing details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar local_address: The peer's local address. + :vartype local_address: str + :ivar network: The route's network prefix. + :vartype network: str + :ivar next_hop: The route's next hop. + :vartype next_hop: str + :ivar source_peer: The peer this route was learned from. + :vartype source_peer: str + :ivar origin: The source this route was learned from. + :vartype origin: str + :ivar as_path: The route's AS path sequence. + :vartype as_path: str + :ivar weight: The route's weight. + :vartype weight: int + """ + + _validation = { + "local_address": {"readonly": True}, + "network": {"readonly": True}, + "next_hop": {"readonly": True}, + "source_peer": {"readonly": True}, + "origin": {"readonly": True}, + "as_path": {"readonly": True}, + "weight": {"readonly": True}, + } + + _attribute_map = { + "local_address": {"key": "localAddress", "type": "str"}, + "network": {"key": "network", "type": "str"}, + "next_hop": {"key": "nextHop", "type": "str"}, + "source_peer": {"key": "sourcePeer", "type": "str"}, + "origin": {"key": "origin", "type": "str"}, + "as_path": {"key": "asPath", "type": "str"}, + "weight": {"key": "weight", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.local_address = None + self.network = None + self.next_hop = None + self.source_peer = None + self.origin = None + self.as_path = None + self.weight = None + + +class PolicySettings(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Defines contents of a web application firewall global configuration. + + :ivar state: The state of the policy. Known values are: "Disabled" and "Enabled". + :vartype state: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallEnabledState + :ivar mode: The mode of the policy. Known values are: "Prevention" and "Detection". + :vartype mode: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallMode + :ivar request_body_check: Whether to allow WAF to check request Body. + :vartype request_body_check: bool + :ivar request_body_inspect_limit_in_kb: Max inspection limit in KB for request body inspection + for WAF. + :vartype request_body_inspect_limit_in_kb: int + :ivar request_body_enforcement: Whether allow WAF to enforce request body limits. + :vartype request_body_enforcement: bool + :ivar max_request_body_size_in_kb: Maximum request body size in Kb for WAF. + :vartype max_request_body_size_in_kb: int + :ivar file_upload_enforcement: Whether allow WAF to enforce file upload limits. + :vartype file_upload_enforcement: bool + :ivar file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. + :vartype file_upload_limit_in_mb: int + :ivar custom_block_response_status_code: If the action type is block, customer can override the + response status code. + :vartype custom_block_response_status_code: int + :ivar custom_block_response_body: If the action type is block, customer can override the + response body. The body must be specified in base64 encoding. + :vartype custom_block_response_body: str + :ivar log_scrubbing: To scrub sensitive log fields. + :vartype log_scrubbing: ~azure.mgmt.network.v2023_09_01.models.PolicySettingsLogScrubbing + """ + + _validation = { + "max_request_body_size_in_kb": {"minimum": 8}, + "file_upload_limit_in_mb": {"minimum": 0}, + "custom_block_response_status_code": {"minimum": 0}, + "custom_block_response_body": { + "max_length": 32768, + "pattern": r"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", + }, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "request_body_check": {"key": "requestBodyCheck", "type": "bool"}, + "request_body_inspect_limit_in_kb": {"key": "requestBodyInspectLimitInKB", "type": "int"}, + "request_body_enforcement": {"key": "requestBodyEnforcement", "type": "bool"}, + "max_request_body_size_in_kb": {"key": "maxRequestBodySizeInKb", "type": "int"}, + "file_upload_enforcement": {"key": "fileUploadEnforcement", "type": "bool"}, + "file_upload_limit_in_mb": {"key": "fileUploadLimitInMb", "type": "int"}, + "custom_block_response_status_code": {"key": "customBlockResponseStatusCode", "type": "int"}, + "custom_block_response_body": {"key": "customBlockResponseBody", "type": "str"}, + "log_scrubbing": {"key": "logScrubbing", "type": "PolicySettingsLogScrubbing"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.WebApplicationFirewallEnabledState"]] = None, + mode: Optional[Union[str, "_models.WebApplicationFirewallMode"]] = None, + request_body_check: Optional[bool] = None, + request_body_inspect_limit_in_kb: Optional[int] = None, + request_body_enforcement: bool = True, + max_request_body_size_in_kb: Optional[int] = None, + file_upload_enforcement: bool = True, + file_upload_limit_in_mb: Optional[int] = None, + custom_block_response_status_code: Optional[int] = None, + custom_block_response_body: Optional[str] = None, + log_scrubbing: Optional["_models.PolicySettingsLogScrubbing"] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: The state of the policy. Known values are: "Disabled" and "Enabled". + :paramtype state: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallEnabledState + :keyword mode: The mode of the policy. Known values are: "Prevention" and "Detection". + :paramtype mode: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallMode + :keyword request_body_check: Whether to allow WAF to check request Body. + :paramtype request_body_check: bool + :keyword request_body_inspect_limit_in_kb: Max inspection limit in KB for request body + inspection for WAF. + :paramtype request_body_inspect_limit_in_kb: int + :keyword request_body_enforcement: Whether allow WAF to enforce request body limits. + :paramtype request_body_enforcement: bool + :keyword max_request_body_size_in_kb: Maximum request body size in Kb for WAF. + :paramtype max_request_body_size_in_kb: int + :keyword file_upload_enforcement: Whether allow WAF to enforce file upload limits. + :paramtype file_upload_enforcement: bool + :keyword file_upload_limit_in_mb: Maximum file upload size in Mb for WAF. + :paramtype file_upload_limit_in_mb: int + :keyword custom_block_response_status_code: If the action type is block, customer can override + the response status code. + :paramtype custom_block_response_status_code: int + :keyword custom_block_response_body: If the action type is block, customer can override the + response body. The body must be specified in base64 encoding. + :paramtype custom_block_response_body: str + :keyword log_scrubbing: To scrub sensitive log fields. + :paramtype log_scrubbing: ~azure.mgmt.network.v2023_09_01.models.PolicySettingsLogScrubbing + """ + super().__init__(**kwargs) + self.state = state + self.mode = mode + self.request_body_check = request_body_check + self.request_body_inspect_limit_in_kb = request_body_inspect_limit_in_kb + self.request_body_enforcement = request_body_enforcement + self.max_request_body_size_in_kb = max_request_body_size_in_kb + self.file_upload_enforcement = file_upload_enforcement + self.file_upload_limit_in_mb = file_upload_limit_in_mb + self.custom_block_response_status_code = custom_block_response_status_code + self.custom_block_response_body = custom_block_response_body + self.log_scrubbing = log_scrubbing + + +class PolicySettingsLogScrubbing(_serialization.Model): + """To scrub sensitive log fields. + + :ivar state: State of the log scrubbing config. Default value is Enabled. Known values are: + "Disabled" and "Enabled". + :vartype state: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallScrubbingState + :ivar scrubbing_rules: The rules that are applied to the logs for scrubbing. + :vartype scrubbing_rules: + list[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallScrubbingRules] + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "scrubbing_rules": {"key": "scrubbingRules", "type": "[WebApplicationFirewallScrubbingRules]"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.WebApplicationFirewallScrubbingState"]] = None, + scrubbing_rules: Optional[List["_models.WebApplicationFirewallScrubbingRules"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: State of the log scrubbing config. Default value is Enabled. Known values are: + "Disabled" and "Enabled". + :paramtype state: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallScrubbingState + :keyword scrubbing_rules: The rules that are applied to the logs for scrubbing. + :paramtype scrubbing_rules: + list[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallScrubbingRules] + """ + super().__init__(**kwargs) + self.state = state + self.scrubbing_rules = scrubbing_rules + + +class PrepareNetworkPoliciesRequest(_serialization.Model): + """Details of PrepareNetworkPolicies for Subnet. + + :ivar service_name: The name of the service for which subnet is being prepared for. + :vartype service_name: str + :ivar network_intent_policy_configurations: A list of NetworkIntentPolicyConfiguration. + :vartype network_intent_policy_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicyConfiguration] + """ + + _attribute_map = { + "service_name": {"key": "serviceName", "type": "str"}, + "network_intent_policy_configurations": { + "key": "networkIntentPolicyConfigurations", + "type": "[NetworkIntentPolicyConfiguration]", + }, + } + + def __init__( + self, + *, + service_name: Optional[str] = None, + network_intent_policy_configurations: Optional[List["_models.NetworkIntentPolicyConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_name: The name of the service for which subnet is being prepared for. + :paramtype service_name: str + :keyword network_intent_policy_configurations: A list of NetworkIntentPolicyConfiguration. + :paramtype network_intent_policy_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicyConfiguration] + """ + super().__init__(**kwargs) + self.service_name = service_name + self.network_intent_policy_configurations = network_intent_policy_configurations + + +class PrivateDnsZoneConfig(_serialization.Model): + """PrivateDnsZoneConfig resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar private_dns_zone_id: The resource id of the private dns zone. + :vartype private_dns_zone_id: str + :ivar record_sets: A collection of information regarding a recordSet, holding information to + identify private resources. + :vartype record_sets: list[~azure.mgmt.network.v2023_09_01.models.RecordSet] + """ + + _validation = { + "record_sets": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "private_dns_zone_id": {"key": "properties.privateDnsZoneId", "type": "str"}, + "record_sets": {"key": "properties.recordSets", "type": "[RecordSet]"}, + } + + def __init__(self, *, name: Optional[str] = None, private_dns_zone_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword private_dns_zone_id: The resource id of the private dns zone. + :paramtype private_dns_zone_id: str + """ + super().__init__(**kwargs) + self.name = name + self.private_dns_zone_id = private_dns_zone_id + self.record_sets = None + + +class PrivateDnsZoneGroup(SubResource): + """Private dns zone group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the private dns zone group resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_dns_zone_configs: A collection of private dns zone configurations of the private + dns zone group. + :vartype private_dns_zone_configs: + list[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneConfig] + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_dns_zone_configs": {"key": "properties.privateDnsZoneConfigs", "type": "[PrivateDnsZoneConfig]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_dns_zone_configs: Optional[List["_models.PrivateDnsZoneConfig"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword private_dns_zone_configs: A collection of private dns zone configurations of the + private dns zone group. + :paramtype private_dns_zone_configs: + list[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneConfig] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.provisioning_state = None + self.private_dns_zone_configs = private_dns_zone_configs + + +class PrivateDnsZoneGroupListResult(_serialization.Model): + """Response for the ListPrivateDnsZoneGroups API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of private dns zone group resources in a private endpoint. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateDnsZoneGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateDnsZoneGroup"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of private dns zone group resources in a private endpoint. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateEndpoint(Resource): # pylint: disable=too-many-instance-attributes + """Private endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the load balancer. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar subnet: The ID of the subnet from which the private IP will be allocated. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar network_interfaces: An array of references to the network interfaces created for this + private endpoint. + :vartype network_interfaces: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :ivar provisioning_state: The provisioning state of the private endpoint resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_link_service_connections: A grouping of information about the connection to the + remote resource. + :vartype private_link_service_connections: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnection] + :ivar manual_private_link_service_connections: A grouping of information about the connection + to the remote resource. Used when the network admin does not have access to approve connections + to the remote resource. + :vartype manual_private_link_service_connections: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnection] + :ivar custom_dns_configs: An array of custom dns configurations. + :vartype custom_dns_configs: + list[~azure.mgmt.network.v2023_09_01.models.CustomDnsConfigPropertiesFormat] + :ivar application_security_groups: Application security groups in which the private endpoint IP + configuration is included. + :vartype application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :ivar ip_configurations: A list of IP configurations of the private endpoint. This will be used + to map to the First Party Service's endpoints. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointIPConfiguration] + :ivar custom_network_interface_name: The custom name of the network interface attached to the + private endpoint. + :vartype custom_network_interface_name: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "network_interfaces": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "network_interfaces": {"key": "properties.networkInterfaces", "type": "[NetworkInterface]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_link_service_connections": { + "key": "properties.privateLinkServiceConnections", + "type": "[PrivateLinkServiceConnection]", + }, + "manual_private_link_service_connections": { + "key": "properties.manualPrivateLinkServiceConnections", + "type": "[PrivateLinkServiceConnection]", + }, + "custom_dns_configs": {"key": "properties.customDnsConfigs", "type": "[CustomDnsConfigPropertiesFormat]"}, + "application_security_groups": { + "key": "properties.applicationSecurityGroups", + "type": "[ApplicationSecurityGroup]", + }, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[PrivateEndpointIPConfiguration]"}, + "custom_network_interface_name": {"key": "properties.customNetworkInterfaceName", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + subnet: Optional["_models.Subnet"] = None, + private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = None, + manual_private_link_service_connections: Optional[List["_models.PrivateLinkServiceConnection"]] = None, + custom_dns_configs: Optional[List["_models.CustomDnsConfigPropertiesFormat"]] = None, + application_security_groups: Optional[List["_models.ApplicationSecurityGroup"]] = None, + ip_configurations: Optional[List["_models.PrivateEndpointIPConfiguration"]] = None, + custom_network_interface_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the load balancer. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword subnet: The ID of the subnet from which the private IP will be allocated. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword private_link_service_connections: A grouping of information about the connection to + the remote resource. + :paramtype private_link_service_connections: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnection] + :keyword manual_private_link_service_connections: A grouping of information about the + connection to the remote resource. Used when the network admin does not have access to approve + connections to the remote resource. + :paramtype manual_private_link_service_connections: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnection] + :keyword custom_dns_configs: An array of custom dns configurations. + :paramtype custom_dns_configs: + list[~azure.mgmt.network.v2023_09_01.models.CustomDnsConfigPropertiesFormat] + :keyword application_security_groups: Application security groups in which the private endpoint + IP configuration is included. + :paramtype application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :keyword ip_configurations: A list of IP configurations of the private endpoint. This will be + used to map to the First Party Service's endpoints. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointIPConfiguration] + :keyword custom_network_interface_name: The custom name of the network interface attached to + the private endpoint. + :paramtype custom_network_interface_name: str + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.subnet = subnet + self.network_interfaces = None + self.provisioning_state = None + self.private_link_service_connections = private_link_service_connections + self.manual_private_link_service_connections = manual_private_link_service_connections + self.custom_dns_configs = custom_dns_configs + self.application_security_groups = application_security_groups + self.ip_configurations = ip_configurations + self.custom_network_interface_name = custom_network_interface_name + + +class PrivateEndpointConnection(SubResource): + """PrivateEndpointConnection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.network.v2023_09_01.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.network.v2023_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar link_identifier: The consumer link id. + :vartype link_identifier: str + :ivar private_endpoint_location: The location of the private endpoint. + :vartype private_endpoint_location: str + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "link_identifier": {"readonly": True}, + "private_endpoint_location": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "link_identifier": {"key": "properties.linkIdentifier", "type": "str"}, + "private_endpoint_location": {"key": "properties.privateEndpointLocation", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :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.network.v2023_09_01.models.PrivateLinkServiceConnectionState + """ + super().__init__(id=id, **kwargs) + self.name = name + self.type = None + self.etag = None + self.private_endpoint = None + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + self.link_identifier = None + self.private_endpoint_location = None + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """Response for the ListPrivateEndpointConnection API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of PrivateEndpointConnection resources for a specific private link service. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of PrivateEndpointConnection resources for a specific private link + service. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateEndpointIPConfiguration(_serialization.Model): + """An IP Configuration of the private endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the resource that is unique within a resource group. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar group_id: The ID of a group obtained from the remote resource that this private endpoint + should connect to. + :vartype group_id: str + :ivar member_name: The member name of a group obtained from the remote resource that this + private endpoint should connect to. + :vartype member_name: str + :ivar private_ip_address: A private ip address obtained from the private endpoint's subnet. + :vartype private_ip_address: str + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "member_name": {"key": "properties.memberName", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + group_id: Optional[str] = None, + member_name: Optional[str] = None, + private_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the resource that is unique within a resource group. + :paramtype name: str + :keyword group_id: The ID of a group obtained from the remote resource that this private + endpoint should connect to. + :paramtype group_id: str + :keyword member_name: The member name of a group obtained from the remote resource that this + private endpoint should connect to. + :paramtype member_name: str + :keyword private_ip_address: A private ip address obtained from the private endpoint's subnet. + :paramtype private_ip_address: str + """ + super().__init__(**kwargs) + self.name = name + self.type = None + self.etag = None + self.group_id = group_id + self.member_name = member_name + self.private_ip_address = private_ip_address + + +class PrivateEndpointListResult(_serialization.Model): + """Response for the ListPrivateEndpoints API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of private endpoint resources in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpoint"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of private endpoint resources in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkService(Resource): # pylint: disable=too-many-instance-attributes + """Private link service resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the load balancer. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar load_balancer_frontend_ip_configurations: An array of references to the load balancer IP + configurations. + :vartype load_balancer_frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :ivar ip_configurations: An array of private link service IP configurations. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceIpConfiguration] + :ivar network_interfaces: An array of references to the network interfaces created for this + private link service. + :vartype network_interfaces: list[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :ivar provisioning_state: The provisioning state of the private link service resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_endpoint_connections: An array of list about connections to the private endpoint. + :vartype private_endpoint_connections: + list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection] + :ivar visibility: The visibility list of the private link service. + :vartype visibility: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServicePropertiesVisibility + :ivar auto_approval: The auto-approval list of the private link service. + :vartype auto_approval: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServicePropertiesAutoApproval + :ivar fqdns: The list of Fqdn. + :vartype fqdns: list[str] + :ivar alias: The alias of the private link service. + :vartype alias: str + :ivar enable_proxy_protocol: Whether the private link service is enabled for proxy protocol or + not. + :vartype enable_proxy_protocol: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "network_interfaces": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + "alias": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "load_balancer_frontend_ip_configurations": { + "key": "properties.loadBalancerFrontendIpConfigurations", + "type": "[FrontendIPConfiguration]", + }, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[PrivateLinkServiceIpConfiguration]"}, + "network_interfaces": {"key": "properties.networkInterfaces", "type": "[NetworkInterface]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "visibility": {"key": "properties.visibility", "type": "PrivateLinkServicePropertiesVisibility"}, + "auto_approval": {"key": "properties.autoApproval", "type": "PrivateLinkServicePropertiesAutoApproval"}, + "fqdns": {"key": "properties.fqdns", "type": "[str]"}, + "alias": {"key": "properties.alias", "type": "str"}, + "enable_proxy_protocol": {"key": "properties.enableProxyProtocol", "type": "bool"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + load_balancer_frontend_ip_configurations: Optional[List["_models.FrontendIPConfiguration"]] = None, + ip_configurations: Optional[List["_models.PrivateLinkServiceIpConfiguration"]] = None, + visibility: Optional["_models.PrivateLinkServicePropertiesVisibility"] = None, + auto_approval: Optional["_models.PrivateLinkServicePropertiesAutoApproval"] = None, + fqdns: Optional[List[str]] = None, + enable_proxy_protocol: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the load balancer. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword load_balancer_frontend_ip_configurations: An array of references to the load balancer + IP configurations. + :paramtype load_balancer_frontend_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :keyword ip_configurations: An array of private link service IP configurations. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceIpConfiguration] + :keyword visibility: The visibility list of the private link service. + :paramtype visibility: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServicePropertiesVisibility + :keyword auto_approval: The auto-approval list of the private link service. + :paramtype auto_approval: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServicePropertiesAutoApproval + :keyword fqdns: The list of Fqdn. + :paramtype fqdns: list[str] + :keyword enable_proxy_protocol: Whether the private link service is enabled for proxy protocol + or not. + :paramtype enable_proxy_protocol: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.load_balancer_frontend_ip_configurations = load_balancer_frontend_ip_configurations + self.ip_configurations = ip_configurations + self.network_interfaces = None + self.provisioning_state = None + self.private_endpoint_connections = None + self.visibility = visibility + self.auto_approval = auto_approval + self.fqdns = fqdns + self.alias = None + self.enable_proxy_protocol = enable_proxy_protocol + + +class PrivateLinkServiceConnection(SubResource): + """PrivateLinkServiceConnection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the private link service connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_link_service_id: The resource id of private link service. + :vartype private_link_service_id: str + :ivar group_ids: The ID(s) of the group(s) obtained from the remote resource that this private + endpoint should connect to. + :vartype group_ids: list[str] + :ivar request_message: A message passed to the owner of the remote resource with this + connection request. Restricted to 140 chars. + :vartype request_message: str + :ivar private_link_service_connection_state: A collection of read-only information about the + state of the connection to the remote resource. + :vartype private_link_service_connection_state: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnectionState + """ + + _validation = { + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_link_service_id": {"key": "properties.privateLinkServiceId", "type": "str"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "request_message": {"key": "properties.requestMessage", "type": "str"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_link_service_id: Optional[str] = None, + group_ids: Optional[List[str]] = None, + request_message: Optional[str] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword private_link_service_id: The resource id of private link service. + :paramtype private_link_service_id: str + :keyword group_ids: The ID(s) of the group(s) obtained from the remote resource that this + private endpoint should connect to. + :paramtype group_ids: list[str] + :keyword request_message: A message passed to the owner of the remote resource with this + connection request. Restricted to 140 chars. + :paramtype request_message: str + :keyword private_link_service_connection_state: A collection of read-only information about the + state of the connection to the remote resource. + :paramtype private_link_service_connection_state: + ~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceConnectionState + """ + super().__init__(id=id, **kwargs) + self.name = name + self.type = None + self.etag = None + self.provisioning_state = None + self.private_link_service_id = private_link_service_id + self.group_ids = group_ids + self.request_message = request_message + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. + :vartype status: str + :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 + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. + :paramtype status: str + :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 + """ + super().__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class PrivateLinkServiceIpConfiguration(SubResource): + """The private link service ip configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of private link service ip configuration. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + :ivar private_ip_address: The private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: The reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :ivar primary: Whether the ip configuration is primary or not. + :vartype primary: bool + :ivar provisioning_state: The provisioning state of the private link service IP configuration + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. + Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "Subnet"}, + "primary": {"key": "properties.primary", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_ip_address_version": {"key": "properties.privateIPAddressVersion", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.Subnet"] = None, + primary: Optional[bool] = None, + private_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of private link service ip configuration. + :paramtype name: str + :keyword private_ip_address: The private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: The reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.Subnet + :keyword primary: Whether the ip configuration is primary or not. + :paramtype primary: bool + :keyword private_ip_address_version: Whether the specific IP configuration is IPv4 or IPv6. + Default is IPv4. Known values are: "IPv4" and "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.primary = primary + self.provisioning_state = None + self.private_ip_address_version = private_ip_address_version + + +class PrivateLinkServiceListResult(_serialization.Model): + """Response for the ListPrivateLinkService API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of PrivateLinkService resources in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkService]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateLinkService"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of PrivateLinkService resources in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceSet(_serialization.Model): + """The base resource set for visibility and auto-approval. + + :ivar subscriptions: The list of subscriptions. + :vartype subscriptions: list[str] + """ + + _attribute_map = { + "subscriptions": {"key": "subscriptions", "type": "[str]"}, + } + + def __init__(self, *, subscriptions: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword subscriptions: The list of subscriptions. + :paramtype subscriptions: list[str] + """ + super().__init__(**kwargs) + self.subscriptions = subscriptions + + +class PrivateLinkServicePropertiesAutoApproval(ResourceSet): + """The auto-approval list of the private link service. + + :ivar subscriptions: The list of subscriptions. + :vartype subscriptions: list[str] + """ + + _attribute_map = { + "subscriptions": {"key": "subscriptions", "type": "[str]"}, + } + + def __init__(self, *, subscriptions: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword subscriptions: The list of subscriptions. + :paramtype subscriptions: list[str] + """ + super().__init__(subscriptions=subscriptions, **kwargs) + + +class PrivateLinkServicePropertiesVisibility(ResourceSet): + """The visibility list of the private link service. + + :ivar subscriptions: The list of subscriptions. + :vartype subscriptions: list[str] + """ + + _attribute_map = { + "subscriptions": {"key": "subscriptions", "type": "[str]"}, + } + + def __init__(self, *, subscriptions: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword subscriptions: The list of subscriptions. + :paramtype subscriptions: list[str] + """ + super().__init__(subscriptions=subscriptions, **kwargs) + + +class PrivateLinkServiceVisibility(_serialization.Model): + """Response for the CheckPrivateLinkServiceVisibility API service call. + + :ivar visible: Private Link Service Visibility (True/False). + :vartype visible: bool + """ + + _attribute_map = { + "visible": {"key": "visible", "type": "bool"}, + } + + def __init__(self, *, visible: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword visible: Private Link Service Visibility (True/False). + :paramtype visible: bool + """ + super().__init__(**kwargs) + self.visible = visible + + +class Probe(SubResource): # pylint: disable=too-many-instance-attributes + """A load balancer probe. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within the set of probes used by the load + balancer. This name can be used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Type of the resource. + :vartype type: str + :ivar load_balancing_rules: The load balancer rules that use this probe. + :vartype load_balancing_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar protocol: The protocol of the end point. If 'Tcp' is specified, a received ACK is + required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response + from the specifies URI is required for the probe to be successful. Known values are: "Http", + "Tcp", and "Https". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProbeProtocol + :ivar port: The port for communicating the probe. Possible values range from 1 to 65535, + inclusive. + :vartype port: int + :ivar interval_in_seconds: The interval, in seconds, for how frequently to probe the endpoint + for health status. Typically, the interval is slightly less than half the allocated timeout + period (in seconds) which allows two full probes before taking the instance out of rotation. + The default value is 15, the minimum value is 5. + :vartype interval_in_seconds: int + :ivar number_of_probes: The number of probes where if no response, will result in stopping + further traffic from being delivered to the endpoint. This values allows endpoints to be taken + out of rotation faster or slower than the typical times used in Azure. + :vartype number_of_probes: int + :ivar probe_threshold: The number of consecutive successful or failed probes in order to allow + or deny traffic from being delivered to this endpoint. After failing the number of consecutive + probes equal to this value, the endpoint will be taken out of rotation and require the same + number of successful consecutive probes to be placed back in rotation. + :vartype probe_threshold: int + :ivar request_path: The URI used for requesting health status from the VM. Path is required if + a protocol is set to http. Otherwise, it is not allowed. There is no default value. + :vartype request_path: str + :ivar provisioning_state: The provisioning state of the probe resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "load_balancing_rules": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[SubResource]"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + "interval_in_seconds": {"key": "properties.intervalInSeconds", "type": "int"}, + "number_of_probes": {"key": "properties.numberOfProbes", "type": "int"}, + "probe_threshold": {"key": "properties.probeThreshold", "type": "int"}, + "request_path": {"key": "properties.requestPath", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + protocol: Optional[Union[str, "_models.ProbeProtocol"]] = None, + port: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + number_of_probes: Optional[int] = None, + probe_threshold: Optional[int] = None, + request_path: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within the set of probes used by the + load balancer. This name can be used to access the resource. + :paramtype name: str + :keyword protocol: The protocol of the end point. If 'Tcp' is specified, a received ACK is + required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response + from the specifies URI is required for the probe to be successful. Known values are: "Http", + "Tcp", and "Https". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProbeProtocol + :keyword port: The port for communicating the probe. Possible values range from 1 to 65535, + inclusive. + :paramtype port: int + :keyword interval_in_seconds: The interval, in seconds, for how frequently to probe the + endpoint for health status. Typically, the interval is slightly less than half the allocated + timeout period (in seconds) which allows two full probes before taking the instance out of + rotation. The default value is 15, the minimum value is 5. + :paramtype interval_in_seconds: int + :keyword number_of_probes: The number of probes where if no response, will result in stopping + further traffic from being delivered to the endpoint. This values allows endpoints to be taken + out of rotation faster or slower than the typical times used in Azure. + :paramtype number_of_probes: int + :keyword probe_threshold: The number of consecutive successful or failed probes in order to + allow or deny traffic from being delivered to this endpoint. After failing the number of + consecutive probes equal to this value, the endpoint will be taken out of rotation and require + the same number of successful consecutive probes to be placed back in rotation. + :paramtype probe_threshold: int + :keyword request_path: The URI used for requesting health status from the VM. Path is required + if a protocol is set to http. Otherwise, it is not allowed. There is no default value. + :paramtype request_path: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.load_balancing_rules = None + self.protocol = protocol + self.port = port + self.interval_in_seconds = interval_in_seconds + self.number_of_probes = number_of_probes + self.probe_threshold = probe_threshold + self.request_path = request_path + self.provisioning_state = None + + +class PropagatedRouteTable(_serialization.Model): + """The list of RouteTables to advertise the routes to. + + :ivar labels: The list of labels. + :vartype labels: list[str] + :ivar ids: The list of resource ids of all the RouteTables. + :vartype ids: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _attribute_map = { + "labels": {"key": "labels", "type": "[str]"}, + "ids": {"key": "ids", "type": "[SubResource]"}, + } + + def __init__( + self, *, labels: Optional[List[str]] = None, ids: Optional[List["_models.SubResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword labels: The list of labels. + :paramtype labels: list[str] + :keyword ids: The list of resource ids of all the RouteTables. + :paramtype ids: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(**kwargs) + self.labels = labels + self.ids = ids + + +class ProtocolConfiguration(_serialization.Model): + """Configuration of the protocol. + + :ivar http_configuration: HTTP configuration of the connectivity check. + :vartype http_configuration: ~azure.mgmt.network.v2023_09_01.models.HTTPConfiguration + """ + + _attribute_map = { + "http_configuration": {"key": "HTTPConfiguration", "type": "HTTPConfiguration"}, + } + + def __init__(self, *, http_configuration: Optional["_models.HTTPConfiguration"] = None, **kwargs: Any) -> None: + """ + :keyword http_configuration: HTTP configuration of the connectivity check. + :paramtype http_configuration: ~azure.mgmt.network.v2023_09_01.models.HTTPConfiguration + """ + super().__init__(**kwargs) + self.http_configuration = http_configuration + + +class PublicIPAddress(Resource): # pylint: disable=too-many-instance-attributes + """Public IP address resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the public ip address. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar sku: The public IP address SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar zones: A list of availability zones denoting the IP allocated for the resource needs to + come from. + :vartype zones: list[str] + :ivar public_ip_allocation_method: The public IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype public_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar public_ip_address_version: The public IP address version. Known values are: "IPv4" and + "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :ivar ip_configuration: The IP configuration associated with the public IP address. + :vartype ip_configuration: ~azure.mgmt.network.v2023_09_01.models.IPConfiguration + :ivar dns_settings: The FQDN of the DNS record associated with the public IP address. + :vartype dns_settings: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressDnsSettings + :ivar ddos_settings: The DDoS protection custom policy associated with the public IP address. + :vartype ddos_settings: ~azure.mgmt.network.v2023_09_01.models.DdosSettings + :ivar ip_tags: The list of tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.network.v2023_09_01.models.IpTag] + :ivar ip_address: The IP address associated with the public IP address resource. + :vartype ip_address: str + :ivar public_ip_prefix: The Public IP Prefix this Public IP Address should be allocated from. + :vartype public_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar resource_guid: The resource GUID property of the public IP address resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the public IP address resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar service_public_ip_address: The service public IP address of the public IP address + resource. + :vartype service_public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar nat_gateway: The NatGateway for the Public IP address. + :vartype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :ivar migration_phase: Migration phase of Public IP Address. Known values are: "None", + "Prepare", "Commit", "Abort", and "Committed". + :vartype migration_phase: str or + ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressMigrationPhase + :ivar linked_public_ip_address: The linked public IP address of the public IP address resource. + :vartype linked_public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :ivar delete_option: Specify what happens to the public IP address when the VM using it is + deleted. Known values are: "Delete" and "Detach". + :vartype delete_option: str or ~azure.mgmt.network.v2023_09_01.models.DeleteOptions + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "ip_configuration": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "sku": {"key": "sku", "type": "PublicIPAddressSku"}, + "etag": {"key": "etag", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "public_ip_allocation_method": {"key": "properties.publicIPAllocationMethod", "type": "str"}, + "public_ip_address_version": {"key": "properties.publicIPAddressVersion", "type": "str"}, + "ip_configuration": {"key": "properties.ipConfiguration", "type": "IPConfiguration"}, + "dns_settings": {"key": "properties.dnsSettings", "type": "PublicIPAddressDnsSettings"}, + "ddos_settings": {"key": "properties.ddosSettings", "type": "DdosSettings"}, + "ip_tags": {"key": "properties.ipTags", "type": "[IpTag]"}, + "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "public_ip_prefix": {"key": "properties.publicIPPrefix", "type": "SubResource"}, + "idle_timeout_in_minutes": {"key": "properties.idleTimeoutInMinutes", "type": "int"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "service_public_ip_address": {"key": "properties.servicePublicIPAddress", "type": "PublicIPAddress"}, + "nat_gateway": {"key": "properties.natGateway", "type": "NatGateway"}, + "migration_phase": {"key": "properties.migrationPhase", "type": "str"}, + "linked_public_ip_address": {"key": "properties.linkedPublicIPAddress", "type": "PublicIPAddress"}, + "delete_option": {"key": "properties.deleteOption", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + sku: Optional["_models.PublicIPAddressSku"] = None, + zones: Optional[List[str]] = None, + public_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + public_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + dns_settings: Optional["_models.PublicIPAddressDnsSettings"] = None, + ddos_settings: Optional["_models.DdosSettings"] = None, + ip_tags: Optional[List["_models.IpTag"]] = None, + ip_address: Optional[str] = None, + public_ip_prefix: Optional["_models.SubResource"] = None, + idle_timeout_in_minutes: Optional[int] = None, + service_public_ip_address: Optional["_models.PublicIPAddress"] = None, + nat_gateway: Optional["_models.NatGateway"] = None, + migration_phase: Optional[Union[str, "_models.PublicIPAddressMigrationPhase"]] = None, + linked_public_ip_address: Optional["_models.PublicIPAddress"] = None, + delete_option: Optional[Union[str, "_models.DeleteOptions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the public ip address. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword sku: The public IP address SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSku + :keyword zones: A list of availability zones denoting the IP allocated for the resource needs + to come from. + :paramtype zones: list[str] + :keyword public_ip_allocation_method: The public IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype public_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword public_ip_address_version: The public IP address version. Known values are: "IPv4" and + "IPv6". + :paramtype public_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :keyword dns_settings: The FQDN of the DNS record associated with the public IP address. + :paramtype dns_settings: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressDnsSettings + :keyword ddos_settings: The DDoS protection custom policy associated with the public IP + address. + :paramtype ddos_settings: ~azure.mgmt.network.v2023_09_01.models.DdosSettings + :keyword ip_tags: The list of tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.network.v2023_09_01.models.IpTag] + :keyword ip_address: The IP address associated with the public IP address resource. + :paramtype ip_address: str + :keyword public_ip_prefix: The Public IP Prefix this Public IP Address should be allocated + from. + :paramtype public_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword service_public_ip_address: The service public IP address of the public IP address + resource. + :paramtype service_public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :keyword nat_gateway: The NatGateway for the Public IP address. + :paramtype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :keyword migration_phase: Migration phase of Public IP Address. Known values are: "None", + "Prepare", "Commit", "Abort", and "Committed". + :paramtype migration_phase: str or + ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressMigrationPhase + :keyword linked_public_ip_address: The linked public IP address of the public IP address + resource. + :paramtype linked_public_ip_address: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :keyword delete_option: Specify what happens to the public IP address when the VM using it is + deleted. Known values are: "Delete" and "Detach". + :paramtype delete_option: str or ~azure.mgmt.network.v2023_09_01.models.DeleteOptions + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.sku = sku + self.etag = None + self.zones = zones + self.public_ip_allocation_method = public_ip_allocation_method + self.public_ip_address_version = public_ip_address_version + self.ip_configuration = None + self.dns_settings = dns_settings + self.ddos_settings = ddos_settings + self.ip_tags = ip_tags + self.ip_address = ip_address + self.public_ip_prefix = public_ip_prefix + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.resource_guid = None + self.provisioning_state = None + self.service_public_ip_address = service_public_ip_address + self.nat_gateway = nat_gateway + self.migration_phase = migration_phase + self.linked_public_ip_address = linked_public_ip_address + self.delete_option = delete_option + + +class PublicIPAddressDnsSettings(_serialization.Model): + """Contains FQDN of the DNS record associated with the public IP address. + + :ivar domain_name_label: The domain name label. The concatenation of the domain name label and + the regionalized DNS zone make up the fully qualified domain name associated with the public IP + address. If a domain name label is specified, an A DNS record is created for the public IP in + the Microsoft Azure DNS system. + :vartype domain_name_label: str + :ivar domain_name_label_scope: The domain name label scope. If a domain name label and a domain + name label scope are specified, an A DNS record is created for the public IP in the Microsoft + Azure DNS system with a hashed value includes in FQDN. Known values are: "TenantReuse", + "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". + :vartype domain_name_label_scope: str or + ~azure.mgmt.network.v2023_09_01.models.PublicIpAddressDnsSettingsDomainNameLabelScope + :ivar fqdn: The Fully Qualified Domain Name of the A DNS record associated with the public IP. + This is the concatenation of the domainNameLabel and the regionalized DNS zone. + :vartype fqdn: str + :ivar reverse_fqdn: The reverse FQDN. A user-visible, fully qualified domain name that resolves + to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created + pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. + :vartype reverse_fqdn: str + """ + + _attribute_map = { + "domain_name_label": {"key": "domainNameLabel", "type": "str"}, + "domain_name_label_scope": {"key": "domainNameLabelScope", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "reverse_fqdn": {"key": "reverseFqdn", "type": "str"}, + } + + def __init__( + self, + *, + domain_name_label: Optional[str] = None, + domain_name_label_scope: Optional[Union[str, "_models.PublicIpAddressDnsSettingsDomainNameLabelScope"]] = None, + fqdn: Optional[str] = None, + reverse_fqdn: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_name_label: The domain name label. The concatenation of the domain name label + and the regionalized DNS zone make up the fully qualified domain name associated with the + public IP address. If a domain name label is specified, an A DNS record is created for the + public IP in the Microsoft Azure DNS system. + :paramtype domain_name_label: str + :keyword domain_name_label_scope: The domain name label scope. If a domain name label and a + domain name label scope are specified, an A DNS record is created for the public IP in the + Microsoft Azure DNS system with a hashed value includes in FQDN. Known values are: + "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". + :paramtype domain_name_label_scope: str or + ~azure.mgmt.network.v2023_09_01.models.PublicIpAddressDnsSettingsDomainNameLabelScope + :keyword fqdn: The Fully Qualified Domain Name of the A DNS record associated with the public + IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone. + :paramtype fqdn: str + :keyword reverse_fqdn: The reverse FQDN. A user-visible, fully qualified domain name that + resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is + created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. + :paramtype reverse_fqdn: str + """ + super().__init__(**kwargs) + self.domain_name_label = domain_name_label + self.domain_name_label_scope = domain_name_label_scope + self.fqdn = fqdn + self.reverse_fqdn = reverse_fqdn + + +class PublicIPAddressListResult(_serialization.Model): + """Response for ListPublicIpAddresses API service call. + + :ivar value: A list of public IP addresses that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PublicIPAddress]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.PublicIPAddress"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of public IP addresses that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PublicIPAddressSku(_serialization.Model): + """SKU of a public IP address. + + :ivar name: Name of a public IP address SKU. Known values are: "Basic" and "Standard". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSkuName + :ivar tier: Tier of a public IP address SKU. Known values are: "Regional", "Global", and + "Global". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSkuTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.PublicIPAddressSkuName"]] = None, + tier: Optional[Union[str, "_models.PublicIPAddressSkuTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of a public IP address SKU. Known values are: "Basic" and "Standard". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSkuName + :keyword tier: Tier of a public IP address SKU. Known values are: "Regional", "Global", and + "Global". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPAddressSkuTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class PublicIpDdosProtectionStatusResult(_serialization.Model): + """Response for GetPublicIpAddressDdosProtectionStatusOperation API service call. + + :ivar public_ip_address_id: Public IP ARM resource ID. + :vartype public_ip_address_id: str + :ivar public_ip_address: IP Address of the Public IP Resource. + :vartype public_ip_address: str + :ivar is_workload_protected: Value indicating whether the IP address is DDoS workload protected + or not. Known values are: "False" and "True". + :vartype is_workload_protected: str or + ~azure.mgmt.network.v2023_09_01.models.IsWorkloadProtected + :ivar ddos_protection_plan_id: DDoS protection plan Resource Id of a if IP address is protected + through a plan. + :vartype ddos_protection_plan_id: str + """ + + _attribute_map = { + "public_ip_address_id": {"key": "publicIpAddressId", "type": "str"}, + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "is_workload_protected": {"key": "isWorkloadProtected", "type": "str"}, + "ddos_protection_plan_id": {"key": "ddosProtectionPlanId", "type": "str"}, + } + + def __init__( + self, + *, + public_ip_address_id: Optional[str] = None, + public_ip_address: Optional[str] = None, + is_workload_protected: Optional[Union[str, "_models.IsWorkloadProtected"]] = None, + ddos_protection_plan_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword public_ip_address_id: Public IP ARM resource ID. + :paramtype public_ip_address_id: str + :keyword public_ip_address: IP Address of the Public IP Resource. + :paramtype public_ip_address: str + :keyword is_workload_protected: Value indicating whether the IP address is DDoS workload + protected or not. Known values are: "False" and "True". + :paramtype is_workload_protected: str or + ~azure.mgmt.network.v2023_09_01.models.IsWorkloadProtected + :keyword ddos_protection_plan_id: DDoS protection plan Resource Id of a if IP address is + protected through a plan. + :paramtype ddos_protection_plan_id: str + """ + super().__init__(**kwargs) + self.public_ip_address_id = public_ip_address_id + self.public_ip_address = public_ip_address + self.is_workload_protected = is_workload_protected + self.ddos_protection_plan_id = ddos_protection_plan_id + + +class PublicIPPrefix(Resource): # pylint: disable=too-many-instance-attributes + """Public IP prefix resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the public ip address. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar sku: The public IP prefix SKU. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar zones: A list of availability zones denoting the IP allocated for the resource needs to + come from. + :vartype zones: list[str] + :ivar public_ip_address_version: The public IP address version. Known values are: "IPv4" and + "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :ivar ip_tags: The list of tags associated with the public IP prefix. + :vartype ip_tags: list[~azure.mgmt.network.v2023_09_01.models.IpTag] + :ivar prefix_length: The Length of the Public IP Prefix. + :vartype prefix_length: int + :ivar ip_prefix: The allocated Prefix. + :vartype ip_prefix: str + :ivar public_ip_addresses: The list of all referenced PublicIPAddresses. + :vartype public_ip_addresses: + list[~azure.mgmt.network.v2023_09_01.models.ReferencedPublicIpAddress] + :ivar load_balancer_frontend_ip_configuration: The reference to load balancer frontend IP + configuration associated with the public IP prefix. + :vartype load_balancer_frontend_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar custom_ip_prefix: The customIpPrefix that this prefix is associated with. + :vartype custom_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar resource_guid: The resource GUID property of the public IP prefix resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the public IP prefix resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar nat_gateway: NatGateway of Public IP Prefix. + :vartype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.NatGateway + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "ip_prefix": {"readonly": True}, + "public_ip_addresses": {"readonly": True}, + "load_balancer_frontend_ip_configuration": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "sku": {"key": "sku", "type": "PublicIPPrefixSku"}, + "etag": {"key": "etag", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "public_ip_address_version": {"key": "properties.publicIPAddressVersion", "type": "str"}, + "ip_tags": {"key": "properties.ipTags", "type": "[IpTag]"}, + "prefix_length": {"key": "properties.prefixLength", "type": "int"}, + "ip_prefix": {"key": "properties.ipPrefix", "type": "str"}, + "public_ip_addresses": {"key": "properties.publicIPAddresses", "type": "[ReferencedPublicIpAddress]"}, + "load_balancer_frontend_ip_configuration": { + "key": "properties.loadBalancerFrontendIpConfiguration", + "type": "SubResource", + }, + "custom_ip_prefix": {"key": "properties.customIPPrefix", "type": "SubResource"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "nat_gateway": {"key": "properties.natGateway", "type": "NatGateway"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + sku: Optional["_models.PublicIPPrefixSku"] = None, + zones: Optional[List[str]] = None, + public_ip_address_version: Optional[Union[str, "_models.IPVersion"]] = None, + ip_tags: Optional[List["_models.IpTag"]] = None, + prefix_length: Optional[int] = None, + custom_ip_prefix: Optional["_models.SubResource"] = None, + nat_gateway: Optional["_models.NatGateway"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the public ip address. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword sku: The public IP prefix SKU. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSku + :keyword zones: A list of availability zones denoting the IP allocated for the resource needs + to come from. + :paramtype zones: list[str] + :keyword public_ip_address_version: The public IP address version. Known values are: "IPv4" and + "IPv6". + :paramtype public_ip_address_version: str or ~azure.mgmt.network.v2023_09_01.models.IPVersion + :keyword ip_tags: The list of tags associated with the public IP prefix. + :paramtype ip_tags: list[~azure.mgmt.network.v2023_09_01.models.IpTag] + :keyword prefix_length: The Length of the Public IP Prefix. + :paramtype prefix_length: int + :keyword custom_ip_prefix: The customIpPrefix that this prefix is associated with. + :paramtype custom_ip_prefix: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword nat_gateway: NatGateway of Public IP Prefix. + :paramtype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.NatGateway + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.sku = sku + self.etag = None + self.zones = zones + self.public_ip_address_version = public_ip_address_version + self.ip_tags = ip_tags + self.prefix_length = prefix_length + self.ip_prefix = None + self.public_ip_addresses = None + self.load_balancer_frontend_ip_configuration = None + self.custom_ip_prefix = custom_ip_prefix + self.resource_guid = None + self.provisioning_state = None + self.nat_gateway = nat_gateway + + +class PublicIPPrefixListResult(_serialization.Model): + """Response for ListPublicIpPrefixes API service call. + + :ivar value: A list of public IP prefixes that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PublicIPPrefix]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.PublicIPPrefix"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of public IP prefixes that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PublicIPPrefixSku(_serialization.Model): + """SKU of a public IP prefix. + + :ivar name: Name of a public IP prefix SKU. "Standard" + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSkuName + :ivar tier: Tier of a public IP prefix SKU. Known values are: "Regional", "Global", and + "Global". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSkuTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.PublicIPPrefixSkuName"]] = None, + tier: Optional[Union[str, "_models.PublicIPPrefixSkuTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of a public IP prefix SKU. "Standard" + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSkuName + :keyword tier: Tier of a public IP prefix SKU. Known values are: "Regional", "Global", and + "Global". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefixSkuTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class QosDefinition(_serialization.Model): + """Quality of Service defines the traffic configuration between endpoints. Mandatory to have one + marking. + + :ivar markings: List of markings to be used in the configuration. + :vartype markings: list[int] + :ivar source_ip_ranges: Source IP ranges. + :vartype source_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :ivar destination_ip_ranges: Destination IP ranges. + :vartype destination_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :ivar source_port_ranges: Sources port ranges. + :vartype source_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :ivar destination_port_ranges: Destination port ranges. + :vartype destination_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :ivar protocol: RNM supported protocol types. Known values are: "DoNotUse", "Icmp", "Tcp", + "Udp", "Gre", "Esp", "Ah", "Vxlan", and "All". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProtocolType + """ + + _attribute_map = { + "markings": {"key": "markings", "type": "[int]"}, + "source_ip_ranges": {"key": "sourceIpRanges", "type": "[QosIpRange]"}, + "destination_ip_ranges": {"key": "destinationIpRanges", "type": "[QosIpRange]"}, + "source_port_ranges": {"key": "sourcePortRanges", "type": "[QosPortRange]"}, + "destination_port_ranges": {"key": "destinationPortRanges", "type": "[QosPortRange]"}, + "protocol": {"key": "protocol", "type": "str"}, + } + + def __init__( + self, + *, + markings: Optional[List[int]] = None, + source_ip_ranges: Optional[List["_models.QosIpRange"]] = None, + destination_ip_ranges: Optional[List["_models.QosIpRange"]] = None, + source_port_ranges: Optional[List["_models.QosPortRange"]] = None, + destination_port_ranges: Optional[List["_models.QosPortRange"]] = None, + protocol: Optional[Union[str, "_models.ProtocolType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword markings: List of markings to be used in the configuration. + :paramtype markings: list[int] + :keyword source_ip_ranges: Source IP ranges. + :paramtype source_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :keyword destination_ip_ranges: Destination IP ranges. + :paramtype destination_ip_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosIpRange] + :keyword source_port_ranges: Sources port ranges. + :paramtype source_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :keyword destination_port_ranges: Destination port ranges. + :paramtype destination_port_ranges: list[~azure.mgmt.network.v2023_09_01.models.QosPortRange] + :keyword protocol: RNM supported protocol types. Known values are: "DoNotUse", "Icmp", "Tcp", + "Udp", "Gre", "Esp", "Ah", "Vxlan", and "All". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.ProtocolType + """ + super().__init__(**kwargs) + self.markings = markings + self.source_ip_ranges = source_ip_ranges + self.destination_ip_ranges = destination_ip_ranges + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.protocol = protocol + + +class QosIpRange(_serialization.Model): + """Qos Traffic Profiler IP Range properties. + + :ivar start_ip: Start IP Address. + :vartype start_ip: str + :ivar end_ip: End IP Address. + :vartype end_ip: str + """ + + _attribute_map = { + "start_ip": {"key": "startIP", "type": "str"}, + "end_ip": {"key": "endIP", "type": "str"}, + } + + def __init__(self, *, start_ip: Optional[str] = None, end_ip: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword start_ip: Start IP Address. + :paramtype start_ip: str + :keyword end_ip: End IP Address. + :paramtype end_ip: str + """ + super().__init__(**kwargs) + self.start_ip = start_ip + self.end_ip = end_ip + + +class QosPortRange(_serialization.Model): + """Qos Traffic Profiler Port range properties. + + :ivar start: Qos Port Range start. + :vartype start: int + :ivar end: Qos Port Range end. + :vartype end: int + """ + + _attribute_map = { + "start": {"key": "start", "type": "int"}, + "end": {"key": "end", "type": "int"}, + } + + def __init__(self, *, start: Optional[int] = None, end: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword start: Qos Port Range start. + :paramtype start: int + :keyword end: Qos Port Range end. + :paramtype end: int + """ + super().__init__(**kwargs) + self.start = start + self.end = end + + +class QueryInboundNatRulePortMappingRequest(_serialization.Model): + """The request for a QueryInboundNatRulePortMapping API. Either IpConfiguration or IpAddress + should be set. + + :ivar ip_configuration: NetworkInterfaceIPConfiguration set in load balancer backend address. + :vartype ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar ip_address: IP address set in load balancer backend address. + :vartype ip_address: str + """ + + _attribute_map = { + "ip_configuration": {"key": "ipConfiguration", "type": "SubResource"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + } + + def __init__( + self, + *, + ip_configuration: Optional["_models.SubResource"] = None, + ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ip_configuration: NetworkInterfaceIPConfiguration set in load balancer backend + address. + :paramtype ip_configuration: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword ip_address: IP address set in load balancer backend address. + :paramtype ip_address: str + """ + super().__init__(**kwargs) + self.ip_configuration = ip_configuration + self.ip_address = ip_address + + +class QueryRequestOptions(_serialization.Model): + """Query Request Options. + + :ivar skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :vartype skip_token: str + """ + + _attribute_map = { + "skip_token": {"key": "skipToken", "type": "str"}, + } + + def __init__(self, *, skip_token: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword skip_token: When present, the value can be passed to a subsequent query call (together + with the same query and scopes used in the current request) to retrieve the next page of data. + :paramtype skip_token: str + """ + super().__init__(**kwargs) + self.skip_token = skip_token + + +class QueryResults(_serialization.Model): + """Query result. + + :ivar matching_records_count: Number of total records matching the query. + :vartype matching_records_count: int + :ivar signatures: Array containing the results of the query. + :vartype signatures: list[~azure.mgmt.network.v2023_09_01.models.SingleQueryResult] + """ + + _attribute_map = { + "matching_records_count": {"key": "matchingRecordsCount", "type": "int"}, + "signatures": {"key": "signatures", "type": "[SingleQueryResult]"}, + } + + def __init__( + self, + *, + matching_records_count: Optional[int] = None, + signatures: Optional[List["_models.SingleQueryResult"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword matching_records_count: Number of total records matching the query. + :paramtype matching_records_count: int + :keyword signatures: Array containing the results of the query. + :paramtype signatures: list[~azure.mgmt.network.v2023_09_01.models.SingleQueryResult] + """ + super().__init__(**kwargs) + self.matching_records_count = matching_records_count + self.signatures = signatures + + +class QueryTroubleshootingParameters(_serialization.Model): + """Parameters that define the resource to query the troubleshooting result. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The target resource ID to query the troubleshooting result. Required. + :vartype target_resource_id: str + """ + + _validation = { + "target_resource_id": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + } + + def __init__(self, *, target_resource_id: str, **kwargs: Any) -> None: + """ + :keyword target_resource_id: The target resource ID to query the troubleshooting result. + Required. + :paramtype target_resource_id: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + + +class RadiusServer(_serialization.Model): + """Radius Server Settings. + + All required parameters must be populated in order to send to Azure. + + :ivar radius_server_address: The address of this radius server. Required. + :vartype radius_server_address: str + :ivar radius_server_score: The initial score assigned to this radius server. + :vartype radius_server_score: int + :ivar radius_server_secret: The secret used for this radius server. + :vartype radius_server_secret: str + """ + + _validation = { + "radius_server_address": {"required": True}, + } + + _attribute_map = { + "radius_server_address": {"key": "radiusServerAddress", "type": "str"}, + "radius_server_score": {"key": "radiusServerScore", "type": "int"}, + "radius_server_secret": {"key": "radiusServerSecret", "type": "str"}, + } + + def __init__( + self, + *, + radius_server_address: str, + radius_server_score: Optional[int] = None, + radius_server_secret: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword radius_server_address: The address of this radius server. Required. + :paramtype radius_server_address: str + :keyword radius_server_score: The initial score assigned to this radius server. + :paramtype radius_server_score: int + :keyword radius_server_secret: The secret used for this radius server. + :paramtype radius_server_secret: str + """ + super().__init__(**kwargs) + self.radius_server_address = radius_server_address + self.radius_server_score = radius_server_score + self.radius_server_secret = radius_server_secret + + +class RecordSet(_serialization.Model): + """A collective group of information about the record set information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar record_type: Resource record type. + :vartype record_type: str + :ivar record_set_name: Recordset name. + :vartype record_set_name: str + :ivar fqdn: Fqdn that resolves to private endpoint ip address. + :vartype fqdn: str + :ivar provisioning_state: The provisioning state of the recordset. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar ttl: Recordset time to live. + :vartype ttl: int + :ivar ip_addresses: The private ip address of the private endpoint. + :vartype ip_addresses: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "record_type": {"key": "recordType", "type": "str"}, + "record_set_name": {"key": "recordSetName", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "ttl": {"key": "ttl", "type": "int"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + } + + def __init__( + self, + *, + record_type: Optional[str] = None, + record_set_name: Optional[str] = None, + fqdn: Optional[str] = None, + ttl: Optional[int] = None, + ip_addresses: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword record_type: Resource record type. + :paramtype record_type: str + :keyword record_set_name: Recordset name. + :paramtype record_set_name: str + :keyword fqdn: Fqdn that resolves to private endpoint ip address. + :paramtype fqdn: str + :keyword ttl: Recordset time to live. + :paramtype ttl: int + :keyword ip_addresses: The private ip address of the private endpoint. + :paramtype ip_addresses: list[str] + """ + super().__init__(**kwargs) + self.record_type = record_type + self.record_set_name = record_set_name + self.fqdn = fqdn + self.provisioning_state = None + self.ttl = ttl + self.ip_addresses = ip_addresses + + +class ReferencedPublicIpAddress(_serialization.Model): + """Reference to a public IP address. + + :ivar id: The PublicIPAddress Reference. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The PublicIPAddress Reference. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ResourceNavigationLink(SubResource): + """ResourceNavigationLink resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar linked_resource_type: Resource type of the linked resource. + :vartype linked_resource_type: str + :ivar link: Link to the external resource. + :vartype link: str + :ivar provisioning_state: The provisioning state of the resource navigation link resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "linked_resource_type": {"key": "properties.linkedResourceType", "type": "str"}, + "link": {"key": "properties.link", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + linked_resource_type: Optional[str] = None, + link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword linked_resource_type: Resource type of the linked resource. + :paramtype linked_resource_type: str + :keyword link: Link to the external resource. + :paramtype link: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.linked_resource_type = linked_resource_type + self.link = link + self.provisioning_state = None + + +class ResourceNavigationLinksListResult(_serialization.Model): + """Response for ResourceNavigationLinks_List operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The resource navigation links in a subnet. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ResourceNavigationLink] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceNavigationLink]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ResourceNavigationLink"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The resource navigation links in a subnet. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ResourceNavigationLink] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class RetentionPolicyParameters(_serialization.Model): + """Parameters that define the retention policy for flow log. + + :ivar days: Number of days to retain flow log records. + :vartype days: int + :ivar enabled: Flag to enable/disable retention. + :vartype enabled: bool + """ + + _attribute_map = { + "days": {"key": "days", "type": "int"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, days: int = 0, enabled: bool = False, **kwargs: Any) -> None: + """ + :keyword days: Number of days to retain flow log records. + :paramtype days: int + :keyword enabled: Flag to enable/disable retention. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.days = days + self.enabled = enabled + + +class Route(SubResource): + """Route resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: The type of the resource. + :vartype type: str + :ivar address_prefix: The destination CIDR to which the route applies. + :vartype address_prefix: str + :ivar next_hop_type: The type of Azure hop the packet should be sent to. Known values are: + "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", and "None". + :vartype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.RouteNextHopType + :ivar next_hop_ip_address: The IP address packets should be forwarded to. Next hop values are + only allowed in routes where the next hop type is VirtualAppliance. + :vartype next_hop_ip_address: str + :ivar provisioning_state: The provisioning state of the route resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar has_bgp_override: A value indicating whether this route overrides overlapping BGP routes + regardless of LPM. + :vartype has_bgp_override: bool + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "next_hop_type": {"key": "properties.nextHopType", "type": "str"}, + "next_hop_ip_address": {"key": "properties.nextHopIpAddress", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "has_bgp_override": {"key": "properties.hasBgpOverride", "type": "bool"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + address_prefix: Optional[str] = None, + next_hop_type: Optional[Union[str, "_models.RouteNextHopType"]] = None, + next_hop_ip_address: Optional[str] = None, + has_bgp_override: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: The type of the resource. + :paramtype type: str + :keyword address_prefix: The destination CIDR to which the route applies. + :paramtype address_prefix: str + :keyword next_hop_type: The type of Azure hop the packet should be sent to. Known values are: + "VirtualNetworkGateway", "VnetLocal", "Internet", "VirtualAppliance", and "None". + :paramtype next_hop_type: str or ~azure.mgmt.network.v2023_09_01.models.RouteNextHopType + :keyword next_hop_ip_address: The IP address packets should be forwarded to. Next hop values + are only allowed in routes where the next hop type is VirtualAppliance. + :paramtype next_hop_ip_address: str + :keyword has_bgp_override: A value indicating whether this route overrides overlapping BGP + routes regardless of LPM. + :paramtype has_bgp_override: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.address_prefix = address_prefix + self.next_hop_type = next_hop_type + self.next_hop_ip_address = next_hop_ip_address + self.provisioning_state = None + self.has_bgp_override = has_bgp_override + + +class RouteFilter(Resource): + """Route Filter Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar rules: Collection of RouteFilterRules contained within a route filter. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :ivar peerings: A collection of references to express route circuit peerings. + :vartype peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar ipv6_peerings: A collection of references to express route circuit ipv6 peerings. + :vartype ipv6_peerings: list[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :ivar provisioning_state: The provisioning state of the route filter resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "peerings": {"readonly": True}, + "ipv6_peerings": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "rules": {"key": "properties.rules", "type": "[RouteFilterRule]"}, + "peerings": {"key": "properties.peerings", "type": "[ExpressRouteCircuitPeering]"}, + "ipv6_peerings": {"key": "properties.ipv6Peerings", "type": "[ExpressRouteCircuitPeering]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + rules: Optional[List["_models.RouteFilterRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword rules: Collection of RouteFilterRules contained within a route filter. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.rules = rules + self.peerings = None + self.ipv6_peerings = None + self.provisioning_state = None + + +class RouteFilterListResult(_serialization.Model): + """Response for the ListRouteFilters API service call. + + :ivar value: A list of route filters in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RouteFilter]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RouteFilter"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of route filters in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RouteFilterRule(SubResource): + """Route Filter Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar access: The access type of the rule. Known values are: "Allow" and "Deny". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :ivar route_filter_rule_type: The rule type of the rule. "Community" + :vartype route_filter_rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.RouteFilterRuleType + :ivar communities: The collection for bgp community values to filter on. e.g. + ['12076:5010','12076:5020']. + :vartype communities: list[str] + :ivar provisioning_state: The provisioning state of the route filter rule resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "access": {"key": "properties.access", "type": "str"}, + "route_filter_rule_type": {"key": "properties.routeFilterRuleType", "type": "str"}, + "communities": {"key": "properties.communities", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + location: Optional[str] = None, + access: Optional[Union[str, "_models.Access"]] = None, + route_filter_rule_type: Optional[Union[str, "_models.RouteFilterRuleType"]] = None, + communities: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword location: Resource location. + :paramtype location: str + :keyword access: The access type of the rule. Known values are: "Allow" and "Deny". + :paramtype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :keyword route_filter_rule_type: The rule type of the rule. "Community" + :paramtype route_filter_rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.RouteFilterRuleType + :keyword communities: The collection for bgp community values to filter on. e.g. + ['12076:5010','12076:5020']. + :paramtype communities: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.location = location + self.etag = None + self.access = access + self.route_filter_rule_type = route_filter_rule_type + self.communities = communities + self.provisioning_state = None + + +class RouteFilterRuleListResult(_serialization.Model): + """Response for the ListRouteFilterRules API service call. + + :ivar value: A list of RouteFilterRules in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RouteFilterRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RouteFilterRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of RouteFilterRules in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RouteListResult(_serialization.Model): + """Response for the ListRoute API service call. + + :ivar value: A list of routes in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.Route] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Route]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Route"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of routes in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.Route] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RouteMap(SubResource): + """The RouteMap child resource of a Virtual hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar associated_inbound_connections: List of connections which have this RoutMap associated + for inbound traffic. + :vartype associated_inbound_connections: list[str] + :ivar associated_outbound_connections: List of connections which have this RoutMap associated + for outbound traffic. + :vartype associated_outbound_connections: list[str] + :ivar rules: List of RouteMap rules to be applied. + :vartype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteMapRule] + :ivar provisioning_state: The provisioning state of the RouteMap resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "associated_inbound_connections": {"key": "properties.associatedInboundConnections", "type": "[str]"}, + "associated_outbound_connections": {"key": "properties.associatedOutboundConnections", "type": "[str]"}, + "rules": {"key": "properties.rules", "type": "[RouteMapRule]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + associated_inbound_connections: Optional[List[str]] = None, + associated_outbound_connections: Optional[List[str]] = None, + rules: Optional[List["_models.RouteMapRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword associated_inbound_connections: List of connections which have this RoutMap associated + for inbound traffic. + :paramtype associated_inbound_connections: list[str] + :keyword associated_outbound_connections: List of connections which have this RoutMap + associated for outbound traffic. + :paramtype associated_outbound_connections: list[str] + :keyword rules: List of RouteMap rules to be applied. + :paramtype rules: list[~azure.mgmt.network.v2023_09_01.models.RouteMapRule] + """ + super().__init__(id=id, **kwargs) + self.name = None + self.etag = None + self.type = None + self.associated_inbound_connections = associated_inbound_connections + self.associated_outbound_connections = associated_outbound_connections + self.rules = rules + self.provisioning_state = None + + +class RouteMapRule(_serialization.Model): + """A RouteMap Rule. + + :ivar name: The unique name for the rule. + :vartype name: str + :ivar match_criteria: List of matching criterion which will be applied to traffic. + :vartype match_criteria: list[~azure.mgmt.network.v2023_09_01.models.Criterion] + :ivar actions: List of actions which will be applied on a match. + :vartype actions: list[~azure.mgmt.network.v2023_09_01.models.Action] + :ivar next_step_if_matched: Next step after rule is evaluated. Current supported behaviors are + 'Continue'(to next rule) and 'Terminate'. Known values are: "Unknown", "Continue", "Terminate", + and "Continue". + :vartype next_step_if_matched: str or ~azure.mgmt.network.v2023_09_01.models.NextStep + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "match_criteria": {"key": "matchCriteria", "type": "[Criterion]"}, + "actions": {"key": "actions", "type": "[Action]"}, + "next_step_if_matched": {"key": "nextStepIfMatched", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + match_criteria: Optional[List["_models.Criterion"]] = None, + actions: Optional[List["_models.Action"]] = None, + next_step_if_matched: Optional[Union[str, "_models.NextStep"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The unique name for the rule. + :paramtype name: str + :keyword match_criteria: List of matching criterion which will be applied to traffic. + :paramtype match_criteria: list[~azure.mgmt.network.v2023_09_01.models.Criterion] + :keyword actions: List of actions which will be applied on a match. + :paramtype actions: list[~azure.mgmt.network.v2023_09_01.models.Action] + :keyword next_step_if_matched: Next step after rule is evaluated. Current supported behaviors + are 'Continue'(to next rule) and 'Terminate'. Known values are: "Unknown", "Continue", + "Terminate", and "Continue". + :paramtype next_step_if_matched: str or ~azure.mgmt.network.v2023_09_01.models.NextStep + """ + super().__init__(**kwargs) + self.name = name + self.match_criteria = match_criteria + self.actions = actions + self.next_step_if_matched = next_step_if_matched + + +class RouteTable(Resource): # pylint: disable=too-many-instance-attributes + """Route table resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar routes: Collection of routes contained within a route table. + :vartype routes: list[~azure.mgmt.network.v2023_09_01.models.Route] + :ivar subnets: A collection of references to subnets. + :vartype subnets: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :ivar disable_bgp_route_propagation: Whether to disable the routes learned by BGP on that route + table. True means disable. + :vartype disable_bgp_route_propagation: bool + :ivar provisioning_state: The provisioning state of the route table resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: The resource GUID property of the route table. + :vartype resource_guid: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "subnets": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "routes": {"key": "properties.routes", "type": "[Route]"}, + "subnets": {"key": "properties.subnets", "type": "[Subnet]"}, + "disable_bgp_route_propagation": {"key": "properties.disableBgpRoutePropagation", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + routes: Optional[List["_models.Route"]] = None, + disable_bgp_route_propagation: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword routes: Collection of routes contained within a route table. + :paramtype routes: list[~azure.mgmt.network.v2023_09_01.models.Route] + :keyword disable_bgp_route_propagation: Whether to disable the routes learned by BGP on that + route table. True means disable. + :paramtype disable_bgp_route_propagation: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.routes = routes + self.subnets = None + self.disable_bgp_route_propagation = disable_bgp_route_propagation + self.provisioning_state = None + self.resource_guid = None + + +class RouteTableListResult(_serialization.Model): + """Response for the ListRouteTable API service call. + + :ivar value: A list of route tables in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[RouteTable]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.RouteTable"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of route tables in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RoutingConfiguration(_serialization.Model): + """Routing Configuration indicating the associated and propagated route tables for this + connection. + + :ivar associated_route_table: The resource id RouteTable associated with this + RoutingConfiguration. + :vartype associated_route_table: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar propagated_route_tables: The list of RouteTables to advertise the routes to. + :vartype propagated_route_tables: ~azure.mgmt.network.v2023_09_01.models.PropagatedRouteTable + :ivar vnet_routes: List of routes that control routing from VirtualHub into a virtual network + connection. + :vartype vnet_routes: ~azure.mgmt.network.v2023_09_01.models.VnetRoute + :ivar inbound_route_map: The resource id of the RouteMap associated with this + RoutingConfiguration for inbound learned routes. + :vartype inbound_route_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar outbound_route_map: The resource id of theRouteMap associated with this + RoutingConfiguration for outbound advertised routes. + :vartype outbound_route_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "associated_route_table": {"key": "associatedRouteTable", "type": "SubResource"}, + "propagated_route_tables": {"key": "propagatedRouteTables", "type": "PropagatedRouteTable"}, + "vnet_routes": {"key": "vnetRoutes", "type": "VnetRoute"}, + "inbound_route_map": {"key": "inboundRouteMap", "type": "SubResource"}, + "outbound_route_map": {"key": "outboundRouteMap", "type": "SubResource"}, + } + + def __init__( + self, + *, + associated_route_table: Optional["_models.SubResource"] = None, + propagated_route_tables: Optional["_models.PropagatedRouteTable"] = None, + vnet_routes: Optional["_models.VnetRoute"] = None, + inbound_route_map: Optional["_models.SubResource"] = None, + outbound_route_map: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword associated_route_table: The resource id RouteTable associated with this + RoutingConfiguration. + :paramtype associated_route_table: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword propagated_route_tables: The list of RouteTables to advertise the routes to. + :paramtype propagated_route_tables: ~azure.mgmt.network.v2023_09_01.models.PropagatedRouteTable + :keyword vnet_routes: List of routes that control routing from VirtualHub into a virtual + network connection. + :paramtype vnet_routes: ~azure.mgmt.network.v2023_09_01.models.VnetRoute + :keyword inbound_route_map: The resource id of the RouteMap associated with this + RoutingConfiguration for inbound learned routes. + :paramtype inbound_route_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword outbound_route_map: The resource id of theRouteMap associated with this + RoutingConfiguration for outbound advertised routes. + :paramtype outbound_route_map: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.associated_route_table = associated_route_table + self.propagated_route_tables = propagated_route_tables + self.vnet_routes = vnet_routes + self.inbound_route_map = inbound_route_map + self.outbound_route_map = outbound_route_map + + +class RoutingIntent(SubResource): + """The routing intent child resource of a Virtual hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar routing_policies: List of routing policies. + :vartype routing_policies: list[~azure.mgmt.network.v2023_09_01.models.RoutingPolicy] + :ivar provisioning_state: The provisioning state of the RoutingIntent resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "routing_policies": {"key": "properties.routingPolicies", "type": "[RoutingPolicy]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + routing_policies: Optional[List["_models.RoutingPolicy"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword routing_policies: List of routing policies. + :paramtype routing_policies: list[~azure.mgmt.network.v2023_09_01.models.RoutingPolicy] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.routing_policies = routing_policies + self.provisioning_state = None + + +class RoutingPolicy(_serialization.Model): + """The routing policy object used in a RoutingIntent resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The unique name for the routing policy. Required. + :vartype name: str + :ivar destinations: List of all destinations which this routing policy is applicable to (for + example: Internet, PrivateTraffic). Required. + :vartype destinations: list[str] + :ivar next_hop: The next hop resource id on which this routing policy is applicable to. + Required. + :vartype next_hop: str + """ + + _validation = { + "name": {"required": True}, + "destinations": {"required": True}, + "next_hop": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "destinations": {"key": "destinations", "type": "[str]"}, + "next_hop": {"key": "nextHop", "type": "str"}, + } + + def __init__(self, *, name: str, destinations: List[str], next_hop: str, **kwargs: Any) -> None: + """ + :keyword name: The unique name for the routing policy. Required. + :paramtype name: str + :keyword destinations: List of all destinations which this routing policy is applicable to (for + example: Internet, PrivateTraffic). Required. + :paramtype destinations: list[str] + :keyword next_hop: The next hop resource id on which this routing policy is applicable to. + Required. + :paramtype next_hop: str + """ + super().__init__(**kwargs) + self.name = name + self.destinations = destinations + self.next_hop = next_hop + + +class ScopeConnection(ChildResource): + """The Scope Connections resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar tenant_id: Tenant ID. + :vartype tenant_id: str + :ivar resource_id: Resource ID. + :vartype resource_id: str + :ivar connection_state: Connection State. Known values are: "Connected", "Pending", "Conflict", + "Revoked", and "Rejected". + :vartype connection_state: str or ~azure.mgmt.network.v2023_09_01.models.ScopeConnectionState + :ivar description: A description of the scope connection. + :vartype description: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "connection_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "resource_id": {"key": "properties.resourceId", "type": "str"}, + "connection_state": {"key": "properties.connectionState", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + resource_id: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tenant_id: Tenant ID. + :paramtype tenant_id: str + :keyword resource_id: Resource ID. + :paramtype resource_id: str + :keyword description: A description of the scope connection. + :paramtype description: str + """ + super().__init__(**kwargs) + self.system_data = None + self.tenant_id = tenant_id + self.resource_id = resource_id + self.connection_state = None + self.description = description + + +class ScopeConnectionListResult(_serialization.Model): + """List of scope connections. + + :ivar value: List of scope connections. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ScopeConnection] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ScopeConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ScopeConnection"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of scope connections. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ScopeConnection] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecurityAdminConfiguration(ChildResource): + """Defines the security admin configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar description: A description of the security configuration. + :vartype description: str + :ivar apply_on_network_intent_policy_based_services: Enum list of network intent policy based + services. + :vartype apply_on_network_intent_policy_based_services: list[str or + ~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicyBasedService] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_guid: Unique identifier for this resource. + :vartype resource_guid: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "apply_on_network_intent_policy_based_services": { + "key": "properties.applyOnNetworkIntentPolicyBasedServices", + "type": "[str]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + apply_on_network_intent_policy_based_services: Optional[ + List[Union[str, "_models.NetworkIntentPolicyBasedService"]] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: A description of the security configuration. + :paramtype description: str + :keyword apply_on_network_intent_policy_based_services: Enum list of network intent policy + based services. + :paramtype apply_on_network_intent_policy_based_services: list[str or + ~azure.mgmt.network.v2023_09_01.models.NetworkIntentPolicyBasedService] + """ + super().__init__(**kwargs) + self.system_data = None + self.description = description + self.apply_on_network_intent_policy_based_services = apply_on_network_intent_policy_based_services + self.provisioning_state = None + self.resource_guid = None + + +class SecurityAdminConfigurationListResult(_serialization.Model): + """A list of network manager security admin configurations. + + :ivar value: Gets a page of security admin configurations. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration] + :ivar next_link: Gets the URL to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SecurityAdminConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SecurityAdminConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of security admin configurations. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration] + :keyword next_link: Gets the URL to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecurityGroupNetworkInterface(_serialization.Model): + """Network interface and all its associated security rules. + + :ivar id: ID of the network interface. + :vartype id: str + :ivar security_rule_associations: All security rules associated with the network interface. + :vartype security_rule_associations: + ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAssociations + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "security_rule_associations": {"key": "securityRuleAssociations", "type": "SecurityRuleAssociations"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + security_rule_associations: Optional["_models.SecurityRuleAssociations"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: ID of the network interface. + :paramtype id: str + :keyword security_rule_associations: All security rules associated with the network interface. + :paramtype security_rule_associations: + ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAssociations + """ + super().__init__(**kwargs) + self.id = id + self.security_rule_associations = security_rule_associations + + +class SecurityGroupViewParameters(_serialization.Model): + """Parameters that define the VM to check security groups for. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: ID of the target VM. Required. + :vartype target_resource_id: str + """ + + _validation = { + "target_resource_id": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + } + + def __init__(self, *, target_resource_id: str, **kwargs: Any) -> None: + """ + :keyword target_resource_id: ID of the target VM. Required. + :paramtype target_resource_id: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + + +class SecurityGroupViewResult(_serialization.Model): + """The information about security rules applied to the specified VM. + + :ivar network_interfaces: List of network interfaces on the specified VM. + :vartype network_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.SecurityGroupNetworkInterface] + """ + + _attribute_map = { + "network_interfaces": {"key": "networkInterfaces", "type": "[SecurityGroupNetworkInterface]"}, + } + + def __init__( + self, *, network_interfaces: Optional[List["_models.SecurityGroupNetworkInterface"]] = None, **kwargs: Any + ) -> None: + """ + :keyword network_interfaces: List of network interfaces on the specified VM. + :paramtype network_interfaces: + list[~azure.mgmt.network.v2023_09_01.models.SecurityGroupNetworkInterface] + """ + super().__init__(**kwargs) + self.network_interfaces = network_interfaces + + +class SecurityPartnerProvider(Resource): + """Security Partner Provider resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar provisioning_state: The provisioning state of the Security Partner Provider resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar security_provider_name: The security provider name. Known values are: "ZScaler", "IBoss", + and "Checkpoint". + :vartype security_provider_name: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityProviderName + :ivar connection_status: The connection status with the Security Partner Provider. Known values + are: "Unknown", "PartiallyConnected", "Connected", and "NotConnected". + :vartype connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProviderConnectionStatus + :ivar virtual_hub: The virtualHub to which the Security Partner Provider belongs. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connection_status": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "security_provider_name": {"key": "properties.securityProviderName", "type": "str"}, + "connection_status": {"key": "properties.connectionStatus", "type": "str"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "SubResource"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + security_provider_name: Optional[Union[str, "_models.SecurityProviderName"]] = None, + virtual_hub: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword security_provider_name: The security provider name. Known values are: "ZScaler", + "IBoss", and "Checkpoint". + :paramtype security_provider_name: str or + ~azure.mgmt.network.v2023_09_01.models.SecurityProviderName + :keyword virtual_hub: The virtualHub to which the Security Partner Provider belongs. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.provisioning_state = None + self.security_provider_name = security_provider_name + self.connection_status = None + self.virtual_hub = virtual_hub + + +class SecurityPartnerProviderListResult(_serialization.Model): + """Response for ListSecurityPartnerProviders API service call. + + :ivar value: List of Security Partner Providers in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SecurityPartnerProvider]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SecurityPartnerProvider"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of Security Partner Providers in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecurityRule(SubResource): # pylint: disable=too-many-instance-attributes + """Network security rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: The type of the resource. + :vartype type: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", "Icmp", + "Esp", "*", and "Ah". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleProtocol + :ivar source_port_range: The source port or range. Integer or range between 0 and 65535. + Asterisk '*' can also be used to match all ports. + :vartype source_port_range: str + :ivar destination_port_range: The destination port or range. Integer or range between 0 and + 65535. Asterisk '*' can also be used to match all ports. + :vartype destination_port_range: str + :ivar source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used. If this is an ingress rule, specifies where network traffic originates from. + :vartype source_address_prefix: str + :ivar source_address_prefixes: The CIDR or source IP ranges. + :vartype source_address_prefixes: list[str] + :ivar source_application_security_groups: The application security group specified as source. + :vartype source_application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :ivar destination_address_prefix: The destination address prefix. CIDR or destination IP range. + Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', + 'AzureLoadBalancer' and 'Internet' can also be used. + :vartype destination_address_prefix: str + :ivar destination_address_prefixes: The destination address prefixes. CIDR or destination IP + ranges. + :vartype destination_address_prefixes: list[str] + :ivar destination_application_security_groups: The application security group specified as + destination. + :vartype destination_application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar access: The network traffic is allowed or denied. Known values are: "Allow" and "Deny". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + :ivar priority: The priority of the rule. The value can be between 100 and 4096. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. + :vartype priority: int + :ivar direction: The direction of the rule. The direction specifies if rule will be evaluated + on incoming or outgoing traffic. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleDirection + :ivar provisioning_state: The provisioning state of the security rule resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "protocol": {"key": "properties.protocol", "type": "str"}, + "source_port_range": {"key": "properties.sourcePortRange", "type": "str"}, + "destination_port_range": {"key": "properties.destinationPortRange", "type": "str"}, + "source_address_prefix": {"key": "properties.sourceAddressPrefix", "type": "str"}, + "source_address_prefixes": {"key": "properties.sourceAddressPrefixes", "type": "[str]"}, + "source_application_security_groups": { + "key": "properties.sourceApplicationSecurityGroups", + "type": "[ApplicationSecurityGroup]", + }, + "destination_address_prefix": {"key": "properties.destinationAddressPrefix", "type": "str"}, + "destination_address_prefixes": {"key": "properties.destinationAddressPrefixes", "type": "[str]"}, + "destination_application_security_groups": { + "key": "properties.destinationApplicationSecurityGroups", + "type": "[ApplicationSecurityGroup]", + }, + "source_port_ranges": {"key": "properties.sourcePortRanges", "type": "[str]"}, + "destination_port_ranges": {"key": "properties.destinationPortRanges", "type": "[str]"}, + "access": {"key": "properties.access", "type": "str"}, + "priority": {"key": "properties.priority", "type": "int"}, + "direction": {"key": "properties.direction", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[Union[str, "_models.SecurityRuleProtocol"]] = None, + source_port_range: Optional[str] = None, + destination_port_range: Optional[str] = None, + source_address_prefix: Optional[str] = None, + source_address_prefixes: Optional[List[str]] = None, + source_application_security_groups: Optional[List["_models.ApplicationSecurityGroup"]] = None, + destination_address_prefix: Optional[str] = None, + destination_address_prefixes: Optional[List[str]] = None, + destination_application_security_groups: Optional[List["_models.ApplicationSecurityGroup"]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + access: Optional[Union[str, "_models.SecurityRuleAccess"]] = None, + priority: Optional[int] = None, + direction: Optional[Union[str, "_models.SecurityRuleDirection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: The type of the resource. + :paramtype type: str + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword protocol: Network protocol this rule applies to. Known values are: "Tcp", "Udp", + "Icmp", "Esp", "*", and "Ah". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleProtocol + :keyword source_port_range: The source port or range. Integer or range between 0 and 65535. + Asterisk '*' can also be used to match all ports. + :paramtype source_port_range: str + :keyword destination_port_range: The destination port or range. Integer or range between 0 and + 65535. Asterisk '*' can also be used to match all ports. + :paramtype destination_port_range: str + :keyword source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used. If this is an ingress rule, specifies where network traffic originates from. + :paramtype source_address_prefix: str + :keyword source_address_prefixes: The CIDR or source IP ranges. + :paramtype source_address_prefixes: list[str] + :keyword source_application_security_groups: The application security group specified as + source. + :paramtype source_application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :keyword destination_address_prefix: The destination address prefix. CIDR or destination IP + range. Asterisk '*' can also be used to match all source IPs. Default tags such as + 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. + :paramtype destination_address_prefix: str + :keyword destination_address_prefixes: The destination address prefixes. CIDR or destination IP + ranges. + :paramtype destination_address_prefixes: list[str] + :keyword destination_application_security_groups: The application security group specified as + destination. + :paramtype destination_application_security_groups: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword access: The network traffic is allowed or denied. Known values are: "Allow" and + "Deny". + :paramtype access: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleAccess + :keyword priority: The priority of the rule. The value can be between 100 and 4096. The + priority number must be unique for each rule in the collection. The lower the priority number, + the higher the priority of the rule. + :paramtype priority: int + :keyword direction: The direction of the rule. The direction specifies if rule will be + evaluated on incoming or outgoing traffic. Known values are: "Inbound" and "Outbound". + :paramtype direction: str or ~azure.mgmt.network.v2023_09_01.models.SecurityRuleDirection + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.description = description + self.protocol = protocol + self.source_port_range = source_port_range + self.destination_port_range = destination_port_range + self.source_address_prefix = source_address_prefix + self.source_address_prefixes = source_address_prefixes + self.source_application_security_groups = source_application_security_groups + self.destination_address_prefix = destination_address_prefix + self.destination_address_prefixes = destination_address_prefixes + self.destination_application_security_groups = destination_application_security_groups + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + self.provisioning_state = None + + +class SecurityRuleAssociations(_serialization.Model): + """All security rules associated with the network interface. + + :ivar network_interface_association: Network interface and it's custom security rules. + :vartype network_interface_association: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAssociation + :ivar subnet_association: Subnet and it's custom security rules. + :vartype subnet_association: ~azure.mgmt.network.v2023_09_01.models.SubnetAssociation + :ivar default_security_rules: Collection of default security rules of the network security + group. + :vartype default_security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :ivar effective_security_rules: Collection of effective security rules. + :vartype effective_security_rules: + list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityRule] + """ + + _attribute_map = { + "network_interface_association": {"key": "networkInterfaceAssociation", "type": "NetworkInterfaceAssociation"}, + "subnet_association": {"key": "subnetAssociation", "type": "SubnetAssociation"}, + "default_security_rules": {"key": "defaultSecurityRules", "type": "[SecurityRule]"}, + "effective_security_rules": {"key": "effectiveSecurityRules", "type": "[EffectiveNetworkSecurityRule]"}, + } + + def __init__( + self, + *, + network_interface_association: Optional["_models.NetworkInterfaceAssociation"] = None, + subnet_association: Optional["_models.SubnetAssociation"] = None, + default_security_rules: Optional[List["_models.SecurityRule"]] = None, + effective_security_rules: Optional[List["_models.EffectiveNetworkSecurityRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_interface_association: Network interface and it's custom security rules. + :paramtype network_interface_association: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceAssociation + :keyword subnet_association: Subnet and it's custom security rules. + :paramtype subnet_association: ~azure.mgmt.network.v2023_09_01.models.SubnetAssociation + :keyword default_security_rules: Collection of default security rules of the network security + group. + :paramtype default_security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :keyword effective_security_rules: Collection of effective security rules. + :paramtype effective_security_rules: + list[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityRule] + """ + super().__init__(**kwargs) + self.network_interface_association = network_interface_association + self.subnet_association = subnet_association + self.default_security_rules = default_security_rules + self.effective_security_rules = effective_security_rules + + +class SecurityRuleListResult(_serialization.Model): + """Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a + network security group. + + :ivar value: The security rules in a network security group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SecurityRule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SecurityRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The security rules in a network security group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceAssociationLink(SubResource): + """ServiceAssociationLink resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the resource that is unique within a resource group. This name can be used + to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar linked_resource_type: Resource type of the linked resource. + :vartype linked_resource_type: str + :ivar link: Link to the external resource. + :vartype link: str + :ivar provisioning_state: The provisioning state of the service association link resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar allow_delete: If true, the resource can be deleted. + :vartype allow_delete: bool + :ivar locations: A list of locations. + :vartype locations: list[str] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "linked_resource_type": {"key": "properties.linkedResourceType", "type": "str"}, + "link": {"key": "properties.link", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "allow_delete": {"key": "properties.allowDelete", "type": "bool"}, + "locations": {"key": "properties.locations", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + linked_resource_type: Optional[str] = None, + link: Optional[str] = None, + allow_delete: Optional[bool] = None, + locations: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the resource that is unique within a resource group. This name can be + used to access the resource. + :paramtype name: str + :keyword linked_resource_type: Resource type of the linked resource. + :paramtype linked_resource_type: str + :keyword link: Link to the external resource. + :paramtype link: str + :keyword allow_delete: If true, the resource can be deleted. + :paramtype allow_delete: bool + :keyword locations: A list of locations. + :paramtype locations: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.linked_resource_type = linked_resource_type + self.link = link + self.provisioning_state = None + self.allow_delete = allow_delete + self.locations = locations + + +class ServiceAssociationLinksListResult(_serialization.Model): + """Response for ServiceAssociationLinks_List operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The service association links in a subnet. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceAssociationLink] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceAssociationLink]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ServiceAssociationLink"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The service association links in a subnet. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceAssociationLink] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ServiceEndpointPolicy(Resource): # pylint: disable=too-many-instance-attributes + """Service End point policy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar kind: Kind of service endpoint policy. This is metadata used for the Azure portal + experience. + :vartype kind: str + :ivar service_endpoint_policy_definitions: A collection of service endpoint policy definitions + of the service endpoint policy. + :vartype service_endpoint_policy_definitions: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :ivar subnets: A collection of references to subnets. + :vartype subnets: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :ivar resource_guid: The resource GUID property of the service endpoint policy resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the service endpoint policy resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar service_alias: The alias indicating if the policy belongs to a service. + :vartype service_alias: str + :ivar contextual_service_endpoint_policies: A collection of contextual service endpoint policy. + :vartype contextual_service_endpoint_policies: list[str] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"readonly": True}, + "subnets": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "service_endpoint_policy_definitions": { + "key": "properties.serviceEndpointPolicyDefinitions", + "type": "[ServiceEndpointPolicyDefinition]", + }, + "subnets": {"key": "properties.subnets", "type": "[Subnet]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "service_alias": {"key": "properties.serviceAlias", "type": "str"}, + "contextual_service_endpoint_policies": { + "key": "properties.contextualServiceEndpointPolicies", + "type": "[str]", + }, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + service_endpoint_policy_definitions: Optional[List["_models.ServiceEndpointPolicyDefinition"]] = None, + service_alias: Optional[str] = None, + contextual_service_endpoint_policies: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword service_endpoint_policy_definitions: A collection of service endpoint policy + definitions of the service endpoint policy. + :paramtype service_endpoint_policy_definitions: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :keyword service_alias: The alias indicating if the policy belongs to a service. + :paramtype service_alias: str + :keyword contextual_service_endpoint_policies: A collection of contextual service endpoint + policy. + :paramtype contextual_service_endpoint_policies: list[str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.kind = None + self.service_endpoint_policy_definitions = service_endpoint_policy_definitions + self.subnets = None + self.resource_guid = None + self.provisioning_state = None + self.service_alias = service_alias + self.contextual_service_endpoint_policies = contextual_service_endpoint_policies + + +class ServiceEndpointPolicyDefinition(SubResource): + """Service Endpoint policy definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: The type of the resource. + :vartype type: str + :ivar description: A description for this rule. Restricted to 140 chars. + :vartype description: str + :ivar service: Service endpoint name. + :vartype service: str + :ivar service_resources: A list of service resources. + :vartype service_resources: list[str] + :ivar provisioning_state: The provisioning state of the service endpoint policy definition + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "service": {"key": "properties.service", "type": "str"}, + "service_resources": {"key": "properties.serviceResources", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + description: Optional[str] = None, + service: Optional[str] = None, + service_resources: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: The type of the resource. + :paramtype type: str + :keyword description: A description for this rule. Restricted to 140 chars. + :paramtype description: str + :keyword service: Service endpoint name. + :paramtype service: str + :keyword service_resources: A list of service resources. + :paramtype service_resources: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.description = description + self.service = service + self.service_resources = service_resources + self.provisioning_state = None + + +class ServiceEndpointPolicyDefinitionListResult(_serialization.Model): + """Response for ListServiceEndpointPolicyDefinition API service call. Retrieves all service + endpoint policy definition that belongs to a service endpoint policy. + + :ivar value: The service endpoint policy definition in a service endpoint policy. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceEndpointPolicyDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ServiceEndpointPolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The service endpoint policy definition in a service endpoint policy. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceEndpointPolicyListResult(_serialization.Model): + """Response for ListServiceEndpointPolicies API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of ServiceEndpointPolicy resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceEndpointPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ServiceEndpointPolicy"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of ServiceEndpointPolicy resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ServiceEndpointPropertiesFormat(_serialization.Model): + """The service endpoint properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service: The type of the endpoint service. + :vartype service: str + :ivar locations: A list of locations. + :vartype locations: list[str] + :ivar provisioning_state: The provisioning state of the service endpoint resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "service": {"key": "service", "type": "str"}, + "locations": {"key": "locations", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, service: Optional[str] = None, locations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword service: The type of the endpoint service. + :paramtype service: str + :keyword locations: A list of locations. + :paramtype locations: list[str] + """ + super().__init__(**kwargs) + self.service = service + self.locations = locations + self.provisioning_state = None + + +class ServiceTagInformation(_serialization.Model): + """The service tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: Properties of the service tag information. + :vartype properties: + ~azure.mgmt.network.v2023_09_01.models.ServiceTagInformationPropertiesFormat + :ivar name: The name of service tag. + :vartype name: str + :ivar id: The ID of service tag. + :vartype id: str + :ivar service_tag_change_number: The iteration number of service tag object for region. + :vartype service_tag_change_number: str + """ + + _validation = { + "properties": {"readonly": True}, + "name": {"readonly": True}, + "id": {"readonly": True}, + "service_tag_change_number": {"readonly": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "ServiceTagInformationPropertiesFormat"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "service_tag_change_number": {"key": "serviceTagChangeNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + self.name = None + self.id = None + self.service_tag_change_number = None + + +class ServiceTagInformationListResult(_serialization.Model): + """Response for Get ServiceTagInformation API service call. Retrieves the list of service tag + information resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of service tag information resources. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceTagInformation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceTagInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ServiceTagInformation"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of service tag information resources. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.ServiceTagInformation] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ServiceTagInformationPropertiesFormat(_serialization.Model): + """Properties of the service tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar change_number: The iteration number of service tag. + :vartype change_number: str + :ivar region: The region of service tag. + :vartype region: str + :ivar system_service: The name of system service. + :vartype system_service: str + :ivar address_prefixes: The list of IP address prefixes. + :vartype address_prefixes: list[str] + :ivar state: The state of the service tag. + :vartype state: str + """ + + _validation = { + "change_number": {"readonly": True}, + "region": {"readonly": True}, + "system_service": {"readonly": True}, + "address_prefixes": {"readonly": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "change_number": {"key": "changeNumber", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "system_service": {"key": "systemService", "type": "str"}, + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.change_number = None + self.region = None + self.system_service = None + self.address_prefixes = None + self.state = None + + +class ServiceTagsListResult(_serialization.Model): + """Response for the ListServiceTags API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the cloud. + :vartype name: str + :ivar id: The ID of the cloud. + :vartype id: str + :ivar type: The azure resource type. + :vartype type: str + :ivar change_number: The iteration number. + :vartype change_number: str + :ivar cloud: The name of the cloud. + :vartype cloud: str + :ivar values: The list of service tag information resources. + :vartype values: list[~azure.mgmt.network.v2023_09_01.models.ServiceTagInformation] + :ivar next_link: The URL to get next page of service tag information resources. + :vartype next_link: str + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + "change_number": {"readonly": True}, + "cloud": {"readonly": True}, + "values": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "change_number": {"key": "changeNumber", "type": "str"}, + "cloud": {"key": "cloud", "type": "str"}, + "values": {"key": "values", "type": "[ServiceTagInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.change_number = None + self.cloud = None + self.values = None + self.next_link = None + + +class SessionIds(_serialization.Model): + """List of session IDs. + + :ivar session_ids: List of session IDs. + :vartype session_ids: list[str] + """ + + _attribute_map = { + "session_ids": {"key": "sessionIds", "type": "[str]"}, + } + + def __init__(self, *, session_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword session_ids: List of session IDs. + :paramtype session_ids: list[str] + """ + super().__init__(**kwargs) + self.session_ids = session_ids + + +class SignatureOverridesFilterValuesQuery(_serialization.Model): + """Describes the filter values possibles for a given column. + + :ivar filter_name: Describes the name of the column which values will be returned. + :vartype filter_name: str + """ + + _attribute_map = { + "filter_name": {"key": "filterName", "type": "str"}, + } + + def __init__(self, *, filter_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword filter_name: Describes the name of the column which values will be returned. + :paramtype filter_name: str + """ + super().__init__(**kwargs) + self.filter_name = filter_name + + +class SignatureOverridesFilterValuesResponse(_serialization.Model): + """Describes the list of all possible values for a specific filter value. + + :ivar filter_values: Describes the possible values. + :vartype filter_values: list[str] + """ + + _attribute_map = { + "filter_values": {"key": "filterValues", "type": "[str]"}, + } + + def __init__(self, *, filter_values: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword filter_values: Describes the possible values. + :paramtype filter_values: list[str] + """ + super().__init__(**kwargs) + self.filter_values = filter_values + + +class SignaturesOverrides(_serialization.Model): + """Contains all specific policy signatures overrides for the IDPS. + + :ivar name: Contains the name of the resource (default). + :vartype name: str + :ivar id: Will contain the resource id of the signature override resource. + :vartype id: str + :ivar type: Will contain the type of the resource: + Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides. + :vartype type: str + :ivar properties: Will contain the properties of the resource (the actual signature overrides). + :vartype properties: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverridesProperties + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "SignaturesOverridesProperties"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + properties: Optional["_models.SignaturesOverridesProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Contains the name of the resource (default). + :paramtype name: str + :keyword id: Will contain the resource id of the signature override resource. + :paramtype id: str + :keyword type: Will contain the type of the resource: + Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides. + :paramtype type: str + :keyword properties: Will contain the properties of the resource (the actual signature + overrides). + :paramtype properties: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverridesProperties + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.properties = properties + + +class SignaturesOverridesList(_serialization.Model): + """Describes an object containing an array with a single item. + + :ivar value: Describes a list consisting exactly one item describing the policy's signature + override status. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SignaturesOverrides]"}, + } + + def __init__(self, *, value: Optional[List["_models.SignaturesOverrides"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Describes a list consisting exactly one item describing the policy's signature + override status. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides] + """ + super().__init__(**kwargs) + self.value = value + + +class SignaturesOverridesProperties(_serialization.Model): + """Will contain the properties of the resource (the actual signature overrides). + + :ivar signatures: Dictionary of :code:``. + :vartype signatures: dict[str, str] + """ + + _attribute_map = { + "signatures": {"key": "signatures", "type": "{str}"}, + } + + def __init__(self, *, signatures: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword signatures: Dictionary of :code:``. + :paramtype signatures: dict[str, str] + """ + super().__init__(**kwargs) + self.signatures = signatures + + +class SingleQueryResult(_serialization.Model): # pylint: disable=too-many-instance-attributes + """SingleQueryResult. + + :ivar signature_id: The ID of the signature. + :vartype signature_id: int + :ivar mode: The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny. Known values are: 0, + 1, and 2. + :vartype mode: int or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureMode + :ivar severity: Describes the severity of signature: 1 - High, 2 - Medium, 3 - Low. Known + values are: 1, 2, and 3. + :vartype severity: int or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureSeverity + :ivar direction: Describes in which direction signature is being enforced: 0 - OutBound, 1 - + InBound, 2 - Any, 3 - Internal, 4 - InternalOutbound. Known values are: 0, 1, 2, 3, and 4. + :vartype direction: int or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureDirection + :ivar group: Describes the groups the signature belongs to. + :vartype group: str + :ivar description: Describes what is the signature enforces. + :vartype description: str + :ivar protocol: Describes the protocol the signatures is being enforced in. + :vartype protocol: str + :ivar source_ports: Describes the list of source ports related to this signature. + :vartype source_ports: list[str] + :ivar destination_ports: Describes the list of destination ports related to this signature. + :vartype destination_ports: list[str] + :ivar last_updated: Describes the last updated time of the signature (provided from 3rd party + vendor). + :vartype last_updated: str + :ivar inherited_from_parent_policy: Describes if this override is inherited from base policy or + not. + :vartype inherited_from_parent_policy: bool + """ + + _attribute_map = { + "signature_id": {"key": "signatureId", "type": "int"}, + "mode": {"key": "mode", "type": "int"}, + "severity": {"key": "severity", "type": "int"}, + "direction": {"key": "direction", "type": "int"}, + "group": {"key": "group", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "source_ports": {"key": "sourcePorts", "type": "[str]"}, + "destination_ports": {"key": "destinationPorts", "type": "[str]"}, + "last_updated": {"key": "lastUpdated", "type": "str"}, + "inherited_from_parent_policy": {"key": "inheritedFromParentPolicy", "type": "bool"}, + } + + def __init__( + self, + *, + signature_id: Optional[int] = None, + mode: Optional[Union[int, "_models.FirewallPolicyIDPSSignatureMode"]] = None, + severity: Optional[Union[int, "_models.FirewallPolicyIDPSSignatureSeverity"]] = None, + direction: Optional[Union[int, "_models.FirewallPolicyIDPSSignatureDirection"]] = None, + group: Optional[str] = None, + description: Optional[str] = None, + protocol: Optional[str] = None, + source_ports: Optional[List[str]] = None, + destination_ports: Optional[List[str]] = None, + last_updated: Optional[str] = None, + inherited_from_parent_policy: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword signature_id: The ID of the signature. + :paramtype signature_id: int + :keyword mode: The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny. Known values are: + 0, 1, and 2. + :paramtype mode: int or ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureMode + :keyword severity: Describes the severity of signature: 1 - High, 2 - Medium, 3 - Low. Known + values are: 1, 2, and 3. + :paramtype severity: int or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureSeverity + :keyword direction: Describes in which direction signature is being enforced: 0 - OutBound, 1 - + InBound, 2 - Any, 3 - Internal, 4 - InternalOutbound. Known values are: 0, 1, 2, 3, and 4. + :paramtype direction: int or + ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyIDPSSignatureDirection + :keyword group: Describes the groups the signature belongs to. + :paramtype group: str + :keyword description: Describes what is the signature enforces. + :paramtype description: str + :keyword protocol: Describes the protocol the signatures is being enforced in. + :paramtype protocol: str + :keyword source_ports: Describes the list of source ports related to this signature. + :paramtype source_ports: list[str] + :keyword destination_ports: Describes the list of destination ports related to this signature. + :paramtype destination_ports: list[str] + :keyword last_updated: Describes the last updated time of the signature (provided from 3rd + party vendor). + :paramtype last_updated: str + :keyword inherited_from_parent_policy: Describes if this override is inherited from base policy + or not. + :paramtype inherited_from_parent_policy: bool + """ + super().__init__(**kwargs) + self.signature_id = signature_id + self.mode = mode + self.severity = severity + self.direction = direction + self.group = group + self.description = description + self.protocol = protocol + self.source_ports = source_ports + self.destination_ports = destination_ports + self.last_updated = last_updated + self.inherited_from_parent_policy = inherited_from_parent_policy + + +class Sku(_serialization.Model): + """The sku of this Bastion Host. + + :ivar name: The name of this Bastion Host. Known values are: "Basic", "Standard", and + "Developer". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.BastionHostSkuName + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Union[str, "_models.BastionHostSkuName"] = "Standard", **kwargs: Any) -> None: + """ + :keyword name: The name of this Bastion Host. Known values are: "Basic", "Standard", and + "Developer". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.BastionHostSkuName + """ + super().__init__(**kwargs) + self.name = name + + +class StaticMember(ChildResource): + """StaticMember Item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: The system metadata related to this resource. + :vartype system_data: ~azure.mgmt.network.v2023_09_01.models.SystemData + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar region: Resource region. + :vartype region: str + :ivar provisioning_state: The provisioning state of the scope assignment resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "region": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "resource_id": {"key": "properties.resourceId", "type": "str"}, + "region": {"key": "properties.region", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Resource Id. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.system_data = None + self.resource_id = resource_id + self.region = None + self.provisioning_state = None + + +class StaticMemberListResult(_serialization.Model): + """Result of the request to list StaticMember. It contains a list of groups and a URL link to get + the next set of results. + + :ivar value: Gets a page of StaticMember. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.StaticMember] + :ivar next_link: Gets the URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[StaticMember]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.StaticMember"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Gets a page of StaticMember. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.StaticMember] + :keyword next_link: Gets the URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class StaticRoute(_serialization.Model): + """List of all Static Routes. + + :ivar name: The name of the StaticRoute that is unique within a VnetRoute. + :vartype name: str + :ivar address_prefixes: List of all address prefixes. + :vartype address_prefixes: list[str] + :ivar next_hop_ip_address: The ip address of the next hop. + :vartype next_hop_ip_address: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "next_hop_ip_address": {"key": "nextHopIpAddress", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + address_prefixes: Optional[List[str]] = None, + next_hop_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the StaticRoute that is unique within a VnetRoute. + :paramtype name: str + :keyword address_prefixes: List of all address prefixes. + :paramtype address_prefixes: list[str] + :keyword next_hop_ip_address: The ip address of the next hop. + :paramtype next_hop_ip_address: str + """ + super().__init__(**kwargs) + self.name = name + self.address_prefixes = address_prefixes + self.next_hop_ip_address = next_hop_ip_address + + +class StaticRoutesConfig(_serialization.Model): + """Configuration for static routes on this HubVnetConnectionConfiguration for static routes on + this HubVnetConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar propagate_static_routes: Boolean indicating whether static routes on this connection are + automatically propagate to route tables which this connection propagates to. + :vartype propagate_static_routes: bool + :ivar vnet_local_route_override_criteria: Parameter determining whether NVA in spoke vnet is + bypassed for traffic with destination in spoke. Known values are: "Contains" and "Equal". + :vartype vnet_local_route_override_criteria: str or + ~azure.mgmt.network.v2023_09_01.models.VnetLocalRouteOverrideCriteria + """ + + _validation = { + "propagate_static_routes": {"readonly": True}, + } + + _attribute_map = { + "propagate_static_routes": {"key": "propagateStaticRoutes", "type": "bool"}, + "vnet_local_route_override_criteria": {"key": "vnetLocalRouteOverrideCriteria", "type": "str"}, + } + + def __init__( + self, + *, + vnet_local_route_override_criteria: Optional[Union[str, "_models.VnetLocalRouteOverrideCriteria"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vnet_local_route_override_criteria: Parameter determining whether NVA in spoke vnet is + bypassed for traffic with destination in spoke. Known values are: "Contains" and "Equal". + :paramtype vnet_local_route_override_criteria: str or + ~azure.mgmt.network.v2023_09_01.models.VnetLocalRouteOverrideCriteria + """ + super().__init__(**kwargs) + self.propagate_static_routes = None + self.vnet_local_route_override_criteria = vnet_local_route_override_criteria + + +class Subnet(SubResource): # pylint: disable=too-many-instance-attributes + """Subnet in a virtual network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar address_prefix: The address prefix for the subnet. + :vartype address_prefix: str + :ivar address_prefixes: List of address prefixes for the subnet. + :vartype address_prefixes: list[str] + :ivar network_security_group: The reference to the NetworkSecurityGroup resource. + :vartype network_security_group: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :ivar route_table: The reference to the RouteTable resource. + :vartype route_table: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :ivar nat_gateway: Nat gateway associated with this subnet. + :vartype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar service_endpoints: An array of service endpoints. + :vartype service_endpoints: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPropertiesFormat] + :ivar service_endpoint_policies: An array of service endpoint policies. + :vartype service_endpoint_policies: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :ivar private_endpoints: An array of references to private endpoints. + :vartype private_endpoints: list[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :ivar ip_configurations: An array of references to the network interface IP configurations + using subnet. + :vartype ip_configurations: list[~azure.mgmt.network.v2023_09_01.models.IPConfiguration] + :ivar ip_configuration_profiles: Array of IP configuration profiles which reference this + subnet. + :vartype ip_configuration_profiles: + list[~azure.mgmt.network.v2023_09_01.models.IPConfigurationProfile] + :ivar ip_allocations: Array of IpAllocation which reference this subnet. + :vartype ip_allocations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar resource_navigation_links: An array of references to the external resources using subnet. + :vartype resource_navigation_links: + list[~azure.mgmt.network.v2023_09_01.models.ResourceNavigationLink] + :ivar service_association_links: An array of references to services injecting into this subnet. + :vartype service_association_links: + list[~azure.mgmt.network.v2023_09_01.models.ServiceAssociationLink] + :ivar delegations: An array of references to the delegations on the subnet. + :vartype delegations: list[~azure.mgmt.network.v2023_09_01.models.Delegation] + :ivar purpose: A read-only string identifying the intention of use for this subnet based on + delegations and other user-defined properties. + :vartype purpose: str + :ivar provisioning_state: The provisioning state of the subnet resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private + end point in the subnet. Known values are: "Enabled", "Disabled", + "NetworkSecurityGroupEnabled", and "RouteTableEnabled". + :vartype private_endpoint_network_policies: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPrivateEndpointNetworkPolicies + :ivar private_link_service_network_policies: Enable or Disable apply network policies on + private link service in the subnet. Known values are: "Enabled" and "Disabled". + :vartype private_link_service_network_policies: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPrivateLinkServiceNetworkPolicies + :ivar application_gateway_ip_configurations: Application gateway IP configurations of virtual + network resource. + :vartype application_gateway_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayIPConfiguration] + :ivar default_outbound_access: Set this property to false to disable default outbound + connectivity for all VMs in the subnet. This property can only be set at the time of subnet + creation and cannot be updated for an existing subnet. + :vartype default_outbound_access: bool + """ + + _validation = { + "etag": {"readonly": True}, + "private_endpoints": {"readonly": True}, + "ip_configurations": {"readonly": True}, + "ip_configuration_profiles": {"readonly": True}, + "resource_navigation_links": {"readonly": True}, + "service_association_links": {"readonly": True}, + "purpose": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, + "network_security_group": {"key": "properties.networkSecurityGroup", "type": "NetworkSecurityGroup"}, + "route_table": {"key": "properties.routeTable", "type": "RouteTable"}, + "nat_gateway": {"key": "properties.natGateway", "type": "SubResource"}, + "service_endpoints": {"key": "properties.serviceEndpoints", "type": "[ServiceEndpointPropertiesFormat]"}, + "service_endpoint_policies": {"key": "properties.serviceEndpointPolicies", "type": "[ServiceEndpointPolicy]"}, + "private_endpoints": {"key": "properties.privateEndpoints", "type": "[PrivateEndpoint]"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[IPConfiguration]"}, + "ip_configuration_profiles": {"key": "properties.ipConfigurationProfiles", "type": "[IPConfigurationProfile]"}, + "ip_allocations": {"key": "properties.ipAllocations", "type": "[SubResource]"}, + "resource_navigation_links": {"key": "properties.resourceNavigationLinks", "type": "[ResourceNavigationLink]"}, + "service_association_links": {"key": "properties.serviceAssociationLinks", "type": "[ServiceAssociationLink]"}, + "delegations": {"key": "properties.delegations", "type": "[Delegation]"}, + "purpose": {"key": "properties.purpose", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint_network_policies": {"key": "properties.privateEndpointNetworkPolicies", "type": "str"}, + "private_link_service_network_policies": {"key": "properties.privateLinkServiceNetworkPolicies", "type": "str"}, + "application_gateway_ip_configurations": { + "key": "properties.applicationGatewayIPConfigurations", + "type": "[ApplicationGatewayIPConfiguration]", + }, + "default_outbound_access": {"key": "properties.defaultOutboundAccess", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + address_prefix: Optional[str] = None, + address_prefixes: Optional[List[str]] = None, + network_security_group: Optional["_models.NetworkSecurityGroup"] = None, + route_table: Optional["_models.RouteTable"] = None, + nat_gateway: Optional["_models.SubResource"] = None, + service_endpoints: Optional[List["_models.ServiceEndpointPropertiesFormat"]] = None, + service_endpoint_policies: Optional[List["_models.ServiceEndpointPolicy"]] = None, + ip_allocations: Optional[List["_models.SubResource"]] = None, + delegations: Optional[List["_models.Delegation"]] = None, + private_endpoint_network_policies: Union[ + str, "_models.VirtualNetworkPrivateEndpointNetworkPolicies" + ] = "Disabled", + private_link_service_network_policies: Union[ + str, "_models.VirtualNetworkPrivateLinkServiceNetworkPolicies" + ] = "Enabled", + application_gateway_ip_configurations: Optional[List["_models.ApplicationGatewayIPConfiguration"]] = None, + default_outbound_access: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: Resource type. + :paramtype type: str + :keyword address_prefix: The address prefix for the subnet. + :paramtype address_prefix: str + :keyword address_prefixes: List of address prefixes for the subnet. + :paramtype address_prefixes: list[str] + :keyword network_security_group: The reference to the NetworkSecurityGroup resource. + :paramtype network_security_group: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :keyword route_table: The reference to the RouteTable resource. + :paramtype route_table: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :keyword nat_gateway: Nat gateway associated with this subnet. + :paramtype nat_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword service_endpoints: An array of service endpoints. + :paramtype service_endpoints: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPropertiesFormat] + :keyword service_endpoint_policies: An array of service endpoint policies. + :paramtype service_endpoint_policies: + list[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :keyword ip_allocations: Array of IpAllocation which reference this subnet. + :paramtype ip_allocations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword delegations: An array of references to the delegations on the subnet. + :paramtype delegations: list[~azure.mgmt.network.v2023_09_01.models.Delegation] + :keyword private_endpoint_network_policies: Enable or Disable apply network policies on private + end point in the subnet. Known values are: "Enabled", "Disabled", + "NetworkSecurityGroupEnabled", and "RouteTableEnabled". + :paramtype private_endpoint_network_policies: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPrivateEndpointNetworkPolicies + :keyword private_link_service_network_policies: Enable or Disable apply network policies on + private link service in the subnet. Known values are: "Enabled" and "Disabled". + :paramtype private_link_service_network_policies: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPrivateLinkServiceNetworkPolicies + :keyword application_gateway_ip_configurations: Application gateway IP configurations of + virtual network resource. + :paramtype application_gateway_ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayIPConfiguration] + :keyword default_outbound_access: Set this property to false to disable default outbound + connectivity for all VMs in the subnet. This property can only be set at the time of subnet + creation and cannot be updated for an existing subnet. + :paramtype default_outbound_access: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.address_prefix = address_prefix + self.address_prefixes = address_prefixes + self.network_security_group = network_security_group + self.route_table = route_table + self.nat_gateway = nat_gateway + self.service_endpoints = service_endpoints + self.service_endpoint_policies = service_endpoint_policies + self.private_endpoints = None + self.ip_configurations = None + self.ip_configuration_profiles = None + self.ip_allocations = ip_allocations + self.resource_navigation_links = None + self.service_association_links = None + self.delegations = delegations + self.purpose = None + self.provisioning_state = None + self.private_endpoint_network_policies = private_endpoint_network_policies + self.private_link_service_network_policies = private_link_service_network_policies + self.application_gateway_ip_configurations = application_gateway_ip_configurations + self.default_outbound_access = default_outbound_access + + +class SubnetAssociation(_serialization.Model): + """Subnet and it's custom security rules. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Subnet ID. + :vartype id: str + :ivar security_rules: Collection of custom security rules. + :vartype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "security_rules": {"key": "securityRules", "type": "[SecurityRule]"}, + } + + def __init__(self, *, security_rules: Optional[List["_models.SecurityRule"]] = None, **kwargs: Any) -> None: + """ + :keyword security_rules: Collection of custom security rules. + :paramtype security_rules: list[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + """ + super().__init__(**kwargs) + self.id = None + self.security_rules = security_rules + + +class SubnetListResult(_serialization.Model): + """Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual + network. + + :ivar value: The subnets in a virtual network. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Subnet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Subnet"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The subnets in a virtual network. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SwapResource(_serialization.Model): + """SwapResource to represent slot type on the specified cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar properties: Swap resource properties. + :vartype properties: ~azure.mgmt.network.v2023_09_01.models.SwapResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "SwapResourceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SwapResourceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Swap resource properties. + :paramtype properties: ~azure.mgmt.network.v2023_09_01.models.SwapResourceProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class SwapResourceListResult(_serialization.Model): + """SwapResource List with single entry to represent slot type on the specified cloud service. + + :ivar value: + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.SwapResource] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SwapResource]"}, + } + + def __init__(self, *, value: Optional[List["_models.SwapResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.SwapResource] + """ + super().__init__(**kwargs) + self.value = value + + +class SwapResourceProperties(_serialization.Model): + """Swap resource properties. + + :ivar slot_type: Specifies slot info on a cloud service. Known values are: "Production" and + "Staging". + :vartype slot_type: str or ~azure.mgmt.network.v2023_09_01.models.SlotType + """ + + _attribute_map = { + "slot_type": {"key": "slotType", "type": "str"}, + } + + def __init__(self, *, slot_type: Optional[Union[str, "_models.SlotType"]] = None, **kwargs: Any) -> None: + """ + :keyword slot_type: Specifies slot info on a cloud service. Known values are: "Production" and + "Staging". + :paramtype slot_type: str or ~azure.mgmt.network.v2023_09_01.models.SlotType + """ + super().__init__(**kwargs) + self.slot_type = slot_type + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.network.v2023_09_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.network.v2023_09_01.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.network.v2023_09_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.network.v2023_09_01.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(_serialization.Model): + """Tags object for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _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 Topology(_serialization.Model): + """Topology of the specified resource group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: GUID representing the operation id. + :vartype id: str + :ivar created_date_time: The datetime when the topology was initially created for the resource + group. + :vartype created_date_time: ~datetime.datetime + :ivar last_modified: The datetime when the topology was last modified. + :vartype last_modified: ~datetime.datetime + :ivar resources: A list of topology resources. + :vartype resources: list[~azure.mgmt.network.v2023_09_01.models.TopologyResource] + """ + + _validation = { + "id": {"readonly": True}, + "created_date_time": {"readonly": True}, + "last_modified": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, + "last_modified": {"key": "lastModified", "type": "iso-8601"}, + "resources": {"key": "resources", "type": "[TopologyResource]"}, + } + + def __init__(self, *, resources: Optional[List["_models.TopologyResource"]] = None, **kwargs: Any) -> None: + """ + :keyword resources: A list of topology resources. + :paramtype resources: list[~azure.mgmt.network.v2023_09_01.models.TopologyResource] + """ + super().__init__(**kwargs) + self.id = None + self.created_date_time = None + self.last_modified = None + self.resources = resources + + +class TopologyAssociation(_serialization.Model): + """Resources that have an association with the parent resource. + + :ivar name: The name of the resource that is associated with the parent resource. + :vartype name: str + :ivar resource_id: The ID of the resource that is associated with the parent resource. + :vartype resource_id: str + :ivar association_type: The association type of the child resource to the parent resource. + Known values are: "Associated" and "Contains". + :vartype association_type: str or ~azure.mgmt.network.v2023_09_01.models.AssociationType + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "association_type": {"key": "associationType", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + resource_id: Optional[str] = None, + association_type: Optional[Union[str, "_models.AssociationType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the resource that is associated with the parent resource. + :paramtype name: str + :keyword resource_id: The ID of the resource that is associated with the parent resource. + :paramtype resource_id: str + :keyword association_type: The association type of the child resource to the parent resource. + Known values are: "Associated" and "Contains". + :paramtype association_type: str or ~azure.mgmt.network.v2023_09_01.models.AssociationType + """ + super().__init__(**kwargs) + self.name = name + self.resource_id = resource_id + self.association_type = association_type + + +class TopologyParameters(_serialization.Model): + """Parameters that define the representation of topology. + + :ivar target_resource_group_name: The name of the target resource group to perform topology on. + :vartype target_resource_group_name: str + :ivar target_virtual_network: The reference to the Virtual Network resource. + :vartype target_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar target_subnet: The reference to the Subnet resource. + :vartype target_subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + + _attribute_map = { + "target_resource_group_name": {"key": "targetResourceGroupName", "type": "str"}, + "target_virtual_network": {"key": "targetVirtualNetwork", "type": "SubResource"}, + "target_subnet": {"key": "targetSubnet", "type": "SubResource"}, + } + + def __init__( + self, + *, + target_resource_group_name: Optional[str] = None, + target_virtual_network: Optional["_models.SubResource"] = None, + target_subnet: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_resource_group_name: The name of the target resource group to perform topology + on. + :paramtype target_resource_group_name: str + :keyword target_virtual_network: The reference to the Virtual Network resource. + :paramtype target_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword target_subnet: The reference to the Subnet resource. + :paramtype target_subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(**kwargs) + self.target_resource_group_name = target_resource_group_name + self.target_virtual_network = target_virtual_network + self.target_subnet = target_subnet + + +class TopologyResource(_serialization.Model): + """The network resource topology information for the given resource group. + + :ivar name: Name of the resource. + :vartype name: str + :ivar id: ID of the resource. + :vartype id: str + :ivar location: Resource location. + :vartype location: str + :ivar associations: Holds the associations the resource has with other resources in the + resource group. + :vartype associations: list[~azure.mgmt.network.v2023_09_01.models.TopologyAssociation] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "associations": {"key": "associations", "type": "[TopologyAssociation]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + associations: Optional[List["_models.TopologyAssociation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource. + :paramtype name: str + :keyword id: ID of the resource. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword associations: Holds the associations the resource has with other resources in the + resource group. + :paramtype associations: list[~azure.mgmt.network.v2023_09_01.models.TopologyAssociation] + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.location = location + self.associations = associations + + +class TrafficAnalyticsConfigurationProperties(_serialization.Model): + """Parameters that define the configuration of traffic analytics. + + :ivar enabled: Flag to enable/disable traffic analytics. + :vartype enabled: bool + :ivar workspace_id: The resource guid of the attached workspace. + :vartype workspace_id: str + :ivar workspace_region: The location of the attached workspace. + :vartype workspace_region: str + :ivar workspace_resource_id: Resource Id of the attached workspace. + :vartype workspace_resource_id: str + :ivar traffic_analytics_interval: The interval in minutes which would decide how frequently TA + service should do flow analytics. + :vartype traffic_analytics_interval: int + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "workspace_region": {"key": "workspaceRegion", "type": "str"}, + "workspace_resource_id": {"key": "workspaceResourceId", "type": "str"}, + "traffic_analytics_interval": {"key": "trafficAnalyticsInterval", "type": "int"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + workspace_id: Optional[str] = None, + workspace_region: Optional[str] = None, + workspace_resource_id: Optional[str] = None, + traffic_analytics_interval: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Flag to enable/disable traffic analytics. + :paramtype enabled: bool + :keyword workspace_id: The resource guid of the attached workspace. + :paramtype workspace_id: str + :keyword workspace_region: The location of the attached workspace. + :paramtype workspace_region: str + :keyword workspace_resource_id: Resource Id of the attached workspace. + :paramtype workspace_resource_id: str + :keyword traffic_analytics_interval: The interval in minutes which would decide how frequently + TA service should do flow analytics. + :paramtype traffic_analytics_interval: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.workspace_id = workspace_id + self.workspace_region = workspace_region + self.workspace_resource_id = workspace_resource_id + self.traffic_analytics_interval = traffic_analytics_interval + + +class TrafficAnalyticsProperties(_serialization.Model): + """Parameters that define the configuration of traffic analytics. + + :ivar network_watcher_flow_analytics_configuration: Parameters that define the configuration of + traffic analytics. + :vartype network_watcher_flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsConfigurationProperties + """ + + _attribute_map = { + "network_watcher_flow_analytics_configuration": { + "key": "networkWatcherFlowAnalyticsConfiguration", + "type": "TrafficAnalyticsConfigurationProperties", + }, + } + + def __init__( + self, + *, + network_watcher_flow_analytics_configuration: Optional[ + "_models.TrafficAnalyticsConfigurationProperties" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword network_watcher_flow_analytics_configuration: Parameters that define the configuration + of traffic analytics. + :paramtype network_watcher_flow_analytics_configuration: + ~azure.mgmt.network.v2023_09_01.models.TrafficAnalyticsConfigurationProperties + """ + super().__init__(**kwargs) + self.network_watcher_flow_analytics_configuration = network_watcher_flow_analytics_configuration + + +class TrafficSelectorPolicy(_serialization.Model): + """An traffic selector policy for a virtual network gateway connection. + + All required parameters must be populated in order to send to Azure. + + :ivar local_address_ranges: A collection of local address spaces in CIDR format. Required. + :vartype local_address_ranges: list[str] + :ivar remote_address_ranges: A collection of remote address spaces in CIDR format. Required. + :vartype remote_address_ranges: list[str] + """ + + _validation = { + "local_address_ranges": {"required": True}, + "remote_address_ranges": {"required": True}, + } + + _attribute_map = { + "local_address_ranges": {"key": "localAddressRanges", "type": "[str]"}, + "remote_address_ranges": {"key": "remoteAddressRanges", "type": "[str]"}, + } + + def __init__(self, *, local_address_ranges: List[str], remote_address_ranges: List[str], **kwargs: Any) -> None: + """ + :keyword local_address_ranges: A collection of local address spaces in CIDR format. Required. + :paramtype local_address_ranges: list[str] + :keyword remote_address_ranges: A collection of remote address spaces in CIDR format. Required. + :paramtype remote_address_ranges: list[str] + """ + super().__init__(**kwargs) + self.local_address_ranges = local_address_ranges + self.remote_address_ranges = remote_address_ranges + + +class TroubleshootingDetails(_serialization.Model): + """Information gained from troubleshooting of specified resource. + + :ivar id: The id of the get troubleshoot operation. + :vartype id: str + :ivar reason_type: Reason type of failure. + :vartype reason_type: str + :ivar summary: A summary of troubleshooting. + :vartype summary: str + :ivar detail: Details on troubleshooting results. + :vartype detail: str + :ivar recommended_actions: List of recommended actions. + :vartype recommended_actions: + list[~azure.mgmt.network.v2023_09_01.models.TroubleshootingRecommendedActions] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "reason_type": {"key": "reasonType", "type": "str"}, + "summary": {"key": "summary", "type": "str"}, + "detail": {"key": "detail", "type": "str"}, + "recommended_actions": {"key": "recommendedActions", "type": "[TroubleshootingRecommendedActions]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + reason_type: Optional[str] = None, + summary: Optional[str] = None, + detail: Optional[str] = None, + recommended_actions: Optional[List["_models.TroubleshootingRecommendedActions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The id of the get troubleshoot operation. + :paramtype id: str + :keyword reason_type: Reason type of failure. + :paramtype reason_type: str + :keyword summary: A summary of troubleshooting. + :paramtype summary: str + :keyword detail: Details on troubleshooting results. + :paramtype detail: str + :keyword recommended_actions: List of recommended actions. + :paramtype recommended_actions: + list[~azure.mgmt.network.v2023_09_01.models.TroubleshootingRecommendedActions] + """ + super().__init__(**kwargs) + self.id = id + self.reason_type = reason_type + self.summary = summary + self.detail = detail + self.recommended_actions = recommended_actions + + +class TroubleshootingParameters(_serialization.Model): + """Parameters that define the resource to troubleshoot. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The target resource to troubleshoot. Required. + :vartype target_resource_id: str + :ivar storage_id: The ID for the storage account to save the troubleshoot result. Required. + :vartype storage_id: str + :ivar storage_path: The path to the blob to save the troubleshoot result in. Required. + :vartype storage_path: str + """ + + _validation = { + "target_resource_id": {"required": True}, + "storage_id": {"required": True}, + "storage_path": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "storage_id": {"key": "properties.storageId", "type": "str"}, + "storage_path": {"key": "properties.storagePath", "type": "str"}, + } + + def __init__(self, *, target_resource_id: str, storage_id: str, storage_path: str, **kwargs: Any) -> None: + """ + :keyword target_resource_id: The target resource to troubleshoot. Required. + :paramtype target_resource_id: str + :keyword storage_id: The ID for the storage account to save the troubleshoot result. Required. + :paramtype storage_id: str + :keyword storage_path: The path to the blob to save the troubleshoot result in. Required. + :paramtype storage_path: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + self.storage_id = storage_id + self.storage_path = storage_path + + +class TroubleshootingRecommendedActions(_serialization.Model): + """Recommended actions based on discovered issues. + + :ivar action_id: ID of the recommended action. + :vartype action_id: str + :ivar action_text: Description of recommended actions. + :vartype action_text: str + :ivar action_uri: The uri linking to a documentation for the recommended troubleshooting + actions. + :vartype action_uri: str + :ivar action_uri_text: The information from the URI for the recommended troubleshooting + actions. + :vartype action_uri_text: str + """ + + _attribute_map = { + "action_id": {"key": "actionId", "type": "str"}, + "action_text": {"key": "actionText", "type": "str"}, + "action_uri": {"key": "actionUri", "type": "str"}, + "action_uri_text": {"key": "actionUriText", "type": "str"}, + } + + def __init__( + self, + *, + action_id: Optional[str] = None, + action_text: Optional[str] = None, + action_uri: Optional[str] = None, + action_uri_text: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword action_id: ID of the recommended action. + :paramtype action_id: str + :keyword action_text: Description of recommended actions. + :paramtype action_text: str + :keyword action_uri: The uri linking to a documentation for the recommended troubleshooting + actions. + :paramtype action_uri: str + :keyword action_uri_text: The information from the URI for the recommended troubleshooting + actions. + :paramtype action_uri_text: str + """ + super().__init__(**kwargs) + self.action_id = action_id + self.action_text = action_text + self.action_uri = action_uri + self.action_uri_text = action_uri_text + + +class TroubleshootingResult(_serialization.Model): + """Troubleshooting information gained from specified resource. + + :ivar start_time: The start time of the troubleshooting. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the troubleshooting. + :vartype end_time: ~datetime.datetime + :ivar code: The result code of the troubleshooting. + :vartype code: str + :ivar results: Information from troubleshooting. + :vartype results: list[~azure.mgmt.network.v2023_09_01.models.TroubleshootingDetails] + """ + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "code": {"key": "code", "type": "str"}, + "results": {"key": "results", "type": "[TroubleshootingDetails]"}, + } + + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + code: Optional[str] = None, + results: Optional[List["_models.TroubleshootingDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword start_time: The start time of the troubleshooting. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the troubleshooting. + :paramtype end_time: ~datetime.datetime + :keyword code: The result code of the troubleshooting. + :paramtype code: str + :keyword results: Information from troubleshooting. + :paramtype results: list[~azure.mgmt.network.v2023_09_01.models.TroubleshootingDetails] + """ + super().__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.code = code + self.results = results + + +class TunnelConnectionHealth(_serialization.Model): + """VirtualNetworkGatewayConnection properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tunnel: Tunnel name. + :vartype tunnel: str + :ivar connection_status: Virtual Network Gateway connection status. Known values are: + "Unknown", "Connecting", "Connected", and "NotConnected". + :vartype connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionStatus + :ivar ingress_bytes_transferred: The Ingress Bytes Transferred in this connection. + :vartype ingress_bytes_transferred: int + :ivar egress_bytes_transferred: The Egress Bytes Transferred in this connection. + :vartype egress_bytes_transferred: int + :ivar last_connection_established_utc_time: The time at which connection was established in Utc + format. + :vartype last_connection_established_utc_time: str + """ + + _validation = { + "tunnel": {"readonly": True}, + "connection_status": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "last_connection_established_utc_time": {"readonly": True}, + } + + _attribute_map = { + "tunnel": {"key": "tunnel", "type": "str"}, + "connection_status": {"key": "connectionStatus", "type": "str"}, + "ingress_bytes_transferred": {"key": "ingressBytesTransferred", "type": "int"}, + "egress_bytes_transferred": {"key": "egressBytesTransferred", "type": "int"}, + "last_connection_established_utc_time": {"key": "lastConnectionEstablishedUtcTime", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tunnel = None + self.connection_status = None + self.ingress_bytes_transferred = None + self.egress_bytes_transferred = None + self.last_connection_established_utc_time = None + + +class UnprepareNetworkPoliciesRequest(_serialization.Model): + """Details of UnprepareNetworkPolicies for Subnet. + + :ivar service_name: The name of the service for which subnet is being unprepared for. + :vartype service_name: str + """ + + _attribute_map = { + "service_name": {"key": "serviceName", "type": "str"}, + } + + def __init__(self, *, service_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword service_name: The name of the service for which subnet is being unprepared for. + :paramtype service_name: str + """ + super().__init__(**kwargs) + self.service_name = service_name + + +class Usage(_serialization.Model): + """The network resource usage. + + 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: Resource identifier. + :vartype id: str + :ivar unit: An enum describing the unit of measurement. Required. "Count" + :vartype unit: str or ~azure.mgmt.network.v2023_09_01.models.UsageUnit + :ivar current_value: The current value of the usage. Required. + :vartype current_value: int + :ivar limit: The limit of usage. Required. + :vartype limit: int + :ivar name: The name of the type of usage. Required. + :vartype name: ~azure.mgmt.network.v2023_09_01.models.UsageName + """ + + _validation = { + "id": {"readonly": True}, + "unit": {"required": True}, + "current_value": {"required": True}, + "limit": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "UsageName"}, + } + + def __init__( + self, + *, + unit: Union[str, "_models.UsageUnit"], + current_value: int, + limit: int, + name: "_models.UsageName", + **kwargs: Any + ) -> None: + """ + :keyword unit: An enum describing the unit of measurement. Required. "Count" + :paramtype unit: str or ~azure.mgmt.network.v2023_09_01.models.UsageUnit + :keyword current_value: The current value of the usage. Required. + :paramtype current_value: int + :keyword limit: The limit of usage. Required. + :paramtype limit: int + :keyword name: The name of the type of usage. Required. + :paramtype name: ~azure.mgmt.network.v2023_09_01.models.UsageName + """ + super().__init__(**kwargs) + self.id = None + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = name + + +class UsageName(_serialization.Model): + """The usage names. + + :ivar value: A string describing the resource name. + :vartype value: str + :ivar localized_value: A localized string describing the resource name. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: A string describing the resource name. + :paramtype value: str + :keyword localized_value: A localized string describing the resource name. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class UsagesListResult(_serialization.Model): + """The list usages operation response. + + :ivar value: The list network resource usages. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.Usage] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list network resource usages. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.Usage] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VerificationIPFlowParameters(_serialization.Model): + """Parameters that define the IP flow to be verified. + + All required parameters must be populated in order to send to Azure. + + :ivar target_resource_id: The ID of the target resource to perform next-hop on. Required. + :vartype target_resource_id: str + :ivar direction: The direction of the packet represented as a 5-tuple. Required. Known values + are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.network.v2023_09_01.models.Direction + :ivar protocol: Protocol to be verified on. Required. Known values are: "TCP" and "UDP". + :vartype protocol: str or ~azure.mgmt.network.v2023_09_01.models.IpFlowProtocol + :ivar local_port: The local port. Acceptable values are a single integer in the range + (0-65535). Support for * for the source port, which depends on the direction. Required. + :vartype local_port: str + :ivar remote_port: The remote port. Acceptable values are a single integer in the range + (0-65535). Support for * for the source port, which depends on the direction. Required. + :vartype remote_port: str + :ivar local_ip_address: The local IP address. Acceptable values are valid IPv4 addresses. + Required. + :vartype local_ip_address: str + :ivar remote_ip_address: The remote IP address. Acceptable values are valid IPv4 addresses. + Required. + :vartype remote_ip_address: str + :ivar target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is enabled + on any of them, then this parameter must be specified. Otherwise optional). + :vartype target_nic_resource_id: str + """ + + _validation = { + "target_resource_id": {"required": True}, + "direction": {"required": True}, + "protocol": {"required": True}, + "local_port": {"required": True}, + "remote_port": {"required": True}, + "local_ip_address": {"required": True}, + "remote_ip_address": {"required": True}, + } + + _attribute_map = { + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "direction": {"key": "direction", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "local_port": {"key": "localPort", "type": "str"}, + "remote_port": {"key": "remotePort", "type": "str"}, + "local_ip_address": {"key": "localIPAddress", "type": "str"}, + "remote_ip_address": {"key": "remoteIPAddress", "type": "str"}, + "target_nic_resource_id": {"key": "targetNicResourceId", "type": "str"}, + } + + def __init__( + self, + *, + target_resource_id: str, + direction: Union[str, "_models.Direction"], + protocol: Union[str, "_models.IpFlowProtocol"], + local_port: str, + remote_port: str, + local_ip_address: str, + remote_ip_address: str, + target_nic_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_resource_id: The ID of the target resource to perform next-hop on. Required. + :paramtype target_resource_id: str + :keyword direction: The direction of the packet represented as a 5-tuple. Required. Known + values are: "Inbound" and "Outbound". + :paramtype direction: str or ~azure.mgmt.network.v2023_09_01.models.Direction + :keyword protocol: Protocol to be verified on. Required. Known values are: "TCP" and "UDP". + :paramtype protocol: str or ~azure.mgmt.network.v2023_09_01.models.IpFlowProtocol + :keyword local_port: The local port. Acceptable values are a single integer in the range + (0-65535). Support for * for the source port, which depends on the direction. Required. + :paramtype local_port: str + :keyword remote_port: The remote port. Acceptable values are a single integer in the range + (0-65535). Support for * for the source port, which depends on the direction. Required. + :paramtype remote_port: str + :keyword local_ip_address: The local IP address. Acceptable values are valid IPv4 addresses. + Required. + :paramtype local_ip_address: str + :keyword remote_ip_address: The remote IP address. Acceptable values are valid IPv4 addresses. + Required. + :paramtype remote_ip_address: str + :keyword target_nic_resource_id: The NIC ID. (If VM has multiple NICs and IP forwarding is + enabled on any of them, then this parameter must be specified. Otherwise optional). + :paramtype target_nic_resource_id: str + """ + super().__init__(**kwargs) + self.target_resource_id = target_resource_id + self.direction = direction + self.protocol = protocol + self.local_port = local_port + self.remote_port = remote_port + self.local_ip_address = local_ip_address + self.remote_ip_address = remote_ip_address + self.target_nic_resource_id = target_nic_resource_id + + +class VerificationIPFlowResult(_serialization.Model): + """Results of IP flow verification on the target resource. + + :ivar access: Indicates whether the traffic is allowed or denied. Known values are: "Allow" and + "Deny". + :vartype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :ivar rule_name: Name of the rule. If input is not matched against any security rule, it is not + displayed. + :vartype rule_name: str + """ + + _attribute_map = { + "access": {"key": "access", "type": "str"}, + "rule_name": {"key": "ruleName", "type": "str"}, + } + + def __init__( + self, *, access: Optional[Union[str, "_models.Access"]] = None, rule_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword access: Indicates whether the traffic is allowed or denied. Known values are: "Allow" + and "Deny". + :paramtype access: str or ~azure.mgmt.network.v2023_09_01.models.Access + :keyword rule_name: Name of the rule. If input is not matched against any security rule, it is + not displayed. + :paramtype rule_name: str + """ + super().__init__(**kwargs) + self.access = access + self.rule_name = rule_name + + +class VirtualApplianceAdditionalNicProperties(_serialization.Model): + """Network Virtual Appliance Additional NIC properties. + + :ivar name: Name of additional nic. + :vartype name: str + :ivar has_public_ip: Flag (true or false) for Intent for Public Ip on additional nic. + :vartype has_public_ip: bool + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "has_public_ip": {"key": "hasPublicIp", "type": "bool"}, + } + + def __init__(self, *, name: Optional[str] = None, has_public_ip: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of additional nic. + :paramtype name: str + :keyword has_public_ip: Flag (true or false) for Intent for Public Ip on additional nic. + :paramtype has_public_ip: bool + """ + super().__init__(**kwargs) + self.name = name + self.has_public_ip = has_public_ip + + +class VirtualApplianceNicProperties(_serialization.Model): + """Network Virtual Appliance NIC properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: NIC name. + :vartype name: str + :ivar public_ip_address: Public IP address. + :vartype public_ip_address: str + :ivar private_ip_address: Private IP address. + :vartype private_ip_address: str + :ivar instance_name: Instance on which nic is attached. + :vartype instance_name: str + """ + + _validation = { + "name": {"readonly": True}, + "public_ip_address": {"readonly": True}, + "private_ip_address": {"readonly": True}, + "instance_name": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "privateIpAddress", "type": "str"}, + "instance_name": {"key": "instanceName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.public_ip_address = None + self.private_ip_address = None + self.instance_name = None + + +class VirtualApplianceSite(SubResource): + """Virtual Appliance Site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the virtual appliance site. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Site type. + :vartype type: str + :ivar address_prefix: Address Prefix. + :vartype address_prefix: str + :ivar o365_policy: Office 365 Policy. + :vartype o365_policy: ~azure.mgmt.network.v2023_09_01.models.Office365PolicyProperties + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "o365_policy": {"key": "properties.o365Policy", "type": "Office365PolicyProperties"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + address_prefix: Optional[str] = None, + o365_policy: Optional["_models.Office365PolicyProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the virtual appliance site. + :paramtype name: str + :keyword address_prefix: Address Prefix. + :paramtype address_prefix: str + :keyword o365_policy: Office 365 Policy. + :paramtype o365_policy: ~azure.mgmt.network.v2023_09_01.models.Office365PolicyProperties + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.address_prefix = address_prefix + self.o365_policy = o365_policy + self.provisioning_state = None + + +class VirtualApplianceSkuProperties(_serialization.Model): + """Network Virtual Appliance Sku Properties. + + :ivar vendor: Virtual Appliance Vendor. + :vartype vendor: str + :ivar bundled_scale_unit: Virtual Appliance Scale Unit. + :vartype bundled_scale_unit: str + :ivar market_place_version: Virtual Appliance Version. + :vartype market_place_version: str + """ + + _attribute_map = { + "vendor": {"key": "vendor", "type": "str"}, + "bundled_scale_unit": {"key": "bundledScaleUnit", "type": "str"}, + "market_place_version": {"key": "marketPlaceVersion", "type": "str"}, + } + + def __init__( + self, + *, + vendor: Optional[str] = None, + bundled_scale_unit: Optional[str] = None, + market_place_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword vendor: Virtual Appliance Vendor. + :paramtype vendor: str + :keyword bundled_scale_unit: Virtual Appliance Scale Unit. + :paramtype bundled_scale_unit: str + :keyword market_place_version: Virtual Appliance Version. + :paramtype market_place_version: str + """ + super().__init__(**kwargs) + self.vendor = vendor + self.bundled_scale_unit = bundled_scale_unit + self.market_place_version = market_place_version + + +class VirtualHub(Resource): # pylint: disable=too-many-instance-attributes + """VirtualHub Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar kind: Kind of service virtual hub. This is metadata used for the Azure portal experience + for Route Server. + :vartype kind: str + :ivar virtual_wan: The VirtualWAN to which the VirtualHub belongs. + :vartype virtual_wan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar vpn_gateway: The VpnGateway associated with this VirtualHub. + :vartype vpn_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar p2_s_vpn_gateway: The P2SVpnGateway associated with this VirtualHub. + :vartype p2_s_vpn_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar express_route_gateway: The expressRouteGateway associated with this VirtualHub. + :vartype express_route_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar azure_firewall: The azureFirewall associated with this VirtualHub. + :vartype azure_firewall: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar security_partner_provider: The securityPartnerProvider associated with this VirtualHub. + :vartype security_partner_provider: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar address_prefix: Address-prefix for this VirtualHub. + :vartype address_prefix: str + :ivar route_table: The routeTable associated with this virtual hub. + :vartype route_table: ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTable + :ivar provisioning_state: The provisioning state of the virtual hub resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar security_provider_name: The Security Provider name. + :vartype security_provider_name: str + :ivar virtual_hub_route_table_v2_s: List of all virtual hub route table v2s associated with + this VirtualHub. + :vartype virtual_hub_route_table_v2_s: + list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :ivar sku: The sku of this VirtualHub. + :vartype sku: str + :ivar routing_state: The routing state. Known values are: "None", "Provisioned", + "Provisioning", and "Failed". + :vartype routing_state: str or ~azure.mgmt.network.v2023_09_01.models.RoutingState + :ivar bgp_connections: List of references to Bgp Connections. + :vartype bgp_connections: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar ip_configurations: List of references to IpConfigurations. + :vartype ip_configurations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar route_maps: List of references to RouteMaps. + :vartype route_maps: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar virtual_router_asn: VirtualRouter ASN. + :vartype virtual_router_asn: int + :ivar virtual_router_ips: VirtualRouter IPs. + :vartype virtual_router_ips: list[str] + :ivar allow_branch_to_branch_traffic: Flag to control transit for VirtualRouter hub. + :vartype allow_branch_to_branch_traffic: bool + :ivar preferred_routing_gateway: The preferred gateway to route on-prem traffic. Known values + are: "ExpressRoute", "VpnGateway", and "None". + :vartype preferred_routing_gateway: str or + ~azure.mgmt.network.v2023_09_01.models.PreferredRoutingGateway + :ivar hub_routing_preference: The hubRoutingPreference of this VirtualHub. Known values are: + "ExpressRoute", "VpnGateway", and "ASPath". + :vartype hub_routing_preference: str or + ~azure.mgmt.network.v2023_09_01.models.HubRoutingPreference + :ivar virtual_router_auto_scale_configuration: The VirtualHub Router autoscale configuration. + :vartype virtual_router_auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.VirtualRouterAutoScaleConfiguration + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "routing_state": {"readonly": True}, + "bgp_connections": {"readonly": True}, + "ip_configurations": {"readonly": True}, + "route_maps": {"readonly": True}, + "virtual_router_asn": {"maximum": 4294967295, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "virtual_wan": {"key": "properties.virtualWan", "type": "SubResource"}, + "vpn_gateway": {"key": "properties.vpnGateway", "type": "SubResource"}, + "p2_s_vpn_gateway": {"key": "properties.p2SVpnGateway", "type": "SubResource"}, + "express_route_gateway": {"key": "properties.expressRouteGateway", "type": "SubResource"}, + "azure_firewall": {"key": "properties.azureFirewall", "type": "SubResource"}, + "security_partner_provider": {"key": "properties.securityPartnerProvider", "type": "SubResource"}, + "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, + "route_table": {"key": "properties.routeTable", "type": "VirtualHubRouteTable"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "security_provider_name": {"key": "properties.securityProviderName", "type": "str"}, + "virtual_hub_route_table_v2_s": { + "key": "properties.virtualHubRouteTableV2s", + "type": "[VirtualHubRouteTableV2]", + }, + "sku": {"key": "properties.sku", "type": "str"}, + "routing_state": {"key": "properties.routingState", "type": "str"}, + "bgp_connections": {"key": "properties.bgpConnections", "type": "[SubResource]"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[SubResource]"}, + "route_maps": {"key": "properties.routeMaps", "type": "[SubResource]"}, + "virtual_router_asn": {"key": "properties.virtualRouterAsn", "type": "int"}, + "virtual_router_ips": {"key": "properties.virtualRouterIps", "type": "[str]"}, + "allow_branch_to_branch_traffic": {"key": "properties.allowBranchToBranchTraffic", "type": "bool"}, + "preferred_routing_gateway": {"key": "properties.preferredRoutingGateway", "type": "str"}, + "hub_routing_preference": {"key": "properties.hubRoutingPreference", "type": "str"}, + "virtual_router_auto_scale_configuration": { + "key": "properties.virtualRouterAutoScaleConfiguration", + "type": "VirtualRouterAutoScaleConfiguration", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + virtual_wan: Optional["_models.SubResource"] = None, + vpn_gateway: Optional["_models.SubResource"] = None, + p2_s_vpn_gateway: Optional["_models.SubResource"] = None, + express_route_gateway: Optional["_models.SubResource"] = None, + azure_firewall: Optional["_models.SubResource"] = None, + security_partner_provider: Optional["_models.SubResource"] = None, + address_prefix: Optional[str] = None, + route_table: Optional["_models.VirtualHubRouteTable"] = None, + security_provider_name: Optional[str] = None, + virtual_hub_route_table_v2_s: Optional[List["_models.VirtualHubRouteTableV2"]] = None, + sku: Optional[str] = None, + virtual_router_asn: Optional[int] = None, + virtual_router_ips: Optional[List[str]] = None, + allow_branch_to_branch_traffic: Optional[bool] = None, + preferred_routing_gateway: Optional[Union[str, "_models.PreferredRoutingGateway"]] = None, + hub_routing_preference: Optional[Union[str, "_models.HubRoutingPreference"]] = None, + virtual_router_auto_scale_configuration: Optional["_models.VirtualRouterAutoScaleConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword virtual_wan: The VirtualWAN to which the VirtualHub belongs. + :paramtype virtual_wan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword vpn_gateway: The VpnGateway associated with this VirtualHub. + :paramtype vpn_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword p2_s_vpn_gateway: The P2SVpnGateway associated with this VirtualHub. + :paramtype p2_s_vpn_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword express_route_gateway: The expressRouteGateway associated with this VirtualHub. + :paramtype express_route_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword azure_firewall: The azureFirewall associated with this VirtualHub. + :paramtype azure_firewall: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword security_partner_provider: The securityPartnerProvider associated with this + VirtualHub. + :paramtype security_partner_provider: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword address_prefix: Address-prefix for this VirtualHub. + :paramtype address_prefix: str + :keyword route_table: The routeTable associated with this virtual hub. + :paramtype route_table: ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTable + :keyword security_provider_name: The Security Provider name. + :paramtype security_provider_name: str + :keyword virtual_hub_route_table_v2_s: List of all virtual hub route table v2s associated with + this VirtualHub. + :paramtype virtual_hub_route_table_v2_s: + list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :keyword sku: The sku of this VirtualHub. + :paramtype sku: str + :keyword virtual_router_asn: VirtualRouter ASN. + :paramtype virtual_router_asn: int + :keyword virtual_router_ips: VirtualRouter IPs. + :paramtype virtual_router_ips: list[str] + :keyword allow_branch_to_branch_traffic: Flag to control transit for VirtualRouter hub. + :paramtype allow_branch_to_branch_traffic: bool + :keyword preferred_routing_gateway: The preferred gateway to route on-prem traffic. Known + values are: "ExpressRoute", "VpnGateway", and "None". + :paramtype preferred_routing_gateway: str or + ~azure.mgmt.network.v2023_09_01.models.PreferredRoutingGateway + :keyword hub_routing_preference: The hubRoutingPreference of this VirtualHub. Known values are: + "ExpressRoute", "VpnGateway", and "ASPath". + :paramtype hub_routing_preference: str or + ~azure.mgmt.network.v2023_09_01.models.HubRoutingPreference + :keyword virtual_router_auto_scale_configuration: The VirtualHub Router autoscale + configuration. + :paramtype virtual_router_auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.VirtualRouterAutoScaleConfiguration + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.kind = None + self.virtual_wan = virtual_wan + self.vpn_gateway = vpn_gateway + self.p2_s_vpn_gateway = p2_s_vpn_gateway + self.express_route_gateway = express_route_gateway + self.azure_firewall = azure_firewall + self.security_partner_provider = security_partner_provider + self.address_prefix = address_prefix + self.route_table = route_table + self.provisioning_state = None + self.security_provider_name = security_provider_name + self.virtual_hub_route_table_v2_s = virtual_hub_route_table_v2_s + self.sku = sku + self.routing_state = None + self.bgp_connections = None + self.ip_configurations = None + self.route_maps = None + self.virtual_router_asn = virtual_router_asn + self.virtual_router_ips = virtual_router_ips + self.allow_branch_to_branch_traffic = allow_branch_to_branch_traffic + self.preferred_routing_gateway = preferred_routing_gateway + self.hub_routing_preference = hub_routing_preference + self.virtual_router_auto_scale_configuration = virtual_router_auto_scale_configuration + + +class VirtualHubEffectiveRoute(_serialization.Model): + """The effective route configured on the virtual hub or specified resource. + + :ivar address_prefixes: The list of address prefixes. + :vartype address_prefixes: list[str] + :ivar next_hops: The list of next hops. + :vartype next_hops: list[str] + :ivar next_hop_type: The type of the next hop. + :vartype next_hop_type: str + :ivar as_path: The ASPath of this route. + :vartype as_path: str + :ivar route_origin: The origin of this route. + :vartype route_origin: str + """ + + _attribute_map = { + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "next_hops": {"key": "nextHops", "type": "[str]"}, + "next_hop_type": {"key": "nextHopType", "type": "str"}, + "as_path": {"key": "asPath", "type": "str"}, + "route_origin": {"key": "routeOrigin", "type": "str"}, + } + + def __init__( + self, + *, + address_prefixes: Optional[List[str]] = None, + next_hops: Optional[List[str]] = None, + next_hop_type: Optional[str] = None, + as_path: Optional[str] = None, + route_origin: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword address_prefixes: The list of address prefixes. + :paramtype address_prefixes: list[str] + :keyword next_hops: The list of next hops. + :paramtype next_hops: list[str] + :keyword next_hop_type: The type of the next hop. + :paramtype next_hop_type: str + :keyword as_path: The ASPath of this route. + :paramtype as_path: str + :keyword route_origin: The origin of this route. + :paramtype route_origin: str + """ + super().__init__(**kwargs) + self.address_prefixes = address_prefixes + self.next_hops = next_hops + self.next_hop_type = next_hop_type + self.as_path = as_path + self.route_origin = route_origin + + +class VirtualHubEffectiveRouteList(_serialization.Model): + """EffectiveRoutes List. + + :ivar value: The list of effective routes configured on the virtual hub or the specified + resource. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRoute] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualHubEffectiveRoute]"}, + } + + def __init__(self, *, value: Optional[List["_models.VirtualHubEffectiveRoute"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of effective routes configured on the virtual hub or the specified + resource. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRoute] + """ + super().__init__(**kwargs) + self.value = value + + +class VirtualHubId(_serialization.Model): + """Virtual Hub identifier. + + :ivar id: The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be + deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same + subscription. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be + deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same + subscription. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class VirtualHubRoute(_serialization.Model): + """VirtualHub route. + + :ivar address_prefixes: List of all addressPrefixes. + :vartype address_prefixes: list[str] + :ivar next_hop_ip_address: NextHop ip address. + :vartype next_hop_ip_address: str + """ + + _attribute_map = { + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "next_hop_ip_address": {"key": "nextHopIpAddress", "type": "str"}, + } + + def __init__( + self, *, address_prefixes: Optional[List[str]] = None, next_hop_ip_address: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword address_prefixes: List of all addressPrefixes. + :paramtype address_prefixes: list[str] + :keyword next_hop_ip_address: NextHop ip address. + :paramtype next_hop_ip_address: str + """ + super().__init__(**kwargs) + self.address_prefixes = address_prefixes + self.next_hop_ip_address = next_hop_ip_address + + +class VirtualHubRouteTable(_serialization.Model): + """VirtualHub route table. + + :ivar routes: List of all routes. + :vartype routes: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRoute] + """ + + _attribute_map = { + "routes": {"key": "routes", "type": "[VirtualHubRoute]"}, + } + + def __init__(self, *, routes: Optional[List["_models.VirtualHubRoute"]] = None, **kwargs: Any) -> None: + """ + :keyword routes: List of all routes. + :paramtype routes: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRoute] + """ + super().__init__(**kwargs) + self.routes = routes + + +class VirtualHubRouteTableV2(SubResource): + """VirtualHubRouteTableV2 Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar routes: List of all routes. + :vartype routes: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteV2] + :ivar attached_connections: List of all connections attached to this route table v2. + :vartype attached_connections: list[str] + :ivar provisioning_state: The provisioning state of the virtual hub route table v2 resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "routes": {"key": "properties.routes", "type": "[VirtualHubRouteV2]"}, + "attached_connections": {"key": "properties.attachedConnections", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + routes: Optional[List["_models.VirtualHubRouteV2"]] = None, + attached_connections: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword routes: List of all routes. + :paramtype routes: list[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteV2] + :keyword attached_connections: List of all connections attached to this route table v2. + :paramtype attached_connections: list[str] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.routes = routes + self.attached_connections = attached_connections + self.provisioning_state = None + + +class VirtualHubRouteV2(_serialization.Model): + """VirtualHubRouteTableV2 route. + + :ivar destination_type: The type of destinations. + :vartype destination_type: str + :ivar destinations: List of all destinations. + :vartype destinations: list[str] + :ivar next_hop_type: The type of next hops. + :vartype next_hop_type: str + :ivar next_hops: NextHops ip address. + :vartype next_hops: list[str] + """ + + _attribute_map = { + "destination_type": {"key": "destinationType", "type": "str"}, + "destinations": {"key": "destinations", "type": "[str]"}, + "next_hop_type": {"key": "nextHopType", "type": "str"}, + "next_hops": {"key": "nextHops", "type": "[str]"}, + } + + def __init__( + self, + *, + destination_type: Optional[str] = None, + destinations: Optional[List[str]] = None, + next_hop_type: Optional[str] = None, + next_hops: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword destination_type: The type of destinations. + :paramtype destination_type: str + :keyword destinations: List of all destinations. + :paramtype destinations: list[str] + :keyword next_hop_type: The type of next hops. + :paramtype next_hop_type: str + :keyword next_hops: NextHops ip address. + :paramtype next_hops: list[str] + """ + super().__init__(**kwargs) + self.destination_type = destination_type + self.destinations = destinations + self.next_hop_type = next_hop_type + self.next_hops = next_hops + + +class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes + """Virtual Network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the virtual network. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar address_space: The AddressSpace that contains an array of IP address ranges that can be + used by subnets. + :vartype address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar dhcp_options: The dhcpOptions that contains an array of DNS servers available to VMs + deployed in the virtual network. + :vartype dhcp_options: ~azure.mgmt.network.v2023_09_01.models.DhcpOptions + :ivar flow_timeout_in_minutes: The FlowTimeout value (in minutes) for the Virtual Network. + :vartype flow_timeout_in_minutes: int + :ivar subnets: A list of subnets in a Virtual Network. + :vartype subnets: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :ivar virtual_network_peerings: A list of peerings in a Virtual Network. + :vartype virtual_network_peerings: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :ivar resource_guid: The resourceGuid property of the Virtual Network resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the virtual network resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar enable_ddos_protection: Indicates if DDoS protection is enabled for all the protected + resources in the virtual network. It requires a DDoS protection plan associated with the + resource. + :vartype enable_ddos_protection: bool + :ivar enable_vm_protection: Indicates if VM protection is enabled for all the subnets in the + virtual network. + :vartype enable_vm_protection: bool + :ivar ddos_protection_plan: The DDoS protection plan associated with the virtual network. + :vartype ddos_protection_plan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar bgp_communities: Bgp Communities sent over ExpressRoute with each route corresponding to + a prefix in this VNET. + :vartype bgp_communities: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkBgpCommunities + :ivar encryption: Indicates if encryption is enabled on virtual network and if VM without + encryption is allowed in encrypted VNet. + :vartype encryption: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkEncryption + :ivar ip_allocations: Array of IpAllocation which reference this VNET. + :vartype ip_allocations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar flow_logs: A collection of references to flow log resources. + :vartype flow_logs: list[~azure.mgmt.network.v2023_09_01.models.FlowLog] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "flow_logs": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "address_space": {"key": "properties.addressSpace", "type": "AddressSpace"}, + "dhcp_options": {"key": "properties.dhcpOptions", "type": "DhcpOptions"}, + "flow_timeout_in_minutes": {"key": "properties.flowTimeoutInMinutes", "type": "int"}, + "subnets": {"key": "properties.subnets", "type": "[Subnet]"}, + "virtual_network_peerings": {"key": "properties.virtualNetworkPeerings", "type": "[VirtualNetworkPeering]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "enable_ddos_protection": {"key": "properties.enableDdosProtection", "type": "bool"}, + "enable_vm_protection": {"key": "properties.enableVmProtection", "type": "bool"}, + "ddos_protection_plan": {"key": "properties.ddosProtectionPlan", "type": "SubResource"}, + "bgp_communities": {"key": "properties.bgpCommunities", "type": "VirtualNetworkBgpCommunities"}, + "encryption": {"key": "properties.encryption", "type": "VirtualNetworkEncryption"}, + "ip_allocations": {"key": "properties.ipAllocations", "type": "[SubResource]"}, + "flow_logs": {"key": "properties.flowLogs", "type": "[FlowLog]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + address_space: Optional["_models.AddressSpace"] = None, + dhcp_options: Optional["_models.DhcpOptions"] = None, + flow_timeout_in_minutes: Optional[int] = None, + subnets: Optional[List["_models.Subnet"]] = None, + virtual_network_peerings: Optional[List["_models.VirtualNetworkPeering"]] = None, + enable_ddos_protection: bool = False, + enable_vm_protection: bool = False, + ddos_protection_plan: Optional["_models.SubResource"] = None, + bgp_communities: Optional["_models.VirtualNetworkBgpCommunities"] = None, + encryption: Optional["_models.VirtualNetworkEncryption"] = None, + ip_allocations: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of the virtual network. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword address_space: The AddressSpace that contains an array of IP address ranges that can + be used by subnets. + :paramtype address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword dhcp_options: The dhcpOptions that contains an array of DNS servers available to VMs + deployed in the virtual network. + :paramtype dhcp_options: ~azure.mgmt.network.v2023_09_01.models.DhcpOptions + :keyword flow_timeout_in_minutes: The FlowTimeout value (in minutes) for the Virtual Network. + :paramtype flow_timeout_in_minutes: int + :keyword subnets: A list of subnets in a Virtual Network. + :paramtype subnets: list[~azure.mgmt.network.v2023_09_01.models.Subnet] + :keyword virtual_network_peerings: A list of peerings in a Virtual Network. + :paramtype virtual_network_peerings: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :keyword enable_ddos_protection: Indicates if DDoS protection is enabled for all the protected + resources in the virtual network. It requires a DDoS protection plan associated with the + resource. + :paramtype enable_ddos_protection: bool + :keyword enable_vm_protection: Indicates if VM protection is enabled for all the subnets in the + virtual network. + :paramtype enable_vm_protection: bool + :keyword ddos_protection_plan: The DDoS protection plan associated with the virtual network. + :paramtype ddos_protection_plan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword bgp_communities: Bgp Communities sent over ExpressRoute with each route corresponding + to a prefix in this VNET. + :paramtype bgp_communities: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkBgpCommunities + :keyword encryption: Indicates if encryption is enabled on virtual network and if VM without + encryption is allowed in encrypted VNet. + :paramtype encryption: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkEncryption + :keyword ip_allocations: Array of IpAllocation which reference this VNET. + :paramtype ip_allocations: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.address_space = address_space + self.dhcp_options = dhcp_options + self.flow_timeout_in_minutes = flow_timeout_in_minutes + self.subnets = subnets + self.virtual_network_peerings = virtual_network_peerings + self.resource_guid = None + self.provisioning_state = None + self.enable_ddos_protection = enable_ddos_protection + self.enable_vm_protection = enable_vm_protection + self.ddos_protection_plan = ddos_protection_plan + self.bgp_communities = bgp_communities + self.encryption = encryption + self.ip_allocations = ip_allocations + self.flow_logs = None + + +class VirtualNetworkBgpCommunities(_serialization.Model): + """Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. + + 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 virtual_network_community: The BGP community associated with the virtual network. + Required. + :vartype virtual_network_community: str + :ivar regional_community: The BGP community associated with the region of the virtual network. + :vartype regional_community: str + """ + + _validation = { + "virtual_network_community": {"required": True}, + "regional_community": {"readonly": True}, + } + + _attribute_map = { + "virtual_network_community": {"key": "virtualNetworkCommunity", "type": "str"}, + "regional_community": {"key": "regionalCommunity", "type": "str"}, + } + + def __init__(self, *, virtual_network_community: str, **kwargs: Any) -> None: + """ + :keyword virtual_network_community: The BGP community associated with the virtual network. + Required. + :paramtype virtual_network_community: str + """ + super().__init__(**kwargs) + self.virtual_network_community = virtual_network_community + self.regional_community = None + + +class VirtualNetworkConnectionGatewayReference(_serialization.Model): + """A reference to VirtualNetworkGateway or LocalNetworkGateway resource. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of VirtualNetworkGateway or LocalNetworkGateway resource. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The ID of VirtualNetworkGateway or LocalNetworkGateway resource. Required. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class VirtualNetworkDdosProtectionStatusResult(_serialization.Model): + """Response for GetVirtualNetworkDdosProtectionStatusOperation. + + :ivar value: The Ddos Protection Status Result for each public ip under a virtual network. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PublicIpDdosProtectionStatusResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PublicIpDdosProtectionStatusResult"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The Ddos Protection Status Result for each public ip under a virtual network. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualNetworkEncryption(_serialization.Model): + """Indicates if encryption is enabled on virtual network and if VM without encryption is allowed + in encrypted VNet. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Indicates if encryption is enabled on the virtual network. Required. + :vartype enabled: bool + :ivar enforcement: If the encrypted VNet allows VM that does not support encryption. Known + values are: "DropUnencrypted" and "AllowUnencrypted". + :vartype enforcement: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkEncryptionEnforcement + """ + + _validation = { + "enabled": {"required": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "enforcement": {"key": "enforcement", "type": "str"}, + } + + def __init__( + self, + *, + enabled: bool, + enforcement: Optional[Union[str, "_models.VirtualNetworkEncryptionEnforcement"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Indicates if encryption is enabled on the virtual network. Required. + :paramtype enabled: bool + :keyword enforcement: If the encrypted VNet allows VM that does not support encryption. Known + values are: "DropUnencrypted" and "AllowUnencrypted". + :paramtype enforcement: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkEncryptionEnforcement + """ + super().__init__(**kwargs) + self.enabled = enabled + self.enforcement = enforcement + + +class VirtualNetworkGateway(Resource): # pylint: disable=too-many-instance-attributes + """A common class for general resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of type local virtual network gateway. + :vartype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar auto_scale_configuration: Autoscale configuration for virutal network gateway. + :vartype auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayAutoScaleConfiguration + :ivar ip_configurations: IP configurations for virtual network gateway. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayIPConfiguration] + :ivar gateway_type: The type of this virtual network gateway. Known values are: "Vpn", + "ExpressRoute", and "LocalGateway". + :vartype gateway_type: str or ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayType + :ivar vpn_type: The type of this virtual network gateway. Known values are: "PolicyBased" and + "RouteBased". + :vartype vpn_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnType + :ivar vpn_gateway_generation: The generation for this VirtualNetworkGateway. Must be None if + gatewayType is not VPN. Known values are: "None", "Generation1", and "Generation2". + :vartype vpn_gateway_generation: str or + ~azure.mgmt.network.v2023_09_01.models.VpnGatewayGeneration + :ivar enable_bgp: Whether BGP is enabled for this virtual network gateway or not. + :vartype enable_bgp: bool + :ivar enable_private_ip_address: Whether private IP needs to be enabled on this gateway for + connections or not. + :vartype enable_private_ip_address: bool + :ivar active: ActiveActive flag. + :vartype active: bool + :ivar disable_ip_sec_replay_protection: disableIPSecReplayProtection flag. + :vartype disable_ip_sec_replay_protection: bool + :ivar gateway_default_site: The reference to the LocalNetworkGateway resource which represents + local network site having default routes. Assign Null value in case of removing existing + default site setting. + :vartype gateway_default_site: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar sku: The reference to the VirtualNetworkGatewaySku resource which represents the SKU + selected for Virtual network gateway. + :vartype sku: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySku + :ivar vpn_client_configuration: The reference to the VpnClientConfiguration resource which + represents the P2S VpnClient configurations. + :vartype vpn_client_configuration: + ~azure.mgmt.network.v2023_09_01.models.VpnClientConfiguration + :ivar virtual_network_gateway_policy_groups: The reference to the + VirtualNetworkGatewayPolicyGroup resource which represents the available + VirtualNetworkGatewayPolicyGroup for the gateway. + :vartype virtual_network_gateway_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayPolicyGroup] + :ivar bgp_settings: Virtual network gateway's BGP speaker settings. + :vartype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :ivar custom_routes: The reference to the address space resource which represents the custom + routes address space specified by the customer for virtual network gateway and VpnClient. + :vartype custom_routes: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar resource_guid: The resource GUID property of the virtual network gateway resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the virtual network gateway resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar enable_dns_forwarding: Whether dns forwarding is enabled or not. + :vartype enable_dns_forwarding: bool + :ivar inbound_dns_forwarding_endpoint: The IP address allocated by the gateway to which dns + requests can be sent. + :vartype inbound_dns_forwarding_endpoint: str + :ivar v_net_extended_location_resource_id: Customer vnet resource id. VirtualNetworkGateway of + type local gateway is associated with the customer vnet. + :vartype v_net_extended_location_resource_id: str + :ivar nat_rules: NatRules for virtual network gateway. + :vartype nat_rules: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :ivar enable_bgp_route_translation_for_nat: EnableBgpRouteTranslationForNat flag. + :vartype enable_bgp_route_translation_for_nat: bool + :ivar allow_virtual_wan_traffic: Configures this gateway to accept traffic from remote Virtual + WAN networks. + :vartype allow_virtual_wan_traffic: bool + :ivar allow_remote_vnet_traffic: Configure this gateway to accept traffic from other Azure + Virtual Networks. This configuration does not support connectivity to Azure Virtual WAN. + :vartype allow_remote_vnet_traffic: bool + :ivar admin_state: Property to indicate if the Express Route Gateway serves traffic when there + are multiple Express Route Gateways in the vnet. Known values are: "Enabled" and "Disabled". + :vartype admin_state: str or ~azure.mgmt.network.v2023_09_01.models.AdminState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "inbound_dns_forwarding_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "etag": {"key": "etag", "type": "str"}, + "auto_scale_configuration": { + "key": "properties.autoScaleConfiguration", + "type": "VirtualNetworkGatewayAutoScaleConfiguration", + }, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[VirtualNetworkGatewayIPConfiguration]"}, + "gateway_type": {"key": "properties.gatewayType", "type": "str"}, + "vpn_type": {"key": "properties.vpnType", "type": "str"}, + "vpn_gateway_generation": {"key": "properties.vpnGatewayGeneration", "type": "str"}, + "enable_bgp": {"key": "properties.enableBgp", "type": "bool"}, + "enable_private_ip_address": {"key": "properties.enablePrivateIpAddress", "type": "bool"}, + "active": {"key": "properties.activeActive", "type": "bool"}, + "disable_ip_sec_replay_protection": {"key": "properties.disableIPSecReplayProtection", "type": "bool"}, + "gateway_default_site": {"key": "properties.gatewayDefaultSite", "type": "SubResource"}, + "sku": {"key": "properties.sku", "type": "VirtualNetworkGatewaySku"}, + "vpn_client_configuration": {"key": "properties.vpnClientConfiguration", "type": "VpnClientConfiguration"}, + "virtual_network_gateway_policy_groups": { + "key": "properties.virtualNetworkGatewayPolicyGroups", + "type": "[VirtualNetworkGatewayPolicyGroup]", + }, + "bgp_settings": {"key": "properties.bgpSettings", "type": "BgpSettings"}, + "custom_routes": {"key": "properties.customRoutes", "type": "AddressSpace"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "enable_dns_forwarding": {"key": "properties.enableDnsForwarding", "type": "bool"}, + "inbound_dns_forwarding_endpoint": {"key": "properties.inboundDnsForwardingEndpoint", "type": "str"}, + "v_net_extended_location_resource_id": {"key": "properties.vNetExtendedLocationResourceId", "type": "str"}, + "nat_rules": {"key": "properties.natRules", "type": "[VirtualNetworkGatewayNatRule]"}, + "enable_bgp_route_translation_for_nat": {"key": "properties.enableBgpRouteTranslationForNat", "type": "bool"}, + "allow_virtual_wan_traffic": {"key": "properties.allowVirtualWanTraffic", "type": "bool"}, + "allow_remote_vnet_traffic": {"key": "properties.allowRemoteVnetTraffic", "type": "bool"}, + "admin_state": {"key": "properties.adminState", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + auto_scale_configuration: Optional["_models.VirtualNetworkGatewayAutoScaleConfiguration"] = None, + ip_configurations: Optional[List["_models.VirtualNetworkGatewayIPConfiguration"]] = None, + gateway_type: Optional[Union[str, "_models.VirtualNetworkGatewayType"]] = None, + vpn_type: Optional[Union[str, "_models.VpnType"]] = None, + vpn_gateway_generation: Optional[Union[str, "_models.VpnGatewayGeneration"]] = None, + enable_bgp: Optional[bool] = None, + enable_private_ip_address: Optional[bool] = None, + active: Optional[bool] = None, + disable_ip_sec_replay_protection: Optional[bool] = None, + gateway_default_site: Optional["_models.SubResource"] = None, + sku: Optional["_models.VirtualNetworkGatewaySku"] = None, + vpn_client_configuration: Optional["_models.VpnClientConfiguration"] = None, + virtual_network_gateway_policy_groups: Optional[List["_models.VirtualNetworkGatewayPolicyGroup"]] = None, + bgp_settings: Optional["_models.BgpSettings"] = None, + custom_routes: Optional["_models.AddressSpace"] = None, + enable_dns_forwarding: Optional[bool] = None, + v_net_extended_location_resource_id: Optional[str] = None, + nat_rules: Optional[List["_models.VirtualNetworkGatewayNatRule"]] = None, + enable_bgp_route_translation_for_nat: Optional[bool] = None, + allow_virtual_wan_traffic: Optional[bool] = None, + allow_remote_vnet_traffic: Optional[bool] = None, + admin_state: Optional[Union[str, "_models.AdminState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword extended_location: The extended location of type local virtual network gateway. + :paramtype extended_location: ~azure.mgmt.network.v2023_09_01.models.ExtendedLocation + :keyword auto_scale_configuration: Autoscale configuration for virutal network gateway. + :paramtype auto_scale_configuration: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayAutoScaleConfiguration + :keyword ip_configurations: IP configurations for virtual network gateway. + :paramtype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayIPConfiguration] + :keyword gateway_type: The type of this virtual network gateway. Known values are: "Vpn", + "ExpressRoute", and "LocalGateway". + :paramtype gateway_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayType + :keyword vpn_type: The type of this virtual network gateway. Known values are: "PolicyBased" + and "RouteBased". + :paramtype vpn_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnType + :keyword vpn_gateway_generation: The generation for this VirtualNetworkGateway. Must be None if + gatewayType is not VPN. Known values are: "None", "Generation1", and "Generation2". + :paramtype vpn_gateway_generation: str or + ~azure.mgmt.network.v2023_09_01.models.VpnGatewayGeneration + :keyword enable_bgp: Whether BGP is enabled for this virtual network gateway or not. + :paramtype enable_bgp: bool + :keyword enable_private_ip_address: Whether private IP needs to be enabled on this gateway for + connections or not. + :paramtype enable_private_ip_address: bool + :keyword active: ActiveActive flag. + :paramtype active: bool + :keyword disable_ip_sec_replay_protection: disableIPSecReplayProtection flag. + :paramtype disable_ip_sec_replay_protection: bool + :keyword gateway_default_site: The reference to the LocalNetworkGateway resource which + represents local network site having default routes. Assign Null value in case of removing + existing default site setting. + :paramtype gateway_default_site: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword sku: The reference to the VirtualNetworkGatewaySku resource which represents the SKU + selected for Virtual network gateway. + :paramtype sku: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySku + :keyword vpn_client_configuration: The reference to the VpnClientConfiguration resource which + represents the P2S VpnClient configurations. + :paramtype vpn_client_configuration: + ~azure.mgmt.network.v2023_09_01.models.VpnClientConfiguration + :keyword virtual_network_gateway_policy_groups: The reference to the + VirtualNetworkGatewayPolicyGroup resource which represents the available + VirtualNetworkGatewayPolicyGroup for the gateway. + :paramtype virtual_network_gateway_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayPolicyGroup] + :keyword bgp_settings: Virtual network gateway's BGP speaker settings. + :paramtype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :keyword custom_routes: The reference to the address space resource which represents the custom + routes address space specified by the customer for virtual network gateway and VpnClient. + :paramtype custom_routes: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword enable_dns_forwarding: Whether dns forwarding is enabled or not. + :paramtype enable_dns_forwarding: bool + :keyword v_net_extended_location_resource_id: Customer vnet resource id. VirtualNetworkGateway + of type local gateway is associated with the customer vnet. + :paramtype v_net_extended_location_resource_id: str + :keyword nat_rules: NatRules for virtual network gateway. + :paramtype nat_rules: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :keyword enable_bgp_route_translation_for_nat: EnableBgpRouteTranslationForNat flag. + :paramtype enable_bgp_route_translation_for_nat: bool + :keyword allow_virtual_wan_traffic: Configures this gateway to accept traffic from remote + Virtual WAN networks. + :paramtype allow_virtual_wan_traffic: bool + :keyword allow_remote_vnet_traffic: Configure this gateway to accept traffic from other Azure + Virtual Networks. This configuration does not support connectivity to Azure Virtual WAN. + :paramtype allow_remote_vnet_traffic: bool + :keyword admin_state: Property to indicate if the Express Route Gateway serves traffic when + there are multiple Express Route Gateways in the vnet. Known values are: "Enabled" and + "Disabled". + :paramtype admin_state: str or ~azure.mgmt.network.v2023_09_01.models.AdminState + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.etag = None + self.auto_scale_configuration = auto_scale_configuration + self.ip_configurations = ip_configurations + self.gateway_type = gateway_type + self.vpn_type = vpn_type + self.vpn_gateway_generation = vpn_gateway_generation + self.enable_bgp = enable_bgp + self.enable_private_ip_address = enable_private_ip_address + self.active = active + self.disable_ip_sec_replay_protection = disable_ip_sec_replay_protection + self.gateway_default_site = gateway_default_site + self.sku = sku + self.vpn_client_configuration = vpn_client_configuration + self.virtual_network_gateway_policy_groups = virtual_network_gateway_policy_groups + self.bgp_settings = bgp_settings + self.custom_routes = custom_routes + self.resource_guid = None + self.provisioning_state = None + self.enable_dns_forwarding = enable_dns_forwarding + self.inbound_dns_forwarding_endpoint = None + self.v_net_extended_location_resource_id = v_net_extended_location_resource_id + self.nat_rules = nat_rules + self.enable_bgp_route_translation_for_nat = enable_bgp_route_translation_for_nat + self.allow_virtual_wan_traffic = allow_virtual_wan_traffic + self.allow_remote_vnet_traffic = allow_remote_vnet_traffic + self.admin_state = admin_state + + +class VirtualNetworkGatewayAutoScaleBounds(_serialization.Model): + """VirtualNetworkGatewayAutoScaleBounds. + + :ivar min: Minimum scale Units for Autoscale configuration. + :vartype min: int + :ivar max: Maximum Scale Units for Autoscale configuration. + :vartype max: int + """ + + _attribute_map = { + "min": {"key": "min", "type": "int"}, + "max": {"key": "max", "type": "int"}, + } + + def __init__( + self, + *, + min: Optional[int] = None, # pylint: disable=redefined-builtin + max: Optional[int] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: Minimum scale Units for Autoscale configuration. + :paramtype min: int + :keyword max: Maximum Scale Units for Autoscale configuration. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + +class VirtualNetworkGatewayAutoScaleConfiguration(_serialization.Model): + """Virtual Network Gateway Autoscale Configuration details. + + :ivar bounds: The bounds of the autoscale configuration. + :vartype bounds: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayAutoScaleBounds + """ + + _attribute_map = { + "bounds": {"key": "bounds", "type": "VirtualNetworkGatewayAutoScaleBounds"}, + } + + def __init__( + self, *, bounds: Optional["_models.VirtualNetworkGatewayAutoScaleBounds"] = None, **kwargs: Any + ) -> None: + """ + :keyword bounds: The bounds of the autoscale configuration. + :paramtype bounds: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayAutoScaleBounds + """ + super().__init__(**kwargs) + self.bounds = bounds + + +class VirtualNetworkGatewayConnection(Resource): # pylint: disable=too-many-instance-attributes + """A common class for general resource information. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar authorization_key: The authorizationKey. + :vartype authorization_key: str + :ivar virtual_network_gateway1: The reference to virtual network gateway resource. Required. + :vartype virtual_network_gateway1: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :ivar virtual_network_gateway2: The reference to virtual network gateway resource. + :vartype virtual_network_gateway2: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :ivar local_network_gateway2: The reference to local network gateway resource. + :vartype local_network_gateway2: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :ivar ingress_nat_rules: List of ingress NatRules. + :vartype ingress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar egress_nat_rules: List of egress NatRules. + :vartype egress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar connection_type: Gateway connection type. Required. Known values are: "IPsec", + "Vnet2Vnet", "ExpressRoute", and "VPNClient". + :vartype connection_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionType + :ivar connection_protocol: Connection protocol used for this connection. Known values are: + "IKEv2" and "IKEv1". + :vartype connection_protocol: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :ivar routing_weight: The routing weight. + :vartype routing_weight: int + :ivar dpd_timeout_seconds: The dead peer detection timeout of this connection in seconds. + :vartype dpd_timeout_seconds: int + :ivar connection_mode: The connection mode for this connection. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :vartype connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionMode + :ivar shared_key: The IPSec shared key. + :vartype shared_key: str + :ivar connection_status: Virtual Network Gateway connection status. Known values are: + "Unknown", "Connecting", "Connected", and "NotConnected". + :vartype connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionStatus + :ivar tunnel_connection_status: Collection of all tunnels' connection health status. + :vartype tunnel_connection_status: + list[~azure.mgmt.network.v2023_09_01.models.TunnelConnectionHealth] + :ivar egress_bytes_transferred: The egress bytes transferred in this connection. + :vartype egress_bytes_transferred: int + :ivar ingress_bytes_transferred: The ingress bytes transferred in this connection. + :vartype ingress_bytes_transferred: int + :ivar peer: The reference to peerings resource. + :vartype peer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar enable_bgp: EnableBgp flag. + :vartype enable_bgp: bool + :ivar gateway_custom_bgp_ip_addresses: GatewayCustomBgpIpAddresses to be used for virtual + network gateway Connection. + :vartype gateway_custom_bgp_ip_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :ivar use_local_azure_ip_address: Use private local Azure IP for the connection. + :vartype use_local_azure_ip_address: bool + :ivar use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :vartype use_policy_based_traffic_selectors: bool + :ivar ipsec_policies: The IPSec Policies to be considered by this connection. + :vartype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :vartype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :ivar resource_guid: The resource GUID property of the virtual network gateway connection + resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the virtual network gateway connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. + :vartype express_route_gateway_bypass: bool + :ivar enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :vartype enable_private_link_fast_path: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "virtual_network_gateway1": {"required": True}, + "connection_type": {"required": True}, + "connection_status": {"readonly": True}, + "tunnel_connection_status": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "virtual_network_gateway1": {"key": "properties.virtualNetworkGateway1", "type": "VirtualNetworkGateway"}, + "virtual_network_gateway2": {"key": "properties.virtualNetworkGateway2", "type": "VirtualNetworkGateway"}, + "local_network_gateway2": {"key": "properties.localNetworkGateway2", "type": "LocalNetworkGateway"}, + "ingress_nat_rules": {"key": "properties.ingressNatRules", "type": "[SubResource]"}, + "egress_nat_rules": {"key": "properties.egressNatRules", "type": "[SubResource]"}, + "connection_type": {"key": "properties.connectionType", "type": "str"}, + "connection_protocol": {"key": "properties.connectionProtocol", "type": "str"}, + "routing_weight": {"key": "properties.routingWeight", "type": "int"}, + "dpd_timeout_seconds": {"key": "properties.dpdTimeoutSeconds", "type": "int"}, + "connection_mode": {"key": "properties.connectionMode", "type": "str"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "connection_status": {"key": "properties.connectionStatus", "type": "str"}, + "tunnel_connection_status": {"key": "properties.tunnelConnectionStatus", "type": "[TunnelConnectionHealth]"}, + "egress_bytes_transferred": {"key": "properties.egressBytesTransferred", "type": "int"}, + "ingress_bytes_transferred": {"key": "properties.ingressBytesTransferred", "type": "int"}, + "peer": {"key": "properties.peer", "type": "SubResource"}, + "enable_bgp": {"key": "properties.enableBgp", "type": "bool"}, + "gateway_custom_bgp_ip_addresses": { + "key": "properties.gatewayCustomBgpIpAddresses", + "type": "[GatewayCustomBgpIpAddressIpConfiguration]", + }, + "use_local_azure_ip_address": {"key": "properties.useLocalAzureIpAddress", "type": "bool"}, + "use_policy_based_traffic_selectors": {"key": "properties.usePolicyBasedTrafficSelectors", "type": "bool"}, + "ipsec_policies": {"key": "properties.ipsecPolicies", "type": "[IpsecPolicy]"}, + "traffic_selector_policies": {"key": "properties.trafficSelectorPolicies", "type": "[TrafficSelectorPolicy]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "express_route_gateway_bypass": {"key": "properties.expressRouteGatewayBypass", "type": "bool"}, + "enable_private_link_fast_path": {"key": "properties.enablePrivateLinkFastPath", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + virtual_network_gateway1: "_models.VirtualNetworkGateway", + connection_type: Union[str, "_models.VirtualNetworkGatewayConnectionType"], + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + authorization_key: Optional[str] = None, + virtual_network_gateway2: Optional["_models.VirtualNetworkGateway"] = None, + local_network_gateway2: Optional["_models.LocalNetworkGateway"] = None, + ingress_nat_rules: Optional[List["_models.SubResource"]] = None, + egress_nat_rules: Optional[List["_models.SubResource"]] = None, + connection_protocol: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionProtocol"]] = None, + routing_weight: Optional[int] = None, + dpd_timeout_seconds: Optional[int] = None, + connection_mode: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionMode"]] = None, + shared_key: Optional[str] = None, + peer: Optional["_models.SubResource"] = None, + enable_bgp: Optional[bool] = None, + gateway_custom_bgp_ip_addresses: Optional[List["_models.GatewayCustomBgpIpAddressIpConfiguration"]] = None, + use_local_azure_ip_address: Optional[bool] = None, + use_policy_based_traffic_selectors: Optional[bool] = None, + ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + traffic_selector_policies: Optional[List["_models.TrafficSelectorPolicy"]] = None, + express_route_gateway_bypass: Optional[bool] = None, + enable_private_link_fast_path: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword authorization_key: The authorizationKey. + :paramtype authorization_key: str + :keyword virtual_network_gateway1: The reference to virtual network gateway resource. Required. + :paramtype virtual_network_gateway1: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :keyword virtual_network_gateway2: The reference to virtual network gateway resource. + :paramtype virtual_network_gateway2: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :keyword local_network_gateway2: The reference to local network gateway resource. + :paramtype local_network_gateway2: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :keyword ingress_nat_rules: List of ingress NatRules. + :paramtype ingress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword egress_nat_rules: List of egress NatRules. + :paramtype egress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword connection_type: Gateway connection type. Required. Known values are: "IPsec", + "Vnet2Vnet", "ExpressRoute", and "VPNClient". + :paramtype connection_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionType + :keyword connection_protocol: Connection protocol used for this connection. Known values are: + "IKEv2" and "IKEv1". + :paramtype connection_protocol: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :keyword routing_weight: The routing weight. + :paramtype routing_weight: int + :keyword dpd_timeout_seconds: The dead peer detection timeout of this connection in seconds. + :paramtype dpd_timeout_seconds: int + :keyword connection_mode: The connection mode for this connection. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :paramtype connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionMode + :keyword shared_key: The IPSec shared key. + :paramtype shared_key: str + :keyword peer: The reference to peerings resource. + :paramtype peer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword enable_bgp: EnableBgp flag. + :paramtype enable_bgp: bool + :keyword gateway_custom_bgp_ip_addresses: GatewayCustomBgpIpAddresses to be used for virtual + network gateway Connection. + :paramtype gateway_custom_bgp_ip_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :keyword use_local_azure_ip_address: Use private local Azure IP for the connection. + :paramtype use_local_azure_ip_address: bool + :keyword use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :paramtype use_policy_based_traffic_selectors: bool + :keyword ipsec_policies: The IPSec Policies to be considered by this connection. + :paramtype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :paramtype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :keyword express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. + :paramtype express_route_gateway_bypass: bool + :keyword enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :paramtype enable_private_link_fast_path: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.authorization_key = authorization_key + self.virtual_network_gateway1 = virtual_network_gateway1 + self.virtual_network_gateway2 = virtual_network_gateway2 + self.local_network_gateway2 = local_network_gateway2 + self.ingress_nat_rules = ingress_nat_rules + self.egress_nat_rules = egress_nat_rules + self.connection_type = connection_type + self.connection_protocol = connection_protocol + self.routing_weight = routing_weight + self.dpd_timeout_seconds = dpd_timeout_seconds + self.connection_mode = connection_mode + self.shared_key = shared_key + self.connection_status = None + self.tunnel_connection_status = None + self.egress_bytes_transferred = None + self.ingress_bytes_transferred = None + self.peer = peer + self.enable_bgp = enable_bgp + self.gateway_custom_bgp_ip_addresses = gateway_custom_bgp_ip_addresses + self.use_local_azure_ip_address = use_local_azure_ip_address + self.use_policy_based_traffic_selectors = use_policy_based_traffic_selectors + self.ipsec_policies = ipsec_policies + self.traffic_selector_policies = traffic_selector_policies + self.resource_guid = None + self.provisioning_state = None + self.express_route_gateway_bypass = express_route_gateway_bypass + self.enable_private_link_fast_path = enable_private_link_fast_path + + +class VirtualNetworkGatewayConnectionListEntity(Resource): # pylint: disable=too-many-instance-attributes + """A common class for general resource information. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar authorization_key: The authorizationKey. + :vartype authorization_key: str + :ivar virtual_network_gateway1: The reference to virtual network gateway resource. Required. + :vartype virtual_network_gateway1: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :ivar virtual_network_gateway2: The reference to virtual network gateway resource. + :vartype virtual_network_gateway2: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :ivar local_network_gateway2: The reference to local network gateway resource. + :vartype local_network_gateway2: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :ivar connection_type: Gateway connection type. Required. Known values are: "IPsec", + "Vnet2Vnet", "ExpressRoute", and "VPNClient". + :vartype connection_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionType + :ivar connection_protocol: Connection protocol used for this connection. Known values are: + "IKEv2" and "IKEv1". + :vartype connection_protocol: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :ivar routing_weight: The routing weight. + :vartype routing_weight: int + :ivar connection_mode: The connection mode for this connection. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :vartype connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionMode + :ivar shared_key: The IPSec shared key. + :vartype shared_key: str + :ivar connection_status: Virtual Network Gateway connection status. Known values are: + "Unknown", "Connecting", "Connected", and "NotConnected". + :vartype connection_status: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionStatus + :ivar tunnel_connection_status: Collection of all tunnels' connection health status. + :vartype tunnel_connection_status: + list[~azure.mgmt.network.v2023_09_01.models.TunnelConnectionHealth] + :ivar egress_bytes_transferred: The egress bytes transferred in this connection. + :vartype egress_bytes_transferred: int + :ivar ingress_bytes_transferred: The ingress bytes transferred in this connection. + :vartype ingress_bytes_transferred: int + :ivar peer: The reference to peerings resource. + :vartype peer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar enable_bgp: EnableBgp flag. + :vartype enable_bgp: bool + :ivar gateway_custom_bgp_ip_addresses: GatewayCustomBgpIpAddresses to be used for virtual + network gateway Connection. + :vartype gateway_custom_bgp_ip_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :ivar use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :vartype use_policy_based_traffic_selectors: bool + :ivar ipsec_policies: The IPSec Policies to be considered by this connection. + :vartype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :vartype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :ivar resource_guid: The resource GUID property of the virtual network gateway connection + resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the virtual network gateway connection + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. + :vartype express_route_gateway_bypass: bool + :ivar enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :vartype enable_private_link_fast_path: bool + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "virtual_network_gateway1": {"required": True}, + "connection_type": {"required": True}, + "connection_status": {"readonly": True}, + "tunnel_connection_status": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "authorization_key": {"key": "properties.authorizationKey", "type": "str"}, + "virtual_network_gateway1": { + "key": "properties.virtualNetworkGateway1", + "type": "VirtualNetworkConnectionGatewayReference", + }, + "virtual_network_gateway2": { + "key": "properties.virtualNetworkGateway2", + "type": "VirtualNetworkConnectionGatewayReference", + }, + "local_network_gateway2": { + "key": "properties.localNetworkGateway2", + "type": "VirtualNetworkConnectionGatewayReference", + }, + "connection_type": {"key": "properties.connectionType", "type": "str"}, + "connection_protocol": {"key": "properties.connectionProtocol", "type": "str"}, + "routing_weight": {"key": "properties.routingWeight", "type": "int"}, + "connection_mode": {"key": "properties.connectionMode", "type": "str"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "connection_status": {"key": "properties.connectionStatus", "type": "str"}, + "tunnel_connection_status": {"key": "properties.tunnelConnectionStatus", "type": "[TunnelConnectionHealth]"}, + "egress_bytes_transferred": {"key": "properties.egressBytesTransferred", "type": "int"}, + "ingress_bytes_transferred": {"key": "properties.ingressBytesTransferred", "type": "int"}, + "peer": {"key": "properties.peer", "type": "SubResource"}, + "enable_bgp": {"key": "properties.enableBgp", "type": "bool"}, + "gateway_custom_bgp_ip_addresses": { + "key": "properties.gatewayCustomBgpIpAddresses", + "type": "[GatewayCustomBgpIpAddressIpConfiguration]", + }, + "use_policy_based_traffic_selectors": {"key": "properties.usePolicyBasedTrafficSelectors", "type": "bool"}, + "ipsec_policies": {"key": "properties.ipsecPolicies", "type": "[IpsecPolicy]"}, + "traffic_selector_policies": {"key": "properties.trafficSelectorPolicies", "type": "[TrafficSelectorPolicy]"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "express_route_gateway_bypass": {"key": "properties.expressRouteGatewayBypass", "type": "bool"}, + "enable_private_link_fast_path": {"key": "properties.enablePrivateLinkFastPath", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + virtual_network_gateway1: "_models.VirtualNetworkConnectionGatewayReference", + connection_type: Union[str, "_models.VirtualNetworkGatewayConnectionType"], + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + authorization_key: Optional[str] = None, + virtual_network_gateway2: Optional["_models.VirtualNetworkConnectionGatewayReference"] = None, + local_network_gateway2: Optional["_models.VirtualNetworkConnectionGatewayReference"] = None, + connection_protocol: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionProtocol"]] = None, + routing_weight: Optional[int] = None, + connection_mode: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionMode"]] = None, + shared_key: Optional[str] = None, + peer: Optional["_models.SubResource"] = None, + enable_bgp: Optional[bool] = None, + gateway_custom_bgp_ip_addresses: Optional[List["_models.GatewayCustomBgpIpAddressIpConfiguration"]] = None, + use_policy_based_traffic_selectors: Optional[bool] = None, + ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + traffic_selector_policies: Optional[List["_models.TrafficSelectorPolicy"]] = None, + express_route_gateway_bypass: Optional[bool] = None, + enable_private_link_fast_path: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword authorization_key: The authorizationKey. + :paramtype authorization_key: str + :keyword virtual_network_gateway1: The reference to virtual network gateway resource. Required. + :paramtype virtual_network_gateway1: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :keyword virtual_network_gateway2: The reference to virtual network gateway resource. + :paramtype virtual_network_gateway2: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :keyword local_network_gateway2: The reference to local network gateway resource. + :paramtype local_network_gateway2: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkConnectionGatewayReference + :keyword connection_type: Gateway connection type. Required. Known values are: "IPsec", + "Vnet2Vnet", "ExpressRoute", and "VPNClient". + :paramtype connection_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionType + :keyword connection_protocol: Connection protocol used for this connection. Known values are: + "IKEv2" and "IKEv1". + :paramtype connection_protocol: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :keyword routing_weight: The routing weight. + :paramtype routing_weight: int + :keyword connection_mode: The connection mode for this connection. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :paramtype connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionMode + :keyword shared_key: The IPSec shared key. + :paramtype shared_key: str + :keyword peer: The reference to peerings resource. + :paramtype peer: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword enable_bgp: EnableBgp flag. + :paramtype enable_bgp: bool + :keyword gateway_custom_bgp_ip_addresses: GatewayCustomBgpIpAddresses to be used for virtual + network gateway Connection. + :paramtype gateway_custom_bgp_ip_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :keyword use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :paramtype use_policy_based_traffic_selectors: bool + :keyword ipsec_policies: The IPSec Policies to be considered by this connection. + :paramtype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :paramtype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :keyword express_route_gateway_bypass: Bypass ExpressRoute Gateway for data forwarding. + :paramtype express_route_gateway_bypass: bool + :keyword enable_private_link_fast_path: Bypass the ExpressRoute gateway when accessing + private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + :paramtype enable_private_link_fast_path: bool + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.authorization_key = authorization_key + self.virtual_network_gateway1 = virtual_network_gateway1 + self.virtual_network_gateway2 = virtual_network_gateway2 + self.local_network_gateway2 = local_network_gateway2 + self.connection_type = connection_type + self.connection_protocol = connection_protocol + self.routing_weight = routing_weight + self.connection_mode = connection_mode + self.shared_key = shared_key + self.connection_status = None + self.tunnel_connection_status = None + self.egress_bytes_transferred = None + self.ingress_bytes_transferred = None + self.peer = peer + self.enable_bgp = enable_bgp + self.gateway_custom_bgp_ip_addresses = gateway_custom_bgp_ip_addresses + self.use_policy_based_traffic_selectors = use_policy_based_traffic_selectors + self.ipsec_policies = ipsec_policies + self.traffic_selector_policies = traffic_selector_policies + self.resource_guid = None + self.provisioning_state = None + self.express_route_gateway_bypass = express_route_gateway_bypass + self.enable_private_link_fast_path = enable_private_link_fast_path + + +class VirtualNetworkGatewayConnectionListResult(_serialization.Model): + """Response for the ListVirtualNetworkGatewayConnections API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of VirtualNetworkGatewayConnection resources that exists in a resource + group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkGatewayConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualNetworkGatewayConnection"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of VirtualNetworkGatewayConnection resources that exists in a resource + group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualNetworkGatewayIPConfiguration(SubResource): + """IP configuration for virtual network gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar private_ip_allocation_method: The private IP address allocation method. Known values are: + "Static" and "Dynamic". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :ivar subnet: The reference to the subnet resource. + :vartype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar public_ip_address: The reference to the public IP resource. + :vartype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar private_ip_address: Private IP Address for this gateway. + :vartype private_ip_address: str + :ivar provisioning_state: The provisioning state of the virtual network gateway IP + configuration resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "private_ip_address": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "private_ip_allocation_method": {"key": "properties.privateIPAllocationMethod", "type": "str"}, + "subnet": {"key": "properties.subnet", "type": "SubResource"}, + "public_ip_address": {"key": "properties.publicIPAddress", "type": "SubResource"}, + "private_ip_address": {"key": "properties.privateIPAddress", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "_models.IPAllocationMethod"]] = None, + subnet: Optional["_models.SubResource"] = None, + public_ip_address: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword private_ip_allocation_method: The private IP address allocation method. Known values + are: "Static" and "Dynamic". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.network.v2023_09_01.models.IPAllocationMethod + :keyword subnet: The reference to the subnet resource. + :paramtype subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword public_ip_address: The reference to the public IP resource. + :paramtype public_ip_address: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + self.public_ip_address = public_ip_address + self.private_ip_address = None + self.provisioning_state = None + + +class VirtualNetworkGatewayListConnectionsResult(_serialization.Model): + """Response for the VirtualNetworkGatewayListConnections API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of VirtualNetworkGatewayConnection resources that exists in a resource + group. + :vartype value: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionListEntity] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkGatewayConnectionListEntity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualNetworkGatewayConnectionListEntity"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of VirtualNetworkGatewayConnection resources that exists in a resource + group. + :paramtype value: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionListEntity] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualNetworkGatewayListResult(_serialization.Model): + """Response for the ListVirtualNetworkGateways API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of VirtualNetworkGateway resources that exists in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkGateway]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.VirtualNetworkGateway"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of VirtualNetworkGateway resources that exists in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualNetworkGatewayNatRule(SubResource): + """VirtualNetworkGatewayNatRule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The provisioning state of the NAT Rule resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar type_properties_type: The type of NAT rule for VPN NAT. Known values are: "Static" and + "Dynamic". + :vartype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleType + :ivar mode: The Source NAT direction of a VPN NAT. Known values are: "EgressSnat" and + "IngressSnat". + :vartype mode: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMode + :ivar internal_mappings: The private IP address internal mapping for NAT. + :vartype internal_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :ivar external_mappings: The private IP address external mapping for NAT. + :vartype external_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :ivar ip_configuration_id: The IP Configuration ID this NAT rule applies to. + :vartype ip_configuration_id: str + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "internal_mappings": {"key": "properties.internalMappings", "type": "[VpnNatRuleMapping]"}, + "external_mappings": {"key": "properties.externalMappings", "type": "[VpnNatRuleMapping]"}, + "ip_configuration_id": {"key": "properties.ipConfigurationId", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type_properties_type: Optional[Union[str, "_models.VpnNatRuleType"]] = None, + mode: Optional[Union[str, "_models.VpnNatRuleMode"]] = None, + internal_mappings: Optional[List["_models.VpnNatRuleMapping"]] = None, + external_mappings: Optional[List["_models.VpnNatRuleMapping"]] = None, + ip_configuration_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type_properties_type: The type of NAT rule for VPN NAT. Known values are: "Static" and + "Dynamic". + :paramtype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleType + :keyword mode: The Source NAT direction of a VPN NAT. Known values are: "EgressSnat" and + "IngressSnat". + :paramtype mode: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMode + :keyword internal_mappings: The private IP address internal mapping for NAT. + :paramtype internal_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :keyword external_mappings: The private IP address external mapping for NAT. + :paramtype external_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :keyword ip_configuration_id: The IP Configuration ID this NAT rule applies to. + :paramtype ip_configuration_id: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.provisioning_state = None + self.type_properties_type = type_properties_type + self.mode = mode + self.internal_mappings = internal_mappings + self.external_mappings = external_mappings + self.ip_configuration_id = ip_configuration_id + + +class VirtualNetworkGatewayPolicyGroup(SubResource): + """Parameters for VirtualNetworkGatewayPolicyGroup. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar is_default: Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. + :vartype is_default: bool + :ivar priority: Priority for VirtualNetworkGatewayPolicyGroup. + :vartype priority: int + :ivar policy_members: Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. + :vartype policy_members: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayPolicyGroupMember] + :ivar vng_client_connection_configurations: List of references to + vngClientConnectionConfigurations. + :vartype vng_client_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the VirtualNetworkGatewayPolicyGroup + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "vng_client_connection_configurations": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "is_default": {"key": "properties.isDefault", "type": "bool"}, + "priority": {"key": "properties.priority", "type": "int"}, + "policy_members": {"key": "properties.policyMembers", "type": "[VirtualNetworkGatewayPolicyGroupMember]"}, + "vng_client_connection_configurations": { + "key": "properties.vngClientConnectionConfigurations", + "type": "[SubResource]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + is_default: Optional[bool] = None, + priority: Optional[int] = None, + policy_members: Optional[List["_models.VirtualNetworkGatewayPolicyGroupMember"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword is_default: Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. + :paramtype is_default: bool + :keyword priority: Priority for VirtualNetworkGatewayPolicyGroup. + :paramtype priority: int + :keyword policy_members: Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. + :paramtype policy_members: + list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayPolicyGroupMember] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.is_default = is_default + self.priority = priority + self.policy_members = policy_members + self.vng_client_connection_configurations = None + self.provisioning_state = None + + +class VirtualNetworkGatewayPolicyGroupMember(_serialization.Model): + """Vpn Client Connection configuration PolicyGroup member. + + :ivar name: Name of the VirtualNetworkGatewayPolicyGroupMember. + :vartype name: str + :ivar attribute_type: The Vpn Policy member attribute type. Known values are: + "CertificateGroupId", "AADGroupId", and "RadiusAzureGroupId". + :vartype attribute_type: str or + ~azure.mgmt.network.v2023_09_01.models.VpnPolicyMemberAttributeType + :ivar attribute_value: The value of Attribute used for this + VirtualNetworkGatewayPolicyGroupMember. + :vartype attribute_value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "attribute_type": {"key": "attributeType", "type": "str"}, + "attribute_value": {"key": "attributeValue", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + attribute_type: Optional[Union[str, "_models.VpnPolicyMemberAttributeType"]] = None, + attribute_value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the VirtualNetworkGatewayPolicyGroupMember. + :paramtype name: str + :keyword attribute_type: The Vpn Policy member attribute type. Known values are: + "CertificateGroupId", "AADGroupId", and "RadiusAzureGroupId". + :paramtype attribute_type: str or + ~azure.mgmt.network.v2023_09_01.models.VpnPolicyMemberAttributeType + :keyword attribute_value: The value of Attribute used for this + VirtualNetworkGatewayPolicyGroupMember. + :paramtype attribute_value: str + """ + super().__init__(**kwargs) + self.name = name + self.attribute_type = attribute_type + self.attribute_value = attribute_value + + +class VirtualNetworkGatewaySku(_serialization.Model): + """VirtualNetworkGatewaySku details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Gateway SKU name. Known values are: "Basic", "HighPerformance", "Standard", + "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", + "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ", and "ErGwScale". + :vartype name: str or ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySkuName + :ivar tier: Gateway SKU tier. Known values are: "Basic", "HighPerformance", "Standard", + "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", + "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ", and "ErGwScale". + :vartype tier: str or ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySkuTier + :ivar capacity: The capacity. + :vartype capacity: int + """ + + _validation = { + "capacity": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.VirtualNetworkGatewaySkuName"]] = None, + tier: Optional[Union[str, "_models.VirtualNetworkGatewaySkuTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Gateway SKU name. Known values are: "Basic", "HighPerformance", "Standard", + "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", + "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ", and "ErGwScale". + :paramtype name: str or ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySkuName + :keyword tier: Gateway SKU tier. Known values are: "Basic", "HighPerformance", "Standard", + "UltraPerformance", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5", "VpnGw1AZ", "VpnGw2AZ", + "VpnGw3AZ", "VpnGw4AZ", "VpnGw5AZ", "ErGw1AZ", "ErGw2AZ", "ErGw3AZ", and "ErGwScale". + :paramtype tier: str or ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewaySkuTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = None + + +class VirtualNetworkListResult(_serialization.Model): + """Response for the ListVirtualNetworks API service call. + + :ivar value: A list of VirtualNetwork resources in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of VirtualNetwork resources in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualNetworkListUsageResult(_serialization.Model): + """Response for the virtual networks GetUsage API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: VirtualNetwork usage stats. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkUsage] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkUsage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class VirtualNetworkPeering(SubResource): # pylint: disable=too-many-instance-attributes + """Peerings in a virtual network resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar allow_virtual_network_access: Whether the VMs in the local virtual network space would be + able to access the VMs in remote virtual network space. + :vartype allow_virtual_network_access: bool + :ivar allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local virtual + network will be allowed/disallowed in remote virtual network. + :vartype allow_forwarded_traffic: bool + :ivar allow_gateway_transit: If gateway links can be used in remote virtual networking to link + to this virtual network. + :vartype allow_gateway_transit: bool + :ivar use_remote_gateways: If remote gateways can be used on this virtual network. If the flag + is set to true, and allowGatewayTransit on remote peering is also true, virtual network will + use gateways of remote virtual network for transit. Only one peering can have this flag set to + true. This flag cannot be set if virtual network already has a gateway. + :vartype use_remote_gateways: bool + :ivar remote_virtual_network: The reference to the remote virtual network. The remote virtual + network can be in the same or different region (preview). See here to register for the preview + and learn more + (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + :vartype remote_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar remote_address_space: The reference to the address space peered with the remote virtual + network. + :vartype remote_address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar remote_virtual_network_address_space: The reference to the current address space of the + remote virtual network. + :vartype remote_virtual_network_address_space: + ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar remote_bgp_communities: The reference to the remote virtual network's Bgp Communities. + :vartype remote_bgp_communities: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkBgpCommunities + :ivar remote_virtual_network_encryption: The reference to the remote virtual network's + encryption. + :vartype remote_virtual_network_encryption: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkEncryption + :ivar peering_state: The status of the virtual network peering. Known values are: "Initiated", + "Connected", and "Disconnected". + :vartype peering_state: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeeringState + :ivar peering_sync_level: The peering sync status of the virtual network peering. Known values + are: "FullyInSync", "RemoteNotInSync", "LocalNotInSync", and "LocalAndRemoteNotInSync". + :vartype peering_sync_level: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeeringLevel + :ivar provisioning_state: The provisioning state of the virtual network peering resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar do_not_verify_remote_gateways: If we need to verify the provisioning state of the remote + gateway. + :vartype do_not_verify_remote_gateways: bool + :ivar resource_guid: The resourceGuid property of the Virtual Network peering resource. + :vartype resource_guid: str + """ + + _validation = { + "etag": {"readonly": True}, + "remote_virtual_network_encryption": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_guid": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "allow_virtual_network_access": {"key": "properties.allowVirtualNetworkAccess", "type": "bool"}, + "allow_forwarded_traffic": {"key": "properties.allowForwardedTraffic", "type": "bool"}, + "allow_gateway_transit": {"key": "properties.allowGatewayTransit", "type": "bool"}, + "use_remote_gateways": {"key": "properties.useRemoteGateways", "type": "bool"}, + "remote_virtual_network": {"key": "properties.remoteVirtualNetwork", "type": "SubResource"}, + "remote_address_space": {"key": "properties.remoteAddressSpace", "type": "AddressSpace"}, + "remote_virtual_network_address_space": { + "key": "properties.remoteVirtualNetworkAddressSpace", + "type": "AddressSpace", + }, + "remote_bgp_communities": {"key": "properties.remoteBgpCommunities", "type": "VirtualNetworkBgpCommunities"}, + "remote_virtual_network_encryption": { + "key": "properties.remoteVirtualNetworkEncryption", + "type": "VirtualNetworkEncryption", + }, + "peering_state": {"key": "properties.peeringState", "type": "str"}, + "peering_sync_level": {"key": "properties.peeringSyncLevel", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "do_not_verify_remote_gateways": {"key": "properties.doNotVerifyRemoteGateways", "type": "bool"}, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + allow_virtual_network_access: Optional[bool] = None, + allow_forwarded_traffic: Optional[bool] = None, + allow_gateway_transit: Optional[bool] = None, + use_remote_gateways: Optional[bool] = None, + remote_virtual_network: Optional["_models.SubResource"] = None, + remote_address_space: Optional["_models.AddressSpace"] = None, + remote_virtual_network_address_space: Optional["_models.AddressSpace"] = None, + remote_bgp_communities: Optional["_models.VirtualNetworkBgpCommunities"] = None, + peering_state: Optional[Union[str, "_models.VirtualNetworkPeeringState"]] = None, + peering_sync_level: Optional[Union[str, "_models.VirtualNetworkPeeringLevel"]] = None, + do_not_verify_remote_gateways: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type: Resource type. + :paramtype type: str + :keyword allow_virtual_network_access: Whether the VMs in the local virtual network space would + be able to access the VMs in remote virtual network space. + :paramtype allow_virtual_network_access: bool + :keyword allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local + virtual network will be allowed/disallowed in remote virtual network. + :paramtype allow_forwarded_traffic: bool + :keyword allow_gateway_transit: If gateway links can be used in remote virtual networking to + link to this virtual network. + :paramtype allow_gateway_transit: bool + :keyword use_remote_gateways: If remote gateways can be used on this virtual network. If the + flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network + will use gateways of remote virtual network for transit. Only one peering can have this flag + set to true. This flag cannot be set if virtual network already has a gateway. + :paramtype use_remote_gateways: bool + :keyword remote_virtual_network: The reference to the remote virtual network. The remote + virtual network can be in the same or different region (preview). See here to register for the + preview and learn more + (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + :paramtype remote_virtual_network: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword remote_address_space: The reference to the address space peered with the remote + virtual network. + :paramtype remote_address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword remote_virtual_network_address_space: The reference to the current address space of + the remote virtual network. + :paramtype remote_virtual_network_address_space: + ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword remote_bgp_communities: The reference to the remote virtual network's Bgp Communities. + :paramtype remote_bgp_communities: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkBgpCommunities + :keyword peering_state: The status of the virtual network peering. Known values are: + "Initiated", "Connected", and "Disconnected". + :paramtype peering_state: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeeringState + :keyword peering_sync_level: The peering sync status of the virtual network peering. Known + values are: "FullyInSync", "RemoteNotInSync", "LocalNotInSync", and "LocalAndRemoteNotInSync". + :paramtype peering_sync_level: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeeringLevel + :keyword do_not_verify_remote_gateways: If we need to verify the provisioning state of the + remote gateway. + :paramtype do_not_verify_remote_gateways: bool + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = type + self.allow_virtual_network_access = allow_virtual_network_access + self.allow_forwarded_traffic = allow_forwarded_traffic + self.allow_gateway_transit = allow_gateway_transit + self.use_remote_gateways = use_remote_gateways + self.remote_virtual_network = remote_virtual_network + self.remote_address_space = remote_address_space + self.remote_virtual_network_address_space = remote_virtual_network_address_space + self.remote_bgp_communities = remote_bgp_communities + self.remote_virtual_network_encryption = None + self.peering_state = peering_state + self.peering_sync_level = peering_sync_level + self.provisioning_state = None + self.do_not_verify_remote_gateways = do_not_verify_remote_gateways + self.resource_guid = None + + +class VirtualNetworkPeeringListResult(_serialization.Model): + """Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual + network. + + :ivar value: The peerings in a virtual network. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkPeering]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualNetworkPeering"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The peerings in a virtual network. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualNetworkTap(Resource): # pylint: disable=too-many-instance-attributes + """Virtual Network Tap resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar network_interface_tap_configurations: Specifies the list of resource IDs for the network + interface IP configuration that needs to be tapped. + :vartype network_interface_tap_configurations: + list[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :ivar resource_guid: The resource GUID property of the virtual network tap resource. + :vartype resource_guid: str + :ivar provisioning_state: The provisioning state of the virtual network tap resource. Known + values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar destination_network_interface_ip_configuration: The reference to the private IP Address + of the collector nic that will receive the tap. + :vartype destination_network_interface_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :ivar destination_load_balancer_front_end_ip_configuration: The reference to the private IP + address on the internal Load Balancer that will receive the tap. + :vartype destination_load_balancer_front_end_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration + :ivar destination_port: The VXLAN destination port that will receive the tapped traffic. + :vartype destination_port: int + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "network_interface_tap_configurations": {"readonly": True}, + "resource_guid": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "network_interface_tap_configurations": { + "key": "properties.networkInterfaceTapConfigurations", + "type": "[NetworkInterfaceTapConfiguration]", + }, + "resource_guid": {"key": "properties.resourceGuid", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "destination_network_interface_ip_configuration": { + "key": "properties.destinationNetworkInterfaceIPConfiguration", + "type": "NetworkInterfaceIPConfiguration", + }, + "destination_load_balancer_front_end_ip_configuration": { + "key": "properties.destinationLoadBalancerFrontEndIPConfiguration", + "type": "FrontendIPConfiguration", + }, + "destination_port": {"key": "properties.destinationPort", "type": "int"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + destination_network_interface_ip_configuration: Optional["_models.NetworkInterfaceIPConfiguration"] = None, + destination_load_balancer_front_end_ip_configuration: Optional["_models.FrontendIPConfiguration"] = None, + destination_port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword destination_network_interface_ip_configuration: The reference to the private IP + Address of the collector nic that will receive the tap. + :paramtype destination_network_interface_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :keyword destination_load_balancer_front_end_ip_configuration: The reference to the private IP + address on the internal Load Balancer that will receive the tap. + :paramtype destination_load_balancer_front_end_ip_configuration: + ~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration + :keyword destination_port: The VXLAN destination port that will receive the tapped traffic. + :paramtype destination_port: int + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.network_interface_tap_configurations = None + self.resource_guid = None + self.provisioning_state = None + self.destination_network_interface_ip_configuration = destination_network_interface_ip_configuration + self.destination_load_balancer_front_end_ip_configuration = destination_load_balancer_front_end_ip_configuration + self.destination_port = destination_port + + +class VirtualNetworkTapListResult(_serialization.Model): + """Response for ListVirtualNetworkTap API service call. + + :ivar value: A list of VirtualNetworkTaps in a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkTap]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualNetworkTap"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of VirtualNetworkTaps in a resource group. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualNetworkUsage(_serialization.Model): + """Usage details for subnet. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar current_value: Indicates number of IPs used from the Subnet. + :vartype current_value: float + :ivar id: Subnet identifier. + :vartype id: str + :ivar limit: Indicates the size of the subnet. + :vartype limit: float + :ivar name: The name containing common and localized value for usage. + :vartype name: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkUsageName + :ivar unit: Usage units. Returns 'Count'. + :vartype unit: str + """ + + _validation = { + "current_value": {"readonly": True}, + "id": {"readonly": True}, + "limit": {"readonly": True}, + "name": {"readonly": True}, + "unit": {"readonly": True}, + } + + _attribute_map = { + "current_value": {"key": "currentValue", "type": "float"}, + "id": {"key": "id", "type": "str"}, + "limit": {"key": "limit", "type": "float"}, + "name": {"key": "name", "type": "VirtualNetworkUsageName"}, + "unit": {"key": "unit", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.current_value = None + self.id = None + self.limit = None + self.name = None + self.unit = None + + +class VirtualNetworkUsageName(_serialization.Model): + """Usage strings container. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar localized_value: Localized subnet size and usage string. + :vartype localized_value: str + :ivar value: Subnet size and usage string. + :vartype value: str + """ + + _validation = { + "localized_value": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "localized_value": {"key": "localizedValue", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.localized_value = None + self.value = None + + +class VirtualRouter(Resource): # pylint: disable=too-many-instance-attributes + """VirtualRouter Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar virtual_router_asn: VirtualRouter ASN. + :vartype virtual_router_asn: int + :ivar virtual_router_ips: VirtualRouter IPs. + :vartype virtual_router_ips: list[str] + :ivar hosted_subnet: The Subnet on which VirtualRouter is hosted. + :vartype hosted_subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar hosted_gateway: The Gateway on which VirtualRouter is hosted. + :vartype hosted_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar peerings: List of references to VirtualRouterPeerings. + :vartype peerings: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "virtual_router_asn": {"maximum": 4294967295, "minimum": 0}, + "peerings": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "virtual_router_asn": {"key": "properties.virtualRouterAsn", "type": "int"}, + "virtual_router_ips": {"key": "properties.virtualRouterIps", "type": "[str]"}, + "hosted_subnet": {"key": "properties.hostedSubnet", "type": "SubResource"}, + "hosted_gateway": {"key": "properties.hostedGateway", "type": "SubResource"}, + "peerings": {"key": "properties.peerings", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + virtual_router_asn: Optional[int] = None, + virtual_router_ips: Optional[List[str]] = None, + hosted_subnet: Optional["_models.SubResource"] = None, + hosted_gateway: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword virtual_router_asn: VirtualRouter ASN. + :paramtype virtual_router_asn: int + :keyword virtual_router_ips: VirtualRouter IPs. + :paramtype virtual_router_ips: list[str] + :keyword hosted_subnet: The Subnet on which VirtualRouter is hosted. + :paramtype hosted_subnet: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword hosted_gateway: The Gateway on which VirtualRouter is hosted. + :paramtype hosted_gateway: ~azure.mgmt.network.v2023_09_01.models.SubResource + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.virtual_router_asn = virtual_router_asn + self.virtual_router_ips = virtual_router_ips + self.hosted_subnet = hosted_subnet + self.hosted_gateway = hosted_gateway + self.peerings = None + self.provisioning_state = None + + +class VirtualRouterAutoScaleConfiguration(_serialization.Model): + """The VirtualHub Router autoscale configuration. + + :ivar min_capacity: The minimum number of scale units for VirtualHub Router. + :vartype min_capacity: int + """ + + _validation = { + "min_capacity": {"minimum": 0}, + } + + _attribute_map = { + "min_capacity": {"key": "minCapacity", "type": "int"}, + } + + def __init__(self, *, min_capacity: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword min_capacity: The minimum number of scale units for VirtualHub Router. + :paramtype min_capacity: int + """ + super().__init__(**kwargs) + self.min_capacity = min_capacity + + +class VirtualRouterListResult(_serialization.Model): + """Response for ListVirtualRouters API service call. + + :ivar value: List of Virtual Routers. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualRouter]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualRouter"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Virtual Routers. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualRouterPeering(SubResource): + """Virtual Router Peering resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Name of the virtual router peering that is unique within a virtual router. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Peering type. + :vartype type: str + :ivar peer_asn: Peer ASN. + :vartype peer_asn: int + :ivar peer_ip: Peer IP. + :vartype peer_ip: str + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "peer_asn": {"maximum": 4294967295, "minimum": 0}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "peer_asn": {"key": "properties.peerAsn", "type": "int"}, + "peer_ip": {"key": "properties.peerIp", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + peer_asn: Optional[int] = None, + peer_ip: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Name of the virtual router peering that is unique within a virtual router. + :paramtype name: str + :keyword peer_asn: Peer ASN. + :paramtype peer_asn: int + :keyword peer_ip: Peer IP. + :paramtype peer_ip: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.peer_asn = peer_asn + self.peer_ip = peer_ip + self.provisioning_state = None + + +class VirtualRouterPeeringListResult(_serialization.Model): + """Response for ListVirtualRouterPeerings API service call. + + :ivar value: List of VirtualRouterPeerings in a VirtualRouter. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualRouterPeering]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualRouterPeering"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of VirtualRouterPeerings in a VirtualRouter. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualWAN(Resource): # pylint: disable=too-many-instance-attributes + """VirtualWAN Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar disable_vpn_encryption: Vpn encryption to be disabled or not. + :vartype disable_vpn_encryption: bool + :ivar virtual_hubs: List of VirtualHubs in the VirtualWAN. + :vartype virtual_hubs: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar vpn_sites: List of VpnSites in the VirtualWAN. + :vartype vpn_sites: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar allow_branch_to_branch_traffic: True if branch to branch traffic is allowed. + :vartype allow_branch_to_branch_traffic: bool + :ivar allow_vnet_to_vnet_traffic: True if Vnet to Vnet traffic is allowed. + :vartype allow_vnet_to_vnet_traffic: bool + :ivar office365_local_breakout_category: The office local breakout category. Known values are: + "Optimize", "OptimizeAndAllow", "All", and "None". + :vartype office365_local_breakout_category: str or + ~azure.mgmt.network.v2023_09_01.models.OfficeTrafficCategory + :ivar provisioning_state: The provisioning state of the virtual WAN resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar type_properties_type: The type of the VirtualWAN. + :vartype type_properties_type: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "virtual_hubs": {"readonly": True}, + "vpn_sites": {"readonly": True}, + "office365_local_breakout_category": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "disable_vpn_encryption": {"key": "properties.disableVpnEncryption", "type": "bool"}, + "virtual_hubs": {"key": "properties.virtualHubs", "type": "[SubResource]"}, + "vpn_sites": {"key": "properties.vpnSites", "type": "[SubResource]"}, + "allow_branch_to_branch_traffic": {"key": "properties.allowBranchToBranchTraffic", "type": "bool"}, + "allow_vnet_to_vnet_traffic": {"key": "properties.allowVnetToVnetTraffic", "type": "bool"}, + "office365_local_breakout_category": {"key": "properties.office365LocalBreakoutCategory", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + disable_vpn_encryption: Optional[bool] = None, + allow_branch_to_branch_traffic: Optional[bool] = None, + allow_vnet_to_vnet_traffic: Optional[bool] = None, + type_properties_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword disable_vpn_encryption: Vpn encryption to be disabled or not. + :paramtype disable_vpn_encryption: bool + :keyword allow_branch_to_branch_traffic: True if branch to branch traffic is allowed. + :paramtype allow_branch_to_branch_traffic: bool + :keyword allow_vnet_to_vnet_traffic: True if Vnet to Vnet traffic is allowed. + :paramtype allow_vnet_to_vnet_traffic: bool + :keyword type_properties_type: The type of the VirtualWAN. + :paramtype type_properties_type: str + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.disable_vpn_encryption = disable_vpn_encryption + self.virtual_hubs = None + self.vpn_sites = None + self.allow_branch_to_branch_traffic = allow_branch_to_branch_traffic + self.allow_vnet_to_vnet_traffic = allow_vnet_to_vnet_traffic + self.office365_local_breakout_category = None + self.provisioning_state = None + self.type_properties_type = type_properties_type + + +class VirtualWanSecurityProvider(_serialization.Model): + """Collection of SecurityProviders. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the security provider. + :vartype name: str + :ivar url: Url of the security provider. + :vartype url: str + :ivar type: Name of the security provider. Known values are: "External" and "Native". + :vartype type: str or ~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProviderType + """ + + _validation = { + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the security provider. + :paramtype name: str + :keyword url: Url of the security provider. + :paramtype url: str + """ + super().__init__(**kwargs) + self.name = name + self.url = url + self.type = None + + +class VirtualWanSecurityProviders(_serialization.Model): + """Collection of SecurityProviders. + + :ivar supported_providers: List of VirtualWAN security providers. + :vartype supported_providers: + list[~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProvider] + """ + + _attribute_map = { + "supported_providers": {"key": "supportedProviders", "type": "[VirtualWanSecurityProvider]"}, + } + + def __init__( + self, *, supported_providers: Optional[List["_models.VirtualWanSecurityProvider"]] = None, **kwargs: Any + ) -> None: + """ + :keyword supported_providers: List of VirtualWAN security providers. + :paramtype supported_providers: + list[~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProvider] + """ + super().__init__(**kwargs) + self.supported_providers = supported_providers + + +class VirtualWanVpnProfileParameters(_serialization.Model): + """Virtual Wan Vpn profile parameters Vpn profile generation. + + :ivar vpn_server_configuration_resource_id: VpnServerConfiguration partial resource uri with + which VirtualWan is associated to. + :vartype vpn_server_configuration_resource_id: str + :ivar authentication_method: VPN client authentication method. Known values are: "EAPTLS" and + "EAPMSCHAPv2". + :vartype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + """ + + _attribute_map = { + "vpn_server_configuration_resource_id": {"key": "vpnServerConfigurationResourceId", "type": "str"}, + "authentication_method": {"key": "authenticationMethod", "type": "str"}, + } + + def __init__( + self, + *, + vpn_server_configuration_resource_id: Optional[str] = None, + authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vpn_server_configuration_resource_id: VpnServerConfiguration partial resource uri with + which VirtualWan is associated to. + :paramtype vpn_server_configuration_resource_id: str + :keyword authentication_method: VPN client authentication method. Known values are: "EAPTLS" + and "EAPMSCHAPv2". + :paramtype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + """ + super().__init__(**kwargs) + self.vpn_server_configuration_resource_id = vpn_server_configuration_resource_id + self.authentication_method = authentication_method + + +class VM(Resource): + """Describes a Virtual Machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + + +class VnetRoute(_serialization.Model): + """List of routes that control routing from VirtualHub into a virtual network connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar static_routes_config: Configuration for static routes on this HubVnetConnection. + :vartype static_routes_config: ~azure.mgmt.network.v2023_09_01.models.StaticRoutesConfig + :ivar static_routes: List of all Static Routes. + :vartype static_routes: list[~azure.mgmt.network.v2023_09_01.models.StaticRoute] + :ivar bgp_connections: The list of references to HubBgpConnection objects. + :vartype bgp_connections: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "bgp_connections": {"readonly": True}, + } + + _attribute_map = { + "static_routes_config": {"key": "staticRoutesConfig", "type": "StaticRoutesConfig"}, + "static_routes": {"key": "staticRoutes", "type": "[StaticRoute]"}, + "bgp_connections": {"key": "bgpConnections", "type": "[SubResource]"}, + } + + def __init__( + self, + *, + static_routes_config: Optional["_models.StaticRoutesConfig"] = None, + static_routes: Optional[List["_models.StaticRoute"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword static_routes_config: Configuration for static routes on this HubVnetConnection. + :paramtype static_routes_config: ~azure.mgmt.network.v2023_09_01.models.StaticRoutesConfig + :keyword static_routes: List of all Static Routes. + :paramtype static_routes: list[~azure.mgmt.network.v2023_09_01.models.StaticRoute] + """ + super().__init__(**kwargs) + self.static_routes_config = static_routes_config + self.static_routes = static_routes + self.bgp_connections = None + + +class VngClientConnectionConfiguration(SubResource): + """A vpn client connection configuration for client connection configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :vartype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar virtual_network_gateway_policy_groups: List of references to + virtualNetworkGatewayPolicyGroups. + :vartype virtual_network_gateway_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the VngClientConnectionConfiguration + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "vpn_client_address_pool": {"key": "properties.vpnClientAddressPool", "type": "AddressSpace"}, + "virtual_network_gateway_policy_groups": { + "key": "properties.virtualNetworkGatewayPolicyGroups", + "type": "[SubResource]", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + vpn_client_address_pool: Optional["_models.AddressSpace"] = None, + virtual_network_gateway_policy_groups: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :paramtype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword virtual_network_gateway_policy_groups: List of references to + virtualNetworkGatewayPolicyGroups. + :paramtype virtual_network_gateway_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.vpn_client_address_pool = vpn_client_address_pool + self.virtual_network_gateway_policy_groups = virtual_network_gateway_policy_groups + self.provisioning_state = None + + +class VpnClientConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes + """VpnClientConfiguration for P2S client. + + :ivar vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :vartype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar vpn_client_root_certificates: VpnClientRootCertificate for virtual network gateway. + :vartype vpn_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnClientRootCertificate] + :ivar vpn_client_revoked_certificates: VpnClientRevokedCertificate for Virtual network gateway. + :vartype vpn_client_revoked_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnClientRevokedCertificate] + :ivar vpn_client_protocols: VpnClientProtocols for Virtual network gateway. + :vartype vpn_client_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnClientProtocol] + :ivar vpn_authentication_types: VPN authentication types for the virtual network gateway.. + :vartype vpn_authentication_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnAuthenticationType] + :ivar vpn_client_ipsec_policies: VpnClientIpsecPolicies for virtual network gateway P2S client. + :vartype vpn_client_ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar radius_server_address: The radius server address property of the VirtualNetworkGateway + resource for vpn client connection. + :vartype radius_server_address: str + :ivar radius_server_secret: The radius secret property of the VirtualNetworkGateway resource + for vpn client connection. + :vartype radius_server_secret: str + :ivar radius_servers: The radiusServers property for multiple radius server configuration. + :vartype radius_servers: list[~azure.mgmt.network.v2023_09_01.models.RadiusServer] + :ivar aad_tenant: The AADTenant property of the VirtualNetworkGateway resource for vpn client + connection used for AAD authentication. + :vartype aad_tenant: str + :ivar aad_audience: The AADAudience property of the VirtualNetworkGateway resource for vpn + client connection used for AAD authentication. + :vartype aad_audience: str + :ivar aad_issuer: The AADIssuer property of the VirtualNetworkGateway resource for vpn client + connection used for AAD authentication. + :vartype aad_issuer: str + :ivar vng_client_connection_configurations: per ip address pool connection policy for virtual + network gateway P2S client. + :vartype vng_client_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.VngClientConnectionConfiguration] + """ + + _attribute_map = { + "vpn_client_address_pool": {"key": "vpnClientAddressPool", "type": "AddressSpace"}, + "vpn_client_root_certificates": {"key": "vpnClientRootCertificates", "type": "[VpnClientRootCertificate]"}, + "vpn_client_revoked_certificates": { + "key": "vpnClientRevokedCertificates", + "type": "[VpnClientRevokedCertificate]", + }, + "vpn_client_protocols": {"key": "vpnClientProtocols", "type": "[str]"}, + "vpn_authentication_types": {"key": "vpnAuthenticationTypes", "type": "[str]"}, + "vpn_client_ipsec_policies": {"key": "vpnClientIpsecPolicies", "type": "[IpsecPolicy]"}, + "radius_server_address": {"key": "radiusServerAddress", "type": "str"}, + "radius_server_secret": {"key": "radiusServerSecret", "type": "str"}, + "radius_servers": {"key": "radiusServers", "type": "[RadiusServer]"}, + "aad_tenant": {"key": "aadTenant", "type": "str"}, + "aad_audience": {"key": "aadAudience", "type": "str"}, + "aad_issuer": {"key": "aadIssuer", "type": "str"}, + "vng_client_connection_configurations": { + "key": "vngClientConnectionConfigurations", + "type": "[VngClientConnectionConfiguration]", + }, + } + + def __init__( + self, + *, + vpn_client_address_pool: Optional["_models.AddressSpace"] = None, + vpn_client_root_certificates: Optional[List["_models.VpnClientRootCertificate"]] = None, + vpn_client_revoked_certificates: Optional[List["_models.VpnClientRevokedCertificate"]] = None, + vpn_client_protocols: Optional[List[Union[str, "_models.VpnClientProtocol"]]] = None, + vpn_authentication_types: Optional[List[Union[str, "_models.VpnAuthenticationType"]]] = None, + vpn_client_ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + radius_server_address: Optional[str] = None, + radius_server_secret: Optional[str] = None, + radius_servers: Optional[List["_models.RadiusServer"]] = None, + aad_tenant: Optional[str] = None, + aad_audience: Optional[str] = None, + aad_issuer: Optional[str] = None, + vng_client_connection_configurations: Optional[List["_models.VngClientConnectionConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vpn_client_address_pool: The reference to the address space resource which represents + Address space for P2S VpnClient. + :paramtype vpn_client_address_pool: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword vpn_client_root_certificates: VpnClientRootCertificate for virtual network gateway. + :paramtype vpn_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnClientRootCertificate] + :keyword vpn_client_revoked_certificates: VpnClientRevokedCertificate for Virtual network + gateway. + :paramtype vpn_client_revoked_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnClientRevokedCertificate] + :keyword vpn_client_protocols: VpnClientProtocols for Virtual network gateway. + :paramtype vpn_client_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnClientProtocol] + :keyword vpn_authentication_types: VPN authentication types for the virtual network gateway.. + :paramtype vpn_authentication_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnAuthenticationType] + :keyword vpn_client_ipsec_policies: VpnClientIpsecPolicies for virtual network gateway P2S + client. + :paramtype vpn_client_ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword radius_server_address: The radius server address property of the VirtualNetworkGateway + resource for vpn client connection. + :paramtype radius_server_address: str + :keyword radius_server_secret: The radius secret property of the VirtualNetworkGateway resource + for vpn client connection. + :paramtype radius_server_secret: str + :keyword radius_servers: The radiusServers property for multiple radius server configuration. + :paramtype radius_servers: list[~azure.mgmt.network.v2023_09_01.models.RadiusServer] + :keyword aad_tenant: The AADTenant property of the VirtualNetworkGateway resource for vpn + client connection used for AAD authentication. + :paramtype aad_tenant: str + :keyword aad_audience: The AADAudience property of the VirtualNetworkGateway resource for vpn + client connection used for AAD authentication. + :paramtype aad_audience: str + :keyword aad_issuer: The AADIssuer property of the VirtualNetworkGateway resource for vpn + client connection used for AAD authentication. + :paramtype aad_issuer: str + :keyword vng_client_connection_configurations: per ip address pool connection policy for + virtual network gateway P2S client. + :paramtype vng_client_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.VngClientConnectionConfiguration] + """ + super().__init__(**kwargs) + self.vpn_client_address_pool = vpn_client_address_pool + self.vpn_client_root_certificates = vpn_client_root_certificates + self.vpn_client_revoked_certificates = vpn_client_revoked_certificates + self.vpn_client_protocols = vpn_client_protocols + self.vpn_authentication_types = vpn_authentication_types + self.vpn_client_ipsec_policies = vpn_client_ipsec_policies + self.radius_server_address = radius_server_address + self.radius_server_secret = radius_server_secret + self.radius_servers = radius_servers + self.aad_tenant = aad_tenant + self.aad_audience = aad_audience + self.aad_issuer = aad_issuer + self.vng_client_connection_configurations = vng_client_connection_configurations + + +class VpnClientConnectionHealth(_serialization.Model): + """VpnClientConnectionHealth properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_ingress_bytes_transferred: Total of the Ingress Bytes Transferred in this P2S Vpn + connection. + :vartype total_ingress_bytes_transferred: int + :ivar total_egress_bytes_transferred: Total of the Egress Bytes Transferred in this connection. + :vartype total_egress_bytes_transferred: int + :ivar vpn_client_connections_count: The total of p2s vpn clients connected at this time to this + P2SVpnGateway. + :vartype vpn_client_connections_count: int + :ivar allocated_ip_addresses: List of allocated ip addresses to the connected p2s vpn clients. + :vartype allocated_ip_addresses: list[str] + """ + + _validation = { + "total_ingress_bytes_transferred": {"readonly": True}, + "total_egress_bytes_transferred": {"readonly": True}, + } + + _attribute_map = { + "total_ingress_bytes_transferred": {"key": "totalIngressBytesTransferred", "type": "int"}, + "total_egress_bytes_transferred": {"key": "totalEgressBytesTransferred", "type": "int"}, + "vpn_client_connections_count": {"key": "vpnClientConnectionsCount", "type": "int"}, + "allocated_ip_addresses": {"key": "allocatedIpAddresses", "type": "[str]"}, + } + + def __init__( + self, + *, + vpn_client_connections_count: Optional[int] = None, + allocated_ip_addresses: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vpn_client_connections_count: The total of p2s vpn clients connected at this time to + this P2SVpnGateway. + :paramtype vpn_client_connections_count: int + :keyword allocated_ip_addresses: List of allocated ip addresses to the connected p2s vpn + clients. + :paramtype allocated_ip_addresses: list[str] + """ + super().__init__(**kwargs) + self.total_ingress_bytes_transferred = None + self.total_egress_bytes_transferred = None + self.vpn_client_connections_count = vpn_client_connections_count + self.allocated_ip_addresses = allocated_ip_addresses + + +class VpnClientConnectionHealthDetail(_serialization.Model): # pylint: disable=too-many-instance-attributes + """VPN client connection health detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vpn_connection_id: The vpn client Id. + :vartype vpn_connection_id: str + :ivar vpn_connection_duration: The duration time of a connected vpn client. + :vartype vpn_connection_duration: int + :ivar vpn_connection_time: The start time of a connected vpn client. + :vartype vpn_connection_time: str + :ivar public_ip_address: The public Ip of a connected vpn client. + :vartype public_ip_address: str + :ivar private_ip_address: The assigned private Ip of a connected vpn client. + :vartype private_ip_address: str + :ivar vpn_user_name: The user name of a connected vpn client. + :vartype vpn_user_name: str + :ivar max_bandwidth: The max band width. + :vartype max_bandwidth: int + :ivar egress_packets_transferred: The egress packets per second. + :vartype egress_packets_transferred: int + :ivar egress_bytes_transferred: The egress bytes per second. + :vartype egress_bytes_transferred: int + :ivar ingress_packets_transferred: The ingress packets per second. + :vartype ingress_packets_transferred: int + :ivar ingress_bytes_transferred: The ingress bytes per second. + :vartype ingress_bytes_transferred: int + :ivar max_packets_per_second: The max packets transferred per second. + :vartype max_packets_per_second: int + """ + + _validation = { + "vpn_connection_id": {"readonly": True}, + "vpn_connection_duration": {"readonly": True}, + "vpn_connection_time": {"readonly": True}, + "public_ip_address": {"readonly": True}, + "private_ip_address": {"readonly": True}, + "vpn_user_name": {"readonly": True}, + "max_bandwidth": {"readonly": True}, + "egress_packets_transferred": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "ingress_packets_transferred": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "max_packets_per_second": {"readonly": True}, + } + + _attribute_map = { + "vpn_connection_id": {"key": "vpnConnectionId", "type": "str"}, + "vpn_connection_duration": {"key": "vpnConnectionDuration", "type": "int"}, + "vpn_connection_time": {"key": "vpnConnectionTime", "type": "str"}, + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "privateIpAddress", "type": "str"}, + "vpn_user_name": {"key": "vpnUserName", "type": "str"}, + "max_bandwidth": {"key": "maxBandwidth", "type": "int"}, + "egress_packets_transferred": {"key": "egressPacketsTransferred", "type": "int"}, + "egress_bytes_transferred": {"key": "egressBytesTransferred", "type": "int"}, + "ingress_packets_transferred": {"key": "ingressPacketsTransferred", "type": "int"}, + "ingress_bytes_transferred": {"key": "ingressBytesTransferred", "type": "int"}, + "max_packets_per_second": {"key": "maxPacketsPerSecond", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.vpn_connection_id = None + self.vpn_connection_duration = None + self.vpn_connection_time = None + self.public_ip_address = None + self.private_ip_address = None + self.vpn_user_name = None + self.max_bandwidth = None + self.egress_packets_transferred = None + self.egress_bytes_transferred = None + self.ingress_packets_transferred = None + self.ingress_bytes_transferred = None + self.max_packets_per_second = None + + +class VpnClientConnectionHealthDetailListResult(_serialization.Model): + """List of virtual network gateway vpn client connection health. + + :ivar value: List of vpn client connection health. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.VpnClientConnectionHealthDetail] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VpnClientConnectionHealthDetail]"}, + } + + def __init__( + self, *, value: Optional[List["_models.VpnClientConnectionHealthDetail"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of vpn client connection health. + :paramtype value: list[~azure.mgmt.network.v2023_09_01.models.VpnClientConnectionHealthDetail] + """ + super().__init__(**kwargs) + self.value = value + + +class VpnClientIPsecParameters(_serialization.Model): + """An IPSec parameters for a virtual network gateway P2S connection. + + All required parameters must be populated in order to send to Azure. + + :ivar sa_life_time_seconds: The IPSec Security Association (also called Quick Mode or Phase 2 + SA) lifetime in seconds for P2S client. Required. + :vartype sa_life_time_seconds: int + :ivar sa_data_size_kilobytes: The IPSec Security Association (also called Quick Mode or Phase 2 + SA) payload size in KB for P2S client.. Required. + :vartype sa_data_size_kilobytes: int + :ivar ipsec_encryption: The IPSec encryption algorithm (IKE phase 1). Required. Known values + are: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", and + "GCMAES256". + :vartype ipsec_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IpsecEncryption + :ivar ipsec_integrity: The IPSec integrity algorithm (IKE phase 1). Required. Known values are: + "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", and "GCMAES256". + :vartype ipsec_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IpsecIntegrity + :ivar ike_encryption: The IKE encryption algorithm (IKE phase 2). Required. Known values are: + "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", and "GCMAES128". + :vartype ike_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IkeEncryption + :ivar ike_integrity: The IKE integrity algorithm (IKE phase 2). Required. Known values are: + "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", and "GCMAES128". + :vartype ike_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IkeIntegrity + :ivar dh_group: The DH Group used in IKE Phase 1 for initial SA. Required. Known values are: + "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", and + "DHGroup24". + :vartype dh_group: str or ~azure.mgmt.network.v2023_09_01.models.DhGroup + :ivar pfs_group: The Pfs Group used in IKE Phase 2 for new child SA. Required. Known values + are: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", and "PFSMM". + :vartype pfs_group: str or ~azure.mgmt.network.v2023_09_01.models.PfsGroup + """ + + _validation = { + "sa_life_time_seconds": {"required": True}, + "sa_data_size_kilobytes": {"required": True}, + "ipsec_encryption": {"required": True}, + "ipsec_integrity": {"required": True}, + "ike_encryption": {"required": True}, + "ike_integrity": {"required": True}, + "dh_group": {"required": True}, + "pfs_group": {"required": True}, + } + + _attribute_map = { + "sa_life_time_seconds": {"key": "saLifeTimeSeconds", "type": "int"}, + "sa_data_size_kilobytes": {"key": "saDataSizeKilobytes", "type": "int"}, + "ipsec_encryption": {"key": "ipsecEncryption", "type": "str"}, + "ipsec_integrity": {"key": "ipsecIntegrity", "type": "str"}, + "ike_encryption": {"key": "ikeEncryption", "type": "str"}, + "ike_integrity": {"key": "ikeIntegrity", "type": "str"}, + "dh_group": {"key": "dhGroup", "type": "str"}, + "pfs_group": {"key": "pfsGroup", "type": "str"}, + } + + def __init__( + self, + *, + sa_life_time_seconds: int, + sa_data_size_kilobytes: int, + ipsec_encryption: Union[str, "_models.IpsecEncryption"], + ipsec_integrity: Union[str, "_models.IpsecIntegrity"], + ike_encryption: Union[str, "_models.IkeEncryption"], + ike_integrity: Union[str, "_models.IkeIntegrity"], + dh_group: Union[str, "_models.DhGroup"], + pfs_group: Union[str, "_models.PfsGroup"], + **kwargs: Any + ) -> None: + """ + :keyword sa_life_time_seconds: The IPSec Security Association (also called Quick Mode or Phase + 2 SA) lifetime in seconds for P2S client. Required. + :paramtype sa_life_time_seconds: int + :keyword sa_data_size_kilobytes: The IPSec Security Association (also called Quick Mode or + Phase 2 SA) payload size in KB for P2S client.. Required. + :paramtype sa_data_size_kilobytes: int + :keyword ipsec_encryption: The IPSec encryption algorithm (IKE phase 1). Required. Known values + are: "None", "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES128", "GCMAES192", and + "GCMAES256". + :paramtype ipsec_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IpsecEncryption + :keyword ipsec_integrity: The IPSec integrity algorithm (IKE phase 1). Required. Known values + are: "MD5", "SHA1", "SHA256", "GCMAES128", "GCMAES192", and "GCMAES256". + :paramtype ipsec_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IpsecIntegrity + :keyword ike_encryption: The IKE encryption algorithm (IKE phase 2). Required. Known values + are: "DES", "DES3", "AES128", "AES192", "AES256", "GCMAES256", and "GCMAES128". + :paramtype ike_encryption: str or ~azure.mgmt.network.v2023_09_01.models.IkeEncryption + :keyword ike_integrity: The IKE integrity algorithm (IKE phase 2). Required. Known values are: + "MD5", "SHA1", "SHA256", "SHA384", "GCMAES256", and "GCMAES128". + :paramtype ike_integrity: str or ~azure.mgmt.network.v2023_09_01.models.IkeIntegrity + :keyword dh_group: The DH Group used in IKE Phase 1 for initial SA. Required. Known values are: + "None", "DHGroup1", "DHGroup2", "DHGroup14", "DHGroup2048", "ECP256", "ECP384", and + "DHGroup24". + :paramtype dh_group: str or ~azure.mgmt.network.v2023_09_01.models.DhGroup + :keyword pfs_group: The Pfs Group used in IKE Phase 2 for new child SA. Required. Known values + are: "None", "PFS1", "PFS2", "PFS2048", "ECP256", "ECP384", "PFS24", "PFS14", and "PFSMM". + :paramtype pfs_group: str or ~azure.mgmt.network.v2023_09_01.models.PfsGroup + """ + super().__init__(**kwargs) + self.sa_life_time_seconds = sa_life_time_seconds + self.sa_data_size_kilobytes = sa_data_size_kilobytes + self.ipsec_encryption = ipsec_encryption + self.ipsec_integrity = ipsec_integrity + self.ike_encryption = ike_encryption + self.ike_integrity = ike_integrity + self.dh_group = dh_group + self.pfs_group = pfs_group + + +class VpnClientParameters(_serialization.Model): + """Vpn Client Parameters for package generation. + + :ivar processor_architecture: VPN client Processor Architecture. Known values are: "Amd64" and + "X86". + :vartype processor_architecture: str or + ~azure.mgmt.network.v2023_09_01.models.ProcessorArchitecture + :ivar authentication_method: VPN client authentication method. Known values are: "EAPTLS" and + "EAPMSCHAPv2". + :vartype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + :ivar radius_server_auth_certificate: The public certificate data for the radius server + authentication certificate as a Base-64 encoded string. Required only if external radius + authentication has been configured with EAPTLS authentication. + :vartype radius_server_auth_certificate: str + :ivar client_root_certificates: A list of client root certificates public certificate data + encoded as Base-64 strings. Optional parameter for external radius based authentication with + EAPTLS. + :vartype client_root_certificates: list[str] + """ + + _attribute_map = { + "processor_architecture": {"key": "processorArchitecture", "type": "str"}, + "authentication_method": {"key": "authenticationMethod", "type": "str"}, + "radius_server_auth_certificate": {"key": "radiusServerAuthCertificate", "type": "str"}, + "client_root_certificates": {"key": "clientRootCertificates", "type": "[str]"}, + } + + def __init__( + self, + *, + processor_architecture: Optional[Union[str, "_models.ProcessorArchitecture"]] = None, + authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = None, + radius_server_auth_certificate: Optional[str] = None, + client_root_certificates: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword processor_architecture: VPN client Processor Architecture. Known values are: "Amd64" + and "X86". + :paramtype processor_architecture: str or + ~azure.mgmt.network.v2023_09_01.models.ProcessorArchitecture + :keyword authentication_method: VPN client authentication method. Known values are: "EAPTLS" + and "EAPMSCHAPv2". + :paramtype authentication_method: str or + ~azure.mgmt.network.v2023_09_01.models.AuthenticationMethod + :keyword radius_server_auth_certificate: The public certificate data for the radius server + authentication certificate as a Base-64 encoded string. Required only if external radius + authentication has been configured with EAPTLS authentication. + :paramtype radius_server_auth_certificate: str + :keyword client_root_certificates: A list of client root certificates public certificate data + encoded as Base-64 strings. Optional parameter for external radius based authentication with + EAPTLS. + :paramtype client_root_certificates: list[str] + """ + super().__init__(**kwargs) + self.processor_architecture = processor_architecture + self.authentication_method = authentication_method + self.radius_server_auth_certificate = radius_server_auth_certificate + self.client_root_certificates = client_root_certificates + + +class VpnClientRevokedCertificate(SubResource): + """VPN client revoked certificate of virtual network gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar thumbprint: The revoked VPN client certificate thumbprint. + :vartype thumbprint: str + :ivar provisioning_state: The provisioning state of the VPN client revoked certificate + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "thumbprint": {"key": "properties.thumbprint", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + thumbprint: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword thumbprint: The revoked VPN client certificate thumbprint. + :paramtype thumbprint: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.thumbprint = thumbprint + self.provisioning_state = None + + +class VpnClientRootCertificate(SubResource): + """VPN client root certificate of virtual network gateway. + + 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: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar public_cert_data: The certificate public data. Required. + :vartype public_cert_data: str + :ivar provisioning_state: The provisioning state of the VPN client root certificate resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "public_cert_data": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "public_cert_data": {"key": "properties.publicCertData", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + public_cert_data: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword public_cert_data: The certificate public data. Required. + :paramtype public_cert_data: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.public_cert_data = public_cert_data + self.provisioning_state = None + + +class VpnConnection(SubResource): # pylint: disable=too-many-instance-attributes + """VpnConnection Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar remote_vpn_site: Id of the connected vpn site. + :vartype remote_vpn_site: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar routing_weight: Routing weight for vpn connection. + :vartype routing_weight: int + :ivar dpd_timeout_seconds: DPD timeout in seconds for vpn connection. + :vartype dpd_timeout_seconds: int + :ivar connection_status: The connection status. Known values are: "Unknown", "Connecting", + "Connected", and "NotConnected". + :vartype connection_status: str or ~azure.mgmt.network.v2023_09_01.models.VpnConnectionStatus + :ivar vpn_connection_protocol_type: Connection protocol used for this connection. Known values + are: "IKEv2" and "IKEv1". + :vartype vpn_connection_protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :ivar ingress_bytes_transferred: Ingress bytes transferred. + :vartype ingress_bytes_transferred: int + :ivar egress_bytes_transferred: Egress bytes transferred. + :vartype egress_bytes_transferred: int + :ivar connection_bandwidth: Expected bandwidth in MBPS. + :vartype connection_bandwidth: int + :ivar shared_key: SharedKey for the vpn connection. + :vartype shared_key: str + :ivar enable_bgp: EnableBgp flag. + :vartype enable_bgp: bool + :ivar use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :vartype use_policy_based_traffic_selectors: bool + :ivar ipsec_policies: The IPSec Policies to be considered by this connection. + :vartype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :vartype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :ivar enable_rate_limiting: EnableBgp flag. + :vartype enable_rate_limiting: bool + :ivar enable_internet_security: Enable internet security. + :vartype enable_internet_security: bool + :ivar use_local_azure_ip_address: Use local azure ip to initiate connection. + :vartype use_local_azure_ip_address: bool + :ivar provisioning_state: The provisioning state of the VPN connection resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar vpn_link_connections: List of all vpn site link connections to the gateway. + :vartype vpn_link_connections: + list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :ivar routing_configuration: The Routing Configuration indicating the associated and propagated + route tables on this connection. + :vartype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + + _validation = { + "etag": {"readonly": True}, + "connection_status": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "remote_vpn_site": {"key": "properties.remoteVpnSite", "type": "SubResource"}, + "routing_weight": {"key": "properties.routingWeight", "type": "int"}, + "dpd_timeout_seconds": {"key": "properties.dpdTimeoutSeconds", "type": "int"}, + "connection_status": {"key": "properties.connectionStatus", "type": "str"}, + "vpn_connection_protocol_type": {"key": "properties.vpnConnectionProtocolType", "type": "str"}, + "ingress_bytes_transferred": {"key": "properties.ingressBytesTransferred", "type": "int"}, + "egress_bytes_transferred": {"key": "properties.egressBytesTransferred", "type": "int"}, + "connection_bandwidth": {"key": "properties.connectionBandwidth", "type": "int"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "enable_bgp": {"key": "properties.enableBgp", "type": "bool"}, + "use_policy_based_traffic_selectors": {"key": "properties.usePolicyBasedTrafficSelectors", "type": "bool"}, + "ipsec_policies": {"key": "properties.ipsecPolicies", "type": "[IpsecPolicy]"}, + "traffic_selector_policies": {"key": "properties.trafficSelectorPolicies", "type": "[TrafficSelectorPolicy]"}, + "enable_rate_limiting": {"key": "properties.enableRateLimiting", "type": "bool"}, + "enable_internet_security": {"key": "properties.enableInternetSecurity", "type": "bool"}, + "use_local_azure_ip_address": {"key": "properties.useLocalAzureIpAddress", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vpn_link_connections": {"key": "properties.vpnLinkConnections", "type": "[VpnSiteLinkConnection]"}, + "routing_configuration": {"key": "properties.routingConfiguration", "type": "RoutingConfiguration"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + remote_vpn_site: Optional["_models.SubResource"] = None, + routing_weight: Optional[int] = None, + dpd_timeout_seconds: Optional[int] = None, + vpn_connection_protocol_type: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionProtocol"]] = None, + connection_bandwidth: Optional[int] = None, + shared_key: Optional[str] = None, + enable_bgp: Optional[bool] = None, + use_policy_based_traffic_selectors: Optional[bool] = None, + ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + traffic_selector_policies: Optional[List["_models.TrafficSelectorPolicy"]] = None, + enable_rate_limiting: Optional[bool] = None, + enable_internet_security: Optional[bool] = None, + use_local_azure_ip_address: Optional[bool] = None, + vpn_link_connections: Optional[List["_models.VpnSiteLinkConnection"]] = None, + routing_configuration: Optional["_models.RoutingConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword remote_vpn_site: Id of the connected vpn site. + :paramtype remote_vpn_site: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword routing_weight: Routing weight for vpn connection. + :paramtype routing_weight: int + :keyword dpd_timeout_seconds: DPD timeout in seconds for vpn connection. + :paramtype dpd_timeout_seconds: int + :keyword vpn_connection_protocol_type: Connection protocol used for this connection. Known + values are: "IKEv2" and "IKEv1". + :paramtype vpn_connection_protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :keyword connection_bandwidth: Expected bandwidth in MBPS. + :paramtype connection_bandwidth: int + :keyword shared_key: SharedKey for the vpn connection. + :paramtype shared_key: str + :keyword enable_bgp: EnableBgp flag. + :paramtype enable_bgp: bool + :keyword use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :paramtype use_policy_based_traffic_selectors: bool + :keyword ipsec_policies: The IPSec Policies to be considered by this connection. + :paramtype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword traffic_selector_policies: The Traffic Selector Policies to be considered by this + connection. + :paramtype traffic_selector_policies: + list[~azure.mgmt.network.v2023_09_01.models.TrafficSelectorPolicy] + :keyword enable_rate_limiting: EnableBgp flag. + :paramtype enable_rate_limiting: bool + :keyword enable_internet_security: Enable internet security. + :paramtype enable_internet_security: bool + :keyword use_local_azure_ip_address: Use local azure ip to initiate connection. + :paramtype use_local_azure_ip_address: bool + :keyword vpn_link_connections: List of all vpn site link connections to the gateway. + :paramtype vpn_link_connections: + list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :keyword routing_configuration: The Routing Configuration indicating the associated and + propagated route tables on this connection. + :paramtype routing_configuration: ~azure.mgmt.network.v2023_09_01.models.RoutingConfiguration + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.remote_vpn_site = remote_vpn_site + self.routing_weight = routing_weight + self.dpd_timeout_seconds = dpd_timeout_seconds + self.connection_status = None + self.vpn_connection_protocol_type = vpn_connection_protocol_type + self.ingress_bytes_transferred = None + self.egress_bytes_transferred = None + self.connection_bandwidth = connection_bandwidth + self.shared_key = shared_key + self.enable_bgp = enable_bgp + self.use_policy_based_traffic_selectors = use_policy_based_traffic_selectors + self.ipsec_policies = ipsec_policies + self.traffic_selector_policies = traffic_selector_policies + self.enable_rate_limiting = enable_rate_limiting + self.enable_internet_security = enable_internet_security + self.use_local_azure_ip_address = use_local_azure_ip_address + self.provisioning_state = None + self.vpn_link_connections = vpn_link_connections + self.routing_configuration = routing_configuration + + +class VpnConnectionPacketCaptureStartParameters(_serialization.Model): + """Vpn Connection packet capture parameters supplied to start packet capture on gateway + connection. + + :ivar filter_data: Start Packet capture parameters on vpn connection. + :vartype filter_data: str + :ivar link_connection_names: List of site link connection names. + :vartype link_connection_names: list[str] + """ + + _attribute_map = { + "filter_data": {"key": "filterData", "type": "str"}, + "link_connection_names": {"key": "linkConnectionNames", "type": "[str]"}, + } + + def __init__( + self, *, filter_data: Optional[str] = None, link_connection_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword filter_data: Start Packet capture parameters on vpn connection. + :paramtype filter_data: str + :keyword link_connection_names: List of site link connection names. + :paramtype link_connection_names: list[str] + """ + super().__init__(**kwargs) + self.filter_data = filter_data + self.link_connection_names = link_connection_names + + +class VpnConnectionPacketCaptureStopParameters(_serialization.Model): + """Vpn Connection packet capture parameters supplied to stop packet capture on gateway connection. + + :ivar sas_url: SAS url for packet capture on vpn connection. + :vartype sas_url: str + :ivar link_connection_names: List of site link connection names. + :vartype link_connection_names: list[str] + """ + + _attribute_map = { + "sas_url": {"key": "sasUrl", "type": "str"}, + "link_connection_names": {"key": "linkConnectionNames", "type": "[str]"}, + } + + def __init__( + self, *, sas_url: Optional[str] = None, link_connection_names: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword sas_url: SAS url for packet capture on vpn connection. + :paramtype sas_url: str + :keyword link_connection_names: List of site link connection names. + :paramtype link_connection_names: list[str] + """ + super().__init__(**kwargs) + self.sas_url = sas_url + self.link_connection_names = link_connection_names + + +class VpnDeviceScriptParameters(_serialization.Model): + """Vpn device configuration script generation parameters. + + :ivar vendor: The vendor for the vpn device. + :vartype vendor: str + :ivar device_family: The device family for the vpn device. + :vartype device_family: str + :ivar firmware_version: The firmware version for the vpn device. + :vartype firmware_version: str + """ + + _attribute_map = { + "vendor": {"key": "vendor", "type": "str"}, + "device_family": {"key": "deviceFamily", "type": "str"}, + "firmware_version": {"key": "firmwareVersion", "type": "str"}, + } + + def __init__( + self, + *, + vendor: Optional[str] = None, + device_family: Optional[str] = None, + firmware_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword vendor: The vendor for the vpn device. + :paramtype vendor: str + :keyword device_family: The device family for the vpn device. + :paramtype device_family: str + :keyword firmware_version: The firmware version for the vpn device. + :paramtype firmware_version: str + """ + super().__init__(**kwargs) + self.vendor = vendor + self.device_family = device_family + self.firmware_version = firmware_version + + +class VpnGateway(Resource): # pylint: disable=too-many-instance-attributes + """VpnGateway Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar virtual_hub: The VirtualHub to which the gateway belongs. + :vartype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar connections: List of all vpn connections to the gateway. + :vartype connections: list[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :ivar bgp_settings: Local network gateway's BGP speaker settings. + :vartype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :ivar provisioning_state: The provisioning state of the VPN gateway resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar vpn_gateway_scale_unit: The scale unit for this vpn gateway. + :vartype vpn_gateway_scale_unit: int + :ivar ip_configurations: List of all IPs configured on the gateway. + :vartype ip_configurations: + list[~azure.mgmt.network.v2023_09_01.models.VpnGatewayIpConfiguration] + :ivar enable_bgp_route_translation_for_nat: Enable BGP routes translation for NAT on this + VpnGateway. + :vartype enable_bgp_route_translation_for_nat: bool + :ivar is_routing_preference_internet: Enable Routing Preference property for the Public IP + Interface of the VpnGateway. + :vartype is_routing_preference_internet: bool + :ivar nat_rules: List of all the nat Rules associated with the gateway. + :vartype nat_rules: list[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "ip_configurations": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "virtual_hub": {"key": "properties.virtualHub", "type": "SubResource"}, + "connections": {"key": "properties.connections", "type": "[VpnConnection]"}, + "bgp_settings": {"key": "properties.bgpSettings", "type": "BgpSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vpn_gateway_scale_unit": {"key": "properties.vpnGatewayScaleUnit", "type": "int"}, + "ip_configurations": {"key": "properties.ipConfigurations", "type": "[VpnGatewayIpConfiguration]"}, + "enable_bgp_route_translation_for_nat": {"key": "properties.enableBgpRouteTranslationForNat", "type": "bool"}, + "is_routing_preference_internet": {"key": "properties.isRoutingPreferenceInternet", "type": "bool"}, + "nat_rules": {"key": "properties.natRules", "type": "[VpnGatewayNatRule]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + virtual_hub: Optional["_models.SubResource"] = None, + connections: Optional[List["_models.VpnConnection"]] = None, + bgp_settings: Optional["_models.BgpSettings"] = None, + vpn_gateway_scale_unit: Optional[int] = None, + enable_bgp_route_translation_for_nat: Optional[bool] = None, + is_routing_preference_internet: Optional[bool] = None, + nat_rules: Optional[List["_models.VpnGatewayNatRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword virtual_hub: The VirtualHub to which the gateway belongs. + :paramtype virtual_hub: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword connections: List of all vpn connections to the gateway. + :paramtype connections: list[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :keyword bgp_settings: Local network gateway's BGP speaker settings. + :paramtype bgp_settings: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :keyword vpn_gateway_scale_unit: The scale unit for this vpn gateway. + :paramtype vpn_gateway_scale_unit: int + :keyword enable_bgp_route_translation_for_nat: Enable BGP routes translation for NAT on this + VpnGateway. + :paramtype enable_bgp_route_translation_for_nat: bool + :keyword is_routing_preference_internet: Enable Routing Preference property for the Public IP + Interface of the VpnGateway. + :paramtype is_routing_preference_internet: bool + :keyword nat_rules: List of all the nat Rules associated with the gateway. + :paramtype nat_rules: list[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.virtual_hub = virtual_hub + self.connections = connections + self.bgp_settings = bgp_settings + self.provisioning_state = None + self.vpn_gateway_scale_unit = vpn_gateway_scale_unit + self.ip_configurations = None + self.enable_bgp_route_translation_for_nat = enable_bgp_route_translation_for_nat + self.is_routing_preference_internet = is_routing_preference_internet + self.nat_rules = nat_rules + + +class VpnGatewayIpConfiguration(_serialization.Model): + """IP Configuration of a VPN Gateway Resource. + + :ivar id: The identifier of the IP configuration for a VPN Gateway. + :vartype id: str + :ivar public_ip_address: The public IP address of this IP configuration. + :vartype public_ip_address: str + :ivar private_ip_address: The private IP address of this IP configuration. + :vartype private_ip_address: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "privateIpAddress", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + public_ip_address: Optional[str] = None, + private_ip_address: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The identifier of the IP configuration for a VPN Gateway. + :paramtype id: str + :keyword public_ip_address: The public IP address of this IP configuration. + :paramtype public_ip_address: str + :keyword private_ip_address: The private IP address of this IP configuration. + :paramtype private_ip_address: str + """ + super().__init__(**kwargs) + self.id = id + self.public_ip_address = public_ip_address + self.private_ip_address = private_ip_address + + +class VpnGatewayNatRule(SubResource): # pylint: disable=too-many-instance-attributes + """VpnGatewayNatRule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: The provisioning state of the NAT Rule resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar type_properties_type: The type of NAT rule for VPN NAT. Known values are: "Static" and + "Dynamic". + :vartype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleType + :ivar mode: The Source NAT direction of a VPN NAT. Known values are: "EgressSnat" and + "IngressSnat". + :vartype mode: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMode + :ivar internal_mappings: The private IP address internal mapping for NAT. + :vartype internal_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :ivar external_mappings: The private IP address external mapping for NAT. + :vartype external_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :ivar ip_configuration_id: The IP Configuration ID this NAT rule applies to. + :vartype ip_configuration_id: str + :ivar egress_vpn_site_link_connections: List of egress VpnSiteLinkConnections. + :vartype egress_vpn_site_link_connections: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar ingress_vpn_site_link_connections: List of ingress VpnSiteLinkConnections. + :vartype ingress_vpn_site_link_connections: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "egress_vpn_site_link_connections": {"readonly": True}, + "ingress_vpn_site_link_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "internal_mappings": {"key": "properties.internalMappings", "type": "[VpnNatRuleMapping]"}, + "external_mappings": {"key": "properties.externalMappings", "type": "[VpnNatRuleMapping]"}, + "ip_configuration_id": {"key": "properties.ipConfigurationId", "type": "str"}, + "egress_vpn_site_link_connections": {"key": "properties.egressVpnSiteLinkConnections", "type": "[SubResource]"}, + "ingress_vpn_site_link_connections": { + "key": "properties.ingressVpnSiteLinkConnections", + "type": "[SubResource]", + }, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type_properties_type: Optional[Union[str, "_models.VpnNatRuleType"]] = None, + mode: Optional[Union[str, "_models.VpnNatRuleMode"]] = None, + internal_mappings: Optional[List["_models.VpnNatRuleMapping"]] = None, + external_mappings: Optional[List["_models.VpnNatRuleMapping"]] = None, + ip_configuration_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword type_properties_type: The type of NAT rule for VPN NAT. Known values are: "Static" and + "Dynamic". + :paramtype type_properties_type: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleType + :keyword mode: The Source NAT direction of a VPN NAT. Known values are: "EgressSnat" and + "IngressSnat". + :paramtype mode: str or ~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMode + :keyword internal_mappings: The private IP address internal mapping for NAT. + :paramtype internal_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :keyword external_mappings: The private IP address external mapping for NAT. + :paramtype external_mappings: list[~azure.mgmt.network.v2023_09_01.models.VpnNatRuleMapping] + :keyword ip_configuration_id: The IP Configuration ID this NAT rule applies to. + :paramtype ip_configuration_id: str + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.provisioning_state = None + self.type_properties_type = type_properties_type + self.mode = mode + self.internal_mappings = internal_mappings + self.external_mappings = external_mappings + self.ip_configuration_id = ip_configuration_id + self.egress_vpn_site_link_connections = None + self.ingress_vpn_site_link_connections = None + + +class VpnGatewayPacketCaptureStartParameters(_serialization.Model): + """Start packet capture parameters. + + :ivar filter_data: Start Packet capture parameters on vpn gateway. + :vartype filter_data: str + """ + + _attribute_map = { + "filter_data": {"key": "filterData", "type": "str"}, + } + + def __init__(self, *, filter_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword filter_data: Start Packet capture parameters on vpn gateway. + :paramtype filter_data: str + """ + super().__init__(**kwargs) + self.filter_data = filter_data + + +class VpnGatewayPacketCaptureStopParameters(_serialization.Model): + """Stop packet capture parameters. + + :ivar sas_url: SAS url for packet capture on vpn gateway. + :vartype sas_url: str + """ + + _attribute_map = { + "sas_url": {"key": "sasUrl", "type": "str"}, + } + + def __init__(self, *, sas_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword sas_url: SAS url for packet capture on vpn gateway. + :paramtype sas_url: str + """ + super().__init__(**kwargs) + self.sas_url = sas_url + + +class VpnLinkBgpSettings(_serialization.Model): + """BGP settings details for a link. + + :ivar asn: The BGP speaker's ASN. + :vartype asn: int + :ivar bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. + :vartype bgp_peering_address: str + """ + + _attribute_map = { + "asn": {"key": "asn", "type": "int"}, + "bgp_peering_address": {"key": "bgpPeeringAddress", "type": "str"}, + } + + def __init__(self, *, asn: Optional[int] = None, bgp_peering_address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword asn: The BGP speaker's ASN. + :paramtype asn: int + :keyword bgp_peering_address: The BGP peering address and BGP identifier of this BGP speaker. + :paramtype bgp_peering_address: str + """ + super().__init__(**kwargs) + self.asn = asn + self.bgp_peering_address = bgp_peering_address + + +class VpnLinkProviderProperties(_serialization.Model): + """List of properties of a link provider. + + :ivar link_provider_name: Name of the link provider. + :vartype link_provider_name: str + :ivar link_speed_in_mbps: Link speed. + :vartype link_speed_in_mbps: int + """ + + _attribute_map = { + "link_provider_name": {"key": "linkProviderName", "type": "str"}, + "link_speed_in_mbps": {"key": "linkSpeedInMbps", "type": "int"}, + } + + def __init__( + self, *, link_provider_name: Optional[str] = None, link_speed_in_mbps: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword link_provider_name: Name of the link provider. + :paramtype link_provider_name: str + :keyword link_speed_in_mbps: Link speed. + :paramtype link_speed_in_mbps: int + """ + super().__init__(**kwargs) + self.link_provider_name = link_provider_name + self.link_speed_in_mbps = link_speed_in_mbps + + +class VpnNatRuleMapping(_serialization.Model): + """Vpn NatRule mapping. + + :ivar address_space: Address space for Vpn NatRule mapping. + :vartype address_space: str + :ivar port_range: Port range for Vpn NatRule mapping. + :vartype port_range: str + """ + + _attribute_map = { + "address_space": {"key": "addressSpace", "type": "str"}, + "port_range": {"key": "portRange", "type": "str"}, + } + + def __init__(self, *, address_space: Optional[str] = None, port_range: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword address_space: Address space for Vpn NatRule mapping. + :paramtype address_space: str + :keyword port_range: Port range for Vpn NatRule mapping. + :paramtype port_range: str + """ + super().__init__(**kwargs) + self.address_space = address_space + self.port_range = port_range + + +class VpnPacketCaptureStartParameters(_serialization.Model): + """Start packet capture parameters on virtual network gateway. + + :ivar filter_data: Start Packet capture parameters. + :vartype filter_data: str + """ + + _attribute_map = { + "filter_data": {"key": "filterData", "type": "str"}, + } + + def __init__(self, *, filter_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword filter_data: Start Packet capture parameters. + :paramtype filter_data: str + """ + super().__init__(**kwargs) + self.filter_data = filter_data + + +class VpnPacketCaptureStopParameters(_serialization.Model): + """Stop packet capture parameters. + + :ivar sas_url: SAS url for packet capture on virtual network gateway. + :vartype sas_url: str + """ + + _attribute_map = { + "sas_url": {"key": "sasUrl", "type": "str"}, + } + + def __init__(self, *, sas_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword sas_url: SAS url for packet capture on virtual network gateway. + :paramtype sas_url: str + """ + super().__init__(**kwargs) + self.sas_url = sas_url + + +class VpnProfileResponse(_serialization.Model): + """Vpn Profile Response for package generation. + + :ivar profile_url: URL to the VPN profile. + :vartype profile_url: str + """ + + _attribute_map = { + "profile_url": {"key": "profileUrl", "type": "str"}, + } + + def __init__(self, *, profile_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword profile_url: URL to the VPN profile. + :paramtype profile_url: str + """ + super().__init__(**kwargs) + self.profile_url = profile_url + + +class VpnServerConfigRadiusClientRootCertificate(_serialization.Model): + """Properties of the Radius client root certificate of VpnServerConfiguration. + + :ivar name: The certificate name. + :vartype name: str + :ivar thumbprint: The Radius client root certificate thumbprint. + :vartype thumbprint: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, thumbprint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The certificate name. + :paramtype name: str + :keyword thumbprint: The Radius client root certificate thumbprint. + :paramtype thumbprint: str + """ + super().__init__(**kwargs) + self.name = name + self.thumbprint = thumbprint + + +class VpnServerConfigRadiusServerRootCertificate(_serialization.Model): + """Properties of Radius Server root certificate of VpnServerConfiguration. + + :ivar name: The certificate name. + :vartype name: str + :ivar public_cert_data: The certificate public data. + :vartype public_cert_data: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "public_cert_data": {"key": "publicCertData", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, public_cert_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The certificate name. + :paramtype name: str + :keyword public_cert_data: The certificate public data. + :paramtype public_cert_data: str + """ + super().__init__(**kwargs) + self.name = name + self.public_cert_data = public_cert_data + + +class VpnServerConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """VpnServerConfiguration Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar name_properties_name: The name of the VpnServerConfiguration that is unique within a + resource group. + :vartype name_properties_name: str + :ivar vpn_protocols: VPN protocols for the VpnServerConfiguration. + :vartype vpn_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnGatewayTunnelingProtocol] + :ivar vpn_authentication_types: VPN authentication types for the VpnServerConfiguration. + :vartype vpn_authentication_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnAuthenticationType] + :ivar vpn_client_root_certificates: VPN client root certificate of VpnServerConfiguration. + :vartype vpn_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigVpnClientRootCertificate] + :ivar vpn_client_revoked_certificates: VPN client revoked certificate of + VpnServerConfiguration. + :vartype vpn_client_revoked_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigVpnClientRevokedCertificate] + :ivar radius_server_root_certificates: Radius Server root certificate of + VpnServerConfiguration. + :vartype radius_server_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigRadiusServerRootCertificate] + :ivar radius_client_root_certificates: Radius client root certificate of + VpnServerConfiguration. + :vartype radius_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigRadiusClientRootCertificate] + :ivar vpn_client_ipsec_policies: VpnClientIpsecPolicies for VpnServerConfiguration. + :vartype vpn_client_ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar radius_server_address: The radius server address property of the VpnServerConfiguration + resource for point to site client connection. + :vartype radius_server_address: str + :ivar radius_server_secret: The radius secret property of the VpnServerConfiguration resource + for point to site client connection. + :vartype radius_server_secret: str + :ivar radius_servers: Multiple Radius Server configuration for VpnServerConfiguration. + :vartype radius_servers: list[~azure.mgmt.network.v2023_09_01.models.RadiusServer] + :ivar aad_authentication_parameters: The set of aad vpn authentication parameters. + :vartype aad_authentication_parameters: + ~azure.mgmt.network.v2023_09_01.models.AadAuthenticationParameters + :ivar provisioning_state: The provisioning state of the VpnServerConfiguration resource. + Possible values are: 'Updating', 'Deleting', and 'Failed'. + :vartype provisioning_state: str + :ivar p2_s_vpn_gateways: List of references to P2SVpnGateways. + :vartype p2_s_vpn_gateways: list[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :ivar configuration_policy_groups: List of all VpnServerConfigurationPolicyGroups. + :vartype configuration_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :ivar etag_properties_etag: A unique read-only string that changes whenever the resource is + updated. + :vartype etag_properties_etag: str + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "p2_s_vpn_gateways": {"readonly": True}, + "etag_properties_etag": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "name_properties_name": {"key": "properties.name", "type": "str"}, + "vpn_protocols": {"key": "properties.vpnProtocols", "type": "[str]"}, + "vpn_authentication_types": {"key": "properties.vpnAuthenticationTypes", "type": "[str]"}, + "vpn_client_root_certificates": { + "key": "properties.vpnClientRootCertificates", + "type": "[VpnServerConfigVpnClientRootCertificate]", + }, + "vpn_client_revoked_certificates": { + "key": "properties.vpnClientRevokedCertificates", + "type": "[VpnServerConfigVpnClientRevokedCertificate]", + }, + "radius_server_root_certificates": { + "key": "properties.radiusServerRootCertificates", + "type": "[VpnServerConfigRadiusServerRootCertificate]", + }, + "radius_client_root_certificates": { + "key": "properties.radiusClientRootCertificates", + "type": "[VpnServerConfigRadiusClientRootCertificate]", + }, + "vpn_client_ipsec_policies": {"key": "properties.vpnClientIpsecPolicies", "type": "[IpsecPolicy]"}, + "radius_server_address": {"key": "properties.radiusServerAddress", "type": "str"}, + "radius_server_secret": {"key": "properties.radiusServerSecret", "type": "str"}, + "radius_servers": {"key": "properties.radiusServers", "type": "[RadiusServer]"}, + "aad_authentication_parameters": { + "key": "properties.aadAuthenticationParameters", + "type": "AadAuthenticationParameters", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "p2_s_vpn_gateways": {"key": "properties.p2SVpnGateways", "type": "[P2SVpnGateway]"}, + "configuration_policy_groups": { + "key": "properties.configurationPolicyGroups", + "type": "[VpnServerConfigurationPolicyGroup]", + }, + "etag_properties_etag": {"key": "properties.etag", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + name_properties_name: Optional[str] = None, + vpn_protocols: Optional[List[Union[str, "_models.VpnGatewayTunnelingProtocol"]]] = None, + vpn_authentication_types: Optional[List[Union[str, "_models.VpnAuthenticationType"]]] = None, + vpn_client_root_certificates: Optional[List["_models.VpnServerConfigVpnClientRootCertificate"]] = None, + vpn_client_revoked_certificates: Optional[List["_models.VpnServerConfigVpnClientRevokedCertificate"]] = None, + radius_server_root_certificates: Optional[List["_models.VpnServerConfigRadiusServerRootCertificate"]] = None, + radius_client_root_certificates: Optional[List["_models.VpnServerConfigRadiusClientRootCertificate"]] = None, + vpn_client_ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + radius_server_address: Optional[str] = None, + radius_server_secret: Optional[str] = None, + radius_servers: Optional[List["_models.RadiusServer"]] = None, + aad_authentication_parameters: Optional["_models.AadAuthenticationParameters"] = None, + configuration_policy_groups: Optional[List["_models.VpnServerConfigurationPolicyGroup"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword name_properties_name: The name of the VpnServerConfiguration that is unique within a + resource group. + :paramtype name_properties_name: str + :keyword vpn_protocols: VPN protocols for the VpnServerConfiguration. + :paramtype vpn_protocols: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnGatewayTunnelingProtocol] + :keyword vpn_authentication_types: VPN authentication types for the VpnServerConfiguration. + :paramtype vpn_authentication_types: list[str or + ~azure.mgmt.network.v2023_09_01.models.VpnAuthenticationType] + :keyword vpn_client_root_certificates: VPN client root certificate of VpnServerConfiguration. + :paramtype vpn_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigVpnClientRootCertificate] + :keyword vpn_client_revoked_certificates: VPN client revoked certificate of + VpnServerConfiguration. + :paramtype vpn_client_revoked_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigVpnClientRevokedCertificate] + :keyword radius_server_root_certificates: Radius Server root certificate of + VpnServerConfiguration. + :paramtype radius_server_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigRadiusServerRootCertificate] + :keyword radius_client_root_certificates: Radius client root certificate of + VpnServerConfiguration. + :paramtype radius_client_root_certificates: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigRadiusClientRootCertificate] + :keyword vpn_client_ipsec_policies: VpnClientIpsecPolicies for VpnServerConfiguration. + :paramtype vpn_client_ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword radius_server_address: The radius server address property of the + VpnServerConfiguration resource for point to site client connection. + :paramtype radius_server_address: str + :keyword radius_server_secret: The radius secret property of the VpnServerConfiguration + resource for point to site client connection. + :paramtype radius_server_secret: str + :keyword radius_servers: Multiple Radius Server configuration for VpnServerConfiguration. + :paramtype radius_servers: list[~azure.mgmt.network.v2023_09_01.models.RadiusServer] + :keyword aad_authentication_parameters: The set of aad vpn authentication parameters. + :paramtype aad_authentication_parameters: + ~azure.mgmt.network.v2023_09_01.models.AadAuthenticationParameters + :keyword configuration_policy_groups: List of all VpnServerConfigurationPolicyGroups. + :paramtype configuration_policy_groups: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.name_properties_name = name_properties_name + self.vpn_protocols = vpn_protocols + self.vpn_authentication_types = vpn_authentication_types + self.vpn_client_root_certificates = vpn_client_root_certificates + self.vpn_client_revoked_certificates = vpn_client_revoked_certificates + self.radius_server_root_certificates = radius_server_root_certificates + self.radius_client_root_certificates = radius_client_root_certificates + self.vpn_client_ipsec_policies = vpn_client_ipsec_policies + self.radius_server_address = radius_server_address + self.radius_server_secret = radius_server_secret + self.radius_servers = radius_servers + self.aad_authentication_parameters = aad_authentication_parameters + self.provisioning_state = None + self.p2_s_vpn_gateways = None + self.configuration_policy_groups = configuration_policy_groups + self.etag_properties_etag = None + + +class VpnServerConfigurationPolicyGroup(SubResource): + """VpnServerConfigurationPolicyGroup Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar is_default: Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + :vartype is_default: bool + :ivar priority: Priority for VpnServerConfigurationPolicyGroup. + :vartype priority: int + :ivar policy_members: Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + :vartype policy_members: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroupMember] + :ivar p2_s_connection_configurations: List of references to P2SConnectionConfigurations. + :vartype p2_s_connection_configurations: + list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar provisioning_state: The provisioning state of the VpnServerConfigurationPolicyGroup + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "p2_s_connection_configurations": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "is_default": {"key": "properties.isDefault", "type": "bool"}, + "priority": {"key": "properties.priority", "type": "int"}, + "policy_members": {"key": "properties.policyMembers", "type": "[VpnServerConfigurationPolicyGroupMember]"}, + "p2_s_connection_configurations": {"key": "properties.p2SConnectionConfigurations", "type": "[SubResource]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + is_default: Optional[bool] = None, + priority: Optional[int] = None, + policy_members: Optional[List["_models.VpnServerConfigurationPolicyGroupMember"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword is_default: Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + :paramtype is_default: bool + :keyword priority: Priority for VpnServerConfigurationPolicyGroup. + :paramtype priority: int + :keyword policy_members: Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + :paramtype policy_members: + list[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroupMember] + """ + super().__init__(id=id, **kwargs) + self.etag = None + self.name = name + self.type = None + self.is_default = is_default + self.priority = priority + self.policy_members = policy_members + self.p2_s_connection_configurations = None + self.provisioning_state = None + + +class VpnServerConfigurationPolicyGroupMember(_serialization.Model): + """VpnServerConfiguration PolicyGroup member. + + :ivar name: Name of the VpnServerConfigurationPolicyGroupMember. + :vartype name: str + :ivar attribute_type: The Vpn Policy member attribute type. Known values are: + "CertificateGroupId", "AADGroupId", and "RadiusAzureGroupId". + :vartype attribute_type: str or + ~azure.mgmt.network.v2023_09_01.models.VpnPolicyMemberAttributeType + :ivar attribute_value: The value of Attribute used for this + VpnServerConfigurationPolicyGroupMember. + :vartype attribute_value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "attribute_type": {"key": "attributeType", "type": "str"}, + "attribute_value": {"key": "attributeValue", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + attribute_type: Optional[Union[str, "_models.VpnPolicyMemberAttributeType"]] = None, + attribute_value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the VpnServerConfigurationPolicyGroupMember. + :paramtype name: str + :keyword attribute_type: The Vpn Policy member attribute type. Known values are: + "CertificateGroupId", "AADGroupId", and "RadiusAzureGroupId". + :paramtype attribute_type: str or + ~azure.mgmt.network.v2023_09_01.models.VpnPolicyMemberAttributeType + :keyword attribute_value: The value of Attribute used for this + VpnServerConfigurationPolicyGroupMember. + :paramtype attribute_value: str + """ + super().__init__(**kwargs) + self.name = name + self.attribute_type = attribute_type + self.attribute_value = attribute_value + + +class VpnServerConfigurationsResponse(_serialization.Model): + """VpnServerConfigurations list associated with VirtualWan Response. + + :ivar vpn_server_configuration_resource_ids: List of VpnServerConfigurations associated with + VirtualWan. + :vartype vpn_server_configuration_resource_ids: list[str] + """ + + _attribute_map = { + "vpn_server_configuration_resource_ids": {"key": "vpnServerConfigurationResourceIds", "type": "[str]"}, + } + + def __init__(self, *, vpn_server_configuration_resource_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword vpn_server_configuration_resource_ids: List of VpnServerConfigurations associated with + VirtualWan. + :paramtype vpn_server_configuration_resource_ids: list[str] + """ + super().__init__(**kwargs) + self.vpn_server_configuration_resource_ids = vpn_server_configuration_resource_ids + + +class VpnServerConfigVpnClientRevokedCertificate(_serialization.Model): + """Properties of the revoked VPN client certificate of VpnServerConfiguration. + + :ivar name: The certificate name. + :vartype name: str + :ivar thumbprint: The revoked VPN client certificate thumbprint. + :vartype thumbprint: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, thumbprint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The certificate name. + :paramtype name: str + :keyword thumbprint: The revoked VPN client certificate thumbprint. + :paramtype thumbprint: str + """ + super().__init__(**kwargs) + self.name = name + self.thumbprint = thumbprint + + +class VpnServerConfigVpnClientRootCertificate(_serialization.Model): + """Properties of VPN client root certificate of VpnServerConfiguration. + + :ivar name: The certificate name. + :vartype name: str + :ivar public_cert_data: The certificate public data. + :vartype public_cert_data: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "public_cert_data": {"key": "publicCertData", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, public_cert_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The certificate name. + :paramtype name: str + :keyword public_cert_data: The certificate public data. + :paramtype public_cert_data: str + """ + super().__init__(**kwargs) + self.name = name + self.public_cert_data = public_cert_data + + +class VpnSite(Resource): # pylint: disable=too-many-instance-attributes + """VpnSite Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar virtual_wan: The VirtualWAN to which the vpnSite belongs. + :vartype virtual_wan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar device_properties: The device properties. + :vartype device_properties: ~azure.mgmt.network.v2023_09_01.models.DeviceProperties + :ivar ip_address: The ip-address for the vpn-site. + :vartype ip_address: str + :ivar site_key: The key for vpn-site that can be used for connections. + :vartype site_key: str + :ivar address_space: The AddressSpace that contains an array of IP address ranges. + :vartype address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :ivar bgp_properties: The set of bgp properties. + :vartype bgp_properties: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :ivar provisioning_state: The provisioning state of the VPN site resource. Known values are: + "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar is_security_site: IsSecuritySite flag. + :vartype is_security_site: bool + :ivar vpn_site_links: List of all vpn site links. + :vartype vpn_site_links: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :ivar o365_policy: Office365 Policy. + :vartype o365_policy: ~azure.mgmt.network.v2023_09_01.models.O365PolicyProperties + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "virtual_wan": {"key": "properties.virtualWan", "type": "SubResource"}, + "device_properties": {"key": "properties.deviceProperties", "type": "DeviceProperties"}, + "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "site_key": {"key": "properties.siteKey", "type": "str"}, + "address_space": {"key": "properties.addressSpace", "type": "AddressSpace"}, + "bgp_properties": {"key": "properties.bgpProperties", "type": "BgpSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "is_security_site": {"key": "properties.isSecuritySite", "type": "bool"}, + "vpn_site_links": {"key": "properties.vpnSiteLinks", "type": "[VpnSiteLink]"}, + "o365_policy": {"key": "properties.o365Policy", "type": "O365PolicyProperties"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + virtual_wan: Optional["_models.SubResource"] = None, + device_properties: Optional["_models.DeviceProperties"] = None, + ip_address: Optional[str] = None, + site_key: Optional[str] = None, + address_space: Optional["_models.AddressSpace"] = None, + bgp_properties: Optional["_models.BgpSettings"] = None, + is_security_site: Optional[bool] = None, + vpn_site_links: Optional[List["_models.VpnSiteLink"]] = None, + o365_policy: Optional["_models.O365PolicyProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword virtual_wan: The VirtualWAN to which the vpnSite belongs. + :paramtype virtual_wan: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword device_properties: The device properties. + :paramtype device_properties: ~azure.mgmt.network.v2023_09_01.models.DeviceProperties + :keyword ip_address: The ip-address for the vpn-site. + :paramtype ip_address: str + :keyword site_key: The key for vpn-site that can be used for connections. + :paramtype site_key: str + :keyword address_space: The AddressSpace that contains an array of IP address ranges. + :paramtype address_space: ~azure.mgmt.network.v2023_09_01.models.AddressSpace + :keyword bgp_properties: The set of bgp properties. + :paramtype bgp_properties: ~azure.mgmt.network.v2023_09_01.models.BgpSettings + :keyword is_security_site: IsSecuritySite flag. + :paramtype is_security_site: bool + :keyword vpn_site_links: List of all vpn site links. + :paramtype vpn_site_links: list[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :keyword o365_policy: Office365 Policy. + :paramtype o365_policy: ~azure.mgmt.network.v2023_09_01.models.O365PolicyProperties + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.virtual_wan = virtual_wan + self.device_properties = device_properties + self.ip_address = ip_address + self.site_key = site_key + self.address_space = address_space + self.bgp_properties = bgp_properties + self.provisioning_state = None + self.is_security_site = is_security_site + self.vpn_site_links = vpn_site_links + self.o365_policy = o365_policy + + +class VpnSiteId(_serialization.Model): + """VpnSite Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vpn_site: The resource-uri of the vpn-site for which config is to be fetched. + :vartype vpn_site: str + """ + + _validation = { + "vpn_site": {"readonly": True}, + } + + _attribute_map = { + "vpn_site": {"key": "vpnSite", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.vpn_site = None + + +class VpnSiteLink(SubResource): + """VpnSiteLink Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar link_properties: The link provider properties. + :vartype link_properties: ~azure.mgmt.network.v2023_09_01.models.VpnLinkProviderProperties + :ivar ip_address: The ip-address for the vpn-site-link. + :vartype ip_address: str + :ivar fqdn: FQDN of vpn-site-link. + :vartype fqdn: str + :ivar bgp_properties: The set of bgp properties. + :vartype bgp_properties: ~azure.mgmt.network.v2023_09_01.models.VpnLinkBgpSettings + :ivar provisioning_state: The provisioning state of the VPN site link resource. Known values + are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "link_properties": {"key": "properties.linkProperties", "type": "VpnLinkProviderProperties"}, + "ip_address": {"key": "properties.ipAddress", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "bgp_properties": {"key": "properties.bgpProperties", "type": "VpnLinkBgpSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + link_properties: Optional["_models.VpnLinkProviderProperties"] = None, + ip_address: Optional[str] = None, + fqdn: Optional[str] = None, + bgp_properties: Optional["_models.VpnLinkBgpSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword link_properties: The link provider properties. + :paramtype link_properties: ~azure.mgmt.network.v2023_09_01.models.VpnLinkProviderProperties + :keyword ip_address: The ip-address for the vpn-site-link. + :paramtype ip_address: str + :keyword fqdn: FQDN of vpn-site-link. + :paramtype fqdn: str + :keyword bgp_properties: The set of bgp properties. + :paramtype bgp_properties: ~azure.mgmt.network.v2023_09_01.models.VpnLinkBgpSettings + """ + super().__init__(id=id, **kwargs) + self.etag = None + self.name = name + self.type = None + self.link_properties = link_properties + self.ip_address = ip_address + self.fqdn = fqdn + self.bgp_properties = bgp_properties + self.provisioning_state = None + + +class VpnSiteLinkConnection(SubResource): # pylint: disable=too-many-instance-attributes + """VpnSiteLinkConnection Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: str + :ivar vpn_site_link: Id of the connected vpn site link. + :vartype vpn_site_link: ~azure.mgmt.network.v2023_09_01.models.SubResource + :ivar routing_weight: Routing weight for vpn connection. + :vartype routing_weight: int + :ivar vpn_link_connection_mode: Vpn link connection mode. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :vartype vpn_link_connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VpnLinkConnectionMode + :ivar connection_status: The connection status. Known values are: "Unknown", "Connecting", + "Connected", and "NotConnected". + :vartype connection_status: str or ~azure.mgmt.network.v2023_09_01.models.VpnConnectionStatus + :ivar vpn_connection_protocol_type: Connection protocol used for this connection. Known values + are: "IKEv2" and "IKEv1". + :vartype vpn_connection_protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :ivar ingress_bytes_transferred: Ingress bytes transferred. + :vartype ingress_bytes_transferred: int + :ivar egress_bytes_transferred: Egress bytes transferred. + :vartype egress_bytes_transferred: int + :ivar connection_bandwidth: Expected bandwidth in MBPS. + :vartype connection_bandwidth: int + :ivar shared_key: SharedKey for the vpn connection. + :vartype shared_key: str + :ivar enable_bgp: EnableBgp flag. + :vartype enable_bgp: bool + :ivar vpn_gateway_custom_bgp_addresses: vpnGatewayCustomBgpAddresses used by this connection. + :vartype vpn_gateway_custom_bgp_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :ivar use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :vartype use_policy_based_traffic_selectors: bool + :ivar ipsec_policies: The IPSec Policies to be considered by this connection. + :vartype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :ivar enable_rate_limiting: EnableBgp flag. + :vartype enable_rate_limiting: bool + :ivar use_local_azure_ip_address: Use local azure ip to initiate connection. + :vartype use_local_azure_ip_address: bool + :ivar provisioning_state: The provisioning state of the VPN site link connection resource. + Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar ingress_nat_rules: List of ingress NatRules. + :vartype ingress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar egress_nat_rules: List of egress NatRules. + :vartype egress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "etag": {"readonly": True}, + "type": {"readonly": True}, + "connection_status": {"readonly": True}, + "ingress_bytes_transferred": {"readonly": True}, + "egress_bytes_transferred": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "vpn_site_link": {"key": "properties.vpnSiteLink", "type": "SubResource"}, + "routing_weight": {"key": "properties.routingWeight", "type": "int"}, + "vpn_link_connection_mode": {"key": "properties.vpnLinkConnectionMode", "type": "str"}, + "connection_status": {"key": "properties.connectionStatus", "type": "str"}, + "vpn_connection_protocol_type": {"key": "properties.vpnConnectionProtocolType", "type": "str"}, + "ingress_bytes_transferred": {"key": "properties.ingressBytesTransferred", "type": "int"}, + "egress_bytes_transferred": {"key": "properties.egressBytesTransferred", "type": "int"}, + "connection_bandwidth": {"key": "properties.connectionBandwidth", "type": "int"}, + "shared_key": {"key": "properties.sharedKey", "type": "str"}, + "enable_bgp": {"key": "properties.enableBgp", "type": "bool"}, + "vpn_gateway_custom_bgp_addresses": { + "key": "properties.vpnGatewayCustomBgpAddresses", + "type": "[GatewayCustomBgpIpAddressIpConfiguration]", + }, + "use_policy_based_traffic_selectors": {"key": "properties.usePolicyBasedTrafficSelectors", "type": "bool"}, + "ipsec_policies": {"key": "properties.ipsecPolicies", "type": "[IpsecPolicy]"}, + "enable_rate_limiting": {"key": "properties.enableRateLimiting", "type": "bool"}, + "use_local_azure_ip_address": {"key": "properties.useLocalAzureIpAddress", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "ingress_nat_rules": {"key": "properties.ingressNatRules", "type": "[SubResource]"}, + "egress_nat_rules": {"key": "properties.egressNatRules", "type": "[SubResource]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + vpn_site_link: Optional["_models.SubResource"] = None, + routing_weight: Optional[int] = None, + vpn_link_connection_mode: Optional[Union[str, "_models.VpnLinkConnectionMode"]] = None, + vpn_connection_protocol_type: Optional[Union[str, "_models.VirtualNetworkGatewayConnectionProtocol"]] = None, + connection_bandwidth: Optional[int] = None, + shared_key: Optional[str] = None, + enable_bgp: Optional[bool] = None, + vpn_gateway_custom_bgp_addresses: Optional[List["_models.GatewayCustomBgpIpAddressIpConfiguration"]] = None, + use_policy_based_traffic_selectors: Optional[bool] = None, + ipsec_policies: Optional[List["_models.IpsecPolicy"]] = None, + enable_rate_limiting: Optional[bool] = None, + use_local_azure_ip_address: Optional[bool] = None, + ingress_nat_rules: Optional[List["_models.SubResource"]] = None, + egress_nat_rules: Optional[List["_models.SubResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: The name of the resource that is unique within a resource group. This name can + be used to access the resource. + :paramtype name: str + :keyword vpn_site_link: Id of the connected vpn site link. + :paramtype vpn_site_link: ~azure.mgmt.network.v2023_09_01.models.SubResource + :keyword routing_weight: Routing weight for vpn connection. + :paramtype routing_weight: int + :keyword vpn_link_connection_mode: Vpn link connection mode. Known values are: "Default", + "ResponderOnly", and "InitiatorOnly". + :paramtype vpn_link_connection_mode: str or + ~azure.mgmt.network.v2023_09_01.models.VpnLinkConnectionMode + :keyword vpn_connection_protocol_type: Connection protocol used for this connection. Known + values are: "IKEv2" and "IKEv1". + :paramtype vpn_connection_protocol_type: str or + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionProtocol + :keyword connection_bandwidth: Expected bandwidth in MBPS. + :paramtype connection_bandwidth: int + :keyword shared_key: SharedKey for the vpn connection. + :paramtype shared_key: str + :keyword enable_bgp: EnableBgp flag. + :paramtype enable_bgp: bool + :keyword vpn_gateway_custom_bgp_addresses: vpnGatewayCustomBgpAddresses used by this + connection. + :paramtype vpn_gateway_custom_bgp_addresses: + list[~azure.mgmt.network.v2023_09_01.models.GatewayCustomBgpIpAddressIpConfiguration] + :keyword use_policy_based_traffic_selectors: Enable policy-based traffic selectors. + :paramtype use_policy_based_traffic_selectors: bool + :keyword ipsec_policies: The IPSec Policies to be considered by this connection. + :paramtype ipsec_policies: list[~azure.mgmt.network.v2023_09_01.models.IpsecPolicy] + :keyword enable_rate_limiting: EnableBgp flag. + :paramtype enable_rate_limiting: bool + :keyword use_local_azure_ip_address: Use local azure ip to initiate connection. + :paramtype use_local_azure_ip_address: bool + :keyword ingress_nat_rules: List of ingress NatRules. + :paramtype ingress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :keyword egress_nat_rules: List of egress NatRules. + :paramtype egress_nat_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + super().__init__(id=id, **kwargs) + self.name = name + self.etag = None + self.type = None + self.vpn_site_link = vpn_site_link + self.routing_weight = routing_weight + self.vpn_link_connection_mode = vpn_link_connection_mode + self.connection_status = None + self.vpn_connection_protocol_type = vpn_connection_protocol_type + self.ingress_bytes_transferred = None + self.egress_bytes_transferred = None + self.connection_bandwidth = connection_bandwidth + self.shared_key = shared_key + self.enable_bgp = enable_bgp + self.vpn_gateway_custom_bgp_addresses = vpn_gateway_custom_bgp_addresses + self.use_policy_based_traffic_selectors = use_policy_based_traffic_selectors + self.ipsec_policies = ipsec_policies + self.enable_rate_limiting = enable_rate_limiting + self.use_local_azure_ip_address = use_local_azure_ip_address + self.provisioning_state = None + self.ingress_nat_rules = ingress_nat_rules + self.egress_nat_rules = egress_nat_rules + + +class WebApplicationFirewallCustomRule(_serialization.Model): + """Defines contents of a web application rule. + + 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 name: The name of the resource that is unique within a policy. This name can be used to + access the resource. + :vartype name: str + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar priority: Priority of the rule. Rules with a lower value will be evaluated before rules + with a higher value. Required. + :vartype priority: int + :ivar state: Describes if the custom rule is in enabled or disabled state. Defaults to Enabled + if not specified. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallState + :ivar rate_limit_duration: Duration over which Rate Limit policy will be applied. Applies only + when ruleType is RateLimitRule. Known values are: "OneMin" and "FiveMins". + :vartype rate_limit_duration: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRateLimitDuration + :ivar rate_limit_threshold: Rate Limit threshold to apply in case ruleType is RateLimitRule. + Must be greater than or equal to 1. + :vartype rate_limit_threshold: int + :ivar rule_type: The rule type. Required. Known values are: "MatchRule", "RateLimitRule", and + "Invalid". + :vartype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallRuleType + :ivar match_conditions: List of match conditions. Required. + :vartype match_conditions: list[~azure.mgmt.network.v2023_09_01.models.MatchCondition] + :ivar group_by_user_session: List of user session identifier group by clauses. + :vartype group_by_user_session: list[~azure.mgmt.network.v2023_09_01.models.GroupByUserSession] + :ivar action: Type of Actions. Required. Known values are: "Allow", "Block", "Log", and + "JSChallenge". + :vartype action: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallAction + """ + + _validation = { + "name": {"max_length": 128}, + "etag": {"readonly": True}, + "priority": {"required": True}, + "rule_type": {"required": True}, + "match_conditions": {"required": True}, + "action": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + "state": {"key": "state", "type": "str"}, + "rate_limit_duration": {"key": "rateLimitDuration", "type": "str"}, + "rate_limit_threshold": {"key": "rateLimitThreshold", "type": "int"}, + "rule_type": {"key": "ruleType", "type": "str"}, + "match_conditions": {"key": "matchConditions", "type": "[MatchCondition]"}, + "group_by_user_session": {"key": "groupByUserSession", "type": "[GroupByUserSession]"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__( + self, + *, + priority: int, + rule_type: Union[str, "_models.WebApplicationFirewallRuleType"], + match_conditions: List["_models.MatchCondition"], + action: Union[str, "_models.WebApplicationFirewallAction"], + name: Optional[str] = None, + state: Optional[Union[str, "_models.WebApplicationFirewallState"]] = None, + rate_limit_duration: Optional[Union[str, "_models.ApplicationGatewayFirewallRateLimitDuration"]] = None, + rate_limit_threshold: Optional[int] = None, + group_by_user_session: Optional[List["_models.GroupByUserSession"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the resource that is unique within a policy. This name can be used + to access the resource. + :paramtype name: str + :keyword priority: Priority of the rule. Rules with a lower value will be evaluated before + rules with a higher value. Required. + :paramtype priority: int + :keyword state: Describes if the custom rule is in enabled or disabled state. Defaults to + Enabled if not specified. Known values are: "Disabled" and "Enabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallState + :keyword rate_limit_duration: Duration over which Rate Limit policy will be applied. Applies + only when ruleType is RateLimitRule. Known values are: "OneMin" and "FiveMins". + :paramtype rate_limit_duration: str or + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayFirewallRateLimitDuration + :keyword rate_limit_threshold: Rate Limit threshold to apply in case ruleType is RateLimitRule. + Must be greater than or equal to 1. + :paramtype rate_limit_threshold: int + :keyword rule_type: The rule type. Required. Known values are: "MatchRule", "RateLimitRule", + and "Invalid". + :paramtype rule_type: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallRuleType + :keyword match_conditions: List of match conditions. Required. + :paramtype match_conditions: list[~azure.mgmt.network.v2023_09_01.models.MatchCondition] + :keyword group_by_user_session: List of user session identifier group by clauses. + :paramtype group_by_user_session: + list[~azure.mgmt.network.v2023_09_01.models.GroupByUserSession] + :keyword action: Type of Actions. Required. Known values are: "Allow", "Block", "Log", and + "JSChallenge". + :paramtype action: str or ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallAction + """ + super().__init__(**kwargs) + self.name = name + self.etag = None + self.priority = priority + self.state = state + self.rate_limit_duration = rate_limit_duration + self.rate_limit_threshold = rate_limit_threshold + self.rule_type = rule_type + self.match_conditions = match_conditions + self.group_by_user_session = group_by_user_session + self.action = action + + +class WebApplicationFirewallPolicy(Resource): # pylint: disable=too-many-instance-attributes + """Defines web application firewall policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar policy_settings: The PolicySettings for policy. + :vartype policy_settings: ~azure.mgmt.network.v2023_09_01.models.PolicySettings + :ivar custom_rules: The custom rules inside the policy. + :vartype custom_rules: + list[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallCustomRule] + :ivar application_gateways: A collection of references to application gateways. + :vartype application_gateways: list[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :ivar provisioning_state: The provisioning state of the web application firewall policy + resource. Known values are: "Succeeded", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.network.v2023_09_01.models.ProvisioningState + :ivar resource_state: Resource status of the policy. Known values are: "Creating", "Enabling", + "Enabled", "Disabling", "Disabled", and "Deleting". + :vartype resource_state: str or + ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicyResourceState + :ivar managed_rules: Describes the managedRules structure. + :vartype managed_rules: ~azure.mgmt.network.v2023_09_01.models.ManagedRulesDefinition + :ivar http_listeners: A collection of references to application gateway http listeners. + :vartype http_listeners: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + :ivar path_based_rules: A collection of references to application gateway path rules. + :vartype path_based_rules: list[~azure.mgmt.network.v2023_09_01.models.SubResource] + """ + + _validation = { + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "application_gateways": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "resource_state": {"readonly": True}, + "http_listeners": {"readonly": True}, + "path_based_rules": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "policy_settings": {"key": "properties.policySettings", "type": "PolicySettings"}, + "custom_rules": {"key": "properties.customRules", "type": "[WebApplicationFirewallCustomRule]"}, + "application_gateways": {"key": "properties.applicationGateways", "type": "[ApplicationGateway]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "resource_state": {"key": "properties.resourceState", "type": "str"}, + "managed_rules": {"key": "properties.managedRules", "type": "ManagedRulesDefinition"}, + "http_listeners": {"key": "properties.httpListeners", "type": "[SubResource]"}, + "path_based_rules": {"key": "properties.pathBasedRules", "type": "[SubResource]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + policy_settings: Optional["_models.PolicySettings"] = None, + custom_rules: Optional[List["_models.WebApplicationFirewallCustomRule"]] = None, + managed_rules: Optional["_models.ManagedRulesDefinition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword policy_settings: The PolicySettings for policy. + :paramtype policy_settings: ~azure.mgmt.network.v2023_09_01.models.PolicySettings + :keyword custom_rules: The custom rules inside the policy. + :paramtype custom_rules: + list[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallCustomRule] + :keyword managed_rules: Describes the managedRules structure. + :paramtype managed_rules: ~azure.mgmt.network.v2023_09_01.models.ManagedRulesDefinition + """ + super().__init__(id=id, location=location, tags=tags, **kwargs) + self.etag = None + self.policy_settings = policy_settings + self.custom_rules = custom_rules + self.application_gateways = None + self.provisioning_state = None + self.resource_state = None + self.managed_rules = managed_rules + self.http_listeners = None + self.path_based_rules = None + + +class WebApplicationFirewallPolicyListResult(_serialization.Model): + """Result of the request to list WebApplicationFirewallPolicies. It contains a list of + WebApplicationFirewallPolicy objects and a 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: List of WebApplicationFirewallPolicies within a resource group. + :vartype value: list[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy] + :ivar next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are + any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WebApplicationFirewallPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class WebApplicationFirewallScrubbingRules(_serialization.Model): + """Allow certain variables to be scrubbed on WAF logs. + + All required parameters must be populated in order to send to Azure. + + :ivar match_variable: The variable to be scrubbed from the logs. Required. Known values are: + "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestPostArgNames", + "RequestJSONArgNames", and "RequestIPAddress". + :vartype match_variable: str or + ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryMatchVariable + :ivar selector_match_operator: When matchVariable is a collection, operate on the selector to + specify which elements in the collection this rule applies to. Required. Known values are: + "Equals" and "EqualsAny". + :vartype selector_match_operator: str or + ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryMatchOperator + :ivar selector: When matchVariable is a collection, operator used to specify which elements in + the collection this rule applies to. + :vartype selector: str + :ivar state: Defines the state of log scrubbing rule. Default value is Enabled. Known values + are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryState + """ + + _validation = { + "match_variable": {"required": True}, + "selector_match_operator": {"required": True}, + } + + _attribute_map = { + "match_variable": {"key": "matchVariable", "type": "str"}, + "selector_match_operator": {"key": "selectorMatchOperator", "type": "str"}, + "selector": {"key": "selector", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__( + self, + *, + match_variable: Union[str, "_models.ScrubbingRuleEntryMatchVariable"], + selector_match_operator: Union[str, "_models.ScrubbingRuleEntryMatchOperator"], + selector: Optional[str] = None, + state: Optional[Union[str, "_models.ScrubbingRuleEntryState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword match_variable: The variable to be scrubbed from the logs. Required. Known values are: + "RequestHeaderNames", "RequestCookieNames", "RequestArgNames", "RequestPostArgNames", + "RequestJSONArgNames", and "RequestIPAddress". + :paramtype match_variable: str or + ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryMatchVariable + :keyword selector_match_operator: When matchVariable is a collection, operate on the selector + to specify which elements in the collection this rule applies to. Required. Known values are: + "Equals" and "EqualsAny". + :paramtype selector_match_operator: str or + ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryMatchOperator + :keyword selector: When matchVariable is a collection, operator used to specify which elements + in the collection this rule applies to. + :paramtype selector: str + :keyword state: Defines the state of log scrubbing rule. Default value is Enabled. Known values + are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.network.v2023_09_01.models.ScrubbingRuleEntryState + """ + super().__init__(**kwargs) + self.match_variable = match_variable + self.selector_match_operator = selector_match_operator + self.selector = selector + self.state = state diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_network_management_client_enums.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_network_management_client_enums.py new file mode 100644 index 000000000000..a4f024874e2b --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_network_management_client_enums.py @@ -0,0 +1,1938 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class Access(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Access to be allowed or denied.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the action to take on rule match.""" + + ANOMALY_SCORING = "AnomalyScoring" + ALLOW = "Allow" + BLOCK = "Block" + LOG = "Log" + JS_CHALLENGE = "JSChallenge" + + +class AddressPrefixType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Address prefix type.""" + + IP_PREFIX = "IPPrefix" + SERVICE_TAG = "ServiceTag" + + +class AdminRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the rule is custom or default.""" + + CUSTOM = "Custom" + DEFAULT = "Default" + + +class AdminState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property to indicate if the Express Route Gateway serves traffic when there are multiple + Express Route Gateways in the vnet. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ApplicationGatewayBackendHealthServerHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health of backend server.""" + + UNKNOWN = "Unknown" + UP = "Up" + DOWN = "Down" + PARTIAL = "Partial" + DRAINING = "Draining" + + +class ApplicationGatewayClientRevocationOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Verify client certificate revocation status.""" + + NONE = "None" + OCSP = "OCSP" + + +class ApplicationGatewayCookieBasedAffinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cookie based affinity.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ApplicationGatewayCustomErrorStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status code of the application gateway custom error.""" + + HTTP_STATUS400 = "HttpStatus400" + HTTP_STATUS403 = "HttpStatus403" + HTTP_STATUS404 = "HttpStatus404" + HTTP_STATUS405 = "HttpStatus405" + HTTP_STATUS408 = "HttpStatus408" + HTTP_STATUS500 = "HttpStatus500" + HTTP_STATUS502 = "HttpStatus502" + HTTP_STATUS503 = "HttpStatus503" + HTTP_STATUS504 = "HttpStatus504" + + +class ApplicationGatewayFirewallMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Web application firewall mode.""" + + DETECTION = "Detection" + PREVENTION = "Prevention" + + +class ApplicationGatewayFirewallRateLimitDuration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Duration over which Rate Limit policy will be applied. Applies only when ruleType is + RateLimitRule. + """ + + ONE_MIN = "OneMin" + FIVE_MINS = "FiveMins" + + +class ApplicationGatewayFirewallUserSessionVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """User Session clause variable.""" + + CLIENT_ADDR = "ClientAddr" + GEO_LOCATION = "GeoLocation" + NONE = "None" + + +class ApplicationGatewayLoadDistributionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Load Distribution Algorithm enums.""" + + ROUND_ROBIN = "RoundRobin" + LEAST_CONNECTIONS = "LeastConnections" + IP_HASH = "IpHash" + + +class ApplicationGatewayOperationalState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operational state of the application gateway resource.""" + + STOPPED = "Stopped" + STARTING = "Starting" + RUNNING = "Running" + STOPPING = "Stopping" + + +class ApplicationGatewayProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Application Gateway protocol.""" + + HTTP = "Http" + """Supported for httpListeners and backendHttpSettingsCollection properties.""" + HTTPS = "Https" + """Supported for httpListeners and backendHttpSettingsCollection properties.""" + TCP = "Tcp" + """Supported for listeners and backendSettingsCollection properties.""" + TLS = "Tls" + """Supported for listeners and backendSettingsCollection properties.""" + + +class ApplicationGatewayRedirectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Redirect type enum.""" + + PERMANENT = "Permanent" + FOUND = "Found" + SEE_OTHER = "SeeOther" + TEMPORARY = "Temporary" + + +class ApplicationGatewayRequestRoutingRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Rule type.""" + + BASIC = "Basic" + PATH_BASED_ROUTING = "PathBasedRouting" + + +class ApplicationGatewayRuleSetStatusOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The rule set status.""" + + PREVIEW = "Preview" + GA = "GA" + SUPPORTED = "Supported" + DEPRECATED = "Deprecated" + + +class ApplicationGatewaySkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of an application gateway SKU.""" + + STANDARD_SMALL = "Standard_Small" + STANDARD_MEDIUM = "Standard_Medium" + STANDARD_LARGE = "Standard_Large" + WAF_MEDIUM = "WAF_Medium" + WAF_LARGE = "WAF_Large" + STANDARD_V2 = "Standard_v2" + WAF_V2 = "WAF_v2" + BASIC = "Basic" + + +class ApplicationGatewaySslCipherSuite(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Ssl cipher suites enums.""" + + TLS_ECDHE_RSA_WITH_AES256_CBC_SHA384 = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" + TLS_ECDHE_RSA_WITH_AES128_CBC_SHA256 = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + TLS_ECDHE_RSA_WITH_AES256_CBC_SHA = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" + TLS_ECDHE_RSA_WITH_AES128_CBC_SHA = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" + TLS_DHE_RSA_WITH_AES256_GCM_SHA384 = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" + TLS_DHE_RSA_WITH_AES128_GCM_SHA256 = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" + TLS_DHE_RSA_WITH_AES256_CBC_SHA = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" + TLS_DHE_RSA_WITH_AES128_CBC_SHA = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" + TLS_RSA_WITH_AES256_GCM_SHA384 = "TLS_RSA_WITH_AES_256_GCM_SHA384" + TLS_RSA_WITH_AES128_GCM_SHA256 = "TLS_RSA_WITH_AES_128_GCM_SHA256" + TLS_RSA_WITH_AES256_CBC_SHA256 = "TLS_RSA_WITH_AES_256_CBC_SHA256" + TLS_RSA_WITH_AES128_CBC_SHA256 = "TLS_RSA_WITH_AES_128_CBC_SHA256" + TLS_RSA_WITH_AES256_CBC_SHA = "TLS_RSA_WITH_AES_256_CBC_SHA" + TLS_RSA_WITH_AES128_CBC_SHA = "TLS_RSA_WITH_AES_128_CBC_SHA" + TLS_ECDHE_ECDSA_WITH_AES256_GCM_SHA384 = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + TLS_ECDHE_ECDSA_WITH_AES128_GCM_SHA256 = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" + TLS_ECDHE_ECDSA_WITH_AES256_CBC_SHA384 = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" + TLS_ECDHE_ECDSA_WITH_AES128_CBC_SHA256 = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + TLS_ECDHE_ECDSA_WITH_AES256_CBC_SHA = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" + TLS_ECDHE_ECDSA_WITH_AES128_CBC_SHA = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" + TLS_DHE_DSS_WITH_AES256_CBC_SHA256 = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" + TLS_DHE_DSS_WITH_AES128_CBC_SHA256 = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" + TLS_DHE_DSS_WITH_AES256_CBC_SHA = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" + TLS_DHE_DSS_WITH_AES128_CBC_SHA = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" + TLS_RSA_WITH3_DES_EDE_CBC_SHA = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" + TLS_DHE_DSS_WITH3_DES_EDE_CBC_SHA = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" + TLS_ECDHE_RSA_WITH_AES128_GCM_SHA256 = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" + TLS_ECDHE_RSA_WITH_AES256_GCM_SHA384 = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" + + +class ApplicationGatewaySslPolicyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Ssl predefined policy name enums.""" + + APP_GW_SSL_POLICY20150501 = "AppGwSslPolicy20150501" + APP_GW_SSL_POLICY20170401 = "AppGwSslPolicy20170401" + APP_GW_SSL_POLICY20170401_S = "AppGwSslPolicy20170401S" + APP_GW_SSL_POLICY20220101 = "AppGwSslPolicy20220101" + APP_GW_SSL_POLICY20220101_S = "AppGwSslPolicy20220101S" + + +class ApplicationGatewaySslPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of Ssl Policy.""" + + PREDEFINED = "Predefined" + CUSTOM = "Custom" + CUSTOM_V2 = "CustomV2" + + +class ApplicationGatewaySslProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Ssl protocol enums.""" + + TL_SV1_0 = "TLSv1_0" + TL_SV1_1 = "TLSv1_1" + TL_SV1_2 = "TLSv1_2" + TL_SV1_3 = "TLSv1_3" + + +class ApplicationGatewayTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of an application gateway.""" + + STANDARD = "Standard" + WAF = "WAF" + STANDARD_V2 = "Standard_v2" + WAF_V2 = "WAF_v2" + BASIC = "Basic" + + +class ApplicationGatewayTierTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ApplicationGatewayTierTypes.""" + + STANDARD = "Standard" + WAF = "WAF" + STANDARD_V2 = "Standard_v2" + WAF_V2 = "WAF_v2" + + +class ApplicationGatewayWafRuleActionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The string representation of the web application firewall rule action.""" + + NONE = "None" + ANOMALY_SCORING = "AnomalyScoring" + ALLOW = "Allow" + BLOCK = "Block" + LOG = "Log" + + +class ApplicationGatewayWafRuleStateTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The string representation of the web application firewall rule state.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class AssociationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The association type of the child resource to the parent resource.""" + + ASSOCIATED = "Associated" + CONTAINS = "Contains" + + +class AuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VPN client authentication method.""" + + EAPTLS = "EAPTLS" + EAPMSCHA_PV2 = "EAPMSCHAPv2" + + +class AuthorizationUseStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The authorization use status.""" + + AVAILABLE = "Available" + IN_USE = "InUse" + + +class AutoLearnPrivateRangesMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operation mode for automatically learning private ranges to not be SNAT.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class AzureFirewallApplicationRuleProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol type of a Application Rule resource.""" + + HTTP = "Http" + HTTPS = "Https" + MSSQL = "Mssql" + + +class AzureFirewallNatRCActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The action type of a NAT rule collection.""" + + SNAT = "Snat" + DNAT = "Dnat" + + +class AzureFirewallNetworkRuleProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol of a Network Rule resource.""" + + TCP = "TCP" + UDP = "UDP" + ANY = "Any" + ICMP = "ICMP" + + +class AzureFirewallPacketCaptureFlagsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The flags type to be captured.""" + + FIN = "fin" + SYN = "syn" + RST = "rst" + PUSH = "push" + ACK = "ack" + URG = "urg" + + +class AzureFirewallRCActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The action type of a rule collection.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class AzureFirewallSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of an Azure Firewall SKU.""" + + AZFW_VNET = "AZFW_VNet" + AZFW_HUB = "AZFW_Hub" + + +class AzureFirewallSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of an Azure Firewall.""" + + STANDARD = "Standard" + PREMIUM = "Premium" + BASIC = "Basic" + + +class AzureFirewallThreatIntelMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operation mode for Threat Intel.""" + + ALERT = "Alert" + DENY = "Deny" + OFF = "Off" + + +class BastionConnectProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol used to connect to the target.""" + + SSH = "SSH" + RDP = "RDP" + + +class BastionHostSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of this Bastion Host.""" + + BASIC = "Basic" + STANDARD = "Standard" + DEVELOPER = "Developer" + + +class BgpPeerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The BGP peer state.""" + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + IDLE = "Idle" + CONNECTING = "Connecting" + CONNECTED = "Connected" + + +class CircuitConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Express Route Circuit connection state.""" + + CONNECTED = "Connected" + CONNECTING = "Connecting" + DISCONNECTED = "Disconnected" + + +class CommissionedState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The commissioned state of the Custom IP Prefix.""" + + PROVISIONING = "Provisioning" + PROVISIONED = "Provisioned" + COMMISSIONING = "Commissioning" + COMMISSIONED_NO_INTERNET_ADVERTISE = "CommissionedNoInternetAdvertise" + COMMISSIONED = "Commissioned" + DECOMMISSIONING = "Decommissioning" + DEPROVISIONING = "Deprovisioning" + DEPROVISIONED = "Deprovisioned" + + +class ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Configuration Deployment Type.""" + + SECURITY_ADMIN = "SecurityAdmin" + CONNECTIVITY = "Connectivity" + + +class ConnectionMonitorEndpointFilterItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of item included in the filter. Currently only 'AgentAddress' is supported.""" + + AGENT_ADDRESS = "AgentAddress" + + +class ConnectionMonitorEndpointFilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The behavior of the endpoint filter. Currently only 'Include' is supported.""" + + INCLUDE = "Include" + + +class ConnectionMonitorSourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of connection monitor source.""" + + UNKNOWN = "Unknown" + ACTIVE = "Active" + INACTIVE = "Inactive" + + +class ConnectionMonitorTestConfigurationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol to use in test evaluation.""" + + TCP = "Tcp" + HTTP = "Http" + ICMP = "Icmp" + + +class ConnectionMonitorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of connection monitor.""" + + MULTI_ENDPOINT = "MultiEndpoint" + SINGLE_SOURCE_DESTINATION = "SingleSourceDestination" + + +class ConnectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The connection state.""" + + REACHABLE = "Reachable" + UNREACHABLE = "Unreachable" + UNKNOWN = "Unknown" + + +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The connection status.""" + + UNKNOWN = "Unknown" + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + DEGRADED = "Degraded" + + +class ConnectivityTopology(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Connectivity topology type.""" + + HUB_AND_SPOKE = "HubAndSpoke" + MESH = "Mesh" + + +class CoverageLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Test coverage for the endpoint.""" + + DEFAULT = "Default" + LOW = "Low" + BELOW_AVERAGE = "BelowAverage" + AVERAGE = "Average" + ABOVE_AVERAGE = "AboveAverage" + FULL = "Full" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class CustomIpPrefixType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of custom IP prefix. Should be Singular, Parent, or Child.""" + + SINGULAR = "Singular" + PARENT = "Parent" + CHILD = "Child" + + +class DdosSettingsProtectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The DDoS protection mode of the public IP.""" + + VIRTUAL_NETWORK_INHERITED = "VirtualNetworkInherited" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class DeleteExistingPeering(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Flag if need to remove current existing peerings.""" + + FALSE = "False" + TRUE = "True" + + +class DeleteOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specify what happens to the public IP address when the VM using it is deleted.""" + + DELETE = "Delete" + DETACH = "Detach" + + +class DeploymentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Deployment Status.""" + + NOT_STARTED = "NotStarted" + DEPLOYING = "Deploying" + DEPLOYED = "Deployed" + FAILED = "Failed" + + +class DestinationPortBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Destination port behavior.""" + + NONE = "None" + LISTEN_IF_AVAILABLE = "ListenIfAvailable" + + +class DhGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The DH Groups used in IKE Phase 1 for initial SA.""" + + NONE = "None" + DH_GROUP1 = "DHGroup1" + DH_GROUP2 = "DHGroup2" + DH_GROUP14 = "DHGroup14" + DH_GROUP2048 = "DHGroup2048" + ECP256 = "ECP256" + ECP384 = "ECP384" + DH_GROUP24 = "DHGroup24" + + +class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The direction of the traffic.""" + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + +class EffectiveAdminRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the rule is custom or default.""" + + CUSTOM = "Custom" + DEFAULT = "Default" + + +class EffectiveRouteSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Who created the route.""" + + UNKNOWN = "Unknown" + USER = "User" + VIRTUAL_NETWORK_GATEWAY = "VirtualNetworkGateway" + DEFAULT = "Default" + + +class EffectiveRouteState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The value of effective route.""" + + ACTIVE = "Active" + INVALID = "Invalid" + + +class EffectiveSecurityRuleProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network protocol this rule applies to.""" + + TCP = "Tcp" + UDP = "Udp" + ALL = "All" + + +class EndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The endpoint type.""" + + AZURE_VM = "AzureVM" + AZURE_V_NET = "AzureVNet" + AZURE_SUBNET = "AzureSubnet" + EXTERNAL_ADDRESS = "ExternalAddress" + MMA_WORKSPACE_MACHINE = "MMAWorkspaceMachine" + MMA_WORKSPACE_NETWORK = "MMAWorkspaceNetwork" + AZURE_ARC_VM = "AzureArcVM" + AZURE_VMSS = "AzureVMSS" + + +class EvaluationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Connectivity analysis evaluation state.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" + + +class ExpressRouteCircuitPeeringAdvertisedPublicPrefixState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The advertised public prefix state of the Peering resource.""" + + NOT_CONFIGURED = "NotConfigured" + CONFIGURING = "Configuring" + CONFIGURED = "Configured" + VALIDATION_NEEDED = "ValidationNeeded" + + +class ExpressRouteCircuitPeeringState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of peering.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class ExpressRouteCircuitSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The family of the SKU.""" + + UNLIMITED_DATA = "UnlimitedData" + METERED_DATA = "MeteredData" + + +class ExpressRouteCircuitSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The tier of the SKU.""" + + STANDARD = "Standard" + PREMIUM = "Premium" + BASIC = "Basic" + LOCAL = "Local" + + +class ExpressRouteLinkAdminState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Administrative state of the physical port.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ExpressRouteLinkConnectorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Physical fiber port type.""" + + LC = "LC" + SC = "SC" + + +class ExpressRouteLinkMacSecCipher(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mac security cipher.""" + + GCM_AES256 = "GcmAes256" + GCM_AES128 = "GcmAes128" + GCM_AES_XPN128 = "GcmAesXpn128" + GCM_AES_XPN256 = "GcmAesXpn256" + + +class ExpressRouteLinkMacSecSciState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Sci mode enabled/disabled.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class ExpressRoutePeeringState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of peering.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class ExpressRoutePeeringType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The peering type.""" + + AZURE_PUBLIC_PEERING = "AzurePublicPeering" + AZURE_PRIVATE_PEERING = "AzurePrivatePeering" + MICROSOFT_PEERING = "MicrosoftPeering" + + +class ExpressRoutePortAuthorizationUseStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The authorization use status.""" + + AVAILABLE = "Available" + IN_USE = "InUse" + + +class ExpressRoutePortsBillingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The billing type of the ExpressRoutePort resource.""" + + METERED_DATA = "MeteredData" + UNLIMITED_DATA = "UnlimitedData" + + +class ExpressRoutePortsEncapsulation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Encapsulation method on physical ports.""" + + DOT1_Q = "Dot1Q" + QIN_Q = "QinQ" + + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network + resources. + """ + + EDGE_ZONE = "EdgeZone" + + +class FirewallPolicyFilterRuleCollectionActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The action type of a rule.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class FirewallPolicyIDPSQuerySortOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes if results should be in ascending/descending order.""" + + ASCENDING = "Ascending" + DESCENDING = "Descending" + + +class FirewallPolicyIDPSSignatureDirection(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes in which direction signature is being enforced: 0 - OutBound, 1 - InBound, 2 - Any, 3 + - Internal, 4 - InternalOutbound. + """ + + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 + + +class FirewallPolicyIDPSSignatureMode(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny.""" + + ZERO = 0 + ONE = 1 + TWO = 2 + + +class FirewallPolicyIDPSSignatureSeverity(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the severity of signature: 1 - High, 2 - Medium, 3 - Low.""" + + ONE = 1 + TWO = 2 + THREE = 3 + + +class FirewallPolicyIntrusionDetectionProfileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible Intrusion Detection profile values.""" + + BASIC = "Basic" + STANDARD = "Standard" + ADVANCED = "Advanced" + EXTENDED = "Extended" + + +class FirewallPolicyIntrusionDetectionProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible intrusion detection bypass traffic protocols.""" + + TCP = "TCP" + UDP = "UDP" + ICMP = "ICMP" + ANY = "ANY" + + +class FirewallPolicyIntrusionDetectionStateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible state values.""" + + OFF = "Off" + ALERT = "Alert" + DENY = "Deny" + + +class FirewallPolicyNatRuleCollectionActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The action type of a rule.""" + + DNAT = "DNAT" + + +class FirewallPolicyRuleApplicationProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The application protocol type of a Rule.""" + + HTTP = "Http" + HTTPS = "Https" + + +class FirewallPolicyRuleCollectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the rule collection.""" + + FIREWALL_POLICY_NAT_RULE_COLLECTION = "FirewallPolicyNatRuleCollection" + FIREWALL_POLICY_FILTER_RULE_COLLECTION = "FirewallPolicyFilterRuleCollection" + + +class FirewallPolicyRuleNetworkProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Network protocol of a Rule.""" + + TCP = "TCP" + UDP = "UDP" + ANY = "Any" + ICMP = "ICMP" + + +class FirewallPolicyRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Rule Type.""" + + APPLICATION_RULE = "ApplicationRule" + NETWORK_RULE = "NetworkRule" + NAT_RULE = "NatRule" + + +class FirewallPolicySkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of Firewall Policy.""" + + STANDARD = "Standard" + PREMIUM = "Premium" + BASIC = "Basic" + + +class FlowLogFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The file type of flow log.""" + + JSON = "JSON" + + +class GatewayLoadBalancerTunnelInterfaceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Traffic type of gateway load balancer tunnel interface.""" + + NONE = "None" + INTERNAL = "Internal" + EXTERNAL = "External" + + +class GatewayLoadBalancerTunnelProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol of gateway load balancer tunnel interface.""" + + NONE = "None" + NATIVE = "Native" + VXLAN = "VXLAN" + + +class Geo(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Geo for CIDR advertising. Should be an Geo code.""" + + GLOBAL = "GLOBAL" + AFRI = "AFRI" + APAC = "APAC" + EURO = "EURO" + LATAM = "LATAM" + NAM = "NAM" + ME = "ME" + OCEANIA = "OCEANIA" + AQ = "AQ" + GLOBAL_ENUM = "GLOBAL" + + +class GroupConnectivity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Group connectivity type.""" + + NONE = "None" + DIRECTLY_CONNECTED = "DirectlyConnected" + + +class HTTPConfigurationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The HTTP method to use.""" + + GET = "Get" + POST = "Post" + + +class HTTPMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HTTP method.""" + + GET = "Get" + + +class HubBgpConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the VirtualHub to Peer.""" + + UNKNOWN = "Unknown" + CONNECTING = "Connecting" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class HubRoutingPreference(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The hub routing preference gateway types.""" + + EXPRESS_ROUTE = "ExpressRoute" + VPN_GATEWAY = "VpnGateway" + AS_PATH = "ASPath" + + +class HubVirtualNetworkConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the VirtualHub to vnet connection.""" + + UNKNOWN = "Unknown" + CONNECTING = "Connecting" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class IkeEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IKE encryption algorithm (IKE phase 2).""" + + DES = "DES" + DES3 = "DES3" + AES128 = "AES128" + AES192 = "AES192" + AES256 = "AES256" + GCMAES256 = "GCMAES256" + GCMAES128 = "GCMAES128" + + +class IkeIntegrity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IKE integrity algorithm (IKE phase 2).""" + + MD5 = "MD5" + SHA1 = "SHA1" + SHA256 = "SHA256" + SHA384 = "SHA384" + GCMAES256 = "GCMAES256" + GCMAES128 = "GCMAES128" + + +class InboundSecurityRulesProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol. This should be either TCP or UDP.""" + + TCP = "TCP" + UDP = "UDP" + + +class IPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IP address allocation method.""" + + STATIC = "Static" + DYNAMIC = "Dynamic" + + +class IpAllocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IpAllocation type.""" + + UNDEFINED = "Undefined" + HYPERNET = "Hypernet" + + +class IpFlowProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol to be verified on.""" + + TCP = "TCP" + UDP = "UDP" + + +class IpsecEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IPSec encryption algorithm (IKE phase 1).""" + + NONE = "None" + DES = "DES" + DES3 = "DES3" + AES128 = "AES128" + AES192 = "AES192" + AES256 = "AES256" + GCMAES128 = "GCMAES128" + GCMAES192 = "GCMAES192" + GCMAES256 = "GCMAES256" + + +class IpsecIntegrity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IPSec integrity algorithm (IKE phase 1).""" + + MD5 = "MD5" + SHA1 = "SHA1" + SHA256 = "SHA256" + GCMAES128 = "GCMAES128" + GCMAES192 = "GCMAES192" + GCMAES256 = "GCMAES256" + + +class IPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IP address version.""" + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + + +class IsGlobal(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Flag if global mesh is supported.""" + + FALSE = "False" + TRUE = "True" + + +class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of issue.""" + + UNKNOWN = "Unknown" + AGENT_STOPPED = "AgentStopped" + GUEST_FIREWALL = "GuestFirewall" + DNS_RESOLUTION = "DnsResolution" + SOCKET_BIND = "SocketBind" + NETWORK_SECURITY_RULE = "NetworkSecurityRule" + USER_DEFINED_ROUTE = "UserDefinedRoute" + PORT_THROTTLED = "PortThrottled" + PLATFORM = "Platform" + + +class IsWorkloadProtected(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Value indicating whether the IP address is DDoS workload protected or not.""" + + FALSE = "False" + TRUE = "True" + + +class LoadBalancerBackendAddressAdminState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A list of administrative states which once set can override health probe so that Load Balancer + will always forward new connections to backend, or deny new connections and reset existing + connections. + """ + + NONE = "None" + UP = "Up" + DOWN = "Down" + + +class LoadBalancerOutboundRuleProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol for the outbound rule in load balancer.""" + + TCP = "Tcp" + UDP = "Udp" + ALL = "All" + + +class LoadBalancerSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of a load balancer SKU.""" + + BASIC = "Basic" + STANDARD = "Standard" + GATEWAY = "Gateway" + + +class LoadBalancerSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of a load balancer SKU.""" + + REGIONAL = "Regional" + GLOBAL = "Global" + GLOBAL_ENUM = "Global" + + +class LoadDistribution(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The load distribution policy for this rule.""" + + DEFAULT = "Default" + SOURCE_IP = "SourceIP" + SOURCE_IP_PROTOCOL = "SourceIPProtocol" + + +class ManagedRuleEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the managed rule. Defaults to Disabled if not specified.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class NatGatewaySkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of Nat Gateway SKU.""" + + STANDARD = "Standard" + + +class NetworkIntentPolicyBasedService(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network intent policy based services.""" + + NONE = "None" + ALL = "All" + ALLOW_RULES_ONLY = "AllowRulesOnly" + + +class NetworkInterfaceAuxiliaryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Auxiliary mode of Network Interface resource.""" + + NONE = "None" + MAX_CONNECTIONS = "MaxConnections" + FLOATING = "Floating" + ACCELERATED_CONNECTIONS = "AcceleratedConnections" + + +class NetworkInterfaceAuxiliarySku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Auxiliary sku of Network Interface resource.""" + + NONE = "None" + A1 = "A1" + A2 = "A2" + A4 = "A4" + A8 = "A8" + + +class NetworkInterfaceMigrationPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Migration phase of Network Interface resource.""" + + NONE = "None" + PREPARE = "Prepare" + COMMIT = "Commit" + ABORT = "Abort" + COMMITTED = "Committed" + + +class NetworkInterfaceNicType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of Network Interface resource.""" + + STANDARD = "Standard" + ELASTIC = "Elastic" + + +class NetworkOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the Azure async operation.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class NextHopType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Next hop type.""" + + INTERNET = "Internet" + VIRTUAL_APPLIANCE = "VirtualAppliance" + VIRTUAL_NETWORK_GATEWAY = "VirtualNetworkGateway" + VNET_LOCAL = "VnetLocal" + HYPER_NET_GATEWAY = "HyperNetGateway" + NONE = "None" + + +class NextStep(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported next step behaviors after a rule is applied to a matched route.""" + + UNKNOWN = "Unknown" + CONTINUE = "Continue" + TERMINATE = "Terminate" + CONTINUE_ENUM = "Continue" + + +class OfficeTrafficCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The office traffic category.""" + + OPTIMIZE = "Optimize" + OPTIMIZE_AND_ALLOW = "OptimizeAndAllow" + ALL = "All" + NONE = "None" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The origin of the issue.""" + + LOCAL = "Local" + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + +class OutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Connection monitor output destination type. Currently, only "Workspace" is supported.""" + + WORKSPACE = "Workspace" + + +class OwaspCrsExclusionEntryMatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The variable to be excluded.""" + + REQUEST_HEADER_NAMES = "RequestHeaderNames" + REQUEST_COOKIE_NAMES = "RequestCookieNames" + REQUEST_ARG_NAMES = "RequestArgNames" + REQUEST_HEADER_KEYS = "RequestHeaderKeys" + REQUEST_HEADER_VALUES = "RequestHeaderValues" + REQUEST_COOKIE_KEYS = "RequestCookieKeys" + REQUEST_COOKIE_VALUES = "RequestCookieValues" + REQUEST_ARG_KEYS = "RequestArgKeys" + REQUEST_ARG_VALUES = "RequestArgValues" + + +class OwaspCrsExclusionEntrySelectorMatchOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """When matchVariable is a collection, operate on the selector to specify which elements in the + collection this exclusion applies to. + """ + + EQUALS = "Equals" + CONTAINS = "Contains" + STARTS_WITH = "StartsWith" + ENDS_WITH = "EndsWith" + EQUALS_ANY = "EqualsAny" + + +class PacketCaptureTargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Target type of the resource provided.""" + + AZURE_VM = "AzureVM" + AZURE_VMSS = "AzureVMSS" + + +class PcError(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PcError.""" + + INTERNAL_ERROR = "InternalError" + AGENT_STOPPED = "AgentStopped" + CAPTURE_FAILED = "CaptureFailed" + LOCAL_FILE_FAILED = "LocalFileFailed" + STORAGE_FAILED = "StorageFailed" + + +class PcProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol to be filtered on.""" + + TCP = "TCP" + UDP = "UDP" + ANY = "Any" + + +class PcStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the packet capture session.""" + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + STOPPED = "Stopped" + ERROR = "Error" + UNKNOWN = "Unknown" + + +class PfsGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Pfs Groups used in IKE Phase 2 for new child SA.""" + + NONE = "None" + PFS1 = "PFS1" + PFS2 = "PFS2" + PFS2048 = "PFS2048" + ECP256 = "ECP256" + ECP384 = "ECP384" + PFS24 = "PFS24" + PFS14 = "PFS14" + PFSMM = "PFSMM" + + +class PreferredIPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The preferred IP version to use in test evaluation. The connection monitor may choose to use a + different version depending on other parameters. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + + +class PreferredRoutingGateway(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The preferred routing gateway types.""" + + EXPRESS_ROUTE = "ExpressRoute" + VPN_GATEWAY = "VpnGateway" + NONE = "None" + + +class ProbeProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe + to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI + is required for the probe to be successful. + """ + + HTTP = "Http" + TCP = "Tcp" + HTTPS = "Https" + + +class ProcessorArchitecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VPN client Processor Architecture.""" + + AMD64 = "Amd64" + X86 = "X86" + + +class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network protocol.""" + + TCP = "Tcp" + HTTP = "Http" + HTTPS = "Https" + ICMP = "Icmp" + + +class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RNM supported protocol types.""" + + DO_NOT_USE = "DoNotUse" + ICMP = "Icmp" + TCP = "Tcp" + UDP = "Udp" + GRE = "Gre" + ESP = "Esp" + AH = "Ah" + VXLAN = "Vxlan" + ALL = "All" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + + +class PublicIpAddressDnsSettingsDomainNameLabelScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The domain name label scope. If a domain name label and a domain name label scope are + specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system with + a hashed value includes in FQDN. + """ + + TENANT_REUSE = "TenantReuse" + SUBSCRIPTION_REUSE = "SubscriptionReuse" + RESOURCE_GROUP_REUSE = "ResourceGroupReuse" + NO_REUSE = "NoReuse" + + +class PublicIPAddressMigrationPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Migration phase of Public IP Address.""" + + NONE = "None" + PREPARE = "Prepare" + COMMIT = "Commit" + ABORT = "Abort" + COMMITTED = "Committed" + + +class PublicIPAddressSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of a public IP address SKU.""" + + BASIC = "Basic" + STANDARD = "Standard" + + +class PublicIPAddressSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of a public IP address SKU.""" + + REGIONAL = "Regional" + GLOBAL = "Global" + GLOBAL_ENUM = "Global" + + +class PublicIPPrefixSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of a public IP prefix SKU.""" + + STANDARD = "Standard" + + +class PublicIPPrefixSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tier of a public IP prefix SKU.""" + + REGIONAL = "Regional" + GLOBAL = "Global" + GLOBAL_ENUM = "Global" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the virtual machine. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + + +class RouteFilterRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The rule type of the rule.""" + + COMMUNITY = "Community" + + +class RouteMapActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Kind of actions which can be taken on a matched route. Add, Replace, Remove refer to parameters + on the route, like community or prefix. + """ + + UNKNOWN = "Unknown" + REMOVE = "Remove" + ADD = "Add" + REPLACE = "Replace" + DROP = "Drop" + + +class RouteMapMatchCondition(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Match condition to apply RouteMap rules.""" + + UNKNOWN = "Unknown" + CONTAINS = "Contains" + EQUALS = "Equals" + NOT_CONTAINS = "NotContains" + NOT_EQUALS = "NotEquals" + + +class RouteNextHopType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Azure hop the packet should be sent to.""" + + VIRTUAL_NETWORK_GATEWAY = "VirtualNetworkGateway" + VNET_LOCAL = "VnetLocal" + INTERNET = "Internet" + VIRTUAL_APPLIANCE = "VirtualAppliance" + NONE = "None" + + +class RoutingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current routing state of the VirtualHub.""" + + NONE = "None" + PROVISIONED = "Provisioned" + PROVISIONING = "Provisioning" + FAILED = "Failed" + + +class ScopeConnectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current scope connection state.""" + + CONNECTED = "Connected" + PENDING = "Pending" + CONFLICT = "Conflict" + REVOKED = "Revoked" + REJECTED = "Rejected" + + +class ScrubbingRuleEntryMatchOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """When matchVariable is a collection, operate on the selector to specify which elements in the + collection this rule applies to. + """ + + EQUALS = "Equals" + EQUALS_ANY = "EqualsAny" + + +class ScrubbingRuleEntryMatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The variable to be scrubbed from the logs.""" + + REQUEST_HEADER_NAMES = "RequestHeaderNames" + REQUEST_COOKIE_NAMES = "RequestCookieNames" + REQUEST_ARG_NAMES = "RequestArgNames" + REQUEST_POST_ARG_NAMES = "RequestPostArgNames" + REQUEST_JSON_ARG_NAMES = "RequestJSONArgNames" + REQUEST_IP_ADDRESS = "RequestIPAddress" + + +class ScrubbingRuleEntryState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the state of log scrubbing rule. Default value is Enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class SecurityConfigurationRuleAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether network traffic is allowed or denied.""" + + ALLOW = "Allow" + DENY = "Deny" + ALWAYS_ALLOW = "AlwaysAllow" + + +class SecurityConfigurationRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The direction of the rule. The direction specifies if the rule will be evaluated on incoming or + outgoing traffic. + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + +class SecurityConfigurationRuleProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network protocol this rule applies to.""" + + TCP = "Tcp" + UDP = "Udp" + ICMP = "Icmp" + ESP = "Esp" + ANY = "Any" + AH = "Ah" + + +class SecurityPartnerProviderConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the connection with Security Partner Provider.""" + + UNKNOWN = "Unknown" + PARTIALLY_CONNECTED = "PartiallyConnected" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class SecurityProviderName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Security Providers.""" + + Z_SCALER = "ZScaler" + I_BOSS = "IBoss" + CHECKPOINT = "Checkpoint" + + +class SecurityRuleAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether network traffic is allowed or denied.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class SecurityRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The direction of the rule. The direction specifies if rule will be evaluated on incoming or + outgoing traffic. + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + +class SecurityRuleProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network protocol this rule applies to.""" + + TCP = "Tcp" + UDP = "Udp" + ICMP = "Icmp" + ESP = "Esp" + ASTERISK = "*" + AH = "Ah" + + +class ServiceProviderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The ServiceProviderProvisioningState state of the resource.""" + + NOT_PROVISIONED = "NotProvisioned" + PROVISIONING = "Provisioning" + PROVISIONED = "Provisioned" + DEPROVISIONING = "Deprovisioning" + + +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The severity of the issue.""" + + ERROR = "Error" + WARNING = "Warning" + + +class SlotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies slot info on a cloud service.""" + + PRODUCTION = "Production" + STAGING = "Staging" + + +class SyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backend address synchronous mode for the backend pool.""" + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + + +class SyncRemoteAddressSpace(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SyncRemoteAddressSpace.""" + + TRUE = "true" + + +class TransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The transport protocol for the endpoint.""" + + UDP = "Udp" + TCP = "Tcp" + ALL = "All" + + +class TunnelConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the tunnel.""" + + UNKNOWN = "Unknown" + CONNECTING = "Connecting" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class UsageUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """An enum describing the unit of measurement.""" + + COUNT = "Count" + + +class UseHubGateway(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Flag if need to use hub gateway.""" + + FALSE = "False" + TRUE = "True" + + +class VerbosityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Verbosity level.""" + + NORMAL = "Normal" + MINIMUM = "Minimum" + FULL = "Full" + + +class VirtualNetworkEncryptionEnforcement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If the encrypted VNet allows VM that does not support encryption.""" + + DROP_UNENCRYPTED = "DropUnencrypted" + ALLOW_UNENCRYPTED = "AllowUnencrypted" + + +class VirtualNetworkGatewayConnectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gateway connection type.""" + + DEFAULT = "Default" + RESPONDER_ONLY = "ResponderOnly" + INITIATOR_ONLY = "InitiatorOnly" + + +class VirtualNetworkGatewayConnectionProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gateway connection protocol.""" + + IK_EV2 = "IKEv2" + IK_EV1 = "IKEv1" + + +class VirtualNetworkGatewayConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Virtual Network Gateway connection status.""" + + UNKNOWN = "Unknown" + CONNECTING = "Connecting" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class VirtualNetworkGatewayConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gateway connection type.""" + + I_PSEC = "IPsec" + VNET2_VNET = "Vnet2Vnet" + EXPRESS_ROUTE = "ExpressRoute" + VPN_CLIENT = "VPNClient" + + +class VirtualNetworkGatewaySkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gateway SKU name.""" + + BASIC = "Basic" + HIGH_PERFORMANCE = "HighPerformance" + STANDARD = "Standard" + ULTRA_PERFORMANCE = "UltraPerformance" + VPN_GW1 = "VpnGw1" + VPN_GW2 = "VpnGw2" + VPN_GW3 = "VpnGw3" + VPN_GW4 = "VpnGw4" + VPN_GW5 = "VpnGw5" + VPN_GW1_AZ = "VpnGw1AZ" + VPN_GW2_AZ = "VpnGw2AZ" + VPN_GW3_AZ = "VpnGw3AZ" + VPN_GW4_AZ = "VpnGw4AZ" + VPN_GW5_AZ = "VpnGw5AZ" + ER_GW1_AZ = "ErGw1AZ" + ER_GW2_AZ = "ErGw2AZ" + ER_GW3_AZ = "ErGw3AZ" + ER_GW_SCALE = "ErGwScale" + + +class VirtualNetworkGatewaySkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gateway SKU tier.""" + + BASIC = "Basic" + HIGH_PERFORMANCE = "HighPerformance" + STANDARD = "Standard" + ULTRA_PERFORMANCE = "UltraPerformance" + VPN_GW1 = "VpnGw1" + VPN_GW2 = "VpnGw2" + VPN_GW3 = "VpnGw3" + VPN_GW4 = "VpnGw4" + VPN_GW5 = "VpnGw5" + VPN_GW1_AZ = "VpnGw1AZ" + VPN_GW2_AZ = "VpnGw2AZ" + VPN_GW3_AZ = "VpnGw3AZ" + VPN_GW4_AZ = "VpnGw4AZ" + VPN_GW5_AZ = "VpnGw5AZ" + ER_GW1_AZ = "ErGw1AZ" + ER_GW2_AZ = "ErGw2AZ" + ER_GW3_AZ = "ErGw3AZ" + ER_GW_SCALE = "ErGwScale" + + +class VirtualNetworkGatewayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of this virtual network gateway.""" + + VPN = "Vpn" + EXPRESS_ROUTE = "ExpressRoute" + LOCAL_GATEWAY = "LocalGateway" + + +class VirtualNetworkPeeringLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The peering sync status of the virtual network peering.""" + + FULLY_IN_SYNC = "FullyInSync" + REMOTE_NOT_IN_SYNC = "RemoteNotInSync" + LOCAL_NOT_IN_SYNC = "LocalNotInSync" + LOCAL_AND_REMOTE_NOT_IN_SYNC = "LocalAndRemoteNotInSync" + + +class VirtualNetworkPeeringState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the virtual network peering.""" + + INITIATED = "Initiated" + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + + +class VirtualNetworkPrivateEndpointNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable or Disable apply network policies on private end point in the subnet.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + NETWORK_SECURITY_GROUP_ENABLED = "NetworkSecurityGroupEnabled" + ROUTE_TABLE_ENABLED = "RouteTableEnabled" + + +class VirtualNetworkPrivateLinkServiceNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable or Disable apply network policies on private link service in the subnet.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class VirtualWanSecurityProviderType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The virtual wan security provider type.""" + + EXTERNAL = "External" + NATIVE = "Native" + + +class VnetLocalRouteOverrideCriteria(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in + spoke vnet. + """ + + CONTAINS = "Contains" + EQUAL = "Equal" + + +class VpnAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VPN authentication types enabled for the virtual network gateway.""" + + CERTIFICATE = "Certificate" + RADIUS = "Radius" + AAD = "AAD" + + +class VpnClientProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VPN client protocol enabled for the virtual network gateway.""" + + IKE_V2 = "IkeV2" + SSTP = "SSTP" + OPEN_VPN = "OpenVPN" + + +class VpnConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the vpn connection.""" + + UNKNOWN = "Unknown" + CONNECTING = "Connecting" + CONNECTED = "Connected" + NOT_CONNECTED = "NotConnected" + + +class VpnGatewayGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN.""" + + NONE = "None" + GENERATION1 = "Generation1" + GENERATION2 = "Generation2" + + +class VpnGatewayTunnelingProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VPN protocol enabled for the VpnServerConfiguration.""" + + IKE_V2 = "IkeV2" + OPEN_VPN = "OpenVPN" + + +class VpnLinkConnectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Vpn link connection mode.""" + + DEFAULT = "Default" + RESPONDER_ONLY = "ResponderOnly" + INITIATOR_ONLY = "InitiatorOnly" + + +class VpnNatRuleMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Source NAT direction of a VPN NAT.""" + + EGRESS_SNAT = "EgressSnat" + INGRESS_SNAT = "IngressSnat" + + +class VpnNatRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of NAT rule for VPN NAT.""" + + STATIC = "Static" + DYNAMIC = "Dynamic" + + +class VpnPolicyMemberAttributeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Vpn Policy member attribute type.""" + + CERTIFICATE_GROUP_ID = "CertificateGroupId" + AAD_GROUP_ID = "AADGroupId" + RADIUS_AZURE_GROUP_ID = "RadiusAzureGroupId" + + +class VpnType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of this virtual network gateway.""" + + POLICY_BASED = "PolicyBased" + ROUTE_BASED = "RouteBased" + + +class WebApplicationFirewallAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of Actions.""" + + ALLOW = "Allow" + BLOCK = "Block" + LOG = "Log" + JS_CHALLENGE = "JSChallenge" + + +class WebApplicationFirewallEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the policy.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class WebApplicationFirewallMatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Match Variable.""" + + REMOTE_ADDR = "RemoteAddr" + REQUEST_METHOD = "RequestMethod" + QUERY_STRING = "QueryString" + POST_ARGS = "PostArgs" + REQUEST_URI = "RequestUri" + REQUEST_HEADERS = "RequestHeaders" + REQUEST_BODY = "RequestBody" + REQUEST_COOKIES = "RequestCookies" + + +class WebApplicationFirewallMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode of the policy.""" + + PREVENTION = "Prevention" + DETECTION = "Detection" + + +class WebApplicationFirewallOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operator to be matched.""" + + IP_MATCH = "IPMatch" + EQUAL = "Equal" + CONTAINS = "Contains" + LESS_THAN = "LessThan" + GREATER_THAN = "GreaterThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + BEGINS_WITH = "BeginsWith" + ENDS_WITH = "EndsWith" + REGEX = "Regex" + GEO_MATCH = "GeoMatch" + ANY = "Any" + + +class WebApplicationFirewallPolicyResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the policy.""" + + CREATING = "Creating" + ENABLING = "Enabling" + ENABLED = "Enabled" + DISABLING = "Disabling" + DISABLED = "Disabled" + DELETING = "Deleting" + + +class WebApplicationFirewallRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The rule type.""" + + MATCH_RULE = "MatchRule" + RATE_LIMIT_RULE = "RateLimitRule" + INVALID = "Invalid" + + +class WebApplicationFirewallScrubbingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the log scrubbing config. Default value is Enabled.""" + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class WebApplicationFirewallState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not + specified. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + + +class WebApplicationFirewallTransform(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transforms applied before matching.""" + + UPPERCASE = "Uppercase" + LOWERCASE = "Lowercase" + TRIM = "Trim" + URL_DECODE = "UrlDecode" + URL_ENCODE = "UrlEncode" + REMOVE_NULLS = "RemoveNulls" + HTML_ENTITY_DECODE = "HtmlEntityDecode" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_patch.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/__init__.py new file mode 100644 index 000000000000..475c77afc399 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/__init__.py @@ -0,0 +1,283 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import ApplicationGatewaysOperations +from ._operations import ApplicationGatewayPrivateLinkResourcesOperations +from ._operations import ApplicationGatewayPrivateEndpointConnectionsOperations +from ._operations import ApplicationGatewayWafDynamicManifestsDefaultOperations +from ._operations import ApplicationGatewayWafDynamicManifestsOperations +from ._operations import ApplicationSecurityGroupsOperations +from ._operations import AvailableDelegationsOperations +from ._operations import AvailableResourceGroupDelegationsOperations +from ._operations import AvailableServiceAliasesOperations +from ._operations import AzureFirewallsOperations +from ._operations import AzureFirewallFqdnTagsOperations +from ._operations import WebCategoriesOperations +from ._operations import BastionHostsOperations +from ._operations import NetworkManagementClientOperationsMixin +from ._operations import NetworkInterfacesOperations +from ._operations import PublicIPAddressesOperations +from ._operations import VipSwapOperations +from ._operations import CustomIPPrefixesOperations +from ._operations import DdosCustomPoliciesOperations +from ._operations import DdosProtectionPlansOperations +from ._operations import DscpConfigurationOperations +from ._operations import AvailableEndpointServicesOperations +from ._operations import ExpressRouteCircuitAuthorizationsOperations +from ._operations import ExpressRouteCircuitPeeringsOperations +from ._operations import ExpressRouteCircuitConnectionsOperations +from ._operations import PeerExpressRouteCircuitConnectionsOperations +from ._operations import ExpressRouteCircuitsOperations +from ._operations import ExpressRouteServiceProvidersOperations +from ._operations import ExpressRouteCrossConnectionsOperations +from ._operations import ExpressRouteCrossConnectionPeeringsOperations +from ._operations import ExpressRoutePortsLocationsOperations +from ._operations import ExpressRoutePortsOperations +from ._operations import ExpressRouteLinksOperations +from ._operations import ExpressRoutePortAuthorizationsOperations +from ._operations import ExpressRouteProviderPortsLocationOperations +from ._operations import FirewallPoliciesOperations +from ._operations import FirewallPolicyRuleCollectionGroupsOperations +from ._operations import FirewallPolicyIdpsSignaturesOperations +from ._operations import FirewallPolicyIdpsSignaturesOverridesOperations +from ._operations import FirewallPolicyIdpsSignaturesFilterValuesOperations +from ._operations import IpAllocationsOperations +from ._operations import IpGroupsOperations +from ._operations import LoadBalancersOperations +from ._operations import LoadBalancerBackendAddressPoolsOperations +from ._operations import LoadBalancerFrontendIPConfigurationsOperations +from ._operations import InboundNatRulesOperations +from ._operations import LoadBalancerLoadBalancingRulesOperations +from ._operations import LoadBalancerOutboundRulesOperations +from ._operations import LoadBalancerNetworkInterfacesOperations +from ._operations import LoadBalancerProbesOperations +from ._operations import NatGatewaysOperations +from ._operations import NetworkInterfaceIPConfigurationsOperations +from ._operations import NetworkInterfaceLoadBalancersOperations +from ._operations import NetworkInterfaceTapConfigurationsOperations +from ._operations import NetworkManagersOperations +from ._operations import NetworkManagerCommitsOperations +from ._operations import NetworkManagerDeploymentStatusOperations +from ._operations import SubscriptionNetworkManagerConnectionsOperations +from ._operations import ManagementGroupNetworkManagerConnectionsOperations +from ._operations import ConnectivityConfigurationsOperations +from ._operations import NetworkGroupsOperations +from ._operations import StaticMembersOperations +from ._operations import ScopeConnectionsOperations +from ._operations import SecurityAdminConfigurationsOperations +from ._operations import AdminRuleCollectionsOperations +from ._operations import AdminRulesOperations +from ._operations import NetworkProfilesOperations +from ._operations import NetworkSecurityGroupsOperations +from ._operations import SecurityRulesOperations +from ._operations import DefaultSecurityRulesOperations +from ._operations import NetworkVirtualAppliancesOperations +from ._operations import VirtualApplianceSitesOperations +from ._operations import VirtualApplianceSkusOperations +from ._operations import InboundSecurityRuleOperations +from ._operations import NetworkWatchersOperations +from ._operations import PacketCapturesOperations +from ._operations import ConnectionMonitorsOperations +from ._operations import FlowLogsOperations +from ._operations import Operations +from ._operations import PrivateEndpointsOperations +from ._operations import AvailablePrivateEndpointTypesOperations +from ._operations import PrivateDnsZoneGroupsOperations +from ._operations import PrivateLinkServicesOperations +from ._operations import PublicIPPrefixesOperations +from ._operations import RouteFiltersOperations +from ._operations import RouteFilterRulesOperations +from ._operations import RouteTablesOperations +from ._operations import RoutesOperations +from ._operations import SecurityPartnerProvidersOperations +from ._operations import BgpServiceCommunitiesOperations +from ._operations import ServiceEndpointPoliciesOperations +from ._operations import ServiceEndpointPolicyDefinitionsOperations +from ._operations import ServiceTagsOperations +from ._operations import ServiceTagInformationOperations +from ._operations import UsagesOperations +from ._operations import VirtualNetworksOperations +from ._operations import SubnetsOperations +from ._operations import ResourceNavigationLinksOperations +from ._operations import ServiceAssociationLinksOperations +from ._operations import VirtualNetworkPeeringsOperations +from ._operations import VirtualNetworkGatewaysOperations +from ._operations import VirtualNetworkGatewayConnectionsOperations +from ._operations import LocalNetworkGatewaysOperations +from ._operations import VirtualNetworkGatewayNatRulesOperations +from ._operations import VirtualNetworkTapsOperations +from ._operations import VirtualRoutersOperations +from ._operations import VirtualRouterPeeringsOperations +from ._operations import VirtualWansOperations +from ._operations import VpnSitesOperations +from ._operations import VpnSiteLinksOperations +from ._operations import VpnSitesConfigurationOperations +from ._operations import VpnServerConfigurationsOperations +from ._operations import ConfigurationPolicyGroupsOperations +from ._operations import VirtualHubsOperations +from ._operations import RouteMapsOperations +from ._operations import HubVirtualNetworkConnectionsOperations +from ._operations import VpnGatewaysOperations +from ._operations import VpnLinkConnectionsOperations +from ._operations import VpnConnectionsOperations +from ._operations import VpnSiteLinkConnectionsOperations +from ._operations import NatRulesOperations +from ._operations import P2SVpnGatewaysOperations +from ._operations import VpnServerConfigurationsAssociatedWithVirtualWanOperations +from ._operations import VirtualHubRouteTableV2SOperations +from ._operations import ExpressRouteGatewaysOperations +from ._operations import ExpressRouteConnectionsOperations +from ._operations import NetworkVirtualApplianceConnectionsOperations +from ._operations import VirtualHubBgpConnectionOperations +from ._operations import VirtualHubBgpConnectionsOperations +from ._operations import VirtualHubIpConfigurationOperations +from ._operations import HubRouteTablesOperations +from ._operations import RoutingIntentOperations +from ._operations import WebApplicationFirewallPoliciesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationGatewaysOperations", + "ApplicationGatewayPrivateLinkResourcesOperations", + "ApplicationGatewayPrivateEndpointConnectionsOperations", + "ApplicationGatewayWafDynamicManifestsDefaultOperations", + "ApplicationGatewayWafDynamicManifestsOperations", + "ApplicationSecurityGroupsOperations", + "AvailableDelegationsOperations", + "AvailableResourceGroupDelegationsOperations", + "AvailableServiceAliasesOperations", + "AzureFirewallsOperations", + "AzureFirewallFqdnTagsOperations", + "WebCategoriesOperations", + "BastionHostsOperations", + "NetworkManagementClientOperationsMixin", + "NetworkInterfacesOperations", + "PublicIPAddressesOperations", + "VipSwapOperations", + "CustomIPPrefixesOperations", + "DdosCustomPoliciesOperations", + "DdosProtectionPlansOperations", + "DscpConfigurationOperations", + "AvailableEndpointServicesOperations", + "ExpressRouteCircuitAuthorizationsOperations", + "ExpressRouteCircuitPeeringsOperations", + "ExpressRouteCircuitConnectionsOperations", + "PeerExpressRouteCircuitConnectionsOperations", + "ExpressRouteCircuitsOperations", + "ExpressRouteServiceProvidersOperations", + "ExpressRouteCrossConnectionsOperations", + "ExpressRouteCrossConnectionPeeringsOperations", + "ExpressRoutePortsLocationsOperations", + "ExpressRoutePortsOperations", + "ExpressRouteLinksOperations", + "ExpressRoutePortAuthorizationsOperations", + "ExpressRouteProviderPortsLocationOperations", + "FirewallPoliciesOperations", + "FirewallPolicyRuleCollectionGroupsOperations", + "FirewallPolicyIdpsSignaturesOperations", + "FirewallPolicyIdpsSignaturesOverridesOperations", + "FirewallPolicyIdpsSignaturesFilterValuesOperations", + "IpAllocationsOperations", + "IpGroupsOperations", + "LoadBalancersOperations", + "LoadBalancerBackendAddressPoolsOperations", + "LoadBalancerFrontendIPConfigurationsOperations", + "InboundNatRulesOperations", + "LoadBalancerLoadBalancingRulesOperations", + "LoadBalancerOutboundRulesOperations", + "LoadBalancerNetworkInterfacesOperations", + "LoadBalancerProbesOperations", + "NatGatewaysOperations", + "NetworkInterfaceIPConfigurationsOperations", + "NetworkInterfaceLoadBalancersOperations", + "NetworkInterfaceTapConfigurationsOperations", + "NetworkManagersOperations", + "NetworkManagerCommitsOperations", + "NetworkManagerDeploymentStatusOperations", + "SubscriptionNetworkManagerConnectionsOperations", + "ManagementGroupNetworkManagerConnectionsOperations", + "ConnectivityConfigurationsOperations", + "NetworkGroupsOperations", + "StaticMembersOperations", + "ScopeConnectionsOperations", + "SecurityAdminConfigurationsOperations", + "AdminRuleCollectionsOperations", + "AdminRulesOperations", + "NetworkProfilesOperations", + "NetworkSecurityGroupsOperations", + "SecurityRulesOperations", + "DefaultSecurityRulesOperations", + "NetworkVirtualAppliancesOperations", + "VirtualApplianceSitesOperations", + "VirtualApplianceSkusOperations", + "InboundSecurityRuleOperations", + "NetworkWatchersOperations", + "PacketCapturesOperations", + "ConnectionMonitorsOperations", + "FlowLogsOperations", + "Operations", + "PrivateEndpointsOperations", + "AvailablePrivateEndpointTypesOperations", + "PrivateDnsZoneGroupsOperations", + "PrivateLinkServicesOperations", + "PublicIPPrefixesOperations", + "RouteFiltersOperations", + "RouteFilterRulesOperations", + "RouteTablesOperations", + "RoutesOperations", + "SecurityPartnerProvidersOperations", + "BgpServiceCommunitiesOperations", + "ServiceEndpointPoliciesOperations", + "ServiceEndpointPolicyDefinitionsOperations", + "ServiceTagsOperations", + "ServiceTagInformationOperations", + "UsagesOperations", + "VirtualNetworksOperations", + "SubnetsOperations", + "ResourceNavigationLinksOperations", + "ServiceAssociationLinksOperations", + "VirtualNetworkPeeringsOperations", + "VirtualNetworkGatewaysOperations", + "VirtualNetworkGatewayConnectionsOperations", + "LocalNetworkGatewaysOperations", + "VirtualNetworkGatewayNatRulesOperations", + "VirtualNetworkTapsOperations", + "VirtualRoutersOperations", + "VirtualRouterPeeringsOperations", + "VirtualWansOperations", + "VpnSitesOperations", + "VpnSiteLinksOperations", + "VpnSitesConfigurationOperations", + "VpnServerConfigurationsOperations", + "ConfigurationPolicyGroupsOperations", + "VirtualHubsOperations", + "RouteMapsOperations", + "HubVirtualNetworkConnectionsOperations", + "VpnGatewaysOperations", + "VpnLinkConnectionsOperations", + "VpnConnectionsOperations", + "VpnSiteLinkConnectionsOperations", + "NatRulesOperations", + "P2SVpnGatewaysOperations", + "VpnServerConfigurationsAssociatedWithVirtualWanOperations", + "VirtualHubRouteTableV2SOperations", + "ExpressRouteGatewaysOperations", + "ExpressRouteConnectionsOperations", + "NetworkVirtualApplianceConnectionsOperations", + "VirtualHubBgpConnectionOperations", + "VirtualHubBgpConnectionsOperations", + "VirtualHubIpConfigurationOperations", + "HubRouteTablesOperations", + "RoutingIntentOperations", + "WebApplicationFirewallPoliciesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_operations.py new file mode 100644 index 000000000000..bf2e690fa201 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_operations.py @@ -0,0 +1,99172 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import NetworkManagementClientMixinABC, _convert_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_application_gateways_delete_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_get_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_create_or_update_request( + resource_group_name: str, application_gateway_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-09-01")) + 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.Network/applicationGateways/{applicationGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_update_tags_request( + resource_group_name: str, application_gateway_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-09-01")) + 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.Network/applicationGateways/{applicationGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_start_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_application_gateways_stop_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_application_gateways_backend_health_request( + resource_group_name: str, + application_gateway_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_application_gateways_backend_health_on_demand_request( + resource_group_name: str, + application_gateway_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + 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.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "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_application_gateways_list_available_server_variables_request( + 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_available_request_headers_request( + 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_available_response_headers_request( + 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_available_waf_rule_sets_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_available_ssl_options_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_list_available_ssl_predefined_policies_request( + 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateways_get_ssl_predefined_policy_request( + predefined_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "predefinedPolicyName": _SERIALIZER.url("predefined_policy_name", predefined_policy_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_application_gateway_private_link_resources_list_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_private_endpoint_connections_delete_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_private_endpoint_connections_update_request( + resource_group_name: str, application_gateway_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-09-01")) + 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.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_private_endpoint_connections_get_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_private_endpoint_connections_list_request( + resource_group_name: str, application_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationGatewayName": _SERIALIZER.url("application_gateway_name", application_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_waf_dynamic_manifests_default_get_request( + location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_gateway_waf_dynamic_manifests_get_request( + location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_delete_request( + resource_group_name: str, application_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationSecurityGroupName": _SERIALIZER.url( + "application_security_group_name", application_security_group_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_get_request( + resource_group_name: str, application_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationSecurityGroupName": _SERIALIZER.url( + "application_security_group_name", application_security_group_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_create_or_update_request( + resource_group_name: str, application_security_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", "2023-09-01")) + 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.Network/applicationSecurityGroups/{applicationSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationSecurityGroupName": _SERIALIZER.url( + "application_security_group_name", application_security_group_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_update_tags_request( + resource_group_name: str, application_security_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", "2023-09-01")) + 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.Network/applicationSecurityGroups/{applicationSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "applicationSecurityGroupName": _SERIALIZER.url( + "application_security_group_name", application_security_group_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_application_security_groups_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_delegations_list_request(location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_resource_group_delegations_list_request( + location: str, resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_service_aliases_list_request(location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_service_aliases_list_by_resource_group_request( + resource_group_name: str, location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_delete_request( + resource_group_name: str, azure_firewall_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url("azure_firewall_name", azure_firewall_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_get_request( + resource_group_name: str, azure_firewall_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url("azure_firewall_name", azure_firewall_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_create_or_update_request( + resource_group_name: str, azure_firewall_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-09-01")) + 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.Network/azureFirewalls/{azureFirewallName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url( + "azure_firewall_name", azure_firewall_name, "str", max_length=56, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_update_tags_request( + resource_group_name: str, azure_firewall_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-09-01")) + 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.Network/azureFirewalls/{azureFirewallName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url("azure_firewall_name", azure_firewall_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewalls_list_learned_prefixes_request( + resource_group_name: str, azure_firewall_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url("azure_firewall_name", azure_firewall_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_firewalls_packet_capture_request( + resource_group_name: str, azure_firewall_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-09-01")) + 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.Network/azureFirewalls/{azureFirewallName}/packetCapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureFirewallName": _SERIALIZER.url( + "azure_firewall_name", azure_firewall_name, "str", max_length=56, min_length=1, pattern=r"^[a-zA-Z0-9]" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_azure_firewall_fqdn_tags_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_web_categories_get_request( + name: str, subscription_id: str, *, 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}" + ) # pylint: disable=line-too-long + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_web_categories_list_by_subscription_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bastion_hosts_delete_request( + resource_group_name: str, bastion_host_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bastion_hosts_get_request( + resource_group_name: str, bastion_host_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bastion_hosts_create_or_update_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bastion_hosts_update_tags_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_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_bastion_hosts_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bastion_hosts_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_put_bastion_shareable_link_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}/createShareableLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_delete_bastion_shareable_link_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}/deleteShareableLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_delete_bastion_shareable_link_by_token_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_get_bastion_shareable_link_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}/getShareableLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_get_active_sessions_request( + resource_group_name: str, bastion_host_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_management_disconnect_active_sessions_request( + resource_group_name: str, bastion_host_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-09-01")) + 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.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "bastionHostName": _SERIALIZER.url("bastion_host_name", bastion_host_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_check_dns_name_availability_request( + location: str, subscription_id: str, *, domain_name_label: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["domainNameLabel"] = _SERIALIZER.query("domain_name_label", domain_name_label, "str") + _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_network_management_express_route_provider_port_request( + providerport: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "providerport": _SERIALIZER.url("providerport", providerport, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_management_list_active_connectivity_configurations_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + + # 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_network_management_list_active_security_admin_rules_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + + # 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_network_management_list_network_manager_effective_connectivity_configurations_request( + resource_group_name: str, + virtual_network_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + + # 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_network_management_list_network_manager_effective_security_admin_rules_request( + resource_group_name: str, + virtual_network_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + + # 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_network_management_supported_security_providers_request( + resource_group_name: str, virtual_wan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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_network_management_generatevirtualwanvpnserverconfigurationvpnprofile_request( + resource_group_name: str, virtual_wan_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-09-01")) + 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.Network/virtualWans/{virtualWANName}/GenerateVpnProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_interfaces_list_cloud_service_role_instance_network_interfaces_request( + resource_group_name: str, cloud_service_name: str, role_instance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_list_cloud_service_network_interfaces_request( + resource_group_name: str, cloud_service_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_get_cloud_service_network_interface_request( + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_interfaces_delete_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_get_request( + resource_group_name: str, + network_interface_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_interfaces_create_or_update_request( + resource_group_name: str, network_interface_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-09-01")) + 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.Network/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_update_tags_request( + resource_group_name: str, network_interface_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-09-01")) + 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.Network/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_get_effective_route_table_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_interfaces_list_effective_network_security_groups_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_interfaces_list_virtual_machine_scale_set_vm_network_interfaces_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: 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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_list_virtual_machine_scale_set_network_interfaces_request( + resource_group_name: str, virtual_machine_scale_set_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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interfaces_get_virtual_machine_scale_set_network_interface_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + subscription_id: str, + *, + 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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_interfaces_list_virtual_machine_scale_set_ip_configurations_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + subscription_id: str, + *, + 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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_interfaces_get_virtual_machine_scale_set_ip_configuration_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + subscription_id: str, + *, + 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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_public_ip_addresses_list_cloud_service_public_ip_addresses_request( + resource_group_name: str, cloud_service_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_list_cloud_service_role_instance_public_ip_addresses_request( + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_get_cloud_service_public_ip_address_request( + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), + "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_public_ip_addresses_delete_request( + resource_group_name: str, public_ip_address_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_get_request( + resource_group_name: str, + public_ip_address_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_public_ip_addresses_create_or_update_request( + resource_group_name: str, public_ip_address_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-09-01")) + 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.Network/publicIPAddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_update_tags_request( + resource_group_name: str, public_ip_address_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-09-01")) + 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.Network/publicIPAddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_ddos_protection_status_request( + resource_group_name: str, public_ip_address_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_public_ip_addresses_list_virtual_machine_scale_set_public_ip_addresses_request( + resource_group_name: str, virtual_machine_scale_set_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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_list_virtual_machine_scale_set_vm_public_ip_addresses_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_addresses_get_virtual_machine_scale_set_public_ip_address_request( + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + subscription_id: str, + *, + 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", "2018-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + ), + "virtualmachineIndex": _SERIALIZER.url("virtualmachine_index", virtualmachine_index, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "publicIpAddressName": _SERIALIZER.url("public_ip_address_name", public_ip_address_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_vip_swap_get_request(group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "singletonResource": _SERIALIZER.url("singleton_resource", singleton_resource, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vip_swap_create_request( + group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "singletonResource": _SERIALIZER.url("singleton_resource", singleton_resource, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vip_swap_list_request( + group_name: str, resource_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots", + ) # pylint: disable=line-too-long + path_format_arguments = { + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_custom_ip_prefixes_delete_request( + resource_group_name: str, custom_ip_prefix_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "customIpPrefixName": _SERIALIZER.url("custom_ip_prefix_name", custom_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_custom_ip_prefixes_get_request( + resource_group_name: str, + custom_ip_prefix_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "customIpPrefixName": _SERIALIZER.url("custom_ip_prefix_name", custom_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_custom_ip_prefixes_create_or_update_request( + resource_group_name: str, custom_ip_prefix_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-09-01")) + 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.Network/customIpPrefixes/{customIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "customIpPrefixName": _SERIALIZER.url("custom_ip_prefix_name", custom_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_custom_ip_prefixes_update_tags_request( + resource_group_name: str, custom_ip_prefix_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-09-01")) + 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.Network/customIpPrefixes/{customIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "customIpPrefixName": _SERIALIZER.url("custom_ip_prefix_name", custom_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_custom_ip_prefixes_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_custom_ip_prefixes_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_custom_policies_delete_request( + resource_group_name: str, ddos_custom_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosCustomPolicyName": _SERIALIZER.url("ddos_custom_policy_name", ddos_custom_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_custom_policies_get_request( + resource_group_name: str, ddos_custom_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosCustomPolicyName": _SERIALIZER.url("ddos_custom_policy_name", ddos_custom_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_custom_policies_create_or_update_request( + resource_group_name: str, ddos_custom_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", "2023-09-01")) + 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.Network/ddosCustomPolicies/{ddosCustomPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosCustomPolicyName": _SERIALIZER.url("ddos_custom_policy_name", ddos_custom_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_custom_policies_update_tags_request( + resource_group_name: str, ddos_custom_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", "2023-09-01")) + 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.Network/ddosCustomPolicies/{ddosCustomPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosCustomPolicyName": _SERIALIZER.url("ddos_custom_policy_name", ddos_custom_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_delete_request( + resource_group_name: str, ddos_protection_plan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosProtectionPlanName": _SERIALIZER.url("ddos_protection_plan_name", ddos_protection_plan_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_get_request( + resource_group_name: str, ddos_protection_plan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosProtectionPlanName": _SERIALIZER.url("ddos_protection_plan_name", ddos_protection_plan_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_create_or_update_request( + resource_group_name: str, ddos_protection_plan_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-09-01")) + 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.Network/ddosProtectionPlans/{ddosProtectionPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosProtectionPlanName": _SERIALIZER.url("ddos_protection_plan_name", ddos_protection_plan_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_update_tags_request( + resource_group_name: str, ddos_protection_plan_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-09-01")) + 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.Network/ddosProtectionPlans/{ddosProtectionPlanName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ddosProtectionPlanName": _SERIALIZER.url("ddos_protection_plan_name", ddos_protection_plan_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ddos_protection_plans_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_dscp_configuration_create_or_update_request( + resource_group_name: str, dscp_configuration_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-09-01")) + 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.Network/dscpConfigurations/{dscpConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "dscpConfigurationName": _SERIALIZER.url("dscp_configuration_name", dscp_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_dscp_configuration_delete_request( + resource_group_name: str, dscp_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "dscpConfigurationName": _SERIALIZER.url("dscp_configuration_name", dscp_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_dscp_configuration_get_request( + resource_group_name: str, dscp_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "dscpConfigurationName": _SERIALIZER.url("dscp_configuration_name", dscp_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_dscp_configuration_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_dscp_configuration_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_endpoint_services_list_request(location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_authorizations_delete_request( + resource_group_name: str, circuit_name: str, authorization_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_authorizations_get_request( + resource_group_name: str, circuit_name: str, authorization_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_authorizations_create_or_update_request( + resource_group_name: str, circuit_name: str, authorization_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-09-01")) + 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.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_authorizations_list_request( + resource_group_name: str, circuit_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_peerings_delete_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_peerings_get_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_peerings_create_or_update_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_peerings_list_request( + resource_group_name: str, circuit_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_connections_delete_request( + resource_group_name: str, + circuit_name: str, + peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_connections_get_request( + resource_group_name: str, + circuit_name: str, + peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_connections_create_or_update_request( + resource_group_name: str, + circuit_name: str, + peering_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-09-01")) + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuit_connections_list_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_peer_express_route_circuit_connections_get_request( + resource_group_name: str, + circuit_name: str, + peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_peer_express_route_circuit_connections_list_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_delete_request( + resource_group_name: str, circuit_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_get_request( + resource_group_name: str, circuit_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_create_or_update_request( + resource_group_name: str, circuit_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-09-01")) + 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.Network/expressRouteCircuits/{circuitName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_update_tags_request( + resource_group_name: str, circuit_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-09-01")) + 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.Network/expressRouteCircuits/{circuitName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_list_arp_table_request( + resource_group_name: str, + circuit_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_circuits_list_routes_table_request( + resource_group_name: str, + circuit_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_circuits_list_routes_table_summary_request( + resource_group_name: str, + circuit_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_circuits_get_stats_request( + resource_group_name: str, circuit_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_get_peering_stats_request( + resource_group_name: str, circuit_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "circuitName": _SERIALIZER.url("circuit_name", circuit_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_circuits_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_service_providers_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_get_request( + resource_group_name: str, cross_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_create_or_update_request( + resource_group_name: str, cross_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-09-01")) + 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.Network/expressRouteCrossConnections/{crossConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_update_tags_request( + resource_group_name: str, cross_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-09-01")) + 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.Network/expressRouteCrossConnections/{crossConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connections_list_arp_table_request( + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_cross_connections_list_routes_table_summary_request( + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_cross_connections_list_routes_table_request( + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + device_path: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "devicePath": _SERIALIZER.url("device_path", device_path, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_cross_connection_peerings_list_request( + resource_group_name: str, cross_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connection_peerings_delete_request( + resource_group_name: str, cross_connection_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connection_peerings_get_request( + resource_group_name: str, cross_connection_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_cross_connection_peerings_create_or_update_request( + resource_group_name: str, cross_connection_name: str, peering_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-09-01")) + 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.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "crossConnectionName": _SERIALIZER.url("cross_connection_name", cross_connection_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_ports_locations_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_ports_locations_get_request( + location_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationName": _SERIALIZER.url("location_name", location_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_express_route_ports_delete_request( + resource_group_name: str, express_route_port_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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_express_route_ports_get_request( + resource_group_name: str, express_route_port_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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_express_route_ports_create_or_update_request( + resource_group_name: str, express_route_port_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-09-01")) + 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.Network/ExpressRoutePorts/{expressRoutePortName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_ports_update_tags_request( + resource_group_name: str, express_route_port_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-09-01")) + 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.Network/ExpressRoutePorts/{expressRoutePortName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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_express_route_ports_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_ports_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_ports_generate_loa_request( + resource_group_name: str, express_route_port_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-09-01")) + 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.Network/expressRoutePorts/{expressRoutePortName}/generateLoa", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_express_route_links_get_request( + resource_group_name: str, express_route_port_name: str, link_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_name, "str"), + "linkName": _SERIALIZER.url("link_name", link_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_express_route_links_list_request( + resource_group_name: str, express_route_port_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_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_express_route_port_authorizations_delete_request( + resource_group_name: str, express_route_port_name: str, authorization_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_port_authorizations_get_request( + resource_group_name: str, express_route_port_name: str, authorization_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_port_authorizations_create_or_update_request( + resource_group_name: str, express_route_port_name: str, authorization_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-09-01")) + 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.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_name, "str"), + "authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_port_authorizations_list_request( + resource_group_name: str, express_route_port_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRoutePortName": _SERIALIZER.url("express_route_port_name", express_route_port_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_provider_ports_location_list_request( + subscription_id: str, *, filter: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_firewall_policies_delete_request( + resource_group_name: str, firewall_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policies_get_request( + resource_group_name: str, + firewall_policy_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_firewall_policies_create_or_update_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policies_update_tags_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policies_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policies_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_rule_collection_groups_delete_request( + resource_group_name: str, + firewall_policy_name: str, + rule_collection_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "ruleCollectionGroupName": _SERIALIZER.url("rule_collection_group_name", rule_collection_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_rule_collection_groups_get_request( + resource_group_name: str, + firewall_policy_name: str, + rule_collection_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "ruleCollectionGroupName": _SERIALIZER.url("rule_collection_group_name", rule_collection_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_rule_collection_groups_create_or_update_request( + resource_group_name: str, + firewall_policy_name: str, + rule_collection_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "ruleCollectionGroupName": _SERIALIZER.url("rule_collection_group_name", rule_collection_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_rule_collection_groups_list_request( + resource_group_name: str, firewall_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_list_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}/listIdpsSignatures", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_overrides_patch_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_overrides_put_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_overrides_get_request( + resource_group_name: str, firewall_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_overrides_list_request( + resource_group_name: str, firewall_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_firewall_policy_idps_signatures_filter_values_list_request( + resource_group_name: str, firewall_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", "2023-09-01")) + 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.Network/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "firewallPolicyName": _SERIALIZER.url("firewall_policy_name", firewall_policy_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_allocations_delete_request( + resource_group_name: str, ip_allocation_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipAllocationName": _SERIALIZER.url("ip_allocation_name", ip_allocation_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_allocations_get_request( + resource_group_name: str, + ip_allocation_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipAllocationName": _SERIALIZER.url("ip_allocation_name", ip_allocation_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_ip_allocations_create_or_update_request( + resource_group_name: str, ip_allocation_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-09-01")) + 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.Network/IpAllocations/{ipAllocationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipAllocationName": _SERIALIZER.url("ip_allocation_name", ip_allocation_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_allocations_update_tags_request( + resource_group_name: str, ip_allocation_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-09-01")) + 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.Network/IpAllocations/{ipAllocationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipAllocationName": _SERIALIZER.url("ip_allocation_name", ip_allocation_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_allocations_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_allocations_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_groups_get_request( + resource_group_name: str, ip_groups_name: str, subscription_id: str, *, 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipGroupsName": _SERIALIZER.url("ip_groups_name", ip_groups_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_ip_groups_create_or_update_request( + resource_group_name: str, ip_groups_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-09-01")) + 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.Network/ipGroups/{ipGroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipGroupsName": _SERIALIZER.url("ip_groups_name", ip_groups_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_groups_update_groups_request( + resource_group_name: str, ip_groups_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-09-01")) + 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.Network/ipGroups/{ipGroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipGroupsName": _SERIALIZER.url("ip_groups_name", ip_groups_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_groups_delete_request( + resource_group_name: str, ip_groups_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ipGroupsName": _SERIALIZER.url("ip_groups_name", ip_groups_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_groups_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_ip_groups_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_delete_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_get_request( + resource_group_name: str, + load_balancer_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_load_balancers_create_or_update_request( + resource_group_name: str, load_balancer_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-09-01")) + 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.Network/loadBalancers/{loadBalancerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_update_tags_request( + resource_group_name: str, load_balancer_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-09-01")) + 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.Network/loadBalancers/{loadBalancerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_swap_public_ip_addresses_request( + location: 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-09-01")) + 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}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_list_inbound_nat_rule_port_mappings_request( + group_name: str, load_balancer_name: str, backend_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", "2023-09-01")) + 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/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping", + ) # pylint: disable=line-too-long + path_format_arguments = { + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "backendPoolName": _SERIALIZER.url("backend_pool_name", backend_pool_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancers_migrate_to_ip_based_request( + group_name: str, load_balancer_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-09-01")) + 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/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/migrateToIpBased", + ) # pylint: disable=line-too-long + path_format_arguments = { + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-z][a-z0-9]*$"), + "loadBalancerName": _SERIALIZER.url( + "load_balancer_name", load_balancer_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_backend_address_pools_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_backend_address_pools_get_request( + resource_group_name: str, + load_balancer_name: str, + backend_address_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "backendAddressPoolName": _SERIALIZER.url("backend_address_pool_name", backend_address_pool_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_backend_address_pools_create_or_update_request( + resource_group_name: str, + load_balancer_name: str, + backend_address_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", "2023-09-01")) + 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.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "backendAddressPoolName": _SERIALIZER.url("backend_address_pool_name", backend_address_pool_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_backend_address_pools_delete_request( + resource_group_name: str, + load_balancer_name: str, + backend_address_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "backendAddressPoolName": _SERIALIZER.url("backend_address_pool_name", backend_address_pool_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_frontend_ip_configurations_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_frontend_ip_configurations_get_request( + resource_group_name: str, + load_balancer_name: str, + frontend_ip_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "frontendIPConfigurationName": _SERIALIZER.url( + "frontend_ip_configuration_name", frontend_ip_configuration_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_inbound_nat_rules_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_inbound_nat_rules_delete_request( + resource_group_name: str, load_balancer_name: str, inbound_nat_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "inboundNatRuleName": _SERIALIZER.url("inbound_nat_rule_name", inbound_nat_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_inbound_nat_rules_get_request( + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "inboundNatRuleName": _SERIALIZER.url("inbound_nat_rule_name", inbound_nat_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_inbound_nat_rules_create_or_update_request( + resource_group_name: str, load_balancer_name: str, inbound_nat_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", "2023-09-01")) + 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.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "inboundNatRuleName": _SERIALIZER.url("inbound_nat_rule_name", inbound_nat_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_load_balancing_rules_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_load_balancing_rules_get_request( + resource_group_name: str, + load_balancer_name: str, + load_balancing_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "loadBalancingRuleName": _SERIALIZER.url("load_balancing_rule_name", load_balancing_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_outbound_rules_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_outbound_rules_get_request( + resource_group_name: str, load_balancer_name: str, outbound_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "outboundRuleName": _SERIALIZER.url("outbound_rule_name", outbound_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_network_interfaces_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_probes_list_request( + resource_group_name: str, load_balancer_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_load_balancer_probes_get_request( + resource_group_name: str, load_balancer_name: str, probe_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "loadBalancerName": _SERIALIZER.url("load_balancer_name", load_balancer_name, "str"), + "probeName": _SERIALIZER.url("probe_name", probe_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_nat_gateways_delete_request( + resource_group_name: str, nat_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "natGatewayName": _SERIALIZER.url("nat_gateway_name", nat_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_nat_gateways_get_request( + resource_group_name: str, + nat_gateway_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "natGatewayName": _SERIALIZER.url("nat_gateway_name", nat_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_nat_gateways_create_or_update_request( + resource_group_name: str, nat_gateway_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-09-01")) + 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.Network/natGateways/{natGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "natGatewayName": _SERIALIZER.url("nat_gateway_name", nat_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_nat_gateways_update_tags_request( + resource_group_name: str, nat_gateway_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-09-01")) + 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.Network/natGateways/{natGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "natGatewayName": _SERIALIZER.url("nat_gateway_name", nat_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_nat_gateways_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_nat_gateways_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_ip_configurations_list_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_ip_configurations_get_request( + resource_group_name: str, + network_interface_name: str, + ip_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "ipConfigurationName": _SERIALIZER.url("ip_configuration_name", ip_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_load_balancers_list_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_tap_configurations_delete_request( + resource_group_name: str, + network_interface_name: str, + tap_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "tapConfigurationName": _SERIALIZER.url("tap_configuration_name", tap_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_tap_configurations_get_request( + resource_group_name: str, + network_interface_name: str, + tap_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "tapConfigurationName": _SERIALIZER.url("tap_configuration_name", tap_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_tap_configurations_create_or_update_request( + resource_group_name: str, + network_interface_name: str, + tap_configuration_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-09-01")) + 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.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "tapConfigurationName": _SERIALIZER.url("tap_configuration_name", tap_configuration_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_interface_tap_configurations_list_request( + resource_group_name: str, network_interface_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkInterfaceName": _SERIALIZER.url("network_interface_name", network_interface_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_managers_get_request( + resource_group_name: str, network_manager_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_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_network_managers_create_or_update_request( + resource_group_name: str, network_manager_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-09-01")) + 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.Network/networkManagers/{networkManagerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_managers_delete_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_managers_patch_request( + resource_group_name: str, network_manager_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-09-01")) + 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.Network/networkManagers/{networkManagerName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_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_network_managers_list_by_subscription_request( + subscription_id: str, *, top: Optional[int] = None, skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_managers_list_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_manager_commits_post_request( + resource_group_name: str, network_manager_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/commit", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_manager_deployment_status_list_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + 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.Network/networkManagers/{networkManagerName}/listDeploymentStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + + # 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_subscription_network_manager_connections_create_or_update_request( + network_manager_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-09-01")) + 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}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_subscription_network_manager_connections_get_request( + network_manager_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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_subscription_network_manager_connections_delete_request( + network_manager_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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_subscription_network_manager_connections_list_request( + subscription_id: str, *, top: Optional[int] = None, skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_management_group_network_manager_connections_create_or_update_request( + management_group_id: str, network_manager_connection_name: 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-09-01")) + 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", + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_management_group_network_manager_connections_get_request( + management_group_id: str, network_manager_connection_name: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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_management_group_network_manager_connections_delete_request( + management_group_id: str, network_manager_connection_name: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), + "networkManagerConnectionName": _SERIALIZER.url( + "network_manager_connection_name", network_manager_connection_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_management_group_network_manager_connections_list_request( + management_group_id: str, *, top: Optional[int] = None, skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connectivity_configurations_get_request( + resource_group_name: str, network_manager_name: str, configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_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_connectivity_configurations_create_or_update_request( + resource_group_name: str, network_manager_name: str, configuration_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connectivity_configurations_delete_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connectivity_configurations_list_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_groups_get_request( + resource_group_name: str, network_manager_name: str, network_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_groups_create_or_update_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + subscription_id: str, + *, + if_match: 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-09-01")) + 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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_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 if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + 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_network_groups_delete_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_groups_list_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_static_members_get_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, "str"), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_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_static_members_create_or_update_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, "str"), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_static_members_delete_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, "str"), + "staticMemberName": _SERIALIZER.url("static_member_name", static_member_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_static_members_list_request( + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "networkGroupName": _SERIALIZER.url("network_group_name", network_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_connections_create_or_update_request( + resource_group_name: str, network_manager_name: str, scope_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_connections_get_request( + resource_group_name: str, network_manager_name: str, scope_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_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_scope_connections_delete_request( + resource_group_name: str, network_manager_name: str, scope_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "scopeConnectionName": _SERIALIZER.url("scope_connection_name", scope_connection_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_scope_connections_list_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_security_admin_configurations_list_request( + resource_group_name: str, + network_manager_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_security_admin_configurations_get_request( + resource_group_name: str, network_manager_name: str, configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_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_security_admin_configurations_create_or_update_request( + resource_group_name: str, network_manager_name: str, configuration_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_security_admin_configurations_delete_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rule_collections_list_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rule_collections_get_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_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_admin_rule_collections_create_or_update_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_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-09-01")) + 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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rule_collections_delete_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rules_list_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rules_get_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_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_admin_rules_create_or_update_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_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", "2023-09-01")) + 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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_rules_delete_request( + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkManagerName": _SERIALIZER.url("network_manager_name", network_manager_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_profiles_delete_request( + resource_group_name: str, network_profile_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkProfileName": _SERIALIZER.url("network_profile_name", network_profile_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_profiles_get_request( + resource_group_name: str, + network_profile_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkProfileName": _SERIALIZER.url("network_profile_name", network_profile_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_profiles_create_or_update_request( + resource_group_name: str, network_profile_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-09-01")) + 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.Network/networkProfiles/{networkProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkProfileName": _SERIALIZER.url("network_profile_name", network_profile_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_profiles_update_tags_request( + resource_group_name: str, network_profile_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-09-01")) + 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.Network/networkProfiles/{networkProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkProfileName": _SERIALIZER.url("network_profile_name", network_profile_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_profiles_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_profiles_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_security_groups_delete_request( + resource_group_name: str, network_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_security_groups_get_request( + resource_group_name: str, + network_security_group_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_security_groups_create_or_update_request( + resource_group_name: str, network_security_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", "2023-09-01")) + 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.Network/networkSecurityGroups/{networkSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_security_groups_update_tags_request( + resource_group_name: str, network_security_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", "2023-09-01")) + 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.Network/networkSecurityGroups/{networkSecurityGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_security_groups_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_security_groups_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_rules_delete_request( + resource_group_name: str, + network_security_group_name: str, + security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "securityRuleName": _SERIALIZER.url("security_rule_name", security_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_rules_get_request( + resource_group_name: str, + network_security_group_name: str, + security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "securityRuleName": _SERIALIZER.url("security_rule_name", security_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_rules_create_or_update_request( + resource_group_name: str, + network_security_group_name: str, + security_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", "2023-09-01")) + 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.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "securityRuleName": _SERIALIZER.url("security_rule_name", security_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_rules_list_request( + resource_group_name: str, network_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_default_security_rules_list_request( + resource_group_name: str, network_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_default_security_rules_get_request( + resource_group_name: str, + network_security_group_name: str, + default_security_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkSecurityGroupName": _SERIALIZER.url("network_security_group_name", network_security_group_name, "str"), + "defaultSecurityRuleName": _SERIALIZER.url("default_security_rule_name", default_security_rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_virtual_appliances_delete_request( + resource_group_name: str, network_virtual_appliance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_virtual_appliances_get_request( + resource_group_name: str, + network_virtual_appliance_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_network_virtual_appliances_update_tags_request( + resource_group_name: str, network_virtual_appliance_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-09-01")) + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_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_network_virtual_appliances_create_or_update_request( + resource_group_name: str, network_virtual_appliance_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-09-01")) + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_virtual_appliances_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_virtual_appliances_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_sites_delete_request( + resource_group_name: str, network_virtual_appliance_name: str, site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "siteName": _SERIALIZER.url("site_name", site_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_sites_get_request( + resource_group_name: str, network_virtual_appliance_name: str, site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "siteName": _SERIALIZER.url("site_name", site_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_sites_create_or_update_request( + resource_group_name: str, network_virtual_appliance_name: str, site_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-09-01")) + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "siteName": _SERIALIZER.url("site_name", site_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_sites_list_request( + resource_group_name: str, network_virtual_appliance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_skus_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_appliance_skus_get_request(sku_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "skuName": _SERIALIZER.url("sku_name", sku_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_inbound_security_rule_create_or_update_request( + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_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-09-01")) + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "ruleCollectionName": _SERIALIZER.url("rule_collection_name", rule_collection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_create_or_update_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_request( + resource_group_name: str, network_watcher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_delete_request( + resource_group_name: str, network_watcher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_update_tags_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_topology_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/topology", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_verify_ip_flow_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_next_hop_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/nextHop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_vm_security_rules_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/securityGroupView", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_troubleshooting_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/troubleshoot", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_troubleshooting_result_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_set_flow_log_configuration_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/configureFlowLog", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_flow_log_status_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_check_connectivity_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/connectivityCheck", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_azure_reachability_report_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_list_available_providers_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/availableProvidersList", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_watchers_get_network_configuration_diagnostic_request( + resource_group_name: str, network_watcher_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_packet_captures_create_request( + resource_group_name: str, network_watcher_name: str, packet_capture_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "packetCaptureName": _SERIALIZER.url("packet_capture_name", packet_capture_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_packet_captures_get_request( + resource_group_name: str, network_watcher_name: str, packet_capture_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "packetCaptureName": _SERIALIZER.url("packet_capture_name", packet_capture_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_packet_captures_delete_request( + resource_group_name: str, network_watcher_name: str, packet_capture_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "packetCaptureName": _SERIALIZER.url("packet_capture_name", packet_capture_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_packet_captures_stop_request( + resource_group_name: str, network_watcher_name: str, packet_capture_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "packetCaptureName": _SERIALIZER.url("packet_capture_name", packet_capture_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_packet_captures_get_status_request( + resource_group_name: str, network_watcher_name: str, packet_capture_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "packetCaptureName": _SERIALIZER.url("packet_capture_name", packet_capture_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_packet_captures_list_request( + resource_group_name: str, network_watcher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_connection_monitors_create_or_update_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + subscription_id: str, + *, + migrate: 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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if migrate is not None: + _params["migrate"] = _SERIALIZER.query("migrate", migrate, "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_connection_monitors_get_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_connection_monitors_delete_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_connection_monitors_update_tags_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_connection_monitors_stop_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_monitors_start_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_monitors_query_request( + resource_group_name: str, + network_watcher_name: str, + connection_monitor_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "connectionMonitorName": _SERIALIZER.url("connection_monitor_name", connection_monitor_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_monitors_list_request( + resource_group_name: str, network_watcher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_flow_logs_create_or_update_request( + resource_group_name: str, network_watcher_name: str, flow_log_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "flowLogName": _SERIALIZER.url("flow_log_name", flow_log_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_flow_logs_update_tags_request( + resource_group_name: str, network_watcher_name: str, flow_log_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-09-01")) + 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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "flowLogName": _SERIALIZER.url("flow_log_name", flow_log_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_flow_logs_get_request( + resource_group_name: str, network_watcher_name: str, flow_log_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "flowLogName": _SERIALIZER.url("flow_log_name", flow_log_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_flow_logs_delete_request( + resource_group_name: str, network_watcher_name: str, flow_log_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "flowLogName": _SERIALIZER.url("flow_log_name", flow_log_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_flow_logs_list_request( + resource_group_name: str, network_watcher_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkWatcherName": _SERIALIZER.url("network_watcher_name", network_watcher_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_operations_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Network/operations") + + # 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_private_endpoints_delete_request( + resource_group_name: str, private_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_endpoints_get_request( + resource_group_name: str, + private_endpoint_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_private_endpoints_create_or_update_request( + resource_group_name: str, private_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", "2023-09-01")) + 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.Network/privateEndpoints/{privateEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_endpoints_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_endpoints_list_by_subscription_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_private_endpoint_types_list_request( + location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_available_private_endpoint_types_list_by_resource_group_request( + location: str, resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_dns_zone_groups_delete_request( + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "privateDnsZoneGroupName": _SERIALIZER.url("private_dns_zone_group_name", private_dns_zone_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_dns_zone_groups_get_request( + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "privateDnsZoneGroupName": _SERIALIZER.url("private_dns_zone_group_name", private_dns_zone_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_dns_zone_groups_create_or_update_request( + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_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", "2023-09-01")) + 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.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "privateDnsZoneGroupName": _SERIALIZER.url("private_dns_zone_group_name", private_dns_zone_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_dns_zone_groups_list_request( + private_endpoint_name: str, resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_delete_request( + resource_group_name: str, service_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_get_request( + resource_group_name: str, service_name: str, subscription_id: str, *, 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_private_link_services_create_or_update_request( + resource_group_name: str, service_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-09-01")) + 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.Network/privateLinkServices/{serviceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_list_by_subscription_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_get_private_endpoint_connection_request( + resource_group_name: str, + service_name: str, + pe_connection_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "peConnectionName": _SERIALIZER.url("pe_connection_name", pe_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_private_link_services_update_private_endpoint_connection_request( + resource_group_name: str, service_name: str, pe_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-09-01")) + 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.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "peConnectionName": _SERIALIZER.url("pe_connection_name", pe_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_delete_private_endpoint_connection_request( + resource_group_name: str, service_name: str, pe_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "peConnectionName": _SERIALIZER.url("pe_connection_name", pe_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_list_private_endpoint_connections_request( + resource_group_name: str, service_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_check_private_link_service_visibility_request( + location: 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-09-01")) + 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}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_check_private_link_service_visibility_by_resource_group_request( + location: str, resource_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", "2023-09-01")) + 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.Network/locations/{location}/checkPrivateLinkServiceVisibility", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_list_auto_approved_private_link_services_request( + location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_private_link_services_list_auto_approved_private_link_services_by_resource_group_request( + location: str, resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_prefixes_delete_request( + resource_group_name: str, public_ip_prefix_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpPrefixName": _SERIALIZER.url("public_ip_prefix_name", public_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_prefixes_get_request( + resource_group_name: str, + public_ip_prefix_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpPrefixName": _SERIALIZER.url("public_ip_prefix_name", public_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_public_ip_prefixes_create_or_update_request( + resource_group_name: str, public_ip_prefix_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-09-01")) + 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.Network/publicIPPrefixes/{publicIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpPrefixName": _SERIALIZER.url("public_ip_prefix_name", public_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_prefixes_update_tags_request( + resource_group_name: str, public_ip_prefix_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-09-01")) + 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.Network/publicIPPrefixes/{publicIpPrefixName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "publicIpPrefixName": _SERIALIZER.url("public_ip_prefix_name", public_ip_prefix_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_prefixes_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_public_ip_prefixes_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filters_delete_request( + resource_group_name: str, route_filter_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filters_get_request( + resource_group_name: str, + route_filter_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_route_filters_create_or_update_request( + resource_group_name: str, route_filter_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-09-01")) + 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.Network/routeFilters/{routeFilterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filters_update_tags_request( + resource_group_name: str, route_filter_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-09-01")) + 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.Network/routeFilters/{routeFilterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filters_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filters_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filter_rules_delete_request( + resource_group_name: str, route_filter_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filter_rules_get_request( + resource_group_name: str, route_filter_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filter_rules_create_or_update_request( + resource_group_name: str, route_filter_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", "2023-09-01")) + 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.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_filter_rules_list_by_route_filter_request( + resource_group_name: str, route_filter_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeFilterName": _SERIALIZER.url("route_filter_name", route_filter_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_tables_delete_request( + resource_group_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_tables_get_request( + resource_group_name: str, + route_table_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_route_tables_create_or_update_request( + resource_group_name: str, route_table_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-09-01")) + 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.Network/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_tables_update_tags_request( + resource_group_name: str, route_table_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-09-01")) + 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.Network/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_tables_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_route_tables_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_routes_delete_request( + resource_group_name: str, route_table_name: str, route_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "routeName": _SERIALIZER.url("route_name", route_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_routes_get_request( + resource_group_name: str, route_table_name: str, route_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "routeName": _SERIALIZER.url("route_name", route_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_routes_create_or_update_request( + resource_group_name: str, route_table_name: str, route_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-09-01")) + 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.Network/routeTables/{routeTableName}/routes/{routeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "routeName": _SERIALIZER.url("route_name", route_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_routes_list_request( + resource_group_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_delete_request( + resource_group_name: str, security_partner_provider_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "securityPartnerProviderName": _SERIALIZER.url( + "security_partner_provider_name", security_partner_provider_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_get_request( + resource_group_name: str, security_partner_provider_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "securityPartnerProviderName": _SERIALIZER.url( + "security_partner_provider_name", security_partner_provider_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_create_or_update_request( + resource_group_name: str, security_partner_provider_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-09-01")) + 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.Network/securityPartnerProviders/{securityPartnerProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "securityPartnerProviderName": _SERIALIZER.url( + "security_partner_provider_name", security_partner_provider_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_update_tags_request( + resource_group_name: str, security_partner_provider_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-09-01")) + 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.Network/securityPartnerProviders/{securityPartnerProviderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "securityPartnerProviderName": _SERIALIZER.url( + "security_partner_provider_name", security_partner_provider_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_security_partner_providers_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_bgp_service_communities_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policies_delete_request( + resource_group_name: str, service_endpoint_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policies_get_request( + resource_group_name: str, + service_endpoint_policy_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_service_endpoint_policies_create_or_update_request( + resource_group_name: str, service_endpoint_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", "2023-09-01")) + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policies_update_tags_request( + resource_group_name: str, service_endpoint_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", "2023-09-01")) + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policies_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policies_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policy_definitions_delete_request( + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "serviceEndpointPolicyDefinitionName": _SERIALIZER.url( + "service_endpoint_policy_definition_name", service_endpoint_policy_definition_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policy_definitions_get_request( + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "serviceEndpointPolicyDefinitionName": _SERIALIZER.url( + "service_endpoint_policy_definition_name", service_endpoint_policy_definition_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policy_definitions_create_or_update_request( + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_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-09-01")) + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "serviceEndpointPolicyDefinitionName": _SERIALIZER.url( + "service_endpoint_policy_definition_name", service_endpoint_policy_definition_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_endpoint_policy_definitions_list_by_resource_group_request( + resource_group_name: str, service_endpoint_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serviceEndpointPolicyName": _SERIALIZER.url( + "service_endpoint_policy_name", service_endpoint_policy_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_tags_list_request(location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags" + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_tag_information_list_request( + location: str, + subscription_id: str, + *, + no_address_prefixes: Optional[bool] = None, + tag_name: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if no_address_prefixes is not None: + _params["noAddressPrefixes"] = _SERIALIZER.query("no_address_prefixes", no_address_prefixes, "bool") + if tag_name is not None: + _params["tagName"] = _SERIALIZER.query("tag_name", tag_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_usages_list_request(location: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages" + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._ ]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_delete_request( + resource_group_name: str, virtual_network_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_get_request( + resource_group_name: str, + virtual_network_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_virtual_networks_create_or_update_request( + resource_group_name: str, virtual_network_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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_update_tags_request( + resource_group_name: str, virtual_network_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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_list_request(resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_check_ip_address_availability_request( + resource_group_name: str, virtual_network_name: str, subscription_id: str, *, ip_address: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["ipAddress"] = _SERIALIZER.query("ip_address", ip_address, "str") + _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_virtual_networks_list_usage_request( + resource_group_name: str, virtual_network_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_networks_list_ddos_protection_status_request( + resource_group_name: str, + virtual_network_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + skip_token: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + _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_subnets_delete_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_subnets_get_request( + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_subnets_create_or_update_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_subnets_prepare_network_policies_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_subnets_unprepare_network_policies_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_subnets_list_request( + resource_group_name: str, virtual_network_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_resource_navigation_links_list_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_service_association_links_list_request( + resource_group_name: str, virtual_network_name: str, subnet_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_peerings_delete_request( + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "virtualNetworkPeeringName": _SERIALIZER.url( + "virtual_network_peering_name", virtual_network_peering_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_peerings_get_request( + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "virtualNetworkPeeringName": _SERIALIZER.url( + "virtual_network_peering_name", virtual_network_peering_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_peerings_create_or_update_request( + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + subscription_id: str, + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = 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-09-01")) + 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.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "virtualNetworkPeeringName": _SERIALIZER.url( + "virtual_network_peering_name", virtual_network_peering_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if sync_remote_address_space is not None: + _params["syncRemoteAddressSpace"] = _SERIALIZER.query( + "sync_remote_address_space", sync_remote_address_space, "str" + ) + _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_virtual_network_peerings_list_request( + resource_group_name: str, virtual_network_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_create_or_update_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_get_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_delete_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_update_tags_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_list_connections_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_reset_request( + resource_group_name: str, + virtual_network_gateway_name: str, + subscription_id: str, + *, + gateway_vip: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if gateway_vip is not None: + _params["gatewayVip"] = _SERIALIZER.query("gateway_vip", gateway_vip, "str") + _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_virtual_network_gateways_reset_vpn_client_shared_key_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_generatevpnclientpackage_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_generate_vpn_profile_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_get_vpn_profile_package_url_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_get_bgp_peer_status_request( + resource_group_name: str, + virtual_network_gateway_name: str, + subscription_id: str, + *, + peer: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if peer is not None: + _params["peer"] = _SERIALIZER.query("peer", peer, "str") + _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_virtual_network_gateways_supported_vpn_devices_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_get_learned_routes_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_get_advertised_routes_request( + resource_group_name: str, virtual_network_gateway_name: str, subscription_id: str, *, peer: 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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["peer"] = _SERIALIZER.query("peer", peer, "str") + _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_virtual_network_gateways_set_vpnclient_ipsec_parameters_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_get_vpnclient_ipsec_parameters_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_vpn_device_configuration_script_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_start_packet_capture_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_stop_packet_capture_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateways_get_vpnclient_connection_health_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateways_disconnect_virtual_network_gateway_vpn_connections_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateway_connections_create_or_update_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_get_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_delete_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_update_tags_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_set_shared_key_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_get_shared_key_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_reset_shared_key_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_start_packet_capture_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_stop_packet_capture_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + 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.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_connections_get_ike_sas_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateway_connections_reset_connection_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayConnectionName": _SERIALIZER.url( + "virtual_network_gateway_connection_name", virtual_network_gateway_connection_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_local_network_gateways_create_or_update_request( + resource_group_name: str, local_network_gateway_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-09-01")) + 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.Network/localNetworkGateways/{localNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localNetworkGatewayName": _SERIALIZER.url( + "local_network_gateway_name", local_network_gateway_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_local_network_gateways_get_request( + resource_group_name: str, local_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localNetworkGatewayName": _SERIALIZER.url( + "local_network_gateway_name", local_network_gateway_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_local_network_gateways_delete_request( + resource_group_name: str, local_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localNetworkGatewayName": _SERIALIZER.url( + "local_network_gateway_name", local_network_gateway_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_local_network_gateways_update_tags_request( + resource_group_name: str, local_network_gateway_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-09-01")) + 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.Network/localNetworkGateways/{localNetworkGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "localNetworkGatewayName": _SERIALIZER.url( + "local_network_gateway_name", local_network_gateway_name, "str", min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_local_network_gateways_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_gateway_nat_rules_get_request( + resource_group_name: str, virtual_network_gateway_name: str, nat_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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_virtual_network_gateway_nat_rules_create_or_update_request( + resource_group_name: str, virtual_network_gateway_name: str, nat_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", "2023-09-01")) + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_network_gateway_nat_rules_delete_request( + resource_group_name: str, virtual_network_gateway_name: str, nat_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_name, "str" + ), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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_virtual_network_gateway_nat_rules_list_by_virtual_network_gateway_request( + resource_group_name: str, virtual_network_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualNetworkGatewayName": _SERIALIZER.url( + "virtual_network_gateway_name", virtual_network_gateway_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_virtual_network_taps_delete_request( + resource_group_name: str, tap_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "tapName": _SERIALIZER.url("tap_name", tap_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_taps_get_request( + resource_group_name: str, tap_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "tapName": _SERIALIZER.url("tap_name", tap_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_taps_create_or_update_request( + resource_group_name: str, tap_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-09-01")) + 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.Network/virtualNetworkTaps/{tapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "tapName": _SERIALIZER.url("tap_name", tap_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_taps_update_tags_request( + resource_group_name: str, tap_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-09-01")) + 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.Network/virtualNetworkTaps/{tapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "tapName": _SERIALIZER.url("tap_name", tap_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_taps_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_network_taps_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_routers_delete_request( + resource_group_name: str, virtual_router_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_routers_get_request( + resource_group_name: str, + virtual_router_name: str, + subscription_id: str, + *, + 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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_virtual_routers_create_or_update_request( + resource_group_name: str, virtual_router_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-09-01")) + 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.Network/virtualRouters/{virtualRouterName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_routers_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_routers_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_router_peerings_delete_request( + resource_group_name: str, virtual_router_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_router_peerings_get_request( + resource_group_name: str, virtual_router_name: str, peering_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_router_peerings_create_or_update_request( + resource_group_name: str, virtual_router_name: str, peering_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-09-01")) + 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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "peeringName": _SERIALIZER.url("peering_name", peering_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_router_peerings_list_request( + resource_group_name: str, virtual_router_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualRouterName": _SERIALIZER.url("virtual_router_name", virtual_router_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_wans_get_request( + resource_group_name: str, virtual_wan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "VirtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_wans_create_or_update_request( + resource_group_name: str, virtual_wan_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-09-01")) + 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.Network/virtualWans/{VirtualWANName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "VirtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_wans_update_tags_request( + resource_group_name: str, virtual_wan_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-09-01")) + 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.Network/virtualWans/{VirtualWANName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "VirtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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_virtual_wans_delete_request( + resource_group_name: str, virtual_wan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "VirtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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_virtual_wans_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_wans_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_sites_get_request( + resource_group_name: str, vpn_site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_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_vpn_sites_create_or_update_request( + resource_group_name: str, vpn_site_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-09-01")) + 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.Network/vpnSites/{vpnSiteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_sites_update_tags_request( + resource_group_name: str, vpn_site_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-09-01")) + 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.Network/vpnSites/{vpnSiteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_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_vpn_sites_delete_request( + resource_group_name: str, vpn_site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_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_vpn_sites_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_sites_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_site_links_get_request( + resource_group_name: str, vpn_site_name: str, vpn_site_link_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_name, "str"), + "vpnSiteLinkName": _SERIALIZER.url("vpn_site_link_name", vpn_site_link_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_vpn_site_links_list_by_vpn_site_request( + resource_group_name: str, vpn_site_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnSiteName": _SERIALIZER.url("vpn_site_name", vpn_site_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_vpn_sites_configuration_download_request( + resource_group_name: str, virtual_wan_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-09-01")) + 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.Network/virtualWans/{virtualWANName}/vpnConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_server_configurations_get_request( + resource_group_name: str, vpn_server_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_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_vpn_server_configurations_create_or_update_request( + resource_group_name: str, vpn_server_configuration_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-09-01")) + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_server_configurations_update_tags_request( + resource_group_name: str, vpn_server_configuration_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-09-01")) + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_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_vpn_server_configurations_delete_request( + resource_group_name: str, vpn_server_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_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_vpn_server_configurations_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_server_configurations_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_configuration_policy_groups_create_or_update_request( + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_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", "2023-09-01")) + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_name, "str" + ), + "configurationPolicyGroupName": _SERIALIZER.url( + "configuration_policy_group_name", configuration_policy_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_policy_groups_delete_request( + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_name, "str" + ), + "configurationPolicyGroupName": _SERIALIZER.url( + "configuration_policy_group_name", configuration_policy_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_policy_groups_get_request( + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_name, "str" + ), + "configurationPolicyGroupName": _SERIALIZER.url( + "configuration_policy_group_name", configuration_policy_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_policy_groups_list_by_vpn_server_configuration_request( + resource_group_name: str, vpn_server_configuration_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vpnServerConfigurationName": _SERIALIZER.url( + "vpn_server_configuration_name", vpn_server_configuration_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_virtual_hubs_get_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_virtual_hubs_create_or_update_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hubs_update_tags_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_virtual_hubs_delete_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_virtual_hubs_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hubs_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_virtual_hubs_get_effective_virtual_hub_routes_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/effectiveRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hubs_get_inbound_routes_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/inboundRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hubs_get_outbound_routes_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/outboundRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_route_maps_get_request( + resource_group_name: str, virtual_hub_name: str, route_map_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeMapName": _SERIALIZER.url("route_map_name", route_map_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_route_maps_create_or_update_request( + resource_group_name: str, virtual_hub_name: str, route_map_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeMapName": _SERIALIZER.url("route_map_name", route_map_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_route_maps_delete_request( + resource_group_name: str, virtual_hub_name: str, route_map_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeMapName": _SERIALIZER.url("route_map_name", route_map_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_route_maps_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_hub_virtual_network_connections_create_or_update_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hub_virtual_network_connections_delete_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_hub_virtual_network_connections_get_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_hub_virtual_network_connections_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_vpn_gateways_get_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_vpn_gateways_create_or_update_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/vpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_gateways_update_tags_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/vpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_vpn_gateways_delete_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_vpn_gateways_reset_request( + resource_group_name: str, + gateway_name: str, + subscription_id: str, + *, + ip_configuration_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if ip_configuration_id is not None: + _params["ipConfigurationId"] = _SERIALIZER.query("ip_configuration_id", ip_configuration_id, "str") + _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_vpn_gateways_start_packet_capture_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/vpnGateways/{gatewayName}/startpacketcapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_gateways_stop_packet_capture_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/vpnGateways/{gatewayName}/stoppacketcapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_gateways_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_gateways_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_link_connections_reset_connection_request( + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "linkConnectionName": _SERIALIZER.url("link_connection_name", link_connection_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_link_connections_get_ike_sas_request( + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "linkConnectionName": _SERIALIZER.url("link_connection_name", link_connection_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_link_connections_list_by_vpn_connection_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_vpn_connections_get_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_vpn_connections_create_or_update_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_connections_delete_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_vpn_connections_start_packet_capture_request( + resource_group_name: str, gateway_name: str, vpn_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-09-01")) + 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.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "vpnConnectionName": _SERIALIZER.url("vpn_connection_name", vpn_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_connections_stop_packet_capture_request( + resource_group_name: str, gateway_name: str, vpn_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-09-01")) + 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.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "vpnConnectionName": _SERIALIZER.url("vpn_connection_name", vpn_connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_vpn_connections_list_by_vpn_gateway_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_vpn_site_link_connections_get_request( + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "linkConnectionName": _SERIALIZER.url("link_connection_name", link_connection_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_nat_rules_get_request( + resource_group_name: str, gateway_name: str, nat_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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_nat_rules_create_or_update_request( + resource_group_name: str, gateway_name: str, nat_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", "2023-09-01")) + 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.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_nat_rules_delete_request( + resource_group_name: str, gateway_name: str, nat_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "natRuleName": _SERIALIZER.url("nat_rule_name", nat_rule_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_nat_rules_list_by_vpn_gateway_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_p2_svpn_gateways_get_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_p2_svpn_gateways_create_or_update_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/p2svpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_p2_svpn_gateways_update_tags_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/p2svpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_p2_svpn_gateways_delete_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_p2_svpn_gateways_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_p2_svpn_gateways_list_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_p2_svpn_gateways_reset_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_p2_svpn_gateways_generate_vpn_profile_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/p2svpnGateways/{gatewayName}/generatevpnprofile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_p2_svpn_gateways_get_p2_s_vpn_connection_health_request( + resource_group_name: str, gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_p2_svpn_gateways_get_p2_s_vpn_connection_health_detailed_request( + resource_group_name: str, gateway_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-09-01")) + 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.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_p2_svpn_gateways_disconnect_p2_s_vpn_connections_request( + resource_group_name: str, p2_s_vpn_gateway_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-09-01")) + 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.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "p2sVpnGatewayName": _SERIALIZER.url("p2_s_vpn_gateway_name", p2_s_vpn_gateway_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vpn_server_configurations_associated_with_virtual_wan_list_request( + resource_group_name: str, virtual_wan_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualWANName": _SERIALIZER.url("virtual_wan_name", virtual_wan_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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_route_table_v2_s_get_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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_virtual_hub_route_table_v2_s_create_or_update_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_route_table_v2_s_delete_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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_virtual_hub_route_table_v2_s_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_express_route_gateways_list_by_subscription_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_gateways_list_by_resource_group_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_gateways_create_or_update_request( + resource_group_name: str, express_route_gateway_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-09-01")) + 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.Network/expressRouteGateways/{expressRouteGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_gateways_update_tags_request( + resource_group_name: str, express_route_gateway_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-09-01")) + 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.Network/expressRouteGateways/{expressRouteGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_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_express_route_gateways_get_request( + resource_group_name: str, express_route_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_gateways_delete_request( + resource_group_name: str, express_route_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_connections_create_or_update_request( + resource_group_name: str, express_route_gateway_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-09-01")) + 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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_connections_get_request( + resource_group_name: str, express_route_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_connections_delete_request( + resource_group_name: str, express_route_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_express_route_connections_list_request( + resource_group_name: str, express_route_gateway_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "expressRouteGatewayName": _SERIALIZER.url("express_route_gateway_name", express_route_gateway_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_network_virtual_appliance_connections_create_or_update_request( + resource_group_name: str, + network_virtual_appliance_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-09-01")) + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str", pattern=r"^[A-Za-z0-9_]+" + ), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str", pattern=r"^[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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_virtual_appliance_connections_get_request( + resource_group_name: str, + network_virtual_appliance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "connectionName": _SERIALIZER.url("connection_name", connection_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_network_virtual_appliance_connections_delete_request( + resource_group_name: str, + network_virtual_appliance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str" + ), + "connectionName": _SERIALIZER.url("connection_name", connection_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_network_virtual_appliance_connections_list_request( + resource_group_name: str, network_virtual_appliance_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "networkVirtualApplianceName": _SERIALIZER.url( + "network_virtual_appliance_name", network_virtual_appliance_name, "str", pattern=r"^[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_virtual_hub_bgp_connection_get_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_virtual_hub_bgp_connection_create_or_update_request( + resource_group_name: str, virtual_hub_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_bgp_connection_delete_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_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_virtual_hub_bgp_connections_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_virtual_hub_bgp_connections_list_learned_routes_request( + resource_group_name: str, hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hubName": _SERIALIZER.url("hub_name", hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_bgp_connections_list_advertised_routes_request( + resource_group_name: str, hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "hubName": _SERIALIZER.url("hub_name", hub_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_ip_configuration_get_request( + resource_group_name: str, virtual_hub_name: str, ip_config_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "ipConfigName": _SERIALIZER.url("ip_config_name", ip_config_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_virtual_hub_ip_configuration_create_or_update_request( + resource_group_name: str, virtual_hub_name: str, ip_config_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "ipConfigName": _SERIALIZER.url("ip_config_name", ip_config_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_virtual_hub_ip_configuration_delete_request( + resource_group_name: str, virtual_hub_name: str, ip_config_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "ipConfigName": _SERIALIZER.url("ip_config_name", ip_config_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_virtual_hub_ip_configuration_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_hub_route_tables_create_or_update_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hub_route_tables_get_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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_hub_route_tables_delete_request( + resource_group_name: str, virtual_hub_name: str, route_table_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routeTableName": _SERIALIZER.url("route_table_name", route_table_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_hub_route_tables_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_routing_intent_create_or_update_request( + resource_group_name: str, virtual_hub_name: str, routing_intent_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-09-01")) + 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.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routingIntentName": _SERIALIZER.url("routing_intent_name", routing_intent_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_routing_intent_get_request( + resource_group_name: str, virtual_hub_name: str, routing_intent_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routingIntentName": _SERIALIZER.url("routing_intent_name", routing_intent_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_routing_intent_delete_request( + resource_group_name: str, virtual_hub_name: str, routing_intent_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_name, "str"), + "routingIntentName": _SERIALIZER.url("routing_intent_name", routing_intent_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_routing_intent_list_request( + resource_group_name: str, virtual_hub_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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "virtualHubName": _SERIALIZER.url("virtual_hub_name", virtual_hub_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_web_application_firewall_policies_list_request( + resource_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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_web_application_firewall_policies_list_all_request(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-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_web_application_firewall_policies_get_request( + resource_group_name: str, 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str", max_length=128), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_web_application_firewall_policies_create_or_update_request( + resource_group_name: str, 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", "2023-09-01")) + 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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str", max_length=128), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_web_application_firewall_policies_delete_request( + resource_group_name: str, 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", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str", max_length=128), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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) + + +class ApplicationGatewaysOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_delete_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, application_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace + def get(self, resource_group_name: str, application_gateway_name: str, **kwargs: Any) -> _models.ApplicationGateway: + """Gets the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGateway] = kwargs.pop("cls", None) + + request = build_application_gateways_get_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.ApplicationGateway, IO], + **kwargs: Any + ) -> _models.ApplicationGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, "ApplicationGateway") + + request = build_application_gateways_create_or_update_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + 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.Network/applicationGateways/{applicationGatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: _models.ApplicationGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :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 ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + 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 ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.ApplicationGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.ApplicationGateway]: + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update application gateway operation. + Is either a ApplicationGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway 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 ApplicationGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, + application_gateway_name=application_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + application_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ApplicationGateway: + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param parameters: Parameters supplied to update application gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGateway] = 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, "TagsObject") + + request = build_application_gateways_update_tags_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ApplicationGateway"]: + """Lists all application gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 ApplicationGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayListResult] = 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_application_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.ApplicationGateway"]: + """Gets all the application gateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayListResult] = 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_application_gateways_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways"} + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_start_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start" + } + + @distributed_trace + def begin_start(self, resource_group_name: str, application_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateways_stop_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop" + } + + @distributed_trace + def begin_stop(self, resource_group_name: str, application_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop" + } + + def _backend_health_initial( + self, resource_group_name: str, application_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.ApplicationGatewayBackendHealth]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ApplicationGatewayBackendHealth]] = kwargs.pop("cls", None) + + request = build_application_gateways_backend_health_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self._backend_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayBackendHealth", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _backend_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth" + } + + @distributed_trace + def begin_backend_health( + self, resource_group_name: str, application_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayBackendHealth]: + """Gets the backend health of the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApplicationGatewayBackendHealth or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealth] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayBackendHealth] = 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._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + 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): + deserialized = self._deserialize("ApplicationGatewayBackendHealth", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backend_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth" + } + + def _backend_health_on_demand_initial( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: Union[_models.ApplicationGatewayOnDemandProbe, IO], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.ApplicationGatewayBackendHealthOnDemand]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApplicationGatewayBackendHealthOnDemand]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(probe_request, (IOBase, bytes)): + _content = probe_request + else: + _json = self._serialize.body(probe_request, "ApplicationGatewayOnDemandProbe") + + request = build_application_gateways_backend_health_on_demand_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._backend_health_on_demand_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayBackendHealthOnDemand", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _backend_health_on_demand_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand" + } + + @overload + def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: _models.ApplicationGatewayOnDemandProbe, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Required. + :type probe_request: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayOnDemandProbe + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :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 ApplicationGatewayBackendHealthOnDemand + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: IO, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Required. + :type probe_request: IO + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :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 ApplicationGatewayBackendHealthOnDemand + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_backend_health_on_demand( + self, + resource_group_name: str, + application_gateway_name: str, + probe_request: Union[_models.ApplicationGatewayOnDemandProbe, IO], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayBackendHealthOnDemand]: + """Gets the backend health for given combination of backend pool and http setting of the specified + application gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param probe_request: Request body for on-demand test probe operation. Is either a + ApplicationGatewayOnDemandProbe type or a IO type. Required. + :type probe_request: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayOnDemandProbe or + IO + :keyword expand: Expands BackendAddressPool and BackendHttpSettings referenced in backend + health. Default value is None. + :paramtype expand: str + :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 ApplicationGatewayBackendHealthOnDemand + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayBackendHealthOnDemand] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGatewayBackendHealthOnDemand] = 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._backend_health_on_demand_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + probe_request=probe_request, + expand=expand, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayBackendHealthOnDemand", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_backend_health_on_demand.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand" + } + + @distributed_trace + def list_available_server_variables(self, **kwargs: Any) -> List[str]: + """Lists all available server variables. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_server_variables_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_server_variables.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_server_variables.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables" + } + + @distributed_trace + def list_available_request_headers(self, **kwargs: Any) -> List[str]: + """Lists all available request headers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_request_headers_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_request_headers.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_request_headers.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders" + } + + @distributed_trace + def list_available_response_headers(self, **kwargs: Any) -> List[str]: + """Lists all available response headers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of str or the result of cls(response) + :rtype: list[str] + :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._api_version or "2023-09-01")) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_response_headers_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_response_headers.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[str]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_response_headers.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders" + } + + @distributed_trace + def list_available_waf_rule_sets(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableWafRuleSetsResult: + """Lists all available web application firewall rule sets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayAvailableWafRuleSetsResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAvailableWafRuleSetsResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableWafRuleSetsResult] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_waf_rule_sets_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_waf_rule_sets.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayAvailableWafRuleSetsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_waf_rule_sets.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets" + } + + @distributed_trace + def list_available_ssl_options(self, **kwargs: Any) -> _models.ApplicationGatewayAvailableSslOptions: + """Lists available Ssl options for configuring Ssl policy. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayAvailableSslOptions or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayAvailableSslOptions + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableSslOptions] = kwargs.pop("cls", None) + + request = build_application_gateways_list_available_ssl_options_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_ssl_options.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayAvailableSslOptions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_available_ssl_options.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default" + } + + @distributed_trace + def list_available_ssl_predefined_policies( + self, **kwargs: Any + ) -> Iterable["_models.ApplicationGatewaySslPredefinedPolicy"]: + """Lists all SSL predefined policies for configuring Ssl policy. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewaySslPredefinedPolicy or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayAvailableSslPredefinedPolicies] = 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_application_gateways_list_available_ssl_predefined_policies_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_available_ssl_predefined_policies.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayAvailableSslPredefinedPolicies", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_available_ssl_predefined_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies" + } + + @distributed_trace + def get_ssl_predefined_policy( + self, predefined_policy_name: str, **kwargs: Any + ) -> _models.ApplicationGatewaySslPredefinedPolicy: + """Gets Ssl predefined policy with the specified policy name. + + :param predefined_policy_name: Name of Ssl predefined policy. Required. + :type predefined_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewaySslPredefinedPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewaySslPredefinedPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewaySslPredefinedPolicy] = kwargs.pop("cls", None) + + request = build_application_gateways_get_ssl_predefined_policy_request( + predefined_policy_name=predefined_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_ssl_predefined_policy.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewaySslPredefinedPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_ssl_predefined_policy.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}" + } + + +class ApplicationGatewayPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_gateway_private_link_resources` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationGatewayPrivateLinkResource"]: + """Lists all private link resources on an application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewayPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateLinkResource] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateLinkResourceListResult] = 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_application_gateway_private_link_resources_list_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateLinkResourceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateLinkResources" + } + + +class ApplicationGatewayPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_gateway_private_endpoint_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_gateway_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, application_gateway_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + def _update_initial( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: Union[_models.ApplicationGatewayPrivateEndpointConnection, IO], + **kwargs: Any + ) -> Optional[_models.ApplicationGatewayPrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ApplicationGatewayPrivateEndpointConnection]] = 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, "ApplicationGatewayPrivateEndpointConnection") + + request = build_application_gateway_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: _models.ApplicationGatewayPrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection + :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 + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. 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 + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + application_gateway_name: str, + connection_name: str, + parameters: Union[_models.ApplicationGatewayPrivateEndpointConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.ApplicationGatewayPrivateEndpointConnection]: + """Updates the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :param parameters: Parameters supplied to update application gateway private endpoint + connection operation. Is either a ApplicationGatewayPrivateEndpointConnection type or a IO + type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection 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 + ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = 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, + application_gateway_name=application_gateway_name, + connection_name=connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, application_gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.ApplicationGatewayPrivateEndpointConnection: + """Gets the specified private endpoint connection on application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :param connection_name: The name of the application gateway private endpoint connection. + Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayPrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_application_gateway_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, application_gateway_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationGatewayPrivateEndpointConnection"]: + """Lists all private endpoint connections on an application gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. Required. + :type application_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGatewayPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayPrivateEndpointConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayPrivateEndpointConnectionListResult] = 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_application_gateway_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayPrivateEndpointConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections" + } + + +class ApplicationGatewayWafDynamicManifestsDefaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_gateway_waf_dynamic_manifests_default` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, location: str, **kwargs: Any) -> _models.ApplicationGatewayWafDynamicManifestResult: + """Gets the regional application gateway waf manifest. + + :param location: The region where the nrp are located at. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGatewayWafDynamicManifestResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResult] = kwargs.pop("cls", None) + + request = build_application_gateway_waf_dynamic_manifests_default_get_request( + location=location, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationGatewayWafDynamicManifestResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault" + } + + +class ApplicationGatewayWafDynamicManifestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_gateway_waf_dynamic_manifests` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, location: str, **kwargs: Any) -> Iterable["_models.ApplicationGatewayWafDynamicManifestResult"]: + """Gets the regional application gateway waf manifest. + + :param location: The region where the nrp are located at. 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 ApplicationGatewayWafDynamicManifestResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationGatewayWafDynamicManifestResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationGatewayWafDynamicManifestResultList] = 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_application_gateway_waf_dynamic_manifests_get_request( + location=location, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationGatewayWafDynamicManifestResultList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests" + } + + +class ApplicationSecurityGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`application_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_security_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_application_security_groups_delete_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, application_security_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, application_security_group_name: str, **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Gets information about the specified application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroup] = kwargs.pop("cls", None) + + request = build_application_security_groups_get_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.ApplicationSecurityGroup, IO], + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, "ApplicationSecurityGroup") + + request = build_application_security_groups_create_or_update_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + 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.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: _models.ApplicationSecurityGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :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 ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. 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 ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.ApplicationSecurityGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.ApplicationSecurityGroup]: + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update ApplicationSecurityGroup + operation. Is either a ApplicationSecurityGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup 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 ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, + application_security_group_name=application_security_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + application_security_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ApplicationSecurityGroup: + """Updates an application security group's tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param application_security_group_name: The name of the application security group. Required. + :type application_security_group_name: str + :param parameters: Parameters supplied to update application security group tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationSecurityGroup] = 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, "TagsObject") + + request = build_application_security_groups_update_tags_request( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.ApplicationSecurityGroup"]: + """Gets all application security groups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroupListResult] = 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_application_security_groups_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ApplicationSecurityGroup"]: + """Gets all the application security groups in a resource group. + + :param resource_group_name: The name of the resource group. 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 ApplicationSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ApplicationSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ApplicationSecurityGroupListResult] = 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_application_security_groups_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups" + } + + +class AvailableDelegationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`available_delegations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableDelegation"]: + """Gets all of the available subnet delegations for this subscription in this region. + + :param location: The location of the subnet. 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 AvailableDelegation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableDelegationsResult] = 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_available_delegations_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableDelegationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations" + } + + +class AvailableResourceGroupDelegationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`available_resource_group_delegations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AvailableDelegation"]: + """Gets all of the available subnet delegations for this resource group in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AvailableDelegation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableDelegation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableDelegationsResult] = 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_available_resource_group_delegations_list_request( + location=location, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableDelegationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations" + } + + +class AvailableServiceAliasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`available_service_aliases` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableServiceAlias"]: + """Gets all available service aliases for this subscription in this region. + + :param location: The location. 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 AvailableServiceAlias or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableServiceAliasesResult] = 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_available_service_aliases_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableServiceAliasesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, location: str, **kwargs: Any + ) -> Iterable["_models.AvailableServiceAlias"]: + """Gets all available service aliases for this resource group in this region. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param location: The location. 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 AvailableServiceAlias or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailableServiceAlias] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailableServiceAliasesResult] = 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_available_service_aliases_list_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableServiceAliasesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + } + + +class AzureFirewallsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`azure_firewalls` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, azure_firewall_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_azure_firewalls_delete_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace + def get(self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any) -> _models.AzureFirewall: + """Gets the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureFirewall or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewall] = kwargs.pop("cls", None) + + request = build_azure_firewalls_get_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.AzureFirewall, IO], + **kwargs: Any + ) -> _models.AzureFirewall: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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, "AzureFirewall") + + request = build_azure_firewalls_create_or_update_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + 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.Network/azureFirewalls/{azureFirewallName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.AzureFirewall, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall + :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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. + 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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.AzureFirewall, IO], + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Creates or updates the specified Azure Firewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to the create or update Azure Firewall operation. Is + either a AzureFirewall type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureFirewall 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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureFirewall", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.AzureFirewall]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AzureFirewall]] = 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, "TagsObject") + + request = build_azure_firewalls_update_tags_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("AzureFirewall", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. 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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.AzureFirewall]: + """Updates tags of an Azure Firewall resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to update azure firewall tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 AzureFirewall or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureFirewall] = 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_tags_initial( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureFirewall", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AzureFirewall"]: + """Lists all Azure Firewalls in a resource group. + + :param resource_group_name: The name of the resource group. 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 AzureFirewall or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallListResult] = 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_azure_firewalls_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.AzureFirewall"]: + """Gets all the Azure Firewalls in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureFirewall or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewall] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallListResult] = 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_azure_firewalls_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls"} + + def _list_learned_prefixes_initial( + self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any + ) -> Optional[_models.IPPrefixesList]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.IPPrefixesList]] = kwargs.pop("cls", None) + + request = build_azure_firewalls_list_learned_prefixes_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_learned_prefixes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("IPPrefixesList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_learned_prefixes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes" + } + + @distributed_trace + def begin_list_learned_prefixes( + self, resource_group_name: str, azure_firewall_name: str, **kwargs: Any + ) -> LROPoller[_models.IPPrefixesList]: + """Retrieves a list of all IP prefixes that azure firewall has learned to not SNAT. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the azure firewall. Required. + :type azure_firewall_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 IPPrefixesList or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IPPrefixesList] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IPPrefixesList] = 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._list_learned_prefixes_initial( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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): + deserialized = self._deserialize("IPPrefixesList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_learned_prefixes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes" + } + + def _packet_capture_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.FirewallPacketCaptureParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "FirewallPacketCaptureParameters") + + request = build_azure_firewalls_packet_capture_request( + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._packet_capture_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture" + } + + @overload + def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: _models.FirewallPacketCaptureParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPacketCaptureParameters + :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: + """ + + @overload + def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_packet_capture( + self, + resource_group_name: str, + azure_firewall_name: str, + parameters: Union[_models.FirewallPacketCaptureParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Runs a packet capture on AzureFirewall. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param azure_firewall_name: The name of the Azure Firewall. Required. + :type azure_firewall_name: str + :param parameters: Parameters supplied to run packet capture on azure firewall. Is either a + FirewallPacketCaptureParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPacketCaptureParameters 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 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._api_version or "2023-09-01")) + 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._packet_capture_initial( # type: ignore + resource_group_name=resource_group_name, + azure_firewall_name=azure_firewall_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/packetCapture" + } + + +class AzureFirewallFqdnTagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`azure_firewall_fqdn_tags` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.AzureFirewallFqdnTag"]: + """Gets all the Azure Firewall FQDN Tags in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureFirewallFqdnTag or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureFirewallFqdnTag] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureFirewallFqdnTagListResult] = 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_azure_firewall_fqdn_tags_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureFirewallFqdnTagListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags"} + + +class WebCategoriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`web_categories` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, name: str, *, expand: Optional[str] = None, **kwargs: Any) -> _models.AzureWebCategory: + """Gets the specified Azure Web Category. + + :param name: The name of the azureWebCategory. Required. + :type name: str + :keyword expand: Expands resourceIds back referenced by the azureWebCategory resource. Default + value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureWebCategory or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AzureWebCategory + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureWebCategory] = kwargs.pop("cls", None) + + request = build_web_categories_get_request( + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureWebCategory", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}"} + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AzureWebCategory"]: + """Gets all the Azure Web Categories in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AzureWebCategory or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AzureWebCategory] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AzureWebCategoryListResult] = 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_web_categories_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AzureWebCategoryListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories" + } + + +class BastionHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`bastion_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, bastion_host_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_bastion_hosts_delete_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, bastion_host_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace + def get(self, resource_group_name: str, bastion_host_name: str, **kwargs: Any) -> _models.BastionHost: + """Gets the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BastionHost + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + request = build_bastion_hosts_get_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: Union[_models.BastionHost, IO], + **kwargs: Any + ) -> _models.BastionHost: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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, "BastionHost") + + request = build_bastion_hosts_create_or_update_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BastionHost", pipeline_response) + + 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.Network/bastionHosts/{bastionHostName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: _models.BastionHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BastionHost + :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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. + 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: Union[_models.BastionHost, IO], + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Creates or updates the specified Bastion Host. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to the create or update Bastion Host operation. Is + either a BastionHost type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BastionHost 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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, + bastion_host_name=bastion_host_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + def _update_tags_initial( + self, resource_group_name: str, bastion_host_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> Optional[_models.BastionHost]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BastionHost]] = 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, "TagsObject") + + request = build_bastion_hosts_update_tags_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + bastion_host_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, bastion_host_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Updates Tags for BastionHost resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param parameters: Parameters supplied to update BastionHost tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionHost] = 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_tags_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.BastionHost"]: + """Lists all Bastion Hosts in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionHost or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHostListResult] = 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_bastion_hosts_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BastionHost"]: + """Lists all Bastion Hosts in a resource group. + + :param resource_group_name: The name of the resource group. 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 BastionHost or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionHost] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BastionHostListResult] = 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_bastion_hosts_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts" + } + + +class NetworkManagementClientOperationsMixin(NetworkManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + def _put_bastion_shareable_link_initial( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> Optional[_models.BastionShareableLinkListResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_put_bastion_shareable_link_initial") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BastionShareableLinkListResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + request = build_network_management_put_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_bastion_shareable_link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionShareableLinkListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _put_bastion_shareable_link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" + } + + @overload + def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Iterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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 an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Iterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: 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 an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_put_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> LROPoller[Iterable["_models.BastionShareableLink"]]: + """Creates a Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest 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 an iterator like instance of either + BastionShareableLinkListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink]] + :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._api_version("begin_put_bastion_shareable_link") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) + + error_map = { + 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 + if isinstance(bsl_request, (IOBase, bytes)): + _json = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_put_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.begin_put_bastion_shareable_link.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionShareableLinkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._put_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_request=bsl_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return get_next(next_link) + + return ItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" + } + + def _delete_bastion_shareable_link_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("_delete_bastion_shareable_link_initial") or "2023-09-01"), + ) + 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(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + request = build_network_management_delete_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_bastion_shareable_link_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_bastion_shareable_link_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" + } + + @overload + def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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: + """ + + @overload + def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest 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 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._api_version("begin_delete_bastion_shareable_link") or "2023-09-01"), + ) + 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._delete_bastion_shareable_link_initial( # type: ignore + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_request=bsl_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" + } + + def _delete_bastion_shareable_link_by_token_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("_delete_bastion_shareable_link_by_token_initial") or "2023-09-01" + ), + ) + 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(bsl_token_request, (IOBase, bytes)): + _content = bsl_token_request + else: + _json = self._serialize.body(bsl_token_request, "BastionShareableLinkTokenListRequest") + + request = build_network_management_delete_bastion_shareable_link_by_token_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._delete_bastion_shareable_link_by_token_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_bastion_shareable_link_by_token_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken" + } + + @overload + def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: _models.BastionShareableLinkTokenListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. + Required. + :type bsl_token_request: + ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest + :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: + """ + + @overload + def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. + Required. + :type bsl_token_request: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_bastion_shareable_link_by_token( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_token_request: Union[_models.BastionShareableLinkTokenListRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Bastion Shareable Links for all the tokens specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_token_request: Post request for Delete Bastion Shareable Link By Token endpoint. Is + either a BastionShareableLinkTokenListRequest type or a IO type. Required. + :type bsl_token_request: + ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkTokenListRequest 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 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._api_version("begin_delete_bastion_shareable_link_by_token") or "2023-09-01" + ), + ) + 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._delete_bastion_shareable_link_by_token_initial( # type: ignore + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + bsl_token_request=bsl_token_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_bastion_shareable_link_by_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinksByToken" + } + + @overload + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: _models.BastionShareableLinkListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest + :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: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. + Required. + :type bsl_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_bastion_shareable_link( + self, + resource_group_name: str, + bastion_host_name: str, + bsl_request: Union[_models.BastionShareableLinkListRequest, IO], + **kwargs: Any + ) -> Iterable["_models.BastionShareableLink"]: + """Return the Bastion Shareable Links for all the VMs specified in the request. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param bsl_request: Post request for Create/Delete/Get Bastion Shareable Link endpoints. Is + either a BastionShareableLinkListRequest type or a IO type. Required. + :type bsl_request: ~azure.mgmt.network.v2023_09_01.models.BastionShareableLinkListRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionShareableLink or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionShareableLink] + :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._api_version("get_bastion_shareable_link") or "2023-09-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionShareableLinkListResult] = kwargs.pop("cls", None) + + error_map = { + 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(bsl_request, (IOBase, bytes)): + _content = bsl_request + else: + _json = self._serialize.body(bsl_request, "BastionShareableLinkListRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_get_bastion_shareable_link_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_bastion_shareable_link.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionShareableLinkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + get_bastion_shareable_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks" + } + + def _get_active_sessions_initial( + self, resource_group_name: str, bastion_host_name: str, **kwargs: Any + ) -> Optional[_models.BastionActiveSessionListResult]: + 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._api_version("_get_active_sessions_initial") or "2023-09-01") + ) + cls: ClsType[Optional[_models.BastionActiveSessionListResult]] = kwargs.pop("cls", None) + + request = build_network_management_get_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_active_sessions_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BastionActiveSessionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_active_sessions_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" + } + + @distributed_trace + def begin_get_active_sessions( + self, resource_group_name: str, bastion_host_name: str, **kwargs: Any + ) -> LROPoller[Iterable["_models.BastionActiveSession"]]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_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 an iterator like instance of either + BastionActiveSessionListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionActiveSession]] + :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._api_version("begin_get_active_sessions") or "2023-09-01") + ) + cls: ClsType[_models.BastionActiveSessionListResult] = 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_network_management_get_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.begin_get_active_sessions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionActiveSessionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._get_active_sessions_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_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): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return get_next(next_link) + + return ItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_active_sessions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" + } + + @overload + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: _models.SessionIds, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Required. + :type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds + :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: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Required. + :type session_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def disconnect_active_sessions( + self, + resource_group_name: str, + bastion_host_name: str, + session_ids: Union[_models.SessionIds, IO], + **kwargs: Any + ) -> Iterable["_models.BastionSessionState"]: + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. Required. + :type bastion_host_name: str + :param session_ids: The list of sessionids to disconnect. Is either a SessionIds type or a IO + type. Required. + :type session_ids: ~azure.mgmt.network.v2023_09_01.models.SessionIds or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionSessionState or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BastionSessionState] + :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._api_version("disconnect_active_sessions") or "2023-09-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BastionSessionDeleteResult] = kwargs.pop("cls", None) + + error_map = { + 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(session_ids, (IOBase, bytes)): + _content = session_ids + else: + _json = self._serialize.body(session_ids, "SessionIds") + + def prepare_request(next_link=None): + if not next_link: + + request = build_network_management_disconnect_active_sessions_request( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.disconnect_active_sessions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionSessionDeleteResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + disconnect_active_sessions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions" + } + + @distributed_trace + def check_dns_name_availability( + self, location: str, *, domain_name_label: str, **kwargs: Any + ) -> _models.DnsNameAvailabilityResult: + """Checks whether a domain name in the cloudapp.azure.com zone is available for use. + + :param location: The location of the domain name. Required. + :type location: str + :keyword domain_name_label: The domain name to be verified. It must conform to the following + regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. Required. + :paramtype domain_name_label: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DnsNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DnsNameAvailabilityResult + :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._api_version("check_dns_name_availability") or "2023-09-01") + ) + cls: ClsType[_models.DnsNameAvailabilityResult] = kwargs.pop("cls", None) + + request = build_network_management_check_dns_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + domain_name_label=domain_name_label, + api_version=api_version, + template_url=self.check_dns_name_availability.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsNameAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_dns_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability" + } + + @distributed_trace + def express_route_provider_port(self, providerport: str, **kwargs: Any) -> _models.ExpressRouteProviderPort: + """Retrieves detail of a provider port. + + :param providerport: The name of the provider port. Required. + :type providerport: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteProviderPort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPort + :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._api_version("express_route_provider_port") or "2023-09-01") + ) + cls: ClsType[_models.ExpressRouteProviderPort] = kwargs.pop("cls", None) + + request = build_network_management_express_route_provider_port_request( + providerport=providerport, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.express_route_provider_port.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteProviderPort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + express_route_provider_port.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}" + } + + @overload + def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.ActiveConfigurationParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_active_connectivity_configurations( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.ActiveConfigurationParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ActiveConnectivityConfigurationsListResult: + """Lists active connectivity configurations in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveConnectivityConfigurationsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveConnectivityConfigurationsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_active_connectivity_configurations") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveConnectivityConfigurationsListResult] = 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, "ActiveConfigurationParameter") + + request = build_network_management_list_active_connectivity_configurations_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_active_connectivity_configurations.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveConnectivityConfigurationsListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_connectivity_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations" + } + + @overload + def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.ActiveConfigurationParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_active_security_admin_rules( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.ActiveConfigurationParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.ActiveSecurityAdminRulesListResult: + """Lists active security admin rules in a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Active Configuration Parameter. Is either a ActiveConfigurationParameter + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ActiveConfigurationParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: ActiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ActiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop("api-version", self._api_version("list_active_security_admin_rules") or "2023-09-01"), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ActiveSecurityAdminRulesListResult] = 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, "ActiveConfigurationParameter") + + request = build_network_management_list_active_security_admin_rules_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_active_security_admin_rules.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSecurityAdminRulesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_active_security_admin_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules" + } + + @overload + def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.QueryRequestOptions, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_network_manager_effective_connectivity_configurations( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.QueryRequestOptions, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerEffectiveConnectivityConfigurationListResult: + """List all effective connectivity configurations applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveConnectivityConfigurationListResult or the result of + cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveConnectivityConfigurationListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", + self._api_version("list_network_manager_effective_connectivity_configurations") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerEffectiveConnectivityConfigurationListResult] = 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, "QueryRequestOptions") + + request = build_network_management_list_network_manager_effective_connectivity_configurations_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_network_manager_effective_connectivity_configurations.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "NetworkManagerEffectiveConnectivityConfigurationListResult", pipeline_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_connectivity_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations" + } + + @overload + def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.QueryRequestOptions, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_network_manager_effective_security_admin_rules( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.QueryRequestOptions, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerEffectiveSecurityAdminRulesListResult: + """List all effective security admin rules applied on a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to list correct page. Is either a QueryRequestOptions + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryRequestOptions or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerEffectiveSecurityAdminRulesListResult or the result of cls(response) + :rtype: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerEffectiveSecurityAdminRulesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", self._api_version("list_network_manager_effective_security_admin_rules") or "2023-09-01" + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerEffectiveSecurityAdminRulesListResult] = 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, "QueryRequestOptions") + + request = build_network_management_list_network_manager_effective_security_admin_rules_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_network_manager_effective_security_admin_rules.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerEffectiveSecurityAdminRulesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_network_manager_effective_security_admin_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules" + } + + @distributed_trace + def supported_security_providers( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> _models.VirtualWanSecurityProviders: + """Gives the supported security providers for the virtual wan. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which supported security providers are + needed. Required. + :type virtual_wan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWanSecurityProviders or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWanSecurityProviders + :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._api_version("supported_security_providers") or "2023-09-01") + ) + cls: ClsType[_models.VirtualWanSecurityProviders] = kwargs.pop("cls", None) + + request = build_network_management_supported_security_providers_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.supported_security_providers.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWanSecurityProviders", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + supported_security_providers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders" + } + + def _generatevirtualwanvpnserverconfigurationvpnprofile_initial( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnProfileResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", + _params.pop( + "api-version", + self._api_version("_generatevirtualwanvpnserverconfigurationvpnprofile_initial") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnProfileResponse]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_client_params, (IOBase, bytes)): + _content = vpn_client_params + else: + _json = self._serialize.body(vpn_client_params, "VirtualWanVpnProfileParameters") + + request = build_network_management_generatevirtualwanvpnserverconfigurationvpnprofile_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generatevirtualwanvpnserverconfigurationvpnprofile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generatevirtualwanvpnserverconfigurationvpnprofile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" + } + + @overload + def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: _models.VirtualWanVpnProfileParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Required. + :type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters + :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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Required. + :type vpn_client_params: 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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generatevirtualwanvpnserverconfigurationvpnprofile( + self, + resource_group_name: str, + virtual_wan_name: str, + vpn_client_params: Union[_models.VirtualWanVpnProfileParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates a unique VPN profile for P2S clients for VirtualWan and associated + VpnServerConfiguration combination in the specified resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_name: str + :param vpn_client_params: Parameters supplied to the generate VirtualWan VPN profile generation + operation. Is either a VirtualWanVpnProfileParameters type or a IO type. Required. + :type vpn_client_params: ~azure.mgmt.network.v2023_09_01.models.VirtualWanVpnProfileParameters + 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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :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._api_version("begin_generatevirtualwanvpnserverconfigurationvpnprofile") or "2023-09-01", + ), + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnProfileResponse] = 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._generatevirtualwanvpnserverconfigurationvpnprofile_initial( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + vpn_client_params=vpn_client_params, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generatevirtualwanvpnserverconfigurationvpnprofile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" + } + + +class NetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_interfaces` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_cloud_service_role_instance_network_interfaces( + self, resource_group_name: str, cloud_service_name: str, role_instance_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """Gets information about all network interfaces in a role instance in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_cloud_service_role_instance_network_interfaces_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_role_instance_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_cloud_service_role_instance_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces" + } + + @distributed_trace + def list_cloud_service_network_interfaces( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """Gets all network interfaces in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_cloud_service_network_interfaces_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_cloud_service_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces" + } + + @distributed_trace + def get_cloud_service_network_interface( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterface: + """Get the specified network interface in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_cloud_service_network_interface_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_cloud_service_network_interface.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_cloud_service_network_interface.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_interfaces_delete_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_interface_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_interface_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkInterface: + """Gets information about the specified network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, "NetworkInterface") + + request = build_network_interfaces_create_or_update_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + 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.Network/networkInterfaces/{networkInterfaceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: _models.NetworkInterface, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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 NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. + 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 NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.NetworkInterface, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkInterface]: + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network interface operation. Is + either a NetworkInterface type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface 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 NetworkInterface or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, + network_interface_name=network_interface_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterface", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_interface_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkInterface: + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param parameters: Parameters supplied to update network interface tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterface] = 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, "TagsObject") + + request = build_network_interfaces_update_tags_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkInterface"]: + """Gets all network interfaces in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkInterface"]: + """Gets all network interfaces in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces" + } + + def _get_effective_route_table_initial( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Optional[_models.EffectiveRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.EffectiveRouteListResult]] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_effective_route_table_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_effective_route_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_effective_route_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" + } + + @distributed_trace + def begin_get_effective_route_table( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteListResult]: + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_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 EffectiveRouteListResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EffectiveRouteListResult] = 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._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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): + deserialized = self._deserialize("EffectiveRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_effective_route_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" + } + + def _list_effective_network_security_groups_initial( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Optional[_models.EffectiveNetworkSecurityGroupListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.EffectiveNetworkSecurityGroupListResult]] = kwargs.pop("cls", None) + + request = build_network_interfaces_list_effective_network_security_groups_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_effective_network_security_groups_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveNetworkSecurityGroupListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_effective_network_security_groups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" + } + + @distributed_trace + def begin_list_effective_network_security_groups( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> LROPoller[_models.EffectiveNetworkSecurityGroupListResult]: + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_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 EffectiveNetworkSecurityGroupListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveNetworkSecurityGroupListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EffectiveNetworkSecurityGroupListResult] = 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._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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): + deserialized = self._deserialize("EffectiveNetworkSecurityGroupListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_effective_network_security_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" + } + + @distributed_trace + def list_virtual_machine_scale_set_vm_network_interfaces( + self, resource_group_name: str, virtual_machine_scale_set_name: str, virtualmachine_index: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """Gets information about all network interfaces in a virtual machine in a virtual machine scale + set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_virtual_machine_scale_set_vm_network_interfaces_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_vm_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_vm_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces" + } + + @distributed_trace + def list_virtual_machine_scale_set_network_interfaces( + self, resource_group_name: str, virtual_machine_scale_set_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """Gets all network interfaces in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_network_interfaces_list_virtual_machine_scale_set_network_interfaces_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_network_interfaces.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_network_interfaces.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces" + } + + @distributed_trace + def get_virtual_machine_scale_set_network_interface( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterface: + """Get the specified network interface in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterface or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterface + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterface] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_virtual_machine_scale_set_network_interface_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_network_interface.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterface", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_network_interface.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}" + } + + @distributed_trace + def list_virtual_machine_scale_set_ip_configurations( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkInterfaceIPConfiguration"]: + """Get the specified network interface ip configuration in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = 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_network_interfaces_list_virtual_machine_scale_set_ip_configurations_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_ip_configurations.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_ip_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations" + } + + @distributed_trace + def get_virtual_machine_scale_set_ip_configuration( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkInterfaceIPConfiguration: + """Get the specified network interface ip configuration in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the ip configuration. Required. + :type ip_configuration_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :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._api_version or "2018-10-01")) + cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) + + request = build_network_interfaces_get_virtual_machine_scale_set_ip_configuration_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_ip_configuration.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_ip_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + } + + +class PublicIPAddressesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`public_ip_addresses` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_cloud_service_public_ip_addresses( + self, resource_group_name: str, cloud_service_name: str, **kwargs: Any + ) -> Iterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses on a cloud service level. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_cloud_service_public_ip_addresses_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_cloud_service_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses" + } + + @distributed_trace + def list_cloud_service_role_instance_public_ip_addresses( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_name: str, + **kwargs: Any + ) -> Iterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses in a role instance IP configuration in a cloud + service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The name of role instance. Required. + :type role_instance_name: str + :param network_interface_name: The network interface name. Required. + :type network_interface_name: str + :param ip_configuration_name: The IP configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_cloud_service_role_instance_public_ip_addresses_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_service_role_instance_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_cloud_service_role_instance_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + } + + @distributed_trace + def get_cloud_service_public_ip_address( + self, + resource_group_name: str, + cloud_service_name: str, + role_instance_name: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PublicIPAddress: + """Get the specified public IP address in a cloud service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cloud_service_name: The name of the cloud service. Required. + :type cloud_service_name: str + :param role_instance_name: The role instance name. Required. + :type role_instance_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the IP configuration. Required. + :type ip_configuration_name: str + :param public_ip_address_name: The name of the public IP Address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_cloud_service_public_ip_address_request( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + role_instance_name=role_instance_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_cloud_service_public_ip_address.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_cloud_service_public_ip_address.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_address_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_delete_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, public_ip_address_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PublicIPAddress: + """Gets the specified public IP address in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.PublicIPAddress, IO], + **kwargs: Any + ) -> _models.PublicIPAddress: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, "PublicIPAddress") + + request = build_public_ip_addresses_create_or_update_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + 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.Network/publicIPAddresses/{publicIpAddressName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: _models.PublicIPAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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 PublicIPAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. + 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 PublicIPAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.PublicIPAddress, IO], + **kwargs: Any + ) -> LROPoller[_models.PublicIPAddress]: + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public IP address operation. Is + either a PublicIPAddress type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress 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 PublicIPAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, + public_ip_address_name=public_ip_address_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + public_ip_address_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.PublicIPAddress: + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_name: str + :param parameters: Parameters supplied to update public IP address tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPAddress] = 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, "TagsObject") + + request = build_public_ip_addresses_update_tags_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.PublicIPAddress"]: + """Gets all the public IP addresses in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PublicIPAddress"]: + """Gets all public IP addresses in a resource group. + + :param resource_group_name: The name of the resource group. 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 PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses" + } + + def _ddos_protection_status_initial( + self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any + ) -> Optional[_models.PublicIpDdosProtectionStatusResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.PublicIpDdosProtectionStatusResult]] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_ddos_protection_status_request( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._ddos_protection_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PublicIpDdosProtectionStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _ddos_protection_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus" + } + + @distributed_trace + def begin_ddos_protection_status( + self, resource_group_name: str, public_ip_address_name: str, **kwargs: Any + ) -> LROPoller[_models.PublicIpDdosProtectionStatusResult]: + """Gets the Ddos Protection Status of a Public IP Address. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. Required. + :type public_ip_address_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 PublicIpDdosProtectionStatusResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIpDdosProtectionStatusResult] = 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._ddos_protection_status_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_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): + deserialized = self._deserialize("PublicIpDdosProtectionStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_ddos_protection_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus" + } + + @distributed_trace + def list_virtual_machine_scale_set_public_ip_addresses( + self, resource_group_name: str, virtual_machine_scale_set_name: str, **kwargs: Any + ) -> Iterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses on a virtual machine scale set level. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_virtual_machine_scale_set_public_ip_addresses_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses" + } + + @distributed_trace + def list_virtual_machine_scale_set_vm_public_ip_addresses( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + **kwargs: Any + ) -> Iterable["_models.PublicIPAddress"]: + """Gets information about all public IP addresses in a virtual machine IP configuration in a + virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The network interface name. Required. + :type network_interface_name: str + :param ip_configuration_name: The IP configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPAddress or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPAddress] + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddressListResult] = 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_public_ip_addresses_list_virtual_machine_scale_set_vm_public_ip_addresses_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_virtual_machine_scale_set_vm_public_ip_addresses.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPAddressListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_virtual_machine_scale_set_vm_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + } + + @distributed_trace + def get_virtual_machine_scale_set_public_ip_address( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + virtualmachine_index: str, + network_interface_name: str, + ip_configuration_name: str, + public_ip_address_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PublicIPAddress: + """Get the specified public IP address in a virtual machine scale set. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the virtual machine scale set. Required. + :type virtual_machine_scale_set_name: str + :param virtualmachine_index: The virtual machine index. Required. + :type virtualmachine_index: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the IP configuration. Required. + :type ip_configuration_name: str + :param public_ip_address_name: The name of the public IP Address. Required. + :type public_ip_address_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPAddress or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPAddress + :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._api_version or "2018-10-01")) + cls: ClsType[_models.PublicIPAddress] = kwargs.pop("cls", None) + + request = build_public_ip_addresses_get_virtual_machine_scale_set_public_ip_address_request( + resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, + virtualmachine_index=virtualmachine_index, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_name, + public_ip_address_name=public_ip_address_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_virtual_machine_scale_set_public_ip_address.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_virtual_machine_scale_set_public_ip_address.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + } + + +class VipSwapOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vip_swap` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.SwapResource: + """Gets the SwapResource which identifies the slot type for the specified cloud service. The slot + type on a cloud service can either be Staging or Production. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :keyword singleton_resource: Specifies a synthetic proxy resource that cannot be created or + deleted. Value must be set to swap. Default value is "swap". Note that overriding this default + value may result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwapResource or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SwapResource + :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 {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[_models.SwapResource] = kwargs.pop("cls", None) + + request = build_vip_swap_get_request( + group_name=group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + singleton_resource=singleton_resource, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SwapResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + def _create_initial( # pylint: disable=inconsistent-return-statements + self, group_name: str, resource_name: str, parameters: Union[_models.SwapResource, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "SwapResource") + + request = build_vip_swap_create_request( + group_name=group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + singleton_resource=singleton_resource, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + @overload + def begin_create( + self, + group_name: str, + resource_name: str, + parameters: _models.SwapResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SwapResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @overload + def begin_create( + self, + group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. 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 singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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: + """ + + @distributed_trace + def begin_create( + self, group_name: str, resource_name: str, parameters: Union[_models.SwapResource, IO], **kwargs: Any + ) -> LROPoller[None]: + """Performs vip swap operation on swappable cloud services. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :param parameters: SwapResource object where slot type should be the target slot after vip swap + for the specified cloud service. Is either a SwapResource type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SwapResource or IO + :keyword singleton_resource: Specifies a synthetic resource that cannot be created or deleted. + Value must be set to swap. Default value is "swap". Note that overriding this default value may + result in unsupported behavior. + :paramtype singleton_resource: str + :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 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 {}) + + singleton_resource: Literal["swap"] = kwargs.pop("singleton_resource", "swap") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._create_initial( # type: ignore + group_name=group_name, + resource_name=resource_name, + parameters=parameters, + singleton_resource=singleton_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + } + + @distributed_trace + def list(self, group_name: str, resource_name: str, **kwargs: Any) -> _models.SwapResourceListResult: + """Gets the list of SwapResource which identifies the slot type for the specified cloud service. + The slot type on a cloud service can either be Staging or Production. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param resource_name: The name of the cloud service. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SwapResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SwapResourceListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SwapResourceListResult] = kwargs.pop("cls", None) + + request = build_vip_swap_list_request( + group_name=group_name, + resource_name=resource_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SwapResourceListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots" + } + + +class CustomIPPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`custom_ip_prefixes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, custom_ip_prefix_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_custom_ip_prefixes_delete_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, custom_ip_prefix_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the CustomIpPrefix. Required. + :type custom_ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, custom_ip_prefix_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.CustomIpPrefix: + """Gets the specified custom IP prefix in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefix] = kwargs.pop("cls", None) + + request = build_custom_ip_prefixes_get_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.CustomIpPrefix, IO], + **kwargs: Any + ) -> _models.CustomIpPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, "CustomIpPrefix") + + request = build_custom_ip_prefixes_create_or_update_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + 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.Network/customIpPrefixes/{customIpPrefixName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: _models.CustomIpPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :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 CustomIpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. + 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 CustomIpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.CustomIpPrefix, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomIpPrefix]: + """Creates or updates a custom IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update custom IP prefix operation. Is + either a CustomIpPrefix type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix 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 CustomIpPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, + custom_ip_prefix_name=custom_ip_prefix_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + custom_ip_prefix_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.CustomIpPrefix: + """Updates custom IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param custom_ip_prefix_name: The name of the custom IP prefix. Required. + :type custom_ip_prefix_name: str + :param parameters: Parameters supplied to update custom IP prefix tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomIpPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomIpPrefix] = 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, "TagsObject") + + request = build_custom_ip_prefixes_update_tags_request( + resource_group_name=resource_group_name, + custom_ip_prefix_name=custom_ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CustomIpPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.CustomIpPrefix"]: + """Gets all the custom IP prefixes in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomIpPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefixListResult] = 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_custom_ip_prefixes_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomIpPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.CustomIpPrefix"]: + """Gets all custom IP prefixes in a resource group. + + :param resource_group_name: The name of the resource group. 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 CustomIpPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.CustomIpPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.CustomIpPrefixListResult] = 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_custom_ip_prefixes_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomIpPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes" + } + + +class DdosCustomPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`ddos_custom_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ddos_custom_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ddos_custom_policies_delete_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @distributed_trace + def get(self, resource_group_name: str, ddos_custom_policy_name: str, **kwargs: Any) -> _models.DdosCustomPolicy: + """Gets information about the specified DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosCustomPolicy] = kwargs.pop("cls", None) + + request = build_ddos_custom_policies_get_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.DdosCustomPolicy, IO], + **kwargs: Any + ) -> _models.DdosCustomPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, "DdosCustomPolicy") + + request = build_ddos_custom_policies_create_or_update_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + 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.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: _models.DdosCustomPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :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 DdosCustomPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. 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 DdosCustomPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.DdosCustomPolicy, IO], + **kwargs: Any + ) -> LROPoller[_models.DdosCustomPolicy]: + """Creates or updates a DDoS custom policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to the create or update operation. Is either a + DdosCustomPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy 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 DdosCustomPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, + ddos_custom_policy_name=ddos_custom_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + ddos_custom_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.DdosCustomPolicy: + """Update a DDoS custom policy tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_custom_policy_name: The name of the DDoS custom policy. Required. + :type ddos_custom_policy_name: str + :param parameters: Parameters supplied to update DDoS custom policy resource tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosCustomPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosCustomPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosCustomPolicy] = 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, "TagsObject") + + request = build_ddos_custom_policies_update_tags_request( + resource_group_name=resource_group_name, + ddos_custom_policy_name=ddos_custom_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosCustomPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + } + + +class DdosProtectionPlansOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`ddos_protection_plans` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ddos_protection_plan_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ddos_protection_plans_delete_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ddos_protection_plan_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, ddos_protection_plan_name: str, **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Gets information about the specified DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlan] = kwargs.pop("cls", None) + + request = build_ddos_protection_plans_get_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.DdosProtectionPlan, IO], + **kwargs: Any + ) -> _models.DdosProtectionPlan: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, "DdosProtectionPlan") + + request = build_ddos_protection_plans_create_or_update_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + 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.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: _models.DdosProtectionPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :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 DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. 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 DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.DdosProtectionPlan, IO], + **kwargs: Any + ) -> LROPoller[_models.DdosProtectionPlan]: + """Creates or updates a DDoS protection plan. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the create or update operation. Is either a + DdosProtectionPlan type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan 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 DdosProtectionPlan or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, + ddos_protection_plan_name=ddos_protection_plan_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + ddos_protection_plan_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.DdosProtectionPlan: + """Update a DDoS protection plan tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ddos_protection_plan_name: The name of the DDoS protection plan. Required. + :type ddos_protection_plan_name: str + :param parameters: Parameters supplied to the update DDoS protection plan resource tags. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DdosProtectionPlan] = 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, "TagsObject") + + request = build_ddos_protection_plans_update_tags_request( + resource_group_name=resource_group_name, + ddos_protection_plan_name=ddos_protection_plan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DdosProtectionPlan", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.DdosProtectionPlan"]: + """Gets all DDoS protection plans in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlanListResult] = 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_ddos_protection_plans_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlanListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DdosProtectionPlan"]: + """Gets all the DDoS protection plans in a resource group. + + :param resource_group_name: The name of the resource group. 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 DdosProtectionPlan or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.DdosProtectionPlan] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DdosProtectionPlanListResult] = 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_ddos_protection_plans_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DdosProtectionPlanListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans" + } + + +class DscpConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`dscp_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: Union[_models.DscpConfiguration, IO], + **kwargs: Any + ) -> _models.DscpConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscpConfiguration] = 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, "DscpConfiguration") + + request = build_dscp_configuration_create_or_update_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + 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.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: _models.DscpConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration + :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 DscpConfiguration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. + 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 DscpConfiguration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + dscp_configuration_name: str, + parameters: Union[_models.DscpConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.DscpConfiguration]: + """Creates or updates a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :param parameters: Parameters supplied to the create or update dscp configuration operation. Is + either a DscpConfiguration type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration 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 DscpConfiguration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DscpConfiguration] = 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, + dscp_configuration_name=dscp_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, dscp_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_dscp_configuration_delete_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, dscp_configuration_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace + def get(self, resource_group_name: str, dscp_configuration_name: str, **kwargs: Any) -> _models.DscpConfiguration: + """Gets a DSCP Configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param dscp_configuration_name: The name of the resource. Required. + :type dscp_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DscpConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.DscpConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfiguration] = kwargs.pop("cls", None) + + request = build_dscp_configuration_get_request( + resource_group_name=resource_group_name, + dscp_configuration_name=dscp_configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DscpConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DscpConfiguration"]: + """Gets a DSCP Configuration. + + :param resource_group_name: The name of the resource group. 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 DscpConfiguration or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfigurationListResult] = 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_dscp_configuration_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DscpConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.DscpConfiguration"]: + """Gets all dscp configurations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DscpConfiguration or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.DscpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.DscpConfigurationListResult] = 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_dscp_configuration_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DscpConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations"} + + +class AvailableEndpointServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`available_endpoint_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.EndpointServiceResult"]: + """List what values of endpoint services are available for use. + + :param location: The location to check available endpoint services. 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 EndpointServiceResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.EndpointServiceResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.EndpointServicesListResult] = 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_available_endpoint_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointServicesListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices" + } + + +class ExpressRouteCircuitAuthorizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_circuit_authorizations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, authorization_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_authorizations_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, circuit_name: str, authorization_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified authorization from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, circuit_name: str, authorization_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitAuthorization: + """Gets the specified authorization from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitAuthorization or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) + + request = build_express_route_circuit_authorizations_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRouteCircuitAuthorization, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitAuthorization: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(authorization_parameters, (IOBase, bytes)): + _content = authorization_parameters + else: + _json = self._serialize.body(authorization_parameters, "ExpressRouteCircuitAuthorization") + + request = build_express_route_circuit_authorizations_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: _models.ExpressRouteCircuitAuthorization, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization + :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 ExpressRouteCircuitAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Required. + :type authorization_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 ExpressRouteCircuitAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRouteCircuitAuthorization, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitAuthorization]: + """Creates or updates an authorization in the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route + circuit authorization operation. Is either a ExpressRouteCircuitAuthorization type or a IO + type. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization 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 ExpressRouteCircuitAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitAuthorization] = 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, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitAuthorization", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteCircuitAuthorization"]: + """Gets all authorizations in an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitAuthorization or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitAuthorization] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AuthorizationListResult] = 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_express_route_circuit_authorizations_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AuthorizationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations" + } + + +class ExpressRouteCircuitPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_circuit_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_peerings_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitPeering: + """Gets the specified peering for the express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) + + request = build_express_route_circuit_peerings_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCircuitPeering, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(peering_parameters, (IOBase, bytes)): + _content = peering_parameters + else: + _json = self._serialize.body(peering_parameters, "ExpressRouteCircuitPeering") + + request = build_express_route_circuit_peerings_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: _models.ExpressRouteCircuitPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Required. + :type peering_parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering + :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 ExpressRouteCircuitPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Required. + :type peering_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 ExpressRouteCircuitPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCircuitPeering, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitPeering]: + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update express route circuit + peering operation. Is either a ExpressRouteCircuitPeering type or a IO type. Required. + :type peering_parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering 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 ExpressRouteCircuitPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitPeering] = 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, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteCircuitPeering"]: + """Gets all peerings in a specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitPeering or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitPeeringListResult] = 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_express_route_circuit_peerings_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitPeeringListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings" + } + + +class ExpressRouteCircuitConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_circuit_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuit_connections_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified Express Route Circuit Connection from the specified express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitConnection: + """Gets the specified Express Route Circuit Connection from the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + request = build_express_route_circuit_connections_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: Union[_models.ExpressRouteCircuitConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuitConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(express_route_circuit_connection_parameters, (IOBase, bytes)): + _content = express_route_circuit_connection_parameters + else: + _json = self._serialize.body(express_route_circuit_connection_parameters, "ExpressRouteCircuitConnection") + + request = build_express_route_circuit_connections_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: _models.ExpressRouteCircuitConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Required. + :type express_route_circuit_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection + :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 ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Required. + :type express_route_circuit_connection_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 ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + peering_name: str, + connection_name: str, + express_route_circuit_connection_parameters: Union[_models.ExpressRouteCircuitConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitConnection]: + """Creates or updates a Express Route Circuit Connection in the specified express route circuits. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the express route circuit connection. Required. + :type connection_name: str + :param express_route_circuit_connection_parameters: Parameters supplied to the create or update + express route circuit connection operation. Is either a ExpressRouteCircuitConnection type or a + IO type. Required. + :type express_route_circuit_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection 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 ExpressRouteCircuitConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuitConnection] = 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, + circuit_name=circuit_name, + peering_name=peering_name, + connection_name=connection_name, + express_route_circuit_connection_parameters=express_route_circuit_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteCircuitConnection"]: + """Gets all global reach connections associated with a private peering in an express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuitConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitConnectionListResult] = 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_express_route_circuit_connections_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections" + } + + +class PeerExpressRouteCircuitConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`peer_express_route_circuit_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, circuit_name: str, peering_name: str, connection_name: str, **kwargs: Any + ) -> _models.PeerExpressRouteCircuitConnection: + """Gets the specified Peer Express Route Circuit Connection from the specified express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param connection_name: The name of the peer express route circuit connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PeerExpressRouteCircuitConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PeerExpressRouteCircuitConnection] = kwargs.pop("cls", None) + + request = build_peer_express_route_circuit_connections_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PeerExpressRouteCircuitConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> Iterable["_models.PeerExpressRouteCircuitConnection"]: + """Gets all global reach peer connections associated with a private peering in an express route + circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PeerExpressRouteCircuitConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PeerExpressRouteCircuitConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PeerExpressRouteCircuitConnectionListResult] = 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_peer_express_route_circuit_connections_list_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PeerExpressRouteCircuitConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections" + } + + +class ExpressRouteCircuitsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_circuits` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, circuit_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_circuits_delete_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + circuit_name=circuit_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @distributed_trace + def get(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> _models.ExpressRouteCircuit: + """Gets information about the specified express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuit] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + circuit_name: str, + parameters: Union[_models.ExpressRouteCircuit, IO], + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, "ExpressRouteCircuit") + + request = build_express_route_circuits_create_or_update_request( + resource_group_name=resource_group_name, + circuit_name=circuit_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + 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.Network/expressRouteCircuits/{circuitName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: _models.ExpressRouteCircuit, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :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 ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + 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 ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + circuit_name: str, + parameters: Union[_models.ExpressRouteCircuit, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuit]: + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express route circuit operation. + Is either a ExpressRouteCircuit type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit 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 ExpressRouteCircuit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, + circuit_name=circuit_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + circuit_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + circuit_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, circuit_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ExpressRouteCircuit: + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the circuit. Required. + :type circuit_name: str + :param parameters: Parameters supplied to update express route circuit tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuit or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCircuit] = 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, "TagsObject") + + request = build_express_route_circuits_update_tags_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + } + + def _list_arp_table_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsArpTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_arp_table_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_arp_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + @distributed_trace + def begin_list_arp_table( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitsArpTableListResult]: + """Gets the currently advertised ARP table associated with the express route circuit in a resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ExpressRouteCircuitsArpTableListResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsArpTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = 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._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + def _list_routes_table_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_routes_table_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + @distributed_trace + def begin_list_routes_table( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitsRoutesTableListResult]: + """Gets the currently advertised routes table associated with the express route circuit in a + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ExpressRouteCircuitsRoutesTableListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = 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._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + def _list_routes_table_summary_initial( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]] = kwargs.pop("cls", None) + + request = build_express_route_circuits_list_routes_table_summary_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_summary_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableSummaryListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_summary_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace + def begin_list_routes_table_summary( + self, resource_group_name: str, circuit_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitsRoutesTableSummaryListResult]: + """Gets the currently advertised routes table summary associated with the express route circuit in + a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCircuitsRoutesTableSummaryListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableSummaryListResult] = 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._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableSummaryListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table_summary.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace + def get_stats(self, resource_group_name: str, circuit_name: str, **kwargs: Any) -> _models.ExpressRouteCircuitStats: + """Gets all the stats from an express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitStats or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_stats_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_stats.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitStats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats" + } + + @distributed_trace + def get_peering_stats( + self, resource_group_name: str, circuit_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCircuitStats: + """Gets all stats from an express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. Required. + :type circuit_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCircuitStats or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitStats + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitStats] = kwargs.pop("cls", None) + + request = build_express_route_circuits_get_peering_stats_request( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_peering_stats.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCircuitStats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_peering_stats.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ExpressRouteCircuit"]: + """Gets all the express route circuits in a resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRouteCircuit or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitListResult] = 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_express_route_circuits_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.ExpressRouteCircuit"]: + """Gets all the express route circuits in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCircuit or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuit] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitListResult] = 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_express_route_circuits_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCircuitListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits"} + + +class ExpressRouteServiceProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_service_providers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ExpressRouteServiceProvider"]: + """Gets all the available express route service providers. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteServiceProvider or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteServiceProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteServiceProviderListResult] = 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_express_route_service_providers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteServiceProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders"} + + +class ExpressRouteCrossConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_cross_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ExpressRouteCrossConnection"]: + """Retrieves all the ExpressRouteCrossConnections in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCrossConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = 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_express_route_cross_connections_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteCrossConnection"]: + """Retrieves all the ExpressRouteCrossConnections in a resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRouteCrossConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionListResult] = 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_express_route_cross_connections_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections" + } + + @distributed_trace + def get( + self, resource_group_name: str, cross_connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Gets details about the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group (peering location of the circuit). + Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection (service key of the + circuit). Required. + :type cross_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_get_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: Union[_models.ExpressRouteCrossConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = 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, "ExpressRouteCrossConnection") + + request = build_express_route_cross_connections_create_or_update_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: _models.ExpressRouteCrossConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :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 ExpressRouteCrossConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + 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 ExpressRouteCrossConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + parameters: Union[_models.ExpressRouteCrossConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnection]: + """Update the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param parameters: Parameters supplied to the update express route crossConnection operation. + Is either a ExpressRouteCrossConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection 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 ExpressRouteCrossConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = 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, + cross_connection_name=cross_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Required. + :type cross_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Required. + :type cross_connection_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + cross_connection_name: str, + cross_connection_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnection: + """Updates an express route cross connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the cross connection. Required. + :type cross_connection_name: str + :param cross_connection_parameters: Parameters supplied to update express route cross + connection tags. Is either a TagsObject type or a IO type. Required. + :type cross_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cross_connection_parameters, (IOBase, bytes)): + _content = cross_connection_parameters + else: + _json = self._serialize.body(cross_connection_parameters, "TagsObject") + + request = build_express_route_cross_connections_update_tags_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + } + + def _list_arp_table_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsArpTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsArpTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_list_arp_table_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_arp_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_arp_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + @distributed_trace + def begin_list_arp_table( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitsArpTableListResult]: + """Gets the currently advertised ARP table associated with the express route cross connection in a + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ExpressRouteCircuitsArpTableListResult or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsArpTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsArpTableListResult] = 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._list_arp_table_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsArpTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_arp_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}" + } + + def _list_routes_table_summary_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]] = kwargs.pop( + "cls", None + ) + + request = build_express_route_cross_connections_list_routes_table_summary_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_summary_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize( + "ExpressRouteCrossConnectionsRoutesTableSummaryListResult", pipeline_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_summary_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + @distributed_trace + def begin_list_routes_table_summary( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult]: + """Gets the route table summary associated with the express route cross connection in a resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ExpressRouteCrossConnectionsRoutesTableSummaryListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionsRoutesTableSummaryListResult] = 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._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize( + "ExpressRouteCrossConnectionsRoutesTableSummaryListResult", pipeline_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table_summary.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + } + + def _list_routes_table_initial( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> Optional[_models.ExpressRouteCircuitsRoutesTableListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.ExpressRouteCircuitsRoutesTableListResult]] = kwargs.pop("cls", None) + + request = build_express_route_cross_connections_list_routes_table_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_routes_table_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_routes_table_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + @distributed_trace + def begin_list_routes_table( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, device_path: str, **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCircuitsRoutesTableListResult]: + """Gets the currently advertised routes table associated with the express route cross connection + in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param device_path: The path of the device. Required. + :type device_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ExpressRouteCircuitsRoutesTableListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCircuitsRoutesTableListResult] = 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._list_routes_table_initial( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + device_path=device_path, + 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): + deserialized = self._deserialize("ExpressRouteCircuitsRoutesTableListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_routes_table.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}" + } + + +class ExpressRouteCrossConnectionPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_cross_connection_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, cross_connection_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteCrossConnectionPeering"]: + """Gets all peerings in a specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteCrossConnectionPeering or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionPeeringList] = 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_express_route_cross_connection_peerings_list_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionPeeringList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cross_connection_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_cross_connection_peerings_delete_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified peering from the ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, cross_connection_name: str, peering_name: str, **kwargs: Any + ) -> _models.ExpressRouteCrossConnectionPeering: + """Gets the specified peering for the ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteCrossConnectionPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) + + request = build_express_route_cross_connection_peerings_get_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCrossConnectionPeering, IO], + **kwargs: Any + ) -> _models.ExpressRouteCrossConnectionPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(peering_parameters, (IOBase, bytes)): + _content = peering_parameters + else: + _json = self._serialize.body(peering_parameters, "ExpressRouteCrossConnectionPeering") + + request = build_express_route_cross_connection_peerings_create_or_update_request( + resource_group_name=resource_group_name, + cross_connection_name=cross_connection_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + + 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.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: _models.ExpressRouteCrossConnectionPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Required. + :type peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering + :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 ExpressRouteCrossConnectionPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Required. + :type peering_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 ExpressRouteCrossConnectionPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cross_connection_name: str, + peering_name: str, + peering_parameters: Union[_models.ExpressRouteCrossConnectionPeering, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteCrossConnectionPeering]: + """Creates or updates a peering in the specified ExpressRouteCrossConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cross_connection_name: The name of the ExpressRouteCrossConnection. Required. + :type cross_connection_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + ExpressRouteCrossConnection peering operation. Is either a ExpressRouteCrossConnectionPeering + type or a IO type. Required. + :type peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering 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 ExpressRouteCrossConnectionPeering or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteCrossConnectionPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteCrossConnectionPeering] = 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, + cross_connection_name=cross_connection_name, + peering_name=peering_name, + peering_parameters=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteCrossConnectionPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + } + + +class ExpressRoutePortsLocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_ports_locations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ExpressRoutePortsLocation"]: + """Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each + location. Available bandwidths can only be obtained when retrieving a specific peering + location. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePortsLocation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortsLocationListResult] = 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_express_route_ports_locations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortsLocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations"} + + @distributed_trace + def get(self, location_name: str, **kwargs: Any) -> _models.ExpressRoutePortsLocation: + """Retrieves a single ExpressRoutePort peering location, including the list of available + bandwidths available at said peering location. + + :param location_name: Name of the requested ExpressRoutePort peering location. Required. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePortsLocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortsLocation + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortsLocation] = kwargs.pop("cls", None) + + request = build_express_route_ports_locations_get_request( + location_name=location_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePortsLocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}" + } + + +class ExpressRoutePortsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_ports` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_port_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_ports_delete_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, express_route_port_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace + def get(self, resource_group_name: str, express_route_port_name: str, **kwargs: Any) -> _models.ExpressRoutePort: + """Retrieves the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePort] = kwargs.pop("cls", None) + + request = build_express_route_ports_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.ExpressRoutePort, IO], + **kwargs: Any + ) -> _models.ExpressRoutePort: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, "ExpressRoutePort") + + request = build_express_route_ports_create_or_update_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + 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.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: _models.ExpressRoutePort, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :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 ExpressRoutePort or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. 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 ExpressRoutePort or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.ExpressRoutePort, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePort]: + """Creates or updates the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to the create ExpressRoutePort operation. Is either a + ExpressRoutePort type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort 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 ExpressRoutePort or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, + express_route_port_name=express_route_port_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + express_route_port_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ExpressRoutePort: + """Update ExpressRoutePort tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param parameters: Parameters supplied to update ExpressRoutePort resource tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePort or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePort] = 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, "TagsObject") + + request = build_express_route_ports_update_tags_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePort", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ExpressRoutePort"]: + """List all the ExpressRoutePort resources in the specified resource group. + + :param resource_group_name: The name of the resource group. 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 ExpressRoutePort or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortListResult] = 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_express_route_ports_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ExpressRoutePort"]: + """List all the ExpressRoutePort resources in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePort or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePort] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortListResult] = 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_express_route_ports_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts"} + + @overload + def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: _models.GenerateExpressRoutePortsLOARequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOARequest + :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: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def generate_loa( + self, + resource_group_name: str, + express_route_port_name: str, + request: Union[_models.GenerateExpressRoutePortsLOARequest, IO], + **kwargs: Any + ) -> _models.GenerateExpressRoutePortsLOAResult: + """Generate a letter of authorization for the requested ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of ExpressRoutePort. Required. + :type express_route_port_name: str + :param request: Request parameters supplied to generate a letter of authorization. Is either a + GenerateExpressRoutePortsLOARequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOARequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateExpressRoutePortsLOAResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.GenerateExpressRoutePortsLOAResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateExpressRoutePortsLOAResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "GenerateExpressRoutePortsLOARequest") + + request = build_express_route_ports_generate_loa_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.generate_loa.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GenerateExpressRoutePortsLOAResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_loa.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/generateLoa" + } + + +class ExpressRouteLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, express_route_port_name: str, link_name: str, **kwargs: Any + ) -> _models.ExpressRouteLink: + """Retrieves the specified ExpressRouteLink resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :param link_name: The name of the ExpressRouteLink resource. Required. + :type link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteLink or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteLink] = kwargs.pop("cls", None) + + request = build_express_route_links_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + link_name=link_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteLink", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRouteLink"]: + """Retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the ExpressRoutePort resource. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRouteLink or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRouteLink] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteLinkListResult] = 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_express_route_links_list_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRouteLinkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links" + } + + +class ExpressRoutePortAuthorizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_port_authorizations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_port_name: str, authorization_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_port_authorizations_delete_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, express_route_port_name: str, authorization_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified authorization from the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, express_route_port_name: str, authorization_name: str, **kwargs: Any + ) -> _models.ExpressRoutePortAuthorization: + """Gets the specified authorization from the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRoutePortAuthorization or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) + + request = build_express_route_port_authorizations_get_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRoutePortAuthorization, IO], + **kwargs: Any + ) -> _models.ExpressRoutePortAuthorization: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePortAuthorization] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(authorization_parameters, (IOBase, bytes)): + _content = authorization_parameters + else: + _json = self._serialize.body(authorization_parameters, "ExpressRoutePortAuthorization") + + request = build_express_route_port_authorizations_create_or_update_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_name, + authorization_name=authorization_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + + 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.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: _models.ExpressRoutePortAuthorization, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization + :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 ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Required. + :type authorization_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 ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + express_route_port_name: str, + authorization_name: str, + authorization_parameters: Union[_models.ExpressRoutePortAuthorization, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRoutePortAuthorization]: + """Creates or updates an authorization in the specified express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :param authorization_name: The name of the authorization. Required. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or update express route port + authorization operation. Is either a ExpressRoutePortAuthorization type or a IO type. Required. + :type authorization_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization 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 ExpressRoutePortAuthorization or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRoutePortAuthorization] = 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, + express_route_port_name=express_route_port_name, + authorization_name=authorization_name, + authorization_parameters=authorization_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortAuthorization", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, express_route_port_name: str, **kwargs: Any + ) -> Iterable["_models.ExpressRoutePortAuthorization"]: + """Gets all authorizations in an express route port. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_port_name: The name of the express route port. Required. + :type express_route_port_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpressRoutePortAuthorization or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ExpressRoutePortAuthorization] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRoutePortAuthorizationListResult] = 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_express_route_port_authorizations_list_request( + resource_group_name=resource_group_name, + express_route_port_name=express_route_port_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExpressRoutePortAuthorizationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations" + } + + +class ExpressRouteProviderPortsLocationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_provider_ports_location` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, *, filter: Optional[str] = None, **kwargs: Any) -> _models.ExpressRouteProviderPortListResult: + """Retrieves all the ExpressRouteProviderPorts in a subscription. + + :keyword filter: The filter to apply on the operation. For example, you can use + $filter=location eq '{state}'. Default value is None. + :paramtype filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteProviderPortListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteProviderPortListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteProviderPortListResult] = kwargs.pop("cls", None) + + request = build_express_route_provider_ports_location_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteProviderPortListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts"} + + +class FirewallPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`firewall_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, firewall_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_firewall_policies_delete_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, firewall_policy_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.FirewallPolicy: + """Gets the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicy] = kwargs.pop("cls", None) + + request = build_firewall_policies_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.FirewallPolicy, IO], + **kwargs: Any + ) -> _models.FirewallPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, "FirewallPolicy") + + request = build_firewall_policies_create_or_update_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + 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.Network/firewallPolicies/{firewallPolicyName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.FirewallPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :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 FirewallPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. + 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 FirewallPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.FirewallPolicy, IO], + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicy]: + """Creates or updates the specified Firewall Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to the create or update Firewall Policy operation. Is + either a FirewallPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy 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 FirewallPolicy or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, + firewall_policy_name=firewall_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.FirewallPolicy: + """Updates tags of a Azure Firewall Policy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Parameters supplied to update Azure Firewall Policy tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicy] = 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, "TagsObject") + + request = build_firewall_policies_update_tags_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.FirewallPolicy"]: + """Lists all Firewall Policies in a resource group. + + :param resource_group_name: The name of the resource group. 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 FirewallPolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyListResult] = 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_firewall_policies_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.FirewallPolicy"]: + """Gets all the Firewall Policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallPolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyListResult] = 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_firewall_policies_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies"} + + +class FirewallPolicyRuleCollectionGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`firewall_policy_rule_collection_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_firewall_policy_rule_collection_groups_delete_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, firewall_policy_name: str, rule_collection_group_name: str, **kwargs: Any + ) -> _models.FirewallPolicyRuleCollectionGroup: + """Gets the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirewallPolicyRuleCollectionGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = kwargs.pop("cls", None) + + request = build_firewall_policy_rule_collection_groups_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: Union[_models.FirewallPolicyRuleCollectionGroup, IO], + **kwargs: Any + ) -> _models.FirewallPolicyRuleCollectionGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = 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, "FirewallPolicyRuleCollectionGroup") + + request = build_firewall_policy_rule_collection_groups_create_or_update_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + + 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.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: _models.FirewallPolicyRuleCollectionGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup + :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 FirewallPolicyRuleCollectionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. 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 FirewallPolicyRuleCollectionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + firewall_policy_name: str, + rule_collection_group_name: str, + parameters: Union[_models.FirewallPolicyRuleCollectionGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.FirewallPolicyRuleCollectionGroup]: + """Creates or updates the specified FirewallPolicyRuleCollectionGroup. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param rule_collection_group_name: The name of the FirewallPolicyRuleCollectionGroup. Required. + :type rule_collection_group_name: str + :param parameters: Parameters supplied to the create or update + FirewallPolicyRuleCollectionGroup operation. Is either a FirewallPolicyRuleCollectionGroup type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup 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 FirewallPolicyRuleCollectionGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroup] = 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, + firewall_policy_name=firewall_policy_name, + rule_collection_group_name=rule_collection_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> Iterable["_models.FirewallPolicyRuleCollectionGroup"]: + """Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirewallPolicyRuleCollectionGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.FirewallPolicyRuleCollectionGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FirewallPolicyRuleCollectionGroupListResult] = 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_firewall_policy_rule_collection_groups_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FirewallPolicyRuleCollectionGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups" + } + + +class FirewallPolicyIdpsSignaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.IDPSQueryObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IDPSQueryObject + :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: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.IDPSQueryObject, IO], + **kwargs: Any + ) -> _models.QueryResults: + """Retrieves the current status of IDPS signatures for the relevant policy. Maximal amount of + returned signatures is 1000. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Is either a IDPSQueryObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IDPSQueryObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueryResults or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.QueryResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResults] = 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, "IDPSQueryObject") + + request = build_firewall_policy_idps_signatures_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("QueryResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsSignatures" + } + + +class FirewallPolicyIdpsSignaturesOverridesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures_overrides` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignaturesOverrides, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignaturesOverrides, IO], + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will update the status of policy's signature overrides for IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Is either a + SignaturesOverrides type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignaturesOverrides] = 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, "SignaturesOverrides") + + request = build_firewall_policy_idps_signatures_overrides_patch_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @overload + def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignaturesOverrides, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignaturesOverrides, IO], + **kwargs: Any + ) -> _models.SignaturesOverrides: + """Will override/create a new signature overrides for the policy's IDPS. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Will contain all properties of the object to put. Is either a + SignaturesOverrides type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignaturesOverrides] = 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, "SignaturesOverrides") + + request = build_firewall_policy_idps_signatures_overrides_put_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @distributed_trace + def get(self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any) -> _models.SignaturesOverrides: + """Returns all signatures overrides for a specific policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverrides or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverrides + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SignaturesOverrides] = kwargs.pop("cls", None) + + request = build_firewall_policy_idps_signatures_overrides_get_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverrides", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + } + + @distributed_trace + def list( + self, resource_group_name: str, firewall_policy_name: str, **kwargs: Any + ) -> _models.SignaturesOverridesList: + """Returns all signatures overrides objects for a specific policy as a list containing a single + value. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignaturesOverridesList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignaturesOverridesList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SignaturesOverridesList] = kwargs.pop("cls", None) + + request = build_firewall_policy_idps_signatures_overrides_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignaturesOverridesList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides" + } + + +class FirewallPolicyIdpsSignaturesFilterValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`firewall_policy_idps_signatures_filter_values` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: _models.SignatureOverridesFilterValuesQuery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesQuery + :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: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + firewall_policy_name: str, + parameters: Union[_models.SignatureOverridesFilterValuesQuery, IO], + **kwargs: Any + ) -> _models.SignatureOverridesFilterValuesResponse: + """Retrieves the current filter values for the signatures overrides. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param firewall_policy_name: The name of the Firewall Policy. Required. + :type firewall_policy_name: str + :param parameters: Is either a SignatureOverridesFilterValuesQuery type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesQuery or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SignatureOverridesFilterValuesResponse or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SignatureOverridesFilterValuesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SignatureOverridesFilterValuesResponse] = 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, "SignatureOverridesFilterValuesQuery") + + request = build_firewall_policy_idps_signatures_filter_values_list_request( + resource_group_name=resource_group_name, + firewall_policy_name=firewall_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SignatureOverridesFilterValuesResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions" + } + + +class IpAllocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`ip_allocations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_allocation_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ip_allocations_delete_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ip_allocation_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified IpAllocation. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, ip_allocation_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.IpAllocation: + """Gets the specified IpAllocation by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocation] = kwargs.pop("cls", None) + + request = build_ip_allocations_get_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.IpAllocation, IO], + **kwargs: Any + ) -> _models.IpAllocation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, "IpAllocation") + + request = build_ip_allocations_create_or_update_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("IpAllocation", pipeline_response) + + 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.Network/IpAllocations/{ipAllocationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: _models.IpAllocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :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 IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + 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 IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.IpAllocation, IO], + **kwargs: Any + ) -> LROPoller[_models.IpAllocation]: + """Creates or updates an IpAllocation in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. Is + either a IpAllocation type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpAllocation 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 IpAllocation or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, + ip_allocation_name=ip_allocation_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpAllocation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + ip_allocation_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.IpAllocation: + """Updates a IpAllocation tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_allocation_name: The name of the IpAllocation. Required. + :type ip_allocation_name: str + :param parameters: Parameters supplied to update IpAllocation tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAllocation or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpAllocation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpAllocation] = 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, "TagsObject") + + request = build_ip_allocations_update_tags_request( + resource_group_name=resource_group_name, + ip_allocation_name=ip_allocation_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpAllocation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.IpAllocation"]: + """Gets all IpAllocations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpAllocation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocationListResult] = 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_ip_allocations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpAllocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IpAllocation"]: + """Gets all IpAllocations in a resource group. + + :param resource_group_name: The name of the resource group. 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 IpAllocation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.IpAllocation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpAllocationListResult] = 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_ip_allocations_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpAllocationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations" + } + + +class IpGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`ip_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, ip_groups_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.IpGroup: + """Gets the specified ipGroups. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :keyword expand: Expands resourceIds (of Firewalls/Network Security Groups etc.) back + referenced by the IpGroups resource. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroup] = kwargs.pop("cls", None) + + request = build_ip_groups_get_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.IpGroup, IO], **kwargs: Any + ) -> _models.IpGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, "IpGroup") + + request = build_ip_groups_create_or_update_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("IpGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("IpGroup", pipeline_response) + + 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.Network/ipGroups/{ipGroupsName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: _models.IpGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :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 IpGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. 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 IpGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.IpGroup, IO], **kwargs: Any + ) -> LROPoller[_models.IpGroup]: + """Creates or updates an ipGroups in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the create or update IpGroups operation. Is either a + IpGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.IpGroup 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 IpGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, + ip_groups_name=ip_groups_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("IpGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + @overload + def update_groups( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_groups( + self, + resource_group_name: str, + ip_groups_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_groups( + self, resource_group_name: str, ip_groups_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.IpGroup: + """Updates tags of an IpGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :param parameters: Parameters supplied to the update ipGroups operation. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IpGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IpGroup] = 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, "TagsObject") + + request = build_ip_groups_update_groups_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_groups.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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IpGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_groups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ip_groups_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ip_groups_delete_request( + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/ipGroups/{ipGroupsName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, ip_groups_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified ipGroups. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ip_groups_name: The name of the ipGroups. Required. + :type ip_groups_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + ip_groups_name=ip_groups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.IpGroup"]: + """Gets all IpGroups in a resource group. + + :param resource_group_name: The name of the resource group. 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 IpGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroupListResult] = 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_ip_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpGroupListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.IpGroup"]: + """Gets all IpGroups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.IpGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IpGroupListResult] = 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_ip_groups_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("IpGroupListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups"} + + +class LoadBalancersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_load_balancers_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, load_balancer_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, load_balancer_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.LoadBalancer: + """Gets the specified load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancer] = kwargs.pop("cls", None) + + request = build_load_balancers_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.LoadBalancer, IO], + **kwargs: Any + ) -> _models.LoadBalancer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, "LoadBalancer") + + request = build_load_balancers_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: _models.LoadBalancer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :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 LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. + 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 LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.LoadBalancer, IO], + **kwargs: Any + ) -> LROPoller[_models.LoadBalancer]: + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load balancer operation. Is + either a LoadBalancer type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer 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 LoadBalancer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, + load_balancer_name=load_balancer_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LoadBalancer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + load_balancer_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.LoadBalancer: + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to update load balancer tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancer or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LoadBalancer] = 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, "TagsObject") + + request = build_load_balancers_update_tags_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.LoadBalancer"]: + """Gets all the load balancers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerListResult] = 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_load_balancers_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.LoadBalancer"]: + """Gets all the load balancers in a resource group. + + :param resource_group_name: The name of the resource group. 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 LoadBalancer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerListResult] = 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_load_balancers_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers" + } + + def _swap_public_ip_addresses_initial( # pylint: disable=inconsistent-return-statements + self, location: str, parameters: Union[_models.LoadBalancerVipSwapRequest, IO], **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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, "LoadBalancerVipSwapRequest") + + request = build_load_balancers_swap_public_ip_addresses_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._swap_public_ip_addresses_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _swap_public_ip_addresses_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses" + } + + @overload + def begin_swap_public_ip_addresses( + self, + location: str, + parameters: _models.LoadBalancerVipSwapRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequest + :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: + """ + + @overload + def begin_swap_public_ip_addresses( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_swap_public_ip_addresses( + self, location: str, parameters: Union[_models.LoadBalancerVipSwapRequest, IO], **kwargs: Any + ) -> LROPoller[None]: + """Swaps VIPs between two load balancers. + + :param location: The region where load balancers are located at. Required. + :type location: str + :param parameters: Parameters that define which VIPs should be swapped. Is either a + LoadBalancerVipSwapRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LoadBalancerVipSwapRequest 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 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._api_version or "2023-09-01")) + 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._swap_public_ip_addresses_initial( # type: ignore + location=location, + 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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_swap_public_ip_addresses.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses" + } + + def _list_inbound_nat_rule_port_mappings_initial( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: Union[_models.QueryInboundNatRulePortMappingRequest, IO], + **kwargs: Any + ) -> _models.BackendAddressInboundNatRulePortMappings: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = 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, "QueryInboundNatRulePortMappingRequest") + + request = build_load_balancers_list_inbound_nat_rule_port_mappings_request( + group_name=group_name, + load_balancer_name=load_balancer_name, + backend_pool_name=backend_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._list_inbound_nat_rule_port_mappings_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _list_inbound_nat_rule_port_mappings_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + } + + @overload + def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: _models.QueryInboundNatRulePortMappingRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryInboundNatRulePortMappingRequest + :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 BackendAddressInboundNatRulePortMappings + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. 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 BackendAddressInboundNatRulePortMappings + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_list_inbound_nat_rule_port_mappings( + self, + group_name: str, + load_balancer_name: str, + backend_pool_name: str, + parameters: Union[_models.QueryInboundNatRulePortMappingRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BackendAddressInboundNatRulePortMappings]: + """List of inbound NAT rule port mappings. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_pool_name: The name of the load balancer backend address pool. Required. + :type backend_pool_name: str + :param parameters: Query inbound NAT rule port mapping request. Is either a + QueryInboundNatRulePortMappingRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryInboundNatRulePortMappingRequest + 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 BackendAddressInboundNatRulePortMappings + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressInboundNatRulePortMappings] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressInboundNatRulePortMappings] = 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._list_inbound_nat_rule_port_mappings_initial( + group_name=group_name, + load_balancer_name=load_balancer_name, + backend_pool_name=backend_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BackendAddressInboundNatRulePortMappings", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_inbound_nat_rule_port_mappings.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + } + + @overload + def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[_models.MigrateLoadBalancerToIpBasedRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.MigrateLoadBalancerToIpBasedRequest + :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: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def migrate_to_ip_based( + self, + group_name: str, + load_balancer_name: str, + parameters: Optional[Union[_models.MigrateLoadBalancerToIpBasedRequest, IO]] = None, + **kwargs: Any + ) -> _models.MigratedPools: + """Migrate load balancer to IP Based. + + :param group_name: The name of the resource group. Required. + :type group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param parameters: Parameters supplied to the migrateToIpBased Api. Is either a + MigrateLoadBalancerToIpBasedRequest type or a IO type. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.MigrateLoadBalancerToIpBasedRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigratedPools or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.MigratedPools + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigratedPools] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "MigrateLoadBalancerToIpBasedRequest") + else: + _json = None + + request = build_load_balancers_migrate_to_ip_based_request( + group_name=group_name, + load_balancer_name=load_balancer_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.migrate_to_ip_based.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MigratedPools", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + migrate_to_ip_based.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/migrateToIpBased" + } + + +class LoadBalancerBackendAddressPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_backend_address_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.BackendAddressPool"]: + """Gets all the load balancer backed address pools. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BackendAddressPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerBackendAddressPoolListResult] = 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_load_balancer_backend_address_pools_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerBackendAddressPoolListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools" + } + + @distributed_trace + def get( + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_name: str, **kwargs: Any + ) -> _models.BackendAddressPool: + """Gets load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackendAddressPool or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BackendAddressPool] = kwargs.pop("cls", None) + + request = build_load_balancer_backend_address_pools_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: Union[_models.BackendAddressPool, IO], + **kwargs: Any + ) -> _models.BackendAddressPool: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressPool] = 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, "BackendAddressPool") + + request = build_load_balancer_backend_address_pools_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: _models.BackendAddressPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool + :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 BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. 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 BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + backend_address_pool_name: str, + parameters: Union[_models.BackendAddressPool, IO], + **kwargs: Any + ) -> LROPoller[_models.BackendAddressPool]: + """Creates or updates a load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :param parameters: Parameters supplied to the create or update load balancer backend address + pool operation. Is either a BackendAddressPool type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BackendAddressPool 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 BackendAddressPool or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BackendAddressPool] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackendAddressPool] = 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, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BackendAddressPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_load_balancer_backend_address_pools_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, load_balancer_name: str, backend_address_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified load balancer backend address pool. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param backend_address_pool_name: The name of the backend address pool. Required. + :type backend_address_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + backend_address_pool_name=backend_address_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + } + + +class LoadBalancerFrontendIPConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_frontend_ip_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.FrontendIPConfiguration"]: + """Gets all the load balancer frontend IP configurations. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FrontendIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerFrontendIPConfigurationListResult] = 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_load_balancer_frontend_ip_configurations_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerFrontendIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations" + } + + @distributed_trace + def get( + self, resource_group_name: str, load_balancer_name: str, frontend_ip_configuration_name: str, **kwargs: Any + ) -> _models.FrontendIPConfiguration: + """Gets load balancer frontend IP configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param frontend_ip_configuration_name: The name of the frontend IP configuration. Required. + :type frontend_ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FrontendIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FrontendIPConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FrontendIPConfiguration] = kwargs.pop("cls", None) + + request = build_load_balancer_frontend_ip_configurations_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + frontend_ip_configuration_name=frontend_ip_configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FrontendIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}" + } + + +class InboundNatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`inbound_nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.InboundNatRule"]: + """Gets all the inbound NAT rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either InboundNatRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.InboundNatRuleListResult] = 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_inbound_nat_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InboundNatRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, load_balancer_name: str, inbound_nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_inbound_nat_rules_delete_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, load_balancer_name: str, inbound_nat_rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.InboundNatRule: + """Gets the specified load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: InboundNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) + + request = build_inbound_nat_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: Union[_models.InboundNatRule, IO], + **kwargs: Any + ) -> _models.InboundNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(inbound_nat_rule_parameters, (IOBase, bytes)): + _content = inbound_nat_rule_parameters + else: + _json = self._serialize.body(inbound_nat_rule_parameters, "InboundNatRule") + + request = build_inbound_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InboundNatRule", pipeline_response) + + 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.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: _models.InboundNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Required. + :type inbound_nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule + :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 InboundNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Required. + :type inbound_nat_rule_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 InboundNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + load_balancer_name: str, + inbound_nat_rule_name: str, + inbound_nat_rule_parameters: Union[_models.InboundNatRule, IO], + **kwargs: Any + ) -> LROPoller[_models.InboundNatRule]: + """Creates or updates a load balancer inbound NAT rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound NAT rule. Required. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create or update inbound NAT + rule operation. Is either a InboundNatRule type or a IO type. Required. + :type inbound_nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.InboundNatRule 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 InboundNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundNatRule] = 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, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InboundNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + } + + +class LoadBalancerLoadBalancingRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_load_balancing_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.LoadBalancingRule"]: + """Gets all the load balancing rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancingRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerLoadBalancingRuleListResult] = 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_load_balancer_load_balancing_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerLoadBalancingRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules" + } + + @distributed_trace + def get( + self, resource_group_name: str, load_balancer_name: str, load_balancing_rule_name: str, **kwargs: Any + ) -> _models.LoadBalancingRule: + """Gets the specified load balancer load balancing rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param load_balancing_rule_name: The name of the load balancing rule. Required. + :type load_balancing_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LoadBalancingRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LoadBalancingRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancingRule] = kwargs.pop("cls", None) + + request = build_load_balancer_load_balancing_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + load_balancing_rule_name=load_balancing_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LoadBalancingRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}" + } + + +class LoadBalancerOutboundRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_outbound_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundRule"]: + """Gets all the outbound rules in a load balancer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.OutboundRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerOutboundRuleListResult] = 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_load_balancer_outbound_rules_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerOutboundRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules" + } + + @distributed_trace + def get( + self, resource_group_name: str, load_balancer_name: str, outbound_rule_name: str, **kwargs: Any + ) -> _models.OutboundRule: + """Gets the specified load balancer outbound rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param outbound_rule_name: The name of the outbound rule. Required. + :type outbound_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.OutboundRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.OutboundRule] = kwargs.pop("cls", None) + + request = build_load_balancer_outbound_rules_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + outbound_rule_name=outbound_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OutboundRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}" + } + + +class LoadBalancerNetworkInterfacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_network_interfaces` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, load_balancer_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterface"]: + """Gets associated load balancer network interfaces. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterface or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterface] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceListResult] = 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_load_balancer_network_interfaces_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces" + } + + +class LoadBalancerProbesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`load_balancer_probes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, load_balancer_name: str, **kwargs: Any) -> Iterable["_models.Probe"]: + """Gets all the load balancer probes. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Probe or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.Probe] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LoadBalancerProbeListResult] = 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_load_balancer_probes_list_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LoadBalancerProbeListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes" + } + + @distributed_trace + def get(self, resource_group_name: str, load_balancer_name: str, probe_name: str, **kwargs: Any) -> _models.Probe: + """Gets load balancer probe. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. Required. + :type load_balancer_name: str + :param probe_name: The name of the probe. Required. + :type probe_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Probe or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Probe + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Probe] = kwargs.pop("cls", None) + + request = build_load_balancer_probes_get_request( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + probe_name=probe_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Probe", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}" + } + + +class NatGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`nat_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, nat_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_nat_gateways_delete_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, nat_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, nat_gateway_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NatGateway: + """Gets the specified nat gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGateway] = kwargs.pop("cls", None) + + request = build_nat_gateways_get_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.NatGateway, IO], **kwargs: Any + ) -> Optional[_models.NatGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.NatGateway]] = 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, "NatGateway") + + request = build_nat_gateways_create_or_update_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_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) + + _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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("NatGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: _models.NatGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :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 NatGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. 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 NatGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.NatGateway, IO], **kwargs: Any + ) -> LROPoller[_models.NatGateway]: + """Creates or updates a nat gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to the create or update nat gateway operation. Is either + a NatGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NatGateway 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 NatGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NatGateway] = 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, + nat_gateway_name=nat_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NatGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + nat_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, nat_gateway_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.NatGateway: + """Updates nat gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param nat_gateway_name: The name of the nat gateway. Required. + :type nat_gateway_name: str + :param parameters: Parameters supplied to update nat gateway tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NatGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NatGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NatGateway] = 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, "TagsObject") + + request = build_nat_gateways_update_tags_request( + resource_group_name=resource_group_name, + nat_gateway_name=nat_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NatGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.NatGateway"]: + """Gets all the Nat Gateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NatGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGatewayListResult] = 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_nat_gateways_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NatGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NatGateway"]: + """Gets all nat gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 NatGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NatGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NatGatewayListResult] = 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_nat_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NatGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways" + } + + +class NetworkInterfaceIPConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_interface_ip_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterfaceIPConfiguration"]: + """Get all ip configurations in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceIPConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceIPConfigurationListResult] = 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_network_interface_ip_configurations_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceIPConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_interface_name: str, ip_configuration_name: str, **kwargs: Any + ) -> _models.NetworkInterfaceIPConfiguration: + """Gets the specified network interface ip configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param ip_configuration_name: The name of the ip configuration name. Required. + :type ip_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceIPConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceIPConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceIPConfiguration] = kwargs.pop("cls", None) + + request = build_network_interface_ip_configurations_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + ip_configuration_name=ip_configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceIPConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + } + + +class NetworkInterfaceLoadBalancersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_interface_load_balancers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Iterable["_models.LoadBalancer"]: + """List all load balancers in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LoadBalancer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.LoadBalancer] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceLoadBalancerListResult] = 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_network_interface_load_balancers_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceLoadBalancerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers" + } + + +class NetworkInterfaceTapConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_interface_tap_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_interface_name: str, tap_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_interface_tap_configurations_delete_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_interface_name: str, tap_configuration_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified tap configuration from the NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_interface_name: str, tap_configuration_name: str, **kwargs: Any + ) -> _models.NetworkInterfaceTapConfiguration: + """Get the specified tap configuration on a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkInterfaceTapConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) + + request = build_network_interface_tap_configurations_get_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: Union[_models.NetworkInterfaceTapConfiguration, IO], + **kwargs: Any + ) -> _models.NetworkInterfaceTapConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(tap_configuration_parameters, (IOBase, bytes)): + _content = tap_configuration_parameters + else: + _json = self._serialize.body(tap_configuration_parameters, "NetworkInterfaceTapConfiguration") + + request = build_network_interface_tap_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + + 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.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: _models.NetworkInterfaceTapConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Required. + :type tap_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration + :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 NetworkInterfaceTapConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Required. + :type tap_configuration_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 NetworkInterfaceTapConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_interface_name: str, + tap_configuration_name: str, + tap_configuration_parameters: Union[_models.NetworkInterfaceTapConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkInterfaceTapConfiguration]: + """Creates or updates a Tap configuration in the specified NetworkInterface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :param tap_configuration_name: The name of the tap configuration. Required. + :type tap_configuration_name: str + :param tap_configuration_parameters: Parameters supplied to the create or update tap + configuration operation. Is either a NetworkInterfaceTapConfiguration type or a IO type. + Required. + :type tap_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration 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 NetworkInterfaceTapConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkInterfaceTapConfiguration] = 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, + network_interface_name=network_interface_name, + tap_configuration_name=tap_configuration_name, + tap_configuration_parameters=tap_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceTapConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_interface_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkInterfaceTapConfiguration"]: + """Get all Tap configurations in a network interface. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. Required. + :type network_interface_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkInterfaceTapConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkInterfaceTapConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkInterfaceTapConfigurationListResult] = 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_network_interface_tap_configurations_list_request( + resource_group_name=resource_group_name, + network_interface_name=network_interface_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkInterfaceTapConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations" + } + + +class NetworkManagersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_managers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, network_manager_name: str, **kwargs: Any) -> _models.NetworkManager: + """Gets the specified Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManager] = kwargs.pop("cls", None) + + request = build_network_managers_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManager, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :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: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManager, IO], + **kwargs: Any + ) -> _models.NetworkManager: + """Creates or updates a Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Is either a + NetworkManager type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManager or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManager] = 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, "NetworkManager") + + request = build_network_managers_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManager", pipeline_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.Network/networkManagers/{networkManagerName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_manager_name: str, *, force: Optional[bool] = None, **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_managers_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_manager_name: str, *, force: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @overload + def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.PatchObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PatchObject + :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: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.PatchObject, IO], + **kwargs: Any + ) -> _models.NetworkManager: + """Patch NetworkManager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which network manager is. Is either a + PatchObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PatchObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManager or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManager + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManager] = 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, "PatchObject") + + request = build_network_managers_patch_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.patch.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManager", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + } + + @distributed_trace + def list_by_subscription( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.NetworkManager"]: + """List all network managers in a subscription. + + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManager or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerListResult] = 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_network_managers_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers" + } + + @distributed_trace + def list( + self, resource_group_name: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.NetworkManager"]: + """List network managers in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManager or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManager] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerListResult] = 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_network_managers_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers" + } + + +class NetworkManagerCommitsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_manager_commits` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _post_initial( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerCommit, IO], + **kwargs: Any + ) -> _models.NetworkManagerCommit: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerCommit] = 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, "NetworkManagerCommit") + + request = build_network_manager_commits_post_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._post_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit" + } + + @overload + def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManagerCommit, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit + :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 NetworkManagerCommit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. 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 NetworkManagerCommit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerCommit, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkManagerCommit]: + """Post a Network Manager Commit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network commit is. Is either a + NetworkManagerCommit type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit 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 NetworkManagerCommit or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkManagerCommit] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerCommit] = 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._post_initial( + resource_group_name=resource_group_name, + network_manager_name=network_manager_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkManagerCommit", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit" + } + + +class NetworkManagerDeploymentStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_manager_deployment_status` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: _models.NetworkManagerDeploymentStatusParameter, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusParameter + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: IO, + *, + top: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Required. + :type parameters: IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + parameters: Union[_models.NetworkManagerDeploymentStatusParameter, IO], + *, + top: Optional[int] = None, + **kwargs: Any + ) -> _models.NetworkManagerDeploymentStatusListResult: + """Post to List of Network Manager Deployment Status. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param parameters: Parameters supplied to specify which Managed Network deployment status is. + Is either a NetworkManagerDeploymentStatusParameter type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusParameter or IO + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :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: NetworkManagerDeploymentStatusListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerDeploymentStatusListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerDeploymentStatusListResult] = 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, "NetworkManagerDeploymentStatusParameter") + + request = build_network_manager_deployment_status_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerDeploymentStatusListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus" + } + + +class SubscriptionNetworkManagerConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`subscription_network_manager_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def create_or_update( + self, + network_manager_connection_name: str, + parameters: _models.NetworkManagerConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + network_manager_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + network_manager_connection_name: str, + parameters: Union[_models.NetworkManagerConnection, IO], + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Is either a + NetworkManagerConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerConnection] = 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, "NetworkManagerConnection") + + request = build_subscription_network_manager_connections_create_or_update_request( + network_manager_connection_name=network_manager_connection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def get(self, network_manager_connection_name: str, **kwargs: Any) -> _models.NetworkManagerConnection: + """Get a specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) + + request = build_subscription_network_manager_connections_get_request( + network_manager_connection_name=network_manager_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, network_manager_connection_name: str, **kwargs: Any + ) -> None: + """Delete specified connection created by this subscription. + + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_subscription_network_manager_connections_delete_request( + network_manager_connection_name=network_manager_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def list( + self, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.NetworkManagerConnection"]: + """List all network manager connections created by this subscription. + + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnectionListResult] = 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_subscription_network_manager_connections_list_request( + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections"} + + +class ManagementGroupNetworkManagerConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`management_group_network_manager_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: _models.NetworkManagerConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + management_group_id: str, + network_manager_connection_name: str, + parameters: Union[_models.NetworkManagerConnection, IO], + **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Create a network manager connection on this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :param parameters: Network manager connection to be created/updated. Is either a + NetworkManagerConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkManagerConnection] = 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, "NetworkManagerConnection") + + request = build_management_group_network_manager_connections_create_or_update_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def get( + self, management_group_id: str, network_manager_connection_name: str, **kwargs: Any + ) -> _models.NetworkManagerConnection: + """Get a specified connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkManagerConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnection] = kwargs.pop("cls", None) + + request = build_management_group_network_manager_connections_get_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkManagerConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, management_group_id: str, network_manager_connection_name: str, **kwargs: Any + ) -> None: + """Delete specified pending connection created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :param network_manager_connection_name: Name for the network manager connection. Required. + :type network_manager_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_management_group_network_manager_connections_delete_request( + management_group_id=management_group_id, + network_manager_connection_name=network_manager_connection_name, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + } + + @distributed_trace + def list( + self, management_group_id: str, *, top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.NetworkManagerConnection"]: + """List all network manager connections created by this management group. + + :param management_group_id: The management group Id which uniquely identify the Microsoft Azure + management group. Required. + :type management_group_id: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkManagerConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkManagerConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkManagerConnectionListResult] = 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_management_group_network_manager_connections_list_request( + management_group_id=management_group_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkManagerConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections" + } + + +class ConnectivityConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`connectivity_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Gets a Network Connectivity Configuration, specified by the resource group, network manager + name, and connectivity Configuration name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) + + request = build_connectivity_configurations_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: _models.ConnectivityConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Required. + :type connectivity_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :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: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Required. + :type connectivity_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + connectivity_configuration: Union[_models.ConnectivityConfiguration, IO], + **kwargs: Any + ) -> _models.ConnectivityConfiguration: + """Creates/Updates a new network manager connectivity configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :param connectivity_configuration: Parameters supplied to create/update a network manager + connectivity configuration. Is either a ConnectivityConfiguration type or a IO type. Required. + :type connectivity_configuration: + ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectivityConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connectivity_configuration, (IOBase, bytes)): + _content = connectivity_configuration + else: + _json = self._serialize.body(connectivity_configuration, "ConnectivityConfiguration") + + request = build_connectivity_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectivityConfiguration", pipeline_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.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connectivity_configurations_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a network manager connectivity configuration, specified by the resource group, network + manager name, and connectivity configuration name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager connectivity configuration. + Required. + :type configuration_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ConnectivityConfiguration"]: + """Lists all the network manager connectivity configuration in a specified network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectivityConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ConnectivityConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectivityConfigurationListResult] = 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_connectivity_configurations_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectivityConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations" + } + + +class NetworkGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, network_manager_name: str, network_group_name: str, **kwargs: Any + ) -> _models.NetworkGroup: + """Gets the specified network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkGroup] = kwargs.pop("cls", None) + + request = build_network_groups_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: _models.NetworkGroup, + *, + if_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: IO, + *, + if_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. + Required. + :type parameters: IO + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + parameters: Union[_models.NetworkGroup, IO], + *, + if_match: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkGroup: + """Creates or updates a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param parameters: Parameters supplied to the specify which network group need to create. Is + either a NetworkGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup or IO + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :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: NetworkGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkGroup] = 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, "NetworkGroup") + + request = build_network_groups_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if response.status_code == 201: + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + deserialized = self._deserialize("NetworkGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_groups_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.NetworkGroup"]: + """Lists the specified network group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkGroupListResult] = 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_network_groups_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups" + } + + +class StaticMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`static_members` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> _models.StaticMember: + """Gets the specified static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :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._api_version or "2023-09-01")) + cls: ClsType[_models.StaticMember] = kwargs.pop("cls", None) + + request = build_static_members_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StaticMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: _models.StaticMember, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :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: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + parameters: Union[_models.StaticMember, IO], + **kwargs: Any + ) -> _models.StaticMember: + """Creates or updates a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_name: str + :param parameters: Parameters supplied to the specify the static member to create. Is either a + StaticMember type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.StaticMember or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StaticMember or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.StaticMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StaticMember] = 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, "StaticMember") + + request = build_static_members_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StaticMember", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StaticMember", pipeline_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.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + static_member_name: str, + **kwargs: Any + ) -> None: + """Deletes a static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :param static_member_name: The name of the static member. Required. + :type static_member_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_static_members_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + static_member_name=static_member_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + network_group_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.StaticMember"]: + """Lists the specified static member. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param network_group_name: The name of the network group. Required. + :type network_group_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StaticMember or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.StaticMember] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.StaticMemberListResult] = 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_static_members_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + network_group_name=network_group_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StaticMemberListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers" + } + + +class ScopeConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`scope_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: _models.ScopeConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :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: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + scope_connection_name: str, + parameters: Union[_models.ScopeConnection, IO], + **kwargs: Any + ) -> _models.ScopeConnection: + """Creates or updates scope connection from Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :param parameters: Scope connection to be created/updated. Is either a ScopeConnection type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeConnection] = 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, "ScopeConnection") + + request = build_scope_connections_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_connection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ScopeConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ScopeConnection", pipeline_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.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_manager_name: str, scope_connection_name: str, **kwargs: Any + ) -> _models.ScopeConnection: + """Get specified scope connection created by this Network Manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ScopeConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ScopeConnection] = kwargs.pop("cls", None) + + request = build_scope_connections_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ScopeConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_manager_name: str, scope_connection_name: str, **kwargs: Any + ) -> None: + """Delete the pending scope connection created by this network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param scope_connection_name: Name for the cross-tenant connection. Required. + :type scope_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_scope_connections_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + scope_connection_name=scope_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ScopeConnection"]: + """List all scope connections created by this network manager. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeConnection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ScopeConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ScopeConnectionListResult] = 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_scope_connections_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ScopeConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections" + } + + +class SecurityAdminConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`security_admin_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SecurityAdminConfiguration"]: + """Lists all the network manager security admin configurations in a network manager, in a + paginated format. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityAdminConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityAdminConfigurationListResult] = 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_security_admin_configurations_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityAdminConfigurationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_manager_name: str, configuration_name: str, **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Retrieves a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) + + request = build_security_admin_configurations_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: _models.SecurityAdminConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + Required. + :type security_admin_configuration: + ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :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: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. + Required. + :type security_admin_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + security_admin_configuration: Union[_models.SecurityAdminConfiguration, IO], + **kwargs: Any + ) -> _models.SecurityAdminConfiguration: + """Creates or updates a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param security_admin_configuration: The security admin configuration to create or update. Is + either a SecurityAdminConfiguration type or a IO type. Required. + :type security_admin_configuration: + ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityAdminConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityAdminConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityAdminConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_admin_configuration, (IOBase, bytes)): + _content = security_admin_configuration + else: + _json = self._serialize.body(security_admin_configuration, "SecurityAdminConfiguration") + + request = build_security_admin_configurations_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityAdminConfiguration", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_admin_configurations_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a network manager security admin configuration. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + } + + +class AdminRuleCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`admin_rule_collections` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AdminRuleCollection"]: + """Lists all the rule collections in a security admin configuration, in a paginated format. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AdminRuleCollection or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleCollectionListResult] = 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_admin_rule_collections_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AdminRuleCollectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Gets a network manager security admin configuration rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) + + request = build_admin_rule_collections_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AdminRuleCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: _models.AdminRuleCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Required. + :type rule_collection: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :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: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Required. + :type rule_collection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_collection: Union[_models.AdminRuleCollection, IO], + **kwargs: Any + ) -> _models.AdminRuleCollection: + """Creates or updates an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_collection: The Rule Collection to create or update. Is either a + AdminRuleCollection type or a IO type. Required. + :type rule_collection: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AdminRuleCollection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.AdminRuleCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AdminRuleCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule_collection, (IOBase, bytes)): + _content = rule_collection + else: + _json = self._serialize.body(rule_collection, "AdminRuleCollection") + + request = build_admin_rule_collections_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AdminRuleCollection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AdminRuleCollection", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_admin_rule_collections_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an admin rule collection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + } + + +class AdminRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`admin_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.BaseAdminRule"]: + """List all network manager security configuration admin rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :keyword top: An optional query parameter which specifies the maximum number of records to be + returned by the server. Default value is None. + :paramtype top: int + :keyword skip_token: SkipToken is only used if a previous operation returned a partial result. + If a previous response contains a nextLink element, the value of the nextLink element will + include a skipToken parameter that specifies a starting point to use for subsequent calls. + Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BaseAdminRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BaseAdminRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AdminRuleListResult] = 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_admin_rules_list_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AdminRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + **kwargs: Any + ) -> _models.BaseAdminRule: + """Gets a network manager security configuration admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) + + request = build_admin_rules_get_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BaseAdminRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: _models.BaseAdminRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Required. + :type admin_rule: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :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: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Required. + :type admin_rule: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + admin_rule: Union[_models.BaseAdminRule, IO], + **kwargs: Any + ) -> _models.BaseAdminRule: + """Creates or updates an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :param admin_rule: The admin rule to create or update. Is either a BaseAdminRule type or a IO + type. Required. + :type admin_rule: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BaseAdminRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BaseAdminRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BaseAdminRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(admin_rule, (IOBase, bytes)): + _content = admin_rule + else: + _json = self._serialize.body(admin_rule, "BaseAdminRule") + + request = build_admin_rules_create_or_update_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BaseAdminRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BaseAdminRule", pipeline_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.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_admin_rules_delete_request( + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + force=force, + 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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + network_manager_name: str, + configuration_name: str, + rule_collection_name: str, + rule_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an admin rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_manager_name: The name of the network manager. Required. + :type network_manager_name: str + :param configuration_name: The name of the network manager Security Configuration. Required. + :type configuration_name: str + :param rule_collection_name: The name of the network manager security Configuration rule + collection. Required. + :type rule_collection_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword force: Deletes the resource even if it is part of a deployed configuration. If the + configuration has been deployed, the service will do a cleanup deployment in the background, + prior to the delete. Default value is None. + :paramtype force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_manager_name=network_manager_name, + configuration_name=configuration_name, + rule_collection_name=rule_collection_name, + rule_name=rule_name, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + } + + +class NetworkProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_profiles` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_profile_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_profiles_delete_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_profile_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the NetworkProfile. Required. + :type network_profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_profile_name=network_profile_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_profile_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkProfile: + """Gets the specified network profile in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the public IP prefix. Required. + :type network_profile_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) + + request = build_network_profiles_get_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: _models.NetworkProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :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: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_profile_name: str, + parameters: Union[_models.NetworkProfile, IO], + **kwargs: Any + ) -> _models.NetworkProfile: + """Creates or updates a network profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to the create or update network profile operation. Is + either a NetworkProfile type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkProfile] = 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, "NetworkProfile") + + request = build_network_profiles_create_or_update_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkProfile", pipeline_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.Network/networkProfiles/{networkProfileName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_profile_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkProfile: + """Updates network profile tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_profile_name: The name of the network profile. Required. + :type network_profile_name: str + :param parameters: Parameters supplied to update network profile tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkProfile or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkProfile] = 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, "TagsObject") + + request = build_network_profiles_update_tags_request( + resource_group_name=resource_group_name, + network_profile_name=network_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkProfile"]: + """Gets all the network profiles in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkProfile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfileListResult] = 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_network_profiles_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkProfileListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkProfile"]: + """Gets all network profiles in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkProfile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkProfile] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkProfileListResult] = 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_network_profiles_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkProfileListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles" + } + + +class NetworkSecurityGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_security_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_security_groups_delete_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_security_group_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Gets the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroup] = kwargs.pop("cls", None) + + request = build_network_security_groups_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.NetworkSecurityGroup, IO], + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, "NetworkSecurityGroup") + + request = build_network_security_groups_create_or_update_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + 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.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: _models.NetworkSecurityGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :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 NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. 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 NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.NetworkSecurityGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityGroup]: + """Creates or updates a network security group in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network security group + operation. Is either a NetworkSecurityGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup 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 NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, + network_security_group_name=network_security_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_security_group_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkSecurityGroup: + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param parameters: Parameters supplied to update network security group tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkSecurityGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkSecurityGroup] = 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, "TagsObject") + + request = build_network_security_groups_update_tags_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkSecurityGroup"]: + """Gets all network security groups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroupListResult] = 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_network_security_groups_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkSecurityGroup"]: + """Gets all network security groups in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkSecurityGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkSecurityGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkSecurityGroupListResult] = 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_network_security_groups_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityGroupListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups" + } + + +class SecurityRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`security_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_security_group_name: str, security_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_rules_delete_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_security_group_name: str, security_rule_name: str, **kwargs: Any + ) -> _models.SecurityRule: + """Get the specified network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + request = build_security_rules_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: Union[_models.SecurityRule, IO], + **kwargs: Any + ) -> _models.SecurityRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_rule_parameters, (IOBase, bytes)): + _content = security_rule_parameters + else: + _json = self._serialize.body(security_rule_parameters, "SecurityRule") + + request = build_security_rules_create_or_update_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityRule", pipeline_response) + + 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.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: _models.SecurityRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Required. + :type security_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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 SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Required. + :type security_rule_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 SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_security_group_name: str, + security_rule_name: str, + security_rule_parameters: Union[_models.SecurityRule, IO], + **kwargs: Any + ) -> LROPoller[_models.SecurityRule]: + """Creates or updates a security rule in the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. Required. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or update network security + rule operation. Is either a SecurityRule type or a IO type. Required. + :type security_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityRule 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 SecurityRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityRule] = 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, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> Iterable["_models.SecurityRule"]: + """Gets all security rules in a network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_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 SecurityRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRuleListResult] = 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_security_rules_list_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules" + } + + +class DefaultSecurityRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`default_security_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, network_security_group_name: str, **kwargs: Any + ) -> Iterable["_models.SecurityRule"]: + """Gets all default security rules in a network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_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 SecurityRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRuleListResult] = 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_default_security_rules_list_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_security_group_name: str, default_security_rule_name: str, **kwargs: Any + ) -> _models.SecurityRule: + """Get the specified default network security rule. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_security_group_name: The name of the network security group. Required. + :type network_security_group_name: str + :param default_security_rule_name: The name of the default security rule. Required. + :type default_security_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityRule] = kwargs.pop("cls", None) + + request = build_default_security_rules_get_request( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + default_security_rule_name=default_security_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}" + } + + +class NetworkVirtualAppliancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_virtual_appliances` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_virtual_appliances_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Gets the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualAppliance] = kwargs.pop("cls", None) + + request = build_network_virtual_appliances_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + """Updates a Network Virtual Appliance. + + :param resource_group_name: The resource group name of Network Virtual Appliance. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance being updated. + Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to Update Network Virtual Appliance Tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualAppliance or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, "TagsObject") + + request = build_network_virtual_appliances_update_tags_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.NetworkVirtualAppliance, IO], + **kwargs: Any + ) -> _models.NetworkVirtualAppliance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, "NetworkVirtualAppliance") + + request = build_network_virtual_appliances_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: _models.NetworkVirtualAppliance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance + :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 NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. + 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 NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + parameters: Union[_models.NetworkVirtualAppliance, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualAppliance]: + """Creates or updates the specified Network Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance. Is + either a NetworkVirtualAppliance type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance 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 NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualAppliance] = 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, + network_virtual_appliance_name=network_virtual_appliance_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkVirtualAppliance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkVirtualAppliance"]: + """Lists all Network Virtual Appliances in a resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceListResult] = 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_network_virtual_appliances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.NetworkVirtualAppliance"]: + """Gets all Network Virtual Appliances in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualAppliance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualAppliance] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceListResult] = 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_network_virtual_appliances_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances"} + + +class VirtualApplianceSitesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_appliance_sites` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_name: str, site_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_appliance_sites_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, site_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified site from a Virtual Appliance. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_virtual_appliance_name: str, site_name: str, **kwargs: Any + ) -> _models.VirtualApplianceSite: + """Gets the specified Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualApplianceSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualApplianceSite] = kwargs.pop("cls", None) + + request = build_virtual_appliance_sites_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: Union[_models.VirtualApplianceSite, IO], + **kwargs: Any + ) -> _models.VirtualApplianceSite: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualApplianceSite] = 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, "VirtualApplianceSite") + + request = build_virtual_appliance_sites_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: _models.VirtualApplianceSite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite + :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 VirtualApplianceSite or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. 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 VirtualApplianceSite or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + site_name: str, + parameters: Union[_models.VirtualApplianceSite, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualApplianceSite]: + """Creates or updates the specified Network Virtual Appliance Site. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param site_name: The name of the site. Required. + :type site_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance Site + operation. Is either a VirtualApplianceSite type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite 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 VirtualApplianceSite or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualApplianceSite] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + site_name=site_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualApplianceSite", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualApplianceSite"]: + """Lists all Network Virtual Appliance Sites in a Network Virtual Appliance resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualApplianceSite or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualApplianceSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSiteListResult] = 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_virtual_appliance_sites_list_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceSiteListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites" + } + + +class VirtualApplianceSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_appliance_skus` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.NetworkVirtualApplianceSku"]: + """List all SKUs available for a virtual appliance. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualApplianceSku or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSkuListResult] = 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_virtual_appliance_skus_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceSkuListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus"} + + @distributed_trace + def get(self, sku_name: str, **kwargs: Any) -> _models.NetworkVirtualApplianceSku: + """Retrieves a single available sku for network virtual appliance. + + :param sku_name: Name of the Sku. Required. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualApplianceSku or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceSku + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceSku] = kwargs.pop("cls", None) + + request = build_virtual_appliance_skus_get_request( + sku_name=sku_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualApplianceSku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}" + } + + +class InboundSecurityRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`inbound_security_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: Union[_models.InboundSecurityRule, IO], + **kwargs: Any + ) -> _models.InboundSecurityRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundSecurityRule] = 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, "InboundSecurityRule") + + request = build_inbound_security_rule_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + rule_collection_name=rule_collection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: _models.InboundSecurityRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule + :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 InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. 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 InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + rule_collection_name: str, + parameters: Union[_models.InboundSecurityRule, IO], + **kwargs: Any + ) -> LROPoller[_models.InboundSecurityRule]: + """Creates or updates the specified Network Virtual Appliance Inbound Security Rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param rule_collection_name: The name of security rule collection. Required. + :type rule_collection_name: str + :param parameters: Parameters supplied to the create or update Network Virtual Appliance + Inbound Security Rules operation. Is either a InboundSecurityRule type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule 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 InboundSecurityRule or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.InboundSecurityRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InboundSecurityRule] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + rule_collection_name=rule_collection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InboundSecurityRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}" + } + + +class NetworkWatchersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_watchers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NetworkWatcher, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :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: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkWatcher, IO], + **kwargs: Any + ) -> _models.NetworkWatcher: + """Creates or updates a network watcher in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the network watcher resource. Is either a + NetworkWatcher type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkWatcher] = 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, "NetworkWatcher") + + request = build_network_watchers_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkWatcher", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkWatcher", pipeline_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.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace + def get(self, resource_group_name: str, network_watcher_name: str, **kwargs: Any) -> _models.NetworkWatcher: + """Gets the specified network watcher by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcher] = kwargs.pop("cls", None) + + request = build_network_watchers_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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("NetworkWatcher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_watchers_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, network_watcher_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.NetworkWatcher: + """Updates a network watcher tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters supplied to update network watcher tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkWatcher or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkWatcher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkWatcher] = 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, "TagsObject") + + request = build_network_watchers_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("NetworkWatcher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NetworkWatcher"]: + """Gets all network watchers by resource group. + + :param resource_group_name: The name of the resource group. 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 NetworkWatcher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcherListResult] = 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_network_watchers_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkWatcherListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.NetworkWatcher"]: + """Gets all network watchers by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkWatcher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkWatcher] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkWatcherListResult] = 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_network_watchers_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkWatcherListResult", 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) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers"} + + @overload + def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TopologyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TopologyParameters + :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: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_topology( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TopologyParameters, IO], + **kwargs: Any + ) -> _models.Topology: + """Gets the current network topology by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the representation of topology. Is either a + TopologyParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TopologyParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topology or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Topology + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Topology] = 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, "TopologyParameters") + + request = build_network_watchers_get_topology_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_topology.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("Topology", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_topology.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology" + } + + def _verify_ip_flow_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.VerificationIPFlowParameters, IO], + **kwargs: Any + ) -> _models.VerificationIPFlowResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VerificationIPFlowResult] = 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, "VerificationIPFlowParameters") + + request = build_network_watchers_verify_ip_flow_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._verify_ip_flow_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _verify_ip_flow_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify" + } + + @overload + def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.VerificationIPFlowParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowParameters + :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 VerificationIPFlowResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. 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 VerificationIPFlowResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_verify_ip_flow( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.VerificationIPFlowParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.VerificationIPFlowResult]: + """Verify IP flow from the specified VM to a location given the currently configured NSG rules. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. Is either a + VerificationIPFlowParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowParameters 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 VerificationIPFlowResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VerificationIPFlowResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VerificationIPFlowResult] = 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._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VerificationIPFlowResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_verify_ip_flow.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify" + } + + def _get_next_hop_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NextHopParameters, IO], + **kwargs: Any + ) -> _models.NextHopResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NextHopResult] = 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, "NextHopParameters") + + request = build_network_watchers_get_next_hop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_next_hop_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("NextHopResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NextHopResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_next_hop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop" + } + + @overload + def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NextHopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NextHopParameters + :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 NextHopResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. 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 NextHopResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_next_hop( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NextHopParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.NextHopResult]: + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination endpoint. Is either a + NextHopParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.NextHopParameters 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 NextHopResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NextHopResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NextHopResult] = 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._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NextHopResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_next_hop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop" + } + + def _get_vm_security_rules_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.SecurityGroupViewParameters, IO], + **kwargs: Any + ) -> _models.SecurityGroupViewResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityGroupViewResult] = 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, "SecurityGroupViewParameters") + + request = build_network_watchers_get_vm_security_rules_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_vm_security_rules_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_vm_security_rules_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView" + } + + @overload + def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.SecurityGroupViewParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewParameters + :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 SecurityGroupViewResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. 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 SecurityGroupViewResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_vm_security_rules( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.SecurityGroupViewParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.SecurityGroupViewResult]: + """Gets the configured and effective security group rules on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the VM to check security groups for. Is either a + SecurityGroupViewParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewParameters 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 SecurityGroupViewResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityGroupViewResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityGroupViewResult] = 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._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityGroupViewResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vm_security_rules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView" + } + + def _get_troubleshooting_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TroubleshootingParameters, IO], + **kwargs: Any + ) -> _models.TroubleshootingResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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, "TroubleshootingParameters") + + request = build_network_watchers_get_troubleshooting_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_troubleshooting_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_troubleshooting_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot" + } + + @overload + def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.TroubleshootingParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TroubleshootingParameters + :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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. 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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_troubleshooting( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.TroubleshootingParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to troubleshoot. Is either a + TroubleshootingParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TroubleshootingParameters 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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_troubleshooting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot" + } + + def _get_troubleshooting_result_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.QueryTroubleshootingParameters, IO], + **kwargs: Any + ) -> _models.TroubleshootingResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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, "QueryTroubleshootingParameters") + + request = build_network_watchers_get_troubleshooting_result_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_troubleshooting_result_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_troubleshooting_result_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult" + } + + @overload + def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.QueryTroubleshootingParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryTroubleshootingParameters + :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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. + 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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_troubleshooting_result( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.QueryTroubleshootingParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.TroubleshootingResult]: + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to query the troubleshooting result. Is + either a QueryTroubleshootingParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.QueryTroubleshootingParameters 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 TroubleshootingResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.TroubleshootingResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TroubleshootingResult] = 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._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TroubleshootingResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_troubleshooting_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult" + } + + def _set_flow_log_configuration_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogInformation, IO], + **kwargs: Any + ) -> _models.FlowLogInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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, "FlowLogInformation") + + request = build_network_watchers_set_flow_log_configuration_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_flow_log_configuration_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_flow_log_configuration_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog" + } + + @overload + def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.FlowLogInformation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogInformation + :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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_flow_log_configuration( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogInformation, IO], + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Configures flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow log. Is either a + FlowLogInformation type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogInformation 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_flow_log_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog" + } + + def _get_flow_log_status_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogStatusParameters, IO], + **kwargs: Any + ) -> _models.FlowLogInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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, "FlowLogStatusParameters") + + request = build_network_watchers_get_flow_log_status_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_flow_log_status_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_flow_log_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus" + } + + @overload + def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.FlowLogStatusParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogStatusParameters + :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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_flow_log_status( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.FlowLogStatusParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.FlowLogInformation]: + """Queries status of flow log and traffic analytics (optional) on a specified resource. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that define a resource to query flow log and traffic analytics + (optional) status. Is either a FlowLogStatusParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLogStatusParameters 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 FlowLogInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLogInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLogInformation] = 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._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLogInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_flow_log_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus" + } + + def _check_connectivity_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.ConnectivityParameters, IO], + **kwargs: Any + ) -> _models.ConnectivityInformation: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityInformation] = 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, "ConnectivityParameters") + + request = build_network_watchers_check_connectivity_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_connectivity_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _check_connectivity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck" + } + + @overload + def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.ConnectivityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectivityParameters + :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 ConnectivityInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. + 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 ConnectivityInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_check_connectivity( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.ConnectivityParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.ConnectivityInformation]: + """Verifies the possibility of establishing a direct TCP connection from a virtual machine to a + given endpoint including another VM or an arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine how the connectivity check will be performed. Is + either a ConnectivityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectivityParameters 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 ConnectivityInformation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectivityInformation] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectivityInformation] = 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._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectivityInformation", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_connectivity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck" + } + + def _get_azure_reachability_report_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AzureReachabilityReportParameters, IO], + **kwargs: Any + ) -> _models.AzureReachabilityReport: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureReachabilityReport] = 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, "AzureReachabilityReportParameters") + + request = build_network_watchers_get_azure_reachability_report_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_azure_reachability_report_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_azure_reachability_report_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport" + } + + @overload + def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.AzureReachabilityReportParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportParameters + :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 AzureReachabilityReport or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. 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 AzureReachabilityReport or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_azure_reachability_report( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AzureReachabilityReportParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.AzureReachabilityReport]: + """NOTE: This feature is currently in preview and still being tested for stability. Gets the + relative latency score for internet service providers from a specified location to Azure + regions. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report configuration. Is either + a AzureReachabilityReportParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReportParameters 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 AzureReachabilityReport or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AzureReachabilityReport] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureReachabilityReport] = 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._get_azure_reachability_report_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AzureReachabilityReport", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_azure_reachability_report.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport" + } + + def _list_available_providers_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AvailableProvidersListParameters, IO], + **kwargs: Any + ) -> _models.AvailableProvidersList: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableProvidersList] = 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, "AvailableProvidersListParameters") + + request = build_network_watchers_list_available_providers_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._list_available_providers_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _list_available_providers_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList" + } + + @overload + def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.AvailableProvidersListParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListParameters + :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 AvailableProvidersList or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. 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 AvailableProvidersList or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_list_available_providers( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.AvailableProvidersListParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.AvailableProvidersList]: + """NOTE: This feature is currently in preview and still being tested for stability. Lists all + available internet service providers for a specified Azure region. + + :param resource_group_name: The name of the network watcher resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. Required. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available providers. Is either a + AvailableProvidersListParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.AvailableProvidersListParameters 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 AvailableProvidersList or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.AvailableProvidersList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableProvidersList] = 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._list_available_providers_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AvailableProvidersList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_available_providers.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList" + } + + def _get_network_configuration_diagnostic_initial( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkConfigurationDiagnosticParameters, IO], + **kwargs: Any + ) -> _models.NetworkConfigurationDiagnosticResponse: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = 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, "NetworkConfigurationDiagnosticParameters") + + request = build_network_watchers_get_network_configuration_diagnostic_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_network_configuration_diagnostic_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_network_configuration_diagnostic_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic" + } + + @overload + def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: _models.NetworkConfigurationDiagnosticParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticParameters + :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 NetworkConfigurationDiagnosticResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. 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 NetworkConfigurationDiagnosticResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_network_configuration_diagnostic( + self, + resource_group_name: str, + network_watcher_name: str, + parameters: Union[_models.NetworkConfigurationDiagnosticParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkConfigurationDiagnosticResponse]: + """Gets Network Configuration Diagnostic data to help customers understand and debug network + behavior. It provides detailed information on what security rules were applied to a specified + traffic flow and the result of evaluating these rules. Customers must provide details of a flow + like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, + the rules evaluated for the specified flow and the evaluation results. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param parameters: Parameters to get network configuration diagnostic. Is either a + NetworkConfigurationDiagnosticParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticParameters 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 NetworkConfigurationDiagnosticResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkConfigurationDiagnosticResponse] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkConfigurationDiagnosticResponse] = 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._get_network_configuration_diagnostic_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkConfigurationDiagnosticResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_network_configuration_diagnostic.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic" + } + + +class PacketCapturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`packet_captures` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_initial( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> _models.PacketCaptureResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCaptureResult] = 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, "PacketCapture") + + request = build_packet_captures_create_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PacketCaptureResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: _models.PacketCapture, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PacketCapture + :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 PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. 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 PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + network_watcher_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> LROPoller[_models.PacketCaptureResult]: + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture operation. Is either a + PacketCapture type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PacketCapture 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 PacketCaptureResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCaptureResult] = 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, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PacketCaptureResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCaptureResult: + """Gets a packet capture session by name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PacketCaptureResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureResult] = kwargs.pop("cls", None) + + request = build_packet_captures_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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("PacketCaptureResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, packet_capture_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_packet_captures_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, packet_capture_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_packet_captures_stop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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) + + _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, 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, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace + def begin_stop( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. Required. + :type packet_capture_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop" + } + + def _get_status_initial( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCaptureQueryStatusResult: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureQueryStatusResult] = kwargs.pop("cls", None) + + request = build_packet_captures_get_status_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_status_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _get_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus" + } + + @distributed_trace + def begin_get_status( + self, resource_group_name: str, network_watcher_name: str, packet_capture_name: str, **kwargs: Any + ) -> LROPoller[_models.PacketCaptureQueryStatusResult]: + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture session. Required. + :type packet_capture_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 PacketCaptureQueryStatusResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PacketCaptureQueryStatusResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureQueryStatusResult] = 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._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_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): + deserialized = self._deserialize("PacketCaptureQueryStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> Iterable["_models.PacketCaptureResult"]: + """Lists all packet capture sessions within the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PacketCaptureResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PacketCaptureResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PacketCaptureListResult] = 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_packet_captures_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PacketCaptureListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures" + } + + +class ConnectionMonitorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`connection_monitors` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.ConnectionMonitor, IO], + *, + migrate: Optional[str] = None, + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, "ConnectionMonitor") + + request = build_connection_monitors_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + migrate=migrate, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + + 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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: _models.ConnectionMonitor, + *, + migrate: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitor + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :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 ConnectionMonitorResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: IO, + *, + migrate: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. + Required. + :type parameters: IO + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :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 ConnectionMonitorResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.ConnectionMonitor, IO], + *, + migrate: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.ConnectionMonitorResult]: + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a connection monitor. Is + either a ConnectionMonitor type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitor or IO + :keyword migrate: Value indicating whether connection monitor V1 should be migrated to V2 + format. Default value is None. + :paramtype migrate: str + :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 ConnectionMonitorResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + parameters=parameters, + migrate=migrate, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionMonitorResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Gets a connection monitor by name. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorResult] = kwargs.pop("cls", None) + + request = build_connection_monitors_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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("ConnectionMonitorResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + connection_monitor_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ConnectionMonitorResult: + """Update tags of the specified connection monitor. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :param parameters: Parameters supplied to update connection monitor tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionMonitorResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionMonitorResult] = 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, "TagsObject") + + request = build_connection_monitors_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("ConnectionMonitorResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_stop_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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) + + _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, 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, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop" + } + + @distributed_trace + def begin_stop( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Stops the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._stop_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, connection_monitor_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_connection_monitors_start_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.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, 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, {}) + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start" + } + + @distributed_trace + def begin_start( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts the specified connection monitor. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. Required. + :type connection_monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._start_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start" + } + + def _query_initial( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> _models.ConnectionMonitorQueryResult: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorQueryResult] = kwargs.pop("cls", None) + + request = build_connection_monitors_query_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._query_initial.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, 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 response.status_code == 200: + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _query_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query" + } + + @distributed_trace + def begin_query( + self, resource_group_name: str, network_watcher_name: str, connection_monitor_name: str, **kwargs: Any + ) -> LROPoller[_models.ConnectionMonitorQueryResult]: + """Query a snapshot of the most recent connection states. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :param connection_monitor_name: The name given to the connection monitor. Required. + :type connection_monitor_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 ConnectionMonitorQueryResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorQueryResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorQueryResult] = 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._query_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_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): + deserialized = self._deserialize("ConnectionMonitorQueryResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_query.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_watcher_name: str, **kwargs: Any + ) -> Iterable["_models.ConnectionMonitorResult"]: + """Lists all connection monitors for the specified Network Watcher. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectionMonitorResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ConnectionMonitorResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionMonitorListResult] = 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_connection_monitors_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionMonitorListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors" + } + + +class FlowLogsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`flow_logs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.FlowLog, IO], + **kwargs: Any + ) -> _models.FlowLog: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, "FlowLog") + + request = build_flow_logs_create_or_update_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FlowLog", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FlowLog", pipeline_response) + + 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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: _models.FlowLog, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :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 FlowLog or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. 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 FlowLog or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.FlowLog, IO], + **kwargs: Any + ) -> LROPoller[_models.FlowLog]: + """Create or update a flow log for the specified network security group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters that define the create or update flow log resource. Is either a + FlowLog type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.FlowLog 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 FlowLog or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FlowLog", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + network_watcher_name: str, + flow_log_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.FlowLog: + """Update tags of the specified flow log. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log. Required. + :type flow_log_name: str + :param parameters: Parameters supplied to update flow log tags. Is either a TagsObject type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FlowLog] = 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, "TagsObject") + + request = build_flow_logs_update_tags_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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("FlowLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_watcher_name: str, flow_log_name: str, **kwargs: Any + ) -> _models.FlowLog: + """Gets a flow log resource by name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log resource. Required. + :type flow_log_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlowLog or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.FlowLog + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FlowLog] = kwargs.pop("cls", None) + + request = build_flow_logs_get_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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("FlowLog", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_watcher_name: str, flow_log_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_flow_logs_delete_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_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) + + _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 [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.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_watcher_name: str, flow_log_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified flow log resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. Required. + :type network_watcher_name: str + :param flow_log_name: The name of the flow log resource. Required. + :type flow_log_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + flow_log_name=flow_log_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + } + + @distributed_trace + def list(self, resource_group_name: str, network_watcher_name: str, **kwargs: Any) -> Iterable["_models.FlowLog"]: + """Lists all flow log resources for the specified Network Watcher. + + :param resource_group_name: The name of the resource group containing Network Watcher. + Required. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. Required. + :type network_watcher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FlowLog or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.FlowLog] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.FlowLogListResult] = 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_flow_logs_list_request( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FlowLogListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs" + } + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`operations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all of the available Network 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 Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.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._api_version or "2023-09-01")) + cls: ClsType[_models.OperationListResult] = 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_operations_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.Network/operations"} + + +class PrivateEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`private_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_endpoint_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_endpoints_delete_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, private_endpoint_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_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: + """ + _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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, private_endpoint_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PrivateEndpoint: + """Gets the specified private endpoint by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpoint] = kwargs.pop("cls", None) + + request = build_private_endpoints_get_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: Union[_models.PrivateEndpoint, IO], + **kwargs: Any + ) -> _models.PrivateEndpoint: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpoint] = 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, "PrivateEndpoint") + + request = build_private_endpoints_create_or_update_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + + 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.Network/privateEndpoints/{privateEndpointName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: _models.PrivateEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint + :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 PrivateEndpoint or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. + 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 PrivateEndpoint or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + parameters: Union[_models.PrivateEndpoint, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpoint]: + """Creates or updates an private endpoint in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param parameters: Parameters supplied to the create or update private endpoint operation. Is + either a PrivateEndpoint type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint 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 PrivateEndpoint or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpoint] = 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, + private_endpoint_name=private_endpoint_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpoint", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateEndpoint"]: + """Gets all private endpoints in a resource group. + + :param resource_group_name: The name of the resource group. 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 PrivateEndpoint or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointListResult] = 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_private_endpoints_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateEndpoint"]: + """Gets all private endpoints in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpoint or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpoint] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointListResult] = 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_private_endpoints_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints" + } + + +class AvailablePrivateEndpointTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`available_private_endpoint_types` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.AvailablePrivateEndpointType"]: + """Returns all of the resource types that can be linked to a Private Endpoint in this subscription + in this region. + + :param location: The location of the domain name. 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 AvailablePrivateEndpointType or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = 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_available_private_endpoint_types_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailablePrivateEndpointTypesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + } + + @distributed_trace + def list_by_resource_group( + self, location: str, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AvailablePrivateEndpointType"]: + """Returns all of the resource types that can be linked to a Private Endpoint in this subscription + in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AvailablePrivateEndpointType or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AvailablePrivateEndpointType] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AvailablePrivateEndpointTypesResult] = 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_available_private_endpoint_types_list_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailablePrivateEndpointTypesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + } + + +class PrivateDnsZoneGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`private_dns_zone_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_dns_zone_groups_delete_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private dns zone group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, private_endpoint_name: str, private_dns_zone_group_name: str, **kwargs: Any + ) -> _models.PrivateDnsZoneGroup: + """Gets the private dns zone group resource by specified private dns zone group name. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateDnsZoneGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateDnsZoneGroup] = kwargs.pop("cls", None) + + request = build_private_dns_zone_groups_get_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: Union[_models.PrivateDnsZoneGroup, IO], + **kwargs: Any + ) -> _models.PrivateDnsZoneGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateDnsZoneGroup] = 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, "PrivateDnsZoneGroup") + + request = build_private_dns_zone_groups_create_or_update_request( + resource_group_name=resource_group_name, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + + 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.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: _models.PrivateDnsZoneGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup + :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 PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. 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 PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + private_endpoint_name: str, + private_dns_zone_group_name: str, + parameters: Union[_models.PrivateDnsZoneGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateDnsZoneGroup]: + """Creates or updates a private dns zone group in the specified private endpoint. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param private_dns_zone_group_name: The name of the private dns zone group. Required. + :type private_dns_zone_group_name: str + :param parameters: Parameters supplied to the create or update private dns zone group + operation. Is either a PrivateDnsZoneGroup type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup 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 PrivateDnsZoneGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateDnsZoneGroup] = 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, + private_endpoint_name=private_endpoint_name, + private_dns_zone_group_name=private_dns_zone_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateDnsZoneGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + } + + @distributed_trace + def list( + self, private_endpoint_name: str, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateDnsZoneGroup"]: + """Gets all private dns zone groups in a private endpoint. + + :param private_endpoint_name: The name of the private endpoint. Required. + :type private_endpoint_name: str + :param resource_group_name: The name of the resource group. 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 PrivateDnsZoneGroup or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateDnsZoneGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateDnsZoneGroupListResult] = 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_private_dns_zone_groups_list_request( + private_endpoint_name=private_endpoint_name, + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateDnsZoneGroupListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups" + } + + +class PrivateLinkServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`private_link_services` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_link_services_delete_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, service_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified private link service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, service_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PrivateLinkService: + """Gets the specified private link service by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkService or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkService] = kwargs.pop("cls", None) + + request = build_private_link_services_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + parameters: Union[_models.PrivateLinkService, IO], + **kwargs: Any + ) -> _models.PrivateLinkService: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkService] = 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, "PrivateLinkService") + + request = build_private_link_services_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + + 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.Network/privateLinkServices/{serviceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: _models.PrivateLinkService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService + :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 PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + 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 PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + parameters: Union[_models.PrivateLinkService, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkService]: + """Creates or updates an private link service in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param parameters: Parameters supplied to the create or update private link service operation. + Is either a PrivateLinkService type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PrivateLinkService 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 PrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkService] = 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, + service_name=service_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkService", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateLinkService"]: + """Gets all private link services in a resource group. + + :param resource_group_name: The name of the resource group. 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 PrivateLinkService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkServiceListResult] = 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_private_link_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateLinkService"]: + """Gets all private link service in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkService or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateLinkServiceListResult] = 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_private_link_services_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices" + } + + @distributed_trace + def get_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get the specific private end point connection by specific private link service in the resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: 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.network.v2023_09_01.models.PrivateEndpointConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_private_link_services_get_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get_private_endpoint_connection.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.Error, 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 + + get_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @overload + def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.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.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_private_endpoint_connection( + self, + resource_group_name: str, + service_name: str, + pe_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Approve or reject private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :param parameters: Parameters supplied to approve or reject the private end point connection. + Is either a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.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 + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") + + request = build_private_link_services_update_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_private_endpoint_connection.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.Error, 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 + + update_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + def _delete_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_name: str, pe_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_private_link_services_delete_private_endpoint_connection_request( + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_private_endpoint_connection_initial.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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_private_endpoint_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @distributed_trace + def begin_delete_private_endpoint_connection( + self, resource_group_name: str, service_name: str, pe_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete private end point connection for a private link service in a subscription. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_name: str + :param pe_connection_name: The name of the private end point connection. Required. + :type pe_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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_private_endpoint_connection_initial( # type: ignore + resource_group_name=resource_group_name, + service_name=service_name, + pe_connection_name=pe_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_private_endpoint_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + } + + @distributed_trace + def list_private_endpoint_connections( + self, resource_group_name: str, service_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """Gets all private end point connections for a specific private link service. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_name: The name of the private link service. Required. + :type service_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: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PrivateEndpointConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = 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_private_link_services_list_private_endpoint_connections_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_private_endpoint_connections.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_private_endpoint_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections" + } + + def _check_private_link_service_visibility_initial( + self, location: str, parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], **kwargs: Any + ) -> Optional[_models.PrivateLinkServiceVisibility]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = 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, "CheckPrivateLinkServiceVisibilityRequest") + + request = build_private_link_services_check_private_link_service_visibility_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_private_link_service_visibility_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _check_private_link_service_visibility_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @overload + def begin_check_private_link_service_visibility( + self, + location: str, + parameters: _models.CheckPrivateLinkServiceVisibilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest + :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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_check_private_link_service_visibility( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_check_private_link_service_visibility( + self, location: str, parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service. + + :param location: The location of the domain name. Required. + :type location: str + :param parameters: The request body of CheckPrivateLinkService API call. Is either a + CheckPrivateLinkServiceVisibilityRequest type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkServiceVisibility] = 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._check_private_link_service_visibility_initial( + location=location, + 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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_private_link_service_visibility.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + def _check_private_link_service_visibility_by_resource_group_initial( + self, + location: str, + resource_group_name: str, + parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], + **kwargs: Any + ) -> Optional[_models.PrivateLinkServiceVisibility]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateLinkServiceVisibility]] = 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, "CheckPrivateLinkServiceVisibilityRequest") + + request = build_private_link_services_check_private_link_service_visibility_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._check_private_link_service_visibility_by_resource_group_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _check_private_link_service_visibility_by_resource_group_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @overload + def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: _models.CheckPrivateLinkServiceVisibilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest + :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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_check_private_link_service_visibility_by_resource_group( + self, + location: str, + resource_group_name: str, + parameters: Union[_models.CheckPrivateLinkServiceVisibilityRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateLinkServiceVisibility]: + """Checks whether the subscription is visible to private link service in the specified resource + group. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param parameters: The request body of CheckPrivateLinkService API call. Is either a + CheckPrivateLinkServiceVisibilityRequest type or a IO type. Required. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.CheckPrivateLinkServiceVisibilityRequest 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 PrivateLinkServiceVisibility or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PrivateLinkServiceVisibility] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateLinkServiceVisibility] = 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._check_private_link_service_visibility_by_resource_group_initial( + location=location, + resource_group_name=resource_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateLinkServiceVisibility", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_check_private_link_service_visibility_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + } + + @distributed_trace + def list_auto_approved_private_link_services( + self, location: str, **kwargs: Any + ) -> Iterable["_models.AutoApprovedPrivateLinkService"]: + """Returns all of the private link service ids that can be linked to a Private Endpoint with auto + approved in this subscription in this region. + + :param location: The location of the domain name. 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 AutoApprovedPrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = 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_private_link_services_list_auto_approved_private_link_services_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auto_approved_private_link_services.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutoApprovedPrivateLinkServicesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_auto_approved_private_link_services.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + } + + @distributed_trace + def list_auto_approved_private_link_services_by_resource_group( + self, location: str, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AutoApprovedPrivateLinkService"]: + """Returns all of the private link service ids that can be linked to a Private Endpoint with auto + approved in this subscription in this region. + + :param location: The location of the domain name. Required. + :type location: str + :param resource_group_name: The name of the resource group. 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 AutoApprovedPrivateLinkService or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.AutoApprovedPrivateLinkService] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.AutoApprovedPrivateLinkServicesResult] = 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_private_link_services_list_auto_approved_private_link_services_by_resource_group_request( + location=location, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auto_approved_private_link_services_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutoApprovedPrivateLinkServicesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_auto_approved_private_link_services_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + } + + +class PublicIPPrefixesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`public_ip_prefixes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_ip_prefix_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_public_ip_prefixes_delete_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, public_ip_prefix_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the PublicIpPrefix. Required. + :type public_ip_prefix_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, public_ip_prefix_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.PublicIPPrefix: + """Gets the specified public IP prefix in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefix] = kwargs.pop("cls", None) + + request = build_public_ip_prefixes_get_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.PublicIPPrefix, IO], + **kwargs: Any + ) -> _models.PublicIPPrefix: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, "PublicIPPrefix") + + request = build_public_ip_prefixes_create_or_update_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + 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.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: _models.PublicIPPrefix, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :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 PublicIPPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. + 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 PublicIPPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.PublicIPPrefix, IO], + **kwargs: Any + ) -> LROPoller[_models.PublicIPPrefix]: + """Creates or updates a static or dynamic public IP prefix. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to the create or update public IP prefix operation. Is + either a PublicIPPrefix type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix 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 PublicIPPrefix or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, + public_ip_prefix_name=public_ip_prefix_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + public_ip_prefix_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.PublicIPPrefix: + """Updates public IP prefix tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param public_ip_prefix_name: The name of the public IP prefix. Required. + :type public_ip_prefix_name: str + :param parameters: Parameters supplied to update public IP prefix tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PublicIPPrefix or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicIPPrefix] = 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, "TagsObject") + + request = build_public_ip_prefixes_update_tags_request( + resource_group_name=resource_group_name, + public_ip_prefix_name=public_ip_prefix_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicIPPrefix", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.PublicIPPrefix"]: + """Gets all the public IP prefixes in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PublicIPPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefixListResult] = 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_public_ip_prefixes_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PublicIPPrefix"]: + """Gets all public IP prefixes in a resource group. + + :param resource_group_name: The name of the resource group. 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 PublicIPPrefix or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIPPrefix] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.PublicIPPrefixListResult] = 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_public_ip_prefixes_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicIPPrefixListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes" + } + + +class RouteFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`route_filters` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_filter_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_filters_delete_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, route_filter_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, route_filter_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.RouteFilter: + """Gets the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :keyword expand: Expands referenced express route bgp peering resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) + + request = build_route_filters_get_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: Union[_models.RouteFilter, IO], + **kwargs: Any + ) -> _models.RouteFilter: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_filter_parameters, (IOBase, bytes)): + _content = route_filter_parameters + else: + _json = self._serialize.body(route_filter_parameters, "RouteFilter") + + request = build_route_filters_create_or_update_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteFilter", pipeline_response) + + 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.Network/routeFilters/{routeFilterName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: _models.RouteFilter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Required. + :type route_filter_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :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 RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Required. + :type route_filter_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 RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + route_filter_parameters: Union[_models.RouteFilter, IO], + **kwargs: Any + ) -> LROPoller[_models.RouteFilter]: + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or update route filter + operation. Is either a RouteFilter type or a IO type. Required. + :type route_filter_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilter 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 RouteFilter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = 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, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteFilter", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + route_filter_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + route_filter_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, route_filter_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.RouteFilter: + """Updates tags of a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param parameters: Parameters supplied to update route filter tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilter] = 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, "TagsObject") + + request = build_route_filters_update_tags_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RouteFilter"]: + """Gets all route filters in a resource group. + + :param resource_group_name: The name of the resource group. 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 RouteFilter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterListResult] = 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_route_filters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.RouteFilter"]: + """Gets all route filters in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteFilter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterListResult] = 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_route_filters_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters"} + + +class RouteFilterRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`route_filter_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_filter_name: str, rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_filter_rules_delete_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, route_filter_name: str, rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, route_filter_name: str, rule_name: str, **kwargs: Any + ) -> _models.RouteFilterRule: + """Gets the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteFilterRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) + + request = build_route_filter_rules_get_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: Union[_models.RouteFilterRule, IO], + **kwargs: Any + ) -> _models.RouteFilterRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilterRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_filter_rule_parameters, (IOBase, bytes)): + _content = route_filter_rule_parameters + else: + _json = self._serialize.body(route_filter_rule_parameters, "RouteFilterRule") + + request = build_route_filter_rules_create_or_update_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + + 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.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: _models.RouteFilterRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Required. + :type route_filter_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule + :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 RouteFilterRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Required. + :type route_filter_rule_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 RouteFilterRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + route_filter_name: str, + rule_name: str, + route_filter_rule_parameters: Union[_models.RouteFilterRule, IO], + **kwargs: Any + ) -> LROPoller[_models.RouteFilterRule]: + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. Required. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create or update route filter + rule operation. Is either a RouteFilterRule type or a IO type. Required. + :type route_filter_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteFilterRule 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 RouteFilterRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteFilterRule] = 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, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteFilterRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + } + + @distributed_trace + def list_by_route_filter( + self, resource_group_name: str, route_filter_name: str, **kwargs: Any + ) -> Iterable["_models.RouteFilterRule"]: + """Gets all RouteFilterRules in a route filter. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. Required. + :type route_filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteFilterRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteFilterRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteFilterRuleListResult] = 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_route_filter_rules_list_by_route_filter_request( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_route_filter.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteFilterRuleListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_route_filter.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules" + } + + +class RouteTablesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`route_tables` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_tables_delete_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, route_table_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, route_table_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.RouteTable: + """Gets the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTable] = kwargs.pop("cls", None) + + request = build_route_tables_get_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.RouteTable, IO], **kwargs: Any + ) -> _models.RouteTable: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, "RouteTable") + + request = build_route_tables_create_or_update_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteTable", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteTable", pipeline_response) + + 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.Network/routeTables/{routeTableName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + parameters: _models.RouteTable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :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 RouteTable or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. 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 RouteTable or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.RouteTable, IO], **kwargs: Any + ) -> LROPoller[_models.RouteTable]: + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route table operation. Is either + a RouteTable type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.RouteTable 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 RouteTable or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, + route_table_name=route_table_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteTable", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + route_table_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + route_table_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, route_table_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.RouteTable: + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param parameters: Parameters supplied to update route table tags. Is either a TagsObject type + or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteTable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteTable] = 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, "TagsObject") + + request = build_route_tables_update_tags_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RouteTable"]: + """Gets all route tables in a resource group. + + :param resource_group_name: The name of the resource group. 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 RouteTable or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTableListResult] = 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_route_tables_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteTableListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.RouteTable"]: + """Gets all route tables in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteTable or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteTableListResult] = 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_route_tables_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteTableListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables"} + + +class RoutesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`routes` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, route_table_name: str, route_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_routes_delete_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace + def get(self, resource_group_name: str, route_table_name: str, route_name: str, **kwargs: Any) -> _models.Route: + """Gets the specified route from a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Route or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Route + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + + request = build_routes_get_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Route", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: Union[_models.Route, IO], + **kwargs: Any + ) -> _models.Route: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_parameters, (IOBase, bytes)): + _content = route_parameters + else: + _json = self._serialize.body(route_parameters, "Route") + + request = build_routes_create_or_update_request( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Route", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Route", pipeline_response) + + 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.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: _models.Route, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Required. + :type route_parameters: ~azure.mgmt.network.v2023_09_01.models.Route + :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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Required. + :type route_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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + route_table_name: str, + route_name: str, + route_parameters: Union[_models.Route, IO], + **kwargs: Any + ) -> LROPoller[_models.Route]: + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :param route_name: The name of the route. Required. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update route operation. Is either + a Route type or a IO type. Required. + :type route_parameters: ~azure.mgmt.network.v2023_09_01.models.Route 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Route] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = 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, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Route", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + } + + @distributed_trace + def list(self, resource_group_name: str, route_table_name: str, **kwargs: Any) -> Iterable["_models.Route"]: + """Gets all routes in a route table. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param route_table_name: The name of the route table. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Route or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.Route] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteListResult] = 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_routes_list_request( + resource_group_name=resource_group_name, + route_table_name=route_table_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RouteListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes" + } + + +class SecurityPartnerProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`security_partner_providers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, security_partner_provider_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_security_partner_providers_delete_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, security_partner_provider_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, security_partner_provider_name: str, **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Gets the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProvider] = kwargs.pop("cls", None) + + request = build_security_partner_providers_get_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.SecurityPartnerProvider, IO], + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, "SecurityPartnerProvider") + + request = build_security_partner_providers_create_or_update_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + 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.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: _models.SecurityPartnerProvider, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :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 SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. 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 SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.SecurityPartnerProvider, IO], + **kwargs: Any + ) -> LROPoller[_models.SecurityPartnerProvider]: + """Creates or updates the specified Security Partner Provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to the create or update Security Partner Provider + operation. Is either a SecurityPartnerProvider type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider 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 SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, + security_partner_provider_name=security_partner_provider_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + security_partner_provider_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.SecurityPartnerProvider: + """Updates tags of a Security Partner Provider resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param security_partner_provider_name: The name of the Security Partner Provider. Required. + :type security_partner_provider_name: str + :param parameters: Parameters supplied to update Security Partner Provider tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityPartnerProvider or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPartnerProvider] = 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, "TagsObject") + + request = build_security_partner_providers_update_tags_request( + resource_group_name=resource_group_name, + security_partner_provider_name=security_partner_provider_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityPartnerProvider", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.SecurityPartnerProvider"]: + """Lists all Security Partner Providers in a resource group. + + :param resource_group_name: The name of the resource group. 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 SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProviderListResult] = 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_security_partner_providers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.SecurityPartnerProvider"]: + """Gets all the Security Partner Providers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityPartnerProvider or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.SecurityPartnerProvider] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SecurityPartnerProviderListResult] = 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_security_partner_providers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityPartnerProviderListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders"} + + +class BgpServiceCommunitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`bgp_service_communities` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.BgpServiceCommunity"]: + """Gets all the available bgp service communities. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BgpServiceCommunity or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BgpServiceCommunity] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpServiceCommunityListResult] = 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_bgp_service_communities_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BgpServiceCommunityListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities"} + + +class ServiceEndpointPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`service_endpoint_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, service_endpoint_policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_service_endpoint_policies_delete_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, service_endpoint_policy_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Gets the specified service Endpoint Policies in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicy] = kwargs.pop("cls", None) + + request = build_service_endpoint_policies_get_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.ServiceEndpointPolicy, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, "ServiceEndpointPolicy") + + request = build_service_endpoint_policies_create_or_update_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: _models.ServiceEndpointPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :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 ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. 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 ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.ServiceEndpointPolicy, IO], + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicy]: + """Creates or updates a service Endpoint Policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to the create or update service endpoint policy + operation. Is either a ServiceEndpointPolicy type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy 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 ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, + service_endpoint_policy_name=service_endpoint_policy_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicy: + """Updates tags of a service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param parameters: Parameters supplied to update service endpoint policy tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicy] = 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, "TagsObject") + + request = build_service_endpoint_policies_update_tags_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ServiceEndpointPolicy"]: + """Gets all the service endpoint policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyListResult] = 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_service_endpoint_policies_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ServiceEndpointPolicy"]: + """Gets all service endpoint Policies in a resource group. + + :param resource_group_name: The name of the resource group. 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 ServiceEndpointPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyListResult] = 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_service_endpoint_policies_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies" + } + + +class ServiceEndpointPolicyDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`service_endpoint_policy_definitions` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_service_endpoint_policy_definitions_delete_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified ServiceEndpoint policy definitions. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the Service Endpoint Policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition. Required. + :type service_endpoint_policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + **kwargs: Any + ) -> _models.ServiceEndpointPolicyDefinition: + """Get the specified service endpoint policy definitions from service endpoint policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy name. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceEndpointPolicyDefinition or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) + + request = build_service_endpoint_policy_definitions_get_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: Union[_models.ServiceEndpointPolicyDefinition, IO], + **kwargs: Any + ) -> _models.ServiceEndpointPolicyDefinition: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_endpoint_policy_definitions, (IOBase, bytes)): + _content = service_endpoint_policy_definitions + else: + _json = self._serialize.body(service_endpoint_policy_definitions, "ServiceEndpointPolicyDefinition") + + request = build_service_endpoint_policy_definitions_create_or_update_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + + 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.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: _models.ServiceEndpointPolicyDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Required. + :type service_endpoint_policy_definitions: + ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition + :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 ServiceEndpointPolicyDefinition or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Required. + :type service_endpoint_policy_definitions: 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 ServiceEndpointPolicyDefinition or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_endpoint_policy_name: str, + service_endpoint_policy_definition_name: str, + service_endpoint_policy_definitions: Union[_models.ServiceEndpointPolicyDefinition, IO], + **kwargs: Any + ) -> LROPoller[_models.ServiceEndpointPolicyDefinition]: + """Creates or updates a service endpoint policy definition in the specified service endpoint + policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy. Required. + :type service_endpoint_policy_name: str + :param service_endpoint_policy_definition_name: The name of the service endpoint policy + definition name. Required. + :type service_endpoint_policy_definition_name: str + :param service_endpoint_policy_definitions: Parameters supplied to the create or update service + endpoint policy operation. Is either a ServiceEndpointPolicyDefinition type or a IO type. + Required. + :type service_endpoint_policy_definitions: + ~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition 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 ServiceEndpointPolicyDefinition or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceEndpointPolicyDefinition] = 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, + service_endpoint_policy_name=service_endpoint_policy_name, + service_endpoint_policy_definition_name=service_endpoint_policy_definition_name, + service_endpoint_policy_definitions=service_endpoint_policy_definitions, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyDefinition", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, service_endpoint_policy_name: str, **kwargs: Any + ) -> Iterable["_models.ServiceEndpointPolicyDefinition"]: + """Gets all service endpoint policy definitions in a service end point policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param service_endpoint_policy_name: The name of the service endpoint policy name. Required. + :type service_endpoint_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceEndpointPolicyDefinition or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceEndpointPolicyDefinition] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceEndpointPolicyDefinitionListResult] = 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_service_endpoint_policy_definitions_list_by_resource_group_request( + resource_group_name=resource_group_name, + service_endpoint_policy_name=service_endpoint_policy_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceEndpointPolicyDefinitionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions" + } + + +class ServiceTagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`service_tags` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> _models.ServiceTagsListResult: + """Gets a list of service tag information resources. + + :param location: The location that will be used as a reference for version (not as a filter + based on location, you will get the list of service tags with prefix details across all regions + but limited to the cloud that your subscription belongs to). Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceTagsListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceTagsListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceTagsListResult] = kwargs.pop("cls", None) + + request = build_service_tags_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceTagsListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags" + } + + +class ServiceTagInformationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`service_tag_information` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + location: str, + *, + no_address_prefixes: Optional[bool] = None, + tag_name: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ServiceTagInformation"]: + """Gets a list of service tag information resources with pagination. + + :param location: The location that will be used as a reference for cloud (not as a filter based + on location, you will get the list of service tags with prefix details across all regions but + limited to the cloud that your subscription belongs to). Required. + :type location: str + :keyword no_address_prefixes: Do not return address prefixes for the tag(s). Default value is + None. + :paramtype no_address_prefixes: bool + :keyword tag_name: Return tag information for a particular tag. Default value is None. + :paramtype tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceTagInformation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.ServiceTagInformation] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceTagInformationListResult] = 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_service_tag_information_list_request( + location=location, + subscription_id=self._config.subscription_id, + no_address_prefixes=no_address_prefixes, + tag_name=tag_name, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceTagInformationListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails" + } + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`usages` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: + """List network usages for a subscription. + + :param location: The location where 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.network.v2023_09_01.models.Usage] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.UsagesListResult] = 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_usages_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UsagesListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages"} + + +class VirtualNetworksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_networks` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_networks_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_network_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualNetwork: + """Gets the specified virtual network by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) + + request = build_virtual_networks_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.VirtualNetwork, IO], + **kwargs: Any + ) -> _models.VirtualNetwork: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, "VirtualNetwork") + + request = build_virtual_networks_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.VirtualNetwork, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :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 VirtualNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. + 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 VirtualNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.VirtualNetwork, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetwork]: + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual network operation. Is + either a VirtualNetwork type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork 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 VirtualNetwork or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, + virtual_network_name=virtual_network_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + virtual_network_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualNetwork: + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param parameters: Parameters supplied to update virtual network tags. Is either a TagsObject + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetwork + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = 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, "TagsObject") + + request = build_virtual_networks_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetwork", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: + """Gets all virtual networks in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListResult] = 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_virtual_networks_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks"} + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: + """Gets all virtual networks in a resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetwork] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListResult] = 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_virtual_networks_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks" + } + + @distributed_trace + def check_ip_address_availability( + self, resource_group_name: str, virtual_network_name: str, *, ip_address: str, **kwargs: Any + ) -> _models.IPAddressAvailabilityResult: + """Checks whether a private IP address is available for use. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword ip_address: The private IP address to be verified. Required. + :paramtype ip_address: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IPAddressAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.IPAddressAvailabilityResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.IPAddressAvailabilityResult] = kwargs.pop("cls", None) + + request = build_virtual_networks_check_ip_address_availability_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + ip_address=ip_address, + api_version=api_version, + template_url=self.check_ip_address_availability.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IPAddressAvailabilityResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_ip_address_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability" + } + + @distributed_trace + def list_usage( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkUsage"]: + """Lists usage stats. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkUsage or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkUsage] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkListUsageResult] = 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_virtual_networks_list_usage_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_usage.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkListUsageResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages" + } + + def _list_ddos_protection_status_initial( + self, + resource_group_name: str, + virtual_network_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.VirtualNetworkDdosProtectionStatusResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VirtualNetworkDdosProtectionStatusResult]] = kwargs.pop("cls", None) + + request = build_virtual_networks_list_ddos_protection_status_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self._list_ddos_protection_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkDdosProtectionStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_ddos_protection_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus" + } + + @distributed_trace + def begin_list_ddos_protection_status( + self, + resource_group_name: str, + virtual_network_name: str, + *, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.PublicIpDdosProtectionStatusResult"]]: + """Gets the Ddos Protection Status of all IP Addresses under the Virtual Network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword top: The max number of ip addresses to return. Default value is None. + :paramtype top: int + :keyword skip_token: The skipToken that is given with nextLink. Default value is None. + :paramtype skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 an iterator like instance of either + VirtualNetworkDdosProtectionStatusResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.PublicIpDdosProtectionStatusResult]] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkDdosProtectionStatusResult] = 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_virtual_networks_list_ddos_protection_status_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.begin_list_ddos_protection_status.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkDdosProtectionStatusResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + 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._list_ddos_protection_status_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + top=top, + skip_token=skip_token, + 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): + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return get_next(next_link) + + return ItemPaged(internal_get_next, extract_data) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_ddos_protection_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus" + } + + +class SubnetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`subnets` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, subnet_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_subnets_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Subnet: + """Gets the specified subnet by virtual network and resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Subnet or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.Subnet + :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._api_version or "2023-09-01")) + cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) + + request = build_subnets_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Subnet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: Union[_models.Subnet, IO], + **kwargs: Any + ) -> _models.Subnet: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Subnet] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(subnet_parameters, (IOBase, bytes)): + _content = subnet_parameters + else: + _json = self._serialize.body(subnet_parameters, "Subnet") + + request = build_subnets_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Subnet", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Subnet", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: _models.Subnet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. + Required. + :type subnet_parameters: ~azure.mgmt.network.v2023_09_01.models.Subnet + :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 Subnet or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. + Required. + :type subnet_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 Subnet or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + subnet_parameters: Union[_models.Subnet, IO], + **kwargs: Any + ) -> LROPoller[_models.Subnet]: + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update subnet operation. Is + either a Subnet type or a IO type. Required. + :type subnet_parameters: ~azure.mgmt.network.v2023_09_01.models.Subnet 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 Subnet or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.Subnet] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Subnet] = 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, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Subnet", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + } + + def _prepare_network_policies_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: Union[_models.PrepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(prepare_network_policies_request_parameters, (IOBase, bytes)): + _content = prepare_network_policies_request_parameters + else: + _json = self._serialize.body(prepare_network_policies_request_parameters, "PrepareNetworkPoliciesRequest") + + request = build_subnets_prepare_network_policies_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._prepare_network_policies_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _prepare_network_policies_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies" + } + + @overload + def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: _models.PrepareNetworkPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Required. + :type prepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.PrepareNetworkPoliciesRequest + :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: + """ + + @overload + def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Required. + :type prepare_network_policies_request_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_prepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + prepare_network_policies_request_parameters: Union[_models.PrepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Prepares a subnet by applying network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param prepare_network_policies_request_parameters: Parameters supplied to prepare subnet by + applying network intent policies. Is either a PrepareNetworkPoliciesRequest type or a IO type. + Required. + :type prepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.PrepareNetworkPoliciesRequest 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 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._api_version or "2023-09-01")) + 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._prepare_network_policies_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + prepare_network_policies_request_parameters=prepare_network_policies_request_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_prepare_network_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies" + } + + def _unprepare_network_policies_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: Union[_models.UnprepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(unprepare_network_policies_request_parameters, (IOBase, bytes)): + _content = unprepare_network_policies_request_parameters + else: + _json = self._serialize.body( + unprepare_network_policies_request_parameters, "UnprepareNetworkPoliciesRequest" + ) + + request = build_subnets_unprepare_network_policies_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._unprepare_network_policies_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _unprepare_network_policies_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies" + } + + @overload + def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: _models.UnprepareNetworkPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Required. + :type unprepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.UnprepareNetworkPoliciesRequest + :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: + """ + + @overload + def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Required. + :type unprepare_network_policies_request_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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_unprepare_network_policies( + self, + resource_group_name: str, + virtual_network_name: str, + subnet_name: str, + unprepare_network_policies_request_parameters: Union[_models.UnprepareNetworkPoliciesRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Unprepares a subnet by removing network intent policies. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :param unprepare_network_policies_request_parameters: Parameters supplied to unprepare subnet + to remove network intent policies. Is either a UnprepareNetworkPoliciesRequest type or a IO + type. Required. + :type unprepare_network_policies_request_parameters: + ~azure.mgmt.network.v2023_09_01.models.UnprepareNetworkPoliciesRequest 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 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._api_version or "2023-09-01")) + 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._unprepare_network_policies_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + unprepare_network_policies_request_parameters=unprepare_network_policies_request_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) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_unprepare_network_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies" + } + + @distributed_trace + def list(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any) -> Iterable["_models.Subnet"]: + """Gets all subnets in a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Subnet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.Subnet] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.SubnetListResult] = 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_subnets_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SubnetListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets" + } + + +class ResourceNavigationLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`resource_navigation_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> _models.ResourceNavigationLinksListResult: + """Gets a list of resource navigation links for a subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceNavigationLinksListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ResourceNavigationLinksListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ResourceNavigationLinksListResult] = kwargs.pop("cls", None) + + request = build_resource_navigation_links_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ResourceNavigationLinksListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks" + } + + +class ServiceAssociationLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`service_association_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, virtual_network_name: str, subnet_name: str, **kwargs: Any + ) -> _models.ServiceAssociationLinksListResult: + """Gets a list of service association links for a subnet. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. Required. + :type subnet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceAssociationLinksListResult or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ServiceAssociationLinksListResult + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ServiceAssociationLinksListResult] = kwargs.pop("cls", None) + + request = build_service_association_links_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceAssociationLinksListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks" + } + + +class VirtualNetworkPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_network_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_peerings_delete_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network peering. Required. + :type virtual_network_peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_network_name: str, virtual_network_peering_name: str, **kwargs: Any + ) -> _models.VirtualNetworkPeering: + """Gets the specified virtual network peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network peering. Required. + :type virtual_network_peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) + + request = build_virtual_network_peerings_get_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: Union[_models.VirtualNetworkPeering, IO], + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + **kwargs: Any + ) -> _models.VirtualNetworkPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkPeering] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_network_peering_parameters, (IOBase, bytes)): + _content = virtual_network_peering_parameters + else: + _json = self._serialize.body(virtual_network_peering_parameters, "VirtualNetworkPeering") + + request = build_virtual_network_peerings_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + subscription_id=self._config.subscription_id, + sync_remote_address_space=sync_remote_address_space, + 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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + + 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.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: _models.VirtualNetworkPeering, + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Required. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :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 VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: IO, + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Required. + :type virtual_network_peering_parameters: IO + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :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 VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_name: str, + virtual_network_peering_name: str, + virtual_network_peering_parameters: Union[_models.VirtualNetworkPeering, IO], + *, + sync_remote_address_space: Optional[Union[str, _models.SyncRemoteAddressSpace]] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkPeering]: + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. Required. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the create or update virtual + network peering operation. Is either a VirtualNetworkPeering type or a IO type. Required. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering or IO + :keyword sync_remote_address_space: Parameter indicates the intention to sync the peering with + the current address space on the remote vNet after it's updated. "true" Default value is None. + :paramtype sync_remote_address_space: str or + ~azure.mgmt.network.v2023_09_01.models.SyncRemoteAddressSpace + :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 VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkPeering] = 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, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + sync_remote_address_space=sync_remote_address_space, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkPeering"]: + """Gets all virtual network peerings in a virtual network. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkPeeringListResult] = 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_virtual_network_peerings_list_request( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkPeeringListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings" + } + + +class VirtualNetworkGatewaysOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_network_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VirtualNetworkGateway, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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, "VirtualNetworkGateway") + + request = build_virtual_network_gateways_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VirtualNetworkGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VirtualNetworkGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Creates or updates a virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual network gateway operation. + Is either a VirtualNetworkGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGateway: + """Gets the specified virtual network gateway by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGateway] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkGateway]] = 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, "TagsObject") + + request = build_virtual_network_gateways_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to update virtual network gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetworkGateway"]: + """Gets all virtual network gateways by resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayListResult] = 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_virtual_network_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways" + } + + @distributed_trace + def list_connections( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkGatewayConnectionListEntity"]: + """Gets all the connections in a virtual network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkGatewayConnectionListEntity or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnectionListEntity] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayListConnectionsResult] = 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_virtual_network_gateways_list_connections_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_connections.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayListConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections" + } + + def _reset_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + *, + gateway_vip: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VirtualNetworkGateway]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_reset_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + gateway_vip=gateway_vip, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" + } + + @distributed_trace + def begin_reset( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + *, + gateway_vip: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGateway]: + """Resets the primary of the virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword gateway_vip: Virtual network gateway vip address supplied to the begin reset of the + active-active feature enabled gateway. Default value is None. + :paramtype gateway_vip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 VirtualNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + 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): + deserialized = self._deserialize("VirtualNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" + } + + def _reset_vpn_client_shared_key_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_reset_vpn_client_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_vpn_client_shared_key_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_vpn_client_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" + } + + @distributed_trace + def begin_reset_vpn_client_shared_key( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Resets the VPN client shared key of the virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._reset_vpn_client_shared_key_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_vpn_client_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" + } + + def _generatevpnclientpackage_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnClientParameters") + + request = build_virtual_network_gateways_generatevpnclientpackage_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generatevpnclientpackage_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generatevpnclientpackage_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" + } + + @overload + def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnClientParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generatevpnclientpackage( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN client package for P2S client of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Is either a VpnClientParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generatevpnclientpackage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" + } + + def _generate_vpn_profile_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnClientParameters") + + request = build_virtual_network_gateways_generate_vpn_profile_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_vpn_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generate_vpn_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" + } + + @overload + def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnClientParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_vpn_profile( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnClientParameters, IO], + **kwargs: Any + ) -> LROPoller[str]: + """Generates VPN profile for P2S client of the virtual network gateway in the specified resource + group. Used for IKEV2 and radius based authentication. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network gateway VPN client + package operation. Is either a VpnClientParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnClientParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_vpn_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" + } + + def _get_vpn_profile_package_url_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpn_profile_package_url_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpn_profile_package_url_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpn_profile_package_url_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" + } + + @distributed_trace + def begin_get_vpn_profile_package_url( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[str]: + """Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified + resource group. The profile needs to be generated first using generateVpnProfile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_vpn_profile_package_url_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpn_profile_package_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" + } + + def _get_bgp_peer_status_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.BgpPeerStatusListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.BgpPeerStatusListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_bgp_peer_status_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + peer=peer, + api_version=api_version, + template_url=self._get_bgp_peer_status_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("BgpPeerStatusListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_bgp_peer_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" + } + + @distributed_trace + def begin_get_bgp_peer_status( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: Optional[str] = None, **kwargs: Any + ) -> LROPoller[_models.BgpPeerStatusListResult]: + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword peer: The IP address of the peer to retrieve the status of. Default value is None. + :paramtype peer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BgpPeerStatusListResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BgpPeerStatusListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpPeerStatusListResult] = 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._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + 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): + deserialized = self._deserialize("BgpPeerStatusListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_bgp_peer_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" + } + + @distributed_trace + def supported_vpn_devices(self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any) -> str: + """Gets a xml format representation for supported vpn devices. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :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._api_version or "2023-09-01")) + cls: ClsType[str] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_supported_vpn_devices_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.supported_vpn_devices.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + supported_vpn_devices.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices" + } + + def _get_learned_routes_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[_models.GatewayRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_learned_routes_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_learned_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_learned_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" + } + + @distributed_trace + def begin_get_learned_routes( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[_models.GatewayRouteListResult]: + """This operation retrieves a list of routes the virtual network gateway has learned, including + routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 GatewayRouteListResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.GatewayRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.GatewayRouteListResult] = 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._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_learned_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" + } + + def _get_advertised_routes_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: str, **kwargs: Any + ) -> Optional[_models.GatewayRouteListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.GatewayRouteListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_advertised_routes_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + peer=peer, + api_version=api_version, + template_url=self._get_advertised_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_advertised_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" + } + + @distributed_trace + def begin_get_advertised_routes( + self, resource_group_name: str, virtual_network_gateway_name: str, *, peer: str, **kwargs: Any + ) -> LROPoller[_models.GatewayRouteListResult]: + """This operation retrieves a list of routes the virtual network gateway is advertising to the + specified peer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :keyword peer: The IP address of the peer. Required. + :paramtype peer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayRouteListResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.GatewayRouteListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.GatewayRouteListResult] = 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._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + 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): + deserialized = self._deserialize("GatewayRouteListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_advertised_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" + } + + def _set_vpnclient_ipsec_parameters_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: Union[_models.VpnClientIPsecParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnClientIPsecParameters]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnClientIPsecParameters]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpnclient_ipsec_params, (IOBase, bytes)): + _content = vpnclient_ipsec_params + else: + _json = self._serialize.body(vpnclient_ipsec_params, "VpnClientIPsecParameters") + + request = build_virtual_network_gateways_set_vpnclient_ipsec_parameters_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_vpnclient_ipsec_parameters_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_vpnclient_ipsec_parameters_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" + } + + @overload + def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: _models.VpnClientIPsecParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Required. + :type vpnclient_ipsec_params: ~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters + :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 VpnClientIPsecParameters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Required. + :type vpnclient_ipsec_params: 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 VpnClientIPsecParameters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_vpnclient_ipsec_parameters( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + vpnclient_ipsec_params: Union[_models.VpnClientIPsecParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnClientIPsecParameters]: + """The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of + virtual network gateway in the specified resource group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param vpnclient_ipsec_params: Parameters supplied to the Begin Set vpnclient ipsec parameters + of Virtual Network Gateway P2S client operation through Network resource provider. Is either a + VpnClientIPsecParameters type or a IO type. Required. + :type vpnclient_ipsec_params: ~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters + 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 VpnClientIPsecParameters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnClientIPsecParameters] = 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._set_vpnclient_ipsec_parameters_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + vpnclient_ipsec_params=vpnclient_ipsec_params, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_vpnclient_ipsec_parameters.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" + } + + def _get_vpnclient_ipsec_parameters_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> _models.VpnClientIPsecParameters: + 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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientIPsecParameters] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpnclient_ipsec_parameters_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpnclient_ipsec_parameters_initial.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpnclient_ipsec_parameters_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" + } + + @distributed_trace + def begin_get_vpnclient_ipsec_parameters( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[_models.VpnClientIPsecParameters]: + """The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec + policy for P2S client of virtual network gateway in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The virtual network gateway name. Required. + :type virtual_network_gateway_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 VpnClientIPsecParameters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientIPsecParameters] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientIPsecParameters] = 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._get_vpnclient_ipsec_parameters_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("VpnClientIPsecParameters", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpnclient_ipsec_parameters.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" + } + + @overload + def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VpnDeviceScriptParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnDeviceScriptParameters + :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: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def vpn_device_configuration_script( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnDeviceScriptParameters, IO], + **kwargs: Any + ) -> str: + """Gets a xml format representation for vpn device configuration script. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection for which the configuration script is generated. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the generate vpn device script operation. Is either a + VpnDeviceScriptParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnDeviceScriptParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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, "VpnDeviceScriptParameters") + + request = build_virtual_network_gateways_vpn_device_configuration_script_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.vpn_device_configuration_script.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + vpn_device_configuration_script.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript" + } + + def _start_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnPacketCaptureStartParameters") + else: + _json = None + + request = build_virtual_network_gateways_start_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" + } + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[_models.VpnPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway. Is either a VpnPacketCaptureStartParameters type or a IO type. Default + value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" + } + + def _stop_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnPacketCaptureStopParameters") + + request = build_virtual_network_gateways_stop_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" + } + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: _models.VpnPacketCaptureStopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway. Is either a VpnPacketCaptureStopParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" + } + + def _get_vpnclient_connection_health_initial( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Optional[_models.VpnClientConnectionHealthDetailListResult]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnClientConnectionHealthDetailListResult]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateways_get_vpnclient_connection_health_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_vpnclient_connection_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnClientConnectionHealthDetailListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_vpnclient_connection_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" + } + + @distributed_trace + def begin_get_vpnclient_connection_health( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> LROPoller[_models.VpnClientConnectionHealthDetailListResult]: + """Get VPN client connection health detail per P2S client connection of the virtual network + gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_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 VpnClientConnectionHealthDetailListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnClientConnectionHealthDetailListResult] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnClientConnectionHealthDetailListResult] = 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._get_vpnclient_connection_health_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_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): + deserialized = self._deserialize("VpnClientConnectionHealthDetailListResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_vpnclient_connection_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" + } + + def _disconnect_virtual_network_gateway_vpn_connections_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionRequest") + + request = build_virtual_network_gateways_disconnect_virtual_network_gateway_vpn_connections_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disconnect_virtual_network_gateway_vpn_connections_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _disconnect_virtual_network_gateway_vpn_connections_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" + } + + @overload + def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: _models.P2SVpnConnectionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest + :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: + """ + + @overload + def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Required. + :type request: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_disconnect_virtual_network_gateway_vpn_connections( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect vpn connections of virtual network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network gateway. Required. + :type virtual_network_gateway_name: str + :param request: The parameters are supplied to disconnect vpn connections. Is either a + P2SVpnConnectionRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest 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 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._api_version or "2023-09-01")) + 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._disconnect_virtual_network_gateway_vpn_connections_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disconnect_virtual_network_gateway_vpn_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" + } + + +class VirtualNetworkGatewayConnectionsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_network_gateway_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VirtualNetworkGatewayConnection, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGatewayConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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, "VirtualNetworkGatewayConnection") + + request = build_virtual_network_gateway_connections_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + 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.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VirtualNetworkGatewayConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection + :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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. 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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VirtualNetworkGatewayConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Creates or updates a virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual network gateway + connection operation. Is either a VirtualNetworkGatewayConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection 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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGatewayConnection: + """Gets the specified virtual network gateway connection by resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGatewayConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VirtualNetworkGatewayConnection]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualNetworkGatewayConnection]] = 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, "TagsObject") + + request = build_virtual_network_gateway_connections_update_tags_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. + 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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayConnection]: + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to update virtual network gateway connection tags. Is + either a TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 VirtualNetworkGatewayConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayConnection] = 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_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + } + + def _set_shared_key_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionSharedKey, IO], + **kwargs: Any + ) -> _models.ConnectionSharedKey: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSharedKey] = 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, "ConnectionSharedKey") + + request = build_virtual_network_gateway_connections_set_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._set_shared_key_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _set_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @overload + def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.ConnectionSharedKey, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey + :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 ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. 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 ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_set_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionSharedKey, IO], + **kwargs: Any + ) -> LROPoller[_models.ConnectionSharedKey]: + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection name. + Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the Begin Set Virtual Network Gateway connection + Shared key operation throughNetwork resource provider. Is either a ConnectionSharedKey type or + a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey 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 ConnectionSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSharedKey] = 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._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_set_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @distributed_trace + def get_shared_key( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> _models.ConnectionSharedKey: + """The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the + specified virtual network gateway connection shared key through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection shared + key name. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectionSharedKey or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ConnectionSharedKey + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ConnectionSharedKey] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_shared_key.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetworkGatewayConnection"]: + """The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways + connections created. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkGatewayConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayConnectionListResult] = 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_virtual_network_gateway_connections_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayConnectionListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections" + } + + def _reset_shared_key_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionResetSharedKey, IO], + **kwargs: Any + ) -> Optional[_models.ConnectionResetSharedKey]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ConnectionResetSharedKey]] = 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, "ConnectionResetSharedKey") + + request = build_virtual_network_gateway_connections_reset_shared_key_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_shared_key_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ConnectionResetSharedKey", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_shared_key_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset" + } + + @overload + def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.ConnectionResetSharedKey, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey + :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 ConnectionResetSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. 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 ConnectionResetSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_shared_key( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.ConnectionResetSharedKey, IO], + **kwargs: Any + ) -> LROPoller[_models.ConnectionResetSharedKey]: + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway + connection shared key for passed virtual network gateway connection in the specified resource + group through Network resource provider. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network gateway connection reset + shared key Name. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the begin reset virtual network gateway connection + shared key operation through network resource provider. Is either a ConnectionResetSharedKey + type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey 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 ConnectionResetSharedKey or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ConnectionResetSharedKey] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionResetSharedKey] = 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._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectionResetSharedKey", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_shared_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset" + } + + def _start_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnPacketCaptureStartParameters") + else: + _json = None + + request = build_virtual_network_gateway_connections_start_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture" + } + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[_models.VpnPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Optional[Union[_models.VpnPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to start packet + capture on gateway connection. Is either a VpnPacketCaptureStartParameters type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStartParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture" + } + + def _stop_packet_capture_initial( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = 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, "VpnPacketCaptureStopParameters") + + request = build_virtual_network_gateway_connections_stop_packet_capture_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture" + } + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: _models.VpnPacketCaptureStopParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_packet_capture( + self, + resource_group_name: str, + virtual_network_gateway_connection_name: str, + parameters: Union[_models.VpnPacketCaptureStopParameters, IO], + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on virtual network gateway connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :param parameters: Virtual network gateway packet capture parameters supplied to stop packet + capture on gateway connection. Is either a VpnPacketCaptureStopParameters type or a IO type. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnPacketCaptureStopParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture" + } + + def _get_ike_sas_initial( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_get_ike_sas_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_ike_sas_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_ike_sas_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas" + } + + @distributed_trace + def begin_get_ike_sas( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> LROPoller[str]: + """Lists IKE Security Associations for the virtual network gateway connection in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_ike_sas_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_ike_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas" + } + + def _reset_connection_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_connections_reset_connection_request( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_connection_initial.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 [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, {}) + + _reset_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection" + } + + @distributed_trace + def begin_reset_connection( + self, resource_group_name: str, virtual_network_gateway_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Resets the virtual network gateway connection specified. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the virtual network gateway + Connection. Required. + :type virtual_network_gateway_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._reset_connection_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection" + } + + +class LocalNetworkGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`local_network_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.LocalNetworkGateway, IO], + **kwargs: Any + ) -> _models.LocalNetworkGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, "LocalNetworkGateway") + + request = build_local_network_gateways_create_or_update_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + 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.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: _models.LocalNetworkGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :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 LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + 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 LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.LocalNetworkGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.LocalNetworkGateway]: + """Creates or updates a local network gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local network gateway operation. + Is either a LocalNetworkGateway type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway 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 LocalNetworkGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, + local_network_gateway_name=local_network_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, local_network_gateway_name: str, **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Gets the specified local network gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LocalNetworkGateway] = kwargs.pop("cls", None) + + request = build_local_network_gateways_get_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, local_network_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_local_network_gateways_delete_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, local_network_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + local_network_gateway_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.LocalNetworkGateway: + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network gateway. Required. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to update local network gateway tags. Is either a + TagsObject type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocalNetworkGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LocalNetworkGateway] = 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, "TagsObject") + + request = build_local_network_gateways_update_tags_request( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LocalNetworkGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + } + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.LocalNetworkGateway"]: + """Gets all the local network gateways in a resource group. + + :param resource_group_name: The name of the resource group. 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 LocalNetworkGateway or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.LocalNetworkGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.LocalNetworkGatewayListResult] = 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_local_network_gateways_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LocalNetworkGatewayListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways" + } + + +class VirtualNetworkGatewayNatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_network_gateway_nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> _models.VirtualNetworkGatewayNatRule: + """Retrieves the details of a nat rule. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkGatewayNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_nat_rules_get_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VirtualNetworkGatewayNatRule, IO], + **kwargs: Any + ) -> _models.VirtualNetworkGatewayNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(nat_rule_parameters, (IOBase, bytes)): + _content = nat_rule_parameters + else: + _json = self._serialize.body(nat_rule_parameters, "VirtualNetworkGatewayNatRule") + + request = build_virtual_network_gateway_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + + 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.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: _models.VirtualNetworkGatewayNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + :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 VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_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 VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_network_gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VirtualNetworkGatewayNatRule, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkGatewayNatRule]: + """Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the + existing nat rules. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Is either a + VirtualNetworkGatewayNatRule type or a IO type. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule + 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 VirtualNetworkGatewayNatRule or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkGatewayNatRule] = 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, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_name, + nat_rule_parameters=nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkGatewayNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_gateway_nat_rules_delete_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_network_gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a nat rule. + + :param resource_group_name: The resource group name of the Virtual Network Gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + nat_rule_name=nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def list_by_virtual_network_gateway( + self, resource_group_name: str, virtual_network_gateway_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkGatewayNatRule"]: + """Retrieves all nat rules for a particular virtual network gateway. + + :param resource_group_name: The resource group name of the virtual network gateway. Required. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the gateway. Required. + :type virtual_network_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkGatewayNatRule or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkGatewayNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualNetworkGatewayNatRulesResult] = 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_virtual_network_gateway_nat_rules_list_by_virtual_network_gateway_request( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_virtual_network_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualNetworkGatewayNatRulesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_virtual_network_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules" + } + + +class VirtualNetworkTapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_network_taps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, tap_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_network_taps_delete_request( + resource_group_name=resource_group_name, + tap_name=tap_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified virtual network tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + tap_name=tap_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace + def get(self, resource_group_name: str, tap_name: str, **kwargs: Any) -> _models.VirtualNetworkTap: + """Gets information about the specified virtual network tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of virtual network tap. Required. + :type tap_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) + + request = build_virtual_network_taps_get_request( + resource_group_name=resource_group_name, + tap_name=tap_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, tap_name: str, parameters: Union[_models.VirtualNetworkTap, IO], **kwargs: Any + ) -> _models.VirtualNetworkTap: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = 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, "VirtualNetworkTap") + + request = build_virtual_network_taps_create_or_update_request( + resource_group_name=resource_group_name, + tap_name=tap_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + 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.Network/virtualNetworkTaps/{tapName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + tap_name: str, + parameters: _models.VirtualNetworkTap, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :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 VirtualNetworkTap or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + tap_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + 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 VirtualNetworkTap or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, tap_name: str, parameters: Union[_models.VirtualNetworkTap, IO], **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkTap]: + """Creates or updates a Virtual Network Tap. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the virtual network tap. Required. + :type tap_name: str + :param parameters: Parameters supplied to the create or update virtual network tap operation. + Is either a VirtualNetworkTap type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap 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 VirtualNetworkTap or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = 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, + tap_name=tap_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + tap_name: str, + tap_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Required. + :type tap_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + tap_name: str, + tap_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Required. + :type tap_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, tap_name: str, tap_parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.VirtualNetworkTap: + """Updates an VirtualNetworkTap tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param tap_name: The name of the tap. Required. + :type tap_name: str + :param tap_parameters: Parameters supplied to update VirtualNetworkTap tags. Is either a + TagsObject type or a IO type. Required. + :type tap_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkTap] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(tap_parameters, (IOBase, bytes)): + _content = tap_parameters + else: + _json = self._serialize.body(tap_parameters, "TagsObject") + + request = build_virtual_network_taps_update_tags_request( + resource_group_name=resource_group_name, + tap_name=tap_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkTap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualNetworkTap"]: + """Gets all the VirtualNetworkTaps in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTapListResult] = 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_virtual_network_taps_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTapListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetworkTap"]: + """Gets all the VirtualNetworkTaps in a subscription. + + :param resource_group_name: The name of the resource group. 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 VirtualNetworkTap or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualNetworkTap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualNetworkTapListResult] = 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_virtual_network_taps_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkTapListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps" + } + + +class VirtualRoutersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_routers` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_router_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_routers_delete_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_router_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_router_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualRouter: + """Gets the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualRouter or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouter] = kwargs.pop("cls", None) + + request = build_virtual_routers_get_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: Union[_models.VirtualRouter, IO], + **kwargs: Any + ) -> _models.VirtualRouter: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouter] = 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, "VirtualRouter") + + request = build_virtual_routers_create_or_update_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualRouter", pipeline_response) + + 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.Network/virtualRouters/{virtualRouterName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: _models.VirtualRouter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter + :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 VirtualRouter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. 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 VirtualRouter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + parameters: Union[_models.VirtualRouter, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualRouter]: + """Creates or updates the specified Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param parameters: Parameters supplied to the create or update Virtual Router. Is either a + VirtualRouter type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouter 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 VirtualRouter or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouter] = 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, + virtual_router_name=virtual_router_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualRouter", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualRouter"]: + """Lists all Virtual Routers in a resource group. + + :param resource_group_name: The name of the resource group. 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 VirtualRouter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterListResult] = 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_virtual_routers_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VirtualRouter"]: + """Gets all the Virtual Routers in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualRouter or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouter] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterListResult] = 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_virtual_routers_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters"} + + +class VirtualRouterPeeringsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_router_peerings` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_router_name: str, peering_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_router_peerings_delete_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_router_name: str, peering_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified peering from a Virtual Router. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_router_name: str, peering_name: str, **kwargs: Any + ) -> _models.VirtualRouterPeering: + """Gets the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualRouterPeering or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterPeering] = kwargs.pop("cls", None) + + request = build_virtual_router_peerings_get_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: Union[_models.VirtualRouterPeering, IO], + **kwargs: Any + ) -> _models.VirtualRouterPeering: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouterPeering] = 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, "VirtualRouterPeering") + + request = build_virtual_router_peerings_create_or_update_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + + 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.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: _models.VirtualRouterPeering, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering + :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 VirtualRouterPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. 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 VirtualRouterPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_router_name: str, + peering_name: str, + parameters: Union[_models.VirtualRouterPeering, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualRouterPeering]: + """Creates or updates the specified Virtual Router Peering. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :param peering_name: The name of the Virtual Router Peering. Required. + :type peering_name: str + :param parameters: Parameters supplied to the create or update Virtual Router Peering + operation. Is either a VirtualRouterPeering type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering 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 VirtualRouterPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualRouterPeering] = 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, + virtual_router_name=virtual_router_name, + peering_name=peering_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualRouterPeering", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_router_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualRouterPeering"]: + """Lists all Virtual Router Peerings in a Virtual Router resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param virtual_router_name: The name of the Virtual Router. Required. + :type virtual_router_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualRouterPeering or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualRouterPeering] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualRouterPeeringListResult] = 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_virtual_router_peerings_list_request( + resource_group_name=resource_group_name, + virtual_router_name=virtual_router_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualRouterPeeringListResult", 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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings" + } + + +class VirtualWansOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_wans` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any) -> _models.VirtualWAN: + """Retrieves the details of a VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being retrieved. Required. + :type virtual_wan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + request = build_virtual_wans_get_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.VirtualWAN, IO], + **kwargs: Any + ) -> _models.VirtualWAN: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(wan_parameters, (IOBase, bytes)): + _content = wan_parameters + else: + _json = self._serialize.body(wan_parameters, "VirtualWAN") + + request = build_virtual_wans_create_or_update_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + 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.Network/virtualWans/{VirtualWANName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: _models.VirtualWAN, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :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 VirtualWAN or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Required. + :type wan_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 VirtualWAN or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.VirtualWAN, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualWAN]: + """Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being created or updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to create or update VirtualWAN. Is either a + VirtualWAN type or a IO type. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN 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 VirtualWAN or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = 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, + virtual_wan_name=virtual_wan_name, + wan_parameters=wan_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualWAN", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Required. + :type wan_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + virtual_wan_name: str, + wan_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualWAN: + """Updates a VirtualWAN tags. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being updated. Required. + :type virtual_wan_name: str + :param wan_parameters: Parameters supplied to Update VirtualWAN tags. Is either a TagsObject + type or a IO type. Required. + :type wan_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualWAN or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualWAN + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualWAN] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(wan_parameters, (IOBase, bytes)): + _content = wan_parameters + else: + _json = self._serialize.body(wan_parameters, "TagsObject") + + request = build_virtual_wans_update_tags_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualWAN", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_wan_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_wans_delete_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a VirtualWAN. + + :param resource_group_name: The resource group name of the VirtualWan. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN being deleted. Required. + :type virtual_wan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualWAN"]: + """Lists all the VirtualWANs in a resource group. + + :param resource_group_name: The resource group name of the VirtualWan. 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 VirtualWAN or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualWANsResult] = 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_virtual_wans_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualWANsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VirtualWAN"]: + """Lists all the VirtualWANs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualWAN or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualWAN] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualWANsResult] = 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_virtual_wans_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualWANsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans"} + + +class VpnSitesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_sites` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) -> _models.VpnSite: + """Retrieves the details of a VPN site. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being retrieved. Required. + :type vpn_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + request = build_vpn_sites_get_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.VpnSite, IO], + **kwargs: Any + ) -> _models.VpnSite: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_site_parameters, (IOBase, bytes)): + _content = vpn_site_parameters + else: + _json = self._serialize.body(vpn_site_parameters, "VpnSite") + + request = build_vpn_sites_create_or_update_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnSite", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnSite", pipeline_response) + + 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.Network/vpnSites/{vpnSiteName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: _models.VpnSite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :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 VpnSite or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Required. + :type vpn_site_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 VpnSite or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.VpnSite, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnSite]: + """Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being created or updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to create or update VpnSite. Is either a + VpnSite type or a IO type. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnSite 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 VpnSite or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = 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, + vpn_site_name=vpn_site_name, + vpn_site_parameters=vpn_site_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnSite", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Required. + :type vpn_site_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + vpn_site_name: str, + vpn_site_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VpnSite: + """Updates VpnSite tags. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being updated. Required. + :type vpn_site_name: str + :param vpn_site_parameters: Parameters supplied to update VpnSite tags. Is either a TagsObject + type or a IO type. Required. + :type vpn_site_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSite or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnSite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_site_parameters, (IOBase, bytes)): + _content = vpn_site_parameters + else: + _json = self._serialize.body(vpn_site_parameters, "TagsObject") + + request = build_vpn_sites_update_tags_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSite", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vpn_site_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_sites_delete_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, vpn_site_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a VpnSite. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite being deleted. Required. + :type vpn_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VpnSite"]: + """Lists all the vpnSites in a resource group. + + :param resource_group_name: The resource group name of the VpnSite. 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 VpnSite or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSitesResult] = 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_vpn_sites_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSitesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VpnSite"]: + """Lists all the VpnSites in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSite or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSite] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSitesResult] = 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_vpn_sites_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSitesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites"} + + +class VpnSiteLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_site_links` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, vpn_site_name: str, vpn_site_link_name: str, **kwargs: Any + ) -> _models.VpnSiteLink: + """Retrieves the details of a VPN site link. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite. Required. + :type vpn_site_name: str + :param vpn_site_link_name: The name of the VpnSiteLink being retrieved. Required. + :type vpn_site_link_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSiteLink or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSiteLink + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSiteLink] = kwargs.pop("cls", None) + + request = build_vpn_site_links_get_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + vpn_site_link_name=vpn_site_link_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSiteLink", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}" + } + + @distributed_trace + def list_by_vpn_site( + self, resource_group_name: str, vpn_site_name: str, **kwargs: Any + ) -> Iterable["_models.VpnSiteLink"]: + """Lists all the vpnSiteLinks in a resource group for a vpn site. + + :param resource_group_name: The resource group name of the VpnSite. Required. + :type resource_group_name: str + :param vpn_site_name: The name of the VpnSite. Required. + :type vpn_site_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSiteLink or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSiteLink] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSiteLinksResult] = 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_vpn_site_links_list_by_vpn_site_request( + resource_group_name=resource_group_name, + vpn_site_name=vpn_site_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_site.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSiteLinksResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_vpn_site.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks" + } + + +class VpnSitesConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_sites_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _download_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + virtual_wan_name: str, + request: Union[_models.GetVpnSitesConfigurationRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "GetVpnSitesConfigurationRequest") + + request = build_vpn_sites_configuration_download_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._download_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _download_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" + } + + @overload + def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: _models.GetVpnSitesConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GetVpnSitesConfigurationRequest + :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: + """ + + @overload + def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Required. + :type request: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_download( + self, + resource_group_name: str, + virtual_wan_name: str, + request: Union[_models.GetVpnSitesConfigurationRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Gives the sas-url to download the configurations for vpn-sites in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN for which configuration of all vpn-sites is + needed. Required. + :type virtual_wan_name: str + :param request: Parameters supplied to download vpn-sites configuration. Is either a + GetVpnSitesConfigurationRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.GetVpnSitesConfigurationRequest 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 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._api_version or "2023-09-01")) + 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._download_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_download.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" + } + + +class VpnServerConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_server_configurations` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Retrieves the details of a VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being retrieved. + Required. + :type vpn_server_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_get_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.VpnServerConfiguration, IO], + **kwargs: Any + ) -> _models.VpnServerConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_parameters + else: + _json = self._serialize.body(vpn_server_configuration_parameters, "VpnServerConfiguration") + + request = build_vpn_server_configurations_create_or_update_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: _models.VpnServerConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Required. + :type vpn_server_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :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 VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Required. + :type vpn_server_configuration_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 VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.VpnServerConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfiguration]: + """Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing + VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being created or + updated. Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to create or update + VpnServerConfiguration. Is either a VpnServerConfiguration type or a IO type. Required. + :type vpn_server_configuration_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration 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 VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = 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, + vpn_server_configuration_name=vpn_server_configuration_name, + vpn_server_configuration_parameters=vpn_server_configuration_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Required. + :type vpn_server_configuration_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Required. + :type vpn_server_configuration_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + vpn_server_configuration_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VpnServerConfiguration: + """Updates VpnServerConfiguration tags. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being updated. + Required. + :type vpn_server_configuration_name: str + :param vpn_server_configuration_parameters: Parameters supplied to update + VpnServerConfiguration tags. Is either a TagsObject type or a IO type. Required. + :type vpn_server_configuration_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_parameters + else: + _json = self._serialize.body(vpn_server_configuration_parameters, "TagsObject") + + request = build_vpn_server_configurations_update_tags_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vpn_server_configuration_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_delete_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a VpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration being deleted. + Required. + :type vpn_server_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.VpnServerConfiguration"]: + """Lists all the vpnServerConfigurations in a resource group. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. 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 VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationsResult] = 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_vpn_server_configurations_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VpnServerConfiguration"]: + """Lists all the VpnServerConfigurations in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnServerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationsResult] = 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_vpn_server_configurations_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations"} + + +class ConfigurationPolicyGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`configuration_policy_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: Union[_models.VpnServerConfigurationPolicyGroup, IO], + **kwargs: Any + ) -> _models.VpnServerConfigurationPolicyGroup: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_server_configuration_policy_group_parameters, (IOBase, bytes)): + _content = vpn_server_configuration_policy_group_parameters + else: + _json = self._serialize.body( + vpn_server_configuration_policy_group_parameters, "VpnServerConfigurationPolicyGroup" + ) + + request = build_configuration_policy_groups_create_or_update_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + 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.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: _models.VpnServerConfigurationPolicyGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Required. + :type vpn_server_configuration_policy_group_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup + :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 VpnServerConfigurationPolicyGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Required. + :type vpn_server_configuration_policy_group_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 VpnServerConfigurationPolicyGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + vpn_server_configuration_policy_group_parameters: Union[_models.VpnServerConfigurationPolicyGroup, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnServerConfigurationPolicyGroup]: + """Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :param vpn_server_configuration_policy_group_parameters: Parameters supplied to create or + update a VpnServerConfiguration PolicyGroup. Is either a VpnServerConfigurationPolicyGroup type + or a IO type. Required. + :type vpn_server_configuration_policy_group_parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup 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 VpnServerConfigurationPolicyGroup or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = 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, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_name, + vpn_server_configuration_policy_group_parameters=vpn_server_configuration_policy_group_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_configuration_policy_groups_delete_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a ConfigurationPolicyGroup. + + :param resource_group_name: The resource group name of the ConfigurationPolicyGroup. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup. Required. + :type configuration_policy_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + vpn_server_configuration_name: str, + configuration_policy_group_name: str, + **kwargs: Any + ) -> _models.VpnServerConfigurationPolicyGroup: + """Retrieves the details of a ConfigurationPolicyGroup. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :param configuration_policy_group_name: The name of the ConfigurationPolicyGroup being + retrieved. Required. + :type configuration_policy_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnServerConfigurationPolicyGroup or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfigurationPolicyGroup] = kwargs.pop("cls", None) + + request = build_configuration_policy_groups_get_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + configuration_policy_group_name=configuration_policy_group_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnServerConfigurationPolicyGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + } + + @distributed_trace + def list_by_vpn_server_configuration( + self, resource_group_name: str, vpn_server_configuration_name: str, **kwargs: Any + ) -> Iterable["_models.VpnServerConfigurationPolicyGroup"]: + """Lists all the configurationPolicyGroups in a resource group for a vpnServerConfiguration. + + :param resource_group_name: The resource group name of the VpnServerConfiguration. Required. + :type resource_group_name: str + :param vpn_server_configuration_name: The name of the VpnServerConfiguration. Required. + :type vpn_server_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnServerConfigurationPolicyGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationPolicyGroup] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnServerConfigurationPolicyGroupsResult] = 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_configuration_policy_groups_list_by_vpn_server_configuration_request( + resource_group_name=resource_group_name, + vpn_server_configuration_name=vpn_server_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_server_configuration.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnServerConfigurationPolicyGroupsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_vpn_server_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups" + } + + +class VirtualHubsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_hubs` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> _models.VirtualHub: + """Retrieves the details of a VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + request = build_virtual_hubs_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.VirtualHub, IO], + **kwargs: Any + ) -> _models.VirtualHub: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_parameters, (IOBase, bytes)): + _content = virtual_hub_parameters + else: + _json = self._serialize.body(virtual_hub_parameters, "VirtualHub") + + request = build_virtual_hubs_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualHub", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: _models.VirtualHub, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :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 VirtualHub or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Required. + :type virtual_hub_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 VirtualHub or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.VirtualHub, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualHub]: + """Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to create or update VirtualHub. Is either a + VirtualHub type or a IO type. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.VirtualHub 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 VirtualHub or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = 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, + virtual_hub_name=virtual_hub_name, + virtual_hub_parameters=virtual_hub_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHub", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Required. + :type virtual_hub_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + virtual_hub_name: str, + virtual_hub_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.VirtualHub: + """Updates VirtualHub tags. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param virtual_hub_parameters: Parameters supplied to update VirtualHub tags. Is either a + TagsObject type or a IO type. Required. + :type virtual_hub_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHub or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHub + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHub] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_parameters, (IOBase, bytes)): + _content = virtual_hub_parameters + else: + _json = self._serialize.body(virtual_hub_parameters, "TagsObject") + + request = build_virtual_hubs_update_tags_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHub", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hubs_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualHub"]: + """Lists all the VirtualHubs in a resource group. + + :param resource_group_name: The resource group name of the VirtualHub. 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 VirtualHub or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubsResult] = 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_virtual_hubs_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VirtualHub"]: + """Lists all the VirtualHubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualHub or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHub] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubsResult] = 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_virtual_hubs_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs"} + + def _get_effective_virtual_hub_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[Union[_models.EffectiveRoutesParameters, IO]] = None, + **kwargs: Any + ) -> Optional[_models.VirtualHubEffectiveRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VirtualHubEffectiveRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(effective_routes_parameters, (IOBase, bytes)): + _content = effective_routes_parameters + else: + if effective_routes_parameters is not None: + _json = self._serialize.body(effective_routes_parameters, "EffectiveRoutesParameters") + else: + _json = None + + request = build_virtual_hubs_get_effective_virtual_hub_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_effective_virtual_hub_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VirtualHubEffectiveRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_effective_virtual_hub_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes" + } + + @overload + def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[_models.EffectiveRoutesParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Default value is None. + :type effective_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.EffectiveRoutesParameters + :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 VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Default value is None. + :type effective_routes_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 VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_effective_virtual_hub_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + effective_routes_parameters: Optional[Union[_models.EffectiveRoutesParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualHubEffectiveRouteList]: + """Gets the effective routes configured for the Virtual Hub resource or the specified resource . + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param effective_routes_parameters: Parameters supplied to get the effective routes for a + specific resource. Is either a EffectiveRoutesParameters type or a IO type. Default value is + None. + :type effective_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.EffectiveRoutesParameters 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 VirtualHubEffectiveRouteList or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubEffectiveRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubEffectiveRouteList] = 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._get_effective_virtual_hub_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + effective_routes_parameters=effective_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHubEffectiveRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_effective_virtual_hub_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes" + } + + def _get_inbound_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: Union[_models.GetInboundRoutesParameters, IO], + **kwargs: Any + ) -> Optional[_models.EffectiveRouteMapRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(get_inbound_routes_parameters, (IOBase, bytes)): + _content = get_inbound_routes_parameters + else: + _json = self._serialize.body(get_inbound_routes_parameters, "GetInboundRoutesParameters") + + request = build_virtual_hubs_get_inbound_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_inbound_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_inbound_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes" + } + + @overload + def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: _models.GetInboundRoutesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Required. + :type get_inbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetInboundRoutesParameters + :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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Required. + :type get_inbound_routes_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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_inbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_inbound_routes_parameters: Union[_models.GetInboundRoutesParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the inbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_inbound_routes_parameters: Parameters supplied to get the inbound routes for a + connection resource. Is either a GetInboundRoutesParameters type or a IO type. Required. + :type get_inbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetInboundRoutesParameters 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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EffectiveRouteMapRouteList] = 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._get_inbound_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + get_inbound_routes_parameters=get_inbound_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_inbound_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes" + } + + def _get_outbound_routes_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: Union[_models.GetOutboundRoutesParameters, IO], + **kwargs: Any + ) -> Optional[_models.EffectiveRouteMapRouteList]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.EffectiveRouteMapRouteList]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(get_outbound_routes_parameters, (IOBase, bytes)): + _content = get_outbound_routes_parameters + else: + _json = self._serialize.body(get_outbound_routes_parameters, "GetOutboundRoutesParameters") + + request = build_virtual_hubs_get_outbound_routes_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_outbound_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_outbound_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes" + } + + @overload + def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: _models.GetOutboundRoutesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Required. + :type get_outbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetOutboundRoutesParameters + :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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Required. + :type get_outbound_routes_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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_outbound_routes( + self, + resource_group_name: str, + virtual_hub_name: str, + get_outbound_routes_parameters: Union[_models.GetOutboundRoutesParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.EffectiveRouteMapRouteList]: + """Gets the outbound routes configured for the Virtual Hub on a particular connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param get_outbound_routes_parameters: Parameters supplied to get the outbound routes for a + connection resource. Is either a GetOutboundRoutesParameters type or a IO type. Required. + :type get_outbound_routes_parameters: + ~azure.mgmt.network.v2023_09_01.models.GetOutboundRoutesParameters 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 EffectiveRouteMapRouteList or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.EffectiveRouteMapRouteList] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EffectiveRouteMapRouteList] = 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._get_outbound_routes_initial( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + get_outbound_routes_parameters=get_outbound_routes_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EffectiveRouteMapRouteList", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_outbound_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes" + } + + +class RouteMapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`route_maps` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, route_map_name: str, **kwargs: Any + ) -> _models.RouteMap: + """Retrieves the details of a RouteMap. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteMap or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RouteMap + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) + + request = build_route_maps_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RouteMap", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: Union[_models.RouteMap, IO], + **kwargs: Any + ) -> _models.RouteMap: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteMap] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_map_parameters, (IOBase, bytes)): + _content = route_map_parameters + else: + _json = self._serialize.body(route_map_parameters, "RouteMap") + + request = build_route_maps_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RouteMap", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RouteMap", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: _models.RouteMap, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Required. + :type route_map_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteMap + :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 RouteMap or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Required. + :type route_map_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 RouteMap or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_map_name: str, + route_map_parameters: Union[_models.RouteMap, IO], + **kwargs: Any + ) -> LROPoller[_models.RouteMap]: + """Creates a RouteMap if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :param route_map_parameters: Parameters supplied to create or update a RouteMap. Is either a + RouteMap type or a IO type. Required. + :type route_map_parameters: ~azure.mgmt.network.v2023_09_01.models.RouteMap 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 RouteMap or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RouteMap] = 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, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_name, + route_map_parameters=route_map_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RouteMap", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_map_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_route_maps_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_map_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a RouteMap. + + :param resource_group_name: The resource group name of the RouteMap's resource group. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :param route_map_name: The name of the RouteMap. Required. + :type route_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_map_name=route_map_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + } + + @distributed_trace + def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> Iterable["_models.RouteMap"]: + """Retrieves the details of all RouteMaps. + + :param resource_group_name: The resource group name of the RouteMap's resource group'. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub containing the RouteMap. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RouteMap or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RouteMap] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListRouteMapsResult] = 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_route_maps_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListRouteMapsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps" + } + + +class HubVirtualNetworkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`hub_virtual_network_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: Union[_models.HubVirtualNetworkConnection, IO], + **kwargs: Any + ) -> _models.HubVirtualNetworkConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hub_virtual_network_connection_parameters, (IOBase, bytes)): + _content = hub_virtual_network_connection_parameters + else: + _json = self._serialize.body(hub_virtual_network_connection_parameters, "HubVirtualNetworkConnection") + + request = build_hub_virtual_network_connections_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: _models.HubVirtualNetworkConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Required. + :type hub_virtual_network_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection + :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 HubVirtualNetworkConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Required. + :type hub_virtual_network_connection_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 HubVirtualNetworkConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + hub_virtual_network_connection_parameters: Union[_models.HubVirtualNetworkConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.HubVirtualNetworkConnection]: + """Creates a hub virtual network connection if it doesn't exist else updates the existing one. + + :param resource_group_name: The resource group name of the HubVirtualNetworkConnection. + Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :param hub_virtual_network_connection_parameters: Parameters supplied to create or update a hub + virtual network connection. Is either a HubVirtualNetworkConnection type or a IO type. + Required. + :type hub_virtual_network_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection 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 HubVirtualNetworkConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubVirtualNetworkConnection] = 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + hub_virtual_network_connection_parameters=hub_virtual_network_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_hub_virtual_network_connections_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a HubVirtualNetworkConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the HubVirtualNetworkConnection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> _models.HubVirtualNetworkConnection: + """Retrieves the details of a HubVirtualNetworkConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubVirtualNetworkConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubVirtualNetworkConnection] = kwargs.pop("cls", None) + + request = build_hub_virtual_network_connections_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubVirtualNetworkConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> Iterable["_models.HubVirtualNetworkConnection"]: + """Retrieves the details of all HubVirtualNetworkConnections. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubVirtualNetworkConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.HubVirtualNetworkConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListHubVirtualNetworkConnectionsResult] = 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_hub_virtual_network_connections_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListHubVirtualNetworkConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections" + } + + +class VpnGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.VpnGateway: + """Retrieves the details of a virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) + + request = build_vpn_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.VpnGateway, IO], + **kwargs: Any + ) -> _models.VpnGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_gateway_parameters, (IOBase, bytes)): + _content = vpn_gateway_parameters + else: + _json = self._serialize.body(vpn_gateway_parameters, "VpnGateway") + + request = build_vpn_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: _models.VpnGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGateway + :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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Required. + :type vpn_gateway_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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.VpnGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan vpn + gateway. Is either a VpnGateway type or a IO type. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGateway 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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = 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, + gateway_name=gateway_name, + vpn_gateway_parameters=vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.VpnGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_gateway_parameters, (IOBase, bytes)): + _content = vpn_gateway_parameters + else: + _json = self._serialize.body(vpn_gateway_parameters, "TagsObject") + + request = build_vpn_gateways_update_tags_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. + Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. + Required. + :type vpn_gateway_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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Updates virtual wan vpn gateway tags. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_gateway_parameters: Parameters supplied to update a virtual wan vpn gateway tags. Is + either a TagsObject type or a IO type. Required. + :type vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_gateway_parameters=vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + } + + def _reset_initial( + self, resource_group_name: str, gateway_name: str, *, ip_configuration_id: Optional[str] = None, **kwargs: Any + ) -> Optional[_models.VpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnGateway]] = kwargs.pop("cls", None) + + request = build_vpn_gateways_reset_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + ip_configuration_id=ip_configuration_id, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset" + } + + @distributed_trace + def begin_reset( + self, resource_group_name: str, gateway_name: str, *, ip_configuration_id: Optional[str] = None, **kwargs: Any + ) -> LROPoller[_models.VpnGateway]: + """Resets the primary of the vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword ip_configuration_id: VpnGateway ipConfigurationId to specify the gateway instance. + Default value is None. + :paramtype ip_configuration_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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + ip_configuration_id=ip_configuration_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset" + } + + def _start_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnGatewayPacketCaptureStartParameters") + else: + _json = None + + request = build_vpn_gateways_start_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture" + } + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[_models.VpnGatewayPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to start packet capture on + vpn gateway. Is either a VpnGatewayPacketCaptureStartParameters type or a IO type. Default + value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStartParameters + 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture" + } + + def _stop_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnGatewayPacketCaptureStopParameters") + else: + _json = None + + request = build_vpn_gateways_stop_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture" + } + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[_models.VpnGatewayPacketCaptureStopParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Default value is None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + parameters: Optional[Union[_models.VpnGatewayPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param parameters: Vpn gateway packet capture parameters supplied to stop packet capture on vpn + gateway. Is either a VpnGatewayPacketCaptureStopParameters type or a IO type. Default value is + None. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayPacketCaptureStopParameters + 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VpnGateway"]: + """Lists all the VpnGateways in a resource group. + + :param resource_group_name: The resource group name of the VpnGateway. 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 VpnGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewaysResult] = 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_vpn_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.VpnGateway"]: + """Lists all the VpnGateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewaysResult] = 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_vpn_gateways_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways"} + + +class VpnLinkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_link_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _reset_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_link_connections_reset_connection_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_connection_initial.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 [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, {}) + + _reset_connection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" + } + + @distributed_trace + def begin_reset_connection( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Resets the VpnLink connection specified. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn link connection. Required. + :type link_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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._reset_connection_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" + } + + def _get_ike_sas_initial( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> Optional[str]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + request = build_vpn_link_connections_get_ike_sas_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_ike_sas_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_ike_sas_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" + } + + @distributed_trace + def begin_get_ike_sas( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> LROPoller[str]: + """Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn link connection. Required. + :type link_connection_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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :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._api_version or "2023-09-01")) + cls: ClsType[str] = 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._get_ike_sas_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_connection_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): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_ike_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" + } + + @distributed_trace + def list_by_vpn_connection( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> Iterable["_models.VpnSiteLinkConnection"]: + """Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn + connection. + + :param resource_group_name: The resource group name of the vpn gateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnSiteLinkConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnSiteLinkConnectionsResult] = 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_vpn_link_connections_list_by_vpn_connection_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_connection.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnSiteLinkConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_vpn_connection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections" + } + + +class VpnConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.VpnConnection: + """Retrieves the details of a vpn connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) + + request = build_vpn_connections_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: Union[_models.VpnConnection, IO], + **kwargs: Any + ) -> _models.VpnConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vpn_connection_parameters, (IOBase, bytes)): + _content = vpn_connection_parameters + else: + _json = self._serialize.body(vpn_connection_parameters, "VpnConnection") + + request = build_vpn_connections_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnConnection", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: _models.VpnConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. + Required. + :type vpn_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnConnection + :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 VpnConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. + Required. + :type vpn_connection_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 VpnConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + vpn_connection_parameters: Union[_models.VpnConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnConnection]: + """Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the + existing connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param vpn_connection_parameters: Parameters supplied to create or Update a VPN Connection. Is + either a VpnConnection type or a IO type. Required. + :type vpn_connection_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnConnection 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 VpnConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnConnection] = 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, + gateway_name=gateway_name, + connection_name=connection_name, + vpn_connection_parameters=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_vpn_connections_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, gateway_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a vpn connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + } + + def _start_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnConnectionPacketCaptureStartParameters") + else: + _json = None + + request = build_vpn_connections_start_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture" + } + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[_models.VpnConnectionPacketCaptureStartParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStartParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStartParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Starts packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to start packet capture on + gateway connection. Is either a VpnConnectionPacketCaptureStartParameters type or a IO type. + Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStartParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._start_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture" + } + + def _stop_packet_capture_initial( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> Optional[str]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VpnConnectionPacketCaptureStopParameters") + else: + _json = None + + request = build_vpn_connections_stop_packet_capture_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_packet_capture_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_packet_capture_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture" + } + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[_models.VpnConnectionPacketCaptureStopParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStopParameters + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Default value is None. + :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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_packet_capture( + self, + resource_group_name: str, + gateway_name: str, + vpn_connection_name: str, + parameters: Optional[Union[_models.VpnConnectionPacketCaptureStopParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[str]: + """Stops packet capture on Vpn connection in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param vpn_connection_name: The name of the vpn connection. Required. + :type vpn_connection_name: str + :param parameters: Vpn Connection packet capture parameters supplied to stop packet capture on + gateway connection. Is either a VpnConnectionPacketCaptureStopParameters type or a IO type. + Default value is None. + :type parameters: + ~azure.mgmt.network.v2023_09_01.models.VpnConnectionPacketCaptureStopParameters 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 str or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[str] = 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._stop_packet_capture_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + vpn_connection_name=vpn_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("str", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_packet_capture.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture" + } + + @distributed_trace + def list_by_vpn_gateway( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.VpnConnection"]: + """Retrieves all vpn connections for a particular virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnConnection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnConnectionsResult] = 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_vpn_connections_list_by_vpn_gateway_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnConnectionsResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_vpn_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections" + } + + +class VpnSiteLinkConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_site_link_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, + resource_group_name: str, + gateway_name: str, + connection_name: str, + link_connection_name: str, + **kwargs: Any + ) -> _models.VpnSiteLinkConnection: + """Retrieves the details of a vpn site link connection. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param connection_name: The name of the vpn connection. Required. + :type connection_name: str + :param link_connection_name: The name of the vpn connection. Required. + :type link_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnSiteLinkConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnSiteLinkConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnSiteLinkConnection] = kwargs.pop("cls", None) + + request = build_vpn_site_link_connections_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + connection_name=connection_name, + link_connection_name=link_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnSiteLinkConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}" + } + + +class NatRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`nat_rules` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> _models.VpnGatewayNatRule: + """Retrieves the details of a nat ruleGet. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VpnGatewayNatRule or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) + + request = build_nat_rules_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VpnGatewayNatRule, IO], + **kwargs: Any + ) -> _models.VpnGatewayNatRule: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGatewayNatRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(nat_rule_parameters, (IOBase, bytes)): + _content = nat_rule_parameters + else: + _json = self._serialize.body(nat_rule_parameters, "VpnGatewayNatRule") + + request = build_nat_rules_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + + 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.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: _models.VpnGatewayNatRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule + :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 VpnGatewayNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Required. + :type nat_rule_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 VpnGatewayNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + nat_rule_name: str, + nat_rule_parameters: Union[_models.VpnGatewayNatRule, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnGatewayNatRule]: + """Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat + rules. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :param nat_rule_parameters: Parameters supplied to create or Update a Nat Rule. Is either a + VpnGatewayNatRule type or a IO type. Required. + :type nat_rule_parameters: ~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule 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 VpnGatewayNatRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnGatewayNatRule] = 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, + gateway_name=gateway_name, + nat_rule_name=nat_rule_name, + nat_rule_parameters=nat_rule_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnGatewayNatRule", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_name: str, nat_rule_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_nat_rules_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, gateway_name: str, nat_rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a nat rule. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param nat_rule_name: The name of the nat rule. Required. + :type nat_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + nat_rule_name=nat_rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + } + + @distributed_trace + def list_by_vpn_gateway( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Iterable["_models.VpnGatewayNatRule"]: + """Retrieves all nat rules for a particular virtual wan vpn gateway. + + :param resource_group_name: The resource group name of the VpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VpnGatewayNatRule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VpnGatewayNatRule] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVpnGatewayNatRulesResult] = 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_nat_rules_list_by_vpn_gateway_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_vpn_gateway.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVpnGatewayNatRulesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_vpn_gateway.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules" + } + + +class P2SVpnGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`p2_svpn_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.P2SVpnGateway: + """Retrieves the details of a virtual wan p2s vpn gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: P2SVpnGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.P2SVpnGateway, IO], + **kwargs: Any + ) -> _models.P2SVpnGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(p2_s_vpn_gateway_parameters, (IOBase, bytes)): + _content = p2_s_vpn_gateway_parameters + else: + _json = self._serialize.body(p2_s_vpn_gateway_parameters, "P2SVpnGateway") + + request = build_p2_svpn_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + 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.Network/p2svpnGateways/{gatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: _models.P2SVpnGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway + :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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Required. + :type p2_s_vpn_gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.P2SVpnGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to create or Update a virtual wan p2s + vpn gateway. Is either a P2SVpnGateway type or a IO type. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway 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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = 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, + gateway_name=gateway_name, + p2_s_vpn_gateway_parameters=p2_s_vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(p2_s_vpn_gateway_parameters, (IOBase, bytes)): + _content = p2_s_vpn_gateway_parameters + else: + _json = self._serialize.body(p2_s_vpn_gateway_parameters, "TagsObject") + + request = build_p2_svpn_gateways_update_tags_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Required. + :type p2_s_vpn_gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + gateway_name: str, + p2_s_vpn_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Updates virtual wan p2s vpn gateway tags. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :param p2_s_vpn_gateway_parameters: Parameters supplied to update a virtual wan p2s vpn gateway + tags. Is either a TagsObject type or a IO type. Required. + :type p2_s_vpn_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + p2_s_vpn_gateway_parameters=p2_s_vpn_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a virtual wan p2s vpn gateway. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.P2SVpnGateway"]: + """Lists all the P2SVpnGateways in a resource group. + + :param resource_group_name: The resource group name of the P2SVpnGateway. 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 P2SVpnGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListP2SVpnGatewaysResult] = 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_p2_svpn_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListP2SVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways" + } + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.P2SVpnGateway"]: + """Lists all the P2SVpnGateways in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either P2SVpnGateway or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListP2SVpnGatewaysResult] = 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_p2_svpn_gateways_list_request( + 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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListP2SVpnGatewaysResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways"} + + def _reset_initial( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_reset_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reset_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset" + } + + @distributed_trace + def begin_reset( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Resets the primary of the p2s vpn gateway in the specified resource group. + + :param resource_group_name: The resource group name of the P2SVpnGateway. Required. + :type resource_group_name: str + :param gateway_name: The name of the gateway. Required. + :type gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = 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._reset_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset" + } + + def _generate_vpn_profile_initial( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.P2SVpnProfileParameters, IO], + **kwargs: Any + ) -> Optional[_models.VpnProfileResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.VpnProfileResponse]] = 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, "P2SVpnProfileParameters") + + request = build_p2_svpn_gateways_generate_vpn_profile_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_vpn_profile_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _generate_vpn_profile_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile" + } + + @overload + def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: _models.P2SVpnProfileParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnProfileParameters + :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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. 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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_vpn_profile( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.P2SVpnProfileParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.VpnProfileResponse]: + """Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the generate P2SVpnGateway VPN client package + operation. Is either a P2SVpnProfileParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.P2SVpnProfileParameters 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 VpnProfileResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnProfileResponse] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VpnProfileResponse] = 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._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VpnProfileResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_vpn_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile" + } + + def _get_p2_s_vpn_connection_health_initial( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> Optional[_models.P2SVpnGateway]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.P2SVpnGateway]] = kwargs.pop("cls", None) + + request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._get_p2_s_vpn_connection_health_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_p2_s_vpn_connection_health_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth" + } + + @distributed_trace + def begin_get_p2_s_vpn_connection_health( + self, resource_group_name: str, gateway_name: str, **kwargs: Any + ) -> LROPoller[_models.P2SVpnGateway]: + """Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_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 P2SVpnGateway or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnGateway] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.P2SVpnGateway] = 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._get_p2_s_vpn_connection_health_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_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): + deserialized = self._deserialize("P2SVpnGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_p2_s_vpn_connection_health.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth" + } + + def _get_p2_s_vpn_connection_health_detailed_initial( + self, + resource_group_name: str, + gateway_name: str, + request: Union[_models.P2SVpnConnectionHealthRequest, IO], + **kwargs: Any + ) -> Optional[_models.P2SVpnConnectionHealth]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.P2SVpnConnectionHealth]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionHealthRequest") + + request = build_p2_svpn_gateways_get_p2_s_vpn_connection_health_detailed_request( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._get_p2_s_vpn_connection_health_detailed_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("P2SVpnConnectionHealth", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_p2_s_vpn_connection_health_detailed_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed" + } + + @overload + def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: _models.P2SVpnConnectionHealthRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. + Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealthRequest + :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 P2SVpnConnectionHealth or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. + Required. + :type request: 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 P2SVpnConnectionHealth or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_get_p2_s_vpn_connection_health_detailed( + self, + resource_group_name: str, + gateway_name: str, + request: Union[_models.P2SVpnConnectionHealthRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.P2SVpnConnectionHealth]: + """Gets the sas url to get the connection health detail of P2S clients of the virtual wan + P2SVpnGateway in the specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param gateway_name: The name of the P2SVpnGateway. Required. + :type gateway_name: str + :param request: Request parameters supplied to get p2s vpn connections detailed health. Is + either a P2SVpnConnectionHealthRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealthRequest 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 P2SVpnConnectionHealth or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionHealth] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.P2SVpnConnectionHealth] = 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._get_p2_s_vpn_connection_health_detailed_initial( + resource_group_name=resource_group_name, + gateway_name=gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("P2SVpnConnectionHealth", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_get_p2_s_vpn_connection_health_detailed.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed" + } + + def _disconnect_p2_s_vpn_connections_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + 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(request, (IOBase, bytes)): + _content = request + else: + _json = self._serialize.body(request, "P2SVpnConnectionRequest") + + request = build_p2_svpn_gateways_disconnect_p2_s_vpn_connections_request( + resource_group_name=resource_group_name, + p2_s_vpn_gateway_name=p2_s_vpn_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._disconnect_p2_s_vpn_connections_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _disconnect_p2_s_vpn_connections_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections" + } + + @overload + def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: _models.P2SVpnConnectionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest + :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: + """ + + @overload + def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Required. + :type request: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_disconnect_p2_s_vpn_connections( + self, + resource_group_name: str, + p2_s_vpn_gateway_name: str, + request: Union[_models.P2SVpnConnectionRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param p2_s_vpn_gateway_name: The name of the P2S Vpn Gateway. Required. + :type p2_s_vpn_gateway_name: str + :param request: The parameters are supplied to disconnect p2s vpn connections. Is either a + P2SVpnConnectionRequest type or a IO type. Required. + :type request: ~azure.mgmt.network.v2023_09_01.models.P2SVpnConnectionRequest 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 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._api_version or "2023-09-01")) + 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._disconnect_p2_s_vpn_connections_initial( # type: ignore + resource_group_name=resource_group_name, + p2_s_vpn_gateway_name=p2_s_vpn_gateway_name, + request=request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disconnect_p2_s_vpn_connections.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections" + } + + +class VpnServerConfigurationsAssociatedWithVirtualWanOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`vpn_server_configurations_associated_with_virtual_wan` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _list_initial( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> Optional[_models.VpnServerConfigurationsResponse]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[_models.VpnServerConfigurationsResponse]] = kwargs.pop("cls", None) + + request = build_vpn_server_configurations_associated_with_virtual_wan_list_request( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("VpnServerConfigurationsResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations" + } + + @distributed_trace + def begin_list( + self, resource_group_name: str, virtual_wan_name: str, **kwargs: Any + ) -> LROPoller[_models.VpnServerConfigurationsResponse]: + """Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. + + :param resource_group_name: The resource group name. Required. + :type resource_group_name: str + :param virtual_wan_name: The name of the VirtualWAN whose associated VpnServerConfigurations is + needed. Required. + :type virtual_wan_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 VpnServerConfigurationsResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VpnServerConfigurationsResponse] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VpnServerConfigurationsResponse] = 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._list_initial( + resource_group_name=resource_group_name, + virtual_wan_name=virtual_wan_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): + deserialized = self._deserialize("VpnServerConfigurationsResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations" + } + + +class VirtualHubRouteTableV2SOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_hub_route_table_v2_s` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> _models.VirtualHubRouteTableV2: + """Retrieves the details of a VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHubRouteTableV2. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualHubRouteTableV2 or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 + :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._api_version or "2023-09-01")) + cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) + + request = build_virtual_hub_route_table_v2_s_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: Union[_models.VirtualHubRouteTableV2, IO], + **kwargs: Any + ) -> _models.VirtualHubRouteTableV2: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubRouteTableV2] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(virtual_hub_route_table_v2_parameters, (IOBase, bytes)): + _content = virtual_hub_route_table_v2_parameters + else: + _json = self._serialize.body(virtual_hub_route_table_v2_parameters, "VirtualHubRouteTableV2") + + request = build_virtual_hub_route_table_v2_s_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: _models.VirtualHubRouteTableV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Required. + :type virtual_hub_route_table_v2_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 + :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 VirtualHubRouteTableV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Required. + :type virtual_hub_route_table_v2_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 VirtualHubRouteTableV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + virtual_hub_route_table_v2_parameters: Union[_models.VirtualHubRouteTableV2, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualHubRouteTableV2]: + """Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing + VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :param virtual_hub_route_table_v2_parameters: Parameters supplied to create or update + VirtualHubRouteTableV2. Is either a VirtualHubRouteTableV2 type or a IO type. Required. + :type virtual_hub_route_table_v2_parameters: + ~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2 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 VirtualHubRouteTableV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualHubRouteTableV2] = 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + virtual_hub_route_table_v2_parameters=virtual_hub_route_table_v2_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualHubRouteTableV2", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_route_table_v2_s_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, 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.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a VirtualHubRouteTableV2. + + :param resource_group_name: The resource group name of the VirtualHubRouteTableV2. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the VirtualHubRouteTableV2. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualHubRouteTableV2"]: + """Retrieves the details of all VirtualHubRouteTableV2s. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualHubRouteTableV2 or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.VirtualHubRouteTableV2] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubRouteTableV2SResult] = 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_virtual_hub_route_table_v2_s_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubRouteTableV2SResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables" + } + + +class ExpressRouteGatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_gateways` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> _models.ExpressRouteGatewayList: + """Lists ExpressRoute gateways under a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGatewayList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) + + request = build_express_route_gateways_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGatewayList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> _models.ExpressRouteGatewayList: + """Lists ExpressRoute gateways in a given resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGatewayList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGatewayList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGatewayList] = kwargs.pop("cls", None) + + request = build_express_route_gateways_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGatewayList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: Union[_models.ExpressRouteGateway, IO], + **kwargs: Any + ) -> _models.ExpressRouteGateway: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(put_express_route_gateway_parameters, (IOBase, bytes)): + _content = put_express_route_gateway_parameters + else: + _json = self._serialize.body(put_express_route_gateway_parameters, "ExpressRouteGateway") + + request = build_express_route_gateways_create_or_update_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + 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.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: _models.ExpressRouteGateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Required. + :type put_express_route_gateway_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway + :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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Required. + :type put_express_route_gateway_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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + put_express_route_gateway_parameters: Union[_models.ExpressRouteGateway, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Creates or updates a ExpressRoute gateway in a specified resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param put_express_route_gateway_parameters: Parameters required in an ExpressRoute gateway PUT + operation. Is either a ExpressRouteGateway type or a IO type. Required. + :type put_express_route_gateway_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway 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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = 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, + express_route_gateway_name=express_route_gateway_name, + put_express_route_gateway_parameters=put_express_route_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + def _update_tags_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> Optional[_models.ExpressRouteGateway]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ExpressRouteGateway]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(express_route_gateway_parameters, (IOBase, bytes)): + _content = express_route_gateway_parameters + else: + _json = self._serialize.body(express_route_gateway_parameters, "TagsObject") + + request = build_express_route_gateways_update_tags_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @overload + def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Required. + :type express_route_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject + :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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Required. + :type express_route_gateway_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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + express_route_gateway_name: str, + express_route_gateway_parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteGateway]: + """Updates express route gateway tags. + + :param resource_group_name: The resource group name of the ExpressRouteGateway. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the gateway. Required. + :type express_route_gateway_name: str + :param express_route_gateway_parameters: Parameters supplied to update a virtual wan express + route gateway tags. Is either a TagsObject type or a IO type. Required. + :type express_route_gateway_parameters: ~azure.mgmt.network.v2023_09_01.models.TagsObject 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 ExpressRouteGateway or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteGateway] = 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_tags_initial( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + express_route_gateway_parameters=express_route_gateway_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_tags.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any + ) -> _models.ExpressRouteGateway: + """Fetches the details of a ExpressRoute gateway in a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteGateway or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteGateway + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteGateway] = kwargs.pop("cls", None) + + request = build_express_route_gateways_get_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteGateway", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_gateway_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_gateways_delete_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway + resource can only be deleted when there are no connection subresources. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + } + + +class ExpressRouteConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`express_route_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: Union[_models.ExpressRouteConnection, IO], + **kwargs: Any + ) -> _models.ExpressRouteConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(put_express_route_connection_parameters, (IOBase, bytes)): + _content = put_express_route_connection_parameters + else: + _json = self._serialize.body(put_express_route_connection_parameters, "ExpressRouteConnection") + + request = build_express_route_connections_create_or_update_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + 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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: _models.ExpressRouteConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Required. + :type put_express_route_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection + :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 ExpressRouteConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Required. + :type put_express_route_connection_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 ExpressRouteConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + express_route_gateway_name: str, + connection_name: str, + put_express_route_connection_parameters: Union[_models.ExpressRouteConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.ExpressRouteConnection]: + """Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :param put_express_route_connection_parameters: Parameters required in an + ExpressRouteConnection PUT operation. Is either a ExpressRouteConnection type or a IO type. + Required. + :type put_express_route_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection 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 ExpressRouteConnection or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExpressRouteConnection] = 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, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_name, + put_express_route_connection_parameters=put_express_route_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, express_route_gateway_name: str, connection_name: str, **kwargs: Any + ) -> _models.ExpressRouteConnection: + """Gets the specified ExpressRouteConnection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the ExpressRoute connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteConnection] = kwargs.pop("cls", None) + + request = build_express_route_connections_get_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, express_route_gateway_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_express_route_connections_delete_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, express_route_gateway_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a connection to a ExpressRoute circuit. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :param connection_name: The name of the connection subresource. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, express_route_gateway_name: str, **kwargs: Any + ) -> _models.ExpressRouteConnectionList: + """Lists ExpressRouteConnections. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param express_route_gateway_name: The name of the ExpressRoute gateway. Required. + :type express_route_gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExpressRouteConnectionList or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.ExpressRouteConnectionList + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ExpressRouteConnectionList] = kwargs.pop("cls", None) + + request = build_express_route_connections_list_request( + resource_group_name=resource_group_name, + express_route_gateway_name=express_route_gateway_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExpressRouteConnectionList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections" + } + + +class NetworkVirtualApplianceConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`network_virtual_appliance_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: Union[_models.NetworkVirtualApplianceConnection, IO], + **kwargs: Any + ) -> _models.NetworkVirtualApplianceConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(network_virtual_appliance_connection_parameters, (IOBase, bytes)): + _content = network_virtual_appliance_connection_parameters + else: + _json = self._serialize.body( + network_virtual_appliance_connection_parameters, "NetworkVirtualApplianceConnection" + ) + + request = build_network_virtual_appliance_connections_create_or_update_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + 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.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: _models.NetworkVirtualApplianceConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Required. + :type network_virtual_appliance_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection + :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 NetworkVirtualApplianceConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Required. + :type network_virtual_appliance_connection_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 NetworkVirtualApplianceConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + network_virtual_appliance_name: str, + connection_name: str, + network_virtual_appliance_connection_parameters: Union[_models.NetworkVirtualApplianceConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.NetworkVirtualApplianceConnection]: + """Creates a connection to Network Virtual Appliance, if it doesn't exist else updates the + existing NVA connection'. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :param network_virtual_appliance_connection_parameters: Parameters supplied in an + NetworkVirtualApplianceConnection PUT operation. Is either a NetworkVirtualApplianceConnection + type or a IO type. Required. + :type network_virtual_appliance_connection_parameters: + ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection 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 NetworkVirtualApplianceConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = 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, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_name, + network_virtual_appliance_connection_parameters=network_virtual_appliance_connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, network_virtual_appliance_name: str, connection_name: str, **kwargs: Any + ) -> _models.NetworkVirtualApplianceConnection: + """Retrieves the details of specified NVA connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkVirtualApplianceConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceConnection] = kwargs.pop("cls", None) + + request = build_network_virtual_appliance_connections_get_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkVirtualApplianceConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, network_virtual_appliance_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_network_virtual_appliance_connections_delete_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, network_virtual_appliance_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a NVA connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :param connection_name: The name of the NVA connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, network_virtual_appliance_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkVirtualApplianceConnection"]: + """Lists NetworkVirtualApplianceConnections under the NVA. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param network_virtual_appliance_name: The name of the Network Virtual Appliance. Required. + :type network_virtual_appliance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkVirtualApplianceConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.NetworkVirtualApplianceConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.NetworkVirtualApplianceConnectionList] = 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_network_virtual_appliance_connections_list_request( + resource_group_name=resource_group_name, + network_virtual_appliance_name=network_virtual_appliance_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkVirtualApplianceConnectionList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections" + } + + +class VirtualHubBgpConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_hub_bgp_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> _models.BgpConnection: + """Retrieves the details of a Virtual Hub Bgp Connection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BgpConnection or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.BgpConnection + :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._api_version or "2023-09-01")) + cls: ClsType[_models.BgpConnection] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connection_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BgpConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: Union[_models.BgpConnection, IO], + **kwargs: Any + ) -> _models.BgpConnection: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BgpConnection] = 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, "BgpConnection") + + request = build_virtual_hub_bgp_connection_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BgpConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BgpConnection", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: _models.BgpConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BgpConnection + :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 BgpConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. 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 BgpConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + connection_name: str, + parameters: Union[_models.BgpConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.BgpConnection]: + """Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing + VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :param parameters: Parameters of Bgp connection. Is either a BgpConnection type or a IO type. + Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.BgpConnection 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 BgpConnection or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BgpConnection] = 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, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BgpConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, connection_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connection_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a VirtualHubBgpConnection. + + :param resource_group_name: The resource group name of the VirtualHubBgpConnection. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param connection_name: The name of the connection. Required. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + connection_name=connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + } + + +class VirtualHubBgpConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_hub_bgp_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> Iterable["_models.BgpConnection"]: + """Retrieves the details of all VirtualHubBgpConnections. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BgpConnection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.BgpConnection] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubBgpConnectionResults] = 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_virtual_hub_bgp_connections_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubBgpConnectionResults", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections" + } + + def _list_learned_routes_initial( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> Optional[Dict[str, List[_models.PeerRoute]]]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connections_list_learned_routes_request( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_learned_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_learned_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes" + } + + @distributed_trace + def begin_list_learned_routes( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[Dict[str, List[_models.PeerRoute]]]: + """Retrieves a list of routes the virtual hub bgp connection has learned. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param hub_name: The name of the virtual hub. Required. + :type hub_name: str + :param connection_name: The name of the virtual hub bgp connection. Required. + :type connection_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 dict mapping str to list of PeerRoute or + the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[dict[str, + list[~azure.mgmt.network.v2023_09_01.models.PeerRoute]]] + :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._api_version or "2023-09-01")) + cls: ClsType[Dict[str, List[_models.PeerRoute]]] = 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._list_learned_routes_initial( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_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): + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_learned_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes" + } + + def _list_advertised_routes_initial( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> Optional[Dict[str, List[_models.PeerRoute]]]: + 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._api_version or "2023-09-01")) + cls: ClsType[Optional[Dict[str, List[_models.PeerRoute]]]] = kwargs.pop("cls", None) + + request = build_virtual_hub_bgp_connections_list_advertised_routes_request( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._list_advertised_routes_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _list_advertised_routes_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes" + } + + @distributed_trace + def begin_list_advertised_routes( + self, resource_group_name: str, hub_name: str, connection_name: str, **kwargs: Any + ) -> LROPoller[Dict[str, List[_models.PeerRoute]]]: + """Retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param hub_name: The name of the virtual hub. Required. + :type hub_name: str + :param connection_name: The name of the virtual hub bgp connection. Required. + :type connection_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 dict mapping str to list of PeerRoute or + the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[dict[str, + list[~azure.mgmt.network.v2023_09_01.models.PeerRoute]]] + :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._api_version or "2023-09-01")) + cls: ClsType[Dict[str, List[_models.PeerRoute]]] = 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._list_advertised_routes_initial( + resource_group_name=resource_group_name, + hub_name=hub_name, + connection_name=connection_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): + deserialized = self._deserialize("{[PeerRoute]}", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_advertised_routes.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes" + } + + +class VirtualHubIpConfigurationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`virtual_hub_ip_configuration` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, ip_config_name: str, **kwargs: Any + ) -> _models.HubIpConfiguration: + """Retrieves the details of a Virtual Hub Ip configuration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubIpConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubIpConfiguration] = kwargs.pop("cls", None) + + request = build_virtual_hub_ip_configuration_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: Union[_models.HubIpConfiguration, IO], + **kwargs: Any + ) -> _models.HubIpConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubIpConfiguration] = 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, "HubIpConfiguration") + + request = build_virtual_hub_ip_configuration_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: _models.HubIpConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration + :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 HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. 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 HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + ip_config_name: str, + parameters: Union[_models.HubIpConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.HubIpConfiguration]: + """Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing + VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :param parameters: Hub Ip Configuration parameters. Is either a HubIpConfiguration type or a IO + type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration 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 HubIpConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubIpConfiguration] = 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, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubIpConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, ip_config_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_virtual_hub_ip_configuration_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, ip_config_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a VirtualHubIpConfiguration. + + :param resource_group_name: The resource group name of the VirtualHubBgpConnection. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param ip_config_name: The name of the ipconfig. Required. + :type ip_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + ip_config_name=ip_config_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any + ) -> Iterable["_models.HubIpConfiguration"]: + """Retrieves the details of all VirtualHubIpConfigurations. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubIpConfiguration or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.HubIpConfiguration] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListVirtualHubIpConfigurationResults] = 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_virtual_hub_ip_configuration_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListVirtualHubIpConfigurationResults", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations" + } + + +class HubRouteTablesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`hub_route_tables` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: Union[_models.HubRouteTable, IO], + **kwargs: Any + ) -> _models.HubRouteTable: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_table_parameters, (IOBase, bytes)): + _content = route_table_parameters + else: + _json = self._serialize.body(route_table_parameters, "HubRouteTable") + + request = build_hub_route_tables_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: _models.HubRouteTable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Required. + :type route_table_parameters: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable + :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 HubRouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Required. + :type route_table_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 HubRouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + route_table_name: str, + route_table_parameters: Union[_models.HubRouteTable, IO], + **kwargs: Any + ) -> LROPoller[_models.HubRouteTable]: + """Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :param route_table_parameters: Parameters supplied to create or update RouteTable. Is either a + HubRouteTable type or a IO type. Required. + :type route_table_parameters: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable 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 HubRouteTable or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HubRouteTable] = 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, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + route_table_parameters=route_table_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("HubRouteTable", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> _models.HubRouteTable: + """Retrieves the details of a RouteTable. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HubRouteTable or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.HubRouteTable + :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._api_version or "2023-09-01")) + cls: ClsType[_models.HubRouteTable] = kwargs.pop("cls", None) + + request = build_hub_route_tables_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HubRouteTable", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, route_table_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_hub_route_tables_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, route_table_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a RouteTable. + + :param resource_group_name: The resource group name of the RouteTable. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param route_table_name: The name of the RouteTable. Required. + :type route_table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + route_table_name=route_table_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + } + + @distributed_trace + def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> Iterable["_models.HubRouteTable"]: + """Retrieves the details of all RouteTables. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HubRouteTable or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.HubRouteTable] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListHubRouteTablesResult] = 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_hub_route_tables_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListHubRouteTablesResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables" + } + + +class RoutingIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`routing_intent` 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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _create_or_update_initial( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: Union[_models.RoutingIntent, IO], + **kwargs: Any + ) -> _models.RoutingIntent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(routing_intent_parameters, (IOBase, bytes)): + _content = routing_intent_parameters + else: + _json = self._serialize.body(routing_intent_parameters, "RoutingIntent") + + request = build_routing_intent_create_or_update_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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) + + _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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + 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.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: _models.RoutingIntent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. + Required. + :type routing_intent_parameters: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent + :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 RoutingIntent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. + Required. + :type routing_intent_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 RoutingIntent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtual_hub_name: str, + routing_intent_name: str, + routing_intent_parameters: Union[_models.RoutingIntent, IO], + **kwargs: Any + ) -> LROPoller[_models.RoutingIntent]: + """Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the per VirtualHub singleton Routing Intent resource. + Required. + :type routing_intent_name: str + :param routing_intent_parameters: Parameters supplied to create or update RoutingIntent. Is + either a RoutingIntent type or a IO type. Required. + :type routing_intent_parameters: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent 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 RoutingIntent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :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._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RoutingIntent] = 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, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_name, + routing_intent_parameters=routing_intent_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RoutingIntent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, virtual_hub_name: str, routing_intent_name: str, **kwargs: Any + ) -> _models.RoutingIntent: + """Retrieves the details of a RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the RoutingIntent. Required. + :type routing_intent_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoutingIntent or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.RoutingIntent + :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._api_version or "2023-09-01")) + cls: ClsType[_models.RoutingIntent] = kwargs.pop("cls", None) + + request = build_routing_intent_get_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RoutingIntent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_hub_name: str, routing_intent_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_routing_intent_delete_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, virtual_hub_name: str, routing_intent_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a RoutingIntent. + + :param resource_group_name: The resource group name of the RoutingIntent. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :param routing_intent_name: The name of the RoutingIntent. Required. + :type routing_intent_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_name, + routing_intent_name=routing_intent_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + } + + @distributed_trace + def list(self, resource_group_name: str, virtual_hub_name: str, **kwargs: Any) -> Iterable["_models.RoutingIntent"]: + """Retrieves the details of all RoutingIntent child resources of the VirtualHub. + + :param resource_group_name: The resource group name of the VirtualHub. Required. + :type resource_group_name: str + :param virtual_hub_name: The name of the VirtualHub. Required. + :type virtual_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoutingIntent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.RoutingIntent] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.ListRoutingIntentResult] = 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_routing_intent_list_request( + resource_group_name=resource_group_name, + virtual_hub_name=virtual_hub_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListRoutingIntentResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent" + } + + +class WebApplicationFirewallPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.network.v2023_09_01.NetworkManagementClient`'s + :attr:`web_application_firewall_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") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.WebApplicationFirewallPolicy"]: + """Lists all of the protection policies within a resource group. + + :param resource_group_name: The name of the resource group. 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 WebApplicationFirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = 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_web_application_firewall_policies_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) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebApplicationFirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + } + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.WebApplicationFirewallPolicy"]: + """Gets all the WAF policies in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebApplicationFirewallPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy] + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicyListResult] = 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_web_application_firewall_policies_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebApplicationFirewallPolicyListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_all.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + } + + @distributed_trace + def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _models.WebApplicationFirewallPolicy: + """Retrieve protection policy with specified name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :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._api_version or "2023-09-01")) + cls: ClsType[_models.WebApplicationFirewallPolicy] = kwargs.pop("cls", None) + + request = build_web_application_firewall_policies_get_request( + resource_group_name=resource_group_name, + policy_name=policy_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: _models.WebApplicationFirewallPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :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: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + policy_name: str, + parameters: Union[_models.WebApplicationFirewallPolicy, IO], + **kwargs: Any + ) -> _models.WebApplicationFirewallPolicy: + """Creates or update policy with specified rule set name within a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :param parameters: Policy to be created. Is either a WebApplicationFirewallPolicy type or a IO + type. Required. + :type parameters: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebApplicationFirewallPolicy or the result of cls(response) + :rtype: ~azure.mgmt.network.v2023_09_01.models.WebApplicationFirewallPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebApplicationFirewallPolicy] = 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, "WebApplicationFirewallPolicy") + + request = build_web_application_firewall_policies_create_or_update_request( + resource_group_name=resource_group_name, + policy_name=policy_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WebApplicationFirewallPolicy", pipeline_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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, policy_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._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_web_application_firewall_policies_delete_request( + resource_group_name=resource_group_name, + policy_name=policy_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) + + _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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes Policy. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param policy_name: The name of the policy. Required. + :type policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-09-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + policy_name=policy_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + } diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_patch.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/py.typed b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2023_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_request_headers_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_request_headers_get.py index e2caf27fb41b..31c67c75788c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_request_headers_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_request_headers_get.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableRequestHeadersGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableRequestHeadersGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_response_headers_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_response_headers_get.py index c7f7f8295391..494b7b105064 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_response_headers_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_response_headers_get.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableResponseHeadersGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableResponseHeadersGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_server_variables_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_server_variables_get.py index 62ad63934bb9..dfbaae6d3d54 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_server_variables_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_server_variables_get.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableServerVariablesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableServerVariablesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_get.py index 5e1b77d723d4..b4e85de4bccb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_get.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableSslOptionsGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableSslOptionsGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policies_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policies_get.py index c0b81c87eeb3..bae3299e99b3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policies_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policies_get.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPoliciesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPoliciesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policy_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policy_get.py index 09cf010f8de0..063d90dd8e2e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policy_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_ssl_options_predefined_policy_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPolicyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_waf_rule_sets_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_waf_rule_sets_get.py index c1e701510165..4dcf312c3fe0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_waf_rule_sets_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_available_waf_rule_sets_get.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayAvailableWafRuleSetsGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayAvailableWafRuleSetsGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_get.py index 268d73836619..6d68adbc99dd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayBackendHealthGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayBackendHealthGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_test.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_test.py index a23c5c50a7a8..001ce3b2abfc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_test.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_backend_health_test.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayBackendHealthTest.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayBackendHealthTest.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_create.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_create.py index ec9c676abd97..ebaab409c48e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_create.py @@ -212,6 +212,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_delete.py index f220e1484abc..c167198ea3ab 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_get.py index 828a15426368..21502372379a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list.py index a2a2c832073c..d822737b8de6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list_all.py index 7e454c659921..80787394e080 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_delete.py index a9e95a8d9db2..d3bdb3e641e8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayPrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayPrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_get.py index 569ea36c072e..e92b08b7879a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayPrivateEndpointConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayPrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_list.py index 52ee9cfdf0dc..c5e34042ee8f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayPrivateEndpointConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayPrivateEndpointConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_update.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_update.py index 814b23ba2ee0..1046c381d5aa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_endpoint_connection_update.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayPrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayPrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_link_resource_list.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_link_resource_list.py index fb802bef8ad6..60b9213288f3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_link_resource_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_private_link_resource_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayPrivateLinkResourceList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayPrivateLinkResourceList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_start.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_start.py index b35cda7665c9..762ce60f8837 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_start.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_start.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayStart.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayStart.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_stop.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_stop.py index 8fcc24773d8a..e898927e225c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_stop.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_stop.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayStop.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayStop.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_update_tags.py index 31701813e105..7d28e002d534 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_create.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_create.py index 3e1c5ec6d2a2..6ef9ff715cdd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_delete.py index 9eafcee9db12..d1989cb4a136 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_get.py index a604afae2a75..a89526b90962 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list.py index d33fcfe8e4ea..07ecf161ecbe 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list_all.py index dd39997a23b2..592a51e9b67e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_update_tags.py index 52084cd6c349..95df85369a48 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/application_security_group_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/application_security_group_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ApplicationSecurityGroupUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ApplicationSecurityGroupUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_get.py b/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_get.py index 0de7d56e5652..988b22751b9c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_get.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AutoApprovedPrivateLinkServicesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AutoApprovedPrivateLinkServicesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_resource_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_resource_group_get.py index 4cbd9f6b4d3f..fb198c27f3c9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_resource_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/auto_approved_private_link_services_resource_group_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AutoApprovedPrivateLinkServicesResourceGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AutoApprovedPrivateLinkServicesResourceGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_delegations_resource_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/available_delegations_resource_group_get.py index 0eed0ec15ccd..13177aa3cae0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_delegations_resource_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_delegations_resource_group_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailableDelegationsResourceGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailableDelegationsResourceGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_delegations_subscription_get.py b/sdk/network/azure-mgmt-network/generated_samples/available_delegations_subscription_get.py index a15fefeaef8a..9064f7800170 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_delegations_subscription_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_delegations_subscription_get.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailableDelegationsSubscriptionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailableDelegationsSubscriptionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_get.py b/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_get.py index 4bc934a2b5da..9333704ab483 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_get.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailablePrivateEndpointTypesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailablePrivateEndpointTypesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_resource_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_resource_group_get.py index 0549802da4a5..abd7e0ce2e58 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_resource_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_private_endpoint_types_resource_group_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailablePrivateEndpointTypesResourceGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailablePrivateEndpointTypesResourceGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list.py b/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list.py index baf8b47335fd..e324b59bad47 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailableServiceAliasesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailableServiceAliasesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list_by_resource_group.py index d6388e1ad4f5..6314c17a53b5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/available_service_aliases_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AvailableServiceAliasesListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AvailableServiceAliasesListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_delete.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_delete.py index ec0ac05b2a1c..820896e181e0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_fqdn_tags_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_fqdn_tags_list_by_subscription.py index e5b15575f0c2..8304d6f0b1f2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_fqdn_tags_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_fqdn_tags_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallFqdnTagsListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallFqdnTagsListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get.py index 66d5910b49a5..7c009ee3da55 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_additional_properties.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_additional_properties.py index a01ae23a0818..889c559fa2b8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_additional_properties.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_additional_properties.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallGetWithAdditionalProperties.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallGetWithAdditionalProperties.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_ip_groups.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_ip_groups.py index a85281abf17f..40851386ddd6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_ip_groups.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_ip_groups.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallGetWithIpGroups.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallGetWithIpGroups.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_mgmt_subnet.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_mgmt_subnet.py index 3d1b1c2dc72f..634d32b40ed3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_mgmt_subnet.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_mgmt_subnet.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallGetWithMgmtSubnet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallGetWithMgmtSubnet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_zones.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_zones.py index 3f2ff981b872..8089675f78f5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_zones.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_get_with_zones.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallGetWithZones.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallGetWithZones.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_resource_group.py index 73018f7bf8c6..e4988730d9f3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_subscription.py index 4c27f0aa1d7d..4b28cc396f02 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_learned_ip_prefixes.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_learned_ip_prefixes.py index 8d612e484b77..6549e1792b4a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_learned_ip_prefixes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_list_learned_ip_prefixes.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallListLearnedIPPrefixes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallListLearnedIPPrefixes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_packet_capture.py index e09448392f2e..7f4333f506bd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_packet_capture.py @@ -53,6 +53,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put.py index fd0611696b8a..d379b57a0518 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put.py @@ -134,6 +134,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_in_hub.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_in_hub.py index 1a5e072b84b5..bdf4622267f7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_in_hub.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_in_hub.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPutInHub.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPutInHub.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_additional_properties.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_additional_properties.py index 7572ddb084dd..1c4ad49d0ca5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_additional_properties.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_additional_properties.py @@ -136,6 +136,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPutWithAdditionalProperties.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPutWithAdditionalProperties.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_ip_groups.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_ip_groups.py index eb7656e31f9b..c97c3c7f9b7d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_ip_groups.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_ip_groups.py @@ -134,6 +134,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPutWithIpGroups.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPutWithIpGroups.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_mgmt_subnet.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_mgmt_subnet.py index be41beca20a8..b3a06a2e9f81 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_mgmt_subnet.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_mgmt_subnet.py @@ -145,6 +145,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPutWithMgmtSubnet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPutWithMgmtSubnet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_zones.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_zones.py index b56a589518a1..c343eadc4a36 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_zones.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_put_with_zones.py @@ -134,6 +134,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallPutWithZones.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallPutWithZones.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_update_tags.py index 634bc7d6832c..31e6a2c24c14 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_firewall_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureFirewallUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureFirewallUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_web_categories_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/azure_web_categories_list_by_subscription.py index 2926c2c901cc..ab8b02976e4a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_web_categories_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_web_categories_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureWebCategoriesListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureWebCategoriesListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/azure_web_category_get.py b/sdk/network/azure-mgmt-network/generated_samples/azure_web_category_get.py index 7e9715e9bbeb..08991322377d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/azure_web_category_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/azure_web_category_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/AzureWebCategoryGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/AzureWebCategoryGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_delete.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_delete.py index e7ba0f0844de..c27a478041ae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_delete.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_delete.py index 2cbe51aade1b..7dff6f19c4bc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostDeveloperDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostDeveloperDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_get.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_get.py index ba88f2439069..d1e1a8d37983 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostDeveloperGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostDeveloperGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_put.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_put.py index 18e4dba552d1..31393370f397 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_developer_put.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostDeveloperPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostDeveloperPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get.py index c16489545e4d..c042b4398809 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get_with_zones.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get_with_zones.py new file mode 100644 index 000000000000..1cf97bfe9c96 --- /dev/null +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_get_with_zones.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.network import NetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-network +# USAGE + python bastion_host_get_with_zones.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 = NetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.bastion_hosts.get( + resource_group_name="rg1", + bastion_host_name="bastionhosttenant'", + ) + print(response) + + +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostGetWithZones.json +if __name__ == "__main__": + main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_resource_group.py index b682e84654ff..8c7f675b2da6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_subscription.py index 09feac97dfd5..d8e1f4fb5e7b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_patch.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_patch.py index a1238a231bc3..efe687eed42e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_patch.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostPatch.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostPatch.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put.py index 80a3ab49a046..feba6564dc32 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionHostPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put_with_zones.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put_with_zones.py new file mode 100644 index 000000000000..de9ccb1ae8cc --- /dev/null +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_host_put_with_zones.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.network import NetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-network +# USAGE + python bastion_host_put_with_zones.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 = NetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.bastion_hosts.begin_create_or_update( + resource_group_name="rg1", + bastion_host_name="bastionhosttenant", + parameters={ + "properties": { + "ipConfigurations": [ + { + "name": "bastionHostIpConfiguration", + "properties": { + "publicIPAddress": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName" + }, + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet" + }, + }, + } + ] + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionHostPutWithZones.json +if __name__ == "__main__": + main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_session_delete.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_session_delete.py index dabb5b2f598f..883d56a5e726 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_session_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_session_delete.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionSessionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionSessionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_sessions_list.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_sessions_list.py index 3576035f6cfb..8d16fb3a743b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_sessions_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_sessions_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionSessionsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionSessionsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_create.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_create.py index 8fdff48d36f5..d7784186afe5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_create.py @@ -51,6 +51,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionShareableLinkCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionShareableLinkCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete.py index 9c87cc0b6f1e..80e7a8368a2a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete.py @@ -49,6 +49,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionShareableLinkDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionShareableLinkDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete_by_token.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete_by_token.py index 98aeac4196b6..3dd852dc6f53 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete_by_token.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_delete_by_token.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionShareableLinkDeleteByToken.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionShareableLinkDeleteByToken.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_get.py b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_get.py index 31c2568f3952..293803fe9ee8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/bastion_shareable_link_get.py @@ -51,6 +51,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/BastionShareableLinkGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/BastionShareableLinkGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/check_dns_name_availability.py b/sdk/network/azure-mgmt-network/generated_samples/check_dns_name_availability.py index 2e065d85aed8..211e41937020 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/check_dns_name_availability.py +++ b/sdk/network/azure-mgmt-network/generated_samples/check_dns_name_availability.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CheckDnsNameAvailability.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CheckDnsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility.py b/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility.py index e5c311b0598e..8b037c1b55ee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility.py +++ b/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CheckPrivateLinkServiceVisibility.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CheckPrivateLinkServiceVisibility.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility_by_resource_group.py index 5eea0c9c757d..542dd0c422c6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/check_private_link_service_visibility_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CheckPrivateLinkServiceVisibilityByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CheckPrivateLinkServiceVisibilityByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_get.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_get.py index 293f1afd3246..66f3e4227ff5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceNetworkInterfaceGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceNetworkInterfaceGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_list.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_list.py index b96b75f8f784..e9bb8cdfabfc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_network_interface_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceNetworkInterfaceList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceNetworkInterfaceList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_get.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_get.py index afa9629f5e68..0de1cd94722f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServicePublicIpGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServicePublicIpGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_list_all.py index 7fd34c481cca..f532a0f880e0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_public_ip_list_all.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServicePublicIpListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServicePublicIpListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_network_interface_list.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_network_interface_list.py index f80ee73e3055..e1ad826bb93c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_network_interface_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_network_interface_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceRoleInstanceNetworkInterfaceList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceRoleInstanceNetworkInterfaceList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_public_ip_list.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_public_ip_list.py index cf29b182a534..3c0211d0572d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_public_ip_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_role_instance_public_ip_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceRoleInstancePublicIpList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceRoleInstancePublicIpList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_get.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_get.py index f80740f41b8d..1e64087bf302 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceSwapGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceSwapGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_list.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_list.py index 50accd11a7fc..63551f048559 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceSwapList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceSwapList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_put.py b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_put.py index be694e57203e..d8947b823762 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/cloud_service_swap_put.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CloudServiceSwapPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CloudServiceSwapPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_delete.py index 69b45cee450d..aff866ef9c33 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ConfigurationPolicyGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ConfigurationPolicyGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_get.py index 1f592450dfb4..ff726e741470 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ConfigurationPolicyGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ConfigurationPolicyGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_list_by_vpn_server_configuration.py b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_list_by_vpn_server_configuration.py index fac70a3d37de..a0ada26e97af 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_list_by_vpn_server_configuration.py +++ b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_list_by_vpn_server_configuration.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ConfigurationPolicyGroupListByVpnServerConfiguration.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ConfigurationPolicyGroupListByVpnServerConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_put.py b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_put.py index 803b2d769e13..5e06cc1c101d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/configuration_policy_group_put.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ConfigurationPolicyGroupPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ConfigurationPolicyGroupPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_create_customized_values.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_create_customized_values.py index 17e50edd2c83..807fef5a6c15 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_create_customized_values.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_create_customized_values.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixCreateCustomizedValues.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixCreateCustomizedValues.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_delete.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_delete.py index 810b6900c4ca..7c442a847729 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_get.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_get.py index 0831de907df5..7bd371757202 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list.py index 132ef360ace3..c522d8eb660c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list_all.py index e017dd36e647..cef1b1ee0bb4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_update_tags.py index 2b4bb353ef29..451c32c88527 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/custom_ip_prefix_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/CustomIpPrefixUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/CustomIpPrefixUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_create.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_create.py index 7b5c6ab512e4..ec67730b733c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosCustomPolicyCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosCustomPolicyCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_delete.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_delete.py index cee57537fbc6..c1083a33c62c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosCustomPolicyDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosCustomPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_get.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_get.py index f680784beffb..1158138bafc5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosCustomPolicyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosCustomPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_update_tags.py index e09f73270693..5b9ccda4e122 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_custom_policy_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosCustomPolicyUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosCustomPolicyUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_create.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_create.py index f354339d0f0b..127d660e4eca 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_delete.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_delete.py index f28a9601f537..7b795b064809 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_get.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_get.py index f8d75931b3b3..74113f19885a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list.py index 5fbc455fac89..0ff8927a9e8e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list_all.py index 15f3b9a9a4df..1fd89079188e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_update_tags.py index 4c769f627d03..9a7015b8bcb6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ddos_protection_plan_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DdosProtectionPlanUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DdosProtectionPlanUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_get.py index a5e5f8ba1138..f670578c1f34 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DefaultSecurityRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DefaultSecurityRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_list.py index 607e1201bbc3..ac0594c68f43 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/default_security_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DefaultSecurityRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DefaultSecurityRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_create.py b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_create.py index e7996c7f5468..25131abe3731 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_create.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DscpConfigurationCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DscpConfigurationCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_delete.py index b513ee5fedbd..ee42e4e886dc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DscpConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DscpConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_get.py index 4ad43ae37560..2d8e6839d1f8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DscpConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DscpConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list.py index 615a17ac71bd..cc648d618832 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DscpConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DscpConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list_all.py index 19bd6366dc33..d6f5c690c8d7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/dscp_configuration_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/DscpConfigurationListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/DscpConfigurationListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_connection.py b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_connection.py index 9a057a99581d..ea970ba665b9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_connection.py +++ b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_connection.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/EffectiveRoutesListForConnection.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/EffectiveRoutesListForConnection.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_route_table.py b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_route_table.py index cb8e76c49b09..70c1582bbc57 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_route_table.py +++ b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_route_table.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/EffectiveRoutesListForRouteTable.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/EffectiveRoutesListForRouteTable.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_virtual_hub.py b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_virtual_hub.py index d20c2c04c1a3..7242aa9a8dd0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_virtual_hub.py +++ b/sdk/network/azure-mgmt-network/generated_samples/effective_routes_list_for_virtual_hub.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/EffectiveRoutesListForVirtualHub.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/EffectiveRoutesListForVirtualHub.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/endpoint_services_list.py b/sdk/network/azure-mgmt-network/generated_samples/endpoint_services_list.py index 3780139d67b2..18d739f4b40f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/endpoint_services_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/endpoint_services_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/EndpointServicesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/EndpointServicesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_arp_table_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_arp_table_list.py index 2ef92d64cd11..4f5f2d565a7a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_arp_table_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_arp_table_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitARPTableList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitARPTableList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_create.py index 7dbe62d819b5..3a2b3428231a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitAuthorizationCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitAuthorizationCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_delete.py index 6bdd2db82d9d..aa39f7b41887 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitAuthorizationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitAuthorizationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_get.py index 705e3bcfb947..79f98a2f6f58 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitAuthorizationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitAuthorizationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_list.py index f4b81c7089c7..5652716b9720 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_authorization_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitAuthorizationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitAuthorizationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_create.py index 9961bee58bde..33be9e119809 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_create.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitConnectionCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitConnectionCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_delete.py index adf4b875d321..69a4597e7409 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_get.py index 19b2593682c5..94bcd9754527 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_list.py index 8b467b703ba1..8947c7047bac 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_connection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create.py index 9ae0f6ce8260..160e3fc022a1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create_on_express_route_port.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create_on_express_route_port.py index 46d10412c65c..320d6c0877c7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create_on_express_route_port.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_create_on_express_route_port.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitCreateOnExpressRoutePort.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitCreateOnExpressRoutePort.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_delete.py index 8b4493751a47..5cd00075f229 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_get.py index 4d26a795211d..10061afa9895 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_resource_group.py index 85e00d85d5bf..e7b977f2235c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_subscription.py index 0a41c6646e7d..f574bc84c9cf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_create.py index a1e7e0b4107d..0c13225be5fd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_create.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitPeeringCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitPeeringCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_delete.py index bf9317a0b3f2..d16cf967d14f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitPeeringDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitPeeringDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_get.py index 5a6c3f400793..580d7e6eb8a6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitPeeringGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitPeeringGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_list.py index aba5a64d9517..4d5cec4c5bc8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitPeeringList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitPeeringList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_stats.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_stats.py index 262022259edc..f2b5bcd4c9a1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_stats.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_peering_stats.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitPeeringStats.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitPeeringStats.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_list.py index 15a3c76f5668..e81a5240b82d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitRouteTableList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitRouteTableList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_summary_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_summary_list.py index 21c9abf60e37..ed230a8d77e2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_summary_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_route_table_summary_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitRouteTableSummaryList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitRouteTableSummaryList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_stats.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_stats.py index 3e7d35c53c81..101a6d94bc19 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_stats.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_stats.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitStats.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitStats.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_update_tags.py index 208c252c008d..d420e38f163d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_circuit_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCircuitUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCircuitUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_create.py index 44523bbefb64..f116275a1b29 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_create.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteConnectionCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteConnectionCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_delete.py index 4a612169ec5e..8677414e26fb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_get.py index 9f0292cdfc50..32538b306f1f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_list.py index 8bde85c58d81..e87a2dc5edc0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_connection_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_create.py index c265cc347a7c..4f6586f70250 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_create.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionBgpPeeringCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionBgpPeeringCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_delete.py index 56d83e023d4b..c07159e30690 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionBgpPeeringDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionBgpPeeringDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_get.py index 1173a9c402f1..829a03fb2f0a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionBgpPeeringGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionBgpPeeringGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_list.py index 930d77b0dd65..cf5bf3c20fcb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_bgp_peering_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionBgpPeeringList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionBgpPeeringList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_get.py index 1ced3450ffa3..9b9a84f38958 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list.py index ba1408e6fc9e..6c5def4a9da5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list_by_resource_group.py index e12937747556..68b8c5794aed 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update.py index 69406b937679..a0e5bcfb42fa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update_tags.py index c17fecc18bd2..5218c36693ef 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connection_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_arp_table.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_arp_table.py index b552db6ca1c7..67cde61404e0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_arp_table.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_arp_table.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionsArpTable.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionsArpTable.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table.py index f555cf93bb0a..e922d6cf29ee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionsRouteTable.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionsRouteTable.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table_summary.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table_summary.py index 0ebffd64c3d0..8449bf9aeaa4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table_summary.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_cross_connections_route_table_summary.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteCrossConnectionsRouteTableSummary.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteCrossConnectionsRouteTableSummary.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_create.py index 707c953150b3..0b66286375a7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_delete.py index a1249e09348c..c654829fb883 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_get.py index 5b0661796777..2f3ef1208c9a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_resource_group.py index 571126142e6f..955b278a2714 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_resource_group.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_subscription.py index ac17079ead1e..ef8a3ab53bfb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_list_by_subscription.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_update_tags.py index b85e15a199ee..664b6b6d661d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_link_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_link_get.py index 8d9b4bec7720..f0568bed3c04 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_link_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_link_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteLinkGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteLinkGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_link_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_link_list.py index 22810facff5c..2496271ebc8a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_link_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_link_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteLinkList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteLinkList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_create.py index 8f15f805c777..6113cd01fe78 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortAuthorizationCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortAuthorizationCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_delete.py index 8e75593f1332..0f5b91752eaa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortAuthorizationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortAuthorizationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_get.py index 08dca32bbe4e..06f5866e2481 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortAuthorizationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortAuthorizationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_list.py index 50d12e7da8e8..188aded27185 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_authorization_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortAuthorizationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortAuthorizationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_create.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_create.py index 5c99f989d195..c7ed20ace35c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_create.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_delete.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_delete.py index 7c572ace30b7..8bf7456126b6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_get.py index b30ffb1181c9..e2abb6b8cd22 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list.py index 4f254b8eaae0..ceb563bdb30a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list_by_resource_group.py index 886dccb744a9..ae59b78620c8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_link.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_link.py index fed444632ff2..48a76737ace3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_link.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_link.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortUpdateLink.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortUpdateLink.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_tags.py index b6ec52286f9a..84d5ba02c4f7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_port_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_get.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_get.py index 466ba4c65720..816a2e6947b0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortsLocationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortsLocationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_list.py index e54052f979ab..6d90d7acd6d6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_ports_location_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRoutePortsLocationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRoutePortsLocationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_list.py index ae93ed75990b..bb2e96011cb5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ExpressRouteProviderList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ExpressRouteProviderList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port.py index fc051adec2d0..aea163950372 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/expressRouteProviderPort.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/expressRouteProviderPort.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port_list.py b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port_list.py index 25b7dcb51003..70892088272a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/express_route_provider_port_list.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/expressRouteProviderPortList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/expressRouteProviderPortList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_delete.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_delete.py index eb4b70a5fe6e..d344008d6d0e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_get.py index ef7d2ec08752..5c109f964d76 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_resource_group.py index 103ed8f1f7ca..9a29f060b029 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_subscription.py index 9faa72c08d5c..c94528b7f37c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_get.py index ba1bdb470b78..6096c63badad 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyNatRuleCollectionGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyNatRuleCollectionGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_put.py index 2b565bcbce60..14f7965b991e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_nat_rule_collection_group_put.py @@ -63,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyNatRuleCollectionGroupPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyNatRuleCollectionGroupPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_patch.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_patch.py index 61915befd7cb..a8b33c54af25 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_patch.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyPatch.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyPatch.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_put.py index 86e29776af71..23a5b67f18aa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_put.py @@ -99,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides.py index a2a36b07fea2..acb544727b84 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyQuerySignatureOverrides.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyQuerySignatureOverrides.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides_filter_values.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides_filter_values.py index 44b2a882cfcd..f110d43701d5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides_filter_values.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_query_signature_overrides_filter_values.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyQuerySignatureOverridesFilterValues.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyQuerySignatureOverridesFilterValues.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_delete.py index 0ba2c06c0cc8..3525cbab84d9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_get.py index 1f885e52e945..575edc90befa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_list.py index 74abe365e56e..b8b765a798ef 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_put.py index 1bb3109974a2..dbe834e61905 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_put.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_http_headers_to_insert.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_http_headers_to_insert.py index cbf815c1d105..c48a2886aaeb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_http_headers_to_insert.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_http_headers_to_insert.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithHttpHeadersToInsert.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithHttpHeadersToInsert.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_get.py index c00e7f26130b..da85f87ba3a6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_list.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_list.py index f30a0a9d4be7..30374e30b156 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_put.py index 70f4e8a6ef78..8d0737a69a18 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_ip_groups_put.py @@ -63,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_get.py index e5e80045ea18..f1034efdcc87 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_list.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_list.py index a029b4f0052e..05252be2723b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_put.py index dd68820b03c2..965066c10e61 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_rule_collection_group_with_web_categories_put.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_get.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_get.py index c2e1ff185fa3..5675869cccfc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicySignatureOverridesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicySignatureOverridesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_list.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_list.py index 5d641f7352df..5af5e68ea9ab 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicySignatureOverridesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicySignatureOverridesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_patch.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_patch.py index e945a27e34fe..411782d471fb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_patch.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_patch.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicySignatureOverridesPatch.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicySignatureOverridesPatch.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_put.py b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_put.py index 66c3721dc69b..0631e8f3a199 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/firewall_policy_signature_overrides_put.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/FirewallPolicySignatureOverridesPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicySignatureOverridesPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/generate_express_route_ports_loa.py b/sdk/network/azure-mgmt-network/generated_samples/generate_express_route_ports_loa.py index 35717055570d..0659dce45a54 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/generate_express_route_ports_loa.py +++ b/sdk/network/azure-mgmt-network/generated_samples/generate_express_route_ports_loa.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GenerateExpressRoutePortsLOA.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GenerateExpressRoutePortsLOA.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/generate_virtual_wan_vpn_server_configuration_vpn_profile.py b/sdk/network/azure-mgmt-network/generated_samples/generate_virtual_wan_vpn_server_configuration_vpn_profile.py index 16194576bf78..9e5eb529f673 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/generate_virtual_wan_vpn_server_configuration_vpn_profile.py +++ b/sdk/network/azure-mgmt-network/generated_samples/generate_virtual_wan_vpn_server_configuration_vpn_profile.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GenerateVirtualWanVpnServerConfigurationVpnProfile.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GenerateVirtualWanVpnServerConfigurationVpnProfile.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests.py b/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests.py index a3913699900b..9852736bc9eb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests.py +++ b/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GetApplicationGatewayWafDynamicManifests.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GetApplicationGatewayWafDynamicManifests.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests_default.py b/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests_default.py index 155c86e27c8d..9ee1c0108e9a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests_default.py +++ b/sdk/network/azure-mgmt-network/generated_samples/get_application_gateway_waf_dynamic_manifests_default.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GetApplicationGatewayWafDynamicManifestsDefault.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GetApplicationGatewayWafDynamicManifestsDefault.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/get_inbound_routes.py b/sdk/network/azure-mgmt-network/generated_samples/get_inbound_routes.py index c451f62af4e5..e4e962bfc9a7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/get_inbound_routes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/get_inbound_routes.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GetInboundRoutes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GetInboundRoutes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/get_outbound_routes.py b/sdk/network/azure-mgmt-network/generated_samples/get_outbound_routes.py index b44d0ee67cfb..a1a3ff015d68 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/get_outbound_routes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/get_outbound_routes.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GetOutboundRoutes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GetOutboundRoutes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/get_virtual_wan_vpn_server_configurations.py b/sdk/network/azure-mgmt-network/generated_samples/get_virtual_wan_vpn_server_configurations.py index d9c91fd386c5..ef377e9be8ca 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/get_virtual_wan_vpn_server_configurations.py +++ b/sdk/network/azure-mgmt-network/generated_samples/get_virtual_wan_vpn_server_configurations.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/GetVirtualWanVpnServerConfigurations.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/GetVirtualWanVpnServerConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_delete.py b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_delete.py index fe4d99126444..8a006677e6a0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubRouteTableDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubRouteTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_get.py b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_get.py index c4853a82daaa..6793304ac57a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubRouteTableGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubRouteTableGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_list.py b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_list.py index 60bb04857353..5c44c24f810c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubRouteTableList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubRouteTableList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_put.py b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_put.py index 0fecc503130c..bcdae797ed3b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_route_table_put.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubRouteTablePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubRouteTablePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_delete.py index 9faf811893f5..1a273c6c610a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubVirtualNetworkConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubVirtualNetworkConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_get.py index 2a04d2e1f15e..b8afca5a9f41 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubVirtualNetworkConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubVirtualNetworkConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_list.py index 11b18492c3de..955f8445b0c0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubVirtualNetworkConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubVirtualNetworkConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_put.py b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_put.py index ef5e364b1800..cabf0769ad55 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/hub_virtual_network_connection_put.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/HubVirtualNetworkConnectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/HubVirtualNetworkConnectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_create.py b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_create.py index a03902f2470d..a742402f7f9d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/InboundNatRuleCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/InboundNatRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_delete.py index 990686fa190d..c75bcd40d92d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/InboundNatRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/InboundNatRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_get.py index 5ccd59816058..67e1aac304df 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/InboundNatRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/InboundNatRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_list.py index 75cdbb385efe..9e6f55426994 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/inbound_nat_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/InboundNatRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/InboundNatRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/inbound_security_rule_put.py b/sdk/network/azure-mgmt-network/generated_samples/inbound_security_rule_put.py index 6b02d5c537cc..0ba02e720723 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/inbound_security_rule_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/inbound_security_rule_put.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/InboundSecurityRulePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/InboundSecurityRulePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_create.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_create.py index 1e145496af68..0e72faa96d90 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_delete.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_delete.py index 4d8870691cd6..fccba0154d20 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_get.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_get.py index d4c48bc5b264..1497e867bc24 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list.py index 7cb328bc9b03..dd7c77dadda0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list_by_resource_group.py index de7cdf516e44..18c13378c559 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_update_tags.py index dd96e68b3a3a..6c6834f678f1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_allocation_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpAllocationUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpAllocationUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_create.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_create.py index cc372b647c75..614067ca12ad 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_delete.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_delete.py index e7dfe8dc8852..cfa60eca3535 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_get.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_get.py index 6132ff4bf4c3..c98bcc1494f5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_resource_group.py index 87784362cb35..a8cea5b74275 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_subscription.py index 8843d3c67830..ff43e7167ecc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_update_tags.py index 0f7ea6869505..57982896ab0d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/ip_groups_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/ip_groups_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/IpGroupsUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/IpGroupsUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_list_with_backend_addresses_pool_type.py b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_list_with_backend_addresses_pool_type.py index dc98ba282305..27326a65b72e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_list_with_backend_addresses_pool_type.py +++ b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_list_with_backend_addresses_pool_type.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LBBackendAddressPoolListWithBackendAddressesPoolType.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LBBackendAddressPoolListWithBackendAddressesPoolType.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_get.py b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_get.py index 9efa5d3d581d..291d727898ea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LBBackendAddressPoolWithBackendAddressesGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LBBackendAddressPoolWithBackendAddressesGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_put.py b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_put.py index b1a04063db79..3ed4d0d85c42 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/lb_backend_address_pool_with_backend_addresses_put.py @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LBBackendAddressPoolWithBackendAddressesPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LBBackendAddressPoolWithBackendAddressesPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_delete.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_delete.py index 7b8492fbf901..59f9c22ac37b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerBackendAddressPoolDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerBackendAddressPoolDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_get.py index 963bfd0dbed4..42773e99e1e0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerBackendAddressPoolGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerBackendAddressPoolGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_list.py index 4c4c15dd4e6e..d39257afed24 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_backend_address_pool_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerBackendAddressPoolList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerBackendAddressPoolList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create.py index 6476e9e4adec..5444118fe85b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create.py @@ -105,6 +105,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_consumer.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_consumer.py index 4947ddddfd24..f241cf1bb835 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_consumer.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_consumer.py @@ -108,6 +108,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_one_backend_pool.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_one_backend_pool.py index 3caf81345066..6cf60155af26 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_one_backend_pool.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_one_backend_pool.py @@ -102,6 +102,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_two_backend_pool.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_two_backend_pool.py index 203c0b711b24..a810a6845cc5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_two_backend_pool.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_gateway_load_balancer_provider_with_two_backend_pool.py @@ -96,6 +96,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_global_tier.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_global_tier.py index 692d38af771c..b070cb3bc5cc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_global_tier.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_global_tier.py @@ -104,6 +104,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateGlobalTier.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateGlobalTier.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_standard_sku.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_standard_sku.py index b3661e56c51b..9cb01916cd97 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_standard_sku.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_standard_sku.py @@ -105,6 +105,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateStandardSku.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateStandardSku.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_inbound_nat_pool.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_inbound_nat_pool.py index 8200f1b9b13a..4a22bb81cce1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_inbound_nat_pool.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_inbound_nat_pool.py @@ -78,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateWithInboundNatPool.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateWithInboundNatPool.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_outbound_rules.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_outbound_rules.py index 826c5cb7bfbc..5c539c8d69d0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_outbound_rules.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_outbound_rules.py @@ -121,6 +121,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateWithOutboundRules.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateWithOutboundRules.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_sync_mode_property_on_pool.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_sync_mode_property_on_pool.py index 00642448d926..ca1b45cb33e4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_sync_mode_property_on_pool.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_sync_mode_property_on_pool.py @@ -115,6 +115,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_zones.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_zones.py index 569022d7c1bb..b0a20f8a4927 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_zones.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_create_with_zones.py @@ -106,6 +106,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerCreateWithZones.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerCreateWithZones.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_delete.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_delete.py index b67cafa41e71..5041ea935ee4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_get.py index dade7c429d7d..a6bcc38adc83 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerFrontendIPConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerFrontendIPConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_list.py index 3209d9d4e791..f4878d34a05b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_frontend_ip_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerFrontendIPConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerFrontendIPConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get.py index 61f865033e16..75d70e3816dc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get_inbound_nat_rule_port_mapping.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get_inbound_nat_rule_port_mapping.py index eb7dd337845a..59382bff4301 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get_inbound_nat_rule_port_mapping.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_get_inbound_nat_rule_port_mapping.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerGetInboundNatRulePortMapping.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerGetInboundNatRulePortMapping.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list.py index 77e7e6cea213..32227f6428f5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list_all.py index cd712733922e..8a2292dbfef6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_get.py index e8cb32ad7892..c00be111feea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerLoadBalancingRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerLoadBalancingRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_list.py index 33e7d34d3bb5..c8b488461a69 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_load_balancing_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerLoadBalancingRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerLoadBalancingRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_simple.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_simple.py index 4f8df471ec14..44d5f0c5c11d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_simple.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_simple.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerNetworkInterfaceListSimple.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerNetworkInterfaceListSimple.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_vmss.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_vmss.py index 30515e5536da..1be2e0d57cf4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_vmss.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_network_interface_list_vmss.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerNetworkInterfaceListVmss.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerNetworkInterfaceListVmss.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_get.py index d990fd9eee33..fb5cf662b01c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerOutboundRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerOutboundRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_list.py index a363cc97e500..6501ab7b2630 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_outbound_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerOutboundRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerOutboundRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_get.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_get.py index e3844ac931ab..ab7c10aebee2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerProbeGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerProbeGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_list.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_list.py index 3e701bb36b1e..a46d42e633c1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_probe_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerProbeList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerProbeList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_update_tags.py index e4a05a5499ce..a65f10eef8cc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancer_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancer_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancerUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancerUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/load_balancers_swap_public_ip_addresses.py b/sdk/network/azure-mgmt-network/generated_samples/load_balancers_swap_public_ip_addresses.py index 3c1fef2e8a6a..a30593489457 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/load_balancers_swap_public_ip_addresses.py +++ b/sdk/network/azure-mgmt-network/generated_samples/load_balancers_swap_public_ip_addresses.py @@ -54,6 +54,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LoadBalancersSwapPublicIpAddresses.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LoadBalancersSwapPublicIpAddresses.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_create.py b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_create.py index 74a5a61ba4dd..c67765c3190d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_create.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LocalNetworkGatewayCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LocalNetworkGatewayCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_delete.py index 9536de8d2cd4..02dc485f2958 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LocalNetworkGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LocalNetworkGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_get.py index 6207a86fac8a..d7ecacc11185 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LocalNetworkGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LocalNetworkGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_list.py index 84992ab60722..7a557a9d2440 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LocalNetworkGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LocalNetworkGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_update_tags.py index 772acf831d0b..2a1953169b69 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/local_network_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/LocalNetworkGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/LocalNetworkGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/migrate_load_balancer_to_ip_based.py b/sdk/network/azure-mgmt-network/generated_samples/migrate_load_balancer_to_ip_based.py index fdceca863a9c..64a401084f78 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/migrate_load_balancer_to_ip_based.py +++ b/sdk/network/azure-mgmt-network/generated_samples/migrate_load_balancer_to_ip_based.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/MigrateLoadBalancerToIPBased.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/MigrateLoadBalancerToIPBased.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_create_or_update.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_create_or_update.py index ab824acc40d5..f28f3a1f4f4a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_create_or_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_create_or_update.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayCreateOrUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_delete.py index 85718fb18f11..764d050a06af 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_get.py index bff395c0baa6..fb59bc2cae68 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list.py index 72dd2d07d0e7..125ef7d069c4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list_all.py index ba3be8fb1141..2574758aad1c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_update_tags.py index 58a6151eef69..c44cf502df89 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_delete.py index 87f70e7a33ef..49df9b549ac5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_get.py index 6559d9e33178..20eb6a40a864 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_list.py index 06fba6420b0e..94803bdd280b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_put.py b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_put.py index e23c9e1f7904..e559dbaff871 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/nat_rule_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/nat_rule_put.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NatRulePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatRulePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_create.py index cb1b5cddd375..cda3cf3bbeea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_create.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_create_gateway_load_balancer_consumer.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_create_gateway_load_balancer_consumer.py index 6f03d57d1cd3..c5655b83b1ce 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_create_gateway_load_balancer_consumer.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_create_gateway_load_balancer_consumer.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceCreateGatewayLoadBalancerConsumer.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceCreateGatewayLoadBalancerConsumer.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_delete.py index 3fdbfc2d0918..a2b24b6e84b4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_nsg_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_nsg_list.py index eab7d7c5423b..a4c0c901870e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_nsg_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_nsg_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceEffectiveNSGList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceEffectiveNSGList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_route_table_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_route_table_list.py index 1ad01581e618..1ab82d0d0535 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_route_table_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_effective_route_table_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceEffectiveRouteTableList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceEffectiveRouteTableList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_get.py index c0c3a07f330f..21a2d072ba85 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_get.py index 60391e044872..30120e83660d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceIPConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceIPConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_list.py index 73e82c87e70c..1bd7f29cc01a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_ip_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceIPConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceIPConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_list.py index e08b3dc87ef3..18b7d945e60e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_list_all.py index 722441ed94cb..30f9c74702a4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_load_balancer_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_load_balancer_list.py index 97b1ef3f0c85..1abaf8c78ec8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_load_balancer_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_load_balancer_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceLoadBalancerList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceLoadBalancerList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_create.py index 1eecf4dba735..4047b413dff1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_create.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceTapConfigurationCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceTapConfigurationCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_delete.py index f05dd003ae44..7a8b27d90358 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceTapConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceTapConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_get.py index c39084ac1bc6..82241c7c416a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceTapConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceTapConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_list.py index 919ab7948388..a89aea0cedf0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_tap_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceTapConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceTapConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_interface_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_interface_update_tags.py index 066d39e06a09..44926a9e1fea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_interface_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_interface_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkInterfaceUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkInterfaceUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_connectivity_configurations_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_connectivity_configurations_list.py index 030f7a7fbdf4..91c185bf6986 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_connectivity_configurations_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_connectivity_configurations_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerActiveConnectivityConfigurationsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerActiveConnectivityConfigurationsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_security_admin_rules_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_security_admin_rules_list.py index b0815b8c4826..ed0902a436c6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_security_admin_rules_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_active_security_admin_rules_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerActiveSecurityAdminRulesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerActiveSecurityAdminRulesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_delete.py index 366ce7b6ca0d..aff619fcaee7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleCollectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleCollectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_get.py index 493d8eccff8a..86f9b63831f0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleCollectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleCollectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_list.py index fb23d5b140fb..5fb9cefd174b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleCollectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleCollectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_put.py index 59e1916d5c51..7698b8f67199 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_collection_put.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleCollectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleCollectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_delete.py index 7fcf105a5277..5d262fd7116c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_get.py index a1cf2f9cf886..89da7d00acf2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_list.py index d99b81149ca4..6a6dc766bb87 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_put.py index 6694fe431876..3c0797caf826 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_admin_rule_put.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerAdminRulePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerAdminRulePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_commit_post.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_commit_post.py index 0c3036077c00..9284af4a56d8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_commit_post.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_commit_post.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerCommitPost.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerCommitPost.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_delete.py index 90f0d5018416..59d43c3aa708 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_delete.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionManagementGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionManagementGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_get.py index 52f4f77efad6..6632d7bc4278 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionManagementGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionManagementGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_list.py index 17b1fb85a784..536aac7aec9e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionManagementGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionManagementGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_put.py index 3d9e280435a5..60a37c1e2f31 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_management_group_put.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionManagementGroupPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionManagementGroupPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_delete.py index 1ebf48d15180..8931248722b7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_delete.py @@ -34,6 +34,6 @@ def main(): ) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionSubscriptionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionSubscriptionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_get.py index d4872eb1bebf..25bcd63c2f85 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionSubscriptionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionSubscriptionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_list.py index 2ef4409e0694..140216e3a318 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionSubscriptionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionSubscriptionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_put.py index 7fc83d7e2566..d8827c2e5bd9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connection_subscription_put.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectionSubscriptionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectionSubscriptionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_delete.py index 29f62dee50a0..982f942f0c16 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectivityConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectivityConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_get.py index bb770402fa2d..6894a5fbd5c5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectivityConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectivityConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_list.py index 06a4303aafee..a26b012eb21b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectivityConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectivityConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_put.py index 47275a10baef..ef17345856ee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_connectivity_configuration_put.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerConnectivityConfigurationPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerConnectivityConfigurationPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_get.py index 7ed0180d5bac..c593897e7a02 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerDefaultAdminRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerDefaultAdminRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_put.py index fce388ec37a9..bdb0c18aeeb8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_default_admin_rule_put.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerDefaultAdminRulePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerDefaultAdminRulePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_delete.py index 760727aa7878..cc8a7ef9e623 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_deployment_status_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_deployment_status_list.py index e31aa2c456bd..19e306062788 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_deployment_status_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_deployment_status_list.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerDeploymentStatusList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerDeploymentStatusList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_connectivity_configurations_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_connectivity_configurations_list.py index 618b5e47c761..e846f460f20a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_connectivity_configurations_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_connectivity_configurations_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerEffectiveConnectivityConfigurationsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerEffectiveConnectivityConfigurationsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_security_admin_rules_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_security_admin_rules_list.py index efb60b04076c..6dce205dced4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_security_admin_rules_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_effective_security_admin_rules_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerEffectiveSecurityAdminRulesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerEffectiveSecurityAdminRulesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_get.py index 271e48decc01..a9e38cd07414 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_delete.py index 7e4be7e145f5..deea061a7673 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_get.py index 31f1251ec68a..b5578b73ab97 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_list.py index 504c89a17a78..5d9f3006a3a4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_put.py index a1f8cc871502..e4ba3f1a5b86 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_group_put.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerGroupPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerGroupPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_list.py index 54b0e2c61469..c89572fcb8f7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_list_all.py index a3e2d9e2c236..0a61652c141f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_patch.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_patch.py index b653a118b9ae..122f3e2ce563 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_patch.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerPatch.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerPatch.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_put.py index c96f879152c9..46aa7e3ae90b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_put.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_delete.py index 098d2d0bba47..946e15f997a7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerScopeConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerScopeConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_get.py index ce4f7a567e4a..24f2702e3c0b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerScopeConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerScopeConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_list.py index eb2194b43784..9c7c532c4068 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerScopeConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerScopeConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_put.py index 2eda1b3a2aca..73895fbdd010 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_scope_connection_put.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerScopeConnectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerScopeConnectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_delete.py index 74bd3e18d138..b4a71646f6da 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerSecurityAdminConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerSecurityAdminConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_get.py index 54e0326f0851..4f04e204ddde 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerSecurityAdminConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerSecurityAdminConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_list.py index cb2b45157ee9..b469d8a3be4f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerSecurityAdminConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerSecurityAdminConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_put.py index 69e85a9b8c9c..c1f793457949 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_security_admin_configuration_put.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerSecurityAdminConfigurationPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerSecurityAdminConfigurationPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_delete.py index 7b010ab50815..748972b7758a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerStaticMemberDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerStaticMemberDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_get.py index d33f16421981..dc43876f1c7f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerStaticMemberGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerStaticMemberGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_list.py index 0cf126e22560..ca476486ddab 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerStaticMemberList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerStaticMemberList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_put.py index 2826a56718c8..d5b588ff00f1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_manager_static_member_put.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkManagerStaticMemberPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkManagerStaticMemberPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_create_config_only.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_create_config_only.py index 7b7e3bca893f..56f98c6c4d3a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_create_config_only.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_create_config_only.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileCreateConfigOnly.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileCreateConfigOnly.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_delete.py index 01ff8431e2b5..5847e2aaef25 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_config_only.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_config_only.py index f9fea5ff0d4e..613ec64c94ad 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_config_only.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_config_only.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileGetConfigOnly.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileGetConfigOnly.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_with_container_nic.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_with_container_nic.py index b372e2159cca..613613f18975 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_with_container_nic.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_get_with_container_nic.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileGetWithContainerNic.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileGetWithContainerNic.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_list.py index 22d2fbc2dcdb..aa91da321868 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_list_all.py index ee55bdc45e8c..7fc516c32f38 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_profile_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_profile_update_tags.py index b2f211862ad9..2270186cd625 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_profile_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_profile_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkProfileUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkProfileUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create.py index fe8196050b85..586bc2b2022c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create_with_rule.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create_with_rule.py index 4f34d5f8fa4f..fb197273d96f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create_with_rule.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_create_with_rule.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupCreateWithRule.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupCreateWithRule.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_delete.py index 1c2da5c16965..d1bf76c916c4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_get.py index 05ac74bade66..409830ca2922 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list.py index f5ebfa49ead7..fe3f1dd359ec 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list_all.py index 05c34721c0dd..311ceb70d2d9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_create.py index 9b99c068dfa6..249035ce2e9c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_create.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupRuleCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_delete.py index 08e290062cce..ca319ce0ce52 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_get.py index 536413235af8..8f23c6b542f6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_list.py index 3964f1563df1..7890563a7ec7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_update_tags.py index 777ea861eca7..7a0471c26afa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_security_group_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_security_group_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkSecurityGroupUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkSecurityGroupUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_delete.py index 664cf6436d7d..fd44ffd00940 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_get.py index 8c9c2b7f77b5..02c0446c5808 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_list.py index d65392648faa..c49413985672 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_put.py index 18418e510626..1061be363cb0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_connection_put.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceConnectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceConnectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_delete.py index ec913b77b0d2..fb9ea678e9a1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_get.py index a8d7a74f0849..9c6f46fc5705 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_resource_group.py index 5de3a0635878..0f3f8f5d95ff 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_subscription.py index 5654d2a3780c..9e3fdab05cd3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_put.py index ec62bc24b674..fe22245767f7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_put.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualAppliancePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualAppliancePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_saa_sput.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_saa_sput.py index ab86e6fb5295..e3929efcc3f4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_saa_sput.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_saa_sput.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSaaSPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSaaSPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_delete.py index 13dda06b7647..1e7553b129ba 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSiteDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSiteDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_get.py index 3e18a8691a5c..507083d7ab6a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSiteGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSiteGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_list.py index 66bfe8d041f8..428f89b68965 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSiteList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSiteList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_put.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_put.py index a4086bb2e1fb..ff7f894adc2e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_site_put.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSitePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSitePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_get.py index 725d16c3df83..8f65149e2342 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSkuGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSkuGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_list.py index b2c9d2a7ef04..c846807bd675 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_sku_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceSkuList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceSkuList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_update_tags.py index 5b7dc226d80c..ce828b8258b6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_virtual_appliance_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkVirtualApplianceUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkVirtualApplianceUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_available_providers_list_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_available_providers_list_get.py index 9a744d55a6cb..73f6de96eac9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_available_providers_list_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_available_providers_list_get.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherAvailableProvidersListGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherAvailableProvidersListGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_azure_reachability_report_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_azure_reachability_report_get.py index 59e4024611e1..3b80b596ae8b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_azure_reachability_report_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_azure_reachability_report_get.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherAzureReachabilityReportGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherAzureReachabilityReportGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_create.py index 1b695af40a8d..475513d4f258 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_create.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_delete.py index 28fdfcbb4621..700e25ab414c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_get.py index be7dab7a9c9c..3a48f2e90070 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_list.py index 86d7ddcfa5f8..f577fcccd827 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_query.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_query.py index 5306deba8d21..ac382c000e9f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_query.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_query.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorQuery.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorQuery.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_start.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_start.py index cb755ede5fff..02aa891a9300 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_start.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_start.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorStart.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorStart.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_stop.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_stop.py index 6c2d77616325..0c887264d312 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_stop.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_stop.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorStop.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorStop.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_update_tags.py index 26d5dbd301a6..1bf6fce46add 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_update_tags.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_v2_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_v2_create.py index 45a8ed74ece7..6b9ac73cbaee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_v2_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connection_monitor_v2_create.py @@ -72,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectionMonitorV2Create.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectionMonitorV2Create.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connectivity_check.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connectivity_check.py index 4a06455c8e34..d895af392aae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connectivity_check.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_connectivity_check.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherConnectivityCheck.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherConnectivityCheck.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_create.py index 4bf7d6e3f5b0..5b701e58bc16 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_delete.py index c9344257e6eb..fbf58a41f0a3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_configure.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_configure.py index 9fc4a66a24ec..e1a0599875e9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_configure.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_configure.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogConfigure.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogConfigure.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_create.py index 4c45f45152cb..757a6d2ff6b8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_delete.py index e7340dc9225a..e581d9610ba7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_get.py index cede9838778a..7b491d1def66 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_list.py index e018c3589079..c67b301b9829 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_status_query.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_status_query.py index 906615afd71f..2b86271ee012 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_status_query.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_status_query.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogStatusQuery.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogStatusQuery.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_update_tags.py index ad8dfec733a5..71551a69e54a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_flow_log_update_tags.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherFlowLogUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherFlowLogUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_get.py index 01ce900a57c8..5359b8937941 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_ip_flow_verify.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_ip_flow_verify.py index 08360d4ccb76..cf19af0f9e32 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_ip_flow_verify.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_ip_flow_verify.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherIpFlowVerify.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherIpFlowVerify.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list.py index 018e6eba8051..78a781ff9218 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list_all.py index 92d9a0e91adc..93389258bd3b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_network_configuration_diagnostic.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_network_configuration_diagnostic.py index 05759cffff46..0ecae060859f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_network_configuration_diagnostic.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_network_configuration_diagnostic.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherNetworkConfigurationDiagnostic.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherNetworkConfigurationDiagnostic.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_next_hop_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_next_hop_get.py index bc6011805fc3..0d2692d21f4c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_next_hop_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_next_hop_get.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherNextHopGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherNextHopGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_create.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_create.py index 4cbe9561d533..68fe404f3cab 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_create.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCaptureCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCaptureCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_delete.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_delete.py index b49dea9d0311..9d751106f31c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCaptureDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCaptureDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_get.py index df35bcca28d9..b79fd6e8d6b5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCaptureGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCaptureGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_query_status.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_query_status.py index f3c0e2ce3472..486919e6ece9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_query_status.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_query_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCaptureQueryStatus.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCaptureQueryStatus.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_stop.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_stop.py index aa804dd2db40..268692128f12 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_stop.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_capture_stop.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCaptureStop.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCaptureStop.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_captures_list.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_captures_list.py index 33e2e7f88035..d5fc88b1c25a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_captures_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_packet_captures_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherPacketCapturesList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherPacketCapturesList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_security_group_view_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_security_group_view_get.py index 70cad52a3bd9..d39eedab15df 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_security_group_view_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_security_group_view_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherSecurityGroupViewGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherSecurityGroupViewGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_topology_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_topology_get.py index e212ba89070e..288ee9106014 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_topology_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_topology_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherTopologyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherTopologyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_get.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_get.py index 732add2e3fb3..14a3ce155741 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_get.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherTroubleshootGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherTroubleshootGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_result_query.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_result_query.py index db66080a3015..50db54525ccf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_result_query.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_troubleshoot_result_query.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherTroubleshootResultQuery.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherTroubleshootResultQuery.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_update_tags.py index ff6887dc5167..75ecffe26ef6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/network_watcher_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/network_watcher_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/NetworkWatcherUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NetworkWatcherUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/operation_list.py b/sdk/network/azure-mgmt-network/generated_samples/operation_list.py index 2d5796370f95..643d2fb00bd6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/operation_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/operation_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/OperationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_delete.py index 7d0812d6eeed..b6144a5f4888 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_generate_vpn_profile.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_generate_vpn_profile.py index 3e9792048632..262d884f6aae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_generate_vpn_profile.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_generate_vpn_profile.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayGenerateVpnProfile.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayGenerateVpnProfile.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get.py index 3fca49a4b3fe..e289bbc86dec 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health.py index 26683539a99b..6d0aa46aee36 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayGetConnectionHealth.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayGetConnectionHealth.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health_detailed.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health_detailed.py index 4ceda80d695a..8b288ed5516d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health_detailed.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_get_connection_health_detailed.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayGetConnectionHealthDetailed.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayGetConnectionHealthDetailed.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list.py index 8fb12a3a545a..34f04f7158c9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list_by_resource_group.py index 245d32771408..2db7ee49f8dc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_reset.py b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_reset.py index 02732dfec5e6..79a735f42837 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_reset.py +++ b/sdk/network/azure-mgmt-network/generated_samples/p2_svpn_gateway_reset.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/P2SVpnGatewayReset.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/P2SVpnGatewayReset.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_get.py index e25e8c4e5ee5..07308f853649 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PeerExpressRouteCircuitConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PeerExpressRouteCircuitConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_list.py index 3ccf0d8445eb..2760fa5f9552 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/peer_express_route_circuit_connection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PeerExpressRouteCircuitConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PeerExpressRouteCircuitConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create.py index 20e572844fa9..0cb7a3f70293 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_for_manual_approval.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_for_manual_approval.py index 543f78663fda..58e1a7933d97 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_for_manual_approval.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_for_manual_approval.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointCreateForManualApproval.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointCreateForManualApproval.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_with_asg.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_with_asg.py index bf25870fed3f..cbdb520fab7b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_with_asg.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_create_with_asg.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointCreateWithASG.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointCreateWithASG.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_delete.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_delete.py index ddee0c598d2e..43274d604351 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_create.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_create.py index dbb908db9913..2579f32eeb2e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_create.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointDnsZoneGroupCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointDnsZoneGroupCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_delete.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_delete.py index 1543c2b6f1dc..ba096cb0419f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointDnsZoneGroupDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointDnsZoneGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_get.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_get.py index 4cb6de3424e3..b5da3baab419 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointDnsZoneGroupGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointDnsZoneGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_list.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_list.py index 66421450d686..29a303e0251c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_dns_zone_group_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointDnsZoneGroupList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointDnsZoneGroupList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get.py index 065a7162a57e..a8d802c133fb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_for_manual_approval.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_for_manual_approval.py index 1a107c44b5f2..c7b8f43944cf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_for_manual_approval.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_for_manual_approval.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointGetForManualApproval.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointGetForManualApproval.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_with_asg.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_with_asg.py index f58501d9924e..c1fd20c34caf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_with_asg.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_get_with_asg.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointGetWithASG.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointGetWithASG.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list.py index 3a4c0f76f18c..46ece2d6f1bd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list_all.py index 8e1b8f704912..58ad8b63efcc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_endpoint_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateEndpointListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateEndpointListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_create.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_create.py index c4f79b48c718..a197ff4566ce 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_create.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete.py index 0492c5ebade0..7dcffbe84405 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete_private_endpoint_connection.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete_private_endpoint_connection.py index 557799e7f6c6..f9cf99fefba2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete_private_endpoint_connection.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_delete_private_endpoint_connection.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get.py index 21ab8fe09c28..76f4fff3caf8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get_private_endpoint_connection.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get_private_endpoint_connection.py index 55b9b00e196d..3a0d97dfaee1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get_private_endpoint_connection.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceGetPrivateEndpointConnection.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list.py index 22b11aac15cf..6ea888d8cb7e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_all.py index 883edf4308a5..2c6fd4ec5c79 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_private_endpoint_connection.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_private_endpoint_connection.py index b12c5bedb222..e2d057c93601 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_private_endpoint_connection.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_list_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceListPrivateEndpointConnection.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceListPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_update_private_endpoint_connection.py b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_update_private_endpoint_connection.py index 2719621cabdb..35d2c165e96c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/private_link_service_update_private_endpoint_connection.py +++ b/sdk/network/azure-mgmt-network/generated_samples/private_link_service_update_private_endpoint_connection.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PrivateLinkServiceUpdatePrivateEndpointConnection.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PrivateLinkServiceUpdatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_customized_values.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_customized_values.py index 9cf56f26dd0d..2b93b2d74653 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_customized_values.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_customized_values.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressCreateCustomizedValues.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressCreateCustomizedValues.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_defaults.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_defaults.py index 90f1ce93d223..10fb94b62d7b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_defaults.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_defaults.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressCreateDefaults.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressCreateDefaults.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns.py index 334f69e83455..f46c4d778b1e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressCreateDns.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressCreateDns.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns_with_domain_name_label_scope.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns_with_domain_name_label_scope.py index 4a5b6ec9a0b1..d3a036fed665 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns_with_domain_name_label_scope.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_create_dns_with_domain_name_label_scope.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressCreateDnsWithDomainNameLabelScope.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressCreateDnsWithDomainNameLabelScope.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_delete.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_delete.py index 4935fb2afa41..49aac46cb95d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get.py index f72cce5fc845..9c161563fb92 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get_ddos_protection_status.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get_ddos_protection_status.py index 428be0acc003..af405a337072 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get_ddos_protection_status.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_get_ddos_protection_status.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressGetDdosProtectionStatus.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressGetDdosProtectionStatus.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list.py index 9f0446409ee5..0e88078a4e28 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list_all.py index 6048a5d64f7a..ff12e2affbd8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_update_tags.py index ac83818bc25f..061cf05ec3ae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_address_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpAddressUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpAddressUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_customized_values.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_customized_values.py index e0dee2264764..a991b6a288e3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_customized_values.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_customized_values.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixCreateCustomizedValues.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixCreateCustomizedValues.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_defaults.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_defaults.py index 551311ec0d27..79d8c956ba73 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_defaults.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_create_defaults.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixCreateDefaults.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixCreateDefaults.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_delete.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_delete.py index 9b73f6497852..7c8477563f76 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_get.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_get.py index 55b6c6abdcec..34fc2bfc6afd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list.py index f9a1bdd5086c..91c8378df587 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list_all.py index ecfa24daec95..5868441015e3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_update_tags.py index 9c820f7add86..cadcfc9bb25a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/public_ip_prefix_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/PublicIpPrefixUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/PublicIpPrefixUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/query_inbound_nat_rule_port_mapping.py b/sdk/network/azure-mgmt-network/generated_samples/query_inbound_nat_rule_port_mapping.py index 46a610f6a24a..eaeeb0e619eb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/query_inbound_nat_rule_port_mapping.py +++ b/sdk/network/azure-mgmt-network/generated_samples/query_inbound_nat_rule_port_mapping.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/QueryInboundNatRulePortMapping.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/QueryInboundNatRulePortMapping.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_create.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_create.py index e2168ea40434..71715520d13e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_create.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_delete.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_delete.py index 7437d19d4ff4..a420539bc96a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_get.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_get.py index 04e9d7e59bb3..84b9843c9564 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_list.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_list.py index 6152190bffa1..597bc8610969 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_list_by_resource_group.py index ef3b6c5e51ca..4ec9f750dffe 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_create.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_create.py index 8fa3cdd277b6..5967c8328c30 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_create.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterRuleCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_delete.py index d41787248790..03bd940fc433 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_get.py index 72260aa6cef3..75c6a5029ade 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_list_by_route_filter.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_list_by_route_filter.py index fecba7185ce9..51bbd1986752 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_list_by_route_filter.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_rule_list_by_route_filter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterRuleListByRouteFilter.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterRuleListByRouteFilter.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_filter_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/route_filter_update_tags.py index d51cbe38ac70..e52e8f27b9ea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_filter_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_filter_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteFilterUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteFilterUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_map_delete.py b/sdk/network/azure-mgmt-network/generated_samples/route_map_delete.py index b2067ab38164..d14b95846802 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_map_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_map_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteMapDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteMapDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_map_get.py b/sdk/network/azure-mgmt-network/generated_samples/route_map_get.py index e8ff6f8b8e16..f8b8c547b744 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_map_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_map_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteMapGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteMapGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_map_list.py b/sdk/network/azure-mgmt-network/generated_samples/route_map_list.py index 5feb9cbc51a5..062a99e52b09 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_map_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_map_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteMapList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteMapList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_map_put.py b/sdk/network/azure-mgmt-network/generated_samples/route_map_put.py index 8fb058838cf6..3f43b6f1465c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_map_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_map_put.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteMapPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteMapPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_create.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_create.py index e1602554ebe3..f77027c9e4de 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_create_with_route.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_create_with_route.py index 15b7fd528637..ec27d0f65f52 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_create_with_route.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_create_with_route.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableCreateWithRoute.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableCreateWithRoute.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_delete.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_delete.py index 515627e28abe..e4a39b9140a5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_get.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_get.py index 4a3e325f5d36..0a180b2cd595 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_list.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_list.py index 51cf42f4c2b3..92b9e74f1b9e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_list_all.py index 989a42415c77..5716067fd1cf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_create.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_create.py index eb52941316cb..67f18b006c53 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableRouteCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableRouteCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_delete.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_delete.py index 3db2c4c117fb..2e61ff775178 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableRouteDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableRouteDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_get.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_get.py index dd75c466b9fe..983559c87ba3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableRouteGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableRouteGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_list.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_list.py index d95df2f28f0d..5ff7b1eaf935 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_route_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_route_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableRouteList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableRouteList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/route_table_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/route_table_update_tags.py index b6cc0669a1a2..148c22cb416a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/route_table_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/route_table_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RouteTableUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RouteTableUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_delete.py b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_delete.py index 30a9da3e052c..4f9236c61488 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RoutingIntentDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RoutingIntentDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_get.py b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_get.py index 665a37773e96..fffaada1281b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RoutingIntentGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RoutingIntentGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_list.py b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_list.py index 9e527ae05b6c..ecc574526636 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RoutingIntentList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RoutingIntentList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_put.py b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_put.py index e10de474670b..dedf05e4f834 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/routing_intent_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/routing_intent_put.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/RoutingIntentPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/RoutingIntentPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_delete.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_delete.py index f56c8c1acb3f..1f719d8a34e6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_get.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_get.py index 4633bb8ca161..fee9d13b3699 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_resource_group.py index ab0d669370ce..7490526342d1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_subscription.py index 889c112bcc78..648b3f2b9864 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_put.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_put.py index a0e7009c0c7c..d00ee9c63b2b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_put.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_update_tags.py index 5a8fc1b9e7a4..408cf072dc3f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/security_partner_provider_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SecurityPartnerProviderUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SecurityPartnerProviderUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_community_list.py b/sdk/network/azure-mgmt-network/generated_samples/service_community_list.py index e17d34e6c7f5..f0bc453ace97 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_community_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_community_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceCommunityList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceCommunityList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create.py index 5b867d4799ce..a3221d42a617 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create_with_definition.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create_with_definition.py index f3cef791d6f5..ef025ed7164b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create_with_definition.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_create_with_definition.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyCreateWithDefinition.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyCreateWithDefinition.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_create.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_create.py index 1e0e6ded3074..7c3710f6f1f6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_create.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyDefinitionCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyDefinitionCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_delete.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_delete.py index 6f362529a546..303f679d3e55 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyDefinitionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_get.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_get.py index e6252db58408..5908e6473aad 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyDefinitionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_list.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_list.py index 152da7f86c05..1adbbd1b3c13 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_definition_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyDefinitionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_delete.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_delete.py index 754232d6baca..c4f460a3ed62 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_get.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_get.py index 795ffde3b185..a48cf2281afd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list.py index c0dd836af6e2..cd4b3acebdf4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list_all.py index cfa7bae0d09d..d81757d0d644 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_update_tags.py index 77dda09d480c..e3b1d9b8eafc 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_endpoint_policy_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceEndpointPolicyUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceEndpointPolicyUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result.py b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result.py index 78f45abf7fc9..c942c835e4a3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceTagInformationListResult.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceTagInformationListResult.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_no_address_prefixes.py b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_no_address_prefixes.py index 575d233458a1..a57f15034547 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_no_address_prefixes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_no_address_prefixes.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceTagInformationListResultWithNoAddressPrefixes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceTagInformationListResultWithNoAddressPrefixes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_tagname.py b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_tagname.py index bb127bb4d0d5..eeb99fd762b9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_tagname.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_tag_information_list_result_with_tagname.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceTagInformationListResultWithTagname.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceTagInformationListResultWithTagname.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/service_tags_list.py b/sdk/network/azure-mgmt-network/generated_samples/service_tags_list.py index 7c52d9d63e29..771c0ba05fb9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/service_tags_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/service_tags_list.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/ServiceTagsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/ServiceTagsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_create.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_create.py index 2331cd80ec41..8c3eb4b6feea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_create_service_endpoint.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_create_service_endpoint.py index cca7e2a0c75a..86cad017044f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_create_service_endpoint.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_create_service_endpoint.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetCreateServiceEndpoint.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetCreateServiceEndpoint.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_create_with_delegation.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_create_with_delegation.py index 33d920025a38..e54ce8dce3c8 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_create_with_delegation.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_create_with_delegation.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetCreateWithDelegation.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetCreateWithDelegation.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_delete.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_delete.py index d3b2a42d7184..f4756ef3d27f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_get.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_get.py index 36c3248f521c..5942f6b2de76 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_get_with_delegation.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_get_with_delegation.py index 8936546cee11..abeb512c2f54 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_get_with_delegation.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_get_with_delegation.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetGetWithDelegation.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetGetWithDelegation.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_list.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_list.py index 72d239735290..0a6d921ec8ea 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_prepare_network_policies.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_prepare_network_policies.py index c307ea08acae..630829b4c133 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_prepare_network_policies.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_prepare_network_policies.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetPrepareNetworkPolicies.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetPrepareNetworkPolicies.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/subnet_unprepare_network_policies.py b/sdk/network/azure-mgmt-network/generated_samples/subnet_unprepare_network_policies.py index 3baa27a124b3..c80a236b62b1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/subnet_unprepare_network_policies.py +++ b/sdk/network/azure-mgmt-network/generated_samples/subnet_unprepare_network_policies.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/SubnetUnprepareNetworkPolicies.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/SubnetUnprepareNetworkPolicies.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/usage_list.py b/sdk/network/azure-mgmt-network/generated_samples/usage_list.py index 203aa23be459..b93102584882 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/usage_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/usage_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/UsageList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/UsageList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/usage_list_spaced_location.py b/sdk/network/azure-mgmt-network/generated_samples/usage_list_spaced_location.py index c6bae8257c2c..18117d511a77 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/usage_list_spaced_location.py +++ b/sdk/network/azure-mgmt-network/generated_samples/usage_list_spaced_location.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/UsageListSpacedLocation.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/UsageListSpacedLocation.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_delete.py index d1e36bb432a7..350b5a75db21 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubBgpConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubBgpConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_get.py index 3ce13bbb27f8..2c8d203d2bb6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubBgpConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubBgpConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_list.py index ff37d92521a4..ffa6fd039ff1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubBgpConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubBgpConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_put.py index af4ef766445d..da09effd2808 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_bgp_connection_put.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubBgpConnectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubBgpConnectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_delete.py index c47c0185db78..b17c6cc06a5a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_get.py index b7513c688db9..99d047bb5878 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_delete.py index 832129ef5fc6..925dc0a0a74f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubIpConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubIpConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_get.py index 42cad979a3e4..3e2d0c1b7e12 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubIpConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubIpConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_list.py index 565552faed7b..7f945b993acb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubIpConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubIpConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_put.py index 13e7ecd14bc2..af7b0771bde4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_ip_configuration_put.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubIpConfigurationPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubIpConfigurationPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list.py index 6278e3edf1be..8be320fdba49 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list_by_resource_group.py index 160cc1b0e5ef..6e74dd6f04d2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_put.py index 8a4f42b45be9..17483280654a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_put.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_delete.py index ae75c793e435..7f0680f68b4f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubRouteTableV2Delete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubRouteTableV2Delete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_get.py index 1421423836de..ed25ec7ae45d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubRouteTableV2Get.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubRouteTableV2Get.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_list.py index 64199860bcd0..9c8ed1b87b0e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubRouteTableV2List.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubRouteTableV2List.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_put.py index 2361a1a0c367..b63259bc22b6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_route_table_v2_put.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubRouteTableV2Put.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubRouteTableV2Put.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_update_tags.py index 5a80570c4df3..d801c473c17d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_hub_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualHubUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualHubUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_check_ip_address_availability.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_check_ip_address_availability.py index 46be65791b6e..e2dec0485072 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_check_ip_address_availability.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_check_ip_address_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCheckIPAddressAvailability.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCheckIPAddressAvailability.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create.py index 808081ecd0af..92bc462e3fc1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoint_policy.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoint_policy.py index c1754d0d88fd..732dc651bf9b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoint_policy.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoint_policy.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateServiceEndpointPolicy.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateServiceEndpointPolicy.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoints.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoints.py index a2e69fc8ecf2..a9f492f94db9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoints.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_service_endpoints.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateServiceEndpoints.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateServiceEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet.py index 2e3514ef4ff2..daaea0e6833c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateSubnet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateSubnet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_address_prefixes.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_address_prefixes.py index f884ca2063f5..e5daad590f45 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_address_prefixes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_address_prefixes.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateSubnetWithAddressPrefixes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateSubnetWithAddressPrefixes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_delegation.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_delegation.py index b7a49b38a7f7..8ec025c7c81a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_delegation.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_subnet_with_delegation.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateSubnetWithDelegation.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateSubnetWithDelegation.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_bgp_communities.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_bgp_communities.py index b4e95ded2f0f..e5a006495b6d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_bgp_communities.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_bgp_communities.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateWithBgpCommunities.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateWithBgpCommunities.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_encryption.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_encryption.py index b35f77c5f41f..b0a4229e8d88 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_encryption.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_create_with_encryption.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkCreateWithEncryption.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkCreateWithEncryption.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_delete.py index 2d3d340fa93d..97c67873a1ee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_create.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_create.py index 6cd3db446fc9..1ec92de71a16 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_create.py @@ -108,6 +108,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_delete.py index 4516d80cfd3a..58c34b41270f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get.py index c8da359f9463..66ceaf9c21ba 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_ike_sas.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_ike_sas.py index f931ecbf63b2..497337b1edfa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_ike_sas.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_ike_sas.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionGetIkeSas.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionGetIkeSas.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_shared_key.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_shared_key.py index f447b488924d..cc9886d6fc6a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_shared_key.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_get_shared_key.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionGetSharedKey.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionGetSharedKey.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset.py index 7872a0e9febf..44a9ee54d9fd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionReset.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionReset.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset_shared_key.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset_shared_key.py index 9cf401681a00..1bed5e15cd9b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset_shared_key.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_reset_shared_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionResetSharedKey.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionResetSharedKey.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_set_shared_key.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_set_shared_key.py index 1f33e328cf99..ee1f7b61fff5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_set_shared_key.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_set_shared_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionSetSharedKey.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionSetSharedKey.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture.py index 747ff2437a13..6218437509ac 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionStartPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionStartPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture_filter_data.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture_filter_data.py index b1d7bf2f0f2d..84f48fe2a06e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture_filter_data.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_start_packet_capture_filter_data.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionStartPacketCaptureFilterData.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionStartPacketCaptureFilterData.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_stop_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_stop_packet_capture.py index 9685623c1150..236a6277929e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_stop_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_stop_packet_capture.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionStopPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionStopPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_update_tags.py index 7e0bf4d7a47a..29eba2026e92 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connection_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connections_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connections_list.py index e1d1ff6609b6..852304d5f5b5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connections_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_connections_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayConnectionsList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayConnectionsList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_delete.py index 63b474e93a37..3af3fc8bb4d3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get.py index f73ec35421b6..38f50b53bc67 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_advertised_routes.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_advertised_routes.py index c69c183bae0d..fc96bd982540 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_advertised_routes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_advertised_routes.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGetAdvertisedRoutes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGetAdvertisedRoutes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_bgp_peer_status.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_bgp_peer_status.py index 373bfca784e4..ed5306fd1edf 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_bgp_peer_status.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_bgp_peer_status.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGetBGPPeerStatus.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGetBGPPeerStatus.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_client_ipsec_parameters.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_client_ipsec_parameters.py index b3d185c8f143..65c86a35d769 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_client_ipsec_parameters.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_client_ipsec_parameters.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGetVpnClientIpsecParameters.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGetVpnClientIpsecParameters.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_profile_package_url.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_profile_package_url.py index be3f61e79d53..229f4e98c5e6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_profile_package_url.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpn_profile_package_url.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGetVpnProfilePackageUrl.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGetVpnProfilePackageUrl.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpnclient_connection_health.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpnclient_connection_health.py index b4a29255d606..06fccb11d20b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpnclient_connection_health.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_get_vpnclient_connection_health.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayGetVpnclientConnectionHealth.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayGetVpnclientConnectionHealth.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_learned_routes.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_learned_routes.py index ae8304b182cd..7897fa78a570 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_learned_routes.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_learned_routes.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayLearnedRoutes.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayLearnedRoutes.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_list.py index 7960aaf7754e..ac4222d0b908 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_delete.py index d85c658eb5c6..183e9bbb2f55 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayNatRuleDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayNatRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_get.py index 90aa5265c17d..d94ffd53c99b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayNatRuleGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayNatRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_list.py index 7789be64029d..28bdb7cecc1c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayNatRuleList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayNatRuleList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_put.py index eba585daae8a..734eee0c01ce 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_nat_rule_put.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayNatRulePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayNatRulePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset.py index 4e774d4f83e8..61d11151895c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayReset.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayReset.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset_vpn_client_shared_key.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset_vpn_client_shared_key.py index d15d582357de..a58db12a2468 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset_vpn_client_shared_key.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_reset_vpn_client_shared_key.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayResetVpnClientSharedKey.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayResetVpnClientSharedKey.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_set_vpn_client_ipsec_parameters.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_set_vpn_client_ipsec_parameters.py index 02ddb4ea2503..8685ca51959d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_set_vpn_client_ipsec_parameters.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_set_vpn_client_ipsec_parameters.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewaySetVpnClientIpsecParameters.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewaySetVpnClientIpsecParameters.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture.py index 59e1aa2f88c0..7427701ccca5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayStartPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayStartPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture_filter_data.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture_filter_data.py index 77da52e3277d..abcb931548f7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture_filter_data.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_start_packet_capture_filter_data.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayStartPacketCaptureFilterData.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayStartPacketCaptureFilterData.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_stop_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_stop_packet_capture.py index ee429831fed2..fd5c4ea05401 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_stop_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_stop_packet_capture.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayStopPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayStopPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_supported_vpn_device.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_supported_vpn_device.py index 41d02c2873ff..a07dce9a1795 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_supported_vpn_device.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_supported_vpn_device.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewaySupportedVpnDevice.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewaySupportedVpnDevice.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update.py index 93be941fed91..b97c57b15830 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update.py @@ -103,6 +103,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update_tags.py index 30f5f7dab7c4..71b125e8dee0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_vpn_device_configuration_script.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_vpn_device_configuration_script.py index 320afceafd97..0a80610ed22b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_vpn_device_configuration_script.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateway_vpn_device_configuration_script.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewayVpnDeviceConfigurationScript.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewayVpnDeviceConfigurationScript.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_disconnect_p2s_vpn_connections.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_disconnect_p2s_vpn_connections.py index a0f4d9bf3149..662ab14d3508 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_disconnect_p2s_vpn_connections.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_disconnect_p2s_vpn_connections.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewaysDisconnectP2sVpnConnections.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewaysDisconnectP2sVpnConnections.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_list_connections.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_list_connections.py index e711471f9d70..def95fac9bdd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_list_connections.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_gateways_list_connections.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGatewaysListConnections.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGatewaysListConnections.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get.py index 240d9a4ebffe..f12fa750d426 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_ddos_protection_status.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_ddos_protection_status.py index 01329545b871..d7815bdd2371 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_ddos_protection_status.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_ddos_protection_status.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGetDdosProtectionStatus.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGetDdosProtectionStatus.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_resource_navigation_links.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_resource_navigation_links.py index abebf3a45259..9d566e3530b1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_resource_navigation_links.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_resource_navigation_links.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGetResourceNavigationLinks.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGetResourceNavigationLinks.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_service_association_links.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_service_association_links.py index 7c74763b2d59..d1e2b86237de 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_service_association_links.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_service_association_links.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGetServiceAssociationLinks.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGetServiceAssociationLinks.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_service_association_link.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_service_association_link.py index c254ac917497..09b671051b4c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_service_association_link.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_service_association_link.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGetWithServiceAssociationLink.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGetWithServiceAssociationLink.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_subnet_delegation.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_subnet_delegation.py index 3abe08386288..3858003a3ab0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_subnet_delegation.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_get_with_subnet_delegation.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkGetWithSubnetDelegation.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkGetWithSubnetDelegation.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list.py index b72ebd3fdad3..7d5235b9f56d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_all.py index a62091b88994..823dca402b62 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_usage.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_usage.py index cb600c16d1b8..f520b336f26a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_usage.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_list_usage.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkListUsage.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkListUsage.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create.py index f363b0dd273c..80b97cea30e7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create_with_remote_virtual_network_encryption.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create_with_remote_virtual_network_encryption.py index 9823249620d1..d4dbefedd88d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create_with_remote_virtual_network_encryption.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_create_with_remote_virtual_network_encryption.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringCreateWithRemoteVirtualNetworkEncryption.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringCreateWithRemoteVirtualNetworkEncryption.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_delete.py index 81b29cae9fbb..db5ecfae5a8e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get.py index adae2d3bbb08..374ec196ae2d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get_with_remote_virtual_network_encryption.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get_with_remote_virtual_network_encryption.py index 4d6430cc76ae..afbf2a0aecc1 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get_with_remote_virtual_network_encryption.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_get_with_remote_virtual_network_encryption.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringGetWithRemoteVirtualNetworkEncryption.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringGetWithRemoteVirtualNetworkEncryption.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list.py index d327bee22ffe..ad4722dfa1e9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list_with_remote_virtual_network_encryption.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list_with_remote_virtual_network_encryption.py index effdd41a533d..757d4dc12483 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list_with_remote_virtual_network_encryption.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_list_with_remote_virtual_network_encryption.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringListWithRemoteVirtualNetworkEncryption.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringListWithRemoteVirtualNetworkEncryption.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_sync.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_sync.py index 60381e3dd9e1..7568326196ae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_sync.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_peering_sync.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkPeeringSync.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkPeeringSync.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_get.py index ee8c5a971e9f..bc7da03ced89 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkScalableGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkScalableGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_update.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_update.py index dd1537408380..4b86e8ce93c0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_scalable_gateway_update.py @@ -90,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkScalableGatewayUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkScalableGatewayUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_create.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_create.py index 2a7d3cb7fd81..aefdd154ef2b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_create.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_create.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapCreate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapCreate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_delete.py index e40fa04e778b..38ed79d1edef 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_get.py index e138f3332e62..307d5b4231b6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list.py index e7ed9cf79fd2..7e5c521ff79c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list_all.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list_all.py index 471d3200c580..80a92120544c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list_all.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_list_all.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapListAll.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapListAll.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_update_tags.py index 5322c6ca5933..d8536dec95ae 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_tap_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkTapUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkTapUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_update_tags.py index d7b1964b8225..8fff740d19f0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_network_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_network_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualNetworkUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualNetworkUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_delete.py index a6549a5c2e8b..f0719787c52d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_get.py index 99ee1ccef9a5..3987391cf1a4 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_resource_group.py index c3cbdaaed9da..b6f1bee88a12 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_subscription.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_subscription.py index 94a3db84a82a..ae2a738cd5f6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_subscription.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterListBySubscription.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_advertised_route.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_advertised_route.py index 149e0ce1b5e2..07d87e6bff4f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_advertised_route.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_advertised_route.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeerListAdvertisedRoute.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeerListAdvertisedRoute.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_learned_route.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_learned_route.py index d74525b52a98..28e4b9405606 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_learned_route.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peer_list_learned_route.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeerListLearnedRoute.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeerListLearnedRoute.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_delete.py index 488dc12760b8..3574311bb6ad 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeeringDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeeringDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_get.py index 5f78dfd4ab56..90a8c656ecee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeeringGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeeringGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_list.py index f104f1e55515..b3fcfec460f0 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeeringList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeeringList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_put.py index 4533adfc55c7..b168831bbfb3 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_peering_put.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPeeringPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPeeringPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_put.py index dd9a1cdffe62..c7988f2e43da 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_router_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_router_put.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualRouterPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualRouterPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_delete.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_delete.py index 648b4c7990e8..febeb84d0765 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_get.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_get.py index 7ca3cde85ab6..8cd9ae14d5a7 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list.py index 88ecf7f55c65..feeadc688adb 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list_by_resource_group.py index a915129ef22f..c9a98e7fbe70 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_put.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_put.py index 1fc5014c725e..e8a1b6bc6a2c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_put.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_supported_security_providers.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_supported_security_providers.py index b0ecf7f5de84..965019e159b9 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_supported_security_providers.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_supported_security_providers.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWanSupportedSecurityProviders.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWanSupportedSecurityProviders.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_update_tags.py index 1ba52c5f0a3a..1b8b1fbe6139 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/virtual_wan_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VirtualWANUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VirtualWANUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_delete.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_delete.py index 03b8b5e59366..0fe25e8b04af 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_get.py index cacf841b22e9..8f78b0dadd70 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_list.py index 7c8931934535..1cb0b445b6fd 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_put.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_put.py index e5957e5d20c0..6eb0614e067e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_put.py @@ -85,6 +85,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture.py index 21f410c0091e..d25c8d1a3cf5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionStartPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionStartPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture_filter_data.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture_filter_data.py index a0ba96359ff7..885253950257 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture_filter_data.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_start_packet_capture_filter_data.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionStartPacketCaptureFilterData.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionStartPacketCaptureFilterData.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_stop_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_stop_packet_capture.py index a1df723cda44..a2430c5ffd08 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_stop_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_connection_stop_packet_capture.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnConnectionStopPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnConnectionStopPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_delete.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_delete.py index 698b96b99720..2338c7ce4206 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_get.py index 9365855db0ee..4c58e41ca93a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list.py index be11e4480fca..7ebfc488a0aa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list_by_resource_group.py index 650f470175b2..2fdedb501a16 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_put.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_put.py index 1daa3ae193ae..aea0c81edb3c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_put.py @@ -95,6 +95,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_reset.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_reset.py index eb894a4bbf67..ceb9c3f55e99 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_reset.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_reset.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayReset.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayReset.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture.py index e58e75b53f91..1d40c693c83f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayStartPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayStartPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture_filter_data.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture_filter_data.py index c1093025eca4..ff9a6b10f30b 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture_filter_data.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_start_packet_capture_filter_data.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayStartPacketCaptureFilterData.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayStartPacketCaptureFilterData.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_stop_packet_capture.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_stop_packet_capture.py index 6b8ce44cc3b5..06302321f722 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_stop_packet_capture.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_stop_packet_capture.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayStopPacketCapture.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayStopPacketCapture.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_update_tags.py index 6e93c0dd547b..8c63fb6ebd00 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_gateway_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnGatewayUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnGatewayUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_delete.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_delete.py index ef96d3868075..9f586a8e2c11 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_get.py index d73ea3dabd2f..3e91d9f8666f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list.py index 9ee19558c061..cc1250e4d3d2 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list_by_resource_group.py index 152b6e021cc8..6b95b8919025 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_put.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_put.py index 1cc842490b91..c2e7d33b4fd6 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_put.py @@ -110,6 +110,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationPut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationPut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_update_tags.py index 020cc426ae10..acd735b045fa 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_server_configuration_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnServerConfigurationUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnServerConfigurationUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_delete.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_delete.py index 9fcd7ba823e2..f235290289e5 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_get.py index 25b972fef029..5b0b2c1d6402 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get.py index 31e9c8664e41..2c126fccb98f 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkConnectionGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get_ike_sas.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get_ike_sas.py index e3ff5ca6b60a..f06d3dae57ac 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get_ike_sas.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_get_ike_sas.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkConnectionGetIkeSas.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkConnectionGetIkeSas.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_list.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_list.py index 03c6f1cfca6e..c8391ebb3f2c 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkConnectionList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_reset.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_reset.py index a85dc654176a..071668d6ff42 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_reset.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_connection_reset.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkConnectionReset.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkConnectionReset.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_get.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_get.py index 4d1aab315c40..2a7e8e37d509 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_list_by_vpn_site.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_list_by_vpn_site.py index c4b7805eac32..0beef1cb922a 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_list_by_vpn_site.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_link_list_by_vpn_site.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteLinkListByVpnSite.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteLinkListByVpnSite.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list.py index ee2e4c46b457..766ff4d4a3ee 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteList.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteList.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list_by_resource_group.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list_by_resource_group.py index 01905427b182..efb0ef77a395 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list_by_resource_group.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteListByResourceGroup.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_put.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_put.py index 06713a169573..5d57327e996d 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_put.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_put.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSitePut.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSitePut.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_update_tags.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_update_tags.py index d36cd161c216..89e9bed30e57 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_site_update_tags.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_site_update_tags.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSiteUpdateTags.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSiteUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/vpn_sites_configuration_download.py b/sdk/network/azure-mgmt-network/generated_samples/vpn_sites_configuration_download.py index a0b1aeceebb4..eed1845fef62 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/vpn_sites_configuration_download.py +++ b/sdk/network/azure-mgmt-network/generated_samples/vpn_sites_configuration_download.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/VpnSitesConfigurationDownload.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/VpnSitesConfigurationDownload.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/waf_list_all_policies.py b/sdk/network/azure-mgmt-network/generated_samples/waf_list_all_policies.py index 2a2b0ef2b05c..161f14e7e7ca 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/waf_list_all_policies.py +++ b/sdk/network/azure-mgmt-network/generated_samples/waf_list_all_policies.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/WafListAllPolicies.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/WafListAllPolicies.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/waf_list_policies.py b/sdk/network/azure-mgmt-network/generated_samples/waf_list_policies.py index a083bec4736e..dfeeabaf3e9e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/waf_list_policies.py +++ b/sdk/network/azure-mgmt-network/generated_samples/waf_list_policies.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/WafListPolicies.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/WafListPolicies.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_create_or_update.py b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_create_or_update.py index 9530624bde4b..a5f59f482e43 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_create_or_update.py +++ b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_create_or_update.py @@ -188,6 +188,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/WafPolicyCreateOrUpdate.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/WafPolicyCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_delete.py b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_delete.py index be6f882683d5..38d2f89d270e 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_delete.py +++ b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/WafPolicyDelete.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/WafPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_get.py b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_get.py index 41770470cc1b..feed56fb5aec 100644 --- a/sdk/network/azure-mgmt-network/generated_samples/waf_policy_get.py +++ b/sdk/network/azure-mgmt-network/generated_samples/waf_policy_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/WafPolicyGet.json +# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/WafPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/network/azure-mgmt-network/setup.py b/sdk/network/azure-mgmt-network/setup.py index 75c734e120a7..c873b4a9249a 100644 --- a/sdk/network/azure-mgmt-network/setup.py +++ b/sdk/network/azure-mgmt-network/setup.py @@ -53,11 +53,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -78,7 +78,6 @@ "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'", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/networkanalytics/azure-mgmt-networkanalytics/_meta.json b/sdk/networkanalytics/azure-mgmt-networkanalytics/_meta.json index f5eb6886bf8b..ccec15a219a0 100644 --- a/sdk/networkanalytics/azure-mgmt-networkanalytics/_meta.json +++ b/sdk/networkanalytics/azure-mgmt-networkanalytics/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4307895c13b5bc76d3d6e5d6346a32577842ac17", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/networkanalytics/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/networkanalytics/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/networkanalytics/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/networkanalytics/azure-mgmt-networkanalytics/azure/mgmt/networkanalytics/_version.py b/sdk/networkanalytics/azure-mgmt-networkanalytics/azure/mgmt/networkanalytics/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/networkanalytics/azure-mgmt-networkanalytics/azure/mgmt/networkanalytics/_version.py +++ b/sdk/networkanalytics/azure-mgmt-networkanalytics/azure/mgmt/networkanalytics/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/nginx/azure-mgmt-nginx/_meta.json b/sdk/nginx/azure-mgmt-nginx/_meta.json index 7af512e2286a..9907ed90786b 100644 --- a/sdk/nginx/azure-mgmt-nginx/_meta.json +++ b/sdk/nginx/azure-mgmt-nginx/_meta.json @@ -1,11 +1,11 @@ { - "commit": "11bbc2b1df2e915a2227a6a1a48a27b9e67c3311", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/nginx/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/nginx/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/nginx/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py index c9f0815f44d8..0284f2a354ca 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py @@ -29,14 +29,14 @@ class NginxManagementClientConfiguration(Configuration): # pylint: disable=too- :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 + :keyword api_version: Api Version. Default value is "2023-09-01". 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(NginxManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py index bf692c8873ba..b3e1634036bd 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py @@ -39,7 +39,7 @@ class NginxManagementClient: # pylint: disable=client-accepts-api-version-keywo :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 + :keyword api_version: Api Version. Default value is "2023-09-01". 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 diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py index 9130d1d34fc7..859a4f93aee7 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py @@ -29,14 +29,14 @@ class NginxManagementClientConfiguration(Configuration): # pylint: disable=too- :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 + :keyword api_version: Api Version. Default value is "2023-09-01". 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(NginxManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2023-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py index 95ddba84d12c..cfbbeb8b43d6 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py @@ -39,7 +39,7 @@ class NginxManagementClient: # pylint: disable=client-accepts-api-version-keywo :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 + :keyword api_version: Api Version. Default value is "2023-09-01". 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 diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py index 8f6466452472..657846913dbd 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py @@ -32,6 +32,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._configurations_operations import ( + build_analysis_request, build_create_or_update_request, build_delete_request, build_get_request, @@ -607,3 +608,170 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" } + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :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: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, IO]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Is either a AnalysisCreate type or a IO type. + Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AnalysisResult] = 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, "AnalysisCreate") + else: + _json = None + + request = build_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.analysis.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AnalysisResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + analysis.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + } diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py index 37b11a832238..f0d27a6f2c75 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py @@ -54,9 +54,9 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: - """List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + """List all operations provided by Nginx.NginxPlus for the 2023-09-01 api version. - List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + List all operations provided by Nginx.NginxPlus for the 2023-09-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py index 1302846471ae..aa502ede14f9 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py @@ -6,9 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import ErrorResponseBody +from ._models_py3 import AnalysisCreate +from ._models_py3 import AnalysisCreateConfig +from ._models_py3 import AnalysisError +from ._models_py3 import AnalysisResult +from ._models_py3 import AnalysisResultData +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail from ._models_py3 import IdentityProperties from ._models_py3 import NginxCertificate +from ._models_py3 import NginxCertificateErrorResponseBody from ._models_py3 import NginxCertificateListResponse from ._models_py3 import NginxCertificateProperties from ._models_py3 import NginxConfiguration @@ -47,9 +54,16 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ErrorResponseBody", + "AnalysisCreate", + "AnalysisCreateConfig", + "AnalysisError", + "AnalysisResult", + "AnalysisResultData", + "ErrorAdditionalInfo", + "ErrorDetail", "IdentityProperties", "NginxCertificate", + "NginxCertificateErrorResponseBody", "NginxCertificateListResponse", "NginxCertificateProperties", "NginxConfiguration", diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py index 6ce745228f64..90098003001d 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py @@ -17,50 +17,279 @@ from .. import models as _models -class ErrorResponseBody(_serialization.Model): - """ErrorResponseBody. +class AnalysisCreate(_serialization.Model): + """The request body for creating an analysis for an NGINX configuration. - :ivar code: - :vartype code: str - :ivar message: + All required parameters must be populated in order to send to Azure. + + :ivar config: Required. + :vartype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig + """ + + _validation = { + "config": {"required": True}, + } + + _attribute_map = { + "config": {"key": "config", "type": "AnalysisCreateConfig"}, + } + + def __init__(self, *, config: "_models.AnalysisCreateConfig", **kwargs: Any) -> None: + """ + :keyword config: Required. + :paramtype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig + """ + super().__init__(**kwargs) + self.config = config + + +class AnalysisCreateConfig(_serialization.Model): + """AnalysisCreateConfig. + + :ivar root_file: The root file of the NGINX config file(s). It must match one of the files' + filepath. + :vartype root_file: str + :ivar files: + :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar protected_files: + :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar package: + :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + """ + + _attribute_map = { + "root_file": {"key": "rootFile", "type": "str"}, + "files": {"key": "files", "type": "[NginxConfigurationFile]"}, + "protected_files": {"key": "protectedFiles", "type": "[NginxConfigurationFile]"}, + "package": {"key": "package", "type": "NginxConfigurationPackage"}, + } + + def __init__( + self, + *, + root_file: Optional[str] = None, + files: Optional[List["_models.NginxConfigurationFile"]] = None, + protected_files: Optional[List["_models.NginxConfigurationFile"]] = None, + package: Optional["_models.NginxConfigurationPackage"] = None, + **kwargs: Any + ) -> None: + """ + :keyword root_file: The root file of the NGINX config file(s). It must match one of the files' + filepath. + :paramtype root_file: str + :keyword files: + :paramtype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :keyword protected_files: + :paramtype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :keyword package: + :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + """ + super().__init__(**kwargs) + self.root_file = root_file + self.files = files + self.protected_files = protected_files + self.package = package + + +class AnalysisError(_serialization.Model): + """An error object found during the analysis of an NGINX configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Unique identifier for the error. + :vartype id: str + :ivar directive: Required. + :vartype directive: str + :ivar description: Required. + :vartype description: str + :ivar file: the filepath of the most relevant config file. Required. + :vartype file: str + :ivar line: Required. + :vartype line: float + :ivar message: Required. :vartype message: str - :ivar target: - :vartype target: str - :ivar details: - :vartype details: list[~azure.mgmt.nginx.models.ErrorResponseBody] + :ivar rule: Required. + :vartype rule: str """ + _validation = { + "directive": {"required": True}, + "description": {"required": True}, + "file": {"required": True}, + "line": {"required": True}, + "message": {"required": True}, + "rule": {"required": True}, + } + _attribute_map = { - "code": {"key": "code", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "directive": {"key": "directive", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "file": {"key": "file", "type": "str"}, + "line": {"key": "line", "type": "float"}, "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorResponseBody]"}, + "rule": {"key": "rule", "type": "str"}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.ErrorResponseBody"]] = None, + directive: str, + description: str, + file: str, + line: float, + message: str, + rule: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin **kwargs: Any ) -> None: """ - :keyword code: - :paramtype code: str - :keyword message: + :keyword id: Unique identifier for the error. + :paramtype id: str + :keyword directive: Required. + :paramtype directive: str + :keyword description: Required. + :paramtype description: str + :keyword file: the filepath of the most relevant config file. Required. + :paramtype file: str + :keyword line: Required. + :paramtype line: float + :keyword message: Required. :paramtype message: str - :keyword target: - :paramtype target: str - :keyword details: - :paramtype details: list[~azure.mgmt.nginx.models.ErrorResponseBody] + :keyword rule: Required. + :paramtype rule: str """ super().__init__(**kwargs) - self.code = code + self.id = id + self.directive = directive + self.description = description + self.file = file + self.line = line self.message = message - self.target = target - self.details = details + self.rule = rule + + +class AnalysisResult(_serialization.Model): + """The response body for an analysis request. Contains the status of the analysis and any errors. + + All required parameters must be populated in order to send to Azure. + + :ivar status: The status of the analysis. Required. + :vartype status: str + :ivar data: + :vartype data: ~azure.mgmt.nginx.models.AnalysisResultData + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "data": {"key": "data", "type": "AnalysisResultData"}, + } + + def __init__(self, *, status: str, data: Optional["_models.AnalysisResultData"] = None, **kwargs: Any) -> None: + """ + :keyword status: The status of the analysis. Required. + :paramtype status: str + :keyword data: + :paramtype data: ~azure.mgmt.nginx.models.AnalysisResultData + """ + super().__init__(**kwargs) + self.status = status + self.data = data + + +class AnalysisResultData(_serialization.Model): + """AnalysisResultData. + + :ivar errors: + :vartype errors: list[~azure.mgmt.nginx.models.AnalysisError] + """ + + _attribute_map = { + "errors": {"key": "errors", "type": "[AnalysisError]"}, + } + + def __init__(self, *, errors: Optional[List["_models.AnalysisError"]] = None, **kwargs: Any) -> None: + """ + :keyword errors: + :paramtype errors: list[~azure.mgmt.nginx.models.AnalysisError] + """ + super().__init__(**kwargs) + self.errors = errors + + +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.nginx.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.nginx.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 IdentityProperties(_serialization.Model): @@ -169,6 +398,32 @@ def __init__( self.system_data = None +class NginxCertificateErrorResponseBody(_serialization.Model): + """NginxCertificateErrorResponseBody. + + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + class NginxCertificateListResponse(_serialization.Model): """NginxCertificateListResponse. @@ -215,10 +470,21 @@ class NginxCertificateProperties(_serialization.Model): :vartype certificate_virtual_path: str :ivar key_vault_secret_id: :vartype key_vault_secret_id: str + :ivar sha1_thumbprint: + :vartype sha1_thumbprint: str + :ivar key_vault_secret_version: + :vartype key_vault_secret_version: str + :ivar key_vault_secret_created: + :vartype key_vault_secret_created: ~datetime.datetime + :ivar certificate_error: + :vartype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ _validation = { "provisioning_state": {"readonly": True}, + "sha1_thumbprint": {"readonly": True}, + "key_vault_secret_version": {"readonly": True}, + "key_vault_secret_created": {"readonly": True}, } _attribute_map = { @@ -226,6 +492,10 @@ class NginxCertificateProperties(_serialization.Model): "key_virtual_path": {"key": "keyVirtualPath", "type": "str"}, "certificate_virtual_path": {"key": "certificateVirtualPath", "type": "str"}, "key_vault_secret_id": {"key": "keyVaultSecretId", "type": "str"}, + "sha1_thumbprint": {"key": "sha1Thumbprint", "type": "str"}, + "key_vault_secret_version": {"key": "keyVaultSecretVersion", "type": "str"}, + "key_vault_secret_created": {"key": "keyVaultSecretCreated", "type": "iso-8601"}, + "certificate_error": {"key": "certificateError", "type": "NginxCertificateErrorResponseBody"}, } def __init__( @@ -234,6 +504,7 @@ def __init__( key_virtual_path: Optional[str] = None, certificate_virtual_path: Optional[str] = None, key_vault_secret_id: Optional[str] = None, + certificate_error: Optional["_models.NginxCertificateErrorResponseBody"] = None, **kwargs: Any ) -> None: """ @@ -243,12 +514,18 @@ def __init__( :paramtype certificate_virtual_path: str :keyword key_vault_secret_id: :paramtype key_vault_secret_id: str + :keyword certificate_error: + :paramtype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ super().__init__(**kwargs) self.provisioning_state = None self.key_virtual_path = key_virtual_path self.certificate_virtual_path = certificate_virtual_path self.key_vault_secret_id = key_vault_secret_id + self.sha1_thumbprint = None + self.key_vault_secret_version = None + self.key_vault_secret_created = None + self.certificate_error = certificate_error class NginxConfiguration(_serialization.Model): @@ -1099,18 +1376,18 @@ def __init__( class ResourceProviderDefaultErrorResponse(_serialization.Model): """ResourceProviderDefaultErrorResponse. - :ivar error: - :vartype error: ~azure.mgmt.nginx.models.ErrorResponseBody + :ivar error: The error detail. + :vartype error: ~azure.mgmt.nginx.models.ErrorDetail """ _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseBody"}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorResponseBody"] = None, **kwargs: Any) -> None: + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ - :keyword error: - :paramtype error: ~azure.mgmt.nginx.models.ErrorResponseBody + :keyword error: The error detail. + :paramtype error: ~azure.mgmt.nginx.models.ErrorDetail """ super().__init__(**kwargs) self.error = error diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py index d522e1e1489c..e1d42aef33b1 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py @@ -45,7 +45,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -79,7 +84,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", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +98,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -116,7 +126,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +139,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -150,7 +165,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +178,12 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py index 63b884548732..deafb810bb90 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py @@ -45,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -78,7 +83,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -112,7 +122,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", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +136,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -149,7 +164,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +177,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -177,6 +197,50 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_analysis_request( + resource_group_name: str, deployment_name: str, configuration_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-09-01")) + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze", + ) # 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 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + "configurationName": _SERIALIZER.url( + "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-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) + + class ConfigurationsOperations: """ .. warning:: @@ -741,3 +805,170 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" } + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :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: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, IO]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Is either a AnalysisCreate type or a IO type. + Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.AnalysisResult] = 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, "AnalysisCreate") + else: + _json = None + + request = build_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.analysis.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.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AnalysisResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + analysis.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + } diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py index 22bdd606d934..d236e302b36b 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py @@ -45,7 +45,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -78,7 +83,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", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92,7 +97,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -114,7 +124,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", "2023-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +138,12 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -150,7 +165,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +178,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -181,7 +201,7 @@ def build_list_request(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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +225,7 @@ def build_list_by_resource_group_request(resource_group_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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py index f671fb0ec389..411a587e1697 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py @@ -40,7 +40,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", "2023-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,9 +76,9 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: - """List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + """List all operations provided by Nginx.NginxPlus for the 2023-09-01 api version. - List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + List all operations provided by Nginx.NginxPlus for the 2023-09-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py index cc6efdd485a4..cf6f74bb0bea 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Certificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py index 14a0069beb54..f08127b72f38 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Certificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py index b79e99312552..5ec5153a54f6 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Certificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py index f334853ba72a..b9e5ffced854 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Certificates_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py new file mode 100644 index 000000000000..0171d34f2379 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.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.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python configurations_analysis.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 = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.configurations.analysis( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + configuration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Configurations_Analysis.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py index 0a048c73c91a..1ab5131389b0 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Configurations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py index e957ddd3ba40..b27fd35bd6c8 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Configurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py index 308f7ae90bf3..7fc9c0f1eb63 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Configurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py index f941ce10b673..787982bfb0ed 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Configurations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py index bbe3597550e8..ffc2a5810baf 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Create.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_Create.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py index f805dd9a1438..dfa63fc33924 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py index 9c33bbbcdaa9..ac4ea31d5b86 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py index 1b173a484d75..06ba5983225a 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py index 14ca1fb3b903..c94281f18d12 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_ListByResourceGroup.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py index b99ff331f328..eb7786720e3b 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Update.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Deployments_Update.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py index b7a8f136259a..045b8c4ea592 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Operations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-09-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/orbital/azure-mgmt-orbital/_meta.json b/sdk/orbital/azure-mgmt-orbital/_meta.json index ab9eef4839f7..a2d7800ceb38 100644 --- a/sdk/orbital/azure-mgmt-orbital/_meta.json +++ b/sdk/orbital/azure-mgmt-orbital/_meta.json @@ -1,11 +1,11 @@ { - "commit": "66174681c09b101de03fd35399080cfbccc93e8f", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/orbital/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.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/orbital/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/orbital/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py index 724de415c12b..80e0703cfad0 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py @@ -66,7 +66,7 @@ def __init__( **kwargs: Any ) -> None: self._config = AzureOrbitalConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py index 208b1cae18f2..96b57db42650 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -42,7 +36,7 @@ class AzureOrbitalConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureOrbitalConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") + api_version: str = kwargs.pop("api_version", "2022-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_serialization.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_serialization.py index f17c068e833e..4bae2292227b 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_serialization.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: @@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py index 85035e93f02b..f204b5ca89d3 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py @@ -66,7 +66,7 @@ def __init__( **kwargs: Any ) -> None: self._config = AzureOrbitalConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py index a262b5161896..b81747f684ae 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -42,7 +36,7 @@ class AzureOrbitalConfiguration(Configuration): # pylint: disable=too-many-inst def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureOrbitalConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") + api_version: str = kwargs.pop("api_version", "2022-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py index 4b3162e4f8db..834dec2033d1 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._available_ground_stations_operations import build_list_by_capability_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,9 +71,7 @@ def list_by_capability( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableGroundStationListResult] = kwargs.pop("cls", None) error_map = { @@ -131,8 +124,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py index 003cbe34ffec..d25012aa0d14 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,9 +88,7 @@ async def get(self, resource_group_name: str, contact_profile_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfile] = kwargs.pop("cls", None) request = build_get_request( @@ -109,8 +103,9 @@ async def get(self, resource_group_name: str, contact_profile_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,9 +153,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) @@ -192,8 +185,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,9 +291,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -370,9 +362,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -387,8 +377,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,9 +426,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -497,16 +486,14 @@ async def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -526,8 +513,9 @@ async def _update_tags_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -663,9 +651,7 @@ async def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -732,9 +718,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -787,8 +771,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,9 +813,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -884,8 +867,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py index 33e727b035a0..0b3a162297db 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,9 +86,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactListResult] = kwargs.pop("cls", None) error_map = { @@ -147,8 +141,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,9 +189,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Contact] = kwargs.pop("cls", None) request = build_get_request( @@ -212,8 +205,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,16 +247,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Contact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Contact") @@ -283,8 +275,9 @@ async def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -432,9 +425,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Contact] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -497,9 +488,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -515,8 +504,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,9 +555,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py index c360fdb5db22..3e09d0f32c25 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py index c19375a4b40a..f764deacbfd2 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations_results_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ async def _get_initial(self, location: str, operation_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -86,8 +79,9 @@ async def _get_initial(self, location: str, operation_id: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,9 +134,7 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py index 2840b6eb4553..56623d800144 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,10 +42,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,9 +85,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SpacecraftListResult] = kwargs.pop("cls", None) error_map = { @@ -144,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,9 +178,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SpacecraftListResult] = kwargs.pop("cls", None) error_map = { @@ -239,8 +232,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,9 +276,7 @@ async def get(self, resource_group_name: str, spacecraft_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Spacecraft] = kwargs.pop("cls", None) request = build_get_request( @@ -299,8 +291,9 @@ async def get(self, resource_group_name: str, spacecraft_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,9 +339,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) @@ -378,8 +369,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,9 +458,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -537,9 +527,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -554,8 +542,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,9 +589,7 @@ async def begin_delete(self, resource_group_name: str, spacecraft_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -658,16 +645,14 @@ async def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -687,8 +672,9 @@ async def _update_tags_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,9 +806,7 @@ async def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -890,9 +874,7 @@ async def _list_available_contacts_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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[Optional[_models.AvailableContactsListResult]] = kwargs.pop("cls", None) @@ -918,8 +900,9 @@ async def _list_available_contacts_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -992,9 +975,7 @@ async def begin_list_available_contacts( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailableContactsListResult] = kwargs.pop("cls", None) @@ -1058,8 +1039,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py index 8ae531013f35..73f6dd5cc48c 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar, Union import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_list_by_capability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +53,7 @@ def build_list_by_capability_request( "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") @@ -107,9 +102,7 @@ def list_by_capability( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableGroundStationListResult] = kwargs.pop("cls", None) error_map = { @@ -162,8 +155,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py index a2add8163b7a..21af5cbcbb82 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +61,7 @@ def build_get_request( "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_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") @@ -82,7 +78,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +95,7 @@ def build_create_or_update_request( "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_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") @@ -118,7 +114,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +130,7 @@ def build_delete_request( "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_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") @@ -151,7 +147,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +164,7 @@ def build_update_tags_request( "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_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") @@ -187,7 +183,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +192,7 @@ def build_list_by_subscription_request( "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") @@ -215,7 +211,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +226,7 @@ def build_list_request( "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") @@ -287,9 +283,7 @@ def get(self, resource_group_name: str, contact_profile_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfile] = kwargs.pop("cls", None) request = build_get_request( @@ -304,8 +298,9 @@ def get(self, resource_group_name: str, contact_profile_name: str, **kwargs: Any 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,9 +348,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) @@ -387,8 +380,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -492,9 +486,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -564,9 +556,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -581,8 +571,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -627,9 +618,7 @@ def begin_delete(self, resource_group_name: str, contact_profile_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -689,16 +678,14 @@ def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -718,8 +705,9 @@ def _update_tags_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -855,9 +843,7 @@ def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ContactProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -924,9 +910,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -979,8 +963,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1020,9 +1005,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactProfileListResult] = kwargs.pop("cls", None) error_map = { @@ -1076,8 +1059,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py index 63ef65e83a99..ed9c528bd254 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +66,7 @@ def build_list_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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") @@ -89,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +102,7 @@ def build_get_request( "contactName": _SERIALIZER.url("contact_name", contact_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") @@ -123,7 +119,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +137,7 @@ def build_create_request( "contactName": _SERIALIZER.url("contact_name", contact_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 +156,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +173,7 @@ def build_delete_request( "contactName": _SERIALIZER.url("contact_name", contact_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") @@ -232,9 +228,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContactListResult] = kwargs.pop("cls", None) error_map = { @@ -289,8 +283,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,9 +329,7 @@ def get(self, resource_group_name: str, spacecraft_name: str, contact_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Contact] = kwargs.pop("cls", None) request = build_get_request( @@ -352,8 +345,9 @@ def get(self, resource_group_name: str, spacecraft_name: str, contact_name: str, 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,16 +387,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Contact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Contact") @@ -423,8 +415,9 @@ def _create_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,9 +562,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Contact] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -633,9 +624,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -651,8 +640,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -701,9 +691,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py index 67d358fb2f19..756f6edd2d4a 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -144,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py index 38d188c3e9ff..6a4316f12de0 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "operationId": _SERIALIZER.url("operation_id", operation_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") @@ -101,9 +96,7 @@ def _get_initial(self, location: str, operation_id: str, **kwargs: Any) -> Optio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationResult]] = kwargs.pop("cls", None) request = build_get_request( @@ -118,8 +111,9 @@ def _get_initial(self, location: str, operation_id: str, **kwargs: Any) -> Optio 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,9 +164,7 @@ def begin_get(self, location: str, operation_id: str, **kwargs: Any) -> LROPolle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py index 1cb7f59a70e4..da5e13ff19bc 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,12 +31,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +46,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +55,7 @@ def build_list_by_subscription_request( "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") @@ -78,7 +74,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +89,7 @@ def build_list_request( "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") @@ -112,7 +108,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +124,7 @@ def build_get_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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") @@ -145,7 +141,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +158,7 @@ def build_create_or_update_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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 +177,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +193,7 @@ def build_delete_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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") @@ -214,7 +210,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -231,7 +227,7 @@ def build_update_tags_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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") @@ -250,7 +246,7 @@ def build_list_available_contacts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -267,7 +263,7 @@ def build_list_available_contacts_request( "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_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") @@ -317,9 +313,7 @@ def list_by_subscription(self, skiptoken: Optional[str] = None, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SpacecraftListResult] = kwargs.pop("cls", None) error_map = { @@ -372,8 +366,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,9 +406,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SpacecraftListResult] = kwargs.pop("cls", None) error_map = { @@ -467,8 +460,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -510,9 +504,7 @@ def get(self, resource_group_name: str, spacecraft_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Spacecraft] = kwargs.pop("cls", None) request = build_get_request( @@ -527,8 +519,9 @@ def get(self, resource_group_name: str, spacecraft_name: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,9 +567,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) @@ -606,8 +597,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,9 +685,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -763,9 +753,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -780,8 +768,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -826,9 +815,7 @@ def begin_delete(self, resource_group_name: str, spacecraft_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -884,16 +871,14 @@ def _update_tags_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -913,8 +898,9 @@ def _update_tags_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1043,9 +1029,7 @@ def begin_update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Spacecraft] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1113,9 +1097,7 @@ def _list_available_contacts_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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[Optional[_models.AvailableContactsListResult]] = kwargs.pop("cls", None) @@ -1141,8 +1123,9 @@ def _list_available_contacts_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1215,9 +1198,7 @@ def begin_list_available_contacts( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailableContactsListResult] = kwargs.pop("cls", None) @@ -1281,8 +1262,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_delete.py b/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_delete.py index 3b8c83573179..4257240bbcee 100644 --- a/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_delete.py +++ b/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_delete.py @@ -29,12 +29,11 @@ def main(): subscription_id="c1be1141-a7c9-4aac-9608-3c2e2f1152c3", ) - response = client.contacts.begin_delete( + client.contacts.begin_delete( resource_group_name="contoso-Rgp", spacecraft_name="CONTOSO_SAT", contact_name="contact1", ).result() - print(response) # x-ms-original-file: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactDelete.json diff --git a/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_profile_delete.py b/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_profile_delete.py index f3e2a8e4277b..504142e07a58 100644 --- a/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_profile_delete.py +++ b/sdk/orbital/azure-mgmt-orbital/generated_samples/contact_profile_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="c1be1141-a7c9-4aac-9608-3c2e2f1152c3", ) - response = client.contact_profiles.begin_delete( + client.contact_profiles.begin_delete( resource_group_name="contoso-Rgp", contact_profile_name="CONTOSO-CP", ).result() - print(response) # x-ms-original-file: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfileDelete.json diff --git a/sdk/orbital/azure-mgmt-orbital/generated_samples/spacecraft_delete.py b/sdk/orbital/azure-mgmt-orbital/generated_samples/spacecraft_delete.py index 7d3383ef0774..e89783879c7c 100644 --- a/sdk/orbital/azure-mgmt-orbital/generated_samples/spacecraft_delete.py +++ b/sdk/orbital/azure-mgmt-orbital/generated_samples/spacecraft_delete.py @@ -29,11 +29,10 @@ def main(): subscription_id="c1be1141-a7c9-4aac-9608-3c2e2f1152c3", ) - response = client.spacecrafts.begin_delete( + client.spacecrafts.begin_delete( resource_group_name="contoso-Rgp", spacecraft_name="CONTOSO_SAT", ).result() - print(response) # x-ms-original-file: specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftDelete.json diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json index 12fe0d5e02b1..e99bb48c789c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7c906b15744aaf7b782dfb82ccefcbef05cbf20b", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/paloaltonetworks/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/paloaltonetworks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/paloaltonetworks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py index 7e69dd76f260..59ec5b95bec2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py @@ -29,14 +29,14 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :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-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-07-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(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + api_version: str = kwargs.pop("api_version", "2024-02-07-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py index aae495a25e03..88d77494552d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py @@ -26,6 +26,7 @@ LocalRulesOperations, LocalRulestacksOperations, Operations, + PaloAltoNetworksCloudngfwOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -58,6 +59,9 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.operations.Operations + :ivar palo_alto_networks_cloudngfw: PaloAltoNetworksCloudngfwOperations operations + :vartype palo_alto_networks_cloudngfw: + azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations @@ -81,8 +85,8 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :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-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-07-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. @@ -119,6 +123,9 @@ def __init__( ) self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw = PaloAltoNetworksCloudngfwOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py index b436ff93ee90..781d3d52d08a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py @@ -29,14 +29,14 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :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-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-07-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(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + api_version: str = kwargs.pop("api_version", "2024-02-07-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py index ce71a100f71f..7c5b055f35bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py @@ -26,6 +26,7 @@ LocalRulesOperations, LocalRulestacksOperations, Operations, + PaloAltoNetworksCloudngfwOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -59,6 +60,9 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.aio.operations.Operations + :ivar palo_alto_networks_cloudngfw: PaloAltoNetworksCloudngfwOperations operations + :vartype palo_alto_networks_cloudngfw: + azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations @@ -84,8 +88,8 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :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-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-07-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. @@ -122,6 +126,9 @@ def __init__( ) self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw = PaloAltoNetworksCloudngfwOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py index 72bdc9199a7f..203c56ed82f5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations from ._pre_rules_operations import PreRulesOperations from ._operations import Operations +from ._palo_alto_networks_cloudngfw_operations import PaloAltoNetworksCloudngfwOperations from ._firewalls_operations import FirewallsOperations from ._local_rulestacks_operations import LocalRulestacksOperations from ._firewall_status_operations import FirewallStatusOperations @@ -33,6 +34,7 @@ "PrefixListGlobalRulestackOperations", "PreRulesOperations", "Operations", + "PaloAltoNetworksCloudngfwOperations", "FirewallsOperations", "LocalRulestacksOperations", "FirewallStatusOperations", diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py new file mode 100644 index 000000000000..eb66eb0798ea --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py @@ -0,0 +1,280 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._palo_alto_networks_cloudngfw_operations import ( + build_create_product_serial_number_request, + build_list_cloud_manager_tenants_request, + build_list_product_serial_number_status_request, + build_list_support_info_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PaloAltoNetworksCloudngfwOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw` 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_async + async def create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :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.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + request = build_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create_product_serial_number.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("ProductSerialNumberRequestStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_product_serial_number.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + } + + @distributed_trace_async + async def list_cloud_manager_tenants(self, **kwargs: Any) -> List[_models.CloudManagerTenant]: + """list_cloud_manager_tenants. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CloudManagerTenant or the result of cls(response) + :rtype: list[~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenant] + :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[List[_models.CloudManagerTenant]] = kwargs.pop("cls", None) + + request = build_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_manager_tenants.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("[CloudManagerTenant]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cloud_manager_tenants.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + } + + @distributed_trace_async + async def list_product_serial_number_status(self, **kwargs: Any) -> _models.ProductSerialNumberStatus: + """list_product_serial_number_status. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductSerialNumberStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus + :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.ProductSerialNumberStatus] = kwargs.pop("cls", None) + + request = build_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_product_serial_number_status.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("ProductSerialNumberStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_product_serial_number_status.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus" + } + + @distributed_trace_async + async def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :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.SupportInfoModel] = kwargs.pop("cls", None) + + request = build_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_support_info.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("SupportInfoModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_support_info.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + } diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py index 2cb2e2ebaf6b..baed4bcdc361 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py @@ -19,6 +19,7 @@ from ._models_py3 import CertificateObjectLocalRulestackResource from ._models_py3 import CertificateObjectLocalRulestackResourceListResult from ._models_py3 import Changelog +from ._models_py3 import CloudManagerTenant from ._models_py3 import CountriesResponse from ._models_py3 import Country from ._models_py3 import DNSSettings @@ -76,6 +77,8 @@ from ._models_py3 import PrefixListGlobalRulestackResourceListResult from ._models_py3 import PrefixListResource from ._models_py3 import PrefixListResourceListResult +from ._models_py3 import ProductSerialNumberRequestStatus +from ._models_py3 import ProductSerialNumberStatus from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import RuleCounter @@ -86,7 +89,10 @@ from ._models_py3 import SecurityServicesTypeList from ._models_py3 import SourceAddr from ._models_py3 import StorageAccount +from ._models_py3 import StrataCloudManagerConfig +from ._models_py3 import StrataCloudManagerInfo from ._models_py3 import SupportInfo +from ._models_py3 import SupportInfoModel from ._models_py3 import SystemData from ._models_py3 import TagInfo from ._models_py3 import TrackedResource @@ -103,6 +109,7 @@ from ._palo_alto_networks_ngfw_mgmt_client_enums import DecryptionRuleTypeEnum from ._palo_alto_networks_ngfw_mgmt_client_enums import DefaultMode from ._palo_alto_networks_ngfw_mgmt_client_enums import EgressNat +from ._palo_alto_networks_ngfw_mgmt_client_enums import EnableStatus from ._palo_alto_networks_ngfw_mgmt_client_enums import EnabledDNSType from ._palo_alto_networks_ngfw_mgmt_client_enums import HealthStatus from ._palo_alto_networks_ngfw_mgmt_client_enums import LogOption @@ -111,9 +118,11 @@ from ._palo_alto_networks_ngfw_mgmt_client_enums import MarketplaceSubscriptionStatus from ._palo_alto_networks_ngfw_mgmt_client_enums import NetworkType from ._palo_alto_networks_ngfw_mgmt_client_enums import Origin +from ._palo_alto_networks_ngfw_mgmt_client_enums import ProductSerialStatusValues from ._palo_alto_networks_ngfw_mgmt_client_enums import ProtocolType from ._palo_alto_networks_ngfw_mgmt_client_enums import ProvisioningState from ._palo_alto_networks_ngfw_mgmt_client_enums import ReadOnlyProvisioningState +from ._palo_alto_networks_ngfw_mgmt_client_enums import RegistrationStatus from ._palo_alto_networks_ngfw_mgmt_client_enums import ScopeType from ._palo_alto_networks_ngfw_mgmt_client_enums import SecurityServicesTypeEnum from ._palo_alto_networks_ngfw_mgmt_client_enums import ServerStatus @@ -137,6 +146,7 @@ "CertificateObjectLocalRulestackResource", "CertificateObjectLocalRulestackResourceListResult", "Changelog", + "CloudManagerTenant", "CountriesResponse", "Country", "DNSSettings", @@ -194,6 +204,8 @@ "PrefixListGlobalRulestackResourceListResult", "PrefixListResource", "PrefixListResourceListResult", + "ProductSerialNumberRequestStatus", + "ProductSerialNumberStatus", "ProxyResource", "Resource", "RuleCounter", @@ -204,7 +216,10 @@ "SecurityServicesTypeList", "SourceAddr", "StorageAccount", + "StrataCloudManagerConfig", + "StrataCloudManagerInfo", "SupportInfo", + "SupportInfoModel", "SystemData", "TagInfo", "TrackedResource", @@ -220,6 +235,7 @@ "DecryptionRuleTypeEnum", "DefaultMode", "EgressNat", + "EnableStatus", "EnabledDNSType", "HealthStatus", "LogOption", @@ -228,9 +244,11 @@ "MarketplaceSubscriptionStatus", "NetworkType", "Origin", + "ProductSerialStatusValues", "ProtocolType", "ProvisioningState", "ReadOnlyProvisioningState", + "RegistrationStatus", "ScopeType", "SecurityServicesTypeEnum", "ServerStatus", diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py index 9f11b2f7c47f..0782ba6237df 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py @@ -727,6 +727,38 @@ def __init__( self.last_modified = last_modified +class CloudManagerTenant(_serialization.Model): + """Cloud Manager Tenant. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of Cloud Manager Tenant. Required. + :vartype name: str + :ivar tenant_id: Cloud Manager Tenant ID. + :vartype tenant_id: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, name: str, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of Cloud Manager Tenant. Required. + :paramtype name: str + :keyword tenant_id: Cloud Manager Tenant ID. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.name = name + self.tenant_id = tenant_id + + class CountriesResponse(_serialization.Model): """Countries Response Object. @@ -1151,8 +1183,15 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. Required. @@ -1193,7 +1232,12 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at "pan_etag": {"key": "properties.panEtag", "type": "str"}, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "properties.isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "properties.panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": { + "key": "properties.strataCloudManagerConfig", + "type": "StrataCloudManagerConfig", + }, "associated_rulestack": {"key": "properties.associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "properties.dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "properties.frontEndSettings", "type": "[FrontendSetting]"}, @@ -1214,7 +1258,9 @@ def __init__( identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, pan_etag: Optional[str] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, front_end_settings: Optional[List["_models.FrontendSetting"]] = None, **kwargs: Any @@ -1234,8 +1280,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. Required. @@ -1252,7 +1305,9 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings @@ -1336,7 +1391,7 @@ def __init__( self.properties = properties -class FirewallResourceUpdateProperties(_serialization.Model): +class FirewallResourceUpdateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """The updatable properties of the FirewallResource. :ivar pan_etag: panEtag info. @@ -1346,8 +1401,15 @@ class FirewallResourceUpdateProperties(_serialization.Model): :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. @@ -1364,7 +1426,9 @@ class FirewallResourceUpdateProperties(_serialization.Model): "pan_etag": {"key": "panEtag", "type": "str"}, "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": {"key": "strataCloudManagerConfig", "type": "StrataCloudManagerConfig"}, "associated_rulestack": {"key": "associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "frontEndSettings", "type": "[FrontendSetting]"}, @@ -1378,7 +1442,9 @@ def __init__( pan_etag: Optional[str] = None, network_profile: Optional["_models.NetworkProfile"] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, dns_settings: Optional["_models.DNSSettings"] = None, front_end_settings: Optional[List["_models.FrontendSetting"]] = None, @@ -1394,8 +1460,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. @@ -1411,7 +1484,9 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings @@ -1419,7 +1494,7 @@ def __init__( self.marketplace_details = marketplace_details -class FirewallStatusResource(ProxyResource): +class FirewallStatusResource(ProxyResource): # pylint: disable=too-many-instance-attributes """Firewall Status. Variables are only populated by the server, and will be ignored when sending a request. @@ -1449,6 +1524,12 @@ class FirewallStatusResource(ProxyResource): "Failed", and "Deleted". :vartype provisioning_state: str or ~azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState + :ivar is_strata_cloud_managed: Strata Cloud Manager. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar strata_cloud_manager_info: This field is only present if Strata Cloud Manager is managing + the policy for this firewall. + :vartype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo """ _validation = { @@ -1461,6 +1542,7 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"readonly": True}, "panorama_status": {"readonly": True}, "provisioning_state": {"readonly": True}, + "is_strata_cloud_managed": {"readonly": True}, } _attribute_map = { @@ -1473,16 +1555,27 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"key": "properties.healthReason", "type": "str"}, "panorama_status": {"key": "properties.panoramaStatus", "type": "PanoramaStatus"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, + "strata_cloud_manager_info": {"key": "properties.strataCloudManagerInfo", "type": "StrataCloudManagerInfo"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, strata_cloud_manager_info: Optional["_models.StrataCloudManagerInfo"] = None, **kwargs: Any + ) -> None: + """ + :keyword strata_cloud_manager_info: This field is only present if Strata Cloud Manager is + managing the policy for this firewall. + :paramtype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo + """ super().__init__(**kwargs) self.is_panorama_managed = None self.health_status = None self.health_reason = None self.panorama_status = None self.provisioning_state = None + self.is_strata_cloud_managed = None + self.strata_cloud_manager_info = strata_cloud_manager_info class FirewallStatusResourceListResult(_serialization.Model): @@ -3012,6 +3105,9 @@ class NetworkProfile(_serialization.Model): :vartype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :ivar trusted_ranges: Non-RFC 1918 address. :vartype trusted_ranges: list[str] + :ivar private_source_nat_rules_destination: Array of ipv4 destination address for which source + NAT is to be performed. + :vartype private_source_nat_rules_destination: list[str] """ _validation = { @@ -3028,6 +3124,7 @@ class NetworkProfile(_serialization.Model): "enable_egress_nat": {"key": "enableEgressNat", "type": "str"}, "egress_nat_ip": {"key": "egressNatIp", "type": "[IPAddress]"}, "trusted_ranges": {"key": "trustedRanges", "type": "[str]"}, + "private_source_nat_rules_destination": {"key": "privateSourceNatRulesDestination", "type": "[str]"}, } def __init__( @@ -3040,6 +3137,7 @@ def __init__( vwan_configuration: Optional["_models.VwanConfiguration"] = None, egress_nat_ip: Optional[List["_models.IPAddress"]] = None, trusted_ranges: Optional[List[str]] = None, + private_source_nat_rules_destination: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -3059,6 +3157,9 @@ def __init__( :paramtype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :keyword trusted_ranges: Non-RFC 1918 address. :paramtype trusted_ranges: list[str] + :keyword private_source_nat_rules_destination: Array of ipv4 destination address for which + source NAT is to be performed. + :paramtype private_source_nat_rules_destination: list[str] """ super().__init__(**kwargs) self.vnet_configuration = vnet_configuration @@ -3068,6 +3169,7 @@ def __init__( self.enable_egress_nat = enable_egress_nat self.egress_nat_ip = egress_nat_ip self.trusted_ranges = trusted_ranges + self.private_source_nat_rules_destination = private_source_nat_rules_destination class Operation(_serialization.Model): @@ -4091,6 +4193,72 @@ def __init__( self.next_link = next_link +class ProductSerialNumberRequestStatus(_serialization.Model): + """Create Product Serial Number Request status. + + All required parameters must be populated in order to send to Azure. + + :ivar status: allocation status of the product serial number. Required. + :vartype status: str + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: str, **kwargs: Any) -> None: + """ + :keyword status: allocation status of the product serial number. Required. + :paramtype status: str + """ + super().__init__(**kwargs) + self.status = status + + +class ProductSerialNumberStatus(_serialization.Model): + """Product serial and status for the service. + + All required parameters must be populated in order to send to Azure. + + :ivar serial_number: product Serial associated with given resource. + :vartype serial_number: str + :ivar status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :vartype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + status: Union[str, "_models.ProductSerialStatusValues"], + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword serial_number: product Serial associated with given resource. + :paramtype serial_number: str + :keyword status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :paramtype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + super().__init__(**kwargs) + self.serial_number = serial_number + self.status = status + + class RuleCounter(_serialization.Model): """Rule counter. @@ -4508,6 +4676,60 @@ def __init__( self.account_name = account_name +class StrataCloudManagerConfig(_serialization.Model): + """This field is only present if Strata Cloud Manager is managing the policy for this firewall. + + All required parameters must be populated in order to send to Azure. + + :ivar cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy for + this firewall. Required. + :vartype cloud_manager_name: str + """ + + _validation = { + "cloud_manager_name": {"required": True}, + } + + _attribute_map = { + "cloud_manager_name": {"key": "cloudManagerName", "type": "str"}, + } + + def __init__(self, *, cloud_manager_name: str, **kwargs: Any) -> None: + """ + :keyword cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy + for this firewall. Required. + :paramtype cloud_manager_name: str + """ + super().__init__(**kwargs) + self.cloud_manager_name = cloud_manager_name + + +class StrataCloudManagerInfo(_serialization.Model): + """Strata Cloud Manager Info. + + :ivar folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :vartype folder_name: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + """ + + _attribute_map = { + "folder_name": {"key": "folderName", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + } + + def __init__(self, *, folder_name: Optional[str] = None, hub_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :paramtype folder_name: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + """ + super().__init__(**kwargs) + self.folder_name = folder_name + self.hub_url = hub_url + + class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes """Support information for the resource. @@ -4617,6 +4839,135 @@ def __init__( self.register_url = register_url +class SupportInfoModel(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Support information for the service. + + :ivar product_sku: product SKU associated with given resource. + :vartype product_sku: str + :ivar product_serial: product Serial associated with given resource. + :vartype product_serial: str + :ivar account_registration_status: account registered in Customer Support Portal. Known values + are: "Registered" and "Not Registered". + :vartype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :ivar account_id: Support account associated with given resource. + :vartype account_id: str + :ivar free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :vartype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :ivar free_trial_days_left: Free trial days remaining. + :vartype free_trial_days_left: int + :ivar free_trial_credit_left: Free trial credit remaining. + :vartype free_trial_credit_left: int + :ivar help_url: URL for paloaltonetworks live community. + :vartype help_url: str + :ivar support_url: URL for paloaltonetworks Customer Service Portal. + :vartype support_url: str + :ivar register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :vartype register_url: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + :ivar credits: credits purchased, unit per hour. + :vartype credits: int + :ivar monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :vartype monthly_credit_left: int + :ivar start_date_for_credits: date in format yyyy-mm-dd. + :vartype start_date_for_credits: str + :ivar end_date_for_credits: date in format yyyy-mm-dd. + :vartype end_date_for_credits: str + """ + + _attribute_map = { + "product_sku": {"key": "productSku", "type": "str"}, + "product_serial": {"key": "productSerial", "type": "str"}, + "account_registration_status": {"key": "accountRegistrationStatus", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "free_trial": {"key": "freeTrial", "type": "str"}, + "free_trial_days_left": {"key": "freeTrialDaysLeft", "type": "int"}, + "free_trial_credit_left": {"key": "freeTrialCreditLeft", "type": "int"}, + "help_url": {"key": "helpURL", "type": "str"}, + "support_url": {"key": "supportURL", "type": "str"}, + "register_url": {"key": "registerURL", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + "credits": {"key": "credits", "type": "int"}, + "monthly_credit_left": {"key": "monthlyCreditLeft", "type": "int"}, + "start_date_for_credits": {"key": "startDateForCredits", "type": "str"}, + "end_date_for_credits": {"key": "endDateForCredits", "type": "str"}, + } + + def __init__( + self, + *, + product_sku: Optional[str] = None, + product_serial: Optional[str] = None, + account_registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = None, + account_id: Optional[str] = None, + free_trial: Optional[Union[str, "_models.EnableStatus"]] = None, + free_trial_days_left: Optional[int] = None, + free_trial_credit_left: Optional[int] = None, + help_url: Optional[str] = None, + support_url: Optional[str] = None, + register_url: Optional[str] = None, + hub_url: Optional[str] = None, + credits: Optional[int] = None, + monthly_credit_left: Optional[int] = None, + start_date_for_credits: Optional[str] = None, + end_date_for_credits: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword product_sku: product SKU associated with given resource. + :paramtype product_sku: str + :keyword product_serial: product Serial associated with given resource. + :paramtype product_serial: str + :keyword account_registration_status: account registered in Customer Support Portal. Known + values are: "Registered" and "Not Registered". + :paramtype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :keyword account_id: Support account associated with given resource. + :paramtype account_id: str + :keyword free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :paramtype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :keyword free_trial_days_left: Free trial days remaining. + :paramtype free_trial_days_left: int + :keyword free_trial_credit_left: Free trial credit remaining. + :paramtype free_trial_credit_left: int + :keyword help_url: URL for paloaltonetworks live community. + :paramtype help_url: str + :keyword support_url: URL for paloaltonetworks Customer Service Portal. + :paramtype support_url: str + :keyword register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :paramtype register_url: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + :keyword credits: credits purchased, unit per hour. + :paramtype credits: int + :keyword monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :paramtype monthly_credit_left: int + :keyword start_date_for_credits: date in format yyyy-mm-dd. + :paramtype start_date_for_credits: str + :keyword end_date_for_credits: date in format yyyy-mm-dd. + :paramtype end_date_for_credits: str + """ + super().__init__(**kwargs) + self.product_sku = product_sku + self.product_serial = product_serial + self.account_registration_status = account_registration_status + self.account_id = account_id + self.free_trial = free_trial + self.free_trial_days_left = free_trial_days_left + self.free_trial_credit_left = free_trial_credit_left + self.help_url = help_url + self.support_url = support_url + self.register_url = register_url + self.hub_url = hub_url + self.credits = credits + self.monthly_credit_left = monthly_credit_left + self.start_date_for_credits = start_date_for_credits + self.end_date_for_credits = end_date_for_credits + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py index 58c50e2a512c..6ab85dbde444 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py @@ -92,6 +92,13 @@ class EnabledDNSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE = "AZURE" +class EnableStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable status.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status Codes for the Firewall.""" @@ -156,6 +163,13 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class ProductSerialStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """allocation status of the product serial number.""" + + ALLOCATED = "Allocated" + IN_PROGRESS = "InProgress" + + class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Protocol Enum.""" @@ -185,6 +199,13 @@ class ReadOnlyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETED = "Deleted" +class RegistrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Registration status.""" + + REGISTERED = "Registered" + NOT_REGISTERED = "Not Registered" + + class ScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Rulestack Type.""" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py index 72bdc9199a7f..203c56ed82f5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py @@ -13,6 +13,7 @@ from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations from ._pre_rules_operations import PreRulesOperations from ._operations import Operations +from ._palo_alto_networks_cloudngfw_operations import PaloAltoNetworksCloudngfwOperations from ._firewalls_operations import FirewallsOperations from ._local_rulestacks_operations import LocalRulestacksOperations from ._firewall_status_operations import FirewallStatusOperations @@ -33,6 +34,7 @@ "PrefixListGlobalRulestackOperations", "PreRulesOperations", "Operations", + "PaloAltoNetworksCloudngfwOperations", "FirewallsOperations", "LocalRulestacksOperations", "FirewallStatusOperations", diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py index 037b6f643848..9dc7f5148cd8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py @@ -43,7 +43,7 @@ def build_list_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_delete_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py index b911c687fa3d..f6664311e590 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py @@ -45,7 +45,7 @@ def build_list_by_local_rulestacks_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py index 606fad16f2a0..00dcd14ac6d7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py @@ -42,7 +42,7 @@ def build_list_by_firewalls_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_request(resource_group_name: str, firewall_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py index adf8749a7356..ec5a38005440 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py @@ -43,7 +43,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request(resource_group_name: str, firewall_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +202,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +235,7 @@ def build_get_global_rulestack_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,7 +268,7 @@ def build_get_log_profile_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,7 +301,7 @@ def build_get_support_info_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +336,7 @@ def build_save_log_profile_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py index 80ba3005d964..a011335195ad 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py @@ -43,7 +43,7 @@ def build_list_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +126,7 @@ def build_delete_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py index d44277f52f8b..c41c66ad46b0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py @@ -45,7 +45,7 @@ def build_list_by_local_rulestacks_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py index 005c272705f0..3554d692f96f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py @@ -43,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_get_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_create_or_update_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +113,7 @@ def build_update_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +140,7 @@ def build_delete_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +164,7 @@ def build_commit_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_get_change_log_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +223,7 @@ def build_list_advanced_security_objects_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +263,7 @@ def build_list_app_ids_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -299,7 +299,7 @@ def build_list_countries_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +329,7 @@ def build_list_firewalls_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -357,7 +357,7 @@ def build_list_predefined_url_categories_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -395,7 +395,7 @@ def build_list_security_services_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -427,7 +427,7 @@ def build_revert_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py index 66ce2c4250d2..9881a403e238 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py @@ -45,7 +45,7 @@ def build_list_by_local_rulestacks_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_get_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +231,7 @@ def build_refresh_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +273,7 @@ def build_reset_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py index 465af4ad9ac9..dbd3c0609a0c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py @@ -43,7 +43,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_list_by_resource_group_request(resource_group_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +134,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -206,7 +206,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +239,7 @@ def build_commit_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,7 +272,7 @@ def build_get_change_log_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_get_support_info_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +352,7 @@ def build_list_advanced_security_objects_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -390,7 +390,7 @@ def build_list_firewalls_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -430,7 +430,7 @@ def build_list_security_services_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -468,7 +468,7 @@ def build_revert_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py index f169399f6005..cd427285927e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py @@ -40,7 +40,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py new file mode 100644 index 000000000000..00def902f203 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py @@ -0,0 +1,383 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_product_serial_number_request(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-02-07-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_cloud_manager_tenants_request(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-02-07-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_product_serial_number_status_request(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-02-07-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_support_info_request(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-02-07-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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 PaloAltoNetworksCloudngfwOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw` 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 create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :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.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + request = build_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create_product_serial_number.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("ProductSerialNumberRequestStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_product_serial_number.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + } + + @distributed_trace + def list_cloud_manager_tenants(self, **kwargs: Any) -> List[_models.CloudManagerTenant]: + """list_cloud_manager_tenants. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of CloudManagerTenant or the result of cls(response) + :rtype: list[~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenant] + :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[List[_models.CloudManagerTenant]] = kwargs.pop("cls", None) + + request = build_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_cloud_manager_tenants.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("[CloudManagerTenant]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cloud_manager_tenants.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + } + + @distributed_trace + def list_product_serial_number_status(self, **kwargs: Any) -> _models.ProductSerialNumberStatus: + """list_product_serial_number_status. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductSerialNumberStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus + :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.ProductSerialNumberStatus] = kwargs.pop("cls", None) + + request = build_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_product_serial_number_status.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("ProductSerialNumberStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_product_serial_number_status.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus" + } + + @distributed_trace + def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :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.SupportInfoModel] = kwargs.pop("cls", None) + + request = build_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_support_info.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("SupportInfoModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_support_info.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + } diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py index 9fb02c01406a..7099ca1fcd42 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py @@ -43,7 +43,7 @@ def build_list_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request(global_rulestack_name: str, priority: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_get_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_refresh_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +222,7 @@ def build_reset_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py index d272deda4bc9..7f38c98c9a62 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py @@ -43,7 +43,7 @@ def build_list_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request(global_rulestack_name: str, priority: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_get_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_refresh_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +222,7 @@ def build_reset_counters_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py index 983965edf4db..ceaab5b7d885 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py @@ -43,7 +43,7 @@ def build_list_request(global_rulestack_name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_get_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_delete_request(global_rulestack_name: str, name: 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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py index 06fdd5142ac4..85c53799ba61 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py @@ -45,7 +45,7 @@ def build_list_by_local_rulestacks_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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +149,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-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-07-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py index 23819e971747..ca76abcb77ad 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py index d6b52a02301b..04adf0bad8d3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py index 23c9a4923db9..6b3cf51c9d35 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py index 93b98d14b3b6..7db9e00ff1c0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py index 823c7d7ab63c..d9b20538ddcf 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py index 638d55431086..23a7adab0ddc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py index 1a2dddaa4693..a403cb04a8a4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py index 8b3ad0d56e4f..cc197aec7eb8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py index 79094c46195a..f73d112c598f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py index bdad14463402..bf8592bf3a9d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py index 81bb32451e7c..57090b0d0586 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py index 753229a822c7..6ea70de77d5b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py index 5c07521f4537..e012f55e06f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py index f3cdfcb764e5..8e3e436364cd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 86e38ce4ef6f..78c426bd7433 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 19a0e9f1e245..1106da24aefe 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py index cafeab689658..1059cd24f739 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FirewallStatus_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py index 47f0eb3d91e4..6884ecb7b8fb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FirewallStatus_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py index e2fb41099ee0..f7e229d99cb7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py index edb9daa09def..5c9783f2d1f2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py index 0d47ac446a7a..43db4e5186db 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py @@ -85,6 +85,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -141,6 +142,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py index 907b6a555063..7ae044d63e8e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py index 90323214cd3d..c461b918ada6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py index 3c88823d3656..bd26aa0bccce 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py index c263d4c6f1de..d0b2e26fff26 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py index 42e0870b8e43..8e948634d8b5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py index f7fb33b4d8e5..ff3b25274954 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py index 9590498132b1..3102f9491d74 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py index d4e973378f41..9e2c0349e84b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py index aaa50b05781a..a461f9fe5673 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py index a6dcbacb0933..0f291b9ff7e6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py index f062b94c73d8..ef9ca9f839a5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py index ee6960a2cfaf..e01b7abc9831 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py index 3fbdfc83485f..8e73b8602828 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py index d0327773108b..9674d09b979d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py index 6034893d5594..e36a29850a4a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py index cae3c4800078..a25dd1451cc2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py index 31576fc2f57b..4777307b759b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py index 41587d1bbde5..4d8aaa21aff0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py @@ -88,6 +88,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -147,6 +148,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Firewalls_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py index ee8096ff89e5..3bfa576a43c0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py index 99e27224e06f..04f88611da25 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py index 8f7c21b94dfe..b5eb2f72d6f3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py index 3643d4608173..1cea9485c7c4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py index fa1307d59269..ebf0195b7d5e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py index ed45e1ecdc90..531b5f9a6eab 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py index 03e9523e332c..d6842c0167b8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py index c80a43412c5a..ec9eb0d41d3f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py index 55740bd17197..cda792471255 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py index 690f350b1e35..99f52946b705 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py index d72776834fc5..e2dc886081a9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py index 951ac8fdb7d3..4c2328b40a65 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py index 6b838068cd6a..5c75e166673a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py index a6eadc6e6c31..bdde0aef197c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 684515bd8577..22c233c4ff76 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 2278c005100c..587c947b1b78 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py index c3dc1685bd91..e759180f905b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py index cde18a8c7386..3400a28b3fdc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py index 8d2cfacd8f9d..520f3326c492 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py index 07e2a6a96ce7..834e58d0fc89 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py index 5ce5cf03b477..bd4fa4e4ac7b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py index 8808d17fa9a1..354ffe0233cc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py index a9248ed2fac5..e971e69975d3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py index aa88e2e44575..29aefe7501d2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py index ef67bf85b3bf..514034253079 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py index 9b8c0f48edf3..72b24665c943 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py index 2a5ca1085f3c..1ddb3ad68618 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py index ed6b7fe582c6..4ea70b1bcfb4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py index b3877f042802..5bf52ffc6015 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py index 685eae22ac86..2750ae324f71 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py index 252542846687..c75ccfb9012c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py index 8eb0ca1b9d03..b87fd5e97c1a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py index 9029ffa38317..c67490468c59 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py index 7a9557a32825..50af895fde3a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py index 5aad8ed63ed0..dda310c33818 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py index 58065bcc5716..d4d7a81564f6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py index 964d901d20fa..922dd8c2dfe5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py index bdd4cd37986b..a6fad1b9c1cd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py index 397aac6e4a65..033a9933a3b0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py index 7ca7fd602342..85eff4ee77d1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py index 0320c011c77c..6804e86b3af9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py index 9d2ca31088fb..8aa8f2782bfc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py index c2d9decb49aa..b3b95a38ad32 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/GlobalRulestack_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py index 89b1eddf363f..00d23729ec70 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py @@ -66,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py index 88a2fdcd6c91..7088bc76f591 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py index f54c39aac8a1..d7cd98f7045d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py index d5327972133c..afaf47053163 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py index cc3edf26f4c2..592798a48311 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py index f61cdf92e5e2..5db08e92f40b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py index 8ce51d148c76..a46a55df136f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py index e807fb6846a6..c6c94efdae7a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py index 4b255afc184b..5cc7c589db80 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py index 493878857f31..d24b824d841f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py index 022b9d627e94..99db04b7c51e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py index 961e44655cdc..998f75322a4e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py index 67739b720b2e..2632f63f745c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py index 58ab9f6ba27a..b1a65482e401 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py index c2137adf3102..91475faf2f55 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py index 7cbe940a6ed9..2e7d5273cc47 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py index 1423c45e1e7f..c0f859ffacdc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py @@ -64,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py index 35f90a7c46bf..92ccc7cbb34c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py index 52618393949c..c2f2cf10622a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py index 703b2b9dfbe4..78f24d5370dd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py index 84c8f8a1b78e..f6c97320a2af 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py index 1177a44ef2bd..52a1874bd3ea 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py index 93e934f87de0..73b65b947133 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py index f044e21f08a6..17017bbab194 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py index 4a8048ba38dc..9963bc9f0789 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py index 7a1b3ce20340..dbe83b6e8dc1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py index e3d8274539c9..18d667399438 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py index 4270bf6bda34..95c4e86222f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py index 55c424674922..b214e48c64b9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py index ea91a51a4830..bb347ff368de 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py index 995720ac3fda..55cc40cbdad2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py index ef350a40c51f..4d1543e100e3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py index 8b856d4daa04..7a299fe111a3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py index 9b48a105e88b..52052d3ea908 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py index 417fd7decb11..033726c7518f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py index c163e2920674..c7ed0dba13a9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py index 0b9ae2cffb0a..6140b6f8ffa9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py index aa91454ec5c5..76316af62978 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py index de8c33521830..fc40640908fa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/LocalRulestacks_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py index cfaf85c2bda0..eaa38ffcfc05 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py index 62ea229587fe..1d6b5006cbd3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py new file mode 100644 index 000000000000..dc55dd66e0ba --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_createProductSerialNumber_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py new file mode 100644 index 000000000000..3a307c68e738 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_createProductSerialNumber_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py new file mode 100644 index 000000000000..82dcf5b58106 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listCloudManagerTenants_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py new file mode 100644 index 000000000000..7d4a676c9391 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listCloudManagerTenants_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py new file mode 100644 index 000000000000..d35b03aea01d --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listProductSerialNumberStatus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py new file mode 100644 index 000000000000..2efb59ca0ef3 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listProductSerialNumberStatus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py new file mode 100644 index 000000000000..872348e681b4 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listSupportInfo_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py new file mode 100644 index 000000000000..b14b2e35b8a0 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.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 = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PaloAltoNetworksCloudngfw_listSupportInfo_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py index cd0b9a52e039..6ceb46a3717b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py index 64f622b2e1c8..84463f667c56 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py index c29eebf1a30f..ae7213688cd2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py index 09af61799237..51ed53b47df4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py index c77c59c9e4eb..0234dd45aba2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py index 5ea03e8594e3..deb1bda1a8dc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py index 78f456080d43..21bd2aaee995 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py index 1958c19ed55b..5500839727e2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py index 96693c160426..700bac894d12 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py index d745503854ce..fbaa6a86f6f2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py index 78ced62854e2..c923d644a4fa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py index 598d7686bec3..820756339116 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py index 64dd83e52a49..1a9864c856fa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py index f0a41a386e4f..9476e8c8787a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PostRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py index fc6918e926a3..ef1dc5c48cce 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py index f02e7bc83b1c..fc058ea21321 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py index 12d5c623f679..204594abf6ae 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py index 8d680018ef5d..b9919abdfbe5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py index c31471107029..8de4ed6a7d4c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py index 9ca7c2a5a464..ad35b46d97a4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py index cee729320321..8e1c05d6516c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py index db38c3564330..570f3513eb71 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py index bdd4727cf04e..36ed107153d1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py index f4b34d445f20..7477a2091a18 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py index 6869b39ea93f..6af644a324bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py index 4997bf81f87c..e9ac61844140 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py index 94f64b4ad95e..0fb0738dd0f5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py index 3782366f3270..03b4d52ce2fe 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PreRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py index 857d5b5c95fe..f24912ed65b9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py index 96356fd59da4..efd3c9a8bef4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py index 9e7cec848ccc..3815f6a14a15 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py index 432985ee899b..4096918fcf36 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py index 8ba7421844a2..6978dfecf14e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py index 1197c371bde9..e526a96838e8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py index 11666ccb8b85..20f9c7a1f80b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py index 157c1a3628c1..be885edacfc7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py index 7e79667026b0..c2fe678f4723 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py index 7c75fb9895d3..225231e2129c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py index cf8241f8b4cb..5eb13f297d62 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py index 550041be8fde..0f8adb649570 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py index 705081bdfe20..5656d925e1e1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py index 97e5b4032c03..4794c8365aab 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 8222e318c811..395711452e5b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 0963ee87e98d..46a8f1fd6a5f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2024-02-07-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json index 87c7eefc28d4..a0ae5ca934bf 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/_meta.json @@ -1,11 +1,11 @@ { - "commit": "eeac7c84d823171f7d3e521621fc301b85b09cf8", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/playwrighttesting/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/playwrighttesting/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/playwrighttesting/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_configuration.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_configuration.py index d6dd10e94752..0cb68728ca18 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_configuration.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_configuration.py @@ -27,16 +27,16 @@ class PlaywrightTestingMgmtClientConfiguration(Configuration): # pylint: disabl :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-02-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(PlaywrightTestingMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_playwright_testing_mgmt_client.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_playwright_testing_mgmt_client.py index cccf0c3422ce..d47dea216cda 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_playwright_testing_mgmt_client.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/_playwright_testing_mgmt_client.py @@ -15,7 +15,7 @@ from . import models as _models from ._configuration import PlaywrightTestingMgmtClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import AccountsOperations, Operations, QuotasOperations +from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -23,7 +23,7 @@ class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Microsoft.AzurePlaywrightService Resource Provider management API. + """Azure Playwright testing management service. :ivar operations: Operations operations :vartype operations: azure.mgmt.playwrighttesting.operations.Operations @@ -31,13 +31,15 @@ class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version :vartype accounts: azure.mgmt.playwrighttesting.operations.AccountsOperations :ivar quotas: QuotasOperations operations :vartype quotas: azure.mgmt.playwrighttesting.operations.QuotasOperations + :ivar account_quotas: AccountQuotasOperations operations + :vartype account_quotas: azure.mgmt.playwrighttesting.operations.AccountQuotasOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-02-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 @@ -63,6 +65,7 @@ def __init__( self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_quotas = AccountQuotasOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_configuration.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_configuration.py index 6928c781a0cd..4f48618aa6d3 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_configuration.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_configuration.py @@ -27,16 +27,16 @@ class PlaywrightTestingMgmtClientConfiguration(Configuration): # pylint: disabl :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-02-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(PlaywrightTestingMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_playwright_testing_mgmt_client.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_playwright_testing_mgmt_client.py index bf75523ee7f2..37a06e6c3daa 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_playwright_testing_mgmt_client.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/_playwright_testing_mgmt_client.py @@ -15,7 +15,7 @@ from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import PlaywrightTestingMgmtClientConfiguration -from .operations import AccountsOperations, Operations, QuotasOperations +from .operations import AccountQuotasOperations, AccountsOperations, Operations, QuotasOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -23,7 +23,7 @@ class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Microsoft.AzurePlaywrightService Resource Provider management API. + """Azure Playwright testing management service. :ivar operations: Operations operations :vartype operations: azure.mgmt.playwrighttesting.aio.operations.Operations @@ -31,13 +31,15 @@ class PlaywrightTestingMgmtClient: # pylint: disable=client-accepts-api-version :vartype accounts: azure.mgmt.playwrighttesting.aio.operations.AccountsOperations :ivar quotas: QuotasOperations operations :vartype quotas: azure.mgmt.playwrighttesting.aio.operations.QuotasOperations + :ivar account_quotas: AccountQuotasOperations operations + :vartype account_quotas: azure.mgmt.playwrighttesting.aio.operations.AccountQuotasOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-02-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 @@ -63,6 +65,7 @@ def __init__( self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_quotas = AccountQuotasOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/__init__.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/__init__.py index 8f2cc1d31c34..5b075c8470f3 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/__init__.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/__init__.py @@ -9,6 +9,7 @@ from ._operations import Operations from ._accounts_operations import AccountsOperations from ._quotas_operations import QuotasOperations +from ._account_quotas_operations import AccountQuotasOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -18,6 +19,7 @@ "Operations", "AccountsOperations", "QuotasOperations", + "AccountQuotasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_account_quotas_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_account_quotas_operations.py new file mode 100644 index 000000000000..f166c05990f7 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_account_quotas_operations.py @@ -0,0 +1,215 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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._account_quotas_operations import build_get_request, build_list_by_account_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccountQuotasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.playwrighttesting.aio.PlaywrightTestingMgmtClient`'s + :attr:`account_quotas` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AccountQuota"]: + """List quotas for a given account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Name of account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountQuota or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.playwrighttesting.models.AccountQuota] + :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.AccountQuotaListResult] = 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_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.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("AccountQuotaListResult", 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_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any + ) -> _models.AccountQuota: + """Get quota by name for an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Name of account. Required. + :type account_name: str + :param quota_name: The Playwright service account quota name. "ScalableExecution" Required. + :type quota_name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountQuota or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.AccountQuota + :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.AccountQuota] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + quota_name=quota_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 = 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("AccountQuota", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}" + } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_accounts_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_accounts_operations.py index 1b3211769304..ba8692a91271 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_accounts_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_accounts_operations.py @@ -32,6 +32,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._accounts_operations import ( + build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_get_request, @@ -146,6 +147,119 @@ async def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts" } + @overload + async def check_name_availability( + self, body: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityRequest + :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: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, body: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Is either a CheckNameAvailabilityRequest type or a + IO type. Required. + :type body: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CheckNameAvailabilityResponse] = 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, "CheckNameAvailabilityRequest") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.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("CheckNameAvailabilityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability" + } + @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Account"]: """List Account resources by resource group. @@ -234,14 +348,14 @@ async def get_next(next_link=None): } @distributed_trace_async - async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Account: + async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: """Get a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Account or the result of cls(response) :rtype: ~azure.mgmt.playwrighttesting.models.Account @@ -263,7 +377,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode request = build_get_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -293,11 +407,11 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } async def _create_or_update_initial( - self, resource_group_name: str, name: str, resource: Union[_models.Account, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, resource: Union[_models.Account, IO], **kwargs: Any ) -> _models.Account: error_map = { 401: ClientAuthenticationError, @@ -324,7 +438,7 @@ async def _create_or_update_initial( request = build_create_or_update_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -364,14 +478,14 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - name: str, + account_name: str, resource: _models.Account, *, content_type: str = "application/json", @@ -382,8 +496,8 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.playwrighttesting.models.Account :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -407,7 +521,7 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - name: str, + account_name: str, resource: IO, *, content_type: str = "application/json", @@ -418,8 +532,8 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Required. :type resource: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -441,15 +555,15 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, name: str, resource: Union[_models.Account, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, resource: Union[_models.Account, IO], **kwargs: Any ) -> AsyncLROPoller[_models.Account]: """Create a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Is either a Account type or a IO type. Required. :type resource: ~azure.mgmt.playwrighttesting.models.Account or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -480,7 +594,7 @@ async def begin_create_or_update( if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - name=name, + account_name=account_name, resource=resource, api_version=api_version, content_type=content_type, @@ -516,14 +630,14 @@ def get_long_running_output(pipeline_response): 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.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @overload async def update( self, resource_group_name: str, - name: str, + account_name: str, properties: _models.AccountUpdate, *, content_type: str = "application/json", @@ -534,8 +648,8 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Required. :type properties: ~azure.mgmt.playwrighttesting.models.AccountUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -551,7 +665,7 @@ async def update( async def update( self, resource_group_name: str, - name: str, + account_name: str, properties: IO, *, content_type: str = "application/json", @@ -562,8 +676,8 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Required. :type properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -577,15 +691,15 @@ async def update( @distributed_trace_async async def update( - self, resource_group_name: str, name: str, properties: Union[_models.AccountUpdate, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, properties: Union[_models.AccountUpdate, IO], **kwargs: Any ) -> _models.Account: """Update a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Is either a AccountUpdate type or a IO type. Required. :type properties: ~azure.mgmt.playwrighttesting.models.AccountUpdate or IO @@ -622,7 +736,7 @@ async def update( request = build_update_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -655,11 +769,11 @@ async def update( return deserialized update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -677,7 +791,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = build_delete_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -708,18 +822,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @distributed_trace_async - async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_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 @@ -743,7 +857,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - name=name, + account_name=account_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -774,5 +888,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_quotas_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_quotas_operations.py index 80be7054136d..1e63ef51c996 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_quotas_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/aio/operations/_quotas_operations.py @@ -141,14 +141,14 @@ async def get_next(next_link=None): } @distributed_trace_async - async def get(self, location: str, name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: - """Get quota by name. + async def get(self, location: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: + """Get subscription quota by name. :param location: The location of quota in ARM Normalized format like eastus, southeastasia etc. Required. :type location: str - :param name: The quota name. "ScalableExecution" Required. - :type name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames + :param quota_name: The quota name. "ScalableExecution" Required. + :type quota_name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames :keyword callable cls: A custom type or function that will be passed the direct response :return: Quota or the result of cls(response) :rtype: ~azure.mgmt.playwrighttesting.models.Quota @@ -170,7 +170,7 @@ async def get(self, location: str, name: Union[str, _models.QuotaNames], **kwarg request = build_get_request( location=location, - name=name, + quota_name=quota_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -200,5 +200,5 @@ async def get(self, location: str, name: Union[str, _models.QuotaNames], **kwarg return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}" + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}" } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/__init__.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/__init__.py index dcb08c2a98a8..10e02cc2d4f1 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/__init__.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/__init__.py @@ -7,8 +7,16 @@ # -------------------------------------------------------------------------- from ._models_py3 import Account +from ._models_py3 import AccountFreeTrialProperties from ._models_py3 import AccountListResult +from ._models_py3 import AccountProperties +from ._models_py3 import AccountQuota +from ._models_py3 import AccountQuotaListResult +from ._models_py3 import AccountQuotaProperties from ._models_py3 import AccountUpdate +from ._models_py3 import AccountUpdateProperties +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResponse from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -19,11 +27,13 @@ from ._models_py3 import ProxyResource from ._models_py3 import Quota from ._models_py3 import QuotaListResult +from ._models_py3 import QuotaProperties from ._models_py3 import Resource from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._playwright_testing_mgmt_client_enums import ActionType +from ._playwright_testing_mgmt_client_enums import CheckNameAvailabilityReason from ._playwright_testing_mgmt_client_enums import CreatedByType from ._playwright_testing_mgmt_client_enums import EnablementStatus from ._playwright_testing_mgmt_client_enums import FreeTrialState @@ -36,8 +46,16 @@ __all__ = [ "Account", + "AccountFreeTrialProperties", "AccountListResult", + "AccountProperties", + "AccountQuota", + "AccountQuotaListResult", + "AccountQuotaProperties", "AccountUpdate", + "AccountUpdateProperties", + "CheckNameAvailabilityRequest", + "CheckNameAvailabilityResponse", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -48,10 +66,12 @@ "ProxyResource", "Quota", "QuotaListResult", + "QuotaProperties", "Resource", "SystemData", "TrackedResource", "ActionType", + "CheckNameAvailabilityReason", "CreatedByType", "EnablementStatus", "FreeTrialState", diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models_py3.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models_py3.py index bb27540e65df..f7b31d3d7970 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models_py3.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_models_py3.py @@ -22,8 +22,8 @@ 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -66,8 +66,8 @@ class TrackedResource(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -112,15 +112,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Account(TrackedResource): # pylint: disable=too-many-instance-attributes - """An account resource. +class Account(TrackedResource): + """A Playwright service account 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -134,6 +134,131 @@ class Account(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "AccountProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AccountProperties"] = 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 properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.playwrighttesting.models.AccountProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AccountFreeTrialProperties(_serialization.Model): + """The Playwright service account quota resource free-trial 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 created_at: The free-trial createdAt utcDateTime. Required. + :vartype created_at: ~datetime.datetime + :ivar expiry_at: The free-trial expiryAt utcDateTime. Required. + :vartype expiry_at: ~datetime.datetime + :ivar allocated_value: The free-trial allocated limit value eg. allocated free minutes. + Required. + :vartype allocated_value: int + :ivar used_value: The free-trial used value eg. used free minutes. Required. + :vartype used_value: int + :ivar percentage_used: The free-trial percentage used. Required. + :vartype percentage_used: float + """ + + _validation = { + "created_at": {"required": True, "readonly": True}, + "expiry_at": {"required": True, "readonly": True}, + "allocated_value": {"required": True, "readonly": True}, + "used_value": {"required": True, "readonly": True}, + "percentage_used": {"required": True, "readonly": True, "maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "expiry_at": {"key": "expiryAt", "type": "iso-8601"}, + "allocated_value": {"key": "allocatedValue", "type": "int"}, + "used_value": {"key": "usedValue", "type": "int"}, + "percentage_used": {"key": "percentageUsed", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_at = None + self.expiry_at = None + self.allocated_value = None + self.used_value = None + self.percentage_used = None + + +class AccountListResult(_serialization.Model): + """The response of a Account list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The Account items on this page. Required. + :vartype value: list[~azure.mgmt.playwrighttesting.models.Account] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Account]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Account"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Account items on this page. Required. + :paramtype value: list[~azure.mgmt.playwrighttesting.models.Account] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AccountProperties(_serialization.Model): + """Account resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar dashboard_uri: The Playwright testing dashboard URI for the account resource. :vartype dashboard_uri: str :ivar regional_affinity: This property sets the connection region for Playwright client workers @@ -150,49 +275,32 @@ class Account(TrackedResource): # pylint: disable=too-many-instance-attributes enables faster and more efficient troubleshooting. Known values are: "Enabled" and "Disabled". :vartype reporting: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Deleting", and "Accepted". + "Failed", "Canceled", "Creating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, "dashboard_uri": {"readonly": True}, "provisioning_state": {"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"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "dashboard_uri": {"key": "properties.dashboardUri", "type": "str"}, - "regional_affinity": {"key": "properties.regionalAffinity", "type": "str"}, - "scalable_execution": {"key": "properties.scalableExecution", "type": "str"}, - "reporting": {"key": "properties.reporting", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "dashboard_uri": {"key": "dashboardUri", "type": "str"}, + "regional_affinity": {"key": "regionalAffinity", "type": "str"}, + "scalable_execution": {"key": "scalableExecution", "type": "str"}, + "reporting": {"key": "reporting", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = None, scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = None, reporting: Optional[Union[str, "_models.EnablementStatus"]] = 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 regional_affinity: This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in @@ -207,7 +315,7 @@ def __init__( enables faster and more efficient troubleshooting. Known values are: "Enabled" and "Disabled". :paramtype reporting: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus """ - super().__init__(tags=tags, location=location, **kwargs) + super().__init__(**kwargs) self.dashboard_uri = None self.regional_affinity = regional_affinity self.scalable_execution = scalable_execution @@ -215,13 +323,95 @@ def __init__( self.provisioning_state = None -class AccountListResult(_serialization.Model): - """The response of a Account list operation. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.playwrighttesting.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class AccountQuota(ProxyResource): + """A quota resource for a Playwright service account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.playwrighttesting.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountQuotaProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "AccountQuotaProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AccountQuotaProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.playwrighttesting.models.AccountQuotaProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AccountQuotaListResult(_serialization.Model): + """The response of a AccountQuota list operation. All required parameters must be populated in order to send to Azure. - :ivar value: The Account items on this page. Required. - :vartype value: list[~azure.mgmt.playwrighttesting.models.Account] + :ivar value: The AccountQuota items on this page. Required. + :vartype value: list[~azure.mgmt.playwrighttesting.models.AccountQuota] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -231,14 +421,14 @@ class AccountListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Account]"}, + "value": {"key": "value", "type": "[AccountQuota]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Account"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.AccountQuota"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: The Account items on this page. Required. - :paramtype value: list[~azure.mgmt.playwrighttesting.models.Account] + :keyword value: The AccountQuota items on this page. Required. + :paramtype value: list[~azure.mgmt.playwrighttesting.models.AccountQuota] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -247,11 +437,72 @@ def __init__(self, *, value: List["_models.Account"], next_link: Optional[str] = self.next_link = next_link +class AccountQuotaProperties(_serialization.Model): + """The Playwright service account quota resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar free_trial: The Playwright service account quota resource free-trial properties. + :vartype free_trial: ~azure.mgmt.playwrighttesting.models.AccountFreeTrialProperties + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "free_trial": {"key": "freeTrial", "type": "AccountFreeTrialProperties"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, free_trial: Optional["_models.AccountFreeTrialProperties"] = None, **kwargs: Any) -> None: + """ + :keyword free_trial: The Playwright service account quota resource free-trial properties. + :paramtype free_trial: ~azure.mgmt.playwrighttesting.models.AccountFreeTrialProperties + """ + super().__init__(**kwargs) + self.free_trial = free_trial + self.provisioning_state = None + + class AccountUpdate(_serialization.Model): """The type used for update operations of the Account. :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the Account. + :vartype properties: ~azure.mgmt.playwrighttesting.models.AccountUpdateProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "AccountUpdateProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AccountUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the Account. + :paramtype properties: ~azure.mgmt.playwrighttesting.models.AccountUpdateProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class AccountUpdateProperties(_serialization.Model): + """The updatable properties of the Account. + :ivar regional_affinity: This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which @@ -268,24 +519,20 @@ class AccountUpdate(_serialization.Model): """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "regional_affinity": {"key": "properties.regionalAffinity", "type": "str"}, - "scalable_execution": {"key": "properties.scalableExecution", "type": "str"}, - "reporting": {"key": "properties.reporting", "type": "str"}, + "regional_affinity": {"key": "regionalAffinity", "type": "str"}, + "scalable_execution": {"key": "scalableExecution", "type": "str"}, + "reporting": {"key": "reporting", "type": "str"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, regional_affinity: Optional[Union[str, "_models.EnablementStatus"]] = None, scalable_execution: Optional[Union[str, "_models.EnablementStatus"]] = None, reporting: Optional[Union[str, "_models.EnablementStatus"]] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] :keyword regional_affinity: This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in @@ -301,12 +548,78 @@ def __init__( :paramtype reporting: str or ~azure.mgmt.playwrighttesting.models.EnablementStatus """ super().__init__(**kwargs) - self.tags = tags self.regional_affinity = regional_affinity self.scalable_execution = scalable_execution self.reporting = reporting +class CheckNameAvailabilityRequest(_serialization.Model): + """The check availability request body. + + :ivar name: The name of the resource for which availability needs to be checked. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the resource for which availability needs to be checked. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class CheckNameAvailabilityResponse(_serialization.Model): + """The check availability result. + + :ivar name_available: Indicates if the resource name is available. + :vartype name_available: bool + :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. + :vartype message: str + """ + + _attribute_map = { + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name_available: Indicates if the resource name is available. + :paramtype name_available: bool + :keyword reason: The reason why the given name is not available. Known values are: "Invalid" + and "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str + """ + super().__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -400,46 +713,26 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class FreeTrialProperties(_serialization.Model): - """The free-trial properties. + """The subscription quota resource free-trial 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 account_id: The playwright account id. Required. + :ivar account_id: The Playwright service account id. Required. :vartype account_id: str - :ivar created_at: The free-trial createdAt utcDateTime. Required. - :vartype created_at: ~datetime.datetime - :ivar expiry_at: The free-trial expiryAt utcDateTime. Required. - :vartype expiry_at: ~datetime.datetime - :ivar allocated_value: The free-trial allocated limit value eg. allocated free minutes. - Required. - :vartype allocated_value: int - :ivar used_value: The free-trial used value eg. used free minutes. Required. - :vartype used_value: int - :ivar percentage_used: The free-trial percentage used. Required. - :vartype percentage_used: float - :ivar state: The free-trial state. Required. Known values are: "Active" and "Expired". + :ivar state: The free-trial state. Required. Known values are: "Active", "Expired", + "NotEligible", and "NotRegistered". :vartype state: str or ~azure.mgmt.playwrighttesting.models.FreeTrialState """ _validation = { "account_id": {"required": True, "readonly": True}, - "created_at": {"required": True, "readonly": True}, - "expiry_at": {"required": True, "readonly": True}, - "allocated_value": {"required": True, "readonly": True}, - "used_value": {"required": True, "readonly": True}, - "percentage_used": {"required": True, "readonly": True, "maximum": 100, "minimum": 0}, "state": {"required": True, "readonly": True}, } _attribute_map = { "account_id": {"key": "accountId", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "expiry_at": {"key": "expiryAt", "type": "iso-8601"}, - "allocated_value": {"key": "allocatedValue", "type": "int"}, - "used_value": {"key": "usedValue", "type": "int"}, - "percentage_used": {"key": "percentageUsed", "type": "float"}, "state": {"key": "state", "type": "str"}, } @@ -447,11 +740,6 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.account_id = None - self.created_at = None - self.expiry_at = None - self.allocated_value = None - self.used_value = None - self.percentage_used = None self.state = None @@ -576,51 +864,13 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - 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.playwrighttesting.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - class Quota(ProxyResource): - """A quota resource. + """A subscription quota 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -630,11 +880,8 @@ class Quota(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.playwrighttesting.models.SystemData - :ivar free_trial: The free-trial quota. - :vartype free_trial: ~azure.mgmt.playwrighttesting.models.FreeTrialProperties - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.playwrighttesting.models.QuotaProperties """ _validation = { @@ -642,7 +889,6 @@ class Quota(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -650,18 +896,16 @@ class Quota(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "free_trial": {"key": "properties.freeTrial", "type": "FreeTrialProperties"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "QuotaProperties"}, } - def __init__(self, *, free_trial: Optional["_models.FreeTrialProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.QuotaProperties"] = None, **kwargs: Any) -> None: """ - :keyword free_trial: The free-trial quota. - :paramtype free_trial: ~azure.mgmt.playwrighttesting.models.FreeTrialProperties + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.playwrighttesting.models.QuotaProperties """ super().__init__(**kwargs) - self.free_trial = free_trial - self.provisioning_state = None + self.properties = properties class QuotaListResult(_serialization.Model): @@ -696,6 +940,37 @@ def __init__(self, *, value: List["_models.Quota"], next_link: Optional[str] = N self.next_link = next_link +class QuotaProperties(_serialization.Model): + """The subscription quota resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar free_trial: The subscription quota resource free-trial properties. + :vartype free_trial: ~azure.mgmt.playwrighttesting.models.FreeTrialProperties + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.playwrighttesting.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "free_trial": {"key": "freeTrial", "type": "FreeTrialProperties"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, free_trial: Optional["_models.FreeTrialProperties"] = None, **kwargs: Any) -> None: + """ + :keyword free_trial: The subscription quota resource free-trial properties. + :paramtype free_trial: ~azure.mgmt.playwrighttesting.models.FreeTrialProperties + """ + super().__init__(**kwargs) + self.free_trial = free_trial + self.provisioning_state = None + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_playwright_testing_mgmt_client_enums.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_playwright_testing_mgmt_client_enums.py index 41e39f61e8e9..9a56fcb61334 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_playwright_testing_mgmt_client_enums.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/models/_playwright_testing_mgmt_client_enums.py @@ -16,6 +16,13 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The reason why the given name is not available.""" + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -26,7 +33,11 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EnablementStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The enablement status of a feature.""" + """This property sets the connection region for Playwright client workers to cloud-hosted + browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + latency. If disabled, workers connect to browsers in the Azure region in which the workspace + was initially created. + """ ENABLED = "Enabled" """The feature is Enabled.""" @@ -41,6 +52,10 @@ class FreeTrialState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The free-trial is Active.""" EXPIRED = "Expired" """The free-trial is Expired.""" + NOT_ELIGIBLE = "NotEligible" + """The free-trial is Not Eligible.""" + NOT_REGISTERED = "NotRegistered" + """The free-trial is Not Registered.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -62,10 +77,12 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource creation failed.""" CANCELED = "Canceled" """Resource creation was canceled.""" + CREATING = "Creating" + """Creation in progress..""" DELETING = "Deleting" - """Deletion in progress""" + """Deletion in progress..""" ACCEPTED = "Accepted" - """Change accepted for processing""" + """Change accepted for processing..""" class QuotaNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/__init__.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/__init__.py index 8f2cc1d31c34..5b075c8470f3 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/__init__.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/__init__.py @@ -9,6 +9,7 @@ from ._operations import Operations from ._accounts_operations import AccountsOperations from ._quotas_operations import QuotasOperations +from ._account_quotas_operations import AccountQuotasOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -18,6 +19,7 @@ "Operations", "AccountsOperations", "QuotasOperations", + "AccountQuotasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_account_quotas_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_account_quotas_operations.py new file mode 100644 index 000000000000..9d95810b8597 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_account_quotas_operations.py @@ -0,0 +1,291 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_account_request( + resource_group_name: str, account_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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + ), + } + + _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_get_request( + resource_group_name: str, + account_name: str, + quota_name: Union[str, _models.QuotaNames], + 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-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + ), + "quotaName": _SERIALIZER.url("quota_name", quota_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) + + +class AccountQuotasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.playwrighttesting.PlaywrightTestingMgmtClient`'s + :attr:`account_quotas` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.AccountQuota"]: + """List quotas for a given account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Name of account. Required. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountQuota or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.playwrighttesting.models.AccountQuota] + :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.AccountQuotaListResult] = 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_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_account.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AccountQuotaListResult", 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) + + list_by_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas" + } + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any + ) -> _models.AccountQuota: + """Get quota by name for an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Name of account. Required. + :type account_name: str + :param quota_name: The Playwright service account quota name. "ScalableExecution" Required. + :type quota_name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountQuota or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.AccountQuota + :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.AccountQuota] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + quota_name=quota_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("AccountQuota", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}" + } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_accounts_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_accounts_operations.py index 1fb883d1cbbe..9a8f7a5dffd9 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_accounts_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_accounts_operations.py @@ -43,7 +43,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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -65,11 +65,41 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_check_name_availability_request(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-02-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}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +108,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -95,25 +125,25 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(resource_group_name: str, name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request(resource_group_name: str, account_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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" ), } @@ -129,27 +159,27 @@ def build_get_request(resource_group_name: str, name: str, subscription_id: str, def build_create_or_update_request( - resource_group_name: str, name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, account_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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-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.AzurePlaywrightService/accounts/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" ), } @@ -166,26 +196,28 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request(resource_group_name: str, name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_request( + resource_group_name: str, account_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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-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.AzurePlaywrightService/accounts/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" ), } @@ -202,25 +234,27 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request(resource_group_name: str, name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request( + resource_group_name: str, account_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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=3, pattern=r"^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$" ), } @@ -337,6 +371,119 @@ def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts" } + @overload + def check_name_availability( + self, body: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Required. + :type body: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityRequest + :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: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, body: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Adds check global name availability operation, normally used if a resource name must be + globally unique. + + :param body: The CheckAvailability request. Is either a CheckNameAvailabilityRequest type or a + IO type. Required. + :type body: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.playwrighttesting.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.CheckNameAvailabilityResponse] = 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, "CheckNameAvailabilityRequest") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.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("CheckNameAvailabilityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability" + } + @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Account"]: """List Account resources by resource group. @@ -425,14 +572,14 @@ def get_next(next_link=None): } @distributed_trace - def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Account: + def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: """Get a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Account or the result of cls(response) :rtype: ~azure.mgmt.playwrighttesting.models.Account @@ -454,7 +601,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Acc request = build_get_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -484,11 +631,11 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Acc return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } def _create_or_update_initial( - self, resource_group_name: str, name: str, resource: Union[_models.Account, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, resource: Union[_models.Account, IO], **kwargs: Any ) -> _models.Account: error_map = { 401: ClientAuthenticationError, @@ -515,7 +662,7 @@ def _create_or_update_initial( request = build_create_or_update_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -555,14 +702,14 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @overload def begin_create_or_update( self, resource_group_name: str, - name: str, + account_name: str, resource: _models.Account, *, content_type: str = "application/json", @@ -573,8 +720,8 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.playwrighttesting.models.Account :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -597,7 +744,7 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - name: str, + account_name: str, resource: IO, *, content_type: str = "application/json", @@ -608,8 +755,8 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Required. :type resource: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -630,15 +777,15 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, name: str, resource: Union[_models.Account, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, resource: Union[_models.Account, IO], **kwargs: Any ) -> LROPoller[_models.Account]: """Create a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param resource: Resource create parameters. Is either a Account type or a IO type. Required. :type resource: ~azure.mgmt.playwrighttesting.models.Account or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -668,7 +815,7 @@ def begin_create_or_update( if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - name=name, + account_name=account_name, resource=resource, api_version=api_version, content_type=content_type, @@ -703,14 +850,14 @@ def get_long_running_output(pipeline_response): 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.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @overload def update( self, resource_group_name: str, - name: str, + account_name: str, properties: _models.AccountUpdate, *, content_type: str = "application/json", @@ -721,8 +868,8 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Required. :type properties: ~azure.mgmt.playwrighttesting.models.AccountUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -738,7 +885,7 @@ def update( def update( self, resource_group_name: str, - name: str, + account_name: str, properties: IO, *, content_type: str = "application/json", @@ -749,8 +896,8 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Required. :type properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -764,15 +911,15 @@ def update( @distributed_trace def update( - self, resource_group_name: str, name: str, properties: Union[_models.AccountUpdate, IO], **kwargs: Any + self, resource_group_name: str, account_name: str, properties: Union[_models.AccountUpdate, IO], **kwargs: Any ) -> _models.Account: """Update a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_name: str :param properties: The resource properties to be updated. Is either a AccountUpdate type or a IO type. Required. :type properties: ~azure.mgmt.playwrighttesting.models.AccountUpdate or IO @@ -809,7 +956,7 @@ def update( request = build_update_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -842,11 +989,11 @@ def update( return deserialized update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -864,7 +1011,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = build_delete_request( resource_group_name=resource_group_name, - name=name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -895,18 +1042,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } @distributed_trace - def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: """Delete a Account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param name: Name of account. Required. - :type name: str + :param account_name: Name of account. Required. + :type account_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 @@ -930,7 +1077,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - name=name, + account_name=account_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -961,5 +1108,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py index c42402ab7583..bb1db51e4299 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_operations.py @@ -40,7 +40,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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_quotas_operations.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_quotas_operations.py index 80f35d3fd18f..8d7160b3af4f 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_quotas_operations.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/azure/mgmt/playwrighttesting/operations/_quotas_operations.py @@ -40,7 +40,7 @@ def build_list_by_subscription_request(location: str, subscription_id: str, **kw _headers = case_insensitive_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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_by_subscription_request(location: str, subscription_id: str, **kw "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), } @@ -65,23 +65,23 @@ def build_list_by_subscription_request(location: str, subscription_id: str, **kw def build_get_request( - location: str, name: Union[str, _models.QuotaNames], subscription_id: str, **kwargs: Any + location: str, quota_name: Union[str, _models.QuotaNames], 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-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}", + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "quotaName": _SERIALIZER.url("quota_name", quota_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -202,14 +202,14 @@ def get_next(next_link=None): } @distributed_trace - def get(self, location: str, name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: - """Get quota by name. + def get(self, location: str, quota_name: Union[str, _models.QuotaNames], **kwargs: Any) -> _models.Quota: + """Get subscription quota by name. :param location: The location of quota in ARM Normalized format like eastus, southeastasia etc. Required. :type location: str - :param name: The quota name. "ScalableExecution" Required. - :type name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames + :param quota_name: The quota name. "ScalableExecution" Required. + :type quota_name: str or ~azure.mgmt.playwrighttesting.models.QuotaNames :keyword callable cls: A custom type or function that will be passed the direct response :return: Quota or the result of cls(response) :rtype: ~azure.mgmt.playwrighttesting.models.Quota @@ -231,7 +231,7 @@ def get(self, location: str, name: Union[str, _models.QuotaNames], **kwargs: Any request = build_get_request( location=location, - name=name, + quota_name=quota_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -261,5 +261,5 @@ def get(self, location: str, name: Union[str, _models.QuotaNames], **kwargs: Any return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}" + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}" } diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_get.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_get.py new file mode 100644 index 000000000000..25ab14937068 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_get.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.playwrighttesting import PlaywrightTestingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-playwrighttesting +# USAGE + python account_quotas_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 = PlaywrightTestingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_quotas.get( + resource_group_name="dummyrg", + account_name="myPlaywrightAccount", + quota_name="ScalableExecution", + ) + print(response) + + +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/AccountQuotas_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_list_by_account.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_list_by_account.py new file mode 100644 index 000000000000..35ab7f56d582 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/account_quotas_list_by_account.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.playwrighttesting import PlaywrightTestingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-playwrighttesting +# USAGE + python account_quotas_list_by_account.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 = PlaywrightTestingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_quotas.list_by_account( + resource_group_name="dummyrg", + account_name="myPlaywrightAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/AccountQuotas_ListByAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_check_name_availability.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_check_name_availability.py new file mode 100644 index 000000000000..4db40841ab99 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_check_name_availability.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.playwrighttesting import PlaywrightTestingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-playwrighttesting +# USAGE + python accounts_check_name_availability.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 = PlaywrightTestingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.accounts.check_name_availability( + body={"name": "dummyName", "type": "Microsoft.AzurePlaywrightService/Accounts"}, + ) + print(response) + + +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_CheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_create_or_update.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_create_or_update.py index 189dfb0392dc..777ff11a76b4 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_create_or_update.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_create_or_update.py @@ -31,19 +31,12 @@ def main(): response = client.accounts.begin_create_or_update( resource_group_name="dummyrg", - name="myPlaywrightAccount", - resource={ - "location": "westus", - "properties": { - "dashboardUri": "https://dashboard.00000000-0000-0000-0000-000000000000.domain.com", - "regionalAffinity": "Enabled", - }, - "tags": {"Team": "Dev Exp"}, - }, + account_name="myPlaywrightAccount", + resource={"location": "westus", "properties": {"regionalAffinity": "Enabled"}, "tags": {"Team": "Dev Exp"}}, ).result() print(response) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_delete.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_delete.py index ee97ce72a2ce..9ae52d823118 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_delete.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_delete.py @@ -31,10 +31,10 @@ def main(): client.accounts.begin_delete( resource_group_name="dummyrg", - name="myPlaywrightAccount", + account_name="myPlaywrightAccount", ).result() -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_Delete.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_get.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_get.py index 95fb3850b017..a2dd159e116f 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_get.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_get.py @@ -31,11 +31,11 @@ def main(): response = client.accounts.get( resource_group_name="dummyrg", - name="myPlaywrightAccount", + account_name="myPlaywrightAccount", ) print(response) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_Get.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_resource_group.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_resource_group.py index 3fa4aadecf91..f131f0064d49 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_resource_group.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_subscription.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_subscription.py index 1808d469bf08..f6f1655b5eeb 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_subscription.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_update.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_update.py index b7edac1944ed..88208f2181d9 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_update.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/accounts_update.py @@ -31,12 +31,12 @@ def main(): response = client.accounts.update( resource_group_name="dummyrg", - name="myPlaywrightAccount", + account_name="myPlaywrightAccount", properties={"properties": {"regionalAffinity": "Enabled"}, "tags": {"Division": "LT", "Team": "Dev Exp"}}, ) print(response) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Accounts_Update.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/operations_list.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/operations_list.py index cfbc4a8331a3..91a8314e7a1f 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/operations_list.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_get.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_get.py index 91b993a27081..bc1a797cc8ae 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_get.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_get.py @@ -31,11 +31,11 @@ def main(): response = client.quotas.get( location="eastus", - name="ScalableExecution", + quota_name="ScalableExecution", ) print(response) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Quotas_Get.json if __name__ == "__main__": main() diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_list_by_subscription.py b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_list_by_subscription.py index 61cd418cdacf..c44637b55726 100644 --- a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_list_by_subscription.py +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/generated_samples/quotas_list_by_subscription.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json +# x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2024-02-01-preview/examples/Quotas_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/_meta.json b/sdk/quantum/azure-mgmt-quantum/_meta.json index 861e106fc3bd..69c2fe4f396c 100644 --- a/sdk/quantum/azure-mgmt-quantum/_meta.json +++ b/sdk/quantum/azure-mgmt-quantum/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0f39a2d56070d2bc4251494525cb8af88583a938", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/quantum/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/quantum/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/quantum/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py index 64c51ab30a33..e5c644603bbf 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_azure_quantum_management_client.py @@ -35,11 +35,11 @@ class AzureQuantumManagementClient: # pylint: disable=client-accepts-api-versio :vartype workspace: azure.mgmt.quantum.operations.WorkspaceOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2022-01-10-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-13-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 diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py index 3124087e8a00..07c829d647cb 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_configuration.py @@ -27,16 +27,16 @@ class AzureQuantumManagementClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-10-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-13-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(AzureQuantumManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-01-10-preview") + api_version: str = kwargs.pop("api_version", "2023-11-13-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_serialization.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_serialization.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_serialization.py @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_vendor.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_vendor.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py index 8d50297ac8eb..e5754a47ce68 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b4" +VERSION = "1.0.0b1" diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py index 6d97285651f1..9f27c314832e 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_azure_quantum_management_client.py @@ -35,11 +35,11 @@ class AzureQuantumManagementClient: # pylint: disable=client-accepts-api-versio :vartype workspace: azure.mgmt.quantum.aio.operations.WorkspaceOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2022-01-10-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-13-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 diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py index fd34b0ee3f5c..2ec634a567df 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/_configuration.py @@ -27,16 +27,16 @@ class AzureQuantumManagementClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-10-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-13-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(AzureQuantumManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-01-10-preview") + api_version: str = kwargs.pop("api_version", "2023-11-13-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspace_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspace_operations.py index a9763d4f2182..153b38411dba 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspace_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspace_operations.py @@ -26,7 +26,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._workspace_operations import build_check_name_availability_request +from ...operations._workspace_operations import ( + build_check_name_availability_request, + build_list_keys_request, + build_regenerate_keys_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -182,3 +186,210 @@ async def check_name_availability( check_name_availability.metadata = { "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability" } + + @distributed_trace_async + async def list_keys(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.ListKeysResult: + """Get the keys to use with the Quantum APIs. A key is used to authenticate and authorize access + to the Quantum REST APIs. Only one key is needed at a time; two are given to provide seamless + key regeneration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.ListKeysResult + :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.ListKeysResult] = 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("ListKeysResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/listKeys" + } + + @overload + async def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: _models.APIKeys, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Required. + :type key_specification: ~azure.mgmt.quantum.models.APIKeys + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Required. + :type key_specification: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: Union[_models.APIKeys, IO], + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Is either a APIKeys + type or a IO type. Required. + :type key_specification: ~azure.mgmt.quantum.models.APIKeys or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(key_specification, (IOBase, bytes)): + _content = key_specification + else: + _json = self._serialize.body(key_specification, "APIKeys") + + request = build_regenerate_keys_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.regenerate_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 [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, {}) + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/regenerateKey" + } diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py index 8e9bc33d9f21..56ea86d16a56 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/aio/operations/_workspaces_operations.py @@ -67,7 +67,8 @@ def __init__(self, *args, **kwargs) -> None: async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.QuantumWorkspace: """Returns the Workspace resource associated with the given name. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -209,7 +210,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -244,7 +246,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -277,7 +280,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -363,7 +367,8 @@ async def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -390,7 +395,8 @@ async def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -415,7 +421,8 @@ async def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -543,7 +550,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements async def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a Workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -584,7 +592,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -689,7 +699,8 @@ def list_by_resource_group( ) -> AsyncIterable["_models.QuantumWorkspace"]: """Gets the list of Workspaces within a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 QuantumWorkspace or the result of cls(response) diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py index 5ec2e60801c1..bee4102c1f4b 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/__init__.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import APIKeys +from ._models_py3 import ApiKey from ._models_py3 import CheckNameAvailabilityParameters from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse +from ._models_py3 import ListKeysResult from ._models_py3 import OfferingsListResult from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -34,6 +37,7 @@ from ._models_py3 import WorkspaceListResult from ._azure_quantum_management_client_enums import CreatedByType +from ._azure_quantum_management_client_enums import KeyType from ._azure_quantum_management_client_enums import ProvisioningStatus from ._azure_quantum_management_client_enums import ResourceIdentityType from ._azure_quantum_management_client_enums import Status @@ -43,11 +47,14 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "APIKeys", + "ApiKey", "CheckNameAvailabilityParameters", "CheckNameAvailabilityResult", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "ListKeysResult", "OfferingsListResult", "Operation", "OperationDisplay", @@ -70,6 +77,7 @@ "TrackedResource", "WorkspaceListResult", "CreatedByType", + "KeyType", "ProvisioningStatus", "ResourceIdentityType", "Status", diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py index 7760c586f8de..a53a6d30dd52 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_azure_quantum_management_client_enums.py @@ -19,6 +19,13 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyType.""" + + PRIMARY = "Primary" + SECONDARY = "Secondary" + + class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning status field.""" diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py index 501c2a65addf..25e06f621e17 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/models/_models_py3.py @@ -17,6 +17,56 @@ from .. import models as _models +class ApiKey(_serialization.Model): + """Azure quantum workspace Api key details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_at: The creation time of the api key. + :vartype created_at: ~datetime.datetime + :ivar key: The Api key. + :vartype key: str + """ + + _validation = { + "key": {"readonly": True}, + } + + _attribute_map = { + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, created_at: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword created_at: The creation time of the api key. + :paramtype created_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_at = created_at + self.key = None + + +class APIKeys(_serialization.Model): + """List of api keys to be generated. + + :ivar keys: A list of api key names. + :vartype keys: list[str or ~azure.mgmt.quantum.models.KeyType] + """ + + _attribute_map = { + "keys": {"key": "keys", "type": "[str]"}, + } + + def __init__(self, *, keys: Optional[List[Union[str, "_models.KeyType"]]] = None, **kwargs: Any) -> None: + """ + :keyword keys: A list of api key names. + :paramtype keys: list[str or ~azure.mgmt.quantum.models.KeyType] + """ + super().__init__(**kwargs) + self.keys = keys + + class CheckNameAvailabilityParameters(_serialization.Model): """Details of check name availability request body. @@ -173,6 +223,60 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ListKeysResult(_serialization.Model): + """Result of list Api keys and connection strings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar api_key_enabled: Indicator of enablement of the Quantum workspace Api keys. + :vartype api_key_enabled: bool + :ivar primary_key: The quantum workspace primary api key. + :vartype primary_key: ~azure.mgmt.quantum.models.ApiKey + :ivar secondary_key: The quantum workspace secondary api key. + :vartype secondary_key: ~azure.mgmt.quantum.models.ApiKey + :ivar primary_connection_string: The connection string of the primary api key. + :vartype primary_connection_string: str + :ivar secondary_connection_string: The connection string of the secondary api key. + :vartype secondary_connection_string: str + """ + + _validation = { + "primary_connection_string": {"readonly": True}, + "secondary_connection_string": {"readonly": True}, + } + + _attribute_map = { + "api_key_enabled": {"key": "apiKeyEnabled", "type": "bool"}, + "primary_key": {"key": "primaryKey", "type": "ApiKey"}, + "secondary_key": {"key": "secondaryKey", "type": "ApiKey"}, + "primary_connection_string": {"key": "primaryConnectionString", "type": "str"}, + "secondary_connection_string": {"key": "secondaryConnectionString", "type": "str"}, + } + + def __init__( + self, + *, + api_key_enabled: Optional[bool] = None, + primary_key: Optional["_models.ApiKey"] = None, + secondary_key: Optional["_models.ApiKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword api_key_enabled: Indicator of enablement of the Quantum workspace Api keys. + :paramtype api_key_enabled: bool + :keyword primary_key: The quantum workspace primary api key. + :paramtype primary_key: ~azure.mgmt.quantum.models.ApiKey + :keyword secondary_key: The quantum workspace secondary api key. + :paramtype secondary_key: ~azure.mgmt.quantum.models.ApiKey + """ + super().__init__(**kwargs) + self.api_key_enabled = api_key_enabled + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_connection_string = None + self.secondary_connection_string = None + + class OfferingsListResult(_serialization.Model): """The response of a list Providers operation. @@ -461,7 +565,7 @@ class ProviderDescription(_serialization.Model): :vartype id: str :ivar name: Provider's display name. :vartype name: str - :ivar properties: A list of provider-specific properties. + :ivar properties: Provider properties. :vartype properties: ~azure.mgmt.quantum.models.ProviderProperties """ @@ -485,7 +589,7 @@ def __init__( """ :keyword id: Unique provider's id. :paramtype id: str - :keyword properties: A list of provider-specific properties. + :keyword properties: Provider properties. :paramtype properties: ~azure.mgmt.quantum.models.ProviderProperties """ super().__init__(**kwargs) @@ -640,26 +744,31 @@ 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.quantum.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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"}, } def __init__(self, **kwargs: Any) -> None: @@ -668,6 +777,7 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None + self.system_data = None class TrackedResource(Resource): @@ -678,14 +788,17 @@ class TrackedResource(Resource): 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.quantum.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -696,6 +809,7 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -703,6 +817,7 @@ class TrackedResource(Resource): "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"}, } @@ -726,22 +841,23 @@ class QuantumWorkspace(TrackedResource): # pylint: disable=too-many-instance-at 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}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.quantum.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 Identity information. :vartype identity: ~azure.mgmt.quantum.models.QuantumWorkspaceIdentity - :ivar system_data: System metadata. - :vartype system_data: ~azure.mgmt.quantum.models.SystemData :ivar providers: List of Providers selected for this Workspace. :vartype providers: list[~azure.mgmt.quantum.models.Provider] :ivar usable: Whether the current workspace is ready to accept Jobs. Known values are: "Yes", @@ -755,14 +871,16 @@ class QuantumWorkspace(TrackedResource): # pylint: disable=too-many-instance-at :vartype storage_account: str :ivar endpoint_uri: The URI of the workspace endpoint. :vartype endpoint_uri: str + :ivar api_key_enabled: Indicator of enablement of the Quantum workspace Api keys. + :vartype api_key_enabled: bool """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "usable": {"readonly": True}, "provisioning_state": {"readonly": True}, "endpoint_uri": {"readonly": True}, @@ -772,15 +890,16 @@ class QuantumWorkspace(TrackedResource): # pylint: disable=too-many-instance-at "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": "QuantumWorkspaceIdentity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "providers": {"key": "properties.providers", "type": "[Provider]"}, "usable": {"key": "properties.usable", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "storage_account": {"key": "properties.storageAccount", "type": "str"}, "endpoint_uri": {"key": "properties.endpointUri", "type": "str"}, + "api_key_enabled": {"key": "properties.apiKeyEnabled", "type": "bool"}, } def __init__( @@ -791,6 +910,7 @@ def __init__( identity: Optional["_models.QuantumWorkspaceIdentity"] = None, providers: Optional[List["_models.Provider"]] = None, storage_account: Optional[str] = None, + api_key_enabled: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -805,15 +925,17 @@ def __init__( :keyword storage_account: ARM Resource Id of the storage account associated with this workspace. :paramtype storage_account: str + :keyword api_key_enabled: Indicator of enablement of the Quantum workspace Api keys. + :paramtype api_key_enabled: bool """ super().__init__(tags=tags, location=location, **kwargs) self.identity = identity - self.system_data = None self.providers = providers self.usable = None self.provisioning_state = None self.storage_account = storage_account self.endpoint_uri = None + self.api_key_enabled = api_key_enabled class QuantumWorkspaceIdentity(_serialization.Model): diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py index 2ee077cbc011..f6315d6b13af 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_offerings_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(location_name: 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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) "locationName": _SERIALIZER.url("location_name", location_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") diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py index eb2360eac26b..8f23a43436b4 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_operations.py @@ -40,7 +40,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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspace_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspace_operations.py index 2eb7373eece5..7aa09a7c8fbf 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspace_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspace_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +39,7 @@ def build_check_name_availability_request(location_name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,7 +53,80 @@ def build_check_name_availability_request(location_name: str, subscription_id: s "locationName": _SERIALIZER.url("location_name", location_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) + + +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-11-13-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/listKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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])*$" + ), + } + + _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, 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-11-13-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.Quantum/workspaces/{workspaceName}/regenerateKey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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])*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,3 +289,210 @@ def check_name_availability( check_name_availability.metadata = { "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability" } + + @distributed_trace + def list_keys(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.ListKeysResult: + """Get the keys to use with the Quantum APIs. A key is used to authenticate and authorize access + to the Quantum REST APIs. Only one key is needed at a time; two are given to provide seamless + key regeneration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.quantum.models.ListKeysResult + :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.ListKeysResult] = 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 = 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("ListKeysResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/listKeys" + } + + @overload + def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: _models.APIKeys, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Required. + :type key_specification: ~azure.mgmt.quantum.models.APIKeys + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Required. + :type key_specification: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + key_specification: Union[_models.APIKeys, IO], + **kwargs: Any + ) -> None: + """Regenerate either the primary or secondary key for use with the Quantum APIs. The old key will + stop working immediately. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the quantum workspace resource. Required. + :type workspace_name: str + :param key_specification: Which key to regenerate: primary or secondary. Is either a APIKeys + type or a IO type. Required. + :type key_specification: ~azure.mgmt.quantum.models.APIKeys or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(key_specification, (IOBase, bytes)): + _content = key_specification + else: + _json = self._serialize.body(key_specification, "APIKeys") + + request = build_regenerate_keys_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.regenerate_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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [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, {}) + + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/regenerateKey" + } diff --git a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py index 54a9d554bfce..4ebe842b3bb1 100644 --- a/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py +++ b/sdk/quantum/azure-mgmt-quantum/azure/mgmt/quantum/operations/_workspaces_operations.py @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,12 +54,16 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), } - _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") @@ -76,7 +80,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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,12 +90,16 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), } - _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 +118,7 @@ def build_update_tags_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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,12 +128,16 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), } - _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") @@ -144,7 +156,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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,12 +165,16 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), } - _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 +189,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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +198,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -197,7 +213,7 @@ def build_list_by_resource_group_request(resource_group_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", "2022-01-10-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,11 +222,13 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -244,7 +262,8 @@ def __init__(self, *args, **kwargs): def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.QuantumWorkspace: """Returns the Workspace resource associated with the given name. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -386,7 +405,8 @@ def begin_create_or_update( ) -> LROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -421,7 +441,8 @@ def begin_create_or_update( ) -> LROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -454,7 +475,8 @@ def begin_create_or_update( ) -> LROPoller[_models.QuantumWorkspace]: """Creates or updates a workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -539,7 +561,8 @@ def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -566,7 +589,8 @@ def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -591,7 +615,8 @@ def update_tags( ) -> _models.QuantumWorkspace: """Updates an existing workspace's tags. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -719,7 +744,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a Workspace resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param workspace_name: The name of the quantum workspace resource. Required. :type workspace_name: str @@ -760,7 +786,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -863,7 +891,8 @@ def get_next(next_link=None): def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.QuantumWorkspace"]: """Gets the list of Workspaces within a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 QuantumWorkspace or the result of cls(response) diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/list_keys.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/list_keys.py new file mode 100644 index 000000000000..272e52cd05ee --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/list_keys.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.quantum import AzureQuantumManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-quantum +# 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 = AzureQuantumManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.workspace.list_keys( + resource_group_name="quantumResourcegroup", + workspace_name="quantumworkspace1", + ) + print(response) + + +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/listKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/offerings_list.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/offerings_list.py index 61e96fe06d3f..900d2785f5b3 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/offerings_list.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/offerings_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/offeringsList.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/offeringsList.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/operations.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/operations.py index cd7dd5e555a7..f65c63011174 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/operations.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/operations.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/operations.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_check_name_availability.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_check_name_availability.py index f1cf5a18ec11..436094aae9c2 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_check_name_availability.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesCheckNameAvailability.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_delete.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_delete.py index 5aa472941df0..c6a35d0f500f 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_delete.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesDelete.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesDelete.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_get.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_get.py index faf9b52227df..ac2d600daffb 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_get.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesGet.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesGet.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_resource_group.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_resource_group.py index 314ba4a7928f..96bc2088f0b1 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_resource_group.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesListResourceGroup.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesListResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_subscription.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_subscription.py index dceda5843f0d..c17d5d4e8789 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_subscription.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_list_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesListSubscription.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesListSubscription.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_patch.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_patch.py index 3a7f130f241e..c8f53462c7cd 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_patch.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesPatch.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesPatch.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_put.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_put.py index 4cb6e392a59f..7de3837a3fd9 100644 --- a/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_put.py +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/quantum_workspaces_put.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2022-01-10-preview/examples/quantumWorkspacesPut.json +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/quantumWorkspacesPut.json if __name__ == "__main__": main() diff --git a/sdk/quantum/azure-mgmt-quantum/generated_samples/regenerate_key.py b/sdk/quantum/azure-mgmt-quantum/generated_samples/regenerate_key.py new file mode 100644 index 000000000000..7a64bb4136a9 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/generated_samples/regenerate_key.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.quantum import AzureQuantumManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-quantum +# 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 = AzureQuantumManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.workspace.regenerate_keys( + resource_group_name="quantumResourcegroup", + workspace_name="quantumworkspace1", + key_specification={"keys": ["Primary", "Secondary"]}, + ) + + +# x-ms-original-file: specification/quantum/resource-manager/Microsoft.Quantum/preview/2023-11-13-preview/examples/regenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json index 2847cbf116b4..ecb74d46ef49 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a29126ca8200a6c981a4e908e41fe55730df4cad", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/recoveryservicessiterecovery/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/recoveryservicessiterecovery/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/recoveryservicessiterecovery/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py index 3f00167bce51..f42709d32fc8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_configuration.py @@ -34,7 +34,7 @@ class SiteRecoveryManagementClientConfiguration(Configuration): # pylint: disab :type resource_group_name: str :param resource_name: The name of the recovery services vault. Required. :type resource_name: str - :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -48,7 +48,7 @@ def __init__( **kwargs: Any ) -> None: super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-06-01") + api_version: str = kwargs.pop("api_version", "2023-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py index 116aaca122cf..0b8b27fb7f7b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_site_recovery_management_client.py @@ -152,7 +152,7 @@ class SiteRecoveryManagementClient: # pylint: disable=client-accepts-api-versio :type resource_name: 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-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-08-01". 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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py index a812e40adbbd..3ce24ec64b8d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py @@ -34,7 +34,7 @@ class SiteRecoveryManagementClientConfiguration(Configuration): # pylint: disab :type resource_group_name: str :param resource_name: The name of the recovery services vault. Required. :type resource_name: str - :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -48,7 +48,7 @@ def __init__( **kwargs: Any ) -> None: super(SiteRecoveryManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-06-01") + api_version: str = kwargs.pop("api_version", "2023-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py index 97913024422b..f9b44a3adb18 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_site_recovery_management_client.py @@ -152,7 +152,7 @@ class SiteRecoveryManagementClient: # pylint: disable=client-accepts-api-versio :type resource_name: 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-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-08-01". 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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py index 5ff8997ce2d3..15ac0ea860de 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_fabrics_operations.py @@ -40,6 +40,7 @@ build_migrate_to_aad_request, build_purge_request, build_reassociate_gateway_request, + build_remove_infra_request, build_renew_certificate_request, ) @@ -1305,3 +1306,120 @@ def get_long_running_output(pipeline_response): begin_renew_certificate.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" } + + async def _remove_infra_initial( # pylint: disable=inconsistent-return-statements + self, resource_name: str, fabric_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_remove_infra_request( + resource_name=resource_name, + fabric_name=fabric_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._remove_infra_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _remove_infra_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra" + } + + @distributed_trace_async + async def begin_remove_infra(self, resource_name: str, fabric_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Removes the appliance's infrastructure under the fabric. + + Removes the appliance's infrastructure under the fabric. + + :param resource_name: Resource name. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_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._remove_infra_initial( # type: ignore + resource_name=resource_name, + fabric_name=fabric_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_remove_infra.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py index ad4f77a6aa11..ccd11447f4a5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/__init__.py @@ -113,6 +113,9 @@ from ._models_py3 import EnableProtectionInputProperties from ._models_py3 import EnableProtectionProviderSpecificInput from ._models_py3 import EncryptionDetails +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import Event from ._models_py3 import EventCollection from ._models_py3 import EventProperties @@ -690,6 +693,9 @@ "EnableProtectionInputProperties", "EnableProtectionProviderSpecificInput", "EncryptionDetails", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "Event", "EventCollection", "EventProperties", diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py index d4eee8ec4397..2d2000563022 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/models/_models_py3.py @@ -941,6 +941,10 @@ class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): # pylint :vartype recovery_virtual_machine_scale_set_id: str :ivar recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. :vartype recovery_capacity_reservation_group_id: str + :ivar auto_protection_of_data_disk: A value indicating whether the auto protection is enabled. + Known values are: "Disabled" and "Enabled". + :vartype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk """ _validation = { @@ -968,6 +972,7 @@ class A2AEnableProtectionInput(EnableProtectionProviderSpecificInput): # pylint "recovery_subnet_name": {"key": "recoverySubnetName", "type": "str"}, "recovery_virtual_machine_scale_set_id": {"key": "recoveryVirtualMachineScaleSetId", "type": "str"}, "recovery_capacity_reservation_group_id": {"key": "recoveryCapacityReservationGroupId", "type": "str"}, + "auto_protection_of_data_disk": {"key": "autoProtectionOfDataDisk", "type": "str"}, } def __init__( @@ -991,6 +996,7 @@ def __init__( recovery_subnet_name: Optional[str] = None, recovery_virtual_machine_scale_set_id: Optional[str] = None, recovery_capacity_reservation_group_id: Optional[str] = None, + auto_protection_of_data_disk: Optional[Union[str, "_models.AutoProtectionOfDataDisk"]] = None, **kwargs: Any ) -> None: """ @@ -1034,6 +1040,10 @@ def __init__( :paramtype recovery_virtual_machine_scale_set_id: str :keyword recovery_capacity_reservation_group_id: The recovery capacity reservation group Id. :paramtype recovery_capacity_reservation_group_id: str + :keyword auto_protection_of_data_disk: A value indicating whether the auto protection is + enabled. Known values are: "Disabled" and "Enabled". + :paramtype auto_protection_of_data_disk: str or + ~azure.mgmt.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk """ super().__init__(**kwargs) self.instance_type: str = "A2A" @@ -1055,6 +1065,7 @@ def __init__( self.recovery_subnet_name = recovery_subnet_name self.recovery_virtual_machine_scale_set_id = recovery_virtual_machine_scale_set_id self.recovery_capacity_reservation_group_id = recovery_capacity_reservation_group_id + self.auto_protection_of_data_disk = auto_protection_of_data_disk class EventProviderSpecificDetails(_serialization.Model): @@ -6850,6 +6861,99 @@ def __init__( self.kek_cert_expiry_date = kek_cert_expiry_date +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.recoveryservicessiterecovery.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.recoveryservicessiterecovery.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.recoveryservicessiterecovery.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.recoveryservicessiterecovery.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + class Event(Resource): """Implements the Event class. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py index bd0888350b14..40e4fa83be9d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_migration_recovery_points_operations.py @@ -48,7 +48,7 @@ def build_list_by_replication_migration_items_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py index d77cddd5434e..2cd14b8614c1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_operations.py @@ -40,7 +40,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py index 002aee38f168..d6b9fa6ef69a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_recovery_points_operations.py @@ -48,7 +48,7 @@ def build_list_by_replication_protected_items_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py index 11e2dfd35d7e..2d4915d07ef6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_alert_settings_operations.py @@ -43,7 +43,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +106,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py index 1bf08f186bfc..d32c37a3a16a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_appliances_operations.py @@ -42,7 +42,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py index 2a73f7fed7dc..45e23489d83f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_eligibility_results_operations.py @@ -40,7 +40,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py index 02a93c8c7192..d3e9a50e2f0c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_events_operations.py @@ -42,7 +42,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py index 196672a32125..2dc3d779acf8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_fabrics_operations.py @@ -45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +150,7 @@ def build_purge_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -177,7 +177,7 @@ def build_check_consistency_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +208,7 @@ def build_migrate_to_aad_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -235,7 +235,7 @@ def build_reassociate_gateway_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -269,7 +269,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -296,7 +296,7 @@ def build_renew_certificate_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -325,6 +325,42 @@ def build_renew_certificate_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_remove_infra_request( + resource_name: str, fabric_name: str, resource_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", "2023-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url( + "resource_name", resource_name, "str", pattern=r"^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$" + ), + "fabricName": _SERIALIZER.url( + "fabric_name", fabric_name, "str", pattern=r"^[A-Za-z0-9][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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ReplicationFabricsOperations: """ .. warning:: @@ -1560,3 +1596,120 @@ def get_long_running_output(pipeline_response): begin_renew_certificate.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" } + + def _remove_infra_initial( # pylint: disable=inconsistent-return-statements + self, resource_name: str, fabric_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_remove_infra_request( + resource_name=resource_name, + fabric_name=fabric_name, + resource_group_name=self._config.resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._remove_infra_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _remove_infra_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra" + } + + @distributed_trace + def begin_remove_infra(self, resource_name: str, fabric_name: str, **kwargs: Any) -> LROPoller[None]: + """Removes the appliance's infrastructure under the fabric. + + Removes the appliance's infrastructure under the fabric. + + :param resource_name: Resource name. Required. + :type resource_name: str + :param fabric_name: Fabric name. Required. + :type fabric_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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._remove_infra_initial( # type: ignore + resource_name=resource_name, + fabric_name=fabric_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_remove_infra.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/removeInfra" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py index 82de7318ff92..126d92397d7f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_jobs_operations.py @@ -45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +142,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +174,7 @@ def build_resume_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +209,7 @@ def build_export_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py index 1a6979830f49..9c6e2c957528 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_logical_networks_operations.py @@ -42,7 +42,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py index 62ed7fd9ab3c..d12af685aafd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_migration_items_operations.py @@ -54,7 +54,7 @@ def build_list_by_replication_protection_containers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,7 +183,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -220,7 +220,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -263,7 +263,7 @@ def build_migrate_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -306,7 +306,7 @@ def build_pause_replication_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -349,7 +349,7 @@ def build_resume_replication_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -392,7 +392,7 @@ def build_resync_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -435,7 +435,7 @@ def build_test_migrate_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -478,7 +478,7 @@ def build_test_migrate_cleanup_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -522,7 +522,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py index 4f5330a8d38c..00037350745c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_network_mappings_operations.py @@ -50,7 +50,7 @@ def build_list_by_replication_networks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -171,7 +171,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -206,7 +206,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -243,7 +243,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py index efb4d8323e35..6552dc2a9ad4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_networks_operations.py @@ -42,7 +42,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py index 6265366e74a4..4cf95c3c3d7b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_policies_operations.py @@ -45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -169,7 +169,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py index 413910d02d82..651512eced2a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protectable_items_operations.py @@ -51,7 +51,7 @@ def build_list_by_replication_protection_containers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py index 55db28b3a93f..a4963e1ddcab 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protected_items_operations.py @@ -50,7 +50,7 @@ def build_list_by_replication_protection_containers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -175,7 +175,7 @@ def build_purge_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -212,7 +212,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -257,7 +257,7 @@ def build_add_disks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -302,7 +302,7 @@ def build_apply_recovery_point_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -347,7 +347,7 @@ def build_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -389,7 +389,7 @@ def build_failover_commit_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -431,7 +431,7 @@ def build_planned_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -476,7 +476,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( @@ -518,7 +518,7 @@ def build_remove_disks_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -563,7 +563,7 @@ def build_repair_replication_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,7 +605,7 @@ def build_reprotect_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -650,7 +650,7 @@ def build_resolve_health_errors_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -695,7 +695,7 @@ def build_switch_provider_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -740,7 +740,7 @@ def build_test_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -785,7 +785,7 @@ def build_test_failover_cleanup_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -830,7 +830,7 @@ def build_unplanned_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -875,7 +875,7 @@ def build_update_appliance_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -920,7 +920,7 @@ def build_update_mobility_service_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -965,7 +965,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py index 0b22125f635a..26051df53ac5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_container_mappings_operations.py @@ -50,7 +50,7 @@ def build_list_by_replication_protection_containers_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -171,7 +171,7 @@ def build_purge_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -206,7 +206,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -249,7 +249,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( @@ -283,7 +283,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py index 9e9eb9f0377f..a8af9459b9fb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_containers_operations.py @@ -45,7 +45,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,7 +161,7 @@ def build_discover_protectable_item_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +201,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -234,7 +234,7 @@ def build_switch_protection_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -270,7 +270,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py index 8a16671213b3..f78a2fa2418d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_protection_intents_operations.py @@ -49,7 +49,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py index a2f3a128c959..50d88cbeb409 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_plans_operations.py @@ -45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -169,7 +169,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -204,7 +204,7 @@ def build_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +236,7 @@ def build_failover_commit_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,7 +268,7 @@ def build_planned_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -303,7 +303,7 @@ def build_reprotect_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,7 +335,7 @@ def build_test_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -370,7 +370,7 @@ def build_test_failover_cleanup_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -405,7 +405,7 @@ def build_unplanned_failover_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py index fd4665051ee5..9899bf21caf6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_recovery_services_providers_operations.py @@ -45,7 +45,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,7 +160,7 @@ def build_purge_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -193,7 +193,7 @@ def build_refresh_provider_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +230,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -258,7 +258,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py index d851f2a3b3d4..1ee2a303ef3c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classification_mappings_operations.py @@ -50,7 +50,7 @@ def build_list_by_replication_storage_classifications_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +131,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -175,7 +175,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -206,7 +206,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py index 69ab8e68978e..ed001c3b67fc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_storage_classifications_operations.py @@ -42,7 +42,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +79,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +112,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py index e619633ff1ab..fc815bfb4d6b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_health_operations.py @@ -40,7 +40,7 @@ def build_get_request(resource_name: str, resource_group_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_refresh_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py index 5f8f568fd86c..d500572de548 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replication_vault_setting_operations.py @@ -45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py index a79d8dc30ac0..890baebb87eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_replicationv_centers_operations.py @@ -45,7 +45,7 @@ def build_list_by_replication_fabrics_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_create_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,7 +160,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) # Construct URL _url = kwargs.pop( "template_url", @@ -193,7 +193,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -229,7 +229,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py index abc2faf3b590..df7ca061826f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_supported_operating_systems_operations.py @@ -45,7 +45,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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py index 32206d337345..1fa485d27698 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/operations/_target_compute_sizes_operations.py @@ -48,7 +48,7 @@ def build_list_by_replication_protected_items_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py index 39b0f5b9388f..05d22adc4fde 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/MigrationRecoveryPoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py index 85510d9b753c..5755c9d90751 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/migration_recovery_points_list_by_replication_migration_items.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py index 02516ee57132..103de62e6f70 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/operations_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/Operations_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py index 46acf6496e5d..f6239bd95add 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/RecoveryPoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py index eb85e20e80dd..7bfa5e0abdb4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/recovery_points_list_by_replication_protected_items.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py index b02c82271f7c..ea9990ceb6c8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_create.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationAlertSettings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py index b0513d1674c9..5d7ebd3559c2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationAlertSettings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py index d41c1a15ee47..66980e368a97 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_alert_settings_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationAlertSettings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py index cba6595a2862..856eacda128b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_appliances_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAppliances_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationAppliances_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py index aa774514c49a..05b6a8db0de0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationEligibilityResults_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py index 778968838c01..fd1f04e64000 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_eligibility_results_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationEligibilityResults_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py index 6bb4224c636f..938e23504f01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationEvents_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py index 75624fa53754..9496a3bb6577 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_events_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationEvents_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py index 0c7fbb9fa584..63afc7b4c7f3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_check_consistency.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_CheckConsistency.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_CheckConsistency.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py index a8652eea4a2d..9c5ea9a08716 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py index f8fc155575ea..925ea4e7802d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py index 4990e57013ab..f5f73f698586 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py index 1a1f30931c49..8021c60ec74a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py index ef474aa40426..97d078499575 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_migrate_to_aad.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_MigrateToAad.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_MigrateToAad.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py index 121807d46427..52c95baf663a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_purge.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Purge.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py index fb5b2fc5a560..db9f0db0ab3f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_reassociate_gateway.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_ReassociateGateway.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_ReassociateGateway.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py index 31ee1d9ca90d..030dc611292b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_fabrics_renew_certificate.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_RenewCertificate.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationFabrics_RenewCertificate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_delete.py new file mode 100644 index 000000000000..7ecb56c7a722 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_infrastructure_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.recoveryservicessiterecovery import SiteRecoveryManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicessiterecovery +# USAGE + python replication_infrastructure_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 = SiteRecoveryManagementClient( + credential=DefaultAzureCredential(), + subscription_id="c183865e-6077-46f2-a3b1-deb0f4f4650a", + resource_group_name="resourceGroupPS1", + resource_name="vault1", + ) + + client.replication_fabrics.begin_remove_infra( + resource_name="vault1", + fabric_name="cloud1", + ).result() + + +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationInfrastructure_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py index 1501204a076e..d67749339d51 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_cancel.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Cancel.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_Cancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py index ba9cc9843a74..501f87c47c72 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_export.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Export.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_Export.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py index 11af1720eda8..7ecff129f278 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py index 5ed7495821b4..0e4e82c2286d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py index 2601daf9118f..47d938394517 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_restart.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Restart.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_Restart.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py index d6ac59eb1df1..6e33a66be140 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_jobs_resume.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Resume.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationJobs_Resume.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py index 642c6d06d5a8..26d86e6e6fe7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationLogicalNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py index 45e13568fc7f..bcd5c75b12c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_logical_networks_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py index 0ab36dab1583..78fb77567117 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_create.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py index 48aede6d37b6..2f715a5ba0f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py index e514dd01071a..d3af32c4ea37 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py index d7df0612a800..c24226b6d0c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py index 8f021fee0cf8..aca39b316e71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_list_by_replication_protection_containers.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py index eee66966dc68..a769156d86d7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_migrate.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Migrate.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Migrate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py index 2782657ca8a0..80243b14d7bf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_pause_replication.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_PauseReplication.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_PauseReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py index be1bb39ae91e..2d6617516f41 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resume_replication.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ResumeReplication.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_ResumeReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py index 445534ba4e2d..5555d03a0b9b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_resync.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Resync.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Resync.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py index 1772c02351ed..b42df437dd98 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrate.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_TestMigrate.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py index 6611683904a3..ee8ab3bc35f2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_test_migrate_cleanup.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py index 2c8b205df9ae..8258cfb845c5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_migration_items_update.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationMigrationItems_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py index 2c1d6228cb52..e5c8c9e7cdcd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py index 5b539e2bb760..2cb897b52ac7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py index 3a798240b183..5eac684a0968 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py index a476b17e4fc0..c0c677f1cbe1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py index 541d8aece2e4..61179c79ecb8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_list_by_replication_networks.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py index 7d5ba2193351..d12faba60a51 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_network_mappings_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworkMappings_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py index 8f6cc157a768..bc73a4e33be1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py index c54216871d2e..12ca9f09d042 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworks_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py index 2501031c8352..68407aa1dcae 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_networks_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationNetworks_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py index 42907fc61a81..52a8ba781069 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationPolicies_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py index 912fe234d46e..071ad9c7d9d3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py index b1276ce394c8..72b638b23d2f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py index 9f4dabb50962..2178f178fe96 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py index 637a12e9270e..cf097e8d708a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_policies_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationPolicies_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py index 887ebab610bf..34a44efa1b9d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectableItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py index bd3c56f7ff62..866663cdefb6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protectable_items_list_by_replication_protection_containers.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py index 3e901c4423ee..413d9feb80fc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_add_disks.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_AddDisks.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_AddDisks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py index 4a1cb0e1543d..770efd71b4c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_apply_recovery_point.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py index bcd9f7a6e345..e949960286b6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py index f3aeda41c84d..7dd4ab74e5c0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_delete.py @@ -41,6 +41,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py index 2b6cbf53a063..74e4eb30d6c9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_cancel.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCancel.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_FailoverCancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py index 17f2a33630eb..6d3a4c52b467 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_failover_commit.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCommit.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_FailoverCommit.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py index 4516efee8fe3..cf8e3003bfb9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py index 1c870fce90be..b2c66c2a0282 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py index 96f1f6500a6f..64f34aa80f2b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_list_by_replication_protection_containers.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py index f6249f26aea3..33615cf223b8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_planned_failover.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_PlannedFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_PlannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py index 8b6187c8fe84..63072b3447a1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_purge.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Purge.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py index ab51fc9a0386..fa141310ad7b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_remove_disks.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RemoveDisks.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_RemoveDisks.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py index 9b23b99b9413..8b4d78efc516 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_repair_replication.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RepairReplication.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_RepairReplication.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py index 5a9f98ec402c..58f1946145d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_reprotect.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Reprotect.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Reprotect.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py index b25be3f0d9e2..e134c91fa9d1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_resolve_health_errors.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py index f39db247a320..0df298ae7639 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_switch_provider.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_SwitchProvider.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_SwitchProvider.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py index 6f7f54262f77..31aba82e80e4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_TestFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py index 45d2f1734e24..ca02519b8569 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_test_failover_cleanup.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py index 78e4985ff09b..24df21699f0c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_unplanned_failover.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UnplannedFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_UnplannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py index d5285c4539be..4a018b530a4c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py index 32f0d2173780..9e8675544ab3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_appliance.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateAppliance.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_UpdateAppliance.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py index f8dad9d15384..eb28593fba3d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protected_items_update_mobility_service.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateMobilityService.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectedItems_UpdateMobilityService.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py index d9e39262621e..d0f8c494dacd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py index 8dcda5c4c34f..bb4a12bdf0af 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py index 16f4fe4b4337..b9ed1ea9dc52 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py index c651e372a10d..caddc6e958e9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py index 718a82ba0d52..7353201e8463 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_list_by_replication_protection_containers.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py index a8a0e3295b38..6ff25c40bd48 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_purge.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Purge.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py index 5ece3eb93343..29b4d7189035 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_container_mappings_update.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainerMappings_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py index 69ebbcfa88fc..47e8cd29faaf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_create.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py index 4337ce53dbe5..3411b4fa48d8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py index 5eed4d1d46de..d1b301511b39 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_discover_protectable_item.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py index 1b63e133e285..a897a0f94202 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py index 83c768c2737a..45df3f7b3915 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py index 9320a82ad5dd..008b40b6918e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py index 84d87b08e016..6f13f74bfcda 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_containers_switch_protection.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_SwitchProtection.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionContainers_SwitchProtection.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py index 7f76bd270ee1..611d7dcfc270 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionIntents_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py index 0f93531ddda6..9ed910dbb243 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionIntents_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py index f79998a75fc3..db147d817c60 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_protection_intents_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationProtectionIntents_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py index bae5871eee66..8be0cbe34799 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_create.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py index 44e04ce62666..c6b03ff30006 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py index 6f89cb490007..0b4c629a82a5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_cancel.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCancel.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_FailoverCancel.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py index db194bd55ae4..583cd639b7a0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_failover_commit.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCommit.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_FailoverCommit.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py index 295a9e0b85fd..1b418a6bf187 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py index 346f778e1a20..d21424f3945e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py index 877db8110bf2..d16eb90fc687 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_planned_failover.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_PlannedFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_PlannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py index 06c421014555..36d99f572363 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_reprotect.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Reprotect.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_Reprotect.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py index 4956b19fe27e..bb8c3186d781 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_TestFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py index 6e3509fb8f9b..1621ec3167bb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_test_failover_cleanup.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py index 18437fdb8c15..721ea7e78362 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_unplanned_failover.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py index 2ebf962023c1..dd977a90faee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_plans_update.py @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Update.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryPlans_Update.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py index 90870dbb1c56..b9b2e4b293c6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_create.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py index 129a63c22ca6..3a523efb3985 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py index 92070c531b39..44c32075367f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py index 5b1445a45b8b..63ed54d4dc71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py index c9898f39b559..667a78beffa6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py index 846c622f0e4c..580f6f2ab9e0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_purge.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Purge.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_Purge.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py index 6abfc9e89bbc..765f0968175e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_recovery_services_providers_refresh_provider.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py index 54981db43b73..2bc2f6a4e00b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_create.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassificationMappings_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py index 9f4af468bdfb..b710aeb23c39 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassificationMappings_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py index a3e3fa39de82..27a6397d991f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassificationMappings_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py index 6f96fb4067a0..82f2e490c4d9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassificationMappings_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py index d217fbe41c04..b1652eab7a09 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classification_mappings_list_by_replication_storage_classifications.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py index 620c1ac27bed..9cf0e0b4d9a0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassifications_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py index e3281505d5ef..eb7e8f2f42fd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassifications_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py index 2d03c004f17c..a124b21f3da2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_storage_classifications_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py index 4d5df4e14e1e..f7241c9c0226 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationVaultHealth_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py index 172677feb4c3..689741e95f5a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_health_refresh.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Refresh.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationVaultHealth_Refresh.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py index c64000a68048..880b602f8fcd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_create.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Create.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationVaultSetting_Create.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py index bbf1705092eb..27ca81a5a4b5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationVaultSetting_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py index b7d8dd8cf949..dd760d3659b5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replication_vault_setting_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationVaultSetting_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py index 7d0e4f1dd1a5..a9b08e5747d4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Delete.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationvCenters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py index bbfe983d6a65..005b1ecd77ee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationvCenters_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py index e06e902f57c4..87deb98ac206 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_List.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationvCenters_List.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py index e6401a6f49af..b1930ae18f6d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/replicationv_centers_list_by_replication_fabrics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_ListByReplicationFabrics.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/ReplicationvCenters_ListByReplicationFabrics.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py index 7b81c565acf8..a4c0e7c51742 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/supported_operating_systems_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/SupportedOperatingSystems_Get.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/SupportedOperatingSystems_Get.json if __name__ == "__main__": main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py index c4bc6774baca..a40c60bdb023 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/generated_samples/target_compute_sizes_list_by_replication_protected_items.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json +# x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-08-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json b/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json index 4e780a3f064a..0d678b5bd1fd 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json @@ -1,11 +1,11 @@ { - "commit": "9565a97e3efbeb3691c9100d5473b0a884c1b786", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.3", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/redisenterprise/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.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/redisenterprise/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/redisenterprise/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py index 179a49480bc7..a100e065140c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class RedisEnterpriseManagementClientConfiguration(Configuration): # pylint: di :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-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-01". 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(RedisEnterpriseManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-03-01-preview"] = kwargs.pop("api_version", "2023-03-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py index 4e533b75404c..bd7ab53cef7b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py @@ -22,7 +22,6 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisEnterpriseOperations, - SkusOperations, ) if TYPE_CHECKING: @@ -30,7 +29,7 @@ from azure.core.credentials import TokenCredential -class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword """REST API for managing Redis Enterprise resources in Azure. :ivar operations: Operations operations @@ -47,16 +46,14 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redisenterprise.operations.PrivateLinkResourcesOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.redisenterprise.operations.SkusOperations :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-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-01". 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. @@ -92,7 +89,6 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py index f17c068e833e..4bae2292227b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -662,8 +662,9 @@ 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)) @@ -741,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,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 str(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) @@ -891,6 +892,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 +906,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 +958,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: @@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_vendor.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_vendor.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py index b2fff948b5bb..48944bf3938a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b2" +VERSION = "2.0.0" diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py index 73abf893d685..f5266699aa6a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class RedisEnterpriseManagementClientConfiguration(Configuration): # pylint: di :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-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-01". 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(RedisEnterpriseManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-03-01-preview"] = kwargs.pop("api_version", "2023-03-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py index 7323a9ac5572..2a4f98c306fe 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py @@ -22,7 +22,6 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisEnterpriseOperations, - SkusOperations, ) if TYPE_CHECKING: @@ -30,7 +29,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword """REST API for managing Redis Enterprise resources in Azure. :ivar operations: Operations operations @@ -48,16 +47,14 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.redisenterprise.aio.operations.PrivateLinkResourcesOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.redisenterprise.aio.operations.SkusOperations :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-03-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-01". 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. @@ -93,7 +90,6 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py index 374c80fa8307..8aa6b8ab91d6 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py @@ -12,7 +12,6 @@ from ._databases_operations import DatabasesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._skus_operations import SkusOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -25,7 +24,6 @@ "DatabasesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", - "SkusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py index 1a6cedb5fd3c..d787c0efc11b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -45,10 +45,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,9 +87,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) error_map = { @@ -185,16 +179,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Database") @@ -360,9 +352,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -430,16 +420,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DatabaseUpdate") @@ -603,9 +591,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -683,9 +669,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( @@ -738,9 +722,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -803,9 +785,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -878,9 +858,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) request = build_list_keys_request( @@ -938,16 +916,14 @@ async def _regenerate_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AccessKeys]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RegenerateKeyParameters") @@ -1111,9 +1087,7 @@ async def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AccessKeys] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1142,7 +1116,8 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -1180,16 +1155,14 @@ async def _import_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ImportClusterParameters") @@ -1344,9 +1317,7 @@ async def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1412,16 +1383,14 @@ async def _export_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ExportClusterParameters") @@ -1576,9 +1545,7 @@ async def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1644,16 +1611,14 @@ async def _force_unlink_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForceUnlinkParameters") @@ -1808,9 +1773,7 @@ async def begin_force_unlink( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1876,16 +1839,14 @@ async def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "FlushParameters") @@ -2047,9 +2008,7 @@ async def begin_flush( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py index 16b6503f11e8..c5337b8ab805 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py index 753714aac8f1..e2655dd7a824 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,9 +74,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py index 4342c2e2b0cf..4cc00d1b7e0d 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +82,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -191,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -251,16 +243,14 @@ async def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "PrivateEndpointConnection") @@ -431,9 +421,7 @@ async def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,25 +467,9 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the RedisEnterprise cluster. Required. - :type cluster_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. 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, @@ -509,9 +481,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -520,7 +490,7 @@ async def delete( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -534,14 +504,93 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. Required. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_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, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - delete.metadata = { + begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" } diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py index e50e0384568e..3d1387dcd161 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_cluster_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,9 +72,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py index 71d84789e8ec..9b0b4a450dbb 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,16 +77,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Cluster") @@ -242,9 +236,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -306,16 +298,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ClusterUpdate") @@ -465,9 +455,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -529,9 +517,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -589,9 +575,7 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -659,9 +643,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -714,9 +696,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -800,9 +780,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py index ba137c682e97..94d708e9b822 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import AccessKeys -from ._models_py3 import Capability from ._models_py3 import Cluster from ._models_py3 import ClusterList from ._models_py3 import ClusterPropertiesEncryption @@ -26,7 +25,6 @@ from ._models_py3 import ForceUnlinkParameters from ._models_py3 import ImportClusterParameters from ._models_py3 import LinkedDatabase -from ._models_py3 import LocationInfo from ._models_py3 import ManagedServiceIdentity from ._models_py3 import Module from ._models_py3 import Operation @@ -42,12 +40,8 @@ from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import RegenerateKeyParameters -from ._models_py3 import RegionSkuDetail -from ._models_py3 import RegionSkuDetails from ._models_py3 import Resource from ._models_py3 import Sku -from ._models_py3 import SkuDetail -from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import UserAssignedIdentity @@ -56,7 +50,6 @@ from ._redis_enterprise_management_client_enums import AofFrequency from ._redis_enterprise_management_client_enums import ClusteringPolicy from ._redis_enterprise_management_client_enums import CmkIdentityType -from ._redis_enterprise_management_client_enums import CreatedByType from ._redis_enterprise_management_client_enums import EvictionPolicy from ._redis_enterprise_management_client_enums import LinkState from ._redis_enterprise_management_client_enums import ManagedServiceIdentityType @@ -75,7 +68,6 @@ __all__ = [ "AccessKeys", - "Capability", "Cluster", "ClusterList", "ClusterPropertiesEncryption", @@ -94,7 +86,6 @@ "ForceUnlinkParameters", "ImportClusterParameters", "LinkedDatabase", - "LocationInfo", "ManagedServiceIdentity", "Module", "Operation", @@ -110,12 +101,8 @@ "PrivateLinkServiceConnectionState", "ProxyResource", "RegenerateKeyParameters", - "RegionSkuDetail", - "RegionSkuDetails", "Resource", "Sku", - "SkuDetail", - "SystemData", "TrackedResource", "UserAssignedIdentity", "AccessKeyType", @@ -123,7 +110,6 @@ "AofFrequency", "ClusteringPolicy", "CmkIdentityType", - "CreatedByType", "EvictionPolicy", "LinkState", "ManagedServiceIdentityType", diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py index 766ef220daa2..356053d679d6 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -45,32 +44,6 @@ def __init__(self, **kwargs: Any) -> None: self.secondary_key = None -class Capability(_serialization.Model): - """Information about the features the location supports. - - :ivar name: Feature name. - :vartype name: str - :ivar value: Indicates whether feature is supported or not. - :vartype value: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bool"}, - } - - def __init__(self, *, name: Optional[str] = None, value: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword name: Feature name. - :paramtype name: str - :keyword value: Indicates whether feature is supported or not. - :paramtype value: bool - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -84,23 +57,18 @@ class Resource(_serialization.Model): :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.redisenterprise.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"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"}, } def __init__(self, **kwargs: Any) -> None: @@ -109,7 +77,6 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None - self.system_data = None class TrackedResource(Resource): @@ -128,9 +95,6 @@ class TrackedResource(Resource): :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.redisenterprise.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -141,7 +105,6 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "location": {"required": True}, } @@ -149,7 +112,6 @@ class TrackedResource(Resource): "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"}, } @@ -181,9 +143,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :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.redisenterprise.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -206,7 +165,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState :ivar resource_state: Current resource status of the cluster. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", - "EnableFailed", "Disabling", "DisableFailed", and "Disabled". + "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState :ivar redis_version: Version of redis the cluster supports, e.g. '6'. :vartype redis_version: str @@ -220,7 +179,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "location": {"required": True}, "sku": {"required": True}, "host_name": {"readonly": True}, @@ -234,7 +192,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "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"}, "sku": {"key": "sku", "type": "Sku"}, @@ -466,7 +423,7 @@ class ClusterUpdate(_serialization.Model): :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState :ivar resource_state: Current resource status of the cluster. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", - "EnableFailed", "Disabling", "DisableFailed", and "Disabled". + "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState :ivar redis_version: Version of redis the cluster supports, e.g. '6'. :vartype redis_version: str @@ -550,23 +507,18 @@ class ProxyResource(Resource): :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.redisenterprise.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"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"}, } def __init__(self, **kwargs: Any) -> None: @@ -587,9 +539,6 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes :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.redisenterprise.models.SystemData :ivar client_protocol: Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted. Known values are: "Encrypted" and "Plaintext". @@ -602,7 +551,7 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState :ivar resource_state: Current resource status of the database. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", - "EnableFailed", "Disabling", "DisableFailed", and "Disabled". + "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState :ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. Known values are: "EnterpriseCluster" and "OSSCluster". @@ -625,7 +574,6 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "resource_state": {"readonly": True}, } @@ -634,7 +582,6 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "client_protocol": {"key": "properties.clientProtocol", "type": "str"}, "port": {"key": "properties.port", "type": "int"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -773,7 +720,7 @@ class DatabaseUpdate(_serialization.Model): :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState :ivar resource_state: Current resource status of the database. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", - "EnableFailed", "Disabling", "DisableFailed", and "Disabled". + "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState :ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. Known values are: "EnterpriseCluster" and "OSSCluster". @@ -978,8 +925,8 @@ def __init__(self, *, sas_uri: str, **kwargs: Any) -> None: class FlushParameters(_serialization.Model): """Parameters for a Redis Enterprise active geo-replication flush operation. - :ivar ids: The resource identifiers of all the other database resources in the georeplication - group to be flushed. + :ivar ids: The identifiers of all the other database resources in the georeplication group to + be flushed. :vartype ids: list[str] """ @@ -989,8 +936,8 @@ class FlushParameters(_serialization.Model): def __init__(self, *, ids: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword ids: The resource identifiers of all the other database resources in the - georeplication group to be flushed. + :keyword ids: The identifiers of all the other database resources in the georeplication group + to be flushed. :paramtype ids: list[str] """ super().__init__(**kwargs) @@ -1080,38 +1027,6 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin self.state = None -class LocationInfo(_serialization.Model): - """Information about location (for example: features that it supports). - - :ivar location: Location name. - :vartype location: str - :ivar capabilities: List of capabilities. - :vartype capabilities: list[~azure.mgmt.redisenterprise.models.Capability] - """ - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "capabilities": {"key": "capabilities", "type": "[Capability]"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - capabilities: Optional[List["_models.Capability"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Location name. - :paramtype location: str - :keyword capabilities: List of capabilities. - :paramtype capabilities: list[~azure.mgmt.redisenterprise.models.Capability] - """ - super().__init__(**kwargs) - self.location = location - self.capabilities = capabilities - - class ManagedServiceIdentity(_serialization.Model): """Managed service identity (system assigned and/or user assigned identities). @@ -1484,9 +1399,6 @@ class PrivateEndpointConnection(Resource): :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.redisenterprise.models.SystemData :ivar private_endpoint: The resource of private end point. :vartype private_endpoint: ~azure.mgmt.redisenterprise.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the @@ -1503,7 +1415,6 @@ class PrivateEndpointConnection(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -1511,7 +1422,6 @@ class PrivateEndpointConnection(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, "private_link_service_connection_state": { "key": "properties.privateLinkServiceConnectionState", @@ -1574,9 +1484,6 @@ class PrivateLinkResource(Resource): :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.redisenterprise.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. @@ -1589,7 +1496,6 @@ class PrivateLinkResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "group_id": {"readonly": True}, "required_members": {"readonly": True}, } @@ -1598,7 +1504,6 @@ class PrivateLinkResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "group_id": {"key": "properties.groupId", "type": "str"}, "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, @@ -1709,75 +1614,15 @@ def __init__(self, *, key_type: Union[str, "_models.AccessKeyType"], **kwargs: A self.key_type = key_type -class RegionSkuDetail(_serialization.Model): - """Details about the location requested and the available skus in the location. - - :ivar resource_type: Resource type which has the SKU, such as Microsoft.Cache/redisEnterprise. - :vartype resource_type: str - :ivar location_info: Details about location and its capabilities. - :vartype location_info: ~azure.mgmt.redisenterprise.models.LocationInfo - :ivar sku_details: Details about available skus. - :vartype sku_details: ~azure.mgmt.redisenterprise.models.SkuDetail - """ - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "location_info": {"key": "locationInfo", "type": "LocationInfo"}, - "sku_details": {"key": "skuDetails", "type": "SkuDetail"}, - } - - def __init__( - self, - *, - resource_type: Optional[str] = None, - location_info: Optional["_models.LocationInfo"] = None, - sku_details: Optional["_models.SkuDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_type: Resource type which has the SKU, such as - Microsoft.Cache/redisEnterprise. - :paramtype resource_type: str - :keyword location_info: Details about location and its capabilities. - :paramtype location_info: ~azure.mgmt.redisenterprise.models.LocationInfo - :keyword sku_details: Details about available skus. - :paramtype sku_details: ~azure.mgmt.redisenterprise.models.SkuDetail - """ - super().__init__(**kwargs) - self.resource_type = resource_type - self.location_info = location_info - self.sku_details = sku_details - - -class RegionSkuDetails(_serialization.Model): - """List of details about all the available SKUs. - - :ivar value: List of Sku Detail. - :vartype value: list[~azure.mgmt.redisenterprise.models.RegionSkuDetail] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RegionSkuDetail]"}, - } - - def __init__(self, *, value: Optional[List["_models.RegionSkuDetail"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of Sku Detail. - :paramtype value: list[~azure.mgmt.redisenterprise.models.RegionSkuDetail] - """ - super().__init__(**kwargs) - self.value = value - - class Sku(_serialization.Model): """SKU parameters supplied to the create RedisEnterprise operation. All required parameters must be populated in order to send to Azure. :ivar name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, - EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E10", "Enterprise_E20", - "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and - "EnterpriseFlash_F1500". + EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E5", "Enterprise_E10", + "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", + "EnterpriseFlash_F700", and "EnterpriseFlash_F1500". :vartype name: str or ~azure.mgmt.redisenterprise.models.SkuName :ivar capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. @@ -1796,9 +1641,9 @@ class Sku(_serialization.Model): def __init__(self, *, name: Union[str, "_models.SkuName"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, - EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E10", "Enterprise_E20", - "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and - "EnterpriseFlash_F1500". + EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E5", "Enterprise_E10", + "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", + "EnterpriseFlash_F700", and "EnterpriseFlash_F1500". :paramtype name: str or ~azure.mgmt.redisenterprise.models.SkuName :keyword capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. @@ -1809,96 +1654,6 @@ def __init__(self, *, name: Union[str, "_models.SkuName"], capacity: Optional[in self.capacity = capacity -class SkuDetail(_serialization.Model): - """Information about Sku. - - :ivar name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, - EnterpriseFlash_F300 etc.). Known values are: "Enterprise_E10", "Enterprise_E20", - "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and - "EnterpriseFlash_F1500". - :vartype name: str or ~azure.mgmt.redisenterprise.models.SkuName - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: - """ - :keyword name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, - EnterpriseFlash_F300 etc.). Known values are: "Enterprise_E10", "Enterprise_E20", - "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and - "EnterpriseFlash_F1500". - :paramtype name: str or ~azure.mgmt.redisenterprise.models.SkuName - """ - super().__init__(**kwargs) - self.name = name - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - class UserAssignedIdentity(_serialization.Model): """User assigned identity properties. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py index b95a4a6ae829..d9b97eaf4001 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py @@ -46,15 +46,6 @@ class CmkIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED_IDENTITY = "userAssignedIdentity" -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - class EvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Redis eviction policy - default is VolatileLRU.""" @@ -159,11 +150,16 @@ class ResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLING = "Disabling" DISABLE_FAILED = "DisableFailed" DISABLED = "Disabled" + SCALING = "Scaling" + SCALING_FAILED = "ScalingFailed" class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SkuName.""" + """The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, + EnterpriseFlash_F300 etc.). + """ + ENTERPRISE_E5 = "Enterprise_E5" ENTERPRISE_E10 = "Enterprise_E10" ENTERPRISE_E20 = "Enterprise_E20" ENTERPRISE_E50 = "Enterprise_E50" diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py index 374c80fa8307..8aa6b8ab91d6 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py @@ -12,7 +12,6 @@ from ._databases_operations import DatabasesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._skus_operations import SkusOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -25,7 +24,6 @@ "DatabasesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", - "SkusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py index b10d39e96037..ca5eb7802aea 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +61,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_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") @@ -84,9 +78,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -104,7 +96,7 @@ def build_create_request( "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") @@ -123,9 +115,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +133,7 @@ def build_update_request( "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") @@ -162,9 +152,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +169,7 @@ def build_get_request( "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") @@ -198,9 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +203,7 @@ def build_delete_request( "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") @@ -234,9 +220,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +237,7 @@ def build_list_keys_request( "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") @@ -270,9 +254,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -290,7 +272,7 @@ def build_regenerate_key_request( "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") @@ -309,9 +291,7 @@ def build_import_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -329,7 +309,7 @@ def build_import_request( "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") @@ -348,9 +328,7 @@ def build_export_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -368,7 +346,7 @@ def build_export_request( "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") @@ -387,9 +365,7 @@ def build_force_unlink_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -407,7 +383,7 @@ def build_force_unlink_request( "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") @@ -426,9 +402,7 @@ def build_flush_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -446,7 +420,7 @@ def build_flush_request( "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") @@ -497,9 +471,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) error_map = { @@ -591,16 +563,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Database") @@ -763,9 +733,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -832,16 +800,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DatabaseUpdate") @@ -1002,9 +968,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Database] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1079,9 +1043,7 @@ def get(self, resource_group_name: str, cluster_name: str, database_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) request = build_get_request( @@ -1134,9 +1096,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -1199,9 +1159,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1273,9 +1231,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccessKeys] = kwargs.pop("cls", None) request = build_list_keys_request( @@ -1333,16 +1289,14 @@ def _regenerate_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AccessKeys]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "RegenerateKeyParameters") @@ -1503,9 +1457,7 @@ def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AccessKeys] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1534,7 +1486,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1572,16 +1524,14 @@ def _import_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ImportClusterParameters") @@ -1736,9 +1686,7 @@ def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1803,16 +1751,14 @@ def _export_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ExportClusterParameters") @@ -1967,9 +1913,7 @@ def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2034,16 +1978,14 @@ def _force_unlink_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForceUnlinkParameters") @@ -2198,9 +2140,7 @@ def begin_force_unlink( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2265,16 +2205,14 @@ def _flush_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "FlushParameters") @@ -2436,9 +2374,7 @@ def begin_flush( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py index 86b8f21736fb..99b246ebc1b3 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py index 7d7643e7aa54..bb95ebb5d92f 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,9 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +52,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "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") @@ -113,9 +106,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py index 0802bd168a26..670da10e736f 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +59,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription "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") @@ -86,9 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +99,7 @@ def build_get_request( "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") @@ -128,9 +120,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +140,7 @@ def build_put_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") @@ -173,9 +163,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +182,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") @@ -245,9 +233,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -350,9 +336,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -410,16 +394,14 @@ def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "PrivateEndpointConnection") @@ -590,9 +572,7 @@ def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -638,25 +618,9 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the RedisEnterprise cluster. Required. - :type cluster_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. 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, @@ -668,9 +632,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -679,7 +641,7 @@ def delete( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -693,14 +655,93 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. Required. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - delete.metadata = { + begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" } diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py index f5b6111508b0..5338b4397b71 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +58,7 @@ def build_list_by_cluster_request( "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") @@ -114,9 +107,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py index 9d8cde120b04..46607c43c012 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +62,7 @@ def build_create_request( "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,9 +81,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -106,7 +98,7 @@ def build_update_request( "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") @@ -125,9 +117,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +133,7 @@ def build_delete_request( "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") @@ -158,9 +148,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,7 +164,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "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") @@ -191,9 +179,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +194,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "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") @@ -223,9 +209,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2023-03-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +218,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -278,16 +262,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Cluster") @@ -436,9 +418,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -499,16 +479,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ClusterUpdate") @@ -655,9 +633,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -718,9 +694,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -778,9 +752,7 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -847,9 +819,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -902,9 +872,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -988,9 +956,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py index 3689878fa9a1..bcd61145ca99 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py index ddd8f55b7b96..736ae3394fb3 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/OperationsStatusGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/OperationsStatusGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py index dbed0c7a4e58..fa7285aa35f7 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseCreate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseCreate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py index 917bc3aa2a75..0b551d08ad49 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesCreate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesCreate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py index be2d0613641e..037afc887dbd 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py index 6530a3ab6043..d037727165de 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.databases.begin_delete( + client.databases.begin_delete( resource_group_name="rg1", cluster_name="cache1", database_name="db1", ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesDelete.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesDelete.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py index b83168450473..193de4da2c38 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.databases.begin_export( + client.databases.begin_export( resource_group_name="rg1", cluster_name="cache1", database_name="default", parameters={"sasUri": "https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters"}, ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesExport.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesExport.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py index 83d1a2f4a237..91432eb59b72 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.databases.begin_flush( + client.databases.begin_flush( resource_group_name="rg1", cluster_name="cache1", database_name="default", @@ -39,9 +39,8 @@ def main(): ] }, ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesFlush.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesFlush.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py index 6d6cd17cdc3a..c111473b1da2 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.databases.begin_force_unlink( + client.databases.begin_force_unlink( resource_group_name="rg1", cluster_name="cache1", database_name="default", @@ -39,9 +39,8 @@ def main(): ] }, ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesForceUnlink.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesForceUnlink.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py index ab807fcf9f10..d568c9cd1fbb 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py index 6027d1b15a87..800c0e4ba956 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.databases.begin_import_method( + client.databases.begin_import_method( resource_group_name="rg1", cluster_name="cache1", database_name="default", @@ -40,9 +40,8 @@ def main(): ] }, ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesImport.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesImport.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py index cae1d1f96e65..2ed685367a21 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesListByCluster.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py index 67d06e005fdc..1d897cb1b354 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesListKeys.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesListKeys.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py index 3fbc65496c0c..00c417dc5183 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesRegenerateKey.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py index 5ab78ddbd178..8ed7dc4747e8 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDatabasesUpdate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDatabasesUpdate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py index bfc28c83c312..ce72c2c2b821 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.redis_enterprise.begin_delete( + client.redis_enterprise.begin_delete( resource_group_name="rg1", cluster_name="cache1", ).result() - print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDelete.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDelete.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py index 6a012b49f343..41b238b6ba9e 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.private_endpoint_connections.delete( + client.private_endpoint_connections.begin_delete( resource_group_name="rg1", cluster_name="cache1", private_endpoint_connection_name="pectest01", - ) - print(response) + ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py index fd20d0fceebf..2c8b08b10c4a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py index 9ca60c6ca478..3bd34fdf16df 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseGetPrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py index cdd60abaf0e6..6356a38a0556 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseList.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseList.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py index dd68c55b0435..99ebb1555f94 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseListByResourceGroup.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py index 9d4c9928f05c..c481b48b40b1 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseListPrivateEndpointConnections.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py index b51905853439..45a4d0ef283f 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseListPrivateLinkResources.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py index d020979a2692..160bf0a9f043 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterprisePutPrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterprisePutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py index bffde2417331..9c735aad038c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2023-03-01-preview/examples/RedisEnterpriseUpdate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2024-02-01/examples/RedisEnterpriseUpdate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/_meta.json b/sdk/scvmm/azure-mgmt-scvmm/_meta.json index e15dc37325e5..b68045fd870d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/_meta.json +++ b/sdk/scvmm/azure-mgmt-scvmm/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7a54c1a83d14da431c0ae48c4315cba143084bce", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/scvmm/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/scvmm/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/scvmm/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py index 687786dd317d..d8b3e1e7171b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,17 +27,16 @@ class SCVMMConfiguration(Configuration): # pylint: disable=too-many-instance-at :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-07". 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(SCVMMConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-06-05-preview"] = kwargs.pop("api_version", "2020-06-05-preview") + api_version: str = kwargs.pop("api_version", "2023-10-07") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py index f5da3dd74c0a..fe3295dcc685 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_scvmm.py @@ -20,8 +20,10 @@ CloudsOperations, InventoryItemsOperations, Operations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstanceHybridIdentityMetadataOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, - VirtualMachinesOperations, VirtualNetworksOperations, VmmServersOperations, ) @@ -42,8 +44,6 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype clouds: azure.mgmt.scvmm.operations.CloudsOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.scvmm.operations.VirtualNetworksOperations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.scvmm.operations.VirtualMachinesOperations :ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations :vartype virtual_machine_templates: azure.mgmt.scvmm.operations.VirtualMachineTemplatesOperations @@ -51,15 +51,23 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.scvmm.operations.InventoryItemsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.scvmm.operations.VirtualMachineInstancesOperations + :ivar virtual_machine_instance_hybrid_identity_metadata: + VirtualMachineInstanceHybridIdentityMetadataOperations operations + :vartype virtual_machine_instance_hybrid_identity_metadata: + azure.mgmt.scvmm.operations.VirtualMachineInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: azure.mgmt.scvmm.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2020-06-05-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-07". 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. @@ -73,7 +81,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SCVMMConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -85,9 +93,6 @@ def __init__( self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_machine_templates = VirtualMachineTemplatesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,6 +100,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_instance_hybrid_identity_metadata = VirtualMachineInstanceHybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -125,5 +139,5 @@ def __enter__(self) -> "SCVMM": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ 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)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,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 str(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) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,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): @@ -875,9 +906,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) @@ -922,7 +958,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: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py index cb32a846720c..08df2214a58e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,17 +27,16 @@ class SCVMMConfiguration(Configuration): # pylint: disable=too-many-instance-at :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-07". 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(SCVMMConfiguration, self).__init__(**kwargs) - api_version: Literal["2020-06-05-preview"] = kwargs.pop("api_version", "2020-06-05-preview") + api_version: str = kwargs.pop("api_version", "2023-10-07") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py index 32781d965ae5..cb2a3d9a2206 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_scvmm.py @@ -20,8 +20,10 @@ CloudsOperations, InventoryItemsOperations, Operations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstanceHybridIdentityMetadataOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, - VirtualMachinesOperations, VirtualNetworksOperations, VmmServersOperations, ) @@ -42,8 +44,6 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype clouds: azure.mgmt.scvmm.aio.operations.CloudsOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.scvmm.aio.operations.VirtualNetworksOperations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.scvmm.aio.operations.VirtualMachinesOperations :ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations :vartype virtual_machine_templates: azure.mgmt.scvmm.aio.operations.VirtualMachineTemplatesOperations @@ -51,15 +51,24 @@ class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-inst :vartype availability_sets: azure.mgmt.scvmm.aio.operations.AvailabilitySetsOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.scvmm.aio.operations.InventoryItemsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.scvmm.aio.operations.VirtualMachineInstancesOperations + :ivar virtual_machine_instance_hybrid_identity_metadata: + VirtualMachineInstanceHybridIdentityMetadataOperations operations + :vartype virtual_machine_instance_hybrid_identity_metadata: + azure.mgmt.scvmm.aio.operations.VirtualMachineInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: + azure.mgmt.scvmm.aio.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2020-06-05-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-07". 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. @@ -73,7 +82,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SCVMMConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -85,9 +94,6 @@ def __init__( self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_machine_templates = VirtualMachineTemplatesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,6 +101,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_machine_instance_hybrid_identity_metadata = VirtualMachineInstanceHybridIdentityMetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -125,5 +140,5 @@ async def __aenter__(self) -> "SCVMM": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py index 69f4eb5e8c3e..8e5a52cb1993 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py @@ -10,10 +10,14 @@ from ._operations import Operations from ._clouds_operations import CloudsOperations from ._virtual_networks_operations import VirtualNetworksOperations -from ._virtual_machines_operations import VirtualMachinesOperations from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._availability_sets_operations import AvailabilitySetsOperations from ._inventory_items_operations import InventoryItemsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._virtual_machine_instance_hybrid_identity_metadata_operations import ( + VirtualMachineInstanceHybridIdentityMetadataOperations, +) +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -24,10 +28,12 @@ "Operations", "CloudsOperations", "VirtualNetworksOperations", - "VirtualMachinesOperations", "VirtualMachineTemplatesOperations", "AvailabilitySetsOperations", "InventoryItemsOperations", + "VirtualMachineInstancesOperations", + "VirtualMachineInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py index 02bd502ef2c0..9cddcaa291a8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,15 +64,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: + async def get( + self, resource_group_name: str, availability_set_resource_name: str, **kwargs: Any + ) -> _models.AvailabilitySet: """Gets an AvailabilitySet. Implements AvailabilitySet GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilitySet or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.AvailabilitySet @@ -93,14 +92,12 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -110,8 +107,9 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,13 +127,13 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } async def _create_or_update_initial( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.AvailabilitySet, IO], **kwargs: Any ) -> _models.AvailabilitySet: @@ -150,23 +148,21 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AvailabilitySet") request = build_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -179,8 +175,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,14 +204,14 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: _models.AvailabilitySet, *, content_type: str = "application/json", @@ -224,10 +221,11 @@ async def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: Request payload. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -251,7 +249,7 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -261,10 +259,11 @@ async def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: Request payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -288,7 +287,7 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.AvailabilitySet, IO], **kwargs: Any ) -> AsyncLROPoller[_models.AvailabilitySet]: @@ -296,11 +295,12 @@ async def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str + :param body: Request payload. Is either a AvailabilitySet type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -321,9 +321,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -332,7 +330,7 @@ async def begin_create_or_update( if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -368,11 +366,15 @@ def get_long_running_output(pipeline_response): 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.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, availability_set_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + availability_set_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -385,14 +387,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, @@ -403,13 +403,14 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) @@ -419,29 +420,35 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @distributed_trace_async async def begin_delete( - self, resource_group_name: str, availability_set_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + availability_set_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements AvailabilitySet DELETE method. Deregisters the ScVmm availability set from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -457,9 +464,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -467,7 +472,7 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -497,13 +502,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } async def _update_initial( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> Optional[_models.AvailabilitySet]: @@ -518,23 +523,21 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") request = build_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -547,38 +550,40 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AvailabilitySet", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @overload async def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: _models.ResourcePatch, *, content_type: str = "application/json", @@ -588,10 +593,11 @@ async def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: AvailabilitySets patch payload. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -615,7 +621,7 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -625,10 +631,11 @@ async def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: AvailabilitySets patch payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -652,7 +659,7 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> AsyncLROPoller[_models.AvailabilitySet]: @@ -660,11 +667,13 @@ async def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str - :param body: AvailabilitySets patch payload. Is either a model type or a IO type. Required. + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str + :param body: AvailabilitySets patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -685,9 +694,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +703,7 @@ async def begin_update( if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -732,7 +739,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @distributed_trace @@ -743,7 +750,8 @@ def list_by_resource_group( List of AvailabilitySets in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 AvailabilitySet or the result of cls(response) @@ -753,9 +761,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -808,8 +814,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -840,9 +847,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Availabi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -894,8 +899,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py index c9451ffa0869..d7fa56b56bc6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,15 +64,16 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _models.Cloud: + async def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs: Any) -> _models.Cloud: """Gets a Cloud. Implements Cloud GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cloud or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.Cloud @@ -93,14 +90,12 @@ async def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cloud] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -110,8 +105,9 @@ async def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,11 +125,11 @@ async def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } async def _create_or_update_initial( - self, resource_group_name: str, cloud_name: str, body: Union[_models.Cloud, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.Cloud, IO], **kwargs: Any ) -> _models.Cloud: error_map = { 401: ClientAuthenticationError, @@ -146,23 +142,21 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "Cloud") request = build_create_or_update_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -175,8 +169,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -198,14 +193,14 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: _models.Cloud, *, content_type: str = "application/json", @@ -215,10 +210,11 @@ async def begin_create_or_update( Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Request payload. Required. :type body: ~azure.mgmt.scvmm.models.Cloud :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -241,7 +237,7 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -251,10 +247,11 @@ async def begin_create_or_update( Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Request payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -275,17 +272,18 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, cloud_name: str, body: Union[_models.Cloud, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.Cloud, IO], **kwargs: Any ) -> AsyncLROPoller[_models.Cloud]: """Implements Clouds PUT method. Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str + :param body: Request payload. Is either a Cloud type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.Cloud or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -305,9 +303,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -316,7 +312,7 @@ async def begin_create_or_update( if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -352,11 +348,15 @@ def get_long_running_output(pipeline_response): 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.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cloud_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + cloud_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -369,14 +369,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, @@ -387,39 +385,49 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @distributed_trace_async async def begin_delete( - self, resource_group_name: str, cloud_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + cloud_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements Cloud resource DELETE method. Deregisters the ScVmm fabric cloud from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -435,9 +443,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -445,7 +451,7 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -478,11 +484,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } async def _update_initial( - self, resource_group_name: str, cloud_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> Optional[_models.Cloud]: error_map = { 401: ClientAuthenticationError, @@ -495,23 +501,21 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") request = build_update_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -524,38 +528,40 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cloud", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Cloud", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @overload async def begin_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: _models.ResourcePatch, *, content_type: str = "application/json", @@ -565,10 +571,11 @@ async def begin_update( Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Clouds patch payload. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -591,7 +598,7 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -601,10 +608,11 @@ async def begin_update( Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Clouds patch payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -625,17 +633,18 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, resource_group_name: str, cloud_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> AsyncLROPoller[_models.Cloud]: """Implements the Clouds PATCH method. Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str - :param body: Clouds patch payload. Is either a model type or a IO type. Required. + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str + :param body: Clouds patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -655,9 +664,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -666,7 +673,7 @@ async def begin_update( if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -702,7 +709,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @distributed_trace @@ -711,7 +718,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy List of Clouds in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 Cloud or the result of cls(response) @@ -721,9 +729,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -776,8 +782,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -808,9 +815,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cloud"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -862,8 +867,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py index 9323641f8a14..9c3b6f8543e0 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_by_vmm_server_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +64,7 @@ async def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[_models.InventoryItem] = None, *, content_type: str = "application/json", @@ -78,12 +74,13 @@ async def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.InventoryItem :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -100,7 +97,7 @@ async def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[IO] = None, *, content_type: str = "application/json", @@ -110,12 +107,13 @@ async def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -132,7 +130,7 @@ async def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[Union[_models.InventoryItem, IO]] = None, **kwargs: Any ) -> _models.InventoryItem: @@ -140,13 +138,15 @@ async def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.scvmm.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -167,16 +167,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -187,7 +185,7 @@ async def create( request = build_create_request( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -200,42 +198,48 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("InventoryItem", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("InventoryItem", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InventoryItem", pipeline_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.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace_async async def get( - self, resource_group_name: str, vmm_server_name: str, inventory_item_name: str, **kwargs: Any + self, resource_group_name: str, vmm_server_name: str, inventory_item_resource_name: str, **kwargs: Any ) -> _models.InventoryItem: """Implements GET InventoryItem method. Shows an inventory item. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: InventoryItem or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.InventoryItem @@ -252,15 +256,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -270,8 +272,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,23 +292,24 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vmm_server_name: str, inventory_item_name: str, **kwargs: Any + self, resource_group_name: str, vmm_server_name: str, inventory_item_resource_name: str, **kwargs: Any ) -> None: """Implements inventoryItem DELETE method. Deletes an inventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_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 @@ -322,15 +326,13 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata["url"], @@ -340,8 +342,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,7 +358,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace @@ -366,7 +369,8 @@ def list_by_vmm_server( Returns the list of inventoryItems in the given VMMServer. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -378,9 +382,7 @@ def list_by_vmm_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -434,8 +436,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py index 2633d340433a..d75dc760a9ad 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,23 +53,19 @@ 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.ResourceProviderOperation"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Returns list of all operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperation or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.ResourceProviderOperation] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +106,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -124,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..8561f0ab04b3 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,208 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtual_machine_instance_hybrid_identity_metadata_operations import ( + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VirtualMachineInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.aio.SCVMM`'s + :attr:`virtual_machine_instance_hybrid_identity_metadata` 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_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata + :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.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + 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 = 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("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata] + :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.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", 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.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py similarity index 68% rename from sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py rename to sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py index ee013db6947c..ba7d5831f990 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machines_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,14 +31,13 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._virtual_machines_operations import ( +from ...operations._virtual_machine_instances_operations import ( build_create_checkpoint_request, build_create_or_update_request, build_delete_checkpoint_request, build_delete_request, build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, + build_list_request, build_restart_request, build_restore_checkpoint_request, build_start_request, @@ -46,22 +45,18 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods +class VirtualMachineInstancesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.scvmm.aio.SCVMM`'s - :attr:`virtual_machines` attribute. + :attr:`virtual_machine_instances` attribute. """ models = _models @@ -74,18 +69,17 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: - """Gets a VirtualMachine. + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine. - Implements VirtualMachine GET method. + Retrieves information about a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.scvmm.models.VirtualMachine + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -99,15 +93,11 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -116,8 +106,9 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,24 +118,18 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} async def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachine, IO], - **kwargs: Any - ) -> _models.VirtualMachine: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -156,24 +141,23 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: - _json = self._serialize.body(body, "VirtualMachine") + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstance") + else: + _json = None request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -185,8 +169,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,10 +182,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -208,29 +193,28 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" } @overload async def begin_create_or_update( self, - resource_group_name: str, - virtual_machine_name: str, - body: _models.VirtualMachine, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachine + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstance :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -242,31 +226,25 @@ async def begin_create_or_update( :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Required. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -279,30 +257,27 @@ async def begin_create_or_update( :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachine, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachine or IO + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -314,26 +289,23 @@ async def begin_create_or_update( :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = 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, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -345,7 +317,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -369,17 +341,12 @@ def get_long_running_output(pipeline_response): 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.ScVmm/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" } - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any - ) -> None: + async def _update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -388,69 +355,85 @@ async def _delete_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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.VirtualMachineInstance]] = kwargs.pop("cls", None) - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - retain=retain, - force=force, + 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, "VirtualMachineInstanceUpdate") + else: + _json = None + + request = build_update_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + 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) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + return deserialized - @distributed_trace_async - async def begin_delete( + _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} + + @overload + async def begin_update( self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Implements VirtualMachine DELETE method. + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. - Deletes a VirtualMachine deployed on ScVmm fabric. + The operation to update a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool - :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdate + :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 @@ -459,27 +442,87 @@ async def begin_delete( :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] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + async def begin_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.VirtualMachineInstance] = 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, - virtual_machine_name=virtual_machine_name, - retain=retain, - force=force, + raw_result = await self._update_initial( + resource_uri=resource_uri, + body=body, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -487,9 +530,11 @@ async def begin_delete( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( @@ -509,17 +554,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} - async def _update_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachineUpdate, IO], + resource_uri: str, + force: Optional[Union[str, _models.Force]] = None, + delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> Optional[_models.VirtualMachine]: + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -528,160 +571,66 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualMachine]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "VirtualMachineUpdate") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_delete_request( + resource_uri=resource_uri, + force=force, + delete_from_host=delete_from_host, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], + template_url=self._delete_initial.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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [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) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: _models.VirtualMachineUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. + return cls(pipeline_response, None, response_headers) - Updates the VirtualMachines resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate - :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. - - Updates the VirtualMachines resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Required. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} @distributed_trace_async - async def begin_update( + async def begin_delete( self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachineUpdate, IO], + resource_uri: str, + force: Optional[Union[str, _models.Force]] = None, + delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. + ) -> AsyncLROPoller[None]: + """Deletes an virtual machine. - Updates the VirtualMachines resource. + The operation to delete a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param force: Whether force delete was specified. Known values are: "false" and "true". Default + value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force + :param delete_from_host: Whether to disable the VM from azure and also delete it from VMM. + Known values are: "false" and "true". Default value is None. + :type delete_from_host: str or ~azure.mgmt.scvmm.models.DeleteFromHost :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -690,29 +639,24 @@ async def begin_update( :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + 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._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - body=body, + raw_result = await self._delete_initial( # type: ignore + resource_uri=resource_uri, + force=force, + delete_from_host=delete_from_host, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -720,11 +664,9 @@ async def begin_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: AsyncPollingMethod = cast( @@ -744,16 +686,98 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :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.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstanceListResult", 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.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances"} async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -766,16 +790,14 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -784,9 +806,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _json = None request = build_stop_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -798,29 +818,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/stop" - } + _stop_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop"} @overload async def begin_stop( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.StopVirtualMachineOptions] = None, *, content_type: str = "application/json", @@ -828,12 +849,11 @@ async def begin_stop( ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -854,22 +874,15 @@ async def begin_stop( @overload async def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -890,22 +903,17 @@ async def begin_stop( @distributed_trace_async async def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -925,9 +933,7 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -935,8 +941,7 @@ async def begin_stop( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -966,12 +971,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/stop" - } + begin_stop.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop"} async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -984,15 +987,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._start_initial.metadata["url"], headers=_headers, @@ -1001,36 +1000,35 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/start" - } + _start_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start"} @distributed_trace_async - async def begin_start( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: """Implements the operation to start a virtual machine. - Start virtual machine. + The operation to start a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -1046,17 +1044,14 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1084,12 +1079,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/start" - } + begin_start.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start"} async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1102,15 +1095,11 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._restart_initial.metadata["url"], headers=_headers, @@ -1119,36 +1108,37 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restart" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart" } @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: """Implements the operation to restart a virtual machine. - Restart virtual machine. + The operation to restart a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -1164,17 +1154,14 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1202,16 +1189,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restart" - } + begin_restart.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart"} async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1224,16 +1205,14 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1242,9 +1221,7 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta _json = None request = build_create_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1256,42 +1233,44 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _create_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/createCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" } @overload async def begin_create_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineCreateCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine create checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1312,22 +1291,15 @@ async def begin_create_checkpoint( @overload async def begin_create_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine create checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1348,22 +1320,17 @@ async def begin_create_checkpoint( @distributed_trace_async async def begin_create_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine create checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine create checkpoint action payload. Is either a + VirtualMachineCreateCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1383,9 +1350,7 @@ async def begin_create_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1393,8 +1358,7 @@ async def begin_create_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1425,15 +1389,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/createCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" } async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1446,16 +1406,14 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1464,9 +1422,7 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta _json = None request = build_delete_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1478,42 +1434,44 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/deleteCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" } @overload async def begin_delete_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineDeleteCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine delete checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1534,22 +1492,15 @@ async def begin_delete_checkpoint( @overload async def begin_delete_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine delete checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1570,22 +1521,17 @@ async def begin_delete_checkpoint( @distributed_trace_async async def begin_delete_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine delete checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine delete checkpoint action payload. Is either a + VirtualMachineDeleteCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1605,9 +1551,7 @@ async def begin_delete_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1615,8 +1559,7 @@ async def begin_delete_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1647,13 +1590,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/deleteCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" } async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[Union[_models.VirtualMachineRestoreCheckpoint, IO]] = None, **kwargs: Any ) -> None: @@ -1668,16 +1610,14 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1686,9 +1626,7 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st _json = None request = build_restore_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1700,42 +1638,44 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restore_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restoreCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" } @overload async def begin_restore_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineRestoreCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine restore checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1756,22 +1696,15 @@ async def begin_restore_checkpoint( @overload async def begin_restore_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine restore checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1793,21 +1726,19 @@ async def begin_restore_checkpoint( @distributed_trace_async async def begin_restore_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[Union[_models.VirtualMachineRestoreCheckpoint, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine restore checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine restore checkpoint action payload. Is either a + VirtualMachineRestoreCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1827,9 +1758,7 @@ async def begin_restore_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1837,8 +1766,7 @@ async def begin_restore_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restore_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1869,180 +1797,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_restore_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restoreCheckpoint" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachine"]: - """Implements GET VirtualMachines in a resource group. - - List of VirtualMachines in a resource group. - - :param resource_group_name: The name of the resource group. 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 VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineListResult] = 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, - 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("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: - """Implements GET VirtualMachines in a subscription. - - List of VirtualMachines in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineListResult] = 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, - 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("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines"} diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py index ec8695ee33ed..2b2cf464511a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +71,8 @@ async def get( Implements VirtualMachineTemplate GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -95,9 +92,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -112,8 +107,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,16 +148,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VirtualMachineTemplate") @@ -181,8 +175,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -221,7 +216,8 @@ async def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -258,7 +254,8 @@ async def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -293,11 +290,12 @@ async def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -318,9 +316,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -369,7 +365,11 @@ def get_long_running_output(pipeline_response): } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_machine_template_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -382,9 +382,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -400,19 +398,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -420,19 +423,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( - self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_machine_template_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements VirtualMachineTemplate DELETE method. Deregisters the ScVmm VM Template from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -448,9 +456,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -512,16 +518,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -541,26 +545,28 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -582,7 +588,8 @@ async def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -619,7 +626,8 @@ async def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -654,12 +662,13 @@ async def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: VirtualMachineTemplates patch details. Is either a model type or a IO type. - Required. + :param body: VirtualMachineTemplates patch details. Is either a ResourcePatch type or a IO + type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -680,9 +689,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -738,7 +745,8 @@ def list_by_resource_group( List of VirtualMachineTemplates in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VirtualMachineTemplate or the result of @@ -750,9 +758,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -805,8 +811,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -839,9 +846,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualM _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -893,8 +898,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py index f90a1f745c50..26df9e3a8c1a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +69,8 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg Implements VirtualNetwork GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -93,9 +90,7 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +105,9 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,16 +146,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VirtualNetwork") @@ -179,8 +173,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +214,8 @@ async def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -256,7 +252,8 @@ async def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -291,11 +288,12 @@ async def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -316,9 +314,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -367,7 +363,11 @@ def get_long_running_output(pipeline_response): } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_network_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_network_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -380,9 +380,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -398,19 +396,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}" @@ -418,19 +421,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( - self, resource_group_name: str, virtual_network_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_network_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements VirtualNetwork DELETE method. Deregisters the ScVmm virtual network from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -446,9 +454,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -506,16 +512,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -535,26 +539,28 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualNetwork", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -576,7 +582,8 @@ async def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -613,7 +620,8 @@ async def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -644,11 +652,13 @@ async def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: VirtualNetworks patch payload. Is either a model type or a IO type. Required. + :param body: VirtualNetworks patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -669,9 +679,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -727,7 +735,8 @@ def list_by_resource_group( List of VirtualNetworks in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VirtualNetwork or the result of cls(response) @@ -737,9 +746,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -792,8 +799,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -824,9 +832,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualN _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -878,8 +884,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_guest_agents_operations.py new file mode 100644 index 000000000000..0a6a0949d9fb --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_guest_agents_operations.py @@ -0,0 +1,479 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._vm_instance_guest_agents_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VMInstanceGuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.aio.SCVMM`'s + :attr:`vm_instance_guest_agents` 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 _create_initial( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> _models.GuestAgent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.GuestAgent] = 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, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @overload + async def begin_create( + self, + resource_uri: str, + body: Optional[_models.GuestAgent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.GuestAgent + :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 GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.models.GuestAgent or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :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.GuestAgent] = 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_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GuestAgent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestAgent or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.GuestAgent + :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.GuestAgent] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + 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 = 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("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace_async + async def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: 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_uri=resource_uri, + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestAgent or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.scvmm.models.GuestAgent] + :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.GuestAgentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GuestAgentList", 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.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents"} diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py index 1d897b760988..cba22e8b2031 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +69,8 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An Implements VMMServer GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -93,9 +90,7 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServer] = kwargs.pop("cls", None) request = build_get_request( @@ -110,8 +105,9 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,16 +142,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VMMServer") @@ -175,8 +169,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,7 +210,8 @@ async def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -252,7 +248,8 @@ async def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -283,11 +280,12 @@ async def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VMMServer type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VMMServer or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -308,9 +306,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -359,7 +355,11 @@ def get_long_running_output(pipeline_response): } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vmm_server_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + vmm_server_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -372,9 +372,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -390,19 +388,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}" @@ -410,19 +413,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( - self, resource_group_name: str, vmm_server_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + vmm_server_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements VmmServers DELETE method. - Deboards the SCVMM fabric from Azure. + Removes the SCVMM fabric from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -438,9 +446,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -498,16 +504,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -527,26 +531,28 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VMMServer", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VMMServer", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -568,7 +574,8 @@ async def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -605,7 +612,8 @@ async def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -636,11 +644,12 @@ async def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: VmmServers patch payload. Is either a model type or a IO type. Required. + :param body: VmmServers patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -661,9 +670,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -717,7 +724,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy List of VmmServers in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VMMServer or the result of cls(response) @@ -727,9 +735,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -782,8 +788,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,9 +821,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VMMServe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -868,8 +873,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py index 3175f63e5b6e..07d421f3c483 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py @@ -9,65 +9,93 @@ from ._models_py3 import AvailabilitySet from ._models_py3 import AvailabilitySetListItem from ._models_py3 import AvailabilitySetListResult +from ._models_py3 import AvailabilitySetProperties from ._models_py3 import Checkpoint from ._models_py3 import Cloud from ._models_py3 import CloudCapacity from ._models_py3 import CloudInventoryItem from ._models_py3 import CloudListResult -from ._models_py3 import ErrorDefinition +from ._models_py3 import CloudProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import ExtendedLocation +from ._models_py3 import GuestAgent +from ._models_py3 import GuestAgentList +from ._models_py3 import GuestAgentProperties +from ._models_py3 import GuestCredential from ._models_py3 import HardwareProfile from ._models_py3 import HardwareProfileUpdate +from ._models_py3 import HttpProxyConfiguration +from ._models_py3 import Identity +from ._models_py3 import InfrastructureProfile +from ._models_py3 import InfrastructureProfileUpdate from ._models_py3 import InventoryItem from ._models_py3 import InventoryItemDetails from ._models_py3 import InventoryItemProperties from ._models_py3 import InventoryItemsList -from ._models_py3 import NetworkInterfaces -from ._models_py3 import NetworkInterfacesUpdate +from ._models_py3 import NetworkInterface +from ._models_py3 import NetworkInterfaceUpdate from ._models_py3 import NetworkProfile from ._models_py3 import NetworkProfileUpdate -from ._models_py3 import OsProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OsProfileForVMInstance from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import ResourcePatch -from ._models_py3 import ResourceProviderOperation -from ._models_py3 import ResourceProviderOperationDisplay -from ._models_py3 import ResourceProviderOperationList from ._models_py3 import StopVirtualMachineOptions from ._models_py3 import StorageProfile from ._models_py3 import StorageProfileUpdate from ._models_py3 import StorageQoSPolicy from ._models_py3 import StorageQoSPolicyDetails from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import VMMCredential from ._models_py3 import VMMServer from ._models_py3 import VMMServerListResult -from ._models_py3 import VMMServerPropertiesCredentials +from ._models_py3 import VMMServerProperties from ._models_py3 import VirtualDisk from ._models_py3 import VirtualDiskUpdate -from ._models_py3 import VirtualMachine from ._models_py3 import VirtualMachineCreateCheckpoint from ._models_py3 import VirtualMachineDeleteCheckpoint +from ._models_py3 import VirtualMachineInstance +from ._models_py3 import VirtualMachineInstanceListResult +from ._models_py3 import VirtualMachineInstanceProperties +from ._models_py3 import VirtualMachineInstanceUpdate +from ._models_py3 import VirtualMachineInstanceUpdateProperties from ._models_py3 import VirtualMachineInventoryItem -from ._models_py3 import VirtualMachineListResult from ._models_py3 import VirtualMachineRestoreCheckpoint from ._models_py3 import VirtualMachineTemplate from ._models_py3 import VirtualMachineTemplateInventoryItem from ._models_py3 import VirtualMachineTemplateListResult -from ._models_py3 import VirtualMachineUpdate -from ._models_py3 import VirtualMachineUpdateProperties +from ._models_py3 import VirtualMachineTemplateProperties from ._models_py3 import VirtualNetwork from ._models_py3 import VirtualNetworkInventoryItem from ._models_py3 import VirtualNetworkListResult +from ._models_py3 import VirtualNetworkProperties +from ._models_py3 import VmInstanceHybridIdentityMetadata +from ._models_py3 import VmInstanceHybridIdentityMetadataList +from ._models_py3 import VmInstanceHybridIdentityMetadataProperties +from ._scvmm_enums import ActionType from ._scvmm_enums import AllocationMethod from ._scvmm_enums import CreateDiffDisk from ._scvmm_enums import CreatedByType +from ._scvmm_enums import DeleteFromHost from ._scvmm_enums import DynamicMemoryEnabled +from ._scvmm_enums import Force +from ._scvmm_enums import IdentityType from ._scvmm_enums import InventoryType from ._scvmm_enums import IsCustomizable +from ._scvmm_enums import IsHighlyAvailable from ._scvmm_enums import LimitCpuForMigration +from ._scvmm_enums import Origin from ._scvmm_enums import OsType +from ._scvmm_enums import ProvisioningAction +from ._scvmm_enums import ProvisioningState +from ._scvmm_enums import SkipShutdown from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -76,64 +104,92 @@ "AvailabilitySet", "AvailabilitySetListItem", "AvailabilitySetListResult", + "AvailabilitySetProperties", "Checkpoint", "Cloud", "CloudCapacity", "CloudInventoryItem", "CloudListResult", - "ErrorDefinition", + "CloudProperties", + "ErrorAdditionalInfo", + "ErrorDetail", "ErrorResponse", "ExtendedLocation", + "GuestAgent", + "GuestAgentList", + "GuestAgentProperties", + "GuestCredential", "HardwareProfile", "HardwareProfileUpdate", + "HttpProxyConfiguration", + "Identity", + "InfrastructureProfile", + "InfrastructureProfileUpdate", "InventoryItem", "InventoryItemDetails", "InventoryItemProperties", "InventoryItemsList", - "NetworkInterfaces", - "NetworkInterfacesUpdate", + "NetworkInterface", + "NetworkInterfaceUpdate", "NetworkProfile", "NetworkProfileUpdate", - "OsProfile", + "Operation", + "OperationDisplay", + "OperationListResult", + "OsProfileForVMInstance", "ProxyResource", "Resource", "ResourcePatch", - "ResourceProviderOperation", - "ResourceProviderOperationDisplay", - "ResourceProviderOperationList", "StopVirtualMachineOptions", "StorageProfile", "StorageProfileUpdate", "StorageQoSPolicy", "StorageQoSPolicyDetails", "SystemData", + "TrackedResource", + "VMMCredential", "VMMServer", "VMMServerListResult", - "VMMServerPropertiesCredentials", + "VMMServerProperties", "VirtualDisk", "VirtualDiskUpdate", - "VirtualMachine", "VirtualMachineCreateCheckpoint", "VirtualMachineDeleteCheckpoint", + "VirtualMachineInstance", + "VirtualMachineInstanceListResult", + "VirtualMachineInstanceProperties", + "VirtualMachineInstanceUpdate", + "VirtualMachineInstanceUpdateProperties", "VirtualMachineInventoryItem", - "VirtualMachineListResult", "VirtualMachineRestoreCheckpoint", "VirtualMachineTemplate", "VirtualMachineTemplateInventoryItem", "VirtualMachineTemplateListResult", - "VirtualMachineUpdate", - "VirtualMachineUpdateProperties", + "VirtualMachineTemplateProperties", "VirtualNetwork", "VirtualNetworkInventoryItem", "VirtualNetworkListResult", + "VirtualNetworkProperties", + "VmInstanceHybridIdentityMetadata", + "VmInstanceHybridIdentityMetadataList", + "VmInstanceHybridIdentityMetadataProperties", + "ActionType", "AllocationMethod", "CreateDiffDisk", "CreatedByType", + "DeleteFromHost", "DynamicMemoryEnabled", + "Force", + "IdentityType", "InventoryType", "IsCustomizable", + "IsHighlyAvailable", "LimitCpuForMigration", + "Origin", "OsType", + "ProvisioningAction", + "ProvisioningState", + "SkipShutdown", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py index 852ced1b43f1..69b1c75f5eda 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -17,31 +17,127 @@ from .. import models as _models -class AvailabilitySet(_serialization.Model): - """The AvailabilitySets resource definition. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Gets or sets the location. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.scvmm.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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. E.g. + "/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.scvmm.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar system_data: The system data. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AvailabilitySet(TrackedResource): + """The AvailabilitySets resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.scvmm.models.SystemData - :ivar extended_location: The extended location. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.AvailabilitySetProperties + :ivar extended_location: The extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :ivar availability_set_name: Name of the availability set. - :vartype availability_set_name: str - :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :vartype vmm_server_id: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str """ _validation = { @@ -49,56 +145,44 @@ class AvailabilitySet(_serialization.Model): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "availability_set_name": {"min_length": 1}, - "provisioning_state": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, + "extended_location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "AvailabilitySetProperties"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "availability_set_name": {"key": "properties.availabilitySetName", "type": "str"}, - "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, + properties: "_models.AvailabilitySetProperties", + extended_location: "_models.ExtendedLocation", tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - availability_set_name: Optional[str] = None, - vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword extended_location: The extended location. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.AvailabilitySetProperties + :keyword extended_location: The extended location. Required. :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :keyword availability_set_name: Name of the availability set. - :paramtype availability_set_name: str - :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :paramtype vmm_server_id: str """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties self.extended_location = extended_location - self.availability_set_name = availability_set_name - self.vmm_server_id = vmm_server_id - self.provisioning_state = None class AvailabilitySetListItem(_serialization.Model): @@ -116,8 +200,12 @@ class AvailabilitySetListItem(_serialization.Model): } def __init__( - self, *, id: Optional[str] = None, name: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword id: Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. :paramtype id: str @@ -132,29 +220,71 @@ def __init__( class AvailabilitySetListResult(_serialization.Model): """List of AvailabilitySets. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: List of AvailabilitySets. :vartype value: list[~azure.mgmt.scvmm.models.AvailabilitySet] :ivar next_link: Url to follow for getting next page of resources. :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[AvailabilitySet]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, value: Optional[List["_models.AvailabilitySet"]] = None, next_link: Optional[str] = None, **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AvailabilitySet"]] = None, **kwargs: Any) -> None: """ :keyword value: List of AvailabilitySets. :paramtype value: list[~azure.mgmt.scvmm.models.AvailabilitySet] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None + + +class AvailabilitySetProperties(_serialization.Model): + """Defines the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar availability_set_name: Name of the availability set. + :vartype availability_set_name: str + :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :vartype vmm_server_id: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + """ + + _validation = { + "availability_set_name": {"min_length": 1}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + "vmm_server_id": {"key": "vmmServerId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, *, availability_set_name: Optional[str] = None, vmm_server_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword availability_set_name: Name of the availability set. + :paramtype availability_set_name: str + :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :paramtype vmm_server_id: str + """ + super().__init__(**kwargs) + self.availability_set_name = availability_set_name + self.vmm_server_id = vmm_server_id + self.provisioning_state = None class Checkpoint(_serialization.Model): @@ -184,8 +314,8 @@ def __init__( checkpoint_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword parent_checkpoint_id: Gets ID of parent of the checkpoint. :paramtype parent_checkpoint_id: str @@ -203,114 +333,77 @@ def __init__( self.description = description -class Cloud(_serialization.Model): # pylint: disable=too-many-instance-attributes +class Cloud(TrackedResource): """The Clouds resource definition. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Gets or sets the location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.scvmm.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.scvmm.models.SystemData + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.CloudProperties :ivar extended_location: The extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. - :vartype inventory_item_id: str - :ivar uuid: Unique ID of the cloud. - :vartype uuid: str - :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :vartype vmm_server_id: str - :ivar cloud_name: Name of the cloud in VMMServer. - :vartype cloud_name: str - :ivar cloud_capacity: Capacity of the cloud. - :vartype cloud_capacity: ~azure.mgmt.scvmm.models.CloudCapacity - :ivar storage_qo_s_policies: List of QoS policies available for the cloud. - :vartype storage_qo_s_policies: list[~azure.mgmt.scvmm.models.StorageQoSPolicy] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, "extended_location": {"required": True}, - "uuid": {"min_length": 1}, - "cloud_name": {"readonly": True}, - "cloud_capacity": {"readonly": True}, - "storage_qo_s_policies": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CloudProperties"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, - "cloud_name": {"key": "properties.cloudName", "type": "str"}, - "cloud_capacity": {"key": "properties.cloudCapacity", "type": "CloudCapacity"}, - "storage_qo_s_policies": {"key": "properties.storageQoSPolicies", "type": "[StorageQoSPolicy]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, location: str, + properties: "_models.CloudProperties", extended_location: "_models.ExtendedLocation", tags: Optional[Dict[str, str]] = None, - inventory_item_id: Optional[str] = None, - uuid: Optional[str] = None, - vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.CloudProperties :keyword extended_location: The extended location. Required. :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. - :paramtype inventory_item_id: str - :keyword uuid: Unique ID of the cloud. - :paramtype uuid: str - :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :paramtype vmm_server_id: str """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties self.extended_location = extended_location - self.inventory_item_id = inventory_item_id - self.uuid = uuid - self.vmm_server_id = vmm_server_id - self.cloud_name = None - self.cloud_capacity = None - self.storage_qo_s_policies = None - self.provisioning_state = None class CloudCapacity(_serialization.Model): @@ -337,8 +430,8 @@ def __init__( cpu_count: Optional[int] = None, memory_mb: Optional[int] = None, vm_count: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cpu_count: CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. @@ -375,8 +468,9 @@ class InventoryItemProperties(_serialization.Model): :vartype uuid: str :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ _validation = { @@ -404,7 +498,7 @@ class InventoryItemProperties(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: Optional[str] = None @@ -431,8 +525,9 @@ class CloudInventoryItem(InventoryItemProperties): :vartype uuid: str :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ _validation = { @@ -451,7 +546,7 @@ class CloudInventoryItem(InventoryItemProperties): "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "Cloud" @@ -460,77 +555,186 @@ def __init__(self, **kwargs): class CloudListResult(_serialization.Model): """List of Clouds. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: List of Clouds. :vartype value: list[~azure.mgmt.scvmm.models.Cloud] :ivar next_link: Url to follow for getting next page of resources. :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[Cloud]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Cloud"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Cloud"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Clouds. :paramtype value: list[~azure.mgmt.scvmm.models.Cloud] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None -class ErrorDefinition(_serialization.Model): - """Error definition. +class CloudProperties(_serialization.Model): + """Defines the resource properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar details: Internal error details. - :vartype details: list[~azure.mgmt.scvmm.models.ErrorDefinition] + :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. + :vartype inventory_item_id: str + :ivar uuid: Unique ID of the cloud. + :vartype uuid: str + :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :vartype vmm_server_id: str + :ivar cloud_name: Name of the cloud in VMMServer. + :vartype cloud_name: str + :ivar cloud_capacity: Capacity of the cloud. + :vartype cloud_capacity: ~azure.mgmt.scvmm.models.CloudCapacity + :ivar storage_qo_s_policies: List of QoS policies available for the cloud. + :vartype storage_qo_s_policies: list[~azure.mgmt.scvmm.models.StorageQoSPolicy] + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "details": {"readonly": True}, + "uuid": {"min_length": 1}, + "cloud_name": {"readonly": True}, + "cloud_capacity": {"readonly": True}, + "storage_qo_s_policies": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDefinition]"}, + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "vmm_server_id": {"key": "vmmServerId", "type": "str"}, + "cloud_name": {"key": "cloudName", "type": "str"}, + "cloud_capacity": {"key": "cloudCapacity", "type": "CloudCapacity"}, + "storage_qo_s_policies": {"key": "storageQoSPolicies", "type": "[StorageQoSPolicy]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) + def __init__( + self, + *, + inventory_item_id: Optional[str] = None, + uuid: Optional[str] = None, + vmm_server_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. + :paramtype inventory_item_id: str + :keyword uuid: Unique ID of the cloud. + :paramtype uuid: str + :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :paramtype vmm_server_id: str + """ + super().__init__(**kwargs) + self.inventory_item_id = inventory_item_id + self.uuid = uuid + self.vmm_server_id = vmm_server_id + self.cloud_name = None + self.cloud_capacity = None + self.storage_qo_s_policies = None + self.provisioning_state = None + + +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.scvmm.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.scvmm.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): - """Error response. + """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 details. - :vartype error: ~azure.mgmt.scvmm.models.ErrorDefinition + :ivar error: The error object. + :vartype error: ~azure.mgmt.scvmm.models.ErrorDetail """ _attribute_map = { - "error": {"key": "error", "type": "ErrorDefinition"}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.scvmm.models.ErrorDefinition + :keyword error: The error object. + :paramtype error: ~azure.mgmt.scvmm.models.ErrorDetail """ super().__init__(**kwargs) self.error = error @@ -550,7 +754,7 @@ class ExtendedLocation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword type: The extended location type. :paramtype type: str @@ -562,9 +766,229 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** self.name = name +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.scvmm.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class GuestAgent(ProxyResource): + """Defines the GuestAgent. + + 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. E.g. + "/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.scvmm.models.SystemData + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.GuestAgentProperties + """ + + _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": "GuestAgentProperties"}, + } + + def __init__(self, *, properties: "_models.GuestAgentProperties", **kwargs: Any) -> None: + """ + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.GuestAgentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GuestAgentList(_serialization.Model): + """List of GuestAgent. + + 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 next_link: Url to follow for getting next page of GuestAgent. + :vartype next_link: str + :ivar value: Array of GuestAgent. Required. + :vartype value: list[~azure.mgmt.scvmm.models.GuestAgent] + """ + + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[GuestAgent]"}, + } + + def __init__(self, *, value: List["_models.GuestAgent"], **kwargs: Any) -> None: + """ + :keyword value: Array of GuestAgent. Required. + :paramtype value: list[~azure.mgmt.scvmm.models.GuestAgent] + """ + super().__init__(**kwargs) + self.next_link = None + self.value = value + + +class GuestAgentProperties(_serialization.Model): + """Defines the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar uuid: Gets a unique identifier for this resource. + :vartype uuid: str + :ivar credentials: Username / Password Credentials to provision guest agent. + :vartype credentials: ~azure.mgmt.scvmm.models.GuestCredential + :ivar http_proxy_config: HTTP Proxy configuration for the VM. + :vartype http_proxy_config: ~azure.mgmt.scvmm.models.HttpProxyConfiguration + :ivar provisioning_action: Gets or sets the guest agent provisioning action. Known values are: + "install", "uninstall", and "repair". + :vartype provisioning_action: str or ~azure.mgmt.scvmm.models.ProvisioningAction + :ivar status: Gets the guest agent status. + :vartype status: str + :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. + :vartype custom_resource_name: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + """ + + _validation = { + "uuid": {"readonly": True}, + "status": {"readonly": True}, + "custom_resource_name": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "uuid": {"key": "uuid", "type": "str"}, + "credentials": {"key": "credentials", "type": "GuestCredential"}, + "http_proxy_config": {"key": "httpProxyConfig", "type": "HttpProxyConfiguration"}, + "provisioning_action": {"key": "provisioningAction", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "custom_resource_name": {"key": "customResourceName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + credentials: Optional["_models.GuestCredential"] = None, + http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, + provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword credentials: Username / Password Credentials to provision guest agent. + :paramtype credentials: ~azure.mgmt.scvmm.models.GuestCredential + :keyword http_proxy_config: HTTP Proxy configuration for the VM. + :paramtype http_proxy_config: ~azure.mgmt.scvmm.models.HttpProxyConfiguration + :keyword provisioning_action: Gets or sets the guest agent provisioning action. Known values + are: "install", "uninstall", and "repair". + :paramtype provisioning_action: str or ~azure.mgmt.scvmm.models.ProvisioningAction + """ + super().__init__(**kwargs) + self.uuid = None + self.credentials = credentials + self.http_proxy_config = http_proxy_config + self.provisioning_action = provisioning_action + self.status = None + self.custom_resource_name = None + self.provisioning_state = None + + +class GuestCredential(_serialization.Model): + """Username / Password Credentials to connect to guest. + + All required parameters must be populated in order to send to Azure. + + :ivar username: Gets or sets username to connect with the guest. Required. + :vartype username: str + :ivar password: Gets or sets the password to connect with the guest. Required. + :vartype password: str + """ + + _validation = { + "username": {"required": True}, + "password": {"required": True}, + } + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__(self, *, username: str, password: str, **kwargs: Any) -> None: + """ + :keyword username: Gets or sets username to connect with the guest. Required. + :paramtype username: str + :keyword password: Gets or sets the password to connect with the guest. Required. + :paramtype password: str + """ + super().__init__(**kwargs) + self.username = username + self.password = password + + class HardwareProfile(_serialization.Model): """Defines the resource properties. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar memory_mb: MemoryMB is the size of a virtual machine's memory, in MB. :vartype memory_mb: int :ivar cpu_count: Gets or sets the number of vCPUs for the vm. @@ -579,10 +1003,15 @@ class HardwareProfile(_serialization.Model): :vartype dynamic_memory_max_mb: int :ivar dynamic_memory_min_mb: Gets or sets the min dynamic memory for the vm. :vartype dynamic_memory_min_mb: int - :ivar is_highly_available: Gets highly available property. - :vartype is_highly_available: str + :ivar is_highly_available: Gets highly available property. Known values are: "false" and + "true". + :vartype is_highly_available: str or ~azure.mgmt.scvmm.models.IsHighlyAvailable """ + _validation = { + "is_highly_available": {"readonly": True}, + } + _attribute_map = { "memory_mb": {"key": "memoryMB", "type": "int"}, "cpu_count": {"key": "cpuCount", "type": "int"}, @@ -602,9 +1031,8 @@ def __init__( dynamic_memory_enabled: Optional[Union[str, "_models.DynamicMemoryEnabled"]] = None, dynamic_memory_max_mb: Optional[int] = None, dynamic_memory_min_mb: Optional[int] = None, - is_highly_available: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_mb: MemoryMB is the size of a virtual machine's memory, in MB. :paramtype memory_mb: int @@ -620,8 +1048,6 @@ def __init__( :paramtype dynamic_memory_max_mb: int :keyword dynamic_memory_min_mb: Gets or sets the min dynamic memory for the vm. :paramtype dynamic_memory_min_mb: int - :keyword is_highly_available: Gets highly available property. - :paramtype is_highly_available: str """ super().__init__(**kwargs) self.memory_mb = memory_mb @@ -630,7 +1056,7 @@ def __init__( self.dynamic_memory_enabled = dynamic_memory_enabled self.dynamic_memory_max_mb = dynamic_memory_max_mb self.dynamic_memory_min_mb = dynamic_memory_min_mb - self.is_highly_available = is_highly_available + self.is_highly_available = None class HardwareProfileUpdate(_serialization.Model): @@ -670,8 +1096,8 @@ def __init__( dynamic_memory_enabled: Optional[Union[str, "_models.DynamicMemoryEnabled"]] = None, dynamic_memory_max_mb: Optional[int] = None, dynamic_memory_min_mb: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_mb: MemoryMB is the size of a virtual machine's memory, in MB. :paramtype memory_mb: int @@ -697,106 +1123,210 @@ def __init__( self.dynamic_memory_min_mb = dynamic_memory_min_mb -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. +class HttpProxyConfiguration(_serialization.Model): + """HTTP Proxy configuration for the VM. - :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 https_proxy: Gets or sets httpsProxy url. + :vartype https_proxy: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, https_proxy: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword https_proxy: Gets or sets httpsProxy url. + :paramtype https_proxy: str + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.https_proxy = https_proxy -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class Identity(_serialization.Model): + """Managed service identity. 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 + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The principal id of managed service identity. + :vartype principal_id: str + :ivar tenant_id: The tenant of managed service identity. + :vartype tenant_id: str + :ivar type: The type of managed service identity. Required. Known values are: "None" and + "SystemAssigned". + :vartype type: str or ~azure.mgmt.scvmm.models.IdentityType """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs: Any) -> None: + """ + :keyword type: The type of managed service identity. Required. Known values are: "None" and + "SystemAssigned". + :paramtype type: str or ~azure.mgmt.scvmm.models.IdentityType + """ super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type -class InventoryItem(ProxyResource): - """Defines the inventory item. +class InfrastructureProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Specifies the vmmServer infrastructure specific settings for the virtual machine instance. 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 inventory_item_id: Gets or sets the inventory Item ID for the resource. + :vartype inventory_item_id: str + :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :vartype vmm_server_id: str + :ivar cloud_id: ARM Id of the cloud resource to use for deploying the vm. + :vartype cloud_id: str + :ivar template_id: ARM Id of the template resource to use for deploying the vm. + :vartype template_id: str + :ivar vm_name: VMName is the name of VM on the SCVMM server. + :vartype vm_name: str + :ivar uuid: Unique ID of the virtual machine. + :vartype uuid: str + :ivar last_restored_vm_checkpoint: Last restored checkpoint in the vm. + :vartype last_restored_vm_checkpoint: ~azure.mgmt.scvmm.models.Checkpoint + :ivar checkpoints: Checkpoints in the vm. + :vartype checkpoints: list[~azure.mgmt.scvmm.models.Checkpoint] + :ivar checkpoint_type: Type of checkpoint supported for the vm. + :vartype checkpoint_type: str + :ivar generation: Gets or sets the generation for the vm. + :vartype generation: int + :ivar bios_guid: Gets or sets the bios guid for the vm. + :vartype bios_guid: str + """ + + _validation = { + "vm_name": {"min_length": 1}, + "last_restored_vm_checkpoint": {"readonly": True}, + } + + _attribute_map = { + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "vmm_server_id": {"key": "vmmServerId", "type": "str"}, + "cloud_id": {"key": "cloudId", "type": "str"}, + "template_id": {"key": "templateId", "type": "str"}, + "vm_name": {"key": "vmName", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "last_restored_vm_checkpoint": {"key": "lastRestoredVMCheckpoint", "type": "Checkpoint"}, + "checkpoints": {"key": "checkpoints", "type": "[Checkpoint]"}, + "checkpoint_type": {"key": "checkpointType", "type": "str"}, + "generation": {"key": "generation", "type": "int"}, + "bios_guid": {"key": "biosGuid", "type": "str"}, + } + + def __init__( + self, + *, + inventory_item_id: Optional[str] = None, + vmm_server_id: Optional[str] = None, + cloud_id: Optional[str] = None, + template_id: Optional[str] = None, + vm_name: Optional[str] = None, + uuid: Optional[str] = None, + checkpoints: Optional[List["_models.Checkpoint"]] = None, + checkpoint_type: Optional[str] = None, + generation: Optional[int] = None, + bios_guid: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. + :paramtype inventory_item_id: str + :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :paramtype vmm_server_id: str + :keyword cloud_id: ARM Id of the cloud resource to use for deploying the vm. + :paramtype cloud_id: str + :keyword template_id: ARM Id of the template resource to use for deploying the vm. + :paramtype template_id: str + :keyword vm_name: VMName is the name of VM on the SCVMM server. + :paramtype vm_name: str + :keyword uuid: Unique ID of the virtual machine. + :paramtype uuid: str + :keyword checkpoints: Checkpoints in the vm. + :paramtype checkpoints: list[~azure.mgmt.scvmm.models.Checkpoint] + :keyword checkpoint_type: Type of checkpoint supported for the vm. + :paramtype checkpoint_type: str + :keyword generation: Gets or sets the generation for the vm. + :paramtype generation: int + :keyword bios_guid: Gets or sets the bios guid for the vm. + :paramtype bios_guid: str + """ + super().__init__(**kwargs) + self.inventory_item_id = inventory_item_id + self.vmm_server_id = vmm_server_id + self.cloud_id = cloud_id + self.template_id = template_id + self.vm_name = vm_name + self.uuid = uuid + self.last_restored_vm_checkpoint = None + self.checkpoints = checkpoints + self.checkpoint_type = checkpoint_type + self.generation = generation + self.bios_guid = bios_guid + + +class InfrastructureProfileUpdate(_serialization.Model): + """Specifies the vmmServer infrastructure specific settings for the virtual machine instance for + update. + + :ivar checkpoint_type: Type of checkpoint supported for the vm. + :vartype checkpoint_type: str + """ + + _attribute_map = { + "checkpoint_type": {"key": "checkpointType", "type": "str"}, + } + + def __init__(self, *, checkpoint_type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword checkpoint_type: Type of checkpoint supported for the vm. + :paramtype checkpoint_type: str + """ + super().__init__(**kwargs) + self.checkpoint_type = checkpoint_type + + +class InventoryItem(ProxyResource): + """Defines the inventory item. + + 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. E.g. + "/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: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.scvmm.models.SystemData + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.InventoryItemProperties :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str - :ivar inventory_type: They inventory type. Required. Known values are: "Cloud", - "VirtualNetwork", "VirtualMachineTemplate", and "VirtualMachine". - :vartype inventory_type: str or ~azure.mgmt.scvmm.models.InventoryType - :ivar managed_resource_id: Gets the tracked resource id corresponding to the inventory - resource. - :vartype managed_resource_id: str - :ivar uuid: Gets the UUID (which is assigned by VMM) for the inventory item. - :vartype uuid: str - :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. - :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str """ _validation = { @@ -804,11 +1334,7 @@ class InventoryItem(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "inventory_type": {"required": True}, - "managed_resource_id": {"readonly": True}, - "uuid": {"readonly": True}, - "inventory_item_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { @@ -816,29 +1342,24 @@ class InventoryItem(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "InventoryItemProperties"}, "kind": {"key": "kind", "type": "str"}, - "inventory_type": {"key": "properties.inventoryType", "type": "str"}, - "managed_resource_id": {"key": "properties.managedResourceId", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "inventory_item_name": {"key": "properties.inventoryItemName", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, kind: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: "_models.InventoryItemProperties", kind: Optional[str] = None, **kwargs: Any + ) -> None: """ + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.InventoryItemProperties :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str """ super().__init__(**kwargs) - self.system_data = None + self.properties = properties self.kind = kind - self.inventory_type: Optional[str] = None - self.managed_resource_id = None - self.uuid = None - self.inventory_item_name = None - self.provisioning_state = None class InventoryItemDetails(_serialization.Model): @@ -855,7 +1376,9 @@ class InventoryItemDetails(_serialization.Model): "inventory_item_name": {"key": "inventoryItemName", "type": "str"}, } - def __init__(self, *, inventory_item_id: Optional[str] = None, inventory_item_name: Optional[str] = None, **kwargs): + def __init__( + self, *, inventory_item_id: Optional[str] = None, inventory_item_name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. :paramtype inventory_item_id: str @@ -870,6 +1393,8 @@ def __init__(self, *, inventory_item_id: Optional[str] = None, inventory_item_na class InventoryItemsList(_serialization.Model): """List of InventoryItems. + 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 next_link: Url to follow for getting next page of InventoryItems. @@ -879,6 +1404,7 @@ class InventoryItemsList(_serialization.Model): """ _validation = { + "next_link": {"readonly": True}, "value": {"required": True}, } @@ -887,19 +1413,17 @@ class InventoryItemsList(_serialization.Model): "value": {"key": "value", "type": "[InventoryItem]"}, } - def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.InventoryItem"], **kwargs: Any) -> None: """ - :keyword next_link: Url to follow for getting next page of InventoryItems. - :paramtype next_link: str :keyword value: Array of InventoryItems. Required. :paramtype value: list[~azure.mgmt.scvmm.models.InventoryItem] """ super().__init__(**kwargs) - self.next_link = next_link + self.next_link = None self.value = value -class NetworkInterfaces(_serialization.Model): # pylint: disable=too-many-instance-attributes +class NetworkInterface(_serialization.Model): # pylint: disable=too-many-instance-attributes """Network Interface model. Variables are only populated by the server, and will be ignored when sending a request. @@ -909,17 +1433,17 @@ class NetworkInterfaces(_serialization.Model): # pylint: disable=too-many-insta :ivar display_name: Gets the display name of the network interface as shown in the vmmServer. This is the fallback label for a NIC when the name is not set. :vartype display_name: str - :ivar ipv4_addresses: Gets or sets the nic ipv4 addresses. + :ivar ipv4_addresses: Gets the nic ipv4 addresses. :vartype ipv4_addresses: list[str] - :ivar ipv6_addresses: Gets or sets the nic ipv6 addresses. + :ivar ipv6_addresses: Gets the nic ipv6 addresses. :vartype ipv6_addresses: list[str] :ivar mac_address: Gets or sets the nic MAC address. :vartype mac_address: str :ivar virtual_network_id: Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to connect the nic. :vartype virtual_network_id: str - :ivar network_name: Gets or sets the name of the virtual network in vmmServer that the nic is - connected to. + :ivar network_name: Gets the name of the virtual network in vmmServer that the nic is connected + to. :vartype network_name: str :ivar ipv4_address_type: Gets or sets the ipv4 address type. Known values are: "Dynamic" and "Static". @@ -965,8 +1489,8 @@ def __init__( ipv6_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, mac_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, nic_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -1001,7 +1525,7 @@ def __init__( self.nic_id = nic_id -class NetworkInterfacesUpdate(_serialization.Model): +class NetworkInterfaceUpdate(_serialization.Model): """Network Interface model. :ivar name: Gets or sets the name of the network interface. @@ -1044,8 +1568,8 @@ def __init__( ipv6_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, mac_address_type: Optional[Union[str, "_models.AllocationMethod"]] = None, nic_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -1081,18 +1605,18 @@ class NetworkProfile(_serialization.Model): :ivar network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. - :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfaces] + :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterface] """ _attribute_map = { - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaces]"}, + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfaces"]] = None, **kwargs): + def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. - :paramtype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfaces] + :paramtype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterface] """ super().__init__(**kwargs) self.network_interfaces = network_interfaces @@ -1103,200 +1627,212 @@ class NetworkProfileUpdate(_serialization.Model): :ivar network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. - :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfacesUpdate] + :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfaceUpdate] """ _attribute_map = { - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfacesUpdate]"}, + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceUpdate]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfacesUpdate"]] = None, **kwargs): + def __init__( + self, *, network_interfaces: Optional[List["_models.NetworkInterfaceUpdate"]] = None, **kwargs: Any + ) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. - :paramtype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfacesUpdate] + :paramtype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfaceUpdate] """ super().__init__(**kwargs) self.network_interfaces = network_interfaces -class OsProfile(_serialization.Model): - """Defines the resource properties. +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 admin_password: Admin password of the virtual machine. - :vartype admin_password: str - :ivar computer_name: Gets or sets computer name. - :vartype computer_name: str - :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and - "Other". - :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType - :ivar os_name: Gets or sets os name. - :vartype os_name: 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.scvmm.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.scvmm.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.scvmm.models.ActionType """ _validation = { - "os_type": {"readonly": True}, - "os_name": {"readonly": True}, + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, } _attribute_map = { - "admin_password": {"key": "adminPassword", "type": "str"}, - "computer_name": {"key": "computerName", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "os_name": {"key": "osName", "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, *, admin_password: Optional[str] = None, computer_name: Optional[str] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ - :keyword admin_password: Admin password of the virtual machine. - :paramtype admin_password: str - :keyword computer_name: Gets or sets computer name. - :paramtype computer_name: str + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.scvmm.models.OperationDisplay """ super().__init__(**kwargs) - self.admin_password = admin_password - self.computer_name = computer_name - self.os_type = None - self.os_name = None + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None -class ResourcePatch(_serialization.Model): - """Object containing tags updates for patch operations. +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + :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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + _attribute_map = { - "tags": {"key": "tags", "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, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.tags = tags + self.provider = None + self.resource = None + self.operation = None + self.description = None -class ResourceProviderOperation(_serialization.Model): - """Results of the request to list operations. +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. - :ivar is_data_action: Indicates whether the operation applies to data-plane. - :vartype is_data_action: str - :ivar name: Operation name, in format of {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Display metadata associated with the operation. - :vartype display: ~azure.mgmt.scvmm.models.ResourceProviderOperationDisplay + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.scvmm.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "is_data_action": {"key": "isDataAction", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - is_data_action: Optional[str] = None, - name: Optional[str] = None, - display: Optional["_models.ResourceProviderOperationDisplay"] = None, - **kwargs - ): - """ - :keyword is_data_action: Indicates whether the operation applies to data-plane. - :paramtype is_data_action: str - :keyword name: Operation name, in format of {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display metadata associated with the operation. - :paramtype display: ~azure.mgmt.scvmm.models.ResourceProviderOperationDisplay - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.is_data_action = is_data_action - self.name = name - self.display = display + self.value = None + self.next_link = None -class ResourceProviderOperationDisplay(_serialization.Model): - """Display metadata associated with the operation. +class OsProfileForVMInstance(_serialization.Model): + """Defines the resource properties. - :ivar provider: The resource provider. - :vartype provider: str - :ivar resource: Resource on which the operation is performed. - :vartype resource: str - :ivar operation: Type of operation: read, write, delete, etc. - :vartype operation: str - :ivar description: Description of this operation. - :vartype description: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar admin_password: Admin password of the virtual machine. + :vartype admin_password: str + :ivar computer_name: Gets or sets computer name. + :vartype computer_name: str + :ivar os_type: Gets the type of the os. Known values are: "Windows", "Linux", and "Other". + :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType + :ivar os_sku: Gets os sku. + :vartype os_sku: str + :ivar os_version: Gets os version. + :vartype os_version: str """ + _validation = { + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "os_version": {"readonly": True}, + } + _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "computer_name": {"key": "computerName", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSku", "type": "str"}, + "os_version": {"key": "osVersion", "type": "str"}, } def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - """ - :keyword provider: The resource provider. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed. - :paramtype resource: str - :keyword operation: Type of operation: read, write, delete, etc. - :paramtype operation: str - :keyword description: Description of this operation. - :paramtype description: str + self, *, admin_password: Optional[str] = None, computer_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword admin_password: Admin password of the virtual machine. + :paramtype admin_password: str + :keyword computer_name: Gets or sets computer name. + :paramtype computer_name: str """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.admin_password = admin_password + self.computer_name = computer_name + self.os_type = None + self.os_sku = None + self.os_version = None -class ResourceProviderOperationList(_serialization.Model): - """Results of the request to list operations. +class ResourcePatch(_serialization.Model): + """Object containing tags updates for patch operations. - :ivar value: List of Operations. - :vartype value: list[~azure.mgmt.scvmm.models.ResourceProviderOperation] - :ivar next_link: Url to follow for getting next page of resources. - :vartype next_link: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { - "value": {"key": "value", "type": "[ResourceProviderOperation]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - value: Optional[List["_models.ResourceProviderOperation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword value: List of Operations. - :paramtype value: list[~azure.mgmt.scvmm.models.ResourceProviderOperation] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.tags = tags class StopVirtualMachineOptions(_serialization.Model): @@ -1304,20 +1840,20 @@ class StopVirtualMachineOptions(_serialization.Model): :ivar skip_shutdown: Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates - otherwise. Defaults to false. - :vartype skip_shutdown: bool + otherwise. Defaults to false. Known values are: "false" and "true". + :vartype skip_shutdown: str or ~azure.mgmt.scvmm.models.SkipShutdown """ _attribute_map = { - "skip_shutdown": {"key": "skipShutdown", "type": "bool"}, + "skip_shutdown": {"key": "skipShutdown", "type": "str"}, } - def __init__(self, *, skip_shutdown: bool = False, **kwargs): + def __init__(self, *, skip_shutdown: Union[str, "_models.SkipShutdown"] = "false", **kwargs: Any) -> None: """ :keyword skip_shutdown: Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates - otherwise. Defaults to false. - :paramtype skip_shutdown: bool + otherwise. Defaults to false. Known values are: "false" and "true". + :paramtype skip_shutdown: str or ~azure.mgmt.scvmm.models.SkipShutdown """ super().__init__(**kwargs) self.skip_shutdown = skip_shutdown @@ -1334,7 +1870,7 @@ class StorageProfile(_serialization.Model): "disks": {"key": "disks", "type": "[VirtualDisk]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.scvmm.models.VirtualDisk] @@ -1354,7 +1890,7 @@ class StorageProfileUpdate(_serialization.Model): "disks": {"key": "disks", "type": "[VirtualDiskUpdate]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.scvmm.models.VirtualDiskUpdate] @@ -1398,8 +1934,8 @@ def __init__( iops_minimum: Optional[int] = None, bandwidth_limit: Optional[int] = None, policy_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy. :paramtype name: str @@ -1438,8 +1974,12 @@ class StorageQoSPolicyDetails(_serialization.Model): } def __init__( - self, *, name: Optional[str] = None, id: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ :keyword name: The name of the policy. :paramtype name: str @@ -1488,8 +2028,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1529,7 +2069,7 @@ class VirtualDisk(_serialization.Model): # pylint: disable=too-many-instance-at :vartype disk_id: str :ivar disk_size_gb: Gets or sets the disk total size. :vartype disk_size_gb: int - :ivar max_disk_size_gb: Gets or sets the max disk size. + :ivar max_disk_size_gb: Gets the max disk size. :vartype max_disk_size_gb: int :ivar bus: Gets or sets the disk bus. :vartype bus: int @@ -1539,7 +2079,7 @@ class VirtualDisk(_serialization.Model): # pylint: disable=too-many-instance-at :vartype bus_type: str :ivar vhd_type: Gets or sets the disk vhd type. :vartype vhd_type: str - :ivar volume_type: Gets or sets the disk volume type. + :ivar volume_type: Gets the disk volume type. :vartype volume_type: str :ivar vhd_format_type: Gets the disk vhd format type. :vartype vhd_format_type: str @@ -1589,8 +2129,8 @@ def __init__( template_disk_id: Optional[str] = None, storage_qo_s_policy: Optional["_models.StorageQoSPolicyDetails"] = None, create_diff_disk: Optional[Union[str, "_models.CreateDiffDisk"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the disk. :paramtype name: str @@ -1674,8 +2214,8 @@ def __init__( bus_type: Optional[str] = None, vhd_type: Optional[str] = None, storage_qo_s_policy: Optional["_models.StorageQoSPolicyDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the disk. :paramtype name: str @@ -1705,230 +2245,294 @@ def __init__( self.storage_qo_s_policy = storage_qo_s_policy -class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The VirtualMachines resource definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +class VirtualMachineCreateCheckpoint(_serialization.Model): + """Defines the create checkpoint action properties. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. + :ivar name: Name of the checkpoint. :vartype name: str - :ivar type: Resource Type. + :ivar description: Description of the checkpoint. + :vartype description: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the checkpoint. + :paramtype name: str + :keyword description: Description of the checkpoint. + :paramtype description: str + """ + super().__init__(**kwargs) + self.name = name + self.description = description + + +class VirtualMachineDeleteCheckpoint(_serialization.Model): + """Defines the delete checkpoint action properties. + + :ivar id: ID of the checkpoint to be deleted. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: ID of the checkpoint to be deleted. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class VirtualMachineInstance(ProxyResource): + """Define the virtualMachineInstance. + + 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. E.g. + "/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 location: Gets or sets the location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.scvmm.models.SystemData - :ivar extended_location: The extended location. Required. + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.VirtualMachineInstanceProperties + :ivar extended_location: Gets or sets the extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. - :vartype inventory_item_id: str - :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :vartype vmm_server_id: str - :ivar cloud_id: ARM Id of the cloud resource to use for deploying the vm. - :vartype cloud_id: str - :ivar template_id: ARM Id of the template resource to use for deploying the vm. - :vartype template_id: str - :ivar checkpoint_type: Type of checkpoint supported for the vm. - :vartype checkpoint_type: str - :ivar checkpoints: Checkpoints in the vm. - :vartype checkpoints: list[~azure.mgmt.scvmm.models.Checkpoint] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + "extended_location": {"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": "VirtualMachineInstanceProperties"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + } + + def __init__( + self, + *, + properties: "_models.VirtualMachineInstanceProperties", + extended_location: "_models.ExtendedLocation", + **kwargs: Any + ) -> None: + """ + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.VirtualMachineInstanceProperties + :keyword extended_location: Gets or sets the extended location. Required. + :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation + """ + super().__init__(**kwargs) + self.properties = properties + self.extended_location = extended_location + + +class VirtualMachineInstanceListResult(_serialization.Model): + """List of VirtualMachineInstances. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of VirtualMachineInstances. + :vartype value: list[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualMachineInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.VirtualMachineInstance"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of VirtualMachineInstances. + :paramtype value: list[~azure.mgmt.scvmm.models.VirtualMachineInstance] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualMachineInstanceProperties(_serialization.Model): + """Defines the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar availability_sets: Availability Sets in vm. :vartype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] :ivar os_profile: OS properties. - :vartype os_profile: ~azure.mgmt.scvmm.models.OsProfile + :vartype os_profile: ~azure.mgmt.scvmm.models.OsProfileForVMInstance :ivar hardware_profile: Hardware properties. :vartype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfile :ivar network_profile: Network properties. :vartype network_profile: ~azure.mgmt.scvmm.models.NetworkProfile :ivar storage_profile: Storage properties. :vartype storage_profile: ~azure.mgmt.scvmm.models.StorageProfile - :ivar vm_name: VMName is the name of VM on the SCVMM server. - :vartype vm_name: str - :ivar uuid: Unique ID of the virtual machine. - :vartype uuid: str - :ivar generation: Gets or sets the generation for the vm. - :vartype generation: int + :ivar infrastructure_profile: Gets the infrastructure profile. + :vartype infrastructure_profile: ~azure.mgmt.scvmm.models.InfrastructureProfile :ivar power_state: Gets the power state of the virtual machine. :vartype power_state: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "extended_location": {"required": True}, - "vm_name": {"min_length": 1}, "power_state": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, - "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, - "cloud_id": {"key": "properties.cloudId", "type": "str"}, - "template_id": {"key": "properties.templateId", "type": "str"}, - "checkpoint_type": {"key": "properties.checkpointType", "type": "str"}, - "checkpoints": {"key": "properties.checkpoints", "type": "[Checkpoint]"}, - "availability_sets": {"key": "properties.availabilitySets", "type": "[AvailabilitySetListItem]"}, - "os_profile": {"key": "properties.osProfile", "type": "OsProfile"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfile"}, - "vm_name": {"key": "properties.vmName", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "generation": {"key": "properties.generation", "type": "int"}, - "power_state": {"key": "properties.powerState", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_sets": {"key": "availabilitySets", "type": "[AvailabilitySetListItem]"}, + "os_profile": {"key": "osProfile", "type": "OsProfileForVMInstance"}, + "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfile"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + "storage_profile": {"key": "storageProfile", "type": "StorageProfile"}, + "infrastructure_profile": {"key": "infrastructureProfile", "type": "InfrastructureProfile"}, + "power_state": {"key": "powerState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( self, *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, - inventory_item_id: Optional[str] = None, - vmm_server_id: Optional[str] = None, - cloud_id: Optional[str] = None, - template_id: Optional[str] = None, - checkpoint_type: Optional[str] = None, - checkpoints: Optional[List["_models.Checkpoint"]] = None, availability_sets: Optional[List["_models.AvailabilitySetListItem"]] = None, - os_profile: Optional["_models.OsProfile"] = None, + os_profile: Optional["_models.OsProfileForVMInstance"] = None, hardware_profile: Optional["_models.HardwareProfile"] = None, network_profile: Optional["_models.NetworkProfile"] = None, storage_profile: Optional["_models.StorageProfile"] = None, - vm_name: Optional[str] = None, - uuid: Optional[str] = None, - generation: Optional[int] = None, - **kwargs - ): + infrastructure_profile: Optional["_models.InfrastructureProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword extended_location: The extended location. Required. - :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. - :paramtype inventory_item_id: str - :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :paramtype vmm_server_id: str - :keyword cloud_id: ARM Id of the cloud resource to use for deploying the vm. - :paramtype cloud_id: str - :keyword template_id: ARM Id of the template resource to use for deploying the vm. - :paramtype template_id: str - :keyword checkpoint_type: Type of checkpoint supported for the vm. - :paramtype checkpoint_type: str - :keyword checkpoints: Checkpoints in the vm. - :paramtype checkpoints: list[~azure.mgmt.scvmm.models.Checkpoint] :keyword availability_sets: Availability Sets in vm. :paramtype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] :keyword os_profile: OS properties. - :paramtype os_profile: ~azure.mgmt.scvmm.models.OsProfile + :paramtype os_profile: ~azure.mgmt.scvmm.models.OsProfileForVMInstance :keyword hardware_profile: Hardware properties. :paramtype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfile :keyword network_profile: Network properties. :paramtype network_profile: ~azure.mgmt.scvmm.models.NetworkProfile :keyword storage_profile: Storage properties. :paramtype storage_profile: ~azure.mgmt.scvmm.models.StorageProfile - :keyword vm_name: VMName is the name of VM on the SCVMM server. - :paramtype vm_name: str - :keyword uuid: Unique ID of the virtual machine. - :paramtype uuid: str - :keyword generation: Gets or sets the generation for the vm. - :paramtype generation: int + :keyword infrastructure_profile: Gets the infrastructure profile. + :paramtype infrastructure_profile: ~azure.mgmt.scvmm.models.InfrastructureProfile """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - self.extended_location = extended_location - self.inventory_item_id = inventory_item_id - self.vmm_server_id = vmm_server_id - self.cloud_id = cloud_id - self.template_id = template_id - self.checkpoint_type = checkpoint_type - self.checkpoints = checkpoints self.availability_sets = availability_sets self.os_profile = os_profile self.hardware_profile = hardware_profile self.network_profile = network_profile self.storage_profile = storage_profile - self.vm_name = vm_name - self.uuid = uuid - self.generation = generation + self.infrastructure_profile = infrastructure_profile self.power_state = None self.provisioning_state = None -class VirtualMachineCreateCheckpoint(_serialization.Model): - """Defines the create checkpoint action properties. +class VirtualMachineInstanceUpdate(_serialization.Model): + """Defines the virtualMachineInstanceUpdate. - :ivar name: Name of the checkpoint. - :vartype name: str - :ivar description: Description of the checkpoint. - :vartype description: str + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdateProperties """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "VirtualMachineInstanceUpdateProperties"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): + def __init__( + self, *, properties: Optional["_models.VirtualMachineInstanceUpdateProperties"] = None, **kwargs: Any + ) -> None: """ - :keyword name: Name of the checkpoint. - :paramtype name: str - :keyword description: Description of the checkpoint. - :paramtype description: str + :keyword properties: Resource properties. + :paramtype properties: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdateProperties """ super().__init__(**kwargs) - self.name = name - self.description = description + self.properties = properties -class VirtualMachineDeleteCheckpoint(_serialization.Model): - """Defines the delete checkpoint action properties. +class VirtualMachineInstanceUpdateProperties(_serialization.Model): + """Defines the resource properties. - :ivar id: ID of the checkpoint to be deleted. - :vartype id: str + :ivar hardware_profile: Defines the resource properties. + :vartype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfileUpdate + :ivar storage_profile: Defines the resource properties. + :vartype storage_profile: ~azure.mgmt.scvmm.models.StorageProfileUpdate + :ivar network_profile: Defines the resource properties. + :vartype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate + :ivar availability_sets: Availability Sets in vm. + :vartype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + :ivar infrastructure_profile: Gets the infrastructure profile. + :vartype infrastructure_profile: ~azure.mgmt.scvmm.models.InfrastructureProfileUpdate """ _attribute_map = { - "id": {"key": "id", "type": "str"}, + "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfileUpdate"}, + "storage_profile": {"key": "storageProfile", "type": "StorageProfileUpdate"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileUpdate"}, + "availability_sets": {"key": "availabilitySets", "type": "[AvailabilitySetListItem]"}, + "infrastructure_profile": {"key": "infrastructureProfile", "type": "InfrastructureProfileUpdate"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, + *, + hardware_profile: Optional["_models.HardwareProfileUpdate"] = None, + storage_profile: Optional["_models.StorageProfileUpdate"] = None, + network_profile: Optional["_models.NetworkProfileUpdate"] = None, + availability_sets: Optional[List["_models.AvailabilitySetListItem"]] = None, + infrastructure_profile: Optional["_models.InfrastructureProfileUpdate"] = None, + **kwargs: Any + ) -> None: """ - :keyword id: ID of the checkpoint to be deleted. - :paramtype id: str + :keyword hardware_profile: Defines the resource properties. + :paramtype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfileUpdate + :keyword storage_profile: Defines the resource properties. + :paramtype storage_profile: ~azure.mgmt.scvmm.models.StorageProfileUpdate + :keyword network_profile: Defines the resource properties. + :paramtype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate + :keyword availability_sets: Availability Sets in vm. + :paramtype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + :keyword infrastructure_profile: Gets the infrastructure profile. + :paramtype infrastructure_profile: ~azure.mgmt.scvmm.models.InfrastructureProfileUpdate """ super().__init__(**kwargs) - self.id = id + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + self.availability_sets = availability_sets + self.infrastructure_profile = infrastructure_profile -class VirtualMachineInventoryItem(InventoryItemProperties): +class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=too-many-instance-attributes """The Virtual machine inventory item. Variables are only populated by the server, and will be ignored when sending a request. @@ -1945,19 +2549,26 @@ class VirtualMachineInventoryItem(InventoryItemProperties): :vartype uuid: str :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str - :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and - "Other". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + :ivar os_type: Gets the type of the os. Known values are: "Windows", "Linux", and "Other". :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType - :ivar os_name: Gets or sets os name. + :ivar os_name: Gets os name. :vartype os_name: str + :ivar os_version: Gets os version. + :vartype os_version: str :ivar power_state: Gets the power state of the virtual machine. :vartype power_state: str :ivar ip_addresses: Gets or sets the nic ip addresses. :vartype ip_addresses: list[str] :ivar cloud: Cloud inventory resource details where the VM is present. :vartype cloud: ~azure.mgmt.scvmm.models.InventoryItemDetails + :ivar bios_guid: Gets the bios guid. + :vartype bios_guid: str + :ivar managed_machine_resource_id: Gets the tracked resource id corresponding to the inventory + resource. + :vartype managed_machine_resource_id: str """ _validation = { @@ -1968,7 +2579,10 @@ class VirtualMachineInventoryItem(InventoryItemProperties): "provisioning_state": {"readonly": True}, "os_type": {"readonly": True}, "os_name": {"readonly": True}, + "os_version": {"readonly": True}, "power_state": {"readonly": True}, + "bios_guid": {"readonly": True}, + "managed_machine_resource_id": {"readonly": True}, } _attribute_map = { @@ -1979,9 +2593,12 @@ class VirtualMachineInventoryItem(InventoryItemProperties): "provisioning_state": {"key": "provisioningState", "type": "str"}, "os_type": {"key": "osType", "type": "str"}, "os_name": {"key": "osName", "type": "str"}, + "os_version": {"key": "osVersion", "type": "str"}, "power_state": {"key": "powerState", "type": "str"}, "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, "cloud": {"key": "cloud", "type": "InventoryItemDetails"}, + "bios_guid": {"key": "biosGuid", "type": "str"}, + "managed_machine_resource_id": {"key": "managedMachineResourceId", "type": "str"}, } def __init__( @@ -1989,8 +2606,8 @@ def __init__( *, ip_addresses: Optional[List[str]] = None, cloud: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword ip_addresses: Gets or sets the nic ip addresses. :paramtype ip_addresses: list[str] @@ -2001,51 +2618,26 @@ def __init__( self.inventory_type: str = "VirtualMachine" self.os_type = None self.os_name = None + self.os_version = None self.power_state = None self.ip_addresses = ip_addresses self.cloud = cloud + self.bios_guid = None + self.managed_machine_resource_id = None -class VirtualMachineListResult(_serialization.Model): - """List of VirtualMachines. +class VirtualMachineRestoreCheckpoint(_serialization.Model): + """Defines the restore checkpoint action properties. - :ivar value: List of VirtualMachines. - :vartype value: list[~azure.mgmt.scvmm.models.VirtualMachine] - :ivar next_link: Url to follow for getting next page of resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualMachine]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.VirtualMachine"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: List of VirtualMachines. - :paramtype value: list[~azure.mgmt.scvmm.models.VirtualMachine] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualMachineRestoreCheckpoint(_serialization.Model): - """Defines the restore checkpoint action properties. - - :ivar id: ID of the checkpoint to be restored to. - :vartype id: str + :ivar id: ID of the checkpoint to be restored to. + :vartype id: str """ _attribute_map = { "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: ID of the checkpoint to be restored to. :paramtype id: str @@ -2054,173 +2646,77 @@ def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=re self.id = id -class VirtualMachineTemplate(_serialization.Model): # pylint: disable=too-many-instance-attributes +class VirtualMachineTemplate(TrackedResource): """The VirtualMachineTemplates resource definition. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Gets or sets the location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.scvmm.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.scvmm.models.SystemData + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.VirtualMachineTemplateProperties :ivar extended_location: The extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. - :vartype inventory_item_id: str - :ivar uuid: Unique ID of the virtual machine template. - :vartype uuid: str - :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :vartype vmm_server_id: str - :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and - "Other". - :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType - :ivar os_name: Gets or sets os name. - :vartype os_name: str - :ivar computer_name: Gets or sets computer name. - :vartype computer_name: str - :ivar memory_mb: MemoryMB is the desired size of a virtual machine's memory, in MB. - :vartype memory_mb: int - :ivar cpu_count: Gets or sets the desired number of vCPUs for the vm. - :vartype cpu_count: int - :ivar limit_cpu_for_migration: Gets or sets a value indicating whether to enable processor - compatibility mode for live migration of VMs. Known values are: "false" and "true". - :vartype limit_cpu_for_migration: str or ~azure.mgmt.scvmm.models.LimitCpuForMigration - :ivar dynamic_memory_enabled: Gets or sets a value indicating whether to enable dynamic memory - or not. Known values are: "false" and "true". - :vartype dynamic_memory_enabled: str or ~azure.mgmt.scvmm.models.DynamicMemoryEnabled - :ivar is_customizable: Gets or sets a value indicating whether the vm template is customizable - or not. Known values are: "false" and "true". - :vartype is_customizable: str or ~azure.mgmt.scvmm.models.IsCustomizable - :ivar dynamic_memory_max_mb: Gets or sets the max dynamic memory for the vm. - :vartype dynamic_memory_max_mb: int - :ivar dynamic_memory_min_mb: Gets or sets the min dynamic memory for the vm. - :vartype dynamic_memory_min_mb: int - :ivar is_highly_available: Gets highly available property. - :vartype is_highly_available: str - :ivar generation: Gets or sets the generation for the vm. - :vartype generation: int - :ivar network_interfaces: Gets or sets the network interfaces of the template. - :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterfaces] - :ivar disks: Gets or sets the disks of the template. - :vartype disks: list[~azure.mgmt.scvmm.models.VirtualDisk] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, "extended_location": {"required": True}, - "uuid": {"min_length": 1}, - "os_type": {"readonly": True}, - "os_name": {"readonly": True}, - "computer_name": {"readonly": True}, - "memory_mb": {"readonly": True}, - "cpu_count": {"readonly": True}, - "limit_cpu_for_migration": {"readonly": True}, - "dynamic_memory_enabled": {"readonly": True}, - "is_customizable": {"readonly": True}, - "dynamic_memory_max_mb": {"readonly": True}, - "dynamic_memory_min_mb": {"readonly": True}, - "is_highly_available": {"readonly": True}, - "generation": {"readonly": True}, - "network_interfaces": {"readonly": True}, - "disks": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "VirtualMachineTemplateProperties"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "os_name": {"key": "properties.osName", "type": "str"}, - "computer_name": {"key": "properties.computerName", "type": "str"}, - "memory_mb": {"key": "properties.memoryMB", "type": "int"}, - "cpu_count": {"key": "properties.cpuCount", "type": "int"}, - "limit_cpu_for_migration": {"key": "properties.limitCpuForMigration", "type": "str"}, - "dynamic_memory_enabled": {"key": "properties.dynamicMemoryEnabled", "type": "str"}, - "is_customizable": {"key": "properties.isCustomizable", "type": "str"}, - "dynamic_memory_max_mb": {"key": "properties.dynamicMemoryMaxMB", "type": "int"}, - "dynamic_memory_min_mb": {"key": "properties.dynamicMemoryMinMB", "type": "int"}, - "is_highly_available": {"key": "properties.isHighlyAvailable", "type": "str"}, - "generation": {"key": "properties.generation", "type": "int"}, - "network_interfaces": {"key": "properties.networkInterfaces", "type": "[NetworkInterfaces]"}, - "disks": {"key": "properties.disks", "type": "[VirtualDisk]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals + } + + def __init__( self, *, location: str, + properties: "_models.VirtualMachineTemplateProperties", extended_location: "_models.ExtendedLocation", tags: Optional[Dict[str, str]] = None, - inventory_item_id: Optional[str] = None, - uuid: Optional[str] = None, - vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.VirtualMachineTemplateProperties :keyword extended_location: The extended location. Required. :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. - :paramtype inventory_item_id: str - :keyword uuid: Unique ID of the virtual machine template. - :paramtype uuid: str - :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. - :paramtype vmm_server_id: str """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties self.extended_location = extended_location - self.inventory_item_id = inventory_item_id - self.uuid = uuid - self.vmm_server_id = vmm_server_id - self.os_type = None - self.os_name = None - self.computer_name = None - self.memory_mb = None - self.cpu_count = None - self.limit_cpu_for_migration = None - self.dynamic_memory_enabled = None - self.is_customizable = None - self.dynamic_memory_max_mb = None - self.dynamic_memory_min_mb = None - self.is_highly_available = None - self.generation = None - self.network_interfaces = None - self.disks = None - self.provisioning_state = None class VirtualMachineTemplateInventoryItem(InventoryItemProperties): @@ -2240,16 +2736,16 @@ class VirtualMachineTemplateInventoryItem(InventoryItemProperties): :vartype uuid: str :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str - :ivar cpu_count: Gets or sets the desired number of vCPUs for the vm. + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + :ivar cpu_count: Gets the desired number of vCPUs for the vm. :vartype cpu_count: int :ivar memory_mb: MemoryMB is the desired size of a virtual machine's memory, in MB. :vartype memory_mb: int - :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and - "Other". + :ivar os_type: Gets the type of the os. Known values are: "Windows", "Linux", and "Other". :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType - :ivar os_name: Gets or sets os name. + :ivar os_name: Gets os name. :vartype os_name: str """ @@ -2277,7 +2773,7 @@ class VirtualMachineTemplateInventoryItem(InventoryItemProperties): "os_name": {"key": "osName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "VirtualMachineTemplate" @@ -2290,134 +2786,310 @@ def __init__(self, **kwargs): class VirtualMachineTemplateListResult(_serialization.Model): """List of VirtualMachineTemplates. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: List of VirtualMachineTemplates. :vartype value: list[~azure.mgmt.scvmm.models.VirtualMachineTemplate] :ivar next_link: Url to follow for getting next page of resources. :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[VirtualMachineTemplate]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.VirtualMachineTemplate"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.VirtualMachineTemplate"]] = None, **kwargs: Any) -> None: """ :keyword value: List of VirtualMachineTemplates. :paramtype value: list[~azure.mgmt.scvmm.models.VirtualMachineTemplate] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None -class VirtualMachineUpdate(_serialization.Model): - """Defines the virtualMachineUpdate. +class VirtualMachineTemplateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Defines the resource properties. - :ivar properties: Defines the resource properties. - :vartype properties: ~azure.mgmt.scvmm.models.VirtualMachineUpdateProperties - :ivar tags: Gets or sets the Resource tags. - :vartype tags: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. + :vartype inventory_item_id: str + :ivar uuid: Unique ID of the virtual machine template. + :vartype uuid: str + :ivar vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :vartype vmm_server_id: str + :ivar os_type: Gets the type of the os. Known values are: "Windows", "Linux", and "Other". + :vartype os_type: str or ~azure.mgmt.scvmm.models.OsType + :ivar os_name: Gets os name. + :vartype os_name: str + :ivar computer_name: Gets computer name. + :vartype computer_name: str + :ivar memory_mb: MemoryMB is the desired size of a virtual machine's memory, in MB. + :vartype memory_mb: int + :ivar cpu_count: Gets the desired number of vCPUs for the vm. + :vartype cpu_count: int + :ivar limit_cpu_for_migration: Gets a value indicating whether to enable processor + compatibility mode for live migration of VMs. Known values are: "false" and "true". + :vartype limit_cpu_for_migration: str or ~azure.mgmt.scvmm.models.LimitCpuForMigration + :ivar dynamic_memory_enabled: Gets a value indicating whether to enable dynamic memory or not. + Known values are: "false" and "true". + :vartype dynamic_memory_enabled: str or ~azure.mgmt.scvmm.models.DynamicMemoryEnabled + :ivar is_customizable: Gets a value indicating whether the vm template is customizable or not. + Known values are: "false" and "true". + :vartype is_customizable: str or ~azure.mgmt.scvmm.models.IsCustomizable + :ivar dynamic_memory_max_mb: Gets the max dynamic memory for the vm. + :vartype dynamic_memory_max_mb: int + :ivar dynamic_memory_min_mb: Gets the min dynamic memory for the vm. + :vartype dynamic_memory_min_mb: int + :ivar is_highly_available: Gets highly available property. Known values are: "false" and + "true". + :vartype is_highly_available: str or ~azure.mgmt.scvmm.models.IsHighlyAvailable + :ivar generation: Gets the generation for the vm. + :vartype generation: int + :ivar network_interfaces: Gets the network interfaces of the template. + :vartype network_interfaces: list[~azure.mgmt.scvmm.models.NetworkInterface] + :ivar disks: Gets the disks of the template. + :vartype disks: list[~azure.mgmt.scvmm.models.VirtualDisk] + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ + _validation = { + "uuid": {"min_length": 1}, + "os_type": {"readonly": True}, + "os_name": {"readonly": True}, + "computer_name": {"readonly": True}, + "memory_mb": {"readonly": True}, + "cpu_count": {"readonly": True}, + "limit_cpu_for_migration": {"readonly": True}, + "dynamic_memory_enabled": {"readonly": True}, + "is_customizable": {"readonly": True}, + "dynamic_memory_max_mb": {"readonly": True}, + "dynamic_memory_min_mb": {"readonly": True}, + "is_highly_available": {"readonly": True}, + "generation": {"readonly": True}, + "network_interfaces": {"readonly": True}, + "disks": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "VirtualMachineUpdateProperties"}, - "tags": {"key": "tags", "type": "{str}"}, + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "vmm_server_id": {"key": "vmmServerId", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "os_name": {"key": "osName", "type": "str"}, + "computer_name": {"key": "computerName", "type": "str"}, + "memory_mb": {"key": "memoryMB", "type": "int"}, + "cpu_count": {"key": "cpuCount", "type": "int"}, + "limit_cpu_for_migration": {"key": "limitCpuForMigration", "type": "str"}, + "dynamic_memory_enabled": {"key": "dynamicMemoryEnabled", "type": "str"}, + "is_customizable": {"key": "isCustomizable", "type": "str"}, + "dynamic_memory_max_mb": {"key": "dynamicMemoryMaxMB", "type": "int"}, + "dynamic_memory_min_mb": {"key": "dynamicMemoryMinMB", "type": "int"}, + "is_highly_available": {"key": "isHighlyAvailable", "type": "str"}, + "generation": {"key": "generation", "type": "int"}, + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, + "disks": {"key": "disks", "type": "[VirtualDisk]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( self, *, - properties: Optional["_models.VirtualMachineUpdateProperties"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + inventory_item_id: Optional[str] = None, + uuid: Optional[str] = None, + vmm_server_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: Defines the resource properties. - :paramtype properties: ~azure.mgmt.scvmm.models.VirtualMachineUpdateProperties - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] + :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. + :paramtype inventory_item_id: str + :keyword uuid: Unique ID of the virtual machine template. + :paramtype uuid: str + :keyword vmm_server_id: ARM Id of the vmmServer resource in which this resource resides. + :paramtype vmm_server_id: str """ super().__init__(**kwargs) - self.properties = properties - self.tags = tags + self.inventory_item_id = inventory_item_id + self.uuid = uuid + self.vmm_server_id = vmm_server_id + self.os_type = None + self.os_name = None + self.computer_name = None + self.memory_mb = None + self.cpu_count = None + self.limit_cpu_for_migration = None + self.dynamic_memory_enabled = None + self.is_customizable = None + self.dynamic_memory_max_mb = None + self.dynamic_memory_min_mb = None + self.is_highly_available = None + self.generation = None + self.network_interfaces = None + self.disks = None + self.provisioning_state = None -class VirtualMachineUpdateProperties(_serialization.Model): - """Defines the resource properties. +class VirtualNetwork(TrackedResource): + """The VirtualNetworks resource definition. - :ivar hardware_profile: Defines the resource properties. - :vartype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfileUpdate - :ivar storage_profile: Defines the resource properties. - :vartype storage_profile: ~azure.mgmt.scvmm.models.StorageProfileUpdate - :ivar network_profile: Defines the resource properties. - :vartype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate - :ivar availability_sets: Availability Sets in vm. - :vartype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + 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. E.g. + "/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.scvmm.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 properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.VirtualNetworkProperties + :ivar extended_location: The extended location. Required. + :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, + "extended_location": {"required": True}, + } + _attribute_map = { - "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfileUpdate"}, - "storage_profile": {"key": "storageProfile", "type": "StorageProfileUpdate"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfileUpdate"}, - "availability_sets": {"key": "availabilitySets", "type": "[AvailabilitySetListItem]"}, + "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"}, + "properties": {"key": "properties", "type": "VirtualNetworkProperties"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, } def __init__( self, *, - hardware_profile: Optional["_models.HardwareProfileUpdate"] = None, - storage_profile: Optional["_models.StorageProfileUpdate"] = None, - network_profile: Optional["_models.NetworkProfileUpdate"] = None, - availability_sets: Optional[List["_models.AvailabilitySetListItem"]] = None, - **kwargs - ): + location: str, + properties: "_models.VirtualNetworkProperties", + extended_location: "_models.ExtendedLocation", + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ - :keyword hardware_profile: Defines the resource properties. - :paramtype hardware_profile: ~azure.mgmt.scvmm.models.HardwareProfileUpdate - :keyword storage_profile: Defines the resource properties. - :paramtype storage_profile: ~azure.mgmt.scvmm.models.StorageProfileUpdate - :keyword network_profile: Defines the resource properties. - :paramtype network_profile: ~azure.mgmt.scvmm.models.NetworkProfileUpdate - :keyword availability_sets: Availability Sets in vm. - :paramtype availability_sets: list[~azure.mgmt.scvmm.models.AvailabilitySetListItem] + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.VirtualNetworkProperties + :keyword extended_location: The extended location. Required. + :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation """ - super().__init__(**kwargs) - self.hardware_profile = hardware_profile - self.storage_profile = storage_profile - self.network_profile = network_profile - self.availability_sets = availability_sets + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.extended_location = extended_location -class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The VirtualNetworks resource definition. +class VirtualNetworkInventoryItem(InventoryItemProperties): + """The Virtual network inventory item. 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: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Gets or sets the location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.scvmm.models.SystemData - :ivar extended_location: The extended location. Required. - :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation + :ivar inventory_type: They inventory type. Required. Known values are: "Cloud", + "VirtualNetwork", "VirtualMachineTemplate", and "VirtualMachine". + :vartype inventory_type: str or ~azure.mgmt.scvmm.models.InventoryType + :ivar managed_resource_id: Gets the tracked resource id corresponding to the inventory + resource. + :vartype managed_resource_id: str + :ivar uuid: Gets the UUID (which is assigned by VMM) for the inventory item. + :vartype uuid: str + :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. + :vartype inventory_item_name: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + """ + + _validation = { + "inventory_type": {"required": True}, + "managed_resource_id": {"readonly": True}, + "uuid": {"readonly": True}, + "inventory_item_name": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "inventory_type": {"key": "inventoryType", "type": "str"}, + "managed_resource_id": {"key": "managedResourceId", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "inventory_item_name": {"key": "inventoryItemName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.inventory_type: str = "VirtualNetwork" + + +class VirtualNetworkListResult(_serialization.Model): + """List of VirtualNetworks. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of VirtualNetworks. + :vartype value: list[~azure.mgmt.scvmm.models.VirtualNetwork] + :ivar next_link: Url to follow for getting next page of resources. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.VirtualNetwork"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of VirtualNetworks. + :paramtype value: list[~azure.mgmt.scvmm.models.VirtualNetwork] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualNetworkProperties(_serialization.Model): + """Defines the resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar inventory_item_id: Gets or sets the inventory Item ID for the resource. :vartype inventory_item_id: str :ivar uuid: Unique ID of the virtual network. @@ -2426,55 +3098,34 @@ class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance :vartype vmm_server_id: str :ivar network_name: Name of the virtual network in vmmServer. :vartype network_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "extended_location": {"required": True}, "uuid": {"min_length": 1}, "network_name": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "vmm_server_id": {"key": "properties.vmmServerId", "type": "str"}, - "network_name": {"key": "properties.networkName", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "vmm_server_id": {"key": "vmmServerId", "type": "str"}, + "network_name": {"key": "networkName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( self, *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, inventory_item_id: Optional[str] = None, uuid: Optional[str] = None, vmm_server_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword extended_location: The extended location. Required. - :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. :paramtype inventory_item_id: str :keyword uuid: Unique ID of the virtual network. @@ -2483,13 +3134,6 @@ def __init__( :paramtype vmm_server_id: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - self.extended_location = extended_location self.inventory_item_id = inventory_item_id self.uuid = uuid self.vmm_server_id = vmm_server_id @@ -2497,241 +3141,321 @@ def __init__( self.provisioning_state = None -class VirtualNetworkInventoryItem(InventoryItemProperties): - """The Virtual network inventory item. +class VmInstanceHybridIdentityMetadata(ProxyResource): + """Defines the HybridIdentityMetadata. 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 inventory_type: They inventory type. Required. Known values are: "Cloud", - "VirtualNetwork", "VirtualMachineTemplate", and "VirtualMachine". - :vartype inventory_type: str or ~azure.mgmt.scvmm.models.InventoryType - :ivar managed_resource_id: Gets the tracked resource id corresponding to the inventory - resource. - :vartype managed_resource_id: str - :ivar uuid: Gets the UUID (which is assigned by VMM) for the inventory item. - :vartype uuid: str - :ivar inventory_item_name: Gets the Managed Object name in VMM for the inventory item. - :vartype inventory_item_name: str - :ivar provisioning_state: Gets the provisioning state. - :vartype provisioning_state: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.scvmm.models.SystemData + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadataProperties """ _validation = { - "inventory_type": {"required": True}, - "managed_resource_id": {"readonly": True}, - "uuid": {"readonly": True}, - "inventory_item_name": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "inventory_type": {"key": "inventoryType", "type": "str"}, - "managed_resource_id": {"key": "managedResourceId", "type": "str"}, - "uuid": {"key": "uuid", "type": "str"}, - "inventory_item_name": {"key": "inventoryItemName", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "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": "VmInstanceHybridIdentityMetadataProperties"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, properties: "_models.VmInstanceHybridIdentityMetadataProperties", **kwargs: Any) -> None: + """ + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadataProperties + """ super().__init__(**kwargs) - self.inventory_type: str = "VirtualNetwork" + self.properties = properties -class VirtualNetworkListResult(_serialization.Model): - """List of VirtualNetworks. +class VmInstanceHybridIdentityMetadataList(_serialization.Model): + """List of HybridIdentityMetadata. - :ivar value: List of VirtualNetworks. - :vartype value: list[~azure.mgmt.scvmm.models.VirtualNetwork] - :ivar next_link: Url to follow for getting next page of resources. + 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 next_link: Url to follow for getting next page of HybridIdentityMetadata. :vartype next_link: str + :ivar value: Array of HybridIdentityMetadata. Required. + :vartype value: list[~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata] """ + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[VirtualNetwork]"}, "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[VmInstanceHybridIdentityMetadata]"}, } - def __init__( - self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs - ): + def __init__(self, *, value: List["_models.VmInstanceHybridIdentityMetadata"], **kwargs: Any) -> None: """ - :keyword value: List of VirtualNetworks. - :paramtype value: list[~azure.mgmt.scvmm.models.VirtualNetwork] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str + :keyword value: Array of HybridIdentityMetadata. Required. + :paramtype value: list[~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata] """ super().__init__(**kwargs) + self.next_link = None self.value = value - self.next_link = next_link -class VMMServer(_serialization.Model): # pylint: disable=too-many-instance-attributes +class VmInstanceHybridIdentityMetadataProperties(_serialization.Model): + """Describes the properties of Hybrid Identity Metadata for a Virtual Machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_uid: The unique identifier for the resource. + :vartype resource_uid: str + :ivar public_key: Gets or sets the Public Key. + :vartype public_key: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "resource_uid": {"key": "resourceUid", "type": "str"}, + "public_key": {"key": "publicKey", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_uid: The unique identifier for the resource. + :paramtype resource_uid: str + :keyword public_key: Gets or sets the Public Key. + :paramtype public_key: str + """ + super().__init__(**kwargs) + self.resource_uid = resource_uid + self.public_key = public_key + self.provisioning_state = None + + +class VMMCredential(_serialization.Model): + """Credentials to connect to VMMServer. + + :ivar username: Username to use to connect to VMMServer. + :vartype username: str + :ivar password: Password to use to connect to VMMServer. + :vartype password: str + """ + + _attribute_map = { + "username": {"key": "username", "type": "str"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword username: Username to use to connect to VMMServer. + :paramtype username: str + :keyword password: Password to use to connect to VMMServer. + :paramtype password: str + """ + super().__init__(**kwargs) + self.username = username + self.password = password + + +class VMMServer(TrackedResource): """The VmmServers resource definition. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Gets or sets the location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.scvmm.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.scvmm.models.SystemData + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Resource properties. Required. + :vartype properties: ~azure.mgmt.scvmm.models.VMMServerProperties :ivar extended_location: The extended location. Required. :vartype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :ivar credentials: Credentials to connect to VMMServer. - :vartype credentials: ~azure.mgmt.scvmm.models.VMMServerPropertiesCredentials - :ivar fqdn: Fqdn is the hostname/ip of the vmmServer. Required. - :vartype fqdn: str - :ivar port: Port is the port on which the vmmServer is listening. - :vartype port: int - :ivar connection_status: Gets or sets the connection status to the vmmServer. - :vartype connection_status: str - :ivar error_message: Gets or sets any error message if connection to vmmServer is having any - issue. - :vartype error_message: str - :ivar uuid: Unique ID of vmmServer. - :vartype uuid: str - :ivar version: Version is the version of the vmmSever. - :vartype version: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, "extended_location": {"required": True}, - "fqdn": {"required": True, "min_length": 1}, - "port": {"maximum": 65535, "minimum": 1}, - "connection_status": {"readonly": True}, - "error_message": {"readonly": True}, - "uuid": {"readonly": True}, - "version": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "VMMServerProperties"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "credentials": {"key": "properties.credentials", "type": "VMMServerPropertiesCredentials"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "port": {"key": "properties.port", "type": "int"}, - "connection_status": {"key": "properties.connectionStatus", "type": "str"}, - "error_message": {"key": "properties.errorMessage", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, location: str, + properties: "_models.VMMServerProperties", extended_location: "_models.ExtendedLocation", - fqdn: str, tags: Optional[Dict[str, str]] = None, - credentials: Optional["_models.VMMServerPropertiesCredentials"] = None, - port: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Resource properties. Required. + :paramtype properties: ~azure.mgmt.scvmm.models.VMMServerProperties :keyword extended_location: The extended location. Required. :paramtype extended_location: ~azure.mgmt.scvmm.models.ExtendedLocation - :keyword credentials: Credentials to connect to VMMServer. - :paramtype credentials: ~azure.mgmt.scvmm.models.VMMServerPropertiesCredentials - :keyword fqdn: Fqdn is the hostname/ip of the vmmServer. Required. - :paramtype fqdn: str - :keyword port: Port is the port on which the vmmServer is listening. - :paramtype port: int """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties self.extended_location = extended_location - self.credentials = credentials - self.fqdn = fqdn - self.port = port - self.connection_status = None - self.error_message = None - self.uuid = None - self.version = None - self.provisioning_state = None class VMMServerListResult(_serialization.Model): """List of VmmServers. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: List of VmmServers. :vartype value: list[~azure.mgmt.scvmm.models.VMMServer] :ivar next_link: Url to follow for getting next page of resources. :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[VMMServer]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.VMMServer"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.VMMServer"]] = None, **kwargs: Any) -> None: """ :keyword value: List of VmmServers. :paramtype value: list[~azure.mgmt.scvmm.models.VMMServer] - :keyword next_link: Url to follow for getting next page of resources. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None -class VMMServerPropertiesCredentials(_serialization.Model): - """Credentials to connect to VMMServer. +class VMMServerProperties(_serialization.Model): + """Defines the resource properties. - :ivar username: Username to use to connect to VMMServer. - :vartype username: str - :ivar password: Credentials to use to connect to VMMServer. - :vartype password: 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 Azure. + + :ivar credentials: Credentials to connect to VMMServer. + :vartype credentials: ~azure.mgmt.scvmm.models.VMMCredential + :ivar fqdn: Fqdn is the hostname/ip of the vmmServer. Required. + :vartype fqdn: str + :ivar port: Port is the port on which the vmmServer is listening. + :vartype port: int + :ivar connection_status: Gets the connection status to the vmmServer. + :vartype connection_status: str + :ivar error_message: Gets any error message if connection to vmmServer is having any issue. + :vartype error_message: str + :ivar uuid: Unique ID of vmmServer. + :vartype uuid: str + :ivar version: Version is the version of the vmmSever. + :vartype version: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState """ + _validation = { + "fqdn": {"required": True, "min_length": 1}, + "port": {"maximum": 65535, "minimum": 1}, + "connection_status": {"readonly": True}, + "error_message": {"readonly": True}, + "uuid": {"readonly": True}, + "version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, + "credentials": {"key": "credentials", "type": "VMMCredential"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "connection_status": {"key": "connectionStatus", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "uuid": {"key": "uuid", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__( + self, + *, + fqdn: str, + credentials: Optional["_models.VMMCredential"] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword username: Username to use to connect to VMMServer. - :paramtype username: str - :keyword password: Credentials to use to connect to VMMServer. - :paramtype password: str + :keyword credentials: Credentials to connect to VMMServer. + :paramtype credentials: ~azure.mgmt.scvmm.models.VMMCredential + :keyword fqdn: Fqdn is the hostname/ip of the vmmServer. Required. + :paramtype fqdn: str + :keyword port: Port is the port on which the vmmServer is listening. + :paramtype port: int """ super().__init__(**kwargs) - self.username = username - self.password = password + self.credentials = credentials + self.fqdn = fqdn + self.port = port + self.connection_status = None + self.error_message = None + self.uuid = None + self.version = None + self.provisioning_state = None diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py index 5546a5c05432..da6caa80cca1 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_enums.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_scvmm_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 AllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allocation method.""" @@ -33,6 +39,13 @@ class CreateDiffDisk(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRUE = "true" +class DeleteFromHost(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DeleteFromHost.""" + + FALSE = "false" + TRUE = "true" + + class DynamicMemoryEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets a value indicating whether to enable dynamic memory or not.""" @@ -40,6 +53,20 @@ class DynamicMemoryEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRUE = "true" +class Force(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Force.""" + + FALSE = "false" + TRUE = "true" + + +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of managed service identity.""" + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + + class InventoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The inventory type.""" @@ -50,7 +77,14 @@ class InventoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class IsCustomizable(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets a value indicating whether the vm template is customizable or not.""" + """Gets a value indicating whether the vm template is customizable or not.""" + + FALSE = "false" + TRUE = "true" + + +class IsHighlyAvailable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets highly available property.""" FALSE = "false" TRUE = "true" @@ -65,9 +99,49 @@ class LimitCpuForMigration(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRUE = "true" +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): """Defines the different types of VM guest operating systems.""" WINDOWS = "Windows" LINUX = "Linux" OTHER = "Other" + + +class ProvisioningAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the different types of operations for guest agent.""" + + INSTALL = "install" + UNINSTALL = "uninstall" + REPAIR = "repair" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + UPDATING = "Updating" + DELETING = "Deleting" + ACCEPTED = "Accepted" + CREATED = "Created" + + +class SkipShutdown(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for + this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. + """ + + FALSE = "false" + TRUE = "true" diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py index 69f4eb5e8c3e..8e5a52cb1993 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py @@ -10,10 +10,14 @@ from ._operations import Operations from ._clouds_operations import CloudsOperations from ._virtual_networks_operations import VirtualNetworksOperations -from ._virtual_machines_operations import VirtualMachinesOperations from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._availability_sets_operations import AvailabilitySetsOperations from ._inventory_items_operations import InventoryItemsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._virtual_machine_instance_hybrid_identity_metadata_operations import ( + VirtualMachineInstanceHybridIdentityMetadataOperations, +) +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -24,10 +28,12 @@ "Operations", "CloudsOperations", "VirtualNetworksOperations", - "VirtualMachinesOperations", "VirtualMachineTemplatesOperations", "AvailabilitySetsOperations", "InventoryItemsOperations", + "VirtualMachineInstancesOperations", + "VirtualMachineInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py index 8e5bdbe2c5ec..2baeaf804115 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,28 +40,35 @@ def build_get_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, availability_set_resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetResourceName": _SERIALIZER.url( + "availability_set_resource_name", + availability_set_resource_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", + ), } - _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") @@ -77,29 +80,36 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, availability_set_resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/availabilitySets/{availabilitySetName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetResourceName": _SERIALIZER.url( + "availability_set_resource_name", + availability_set_resource_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", + ), } - _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,37 +124,44 @@ def build_create_or_update_request( def build_delete_request( resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, subscription_id: str, *, - force: Optional[bool] = None, + force: Optional[Union[str, _models.Force]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetResourceName": _SERIALIZER.url( + "availability_set_resource_name", + availability_set_resource_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", + ), } - _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 is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") + _params["force"] = _SERIALIZER.query("force", force, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -153,29 +170,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, availability_set_resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/availabilitySets/{availabilitySetName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), + "availabilitySetResourceName": _SERIALIZER.url( + "availability_set_resource_name", + availability_set_resource_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", + ), } - _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") @@ -192,9 +216,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,10 +226,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,9 +246,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +255,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -264,15 +286,18 @@ 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, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: + def get( + self, resource_group_name: str, availability_set_resource_name: str, **kwargs: Any + ) -> _models.AvailabilitySet: """Gets an AvailabilitySet. Implements AvailabilitySet GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailabilitySet or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.AvailabilitySet @@ -289,14 +314,12 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -306,8 +329,9 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,13 +349,13 @@ def get(self, resource_group_name: str, availability_set_name: str, **kwargs: An return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } def _create_or_update_initial( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.AvailabilitySet, IO], **kwargs: Any ) -> _models.AvailabilitySet: @@ -346,23 +370,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AvailabilitySet") request = build_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -375,8 +397,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,14 +426,14 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @overload def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: _models.AvailabilitySet, *, content_type: str = "application/json", @@ -420,10 +443,11 @@ def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: Request payload. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -447,7 +471,7 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -457,10 +481,11 @@ def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: Request payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -484,7 +509,7 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.AvailabilitySet, IO], **kwargs: Any ) -> LROPoller[_models.AvailabilitySet]: @@ -492,11 +517,12 @@ def begin_create_or_update( Onboards the ScVmm availability set as an Azure resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str + :param body: Request payload. Is either a AvailabilitySet type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.AvailabilitySet or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -517,9 +543,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -528,7 +552,7 @@ def begin_create_or_update( if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -563,11 +587,15 @@ def get_long_running_output(pipeline_response): 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.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, availability_set_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + availability_set_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -580,14 +608,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, @@ -598,13 +624,14 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [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) @@ -614,29 +641,35 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @distributed_trace def begin_delete( - self, resource_group_name: str, availability_set_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + availability_set_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements AvailabilitySet DELETE method. Deregisters the ScVmm availability set from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -652,9 +685,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -662,7 +693,7 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -692,13 +723,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } def _update_initial( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> Optional[_models.AvailabilitySet]: @@ -713,23 +744,21 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") request = build_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -742,38 +771,40 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AvailabilitySet", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @overload def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: _models.ResourcePatch, *, content_type: str = "application/json", @@ -783,10 +814,11 @@ def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: AvailabilitySets patch payload. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -810,7 +842,7 @@ def begin_update( def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -820,10 +852,11 @@ def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str :param body: AvailabilitySets patch payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -847,7 +880,7 @@ def begin_update( def begin_update( self, resource_group_name: str, - availability_set_name: str, + availability_set_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> LROPoller[_models.AvailabilitySet]: @@ -855,11 +888,13 @@ def begin_update( Updates the AvailabilitySets resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: Name of the AvailabilitySet. Required. - :type availability_set_name: str - :param body: AvailabilitySets patch payload. Is either a model type or a IO type. Required. + :param availability_set_resource_name: Name of the AvailabilitySet. Required. + :type availability_set_resource_name: str + :param body: AvailabilitySets patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -880,9 +915,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AvailabilitySet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -891,7 +924,7 @@ def begin_update( if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + availability_set_resource_name=availability_set_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -926,7 +959,7 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" } @distributed_trace @@ -935,7 +968,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite List of AvailabilitySets in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 AvailabilitySet or the result of cls(response) @@ -945,9 +979,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -1000,8 +1032,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1032,9 +1065,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AvailabilityS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map = { @@ -1086,8 +1117,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py index a8bfcc164abd..bcc432d301f7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,27 +39,31 @@ _SERIALIZER.client_side_validation = False -def build_get_request(resource_group_name: str, cloud_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request( + resource_group_name: str, cloud_resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudName": _SERIALIZER.url("cloud_name", cloud_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudResourceName": _SERIALIZER.url( + "cloud_resource_name", cloud_resource_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -75,29 +75,31 @@ def build_get_request(resource_group_name: str, cloud_name: str, subscription_id def build_create_or_update_request( - resource_group_name: str, cloud_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, cloud_resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/clouds/{cloudName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudName": _SERIALIZER.url("cloud_name", cloud_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudResourceName": _SERIALIZER.url( + "cloud_resource_name", cloud_resource_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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,33 +113,40 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, cloud_name: str, subscription_id: str, *, force: Optional[bool] = None, **kwargs: Any + resource_group_name: str, + cloud_resource_name: str, + subscription_id: str, + *, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "cloudName": _SERIALIZER.url("cloud_name", cloud_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudResourceName": _SERIALIZER.url( + "cloud_resource_name", cloud_resource_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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 is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") + _params["force"] = _SERIALIZER.query("force", force, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -145,28 +154,32 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request(resource_group_name: str, cloud_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_request( + resource_group_name: str, cloud_resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/clouds/{cloudName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "cloudName": _SERIALIZER.url("cloud_name", cloud_name, "str"), + "cloudResourceName": _SERIALIZER.url( + "cloud_resource_name", cloud_resource_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -183,9 +196,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,10 +206,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,9 +226,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +235,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -255,15 +266,16 @@ 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, cloud_name: str, **kwargs: Any) -> _models.Cloud: + def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs: Any) -> _models.Cloud: """Gets a Cloud. Implements Cloud GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cloud or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.Cloud @@ -280,14 +292,12 @@ def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cloud] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -297,8 +307,9 @@ def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _mode 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,11 +327,11 @@ def get(self, resource_group_name: str, cloud_name: str, **kwargs: Any) -> _mode return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } def _create_or_update_initial( - self, resource_group_name: str, cloud_name: str, body: Union[_models.Cloud, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.Cloud, IO], **kwargs: Any ) -> _models.Cloud: error_map = { 401: ClientAuthenticationError, @@ -333,23 +344,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "Cloud") request = build_create_or_update_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -362,8 +371,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,14 +395,14 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @overload def begin_create_or_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: _models.Cloud, *, content_type: str = "application/json", @@ -402,10 +412,11 @@ def begin_create_or_update( Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Request payload. Required. :type body: ~azure.mgmt.scvmm.models.Cloud :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -428,7 +439,7 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -438,10 +449,11 @@ def begin_create_or_update( Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Request payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -462,17 +474,18 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, cloud_name: str, body: Union[_models.Cloud, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.Cloud, IO], **kwargs: Any ) -> LROPoller[_models.Cloud]: """Implements Clouds PUT method. Onboards the ScVmm fabric cloud as an Azure cloud resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str + :param body: Request payload. Is either a Cloud type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.Cloud or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -492,9 +505,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -503,7 +514,7 @@ def begin_create_or_update( if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -538,11 +549,15 @@ def get_long_running_output(pipeline_response): 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.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cloud_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + cloud_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -555,14 +570,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, force=force, api_version=api_version, @@ -573,39 +586,49 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @distributed_trace def begin_delete( - self, resource_group_name: str, cloud_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + cloud_resource_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements Cloud resource DELETE method. Deregisters the ScVmm fabric cloud from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -621,9 +644,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -631,7 +652,7 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -663,11 +684,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } def _update_initial( - self, resource_group_name: str, cloud_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> Optional[_models.Cloud]: error_map = { 401: ClientAuthenticationError, @@ -680,23 +701,21 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") request = build_update_request( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -709,38 +728,40 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Cloud", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("Cloud", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @overload def begin_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: _models.ResourcePatch, *, content_type: str = "application/json", @@ -750,10 +771,11 @@ def begin_update( Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Clouds patch payload. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -776,7 +798,7 @@ def begin_update( def begin_update( self, resource_group_name: str, - cloud_name: str, + cloud_resource_name: str, body: IO, *, content_type: str = "application/json", @@ -786,10 +808,11 @@ def begin_update( Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str :param body: Clouds patch payload. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -810,17 +833,18 @@ def begin_update( @distributed_trace def begin_update( - self, resource_group_name: str, cloud_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any + self, resource_group_name: str, cloud_resource_name: str, body: Union[_models.ResourcePatch, IO], **kwargs: Any ) -> LROPoller[_models.Cloud]: """Implements the Clouds PATCH method. Updates the Clouds resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param cloud_name: Name of the Cloud. Required. - :type cloud_name: str - :param body: Clouds patch payload. Is either a model type or a IO type. Required. + :param cloud_resource_name: Name of the Cloud. Required. + :type cloud_resource_name: str + :param body: Clouds patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -840,9 +864,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cloud] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -851,7 +873,7 @@ def begin_update( if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - cloud_name=cloud_name, + cloud_resource_name=cloud_resource_name, body=body, api_version=api_version, content_type=content_type, @@ -886,7 +908,7 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" } @distributed_trace @@ -895,7 +917,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite List of Clouds in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 Cloud or the result of cls(response) @@ -905,9 +928,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -960,8 +981,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -992,9 +1014,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cloud"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) error_map = { @@ -1046,8 +1066,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py index 2a513f9a7840..a4c78da70904 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,30 +38,41 @@ def build_create_request( - resource_group_name: str, vmm_server_name: str, inventory_item_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + vmm_server_name: str, + inventory_item_resource_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), - "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + "inventoryItemResourceName": _SERIALIZER.url( + "inventory_item_resource_name", + inventory_item_resource_name, + "str", + pattern=r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", + ), } - _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") @@ -79,29 +86,40 @@ def build_create_request( def build_get_request( - resource_group_name: str, vmm_server_name: str, inventory_item_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + vmm_server_name: str, + inventory_item_resource_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), - "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + "inventoryItemResourceName": _SERIALIZER.url( + "inventory_item_resource_name", + inventory_item_resource_name, + "str", + pattern=r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", + ), } - _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") @@ -113,29 +131,40 @@ def build_get_request( def build_delete_request( - resource_group_name: str, vmm_server_name: str, inventory_item_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + vmm_server_name: str, + inventory_item_resource_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), - "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), + "inventoryItemResourceName": _SERIALIZER.url( + "inventory_item_resource_name", + inventory_item_resource_name, + "str", + pattern=r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", + ), } - _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,9 +181,7 @@ def build_list_by_vmm_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,11 +191,15 @@ def build_list_by_vmm_server_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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 +234,7 @@ def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[_models.InventoryItem] = None, *, content_type: str = "application/json", @@ -213,12 +244,13 @@ def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.InventoryItem :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -235,7 +267,7 @@ def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[IO] = None, *, content_type: str = "application/json", @@ -245,12 +277,13 @@ def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -267,7 +300,7 @@ def create( self, resource_group_name: str, vmm_server_name: str, - inventory_item_name: str, + inventory_item_resource_name: str, body: Optional[Union[_models.InventoryItem, IO]] = None, **kwargs: Any ) -> _models.InventoryItem: @@ -275,13 +308,15 @@ def create( Create Or Update InventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.scvmm.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,16 +337,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -322,7 +355,7 @@ def create( request = build_create_request( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -335,42 +368,48 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("InventoryItem", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("InventoryItem", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("InventoryItem", pipeline_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.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace def get( - self, resource_group_name: str, vmm_server_name: str, inventory_item_name: str, **kwargs: Any + self, resource_group_name: str, vmm_server_name: str, inventory_item_resource_name: str, **kwargs: Any ) -> _models.InventoryItem: """Implements GET InventoryItem method. Shows an inventory item. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: InventoryItem or the result of cls(response) :rtype: ~azure.mgmt.scvmm.models.InventoryItem @@ -387,15 +426,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -405,8 +442,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,23 +462,24 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vmm_server_name: str, inventory_item_name: str, **kwargs: Any + self, resource_group_name: str, vmm_server_name: str, inventory_item_resource_name: str, **kwargs: Any ) -> None: """Implements inventoryItem DELETE method. Deletes an inventoryItem. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param inventory_item_name: Name of the inventoryItem. Required. - :type inventory_item_name: str + :param inventory_item_resource_name: Name of the inventoryItem. Required. + :type inventory_item_resource_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 @@ -457,15 +496,13 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, vmm_server_name=vmm_server_name, - inventory_item_name=inventory_item_name, + inventory_item_resource_name=inventory_item_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata["url"], @@ -475,8 +512,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -490,7 +528,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" } @distributed_trace @@ -501,7 +539,8 @@ def list_by_vmm_server( Returns the list of inventoryItems in the given VMMServer. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -513,9 +552,7 @@ def list_by_vmm_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -569,8 +606,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py index 9309903e2e33..a59fab1bded3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,22 +75,19 @@ 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.ResourceProviderOperation"]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Returns list of all operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperation or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.ResourceProviderOperation] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,7 +128,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -147,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..a2cf6ea547c3 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,260 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_uri: 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-10-07")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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_list_request(resource_uri: 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-10-07")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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 VirtualMachineInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.SCVMM`'s + :attr:`virtual_machine_instance_hybrid_identity_metadata` 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(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata + :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.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + 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("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata] + :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.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", 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) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py similarity index 63% rename from sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py rename to sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py index 135c35326583..68fff3336eef 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machines_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,29 +39,20 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -76,30 +63,21 @@ 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, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_create_or_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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,177 +90,132 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: +def build_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + 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.ScVmm/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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 retain is not None: - _params["retain"] = _SERIALIZER.query("retain", retain, "bool") - if force is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") # 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_update_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_uri: str, + *, + force: Optional[Union[str, _models.Force]] = None, + delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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 is not None: + _params["force"] = _SERIALIZER.query("force", force, "str") + if delete_from_host is not None: + _params["deleteFromHost"] = _SERIALIZER.query("delete_from_host", delete_from_host, "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/stop", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_stop_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + 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.ScVmm/virtualMachines/{virtualMachineName}/start", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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_restart_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_start_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restart", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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,66 +226,49 @@ def build_restart_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_checkpoint_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_restart_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/createCheckpoint", - ) # pylint: disable=line-too-long + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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_delete_checkpoint_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_create_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/virtualMachines/{virtualMachineName}/deleteCheckpoint", + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -365,30 +281,23 @@ def build_delete_checkpoint_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_checkpoint_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_delete_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) 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.ScVmm/virtualMachines/{virtualMachineName}/restoreCheckpoint", + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -401,70 +310,43 @@ def build_restore_checkpoint_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_restore_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + 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.ScVmm/virtualMachines", + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods +class VirtualMachineInstancesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.scvmm.SCVMM`'s - :attr:`virtual_machines` attribute. + :attr:`virtual_machine_instances` attribute. """ models = _models @@ -477,18 +359,17 @@ 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, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: - """Gets a VirtualMachine. + def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine. - Implements VirtualMachine GET method. + Retrieves information about a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.scvmm.models.VirtualMachine + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -502,15 +383,11 @@ def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -519,8 +396,9 @@ def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,24 +408,18 @@ def get(self, resource_group_name: str, virtual_machine_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("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachine, IO], - **kwargs: Any - ) -> _models.VirtualMachine: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -559,24 +431,23 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: - _json = self._serialize.body(body, "VirtualMachine") + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstance") + else: + _json = None request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -588,8 +459,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,10 +472,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,29 +483,28 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" } @overload def begin_create_or_update( self, - resource_group_name: str, - virtual_machine_name: str, - body: _models.VirtualMachine, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachine + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstance :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -645,31 +516,25 @@ def begin_create_or_update( :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 VirtualMachine or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @overload def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Required. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -682,30 +547,27 @@ def begin_create_or_update( :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 VirtualMachine or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachine, IO], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements VirtualMachines PUT method. + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. - Creates Or Updates virtual machines deployed on scvmm fabric. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachine or IO + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -717,26 +579,23 @@ def begin_create_or_update( :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 VirtualMachine or the result of + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = 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, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -748,7 +607,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -771,17 +630,12 @@ def get_long_running_output(pipeline_response): 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.ScVmm/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" } - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any - ) -> None: + def _update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -790,69 +644,85 @@ def _delete_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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.VirtualMachineInstance]] = kwargs.pop("cls", None) - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - retain=retain, - force=force, + 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, "VirtualMachineInstanceUpdate") + else: + _json = None + + request = build_update_request( + resource_uri=resource_uri, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + 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) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + return deserialized - @distributed_trace - def begin_delete( + _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} + + @overload + def begin_update( self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Implements VirtualMachine DELETE method. + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. - Deletes a VirtualMachine deployed on ScVmm fabric. + The operation to update a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool - :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdate + :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 @@ -861,27 +731,87 @@ def begin_delete( :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: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.models.VirtualMachineInstanceUpdate 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 VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - retain=retain, - force=force, + raw_result = self._update_initial( + resource_uri=resource_uri, + body=body, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -889,9 +819,11 @@ def begin_delete( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: polling_method: PollingMethod = cast( @@ -910,17 +842,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} - def _update_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachineUpdate, IO], + resource_uri: str, + force: Optional[Union[str, _models.Force]] = None, + delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> Optional[_models.VirtualMachine]: + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -929,160 +859,66 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualMachine]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "VirtualMachineUpdate") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + request = build_delete_request( + resource_uri=resource_uri, + force=force, + delete_from_host=delete_from_host, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], + template_url=self._delete_initial.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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [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) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: _models.VirtualMachineUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. - - Updates the VirtualMachines resource. + return cls(pipeline_response, None, response_headers) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate - :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. - - Updates the VirtualMachines resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Required. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} @distributed_trace - def begin_update( + def begin_delete( self, - resource_group_name: str, - virtual_machine_name: str, - body: Union[_models.VirtualMachineUpdate, IO], + resource_uri: str, + force: Optional[Union[str, _models.Force]] = None, + delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements the VirtualMachines PATCH method. + ) -> LROPoller[None]: + """Deletes an virtual machine. - Updates the VirtualMachines resource. + The operation to delete a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: VirtualMachines patch payload. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.scvmm.models.VirtualMachineUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param force: Whether force delete was specified. Known values are: "false" and "true". Default + value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force + :param delete_from_host: Whether to disable the VM from azure and also delete it from VMM. + Known values are: "false" and "true". Default value is None. + :type delete_from_host: str or ~azure.mgmt.scvmm.models.DeleteFromHost :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -1091,29 +927,24 @@ def begin_update( :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 VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.VirtualMachine] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + 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._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - body=body, + raw_result = self._delete_initial( # type: ignore + resource_uri=resource_uri, + force=force, + delete_from_host=delete_from_host, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1121,39 +952,118 @@ def begin_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default"} + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.VirtualMachineInstance] + :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.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstanceListResult", 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, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + 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_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}" - } + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances"} def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1166,16 +1076,14 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1184,9 +1092,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _json = None request = build_stop_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1198,29 +1104,30 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/stop" - } + _stop_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop"} @overload def begin_stop( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.StopVirtualMachineOptions] = None, *, content_type: str = "application/json", @@ -1228,12 +1135,11 @@ def begin_stop( ) -> LROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1254,22 +1160,15 @@ def begin_stop( @overload def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1290,22 +1189,17 @@ def begin_stop( @distributed_trace def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> LROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1325,9 +1219,7 @@ def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1335,8 +1227,7 @@ def begin_stop( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1366,12 +1257,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/stop" - } + begin_stop.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop"} def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1384,15 +1273,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._start_initial.metadata["url"], headers=_headers, @@ -1401,34 +1286,35 @@ def _start_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/start" - } + _start_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start"} @distributed_trace - def begin_start(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_start(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: """Implements the operation to start a virtual machine. - Start virtual machine. + The operation to start a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -1444,17 +1330,14 @@ def begin_start(self, resource_group_name: str, virtual_machine_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1482,12 +1365,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/start" - } + begin_start.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start"} def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1500,15 +1381,11 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._restart_initial.metadata["url"], headers=_headers, @@ -1517,34 +1394,37 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restart" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart" } @distributed_trace - def begin_restart(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_restart(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: """Implements the operation to restart a virtual machine. - Restart virtual machine. + The operation to restart a virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -1560,17 +1440,14 @@ def begin_restart(self, resource_group_name: str, virtual_machine_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1598,16 +1475,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restart" - } + begin_restart.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart"} def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1620,16 +1491,14 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1638,9 +1507,7 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement _json = None request = build_create_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1652,42 +1519,44 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _create_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/createCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" } @overload def begin_create_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineCreateCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine create checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1708,22 +1577,15 @@ def begin_create_checkpoint( @overload def begin_create_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine create checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1744,22 +1606,17 @@ def begin_create_checkpoint( @distributed_trace def begin_create_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineCreateCheckpoint, IO]] = None, **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to creates a checkpoint in a virtual machine. + """Implements the operation to creates a checkpoint in a virtual machine instance. - Creates a checkpoint in virtual machine. + Creates a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine create checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine create checkpoint action payload. Is either a + VirtualMachineCreateCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineCreateCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1779,9 +1636,7 @@ def begin_create_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1789,8 +1644,7 @@ def begin_create_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1821,15 +1675,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/createCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" } def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1842,16 +1692,14 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1860,9 +1708,7 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement _json = None request = build_delete_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1874,42 +1720,44 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/deleteCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" } @overload def begin_delete_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineDeleteCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine delete checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1930,22 +1778,15 @@ def begin_delete_checkpoint( @overload def begin_delete_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine delete checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1966,22 +1807,17 @@ def begin_delete_checkpoint( @distributed_trace def begin_delete_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineDeleteCheckpoint, IO]] = None, **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to delete a checkpoint in a virtual machine. + """Implements the operation to delete a checkpoint in a virtual machine instance. - Deletes a checkpoint in virtual machine. + Deletes a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine delete checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine delete checkpoint action payload. Is either a + VirtualMachineDeleteCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineDeleteCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2001,9 +1837,7 @@ def begin_delete_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2011,8 +1845,7 @@ def begin_delete_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -2043,13 +1876,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/deleteCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" } def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[Union[_models.VirtualMachineRestoreCheckpoint, IO]] = None, **kwargs: Any ) -> None: @@ -2064,16 +1896,14 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -2082,9 +1912,7 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen _json = None request = build_restore_checkpoint_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -2096,42 +1924,44 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restore_checkpoint_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restoreCheckpoint" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" } @overload def begin_restore_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.VirtualMachineRestoreCheckpoint] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine restore checkpoint action payload. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -2152,22 +1982,15 @@ def begin_restore_checkpoint( @overload def begin_restore_checkpoint( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine restore checkpoint action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -2189,21 +2012,19 @@ def begin_restore_checkpoint( @distributed_trace def begin_restore_checkpoint( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[Union[_models.VirtualMachineRestoreCheckpoint, IO]] = None, **kwargs: Any ) -> LROPoller[None]: - """Implements the operation to restores to a checkpoint in a virtual machine. + """Implements the operation to restores to a checkpoint in a virtual machine instance. - Restores to a checkpoint in virtual machine. + Restores to a checkpoint in virtual machine instance. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the VirtualMachine. Required. - :type virtual_machine_name: str - :param body: Virtualmachine restore checkpoint action payload. Is either a model type or a IO - type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine restore checkpoint action payload. Is either a + VirtualMachineRestoreCheckpoint type or a IO type. Default value is None. :type body: ~azure.mgmt.scvmm.models.VirtualMachineRestoreCheckpoint or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2223,9 +2044,7 @@ def begin_restore_checkpoint( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -2233,8 +2052,7 @@ def begin_restore_checkpoint( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._restore_checkpoint_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -2265,178 +2083,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_restore_checkpoint.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}/restoreCheckpoint" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: - """Implements GET VirtualMachines in a resource group. - - List of VirtualMachines in a resource group. - - :param resource_group_name: The name of the resource group. 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 VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineListResult] = 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, - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines" + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: - """Implements GET VirtualMachines in a subscription. - - List of VirtualMachines in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineListResult] = 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, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines"} diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py index 4514da8ea8d5..b57feeadc885 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,13 +55,20 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "virtualMachineTemplateName": _SERIALIZER.url( - "virtual_machine_template_name", virtual_machine_template_name, "str" + "virtual_machine_template_name", + virtual_machine_template_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", ), } - _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") @@ -84,9 +85,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,13 +96,20 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "virtualMachineTemplateName": _SERIALIZER.url( - "virtual_machine_template_name", virtual_machine_template_name, "str" + "virtual_machine_template_name", + virtual_machine_template_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", ), } - _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") @@ -121,15 +127,13 @@ def build_delete_request( virtual_machine_template_name: str, subscription_id: str, *, - force: Optional[bool] = None, + force: Optional[Union[str, _models.Force]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,18 +143,25 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "virtualMachineTemplateName": _SERIALIZER.url( - "virtual_machine_template_name", virtual_machine_template_name, "str" + "virtual_machine_template_name", + virtual_machine_template_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", ), } - _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 is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") + _params["force"] = _SERIALIZER.query("force", force, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -164,9 +175,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,14 +185,21 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "virtualMachineTemplateName": _SERIALIZER.url( - "virtual_machine_template_name", virtual_machine_template_name, "str" + "virtual_machine_template_name", + virtual_machine_template_name, + "str", + max_length=54, + min_length=1, + pattern=r"[a-zA-Z0-9-_\.]", ), } - _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") @@ -200,9 +216,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,10 +226,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,9 +246,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,7 +257,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -281,7 +295,8 @@ def get( Implements VirtualMachineTemplate GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -301,9 +316,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -318,8 +331,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,16 +372,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VirtualMachineTemplate") @@ -387,8 +399,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,7 +440,8 @@ def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -464,7 +478,8 @@ def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -499,11 +514,12 @@ def begin_create_or_update( Onboards the ScVmm VM Template as an Azure VM Template resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -524,9 +540,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -574,7 +588,11 @@ def get_long_running_output(pipeline_response): } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_machine_template_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -587,9 +605,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -605,19 +621,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -625,19 +646,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( - self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_machine_template_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements VirtualMachineTemplate DELETE method. Deregisters the ScVmm VM Template from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -653,9 +679,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -716,16 +740,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -745,26 +767,28 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -786,7 +810,8 @@ def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -823,7 +848,8 @@ def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str @@ -858,12 +884,13 @@ def begin_update( Updates the VirtualMachineTemplate resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_machine_template_name: Name of the VirtualMachineTemplate. Required. :type virtual_machine_template_name: str - :param body: VirtualMachineTemplates patch details. Is either a model type or a IO type. - Required. + :param body: VirtualMachineTemplates patch details. Is either a ResourcePatch type or a IO + type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -884,9 +911,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachineTemplate] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -941,7 +966,8 @@ def list_by_resource_group( List of VirtualMachineTemplates in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VirtualMachineTemplate or the result of @@ -952,9 +978,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -1007,8 +1031,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1040,9 +1065,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) error_map = { @@ -1094,8 +1117,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py index 77ed816f6569..b77befa83533 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,11 +55,15 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", virtual_network_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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,9 +80,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,11 +91,15 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", virtual_network_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -117,15 +117,13 @@ def build_delete_request( virtual_network_name: str, subscription_id: str, *, - force: Optional[bool] = None, + force: Optional[Union[str, _models.Force]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,16 +133,20 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", virtual_network_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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 is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") + _params["force"] = _SERIALIZER.query("force", force, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -158,9 +160,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,12 +170,16 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", virtual_network_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -192,9 +196,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,10 +206,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,9 +226,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +235,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -269,7 +271,8 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any Implements VirtualNetwork GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -289,9 +292,7 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -306,8 +307,9 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,16 +348,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VirtualNetwork") @@ -375,8 +375,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -415,7 +416,8 @@ def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -452,7 +454,8 @@ def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -487,11 +490,12 @@ def begin_create_or_update( Onboards the ScVmm virtual network as an Azure virtual network resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -512,9 +516,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -562,7 +564,11 @@ def get_long_running_output(pipeline_response): } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_network_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_network_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -575,9 +581,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -593,19 +597,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}" @@ -613,19 +622,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( - self, resource_group_name: str, virtual_network_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + virtual_network_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements VirtualNetwork DELETE method. Deregisters the ScVmm virtual network from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -641,9 +655,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -700,16 +712,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -729,26 +739,28 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VirtualNetwork", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -770,7 +782,8 @@ def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -807,7 +820,8 @@ def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str @@ -838,11 +852,13 @@ def begin_update( Updates the VirtualNetworks resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param virtual_network_name: Name of the VirtualNetwork. Required. :type virtual_network_name: str - :param body: VirtualNetworks patch payload. Is either a model type or a IO type. Required. + :param body: VirtualNetworks patch payload. Is either a ResourcePatch type or a IO type. + Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -863,9 +879,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -918,7 +932,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite List of VirtualNetworks in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VirtualNetwork or the result of cls(response) @@ -928,9 +943,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -983,8 +996,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1015,9 +1029,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetwor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) error_map = { @@ -1069,8 +1081,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_guest_agents_operations.py new file mode 100644 index 000000000000..0ef0cec5e268 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_guest_agents_operations.py @@ -0,0 +1,579 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request(resource_uri: 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-10-07")) + 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", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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_request(resource_uri: 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-10-07")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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_uri: 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-10-07")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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_list_request(resource_uri: 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-10-07")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _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 VMInstanceGuestAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.scvmm.SCVMM`'s + :attr:`vm_instance_guest_agents` 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 _create_initial( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> _models.GuestAgent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.GuestAgent] = 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, "GuestAgent") + else: + _json = None + + request = build_create_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @overload + def begin_create( + self, + resource_uri: str, + body: Optional[_models.GuestAgent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.scvmm.models.GuestAgent + :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 GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.GuestAgent]: + """Implements GuestAgent PUT method. + + Create Or Update GuestAgent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. + :type body: ~azure.mgmt.scvmm.models.GuestAgent 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 GuestAgent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.scvmm.models.GuestAgent] + :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.GuestAgent] = 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_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GuestAgent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: + """Gets GuestAgent. + + Implements GuestAgent GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GuestAgent or the result of cls(response) + :rtype: ~azure.mgmt.scvmm.models.GuestAgent + :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.GuestAgent] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + 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("GuestAgent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Deletes an GuestAgent. + + Implements GuestAgent DELETE method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: 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_uri=resource_uri, + 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": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.GuestAgent"]: + """Implements GET GuestAgent in a vm. + + Returns the list of GuestAgent of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GuestAgent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.scvmm.models.GuestAgent] + :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.GuestAgentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GuestAgentList", 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) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents"} diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py index c49e89f68ea7..38df3b462e41 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,11 +55,15 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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,9 +80,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,11 +91,15 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -113,14 +113,17 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, vmm_server_name: str, subscription_id: str, *, force: Optional[bool] = None, **kwargs: Any + resource_group_name: str, + vmm_server_name: str, + subscription_id: str, + *, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,16 +133,20 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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 is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") + _params["force"] = _SERIALIZER.query("force", force, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -153,9 +160,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,12 +170,16 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "vmmServerName": _SERIALIZER.url("vmm_server_name", vmm_server_name, "str"), + "vmmServerName": _SERIALIZER.url( + "vmm_server_name", vmm_server_name, "str", max_length=54, min_length=1, pattern=r"[a-zA-Z0-9-_\.]" + ), } - _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") @@ -187,9 +196,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,10 +206,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,9 +226,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: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-06-05-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +235,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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") @@ -264,7 +271,8 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> Implements VMMServer GET method. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -284,9 +292,7 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServer] = kwargs.pop("cls", None) request = build_get_request( @@ -301,8 +307,9 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,16 +344,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "VMMServer") @@ -366,8 +371,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,7 +412,8 @@ def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -442,7 +449,8 @@ def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -472,11 +480,12 @@ def begin_create_or_update( Onboards the SCVMM fabric as an Azure VmmServer resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: Request payload. Is either a model type or a IO type. Required. + :param body: Request payload. Is either a VMMServer type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.VMMServer or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -496,9 +505,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -546,7 +553,11 @@ def get_long_running_output(pipeline_response): } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vmm_server_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + vmm_server_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -559,9 +570,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -577,19 +586,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}" @@ -597,19 +611,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( - self, resource_group_name: str, vmm_server_name: str, force: Optional[bool] = None, **kwargs: Any + self, + resource_group_name: str, + vmm_server_name: str, + force: Optional[Union[str, _models.Force]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements VmmServers DELETE method. - Deboards the SCVMM fabric from Azure. + Removes the SCVMM fabric from Azure. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str :param force: Forces the resource to be deleted from azure. The corresponding CR would be - attempted to be deleted too. Default value is None. - :type force: bool + attempted to be deleted too. Known values are: "false" and "true". Default value is None. + :type force: str or ~azure.mgmt.scvmm.models.Force :keyword callable cls: A custom type or function that will be passed the direct response :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 @@ -625,9 +644,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -684,16 +701,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "ResourcePatch") @@ -713,26 +728,28 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("VMMServer", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VMMServer", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -754,7 +771,8 @@ def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -790,7 +808,8 @@ def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str @@ -820,11 +839,12 @@ def begin_update( Updates the VmmServers resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vmm_server_name: Name of the VMMServer. Required. :type vmm_server_name: str - :param body: VmmServers patch payload. Is either a model type or a IO type. Required. + :param body: VmmServers patch payload. Is either a ResourcePatch type or a IO type. Required. :type body: ~azure.mgmt.scvmm.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -844,9 +864,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VMMServer] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -899,7 +917,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite List of VmmServers in a resource group. - :param resource_group_name: The name of the resource group. Required. + :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 VMMServer or the result of cls(response) @@ -909,9 +928,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -964,8 +981,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -996,9 +1014,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VMMServer"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-06-05-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VMMServerListResult] = kwargs.pop("cls", None) error_map = { @@ -1050,8 +1066,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py index 09aec99952ca..c8a034abcb04 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_availability_set.py @@ -31,7 +31,7 @@ def main(): response = client.availability_sets.begin_create_or_update( resource_group_name="testrg", - availability_set_name="HRAvailabilitySet", + availability_set_resource_name="HRAvailabilitySet", body={ "extendedLocation": { "name": "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso", @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine_instance.py new file mode 100644 index 000000000000..bca76c8deeea --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python create_checkpoint_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_create_checkpoint( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateCheckpointVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py index 41adcb45c5b9..2afedf18f66d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_cloud.py @@ -31,7 +31,7 @@ def main(): response = client.clouds.begin_create_or_update( resource_group_name="testrg", - cloud_name="HRCloud", + cloud_resource_name="HRCloud", body={ "extendedLocation": { "name": "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso", @@ -39,7 +39,7 @@ def main(): }, "location": "East US", "properties": { - "uuid": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "uuid": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "vmmServerId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer", }, }, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py index 36b1578a9690..1f7296e6cfa5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_inventory_item.py @@ -32,11 +32,11 @@ def main(): response = client.inventory_items.create( resource_group_name="testrg", vmm_server_name="ContosoVMMServer", - inventory_item_name="12345678-1234-1234-1234-123456789abc", + inventory_item_resource_name="12345678-1234-1234-1234-123456789abc", ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py deleted file mode 100644 index 5679ed55d3ed..000000000000 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-scvmm -# USAGE - python create_virtual_machine.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 = SCVMM( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_create_or_update( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - body={ - "extendedLocation": { - "name": "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso", - "type": "customLocation", - }, - "location": "East US", - "properties": { - "cloudId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/Clouds/HRCloud", - "hardwareProfile": {"cpuCount": 4, "memoryMB": 4096}, - "templateId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VirtualMachineTemplates/HRVirtualMachineTemplate", - "vmmServerId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_instance.py new file mode 100644 index 000000000000..691e81aa495c --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python create_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py index b1d17a5afc9f..588ead51df2d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_machine_template.py @@ -39,7 +39,7 @@ def main(): }, "location": "East US", "properties": { - "uuid": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "uuid": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "vmmServerId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer", }, }, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py index f7667df8ebf3..f53ecdbf6ff8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_virtual_network.py @@ -39,7 +39,7 @@ def main(): }, "location": "East US", "properties": { - "uuid": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "uuid": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "vmmServerId": "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer", }, }, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vm_instance_guest_agent.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vm_instance_guest_agent.py index 7dbe48ecad11..2cb5f8a1f569 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vm_instance_guest_agent.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python restart_virtual_machine.py + python create_vm_instance_guest_agent.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, @@ -26,16 +26,15 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_restart( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + response = client.vm_instance_guest_agents.begin_create( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestartVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateVMInstanceGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py index 298aa7396382..c01455636625 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_vmm_server.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/CreateVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py index 7001248e9f7d..db8e8d0ad079 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_availability_set.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.availability_sets.begin_delete( + client.availability_sets.begin_delete( resource_group_name="testrg", - availability_set_name="HRAvailabilitySet", + availability_set_resource_name="HRAvailabilitySet", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine_instance.py new file mode 100644 index 000000000000..57aef8fd7750 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python delete_checkpoint_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_delete_checkpoint( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteCheckpointVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py index fd345e085d25..2edbb07dbbeb 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_cloud.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clouds.begin_delete( + client.clouds.begin_delete( resource_group_name="testrg", - cloud_name="HRCloud", + cloud_resource_name="HRCloud", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py index 7c690d4e1a08..f048a412796e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_inventory_item.py @@ -29,14 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.inventory_items.delete( + client.inventory_items.delete( resource_group_name="testrg", vmm_server_name="ContosoVMMServer", - inventory_item_name="12345678-1234-1234-1234-123456789abc", + inventory_item_resource_name="12345678-1234-1234-1234-123456789abc", ) - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_instance.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_instance.py index 76084a1b9129..dd11ab57bb04 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_checkpoint_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python delete_checkpoint_virtual_machine.py + python delete_virtual_machine_instance.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, @@ -26,16 +26,14 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_delete_checkpoint( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.virtual_machine_instances.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCheckpointVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py index 7a01b0aedeea..9e498408e91a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine_template.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machine_templates.begin_delete( + client.virtual_machine_templates.begin_delete( resource_group_name="testrg", virtual_machine_template_name="HRVirtualMachineTemplate", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py index 405a98921563..71874dbe929e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_network.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_networks.begin_delete( + client.virtual_networks.begin_delete( resource_group_name="testrg", virtual_network_name="HRVirtualNetwork", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vm_instance_guest_agent.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vm_instance_guest_agent.py index d97c7cd87e2e..547d73c356f6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vm_instance_guest_agent.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python get_virtual_machine.py + python delete_vm_instance_guest_agent.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, @@ -26,16 +26,14 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.get( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.vm_instance_guest_agents.delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteVMInstanceGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py index c3404a219776..f0a2486f33e7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_vmm_server.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.vmm_servers.begin_delete( + client.vmm_servers.begin_delete( resource_group_name="testrg", vmm_server_name="ContosoVMMServer", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/DeleteVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py index 3479e2ac7730..4ae0449018b4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_availability_set.py @@ -31,11 +31,11 @@ def main(): response = client.availability_sets.get( resource_group_name="testrg", - availability_set_name="HRAvailabilitySet", + availability_set_resource_name="HRAvailabilitySet", ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py index 789b98c1d299..fe7ab4038aad 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_cloud.py @@ -31,11 +31,11 @@ def main(): response = client.clouds.get( resource_group_name="testrg", - cloud_name="HRCloud", + cloud_resource_name="HRCloud", ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py index 64395ae730ca..f2361b1b470b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_inventory_item.py @@ -32,11 +32,11 @@ def main(): response = client.inventory_items.get( resource_group_name="testrg", vmm_server_name="ContosoVMMServer", - inventory_item_name="12345678-1234-1234-1234-123456789abc", + inventory_item_resource_name="12345678-1234-1234-1234-123456789abc", ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetInventoryItem.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_instance.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_instance.py index 019b69ea9186..ae60291cf25b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/create_checkpoint_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python create_checkpoint_virtual_machine.py + python get_virtual_machine_instance.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, @@ -26,16 +26,15 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_create_checkpoint( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() + response = client.virtual_machine_instances.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCheckpointVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py index d6d986e23815..517bd3d2969c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py index 625426056ba5..f1e808ac83ff 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_guest_agent.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_guest_agent.py index 72e98c835370..987b760be56c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/delete_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_guest_agent.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python delete_virtual_machine.py + python get_vm_instance_guest_agent.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, @@ -26,16 +26,15 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_delete( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() + response = client.vm_instance_guest_agents.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVMInstanceGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_hybrid_identity_metadata.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_hybrid_identity_metadata.py new file mode 100644 index 000000000000..79b62dde0a5a --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vm_instance_hybrid_identity_metadata.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python get_vm_instance_hybrid_identity_metadata.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instance_hybrid_identity_metadata.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVmInstanceHybridIdentityMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py index e56728fba2c6..93f6e1239d22 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/get_vmm_server.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GetVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py new file mode 100644 index 000000000000..b5f9a9272625 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python hybrid_identity_metadata_list_by_vm_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instance_hybrid_identity_metadata.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/HybridIdentityMetadata_ListByVmInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py index cf19f30ca076..71250cdbb9fa 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListAvailabilitySetsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py index fe48ff92976b..a1f8b5869587 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_availability_sets_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListAvailabilitySetsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py index 1d5d832e52a8..1422d7e75fc9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListCloudsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py index f52eb9215a2d..b09482c1e3b7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_clouds_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListCloudsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py index c51bde92d0cd..c984b2785c77 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_inventory_items_by_vmm_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListInventoryItemsByVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListInventoryItemsByVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py index 52dc365c239b..c7a7acd5c2e2 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListOperations.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_instances.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_instances.py index 1f07268d39ce..ec85b4af406b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_instances.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python list_virtual_machines_by_resource_group.py + python list_virtual_machine_instances.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, @@ -26,16 +26,16 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.list_by_resource_group( - resource_group_name="testrg", + response = client.virtual_machine_instances.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVirtualMachineInstances.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py index f104f0d59b5e..9291cd62fe19 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVirtualMachineTemplatesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py index 5b83ad605544..077a94767242 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machine_templates_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVirtualMachineTemplatesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py index ca8357581634..7ed639b734c7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVirtualNetworksByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py index 1617caa7dca6..3de8b497f2be 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_networks_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVirtualNetworksBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py index 7e86e21d88ba..36a6daf8732a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersByResourceGroup.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVMMServersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py index d93d3a2f762d..fc28b61a3535 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_vmm_servers_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/ListVMMServersBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine_instance.py new file mode 100644 index 000000000000..5a52b3636e1e --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restart_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python restart_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_restart( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/RestartVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine_instance.py new file mode 100644 index 000000000000..38b56254fba3 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/restore_checkpoint_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python restore_checkpoint_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_restore_checkpoint( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/RestoreCheckpointVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine_instance.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine_instance.py index c561ca55c579..a971caaf728d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python stop_virtual_machine.py + python start_virtual_machine_instance.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, @@ -26,16 +26,14 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_stop( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.virtual_machine_instances.begin_start( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StopVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/StartVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine_instance.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine_instance.py index 5e085c79dfa7..f224d888d3de 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/start_virtual_machine.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/stop_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python start_virtual_machine.py + python stop_virtual_machine_instance.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, @@ -26,16 +26,14 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_start( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.virtual_machine_instances.begin_stop( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StartVirtualMachine.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/StopVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py index 1b478fd4e0b8..67ce3af790f1 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_availability_set.py @@ -31,12 +31,12 @@ def main(): response = client.availability_sets.begin_update( resource_group_name="testrg", - availability_set_name="HRAvailabilitySet", + availability_set_resource_name="HRAvailabilitySet", body={"tags": {"tag1": "value1", "tag2": "value2"}}, ).result() print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateAvailabilitySet.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py index b2c4f2aedaf0..3b304fb72cc5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_cloud.py @@ -31,12 +31,12 @@ def main(): response = client.clouds.begin_update( resource_group_name="testrg", - cloud_name="HRCloud", + cloud_resource_name="HRCloud", body={"tags": {"tag1": "value1", "tag2": "value2"}}, ).result() print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateCloud.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateCloud.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_instance.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_instance.py new file mode 100644 index 000000000000..875ca7823d8a --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.scvmm import SCVMM + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python update_virtual_machine_instance.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 = SCVMM( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py index 42aa0f887f2b..05c314a95df1 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_machine_template.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachineTemplate.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py index 0b9ebcca7e2a..fc7e4c316430 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_virtual_network.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualNetwork.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py index 434cb346e26f..0469367396c9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/update_vmm_server.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVMMServer.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/UpdateVMMServer.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_guest_agent_list_by_vm.py similarity index 77% rename from sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py rename to sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_guest_agent_list_by_vm.py index 5c76837814d3..6f1ec7570007 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/list_virtual_machines_by_subscription.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_guest_agent_list_by_vm.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-scvmm # USAGE - python list_virtual_machines_by_subscription.py + python vm_instance_guest_agent_list_by_vm.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, @@ -26,14 +26,16 @@ def main(): client = SCVMM( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.list_by_subscription() + response = client.vm_instance_guest_agents.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ) for item in response: print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesBySubscription.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VMInstanceGuestAgent_ListByVm.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json index fa7204443a7e..f5ae909e081c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json +++ b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json @@ -1,11 +1,11 @@ { - "commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/securityinsights/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py index 9b68f6af78ea..94c7b9d2f2b7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-12-01-preview"] = kwargs.pop("api_version", "2022-12-01-preview") + api_version: str = kwargs.pop("api_version", "2023-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py index 3cde4c860447..49c767997861 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py @@ -17,12 +17,19 @@ from ._serialization import Deserializer, Serializer from .operations import ( ActionsOperations, + AlertRuleOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, + BillingStatisticsOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, + ContentPackageOperations, + ContentPackagesOperations, + ContentTemplateOperations, + ContentTemplatesOperations, + DataConnectorDefinitionsOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, @@ -35,6 +42,10 @@ FileImportsOperations, GetOperations, GetRecommendationsOperations, + GetTriggeredAnalyticsRuleRunsOperations, + HuntCommentsOperations, + HuntRelationsOperations, + HuntsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, @@ -43,7 +54,11 @@ MetadataOperations, OfficeConsentsOperations, Operations, + ProductPackageOperations, + ProductPackagesOperations, ProductSettingsOperations, + ProductTemplateOperations, + ProductTemplatesOperations, SecurityMLAnalyticsSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, @@ -51,9 +66,15 @@ ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, + TriggeredAnalyticsRuleRunOperations, UpdateOperations, WatchlistItemsOperations, WatchlistsOperations, + WorkspaceManagerAssignmentJobsOperations, + WorkspaceManagerAssignmentsOperations, + WorkspaceManagerConfigurationsOperations, + WorkspaceManagerGroupsOperations, + WorkspaceManagerMembersOperations, ) if TYPE_CHECKING: @@ -73,20 +94,38 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to azure.mgmt.securityinsight.operations.AlertRuleTemplatesOperations :ivar automation_rules: AutomationRulesOperations operations :vartype automation_rules: azure.mgmt.securityinsight.operations.AutomationRulesOperations + :ivar entities: EntitiesOperations operations + :vartype entities: azure.mgmt.securityinsight.operations.EntitiesOperations :ivar incidents: IncidentsOperations operations :vartype incidents: azure.mgmt.securityinsight.operations.IncidentsOperations + :ivar billing_statistics: BillingStatisticsOperations operations + :vartype billing_statistics: azure.mgmt.securityinsight.operations.BillingStatisticsOperations :ivar bookmarks: BookmarksOperations operations :vartype bookmarks: azure.mgmt.securityinsight.operations.BookmarksOperations :ivar bookmark_relations: BookmarkRelationsOperations operations :vartype bookmark_relations: azure.mgmt.securityinsight.operations.BookmarkRelationsOperations :ivar bookmark: BookmarkOperations operations :vartype bookmark: azure.mgmt.securityinsight.operations.BookmarkOperations + :ivar content_packages: ContentPackagesOperations operations + :vartype content_packages: azure.mgmt.securityinsight.operations.ContentPackagesOperations + :ivar content_package: ContentPackageOperations operations + :vartype content_package: azure.mgmt.securityinsight.operations.ContentPackageOperations + :ivar product_packages: ProductPackagesOperations operations + :vartype product_packages: azure.mgmt.securityinsight.operations.ProductPackagesOperations + :ivar product_package: ProductPackageOperations operations + :vartype product_package: azure.mgmt.securityinsight.operations.ProductPackageOperations + :ivar product_templates: ProductTemplatesOperations operations + :vartype product_templates: azure.mgmt.securityinsight.operations.ProductTemplatesOperations + :ivar product_template: ProductTemplateOperations operations + :vartype product_template: azure.mgmt.securityinsight.operations.ProductTemplateOperations + :ivar content_templates: ContentTemplatesOperations operations + :vartype content_templates: azure.mgmt.securityinsight.operations.ContentTemplatesOperations + :ivar content_template: ContentTemplateOperations operations + :vartype content_template: azure.mgmt.securityinsight.operations.ContentTemplateOperations :ivar ip_geodata: IPGeodataOperations operations :vartype ip_geodata: azure.mgmt.securityinsight.operations.IPGeodataOperations :ivar domain_whois: DomainWhoisOperations operations :vartype domain_whois: azure.mgmt.securityinsight.operations.DomainWhoisOperations - :ivar entities: EntitiesOperations operations - :vartype entities: azure.mgmt.securityinsight.operations.EntitiesOperations :ivar entities_get_timeline: EntitiesGetTimelineOperations operations :vartype entities_get_timeline: azure.mgmt.securityinsight.operations.EntitiesGetTimelineOperations @@ -101,6 +140,12 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to azure.mgmt.securityinsight.operations.EntityQueryTemplatesOperations :ivar file_imports: FileImportsOperations operations :vartype file_imports: azure.mgmt.securityinsight.operations.FileImportsOperations + :ivar hunts: HuntsOperations operations + :vartype hunts: azure.mgmt.securityinsight.operations.HuntsOperations + :ivar hunt_relations: HuntRelationsOperations operations + :vartype hunt_relations: azure.mgmt.securityinsight.operations.HuntRelationsOperations + :ivar hunt_comments: HuntCommentsOperations operations + :vartype hunt_comments: azure.mgmt.securityinsight.operations.HuntCommentsOperations :ivar incident_comments: IncidentCommentsOperations operations :vartype incident_comments: azure.mgmt.securityinsight.operations.IncidentCommentsOperations :ivar incident_relations: IncidentRelationsOperations operations @@ -140,10 +185,36 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to operations :vartype threat_intelligence_indicator_metrics: azure.mgmt.securityinsight.operations.ThreatIntelligenceIndicatorMetricsOperations + :ivar triggered_analytics_rule_run: TriggeredAnalyticsRuleRunOperations operations + :vartype triggered_analytics_rule_run: + azure.mgmt.securityinsight.operations.TriggeredAnalyticsRuleRunOperations + :ivar get_triggered_analytics_rule_runs: GetTriggeredAnalyticsRuleRunsOperations operations + :vartype get_triggered_analytics_rule_runs: + azure.mgmt.securityinsight.operations.GetTriggeredAnalyticsRuleRunsOperations + :ivar alert_rule: AlertRuleOperations operations + :vartype alert_rule: azure.mgmt.securityinsight.operations.AlertRuleOperations :ivar watchlists: WatchlistsOperations operations :vartype watchlists: azure.mgmt.securityinsight.operations.WatchlistsOperations :ivar watchlist_items: WatchlistItemsOperations operations :vartype watchlist_items: azure.mgmt.securityinsight.operations.WatchlistItemsOperations + :ivar workspace_manager_assignments: WorkspaceManagerAssignmentsOperations operations + :vartype workspace_manager_assignments: + azure.mgmt.securityinsight.operations.WorkspaceManagerAssignmentsOperations + :ivar workspace_manager_assignment_jobs: WorkspaceManagerAssignmentJobsOperations operations + :vartype workspace_manager_assignment_jobs: + azure.mgmt.securityinsight.operations.WorkspaceManagerAssignmentJobsOperations + :ivar workspace_manager_configurations: WorkspaceManagerConfigurationsOperations operations + :vartype workspace_manager_configurations: + azure.mgmt.securityinsight.operations.WorkspaceManagerConfigurationsOperations + :ivar workspace_manager_groups: WorkspaceManagerGroupsOperations operations + :vartype workspace_manager_groups: + azure.mgmt.securityinsight.operations.WorkspaceManagerGroupsOperations + :ivar workspace_manager_members: WorkspaceManagerMembersOperations operations + :vartype workspace_manager_members: + azure.mgmt.securityinsight.operations.WorkspaceManagerMembersOperations + :ivar data_connector_definitions: DataConnectorDefinitionsOperations operations + :vartype data_connector_definitions: + azure.mgmt.securityinsight.operations.DataConnectorDefinitionsOperations :ivar data_connectors: DataConnectorsOperations operations :vartype data_connectors: azure.mgmt.securityinsight.operations.DataConnectorsOperations :ivar data_connectors_check_requirements: DataConnectorsCheckRequirementsOperations operations @@ -157,7 +228,7 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -172,7 +243,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SecurityInsightsConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -186,15 +257,38 @@ def __init__( self.automation_rules = AutomationRulesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.billing_statistics = BillingStatisticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) self.bookmark_relations = BookmarkRelationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.bookmark = BookmarkOperations(self._client, self._config, self._serialize, self._deserialize) + self.content_packages = ContentPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_package = ContentPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_packages = ProductPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_package = ProductPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_templates = ProductTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_template = ProductTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_templates = ContentTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_template = ContentTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.ip_geodata = IPGeodataOperations(self._client, self._config, self._serialize, self._deserialize) self.domain_whois = DomainWhoisOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) self.entities_get_timeline = EntitiesGetTimelineOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -209,6 +303,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.file_imports = FileImportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunts = HuntsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunt_relations = HuntRelationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunt_comments = HuntCommentsOperations(self._client, self._config, self._serialize, self._deserialize) self.incident_comments = IncidentCommentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -243,8 +340,33 @@ def __init__( self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.triggered_analytics_rule_run = TriggeredAnalyticsRuleRunOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.get_triggered_analytics_rule_runs = GetTriggeredAnalyticsRuleRunsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.alert_rule = AlertRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.watchlists = WatchlistsOperations(self._client, self._config, self._serialize, self._deserialize) self.watchlist_items = WatchlistItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_manager_assignments = WorkspaceManagerAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_assignment_jobs = WorkspaceManagerAssignmentJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_configurations = WorkspaceManagerConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_groups = WorkspaceManagerGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_members = WorkspaceManagerMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connector_definitions = DataConnectorDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations( self._client, self._config, self._serialize, self._deserialize @@ -280,5 +402,5 @@ def __enter__(self) -> "SecurityInsights": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_serialization.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_serialization.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ 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)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,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 str(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) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,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): @@ -875,9 +906,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) @@ -922,7 +958,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: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py index 2eda20789583..e5754a47ce68 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_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/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py index e334994b3258..94a6d0b28f6d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-12-01-preview"] = kwargs.pop("api_version", "2022-12-01-preview") + api_version: str = kwargs.pop("api_version", "2023-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py index 6a0f5faa2f24..4772e338488b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py @@ -17,12 +17,19 @@ from ._configuration import SecurityInsightsConfiguration from .operations import ( ActionsOperations, + AlertRuleOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, + BillingStatisticsOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, + ContentPackageOperations, + ContentPackagesOperations, + ContentTemplateOperations, + ContentTemplatesOperations, + DataConnectorDefinitionsOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, @@ -35,6 +42,10 @@ FileImportsOperations, GetOperations, GetRecommendationsOperations, + GetTriggeredAnalyticsRuleRunsOperations, + HuntCommentsOperations, + HuntRelationsOperations, + HuntsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, @@ -43,7 +54,11 @@ MetadataOperations, OfficeConsentsOperations, Operations, + ProductPackageOperations, + ProductPackagesOperations, ProductSettingsOperations, + ProductTemplateOperations, + ProductTemplatesOperations, SecurityMLAnalyticsSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, @@ -51,9 +66,15 @@ ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, + TriggeredAnalyticsRuleRunOperations, UpdateOperations, WatchlistItemsOperations, WatchlistsOperations, + WorkspaceManagerAssignmentJobsOperations, + WorkspaceManagerAssignmentsOperations, + WorkspaceManagerConfigurationsOperations, + WorkspaceManagerGroupsOperations, + WorkspaceManagerMembersOperations, ) if TYPE_CHECKING: @@ -73,8 +94,13 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to azure.mgmt.securityinsight.aio.operations.AlertRuleTemplatesOperations :ivar automation_rules: AutomationRulesOperations operations :vartype automation_rules: azure.mgmt.securityinsight.aio.operations.AutomationRulesOperations + :ivar entities: EntitiesOperations operations + :vartype entities: azure.mgmt.securityinsight.aio.operations.EntitiesOperations :ivar incidents: IncidentsOperations operations :vartype incidents: azure.mgmt.securityinsight.aio.operations.IncidentsOperations + :ivar billing_statistics: BillingStatisticsOperations operations + :vartype billing_statistics: + azure.mgmt.securityinsight.aio.operations.BillingStatisticsOperations :ivar bookmarks: BookmarksOperations operations :vartype bookmarks: azure.mgmt.securityinsight.aio.operations.BookmarksOperations :ivar bookmark_relations: BookmarkRelationsOperations operations @@ -82,12 +108,28 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to azure.mgmt.securityinsight.aio.operations.BookmarkRelationsOperations :ivar bookmark: BookmarkOperations operations :vartype bookmark: azure.mgmt.securityinsight.aio.operations.BookmarkOperations + :ivar content_packages: ContentPackagesOperations operations + :vartype content_packages: azure.mgmt.securityinsight.aio.operations.ContentPackagesOperations + :ivar content_package: ContentPackageOperations operations + :vartype content_package: azure.mgmt.securityinsight.aio.operations.ContentPackageOperations + :ivar product_packages: ProductPackagesOperations operations + :vartype product_packages: azure.mgmt.securityinsight.aio.operations.ProductPackagesOperations + :ivar product_package: ProductPackageOperations operations + :vartype product_package: azure.mgmt.securityinsight.aio.operations.ProductPackageOperations + :ivar product_templates: ProductTemplatesOperations operations + :vartype product_templates: + azure.mgmt.securityinsight.aio.operations.ProductTemplatesOperations + :ivar product_template: ProductTemplateOperations operations + :vartype product_template: azure.mgmt.securityinsight.aio.operations.ProductTemplateOperations + :ivar content_templates: ContentTemplatesOperations operations + :vartype content_templates: + azure.mgmt.securityinsight.aio.operations.ContentTemplatesOperations + :ivar content_template: ContentTemplateOperations operations + :vartype content_template: azure.mgmt.securityinsight.aio.operations.ContentTemplateOperations :ivar ip_geodata: IPGeodataOperations operations :vartype ip_geodata: azure.mgmt.securityinsight.aio.operations.IPGeodataOperations :ivar domain_whois: DomainWhoisOperations operations :vartype domain_whois: azure.mgmt.securityinsight.aio.operations.DomainWhoisOperations - :ivar entities: EntitiesOperations operations - :vartype entities: azure.mgmt.securityinsight.aio.operations.EntitiesOperations :ivar entities_get_timeline: EntitiesGetTimelineOperations operations :vartype entities_get_timeline: azure.mgmt.securityinsight.aio.operations.EntitiesGetTimelineOperations @@ -103,6 +145,12 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to azure.mgmt.securityinsight.aio.operations.EntityQueryTemplatesOperations :ivar file_imports: FileImportsOperations operations :vartype file_imports: azure.mgmt.securityinsight.aio.operations.FileImportsOperations + :ivar hunts: HuntsOperations operations + :vartype hunts: azure.mgmt.securityinsight.aio.operations.HuntsOperations + :ivar hunt_relations: HuntRelationsOperations operations + :vartype hunt_relations: azure.mgmt.securityinsight.aio.operations.HuntRelationsOperations + :ivar hunt_comments: HuntCommentsOperations operations + :vartype hunt_comments: azure.mgmt.securityinsight.aio.operations.HuntCommentsOperations :ivar incident_comments: IncidentCommentsOperations operations :vartype incident_comments: azure.mgmt.securityinsight.aio.operations.IncidentCommentsOperations @@ -144,10 +192,36 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to operations :vartype threat_intelligence_indicator_metrics: azure.mgmt.securityinsight.aio.operations.ThreatIntelligenceIndicatorMetricsOperations + :ivar triggered_analytics_rule_run: TriggeredAnalyticsRuleRunOperations operations + :vartype triggered_analytics_rule_run: + azure.mgmt.securityinsight.aio.operations.TriggeredAnalyticsRuleRunOperations + :ivar get_triggered_analytics_rule_runs: GetTriggeredAnalyticsRuleRunsOperations operations + :vartype get_triggered_analytics_rule_runs: + azure.mgmt.securityinsight.aio.operations.GetTriggeredAnalyticsRuleRunsOperations + :ivar alert_rule: AlertRuleOperations operations + :vartype alert_rule: azure.mgmt.securityinsight.aio.operations.AlertRuleOperations :ivar watchlists: WatchlistsOperations operations :vartype watchlists: azure.mgmt.securityinsight.aio.operations.WatchlistsOperations :ivar watchlist_items: WatchlistItemsOperations operations :vartype watchlist_items: azure.mgmt.securityinsight.aio.operations.WatchlistItemsOperations + :ivar workspace_manager_assignments: WorkspaceManagerAssignmentsOperations operations + :vartype workspace_manager_assignments: + azure.mgmt.securityinsight.aio.operations.WorkspaceManagerAssignmentsOperations + :ivar workspace_manager_assignment_jobs: WorkspaceManagerAssignmentJobsOperations operations + :vartype workspace_manager_assignment_jobs: + azure.mgmt.securityinsight.aio.operations.WorkspaceManagerAssignmentJobsOperations + :ivar workspace_manager_configurations: WorkspaceManagerConfigurationsOperations operations + :vartype workspace_manager_configurations: + azure.mgmt.securityinsight.aio.operations.WorkspaceManagerConfigurationsOperations + :ivar workspace_manager_groups: WorkspaceManagerGroupsOperations operations + :vartype workspace_manager_groups: + azure.mgmt.securityinsight.aio.operations.WorkspaceManagerGroupsOperations + :ivar workspace_manager_members: WorkspaceManagerMembersOperations operations + :vartype workspace_manager_members: + azure.mgmt.securityinsight.aio.operations.WorkspaceManagerMembersOperations + :ivar data_connector_definitions: DataConnectorDefinitionsOperations operations + :vartype data_connector_definitions: + azure.mgmt.securityinsight.aio.operations.DataConnectorDefinitionsOperations :ivar data_connectors: DataConnectorsOperations operations :vartype data_connectors: azure.mgmt.securityinsight.aio.operations.DataConnectorsOperations :ivar data_connectors_check_requirements: DataConnectorsCheckRequirementsOperations operations @@ -161,7 +235,7 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -176,7 +250,7 @@ def __init__( **kwargs: Any ) -> None: self._config = SecurityInsightsConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -190,15 +264,38 @@ def __init__( self.automation_rules = AutomationRulesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.billing_statistics = BillingStatisticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) self.bookmark_relations = BookmarkRelationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.bookmark = BookmarkOperations(self._client, self._config, self._serialize, self._deserialize) + self.content_packages = ContentPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_package = ContentPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_packages = ProductPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_package = ProductPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_templates = ProductTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_template = ProductTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_templates = ContentTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.content_template = ContentTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.ip_geodata = IPGeodataOperations(self._client, self._config, self._serialize, self._deserialize) self.domain_whois = DomainWhoisOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) self.entities_get_timeline = EntitiesGetTimelineOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -213,6 +310,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.file_imports = FileImportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunts = HuntsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunt_relations = HuntRelationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hunt_comments = HuntCommentsOperations(self._client, self._config, self._serialize, self._deserialize) self.incident_comments = IncidentCommentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -247,8 +347,33 @@ def __init__( self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.triggered_analytics_rule_run = TriggeredAnalyticsRuleRunOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.get_triggered_analytics_rule_runs = GetTriggeredAnalyticsRuleRunsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.alert_rule = AlertRuleOperations(self._client, self._config, self._serialize, self._deserialize) self.watchlists = WatchlistsOperations(self._client, self._config, self._serialize, self._deserialize) self.watchlist_items = WatchlistItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_manager_assignments = WorkspaceManagerAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_assignment_jobs = WorkspaceManagerAssignmentJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_configurations = WorkspaceManagerConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_groups = WorkspaceManagerGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.workspace_manager_members = WorkspaceManagerMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connector_definitions = DataConnectorDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations( self._client, self._config, self._serialize, self._deserialize @@ -284,5 +409,5 @@ async def __aenter__(self) -> "SecurityInsights": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py index 802d895ef601..3cef9c159131 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py @@ -10,19 +10,31 @@ from ._actions_operations import ActionsOperations from ._alert_rule_templates_operations import AlertRuleTemplatesOperations from ._automation_rules_operations import AutomationRulesOperations +from ._entities_operations import EntitiesOperations from ._incidents_operations import IncidentsOperations +from ._billing_statistics_operations import BillingStatisticsOperations from ._bookmarks_operations import BookmarksOperations from ._bookmark_relations_operations import BookmarkRelationsOperations from ._bookmark_operations import BookmarkOperations +from ._content_packages_operations import ContentPackagesOperations +from ._content_package_operations import ContentPackageOperations +from ._product_packages_operations import ProductPackagesOperations +from ._product_package_operations import ProductPackageOperations +from ._product_templates_operations import ProductTemplatesOperations +from ._product_template_operations import ProductTemplateOperations +from ._content_templates_operations import ContentTemplatesOperations +from ._content_template_operations import ContentTemplateOperations from ._ip_geodata_operations import IPGeodataOperations from ._domain_whois_operations import DomainWhoisOperations -from ._entities_operations import EntitiesOperations from ._entities_get_timeline_operations import EntitiesGetTimelineOperations from ._entities_relations_operations import EntitiesRelationsOperations from ._entity_relations_operations import EntityRelationsOperations from ._entity_queries_operations import EntityQueriesOperations from ._entity_query_templates_operations import EntityQueryTemplatesOperations from ._file_imports_operations import FileImportsOperations +from ._hunts_operations import HuntsOperations +from ._hunt_relations_operations import HuntRelationsOperations +from ._hunt_comments_operations import HuntCommentsOperations from ._incident_comments_operations import IncidentCommentsOperations from ._incident_relations_operations import IncidentRelationsOperations from ._incident_tasks_operations import IncidentTasksOperations @@ -39,8 +51,17 @@ from ._threat_intelligence_indicator_operations import ThreatIntelligenceIndicatorOperations from ._threat_intelligence_indicators_operations import ThreatIntelligenceIndicatorsOperations from ._threat_intelligence_indicator_metrics_operations import ThreatIntelligenceIndicatorMetricsOperations +from ._triggered_analytics_rule_run_operations import TriggeredAnalyticsRuleRunOperations +from ._get_triggered_analytics_rule_runs_operations import GetTriggeredAnalyticsRuleRunsOperations +from ._alert_rule_operations import AlertRuleOperations from ._watchlists_operations import WatchlistsOperations from ._watchlist_items_operations import WatchlistItemsOperations +from ._workspace_manager_assignments_operations import WorkspaceManagerAssignmentsOperations +from ._workspace_manager_assignment_jobs_operations import WorkspaceManagerAssignmentJobsOperations +from ._workspace_manager_configurations_operations import WorkspaceManagerConfigurationsOperations +from ._workspace_manager_groups_operations import WorkspaceManagerGroupsOperations +from ._workspace_manager_members_operations import WorkspaceManagerMembersOperations +from ._data_connector_definitions_operations import DataConnectorDefinitionsOperations from ._data_connectors_operations import DataConnectorsOperations from ._data_connectors_check_requirements_operations import DataConnectorsCheckRequirementsOperations from ._operations import Operations @@ -54,19 +75,31 @@ "ActionsOperations", "AlertRuleTemplatesOperations", "AutomationRulesOperations", + "EntitiesOperations", "IncidentsOperations", + "BillingStatisticsOperations", "BookmarksOperations", "BookmarkRelationsOperations", "BookmarkOperations", + "ContentPackagesOperations", + "ContentPackageOperations", + "ProductPackagesOperations", + "ProductPackageOperations", + "ProductTemplatesOperations", + "ProductTemplateOperations", + "ContentTemplatesOperations", + "ContentTemplateOperations", "IPGeodataOperations", "DomainWhoisOperations", - "EntitiesOperations", "EntitiesGetTimelineOperations", "EntitiesRelationsOperations", "EntityRelationsOperations", "EntityQueriesOperations", "EntityQueryTemplatesOperations", "FileImportsOperations", + "HuntsOperations", + "HuntRelationsOperations", + "HuntCommentsOperations", "IncidentCommentsOperations", "IncidentRelationsOperations", "IncidentTasksOperations", @@ -83,8 +116,17 @@ "ThreatIntelligenceIndicatorOperations", "ThreatIntelligenceIndicatorsOperations", "ThreatIntelligenceIndicatorMetricsOperations", + "TriggeredAnalyticsRuleRunOperations", + "GetTriggeredAnalyticsRuleRunsOperations", + "AlertRuleOperations", "WatchlistsOperations", "WatchlistItemsOperations", + "WorkspaceManagerAssignmentsOperations", + "WorkspaceManagerAssignmentJobsOperations", + "WorkspaceManagerConfigurationsOperations", + "WorkspaceManagerGroupsOperations", + "WorkspaceManagerMembersOperations", + "DataConnectorDefinitionsOperations", "DataConnectorsOperations", "DataConnectorsCheckRequirementsOperations", "Operations", diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py index 9e3b782688be..b0a1ad37203f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_by_alert_rule_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ def list_by_alert_rule( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActionsList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +136,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActionResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -209,8 +202,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +313,7 @@ async def create_or_update( :type rule_id: str :param action_id: Action ID. Required. :type action_id: str - :param action: The action. Is either a model type or a IO type. Required. + :param action: The action. Is either a ActionRequest type or a IO type. Required. :type action: ~azure.mgmt.securityinsight.models.ActionRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -340,16 +334,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ActionResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(action, (IO, bytes)): + if isinstance(action, (IOBase, bytes)): _content = action else: _json = self._serialize.body(action, "ActionRequest") @@ -371,8 +363,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,9 +420,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -446,8 +437,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_operations.py new file mode 100644 index 000000000000..12aff61ad0db --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_operations.py @@ -0,0 +1,287 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._alert_rule_operations import build_trigger_rule_run_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AlertRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`alert_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") + + async def _trigger_rule_run_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: Union[_models.AnalyticsRuleRunTrigger, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(analytics_rule_run_trigger_parameter, (IOBase, bytes)): + _content = analytics_rule_run_trigger_parameter + else: + _json = self._serialize.body(analytics_rule_run_trigger_parameter, "AnalyticsRuleRunTrigger") + + request = build_trigger_rule_run_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._trigger_rule_run_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_rule_run_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun" + } + + @overload + async def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: _models.AnalyticsRuleRunTrigger, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. + Required. + :type analytics_rule_run_trigger_parameter: + ~azure.mgmt.securityinsight.models.AnalyticsRuleRunTrigger + :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: + """ + + @overload + async def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. + Required. + :type analytics_rule_run_trigger_parameter: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: Union[_models.AnalyticsRuleRunTrigger, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. Is + either a AnalyticsRuleRunTrigger type or a IO type. Required. + :type analytics_rule_run_trigger_parameter: + ~azure.mgmt.securityinsight.models.AnalyticsRuleRunTrigger or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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._trigger_rule_run_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + analytics_rule_run_trigger_parameter=analytics_rule_run_trigger_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_trigger_rule_run.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py index c4517e99abe7..a0bcf9d8d054 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._alert_rule_templates_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,9 +73,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRuleTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -134,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,9 +174,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRuleTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -198,8 +190,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py index 856b3843f35a..6fa74b0a68ed 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRulesList] = kwargs.pop("cls", None) error_map = { @@ -136,8 +130,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,9 +177,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRule] = kwargs.pop("cls", None) request = build_get_request( @@ -200,8 +193,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,7 +295,7 @@ async def create_or_update( :type workspace_name: str :param rule_id: Alert rule ID. Required. :type rule_id: str - :param alert_rule: The alert rule. Is either a model type or a IO type. Required. + :param alert_rule: The alert rule. Is either a AlertRule type or a IO type. Required. :type alert_rule: ~azure.mgmt.securityinsight.models.AlertRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -322,16 +316,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AlertRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_rule, (IO, bytes)): + if isinstance(alert_rule, (IOBase, bytes)): _content = alert_rule else: _json = self._serialize.body(alert_rule, "AlertRule") @@ -352,8 +344,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,9 +399,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -424,8 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py index 9040a09fd9bf..1401e9728256 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py @@ -6,6 +6,7 @@ # 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, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +41,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,9 +94,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationRule] = kwargs.pop("cls", None) request = build_get_request( @@ -115,8 +110,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,8 +212,8 @@ async def create_or_update( :type workspace_name: str :param automation_rule_id: Automation rule ID. Required. :type automation_rule_id: str - :param automation_rule_to_upsert: The automation rule. Is either a model type or a IO type. - Default value is None. + :param automation_rule_to_upsert: The automation rule. Is either a AutomationRule type or a IO + type. Default value is None. :type automation_rule_to_upsert: ~azure.mgmt.securityinsight.models.AutomationRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -238,16 +234,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AutomationRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation_rule_to_upsert, (IO, bytes)): + if isinstance(automation_rule_to_upsert, (IOBase, bytes)): _content = automation_rule_to_upsert else: if automation_rule_to_upsert is not None: @@ -271,8 +265,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,9 +320,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_delete_request( @@ -343,8 +336,9 @@ async def delete( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,9 +382,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationRulesList] = kwargs.pop("cls", None) error_map = { @@ -444,8 +436,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_billing_statistics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_billing_statistics_operations.py new file mode 100644 index 000000000000..797f6490f5ce --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_billing_statistics_operations.py @@ -0,0 +1,215 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._billing_statistics_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BillingStatisticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`billing_statistics` 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.BillingStatistic"]: + """Gets all Microsoft Sentinel billing statistics. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 BillingStatistic or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.BillingStatistic] + :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.BillingStatisticList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BillingStatisticList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, billing_statistic_name: str, **kwargs: Any + ) -> _models.BillingStatistic: + """Gets a billing statistic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param billing_statistic_name: The name of the billing statistic. Required. + :type billing_statistic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BillingStatistic or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.BillingStatistic + :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.BillingStatistic] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + billing_statistic_name=billing_statistic_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 = 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("BillingStatistic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics/{billingStatisticName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py index e87871dba5df..bf09c0d0a737 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._bookmark_operations import build_expand_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -138,7 +134,7 @@ async def expand( :param bookmark_id: Bookmark ID. Required. :type bookmark_id: str :param parameters: The parameters required to execute an expand operation on the given - bookmark. Is either a model type or a IO type. Required. + bookmark. Is either a BookmarkExpandParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.BookmarkExpandParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -159,16 +155,14 @@ async def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BookmarkExpandResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BookmarkExpandParameters") @@ -189,8 +183,9 @@ async def expand( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py index 237aca3682c1..b440c1c6eaef 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,9 +100,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -165,8 +159,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,9 +208,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_request( @@ -232,8 +225,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,7 +336,7 @@ async def create_or_update( :type bookmark_id: str :param relation_name: Relation Name. Required. :type relation_name: str - :param relation: The relation model. Is either a model type or a IO type. Required. + :param relation: The relation model. Is either a Relation type or a IO type. Required. :type relation: ~azure.mgmt.securityinsight.models.Relation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -363,16 +357,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Relation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(relation, (IO, bytes)): + if isinstance(relation, (IOBase, bytes)): _content = relation else: _json = self._serialize.body(relation, "Relation") @@ -394,8 +386,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,9 +443,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -469,8 +460,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py index b9783e8fa1e7..8a4af9d80b9f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BookmarkList] = kwargs.pop("cls", None) error_map = { @@ -136,8 +130,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,9 +177,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Bookmark] = kwargs.pop("cls", None) request = build_get_request( @@ -200,8 +193,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,7 +295,7 @@ async def create_or_update( :type workspace_name: str :param bookmark_id: Bookmark ID. Required. :type bookmark_id: str - :param bookmark: The bookmark. Is either a model type or a IO type. Required. + :param bookmark: The bookmark. Is either a Bookmark type or a IO type. Required. :type bookmark: ~azure.mgmt.securityinsight.models.Bookmark or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -322,16 +316,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Bookmark] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(bookmark, (IO, bytes)): + if isinstance(bookmark, (IOBase, bytes)): _content = bookmark else: _json = self._serialize.body(bookmark, "Bookmark") @@ -352,8 +344,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,9 +399,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -424,8 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_package_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_package_operations.py new file mode 100644 index 000000000000..07d65f75b889 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_package_operations.py @@ -0,0 +1,271 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._content_package_operations import build_install_request, build_uninstall_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContentPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`content_package` 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 install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: _models.PackageModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Required. + :type package_installation_properties: ~azure.mgmt.securityinsight.models.PackageModel + :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: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Required. + :type package_installation_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: Union[_models.PackageModel, IO], + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Is either a + PackageModel type or a IO type. Required. + :type package_installation_properties: ~azure.mgmt.securityinsight.models.PackageModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(package_installation_properties, (IOBase, bytes)): + _content = package_installation_properties + else: + _json = self._serialize.body(package_installation_properties, "PackageModel") + + request = build_install_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.install.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PackageModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + install.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } + + @distributed_trace_async + async def uninstall( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> None: + """Uninstall a package from 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_uninstall_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.uninstall.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + uninstall.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_packages_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_packages_operations.py new file mode 100644 index 000000000000..1e61cd3d4579 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_packages_operations.py @@ -0,0 +1,250 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._content_packages_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContentPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`content_packages` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PackageModel"]: + """Gets all installed packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PackageModel or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.PackageModel] + :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.PackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PackageList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> _models.PackageModel: + """Gets an installed packages by its id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :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.PackageModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_template_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_template_operations.py new file mode 100644 index 000000000000..dd55fa3aa012 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_template_operations.py @@ -0,0 +1,343 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._content_template_operations import build_delete_request, build_get_request, build_install_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContentTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`content_template` 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 install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: _models.TemplateModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Required. + :type template_installation_properties: ~azure.mgmt.securityinsight.models.TemplateModel + :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: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Required. + :type template_installation_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: Union[_models.TemplateModel, IO], + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Is either a + TemplateModel type or a IO type. Required. + :type template_installation_properties: ~azure.mgmt.securityinsight.models.TemplateModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.TemplateModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(template_installation_properties, (IOBase, bytes)): + _content = template_installation_properties + else: + _json = self._serialize.body(template_installation_properties, "TemplateModel") + + request = build_install_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.install.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + install.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> _models.TemplateModel: + """Gets a template byt its identifier. + Expandable properties: + + + * properties/mainTemplate + * properties/dependantTemplates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :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.TemplateModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> None: + """Delete an installed template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_id=template_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_templates_operations.py new file mode 100644 index 000000000000..11746b8a3022 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_content_templates_operations.py @@ -0,0 +1,192 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._content_templates_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContentTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`content_templates` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + expand: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.TemplateModel"]: + """Gets all installed templates. + Expandable properties: + + + * properties/mainTemplate + * properties/dependantTemplates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param expand: Expands the object with optional fiends that are not included by default. + Optional. Default value is None. + :type expand: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TemplateModel or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.TemplateModel] + :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.TemplateList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + expand=expand, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TemplateList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connector_definitions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connector_definitions_operations.py new file mode 100644 index 000000000000..fe5e39ff25ba --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connector_definitions_operations.py @@ -0,0 +1,440 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_connector_definitions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataConnectorDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`data_connector_definitions` 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.DataConnectorDefinition"]: + """Gets all data connector definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 DataConnectorDefinition or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.DataConnectorDefinition] + :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.DataConnectorDefinitionArmCollectionWrapper] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataConnectorDefinitionArmCollectionWrapper", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, data_connector_definition_name: str, **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Gets a data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :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.DataConnectorDefinition] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_definition_name=data_connector_definition_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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataConnectorDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: _models.DataConnectorDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Required. + :type connector_definition_input: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :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: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Required. + :type connector_definition_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: Union[_models.DataConnectorDefinition, IO], + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Is either a + DataConnectorDefinition type or a IO type. Required. + :type connector_definition_input: ~azure.mgmt.securityinsight.models.DataConnectorDefinition or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DataConnectorDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connector_definition_input, (IOBase, bytes)): + _content = connector_definition_input + else: + _json = self._serialize.body(connector_definition_input, "DataConnectorDefinition") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_definition_name=data_connector_definition_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DataConnectorDefinition", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DataConnectorDefinition", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, data_connector_definition_name: str, **kwargs: Any + ) -> None: + """Delete the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_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, + data_connector_definition_name=data_connector_definition_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py index ad27dbca1787..afd1aa6ef510 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._data_connectors_check_requirements_operations import build_post_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +126,7 @@ async def post( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param data_connectors_check_requirements: The parameters for requirements check message. Is - either a model type or a IO type. Required. + either a DataConnectorsCheckRequirements type or a IO type. Required. :type data_connectors_check_requirements: ~azure.mgmt.securityinsight.models.DataConnectorsCheckRequirements or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -152,16 +148,14 @@ async def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataConnectorRequirementsState] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_connectors_check_requirements, (IO, bytes)): + if isinstance(data_connectors_check_requirements, (IOBase, bytes)): _content = data_connectors_check_requirements else: _json = self._serialize.body(data_connectors_check_requirements, "DataConnectorsCheckRequirements") @@ -181,8 +175,9 @@ async def post( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py index 3e9a9ea01f82..4dbbffc3b02c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataConnectorList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +135,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,9 +182,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +198,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,7 +300,8 @@ async def create_or_update( :type workspace_name: str :param data_connector_id: Connector ID. Required. :type data_connector_id: str - :param data_connector: The data connector. Is either a model type or a IO type. Required. + :param data_connector: The data connector. Is either a DataConnector type or a IO type. + Required. :type data_connector: ~azure.mgmt.securityinsight.models.DataConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -327,16 +322,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_connector, (IO, bytes)): + if isinstance(data_connector, (IOBase, bytes)): _content = data_connector else: _json = self._serialize.body(data_connector, "DataConnector") @@ -357,8 +350,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,9 +405,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -429,8 +421,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,7 +519,8 @@ async def connect( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param data_connector_id: Connector ID. Required. :type data_connector_id: str - :param connect_body: The data connector. Is either a model type or a IO type. Required. + :param connect_body: The data connector. Is either a DataConnectorConnectBody type or a IO + type. Required. :type connect_body: ~azure.mgmt.securityinsight.models.DataConnectorConnectBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -547,16 +541,14 @@ async def connect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(connect_body, (IO, bytes)): + if isinstance(connect_body, (IOBase, bytes)): _content = connect_body else: _json = self._serialize.body(connect_body, "DataConnectorConnectBody") @@ -577,8 +569,9 @@ async def connect( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,9 +616,7 @@ async def disconnect( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_disconnect_request( @@ -641,8 +632,9 @@ async def disconnect( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py index 30b1d059703f..a2164cdfb3c7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._domain_whois_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +75,7 @@ async def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnrichmentDomainWhois] = kwargs.pop("cls", None) request = build_get_request( @@ -97,8 +90,9 @@ async def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _mo 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py index 62111c6a7259..8ecceaff5105 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._entities_get_timeline_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -138,7 +134,7 @@ async def list( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute an timeline operation on the given - entity. Is either a model type or a IO type. Required. + entity. Is either a EntityTimelineParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityTimelineParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -159,16 +155,14 @@ async def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityTimelineResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityTimelineParameters") @@ -189,8 +183,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py index ddabc83cb09f..2c05241bcce4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,12 +35,9 @@ build_get_request, build_list_request, build_queries_request, + build_run_playbook_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +61,159 @@ 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") + @overload + async def run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[_models.EntityManualTriggerRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Default + value is None. + :type request_body: ~azure.mgmt.securityinsight.models.EntityManualTriggerRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Default + value is None. + :type request_body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[Union[_models.EntityManualTriggerRequestBody, IO]] = None, + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Is + either a EntityManualTriggerRequestBody type or a IO type. Default value is None. + :type request_body: ~azure.mgmt.securityinsight.models.EntityManualTriggerRequestBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(request_body, (IOBase, bytes)): + _content = request_body + else: + if request_body is not None: + _json = self._serialize.body(request_body, "EntityManualTriggerRequestBody") + else: + _json = None + + request = build_run_playbook_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + entity_identifier=entity_identifier, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.run_playbook.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + run_playbook.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityIdentifier}/runPlaybook" + } + @distributed_trace def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> AsyncIterable["_models.Entity"]: """Gets all entities. @@ -81,9 +231,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityList] = kwargs.pop("cls", None) error_map = { @@ -137,8 +285,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,9 +330,7 @@ async def get(self, resource_group_name: str, workspace_name: str, entity_id: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Entity] = kwargs.pop("cls", None) request = build_get_request( @@ -199,8 +346,9 @@ async def get(self, resource_group_name: str, workspace_name: str, entity_id: st 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,7 +451,7 @@ async def expand( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute an expand operation on the given entity. - Is either a model type or a IO type. Required. + Is either a EntityExpandParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityExpandParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -324,16 +472,14 @@ async def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityExpandResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityExpandParameters") @@ -354,8 +500,9 @@ async def expand( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,9 +558,7 @@ async def queries( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GetQueriesResponse] = kwargs.pop("cls", None) request = build_queries_request( @@ -430,8 +575,9 @@ async def queries( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,7 +678,7 @@ async def get_insights( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute insights on the given entity. Is either a - model type or a IO type. Required. + EntityGetInsightsParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityGetInsightsParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -553,16 +699,14 @@ async def get_insights( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityGetInsightsResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityGetInsightsParameters") @@ -583,8 +727,9 @@ async def get_insights( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py index d232b818621f..49bc5d6ea8b9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._entities_relations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,9 +93,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -159,8 +152,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py index 2a53846738ea..7c02322b5cec 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +64,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, _models.Enum13]] = None, + kind: Optional[Union[str, _models.Enum20]] = None, **kwargs: Any ) -> AsyncIterable["_models.EntityQuery"]: """Gets all entity queries. @@ -80,7 +76,7 @@ def list( :type workspace_name: str :param kind: The entity query kind we want to fetch. Known values are: "Expansion" and "Activity". Default value is None. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum13 + :type kind: str or ~azure.mgmt.securityinsight.models.Enum20 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQuery or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.EntityQuery] @@ -89,9 +85,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryList] = kwargs.pop("cls", None) error_map = { @@ -146,8 +140,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,9 +187,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQuery] = kwargs.pop("cls", None) request = build_get_request( @@ -210,8 +203,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -311,8 +305,8 @@ async def create_or_update( :type workspace_name: str :param entity_query_id: entity query ID. Required. :type entity_query_id: str - :param entity_query: The entity query we want to create or update. Is either a model type or a - IO type. Required. + :param entity_query: The entity query we want to create or update. Is either a + CustomEntityQuery type or a IO type. Required. :type entity_query: ~azure.mgmt.securityinsight.models.CustomEntityQuery or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -333,16 +327,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityQuery] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(entity_query, (IO, bytes)): + if isinstance(entity_query, (IOBase, bytes)): _content = entity_query else: _json = self._serialize.body(entity_query, "CustomEntityQuery") @@ -363,8 +355,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,9 +410,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -435,8 +426,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py index e2f34e18fc04..7c111a25b0bc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar, Union import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._entity_query_templates_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +58,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, _models.Enum15]] = None, + kind: Optional[Union[str, _models.Enum22]] = None, **kwargs: Any ) -> AsyncIterable["_models.EntityQueryTemplate"]: """Gets all entity query templates. @@ -74,7 +69,7 @@ def list( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param kind: The entity template query kind we want to fetch. "Activity" Default value is None. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum15 + :type kind: str or ~azure.mgmt.securityinsight.models.Enum22 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryTemplate or the result of cls(response) :rtype: @@ -84,9 +79,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryTemplateList] = kwargs.pop("cls", None) error_map = { @@ -141,8 +134,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,9 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py index 9cb8ac64c04b..1327848f537e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._entity_relations_operations import build_get_relation_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,9 +81,7 @@ async def get_relation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_relation_request( @@ -105,8 +98,9 @@ async def get_relation( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py index 5636b9487428..ea78a0255ac8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_file_imports_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -103,9 +99,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImportList] = kwargs.pop("cls", None) error_map = { @@ -163,8 +157,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -209,9 +204,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImport] = kwargs.pop("cls", None) request = build_get_request( @@ -227,8 +220,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,7 +322,7 @@ async def create( :type workspace_name: str :param file_import_id: File import ID. Required. :type file_import_id: str - :param file_import: The file import. Is either a model type or a IO type. Required. + :param file_import: The file import. Is either a FileImport type or a IO type. Required. :type file_import: ~azure.mgmt.securityinsight.models.FileImport or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -349,16 +343,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.FileImport] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(file_import, (IO, bytes)): + if isinstance(file_import, (IOBase, bytes)): _content = file_import else: _json = self._serialize.body(file_import, "FileImport") @@ -379,8 +371,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -414,9 +407,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.FileImport]] = kwargs.pop("cls", None) request = build_delete_request( @@ -432,8 +423,9 @@ async def _delete_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,9 +476,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImport] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py index 015f667e45a7..013a6ddb21ed 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._get_operations import build_single_recommendation_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +79,7 @@ async def single_recommendation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Recommendation] = kwargs.pop("cls", None) request = build_single_recommendation_request( @@ -102,8 +95,9 @@ async def single_recommendation( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py index e46e68a6f58a..6120eb8f0ad8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_recommendations_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._get_recommendations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +75,7 @@ async def list(self, resource_group_name: str, workspace_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecommendationList] = kwargs.pop("cls", None) request = build_list_request( @@ -97,8 +90,9 @@ async def list(self, resource_group_name: str, workspace_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_triggered_analytics_rule_runs_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_triggered_analytics_rule_runs_operations.py new file mode 100644 index 000000000000..103226cf45fd --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_get_triggered_analytics_rule_runs_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_triggered_analytics_rule_runs_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GetTriggeredAnalyticsRuleRunsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`get_triggered_analytics_rule_runs` 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.TriggeredAnalyticsRuleRun"]: + """Gets the triggered analytics rule runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 TriggeredAnalyticsRuleRun or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun] + :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.TriggeredAnalyticsRuleRuns] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TriggeredAnalyticsRuleRuns", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_comments_operations.py new file mode 100644 index 000000000000..ca55b561c49b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_comments_operations.py @@ -0,0 +1,479 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hunt_comments_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HuntCommentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`hunt_comments` 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, + hunt_id: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.HuntComment"]: + """Gets all hunt comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HuntComment or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.HuntComment] + :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.HuntCommentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("HuntCommentList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_comment_id: str, **kwargs: Any + ) -> _models.HuntComment: + """Gets a hunt comment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :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.HuntComment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HuntComment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_comment_id: str, **kwargs: Any + ) -> None: + """Delete a hunt comment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: _models.HuntComment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Required. + :type hunt_comment: ~azure.mgmt.securityinsight.models.HuntComment + :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: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Required. + :type hunt_comment: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: Union[_models.HuntComment, IO], + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Is either a HuntComment type or a IO type. Required. + :type hunt_comment: ~azure.mgmt.securityinsight.models.HuntComment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.HuntComment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt_comment, (IOBase, bytes)): + _content = hunt_comment + else: + _json = self._serialize.body(hunt_comment, "HuntComment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HuntComment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HuntComment", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_relations_operations.py new file mode 100644 index 000000000000..0bb0f4ba9fef --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunt_relations_operations.py @@ -0,0 +1,480 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hunt_relations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HuntRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`hunt_relations` 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, + hunt_id: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.HuntRelation"]: + """Gets all hunt relations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HuntRelation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.HuntRelation] + :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.HuntRelationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("HuntRelationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_relation_id: str, **kwargs: Any + ) -> _models.HuntRelation: + """Gets a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :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.HuntRelation] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HuntRelation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_relation_id: str, **kwargs: Any + ) -> None: + """Delete a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: _models.HuntRelation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Required. + :type hunt_relation: ~azure.mgmt.securityinsight.models.HuntRelation + :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: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Required. + :type hunt_relation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: Union[_models.HuntRelation, IO], + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Is either a HuntRelation type or a IO type. Required. + :type hunt_relation: ~azure.mgmt.securityinsight.models.HuntRelation or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.HuntRelation] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt_relation, (IOBase, bytes)): + _content = hunt_relation + else: + _json = self._serialize.body(hunt_relation, "HuntRelation") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HuntRelation", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HuntRelation", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunts_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunts_operations.py new file mode 100644 index 000000000000..28288197e609 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_hunts_operations.py @@ -0,0 +1,452 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hunts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HuntsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`hunts` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Hunt"]: + """Gets all hunts, without relations and comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Hunt or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.Hunt] + :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.HuntList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("HuntList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, workspace_name: str, hunt_id: str, **kwargs: Any) -> _models.Hunt: + """Gets a hunt, without relations and comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :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.Hunt] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Hunt", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, **kwargs: Any + ) -> None: + """Delete a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt: _models.Hunt, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Required. + :type hunt: ~azure.mgmt.securityinsight.models.Hunt + :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: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Required. + :type hunt: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt: Union[_models.Hunt, IO], **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Is either a Hunt type or a IO type. Required. + :type hunt: ~azure.mgmt.securityinsight.models.Hunt or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Hunt] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt, (IOBase, bytes)): + _content = hunt + else: + _json = self._serialize.body(hunt, "Hunt") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Hunt", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Hunt", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py index 0a69a9384b3f..1b014d5a98a6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -105,9 +101,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentCommentList] = kwargs.pop("cls", None) error_map = { @@ -166,8 +160,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,9 +209,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentComment] = kwargs.pop("cls", None) request = build_get_request( @@ -233,8 +226,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +337,8 @@ async def create_or_update( :type incident_id: str :param incident_comment_id: Incident comment ID. Required. :type incident_comment_id: str - :param incident_comment: The incident comment. Is either a model type or a IO type. Required. + :param incident_comment: The incident comment. Is either a IncidentComment type or a IO type. + Required. :type incident_comment: ~azure.mgmt.securityinsight.models.IncidentComment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -364,16 +359,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.IncidentComment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident_comment, (IO, bytes)): + if isinstance(incident_comment, (IOBase, bytes)): _content = incident_comment else: _json = self._serialize.body(incident_comment, "IncidentComment") @@ -395,8 +388,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,9 +445,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -470,8 +462,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py index 3fa719c8adf6..d94ab4774ec5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,9 +100,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -165,8 +159,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,9 +208,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_request( @@ -232,8 +225,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,7 +336,7 @@ async def create_or_update( :type incident_id: str :param relation_name: Relation Name. Required. :type relation_name: str - :param relation: The relation model. Is either a model type or a IO type. Required. + :param relation: The relation model. Is either a Relation type or a IO type. Required. :type relation: ~azure.mgmt.securityinsight.models.Relation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -363,16 +357,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Relation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(relation, (IO, bytes)): + if isinstance(relation, (IOBase, bytes)): _content = relation else: _json = self._serialize.body(relation, "Relation") @@ -394,8 +386,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,9 +443,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -469,8 +460,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_tasks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_tasks_operations.py index 3ab32b7e4d51..a718ca42cd8c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_tasks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_tasks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentTaskList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +136,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentTask] = kwargs.pop("cls", None) request = build_get_request( @@ -209,8 +202,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +313,7 @@ async def create_or_update( :type incident_id: str :param incident_task_id: Incident task ID. Required. :type incident_task_id: str - :param incident_task: The incident task. Is either a model type or a IO type. Required. + :param incident_task: The incident task. Is either a IncidentTask type or a IO type. Required. :type incident_task: ~azure.mgmt.securityinsight.models.IncidentTask or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -340,16 +334,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.IncidentTask] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident_task, (IO, bytes)): + if isinstance(incident_task, (IOBase, bytes)): _content = incident_task else: _json = self._serialize.body(incident_task, "IncidentTask") @@ -371,8 +363,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,9 +420,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -446,8 +437,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py index a0452b513c88..ba9f77da5319 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py @@ -6,6 +6,7 @@ # 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, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -45,10 +46,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -153,7 +150,8 @@ async def run_playbook( :type workspace_name: str :param incident_identifier: Required. :type incident_identifier: str - :param request_body: Is either a model type or a IO type. Default value is None. + :param request_body: Is either a ManualTriggerRequestBody type or a IO type. Default value is + None. :type request_body: ~azure.mgmt.securityinsight.models.ManualTriggerRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -174,16 +172,14 @@ async def run_playbook( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(request_body, (IO, bytes)): + if isinstance(request_body, (IOBase, bytes)): _content = request_body else: if request_body is not None: @@ -207,8 +203,9 @@ async def run_playbook( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -266,9 +263,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentList] = kwargs.pop("cls", None) error_map = { @@ -326,8 +321,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,9 +368,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Incident] = kwargs.pop("cls", None) request = build_get_request( @@ -390,8 +384,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -491,7 +486,7 @@ async def create_or_update( :type workspace_name: str :param incident_id: Incident ID. Required. :type incident_id: str - :param incident: The incident. Is either a model type or a IO type. Required. + :param incident: The incident. Is either a Incident type or a IO type. Required. :type incident: ~azure.mgmt.securityinsight.models.Incident or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -512,16 +507,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Incident] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident, (IO, bytes)): + if isinstance(incident, (IOBase, bytes)): _content = incident else: _json = self._serialize.body(incident, "Incident") @@ -542,8 +535,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -596,9 +590,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -614,8 +606,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -714,7 +707,8 @@ async def create_team( :type workspace_name: str :param incident_id: Incident ID. Required. :type incident_id: str - :param team_properties: Team properties. Is either a model type or a IO type. Required. + :param team_properties: Team properties. Is either a TeamInformation type or a IO type. + Required. :type team_properties: ~azure.mgmt.securityinsight.models.TeamInformation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -735,16 +729,14 @@ async def create_team( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.TeamInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(team_properties, (IO, bytes)): + if isinstance(team_properties, (IOBase, bytes)): _content = team_properties else: _json = self._serialize.body(team_properties, "TeamInformation") @@ -765,8 +757,9 @@ async def create_team( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -815,9 +808,7 @@ async def list_alerts( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentAlertList] = kwargs.pop("cls", None) request = build_list_alerts_request( @@ -833,8 +824,9 @@ async def list_alerts( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -883,9 +875,7 @@ async def list_bookmarks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentBookmarkList] = kwargs.pop("cls", None) request = build_list_bookmarks_request( @@ -901,8 +891,9 @@ async def list_bookmarks( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -951,9 +942,7 @@ async def list_entities( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentEntitiesResponse] = kwargs.pop("cls", None) request = build_list_entities_request( @@ -969,8 +958,9 @@ async def list_entities( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py index e1f7121e301e..e00105460c38 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._ip_geodata_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +75,7 @@ async def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnrichmentIpGeodata] = kwargs.pop("cls", None) request = build_get_request( @@ -97,8 +90,9 @@ async def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py index f9d87e686bcd..9d268bccbecb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,9 +97,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataList] = kwargs.pop("cls", None) error_map = { @@ -161,8 +155,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,9 +202,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataModel] = kwargs.pop("cls", None) request = build_get_request( @@ -225,8 +218,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -275,9 +269,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -293,8 +285,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -390,7 +383,7 @@ async def create( :type workspace_name: str :param metadata_name: The Metadata name. Required. :type metadata_name: str - :param metadata: Metadata resource. Is either a model type or a IO type. Required. + :param metadata: Metadata resource. Is either a MetadataModel type or a IO type. Required. :type metadata: ~azure.mgmt.securityinsight.models.MetadataModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -411,16 +404,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MetadataModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(metadata, (IO, bytes)): + if isinstance(metadata, (IOBase, bytes)): _content = metadata else: _json = self._serialize.body(metadata, "MetadataModel") @@ -441,8 +432,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +538,8 @@ async def update( :type workspace_name: str :param metadata_name: The Metadata name. Required. :type metadata_name: str - :param metadata_patch: Partial metadata request. Is either a model type or a IO type. Required. + :param metadata_patch: Partial metadata request. Is either a MetadataPatch type or a IO type. + Required. :type metadata_patch: ~azure.mgmt.securityinsight.models.MetadataPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -567,16 +560,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MetadataModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(metadata_patch, (IO, bytes)): + if isinstance(metadata_patch, (IOBase, bytes)): _content = metadata_patch else: _json = self._serialize.body(metadata_patch, "MetadataPatch") @@ -597,8 +588,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py index fffada186187..06c618c659ee 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._office_consents_operations import build_delete_request, build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,9 +73,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OfficeConsentList] = kwargs.pop("cls", None) error_map = { @@ -134,8 +127,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,9 +174,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OfficeConsent] = kwargs.pop("cls", None) request = build_get_request( @@ -198,8 +190,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -248,9 +241,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -266,8 +257,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py index 376f9dc326f2..126066cd2908 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_package_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_package_operations.py new file mode 100644 index 000000000000..299b609ce05d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_package_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._product_package_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`product_package` 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_async + async def get( + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> _models.ProductPackageModel: + """Gets a package by its identifier from the catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductPackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ProductPackageModel + :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.ProductPackageModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductPackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_packages_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_packages_operations.py new file mode 100644 index 000000000000..939356ac2155 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_packages_operations.py @@ -0,0 +1,173 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._product_packages_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`product_packages` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ProductPackageModel"]: + """Gets all packages from the catalog. + Expandable properties: + + + * properties/installed + * properties/packagedContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProductPackageModel or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.ProductPackageModel] + :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.ProductPackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProductPackageList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py index 3324a16bab68..8bd1f37e35ba 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,10 +33,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ async def list(self, resource_group_name: str, workspace_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SettingList] = kwargs.pop("cls", None) request = build_list_request( @@ -102,8 +96,9 @@ async def list(self, resource_group_name: str, workspace_name: str, **kwargs: An 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,9 +148,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Settings] = kwargs.pop("cls", None) request = build_get_request( @@ -171,8 +164,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,9 +216,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -240,8 +232,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,7 +333,7 @@ async def update( :param settings_name: The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. Required. :type settings_name: str - :param settings: The setting. Is either a model type or a IO type. Required. + :param settings: The setting. Is either a Settings type or a IO type. Required. :type settings: ~azure.mgmt.securityinsight.models.Settings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -361,16 +354,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Settings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(settings, (IO, bytes)): + if isinstance(settings, (IOBase, bytes)): _content = settings else: _json = self._serialize.body(settings, "Settings") @@ -391,8 +382,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_template_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_template_operations.py new file mode 100644 index 000000000000..249ab76033f7 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_template_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._product_template_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`product_template` 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_async + async def get( + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> _models.ProductTemplateModel: + """Gets a template by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductTemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ProductTemplateModel + :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.ProductTemplateModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductTemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentproducttemplates/{templateId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_templates_operations.py new file mode 100644 index 000000000000..a26f9a5c534b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_templates_operations.py @@ -0,0 +1,183 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._product_templates_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProductTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`product_templates` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ProductTemplateModel"]: + """Gets all templates in the catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProductTemplateModel or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.ProductTemplateModel] + :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.ProductTemplateList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProductTemplateList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductTemplates" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py index eb537fb84c40..88826758caba 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityMLAnalyticsSettingsList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +134,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,9 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityMLAnalyticsSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -204,8 +197,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,8 +300,8 @@ async def create_or_update( :type workspace_name: str :param settings_resource_name: Security ML Analytics Settings resource name. Required. :type settings_resource_name: str - :param security_ml_analytics_setting: The security ML Analytics setting. Is either a model type - or a IO type. Required. + :param security_ml_analytics_setting: The security ML Analytics setting. Is either a + SecurityMLAnalyticsSetting type or a IO type. Required. :type security_ml_analytics_setting: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -329,16 +323,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SecurityMLAnalyticsSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_ml_analytics_setting, (IO, bytes)): + if isinstance(security_ml_analytics_setting, (IOBase, bytes)): _content = security_ml_analytics_setting else: _json = self._serialize.body(security_ml_analytics_setting, "SecurityMLAnalyticsSetting") @@ -359,8 +351,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,9 +406,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -431,8 +422,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py index aac64f7fdd94..5ab389dd046e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,10 +33,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,9 +86,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SentinelOnboardingState] = kwargs.pop("cls", None) request = build_get_request( @@ -108,8 +102,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,7 +211,7 @@ async def create( Required. :type sentinel_onboarding_state_name: str :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. Is either - a model type or a IO type. Default value is None. + a SentinelOnboardingState type or a IO type. Default value is None. :type sentinel_onboarding_state_parameter: ~azure.mgmt.securityinsight.models.SentinelOnboardingState or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -238,16 +233,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SentinelOnboardingState] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sentinel_onboarding_state_parameter, (IO, bytes)): + if isinstance(sentinel_onboarding_state_parameter, (IOBase, bytes)): _content = sentinel_onboarding_state_parameter else: if sentinel_onboarding_state_parameter is not None: @@ -271,8 +264,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,9 +320,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -344,8 +336,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,9 +381,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SentinelOnboardingStatesList] = kwargs.pop("cls", None) request = build_list_request( @@ -405,8 +396,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py index 121de431e0c8..54f54a768870 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py @@ -6,8 +6,8 @@ # 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, TypeVar, Union +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._source_control_operations import build_list_repositories_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,9 +53,69 @@ 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") + @overload + def list_repositories( + self, + resource_group_name: str, + workspace_name: str, + repository_access: _models.RepositoryAccessProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.Repo"]: + """Gets a list of repositories metadata. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param repository_access: The repository access credentials. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties + :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: An iterator like instance of either Repo or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.Repo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_repositories( + self, + resource_group_name: str, + workspace_name: str, + repository_access: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.Repo"]: + """Gets a list of repositories metadata. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param repository_access: The repository access credentials. Required. + :type repository_access: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Repo or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.Repo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace def list_repositories( - self, resource_group_name: str, workspace_name: str, repo_type: Union[str, _models.RepoType], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + repository_access: Union[_models.RepositoryAccessProperties, IO], + **kwargs: Any ) -> AsyncIterable["_models.Repo"]: """Gets a list of repositories metadata. @@ -68,8 +124,12 @@ def list_repositories( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param repo_type: The repo type. Known values are: "Github" and "DevOps". Required. - :type repo_type: str or ~azure.mgmt.securityinsight.models.RepoType + :param repository_access: The repository access credentials. Is either a + RepositoryAccessProperties type or a IO type. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Repo or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.Repo] @@ -78,10 +138,8 @@ def list_repositories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + 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.RepoList] = kwargs.pop("cls", None) error_map = { @@ -91,10 +149,16 @@ def list_repositories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(repository_access, (IOBase, bytes)): + _content = repository_access + else: + _json = self._serialize.body(repository_access, "RepositoryAccessProperties") def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(repo_type, "str") request = build_list_repositories_request( resource_group_name=resource_group_name, @@ -103,6 +167,7 @@ def prepare_request(next_link=None): api_version=api_version, content_type=content_type, json=_json, + content=_content, template_url=self.list_repositories.metadata["url"], headers=_headers, params=_params, @@ -138,8 +203,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py index a2a445e2e5e2..b9bfa4d5ac8b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,9 +79,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlList] = kwargs.pop("cls", None) error_map = { @@ -139,8 +133,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,9 +180,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +196,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,11 +218,78 @@ async def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" } + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: _models.SourceControl, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param source_control_id: Source control Id. Required. + :type source_control_id: str + :param source_control: The SourceControl. Required. + :type source_control: ~azure.mgmt.securityinsight.models.SourceControl + :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: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param source_control_id: Source control Id. Required. + :type source_control_id: str + :param source_control: The SourceControl. Required. + :type source_control: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, source_control_id: str, **kwargs: Any - ) -> None: - """Delete a source control. + async def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: Union[_models.SourceControl, IO], + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -237,9 +298,15 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str + :param source_control: The SourceControl. Is either a SourceControl type or a IO type. + Required. + :type source_control: ~azure.mgmt.securityinsight.models.SourceControl or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -250,56 +317,75 @@ async 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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.SourceControl] = kwargs.pop("cls", None) - request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(source_control, (IOBase, bytes)): + _content = source_control + else: + _json = self._serialize.body(source_control, "SourceControl") + + request = build_create_request( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code == 200: + deserialized = self._deserialize("SourceControl", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SourceControl", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - delete.metadata = { + return deserialized # type: ignore + + create.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" } @overload - async def create( + async def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: _models.SourceControl, + repository_access: _models.RepositoryAccessProperties, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -308,29 +394,29 @@ async def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Required. - :type source_control: ~azure.mgmt.securityinsight.models.SourceControl + :param repository_access: The repository access credentials. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties :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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( + async def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: IO, + repository_access: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -339,27 +425,27 @@ async def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Required. - :type source_control: IO + :param repository_access: The repository access credentials. Required. + :type repository_access: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create( + async def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: Union[_models.SourceControl, IO], + repository_access: Union[_models.RepositoryAccessProperties, IO], **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -368,14 +454,15 @@ async def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Is either a model type or a IO type. Required. - :type source_control: ~azure.mgmt.securityinsight.models.SourceControl or IO + :param repository_access: The repository access credentials. Is either a + RepositoryAccessProperties type or a IO type. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -389,21 +476,19 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[_models.Warning] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(source_control, (IO, bytes)): - _content = source_control + if isinstance(repository_access, (IOBase, bytes)): + _content = repository_access else: - _json = self._serialize.body(source_control, "SourceControl") + _json = self._serialize.body(repository_access, "RepositoryAccessProperties") - request = build_create_request( + request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, @@ -412,34 +497,31 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("Warning", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete" } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py index 5847ff70bdcb..6978118f5076 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._threat_intelligence_indicator_metrics_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,9 +77,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceMetricsList] = kwargs.pop("cls", None) request = build_list_request( @@ -99,8 +92,9 @@ async def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py index e33a32402aa2..9985a2e6d9ea 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -39,10 +39,6 @@ build_replace_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +137,7 @@ async def create_indicator( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param threat_intelligence_properties: Properties of threat intelligence indicators to create - and update. Is either a model type or a IO type. Required. + and update. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -163,16 +159,14 @@ async def create_indicator( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_properties, (IO, bytes)): + if isinstance(threat_intelligence_properties, (IOBase, bytes)): _content = threat_intelligence_properties else: _json = self._serialize.body(threat_intelligence_properties, "ThreatIntelligenceIndicatorModel") @@ -192,8 +186,9 @@ async def create_indicator( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,9 +241,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceInformation] = kwargs.pop("cls", None) request = build_get_request( @@ -264,8 +257,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,7 +363,7 @@ async def create( :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_properties: Properties of threat intelligence indicators to create - and update. Is either a model type or a IO type. Required. + and update. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -391,16 +385,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_properties, (IO, bytes)): + if isinstance(threat_intelligence_properties, (IOBase, bytes)): _content = threat_intelligence_properties else: _json = self._serialize.body(threat_intelligence_properties, "ThreatIntelligenceIndicatorModel") @@ -421,8 +413,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,9 +468,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -493,8 +484,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -589,7 +581,8 @@ def query_indicators( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param threat_intelligence_filtering_criteria: Filtering criteria for querying threat - intelligence indicators. Is either a model type or a IO type. Required. + intelligence indicators. Is either a ThreatIntelligenceFilteringCriteria type or a IO type. + Required. :type threat_intelligence_filtering_criteria: ~azure.mgmt.securityinsight.models.ThreatIntelligenceFilteringCriteria or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -605,9 +598,7 @@ def query_indicators( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformationList] = kwargs.pop("cls", None) @@ -621,7 +612,7 @@ def query_indicators( content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_filtering_criteria, (IO, bytes)): + if isinstance(threat_intelligence_filtering_criteria, (IOBase, bytes)): _content = threat_intelligence_filtering_criteria else: _json = self._serialize.body(threat_intelligence_filtering_criteria, "ThreatIntelligenceFilteringCriteria") @@ -672,8 +663,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,7 +765,7 @@ async def append_tags( # pylint: disable=inconsistent-return-statements :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_append_tags: The threat intelligence append tags request body. Is - either a model type or a IO type. Required. + either a ThreatIntelligenceAppendTags type or a IO type. Required. :type threat_intelligence_append_tags: ~azure.mgmt.securityinsight.models.ThreatIntelligenceAppendTags or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -795,16 +787,14 @@ async def append_tags( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(threat_intelligence_append_tags, (IO, bytes)): + if isinstance(threat_intelligence_append_tags, (IOBase, bytes)): _content = threat_intelligence_append_tags else: _json = self._serialize.body(threat_intelligence_append_tags, "ThreatIntelligenceAppendTags") @@ -825,8 +815,9 @@ async def append_tags( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,7 +917,7 @@ async def replace_tags( :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_replace_tags: Tags in the threat intelligence indicator to be - replaced. Is either a model type or a IO type. Required. + replaced. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_replace_tags: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -948,16 +939,14 @@ async def replace_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_replace_tags, (IO, bytes)): + if isinstance(threat_intelligence_replace_tags, (IOBase, bytes)): _content = threat_intelligence_replace_tags else: _json = self._serialize.body(threat_intelligence_replace_tags, "ThreatIntelligenceIndicatorModel") @@ -978,8 +967,9 @@ async def replace_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py index 43499935ceb1..e748fc3edbf9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._threat_intelligence_indicators_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,9 +92,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceInformationList] = kwargs.pop("cls", None) error_map = { @@ -157,8 +150,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_triggered_analytics_rule_run_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_triggered_analytics_rule_run_operations.py new file mode 100644 index 000000000000..38205bcfa831 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_triggered_analytics_rule_run_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._triggered_analytics_rule_run_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class TriggeredAnalyticsRuleRunOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`triggered_analytics_rule_run` 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_async + async def get( + self, resource_group_name: str, workspace_name: str, rule_run_id: str, **kwargs: Any + ) -> _models.TriggeredAnalyticsRuleRun: + """Gets the triggered analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_run_id: the triggered rule id. Required. + :type rule_run_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredAnalyticsRuleRun or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun + :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.TriggeredAnalyticsRuleRun] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_run_id=rule_run_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TriggeredAnalyticsRuleRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns/{ruleRunId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py index 18154771938c..a471a2ca1e55 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_update_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._update_operations import build_recommendation_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,16 +72,14 @@ async def _recommendation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Recommendation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(recommendation_patch, (IO, bytes)): + if isinstance(recommendation_patch, (IOBase, bytes)): _content = recommendation_patch else: _json = self._serialize.body(recommendation_patch, "[RecommendationPatch]") @@ -106,8 +100,9 @@ async def _recommendation_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,8 +218,8 @@ async def begin_recommendation( :type workspace_name: str :param recommendation_id: Recommendation Id. Required. :type recommendation_id: str - :param recommendation_patch: Recommendation Fields to Update. Is either a list type or a IO - type. Required. + :param recommendation_patch: Recommendation Fields to Update. Is either a [RecommendationPatch] + type or a IO type. Required. :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -245,9 +240,7 @@ async def begin_recommendation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Recommendation] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py index 913eefeee849..35d13d6dedd4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,9 +91,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistItemList] = kwargs.pop("cls", None) error_map = { @@ -153,8 +147,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -201,9 +196,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistItem] = kwargs.pop("cls", None) request = build_get_request( @@ -220,8 +213,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,9 +266,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -291,8 +283,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -397,7 +390,8 @@ async def create_or_update( :type watchlist_alias: str :param watchlist_item_id: Watchlist Item Id (GUID). Required. :type watchlist_item_id: str - :param watchlist_item: The watchlist item. Is either a model type or a IO type. Required. + :param watchlist_item: The watchlist item. Is either a WatchlistItem type or a IO type. + Required. :type watchlist_item: ~azure.mgmt.securityinsight.models.WatchlistItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -418,16 +412,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.WatchlistItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(watchlist_item, (IO, bytes)): + if isinstance(watchlist_item, (IOBase, bytes)): _content = watchlist_item else: _json = self._serialize.body(watchlist_item, "WatchlistItem") @@ -449,8 +441,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py index 2028bb0b5458..10f7cc6bca5a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,9 +83,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistList] = kwargs.pop("cls", None) error_map = { @@ -144,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Watchlist] = kwargs.pop("cls", None) request = build_get_request( @@ -208,8 +201,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,9 +252,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -276,8 +268,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,7 +387,7 @@ async def create_or_update( :type workspace_name: str :param watchlist_alias: Watchlist Alias. Required. :type watchlist_alias: str - :param watchlist: The watchlist. Is either a model type or a IO type. Required. + :param watchlist: The watchlist. Is either a Watchlist type or a IO type. Required. :type watchlist: ~azure.mgmt.securityinsight.models.Watchlist or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -415,16 +408,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Watchlist] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(watchlist, (IO, bytes)): + if isinstance(watchlist, (IOBase, bytes)): _content = watchlist else: _json = self._serialize.body(watchlist, "Watchlist") @@ -445,8 +436,9 @@ async def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignment_jobs_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignment_jobs_operations.py new file mode 100644 index 000000000000..22b6d7cce4d8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignment_jobs_operations.py @@ -0,0 +1,393 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspace_manager_assignment_jobs_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspaceManagerAssignmentJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`workspace_manager_assignment_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Job"]: + """Get all jobs for the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Job or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.Job] + :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.JobList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs" + } + + @distributed_trace_async + async def create( + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> _models.Job: + """Create a job for the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Job + :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.Job] = kwargs.pop("cls", None) + + request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create.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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_name: str, + **kwargs: Any + ) -> _models.Job: + """Gets a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Job + :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.Job] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + job_name=job_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 = 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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified job from the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param job_name: The job name. Required. + :type job_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, + workspace_manager_assignment_name=workspace_manager_assignment_name, + job_name=job_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignments_operations.py new file mode 100644 index 000000000000..cdcea494e7e5 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_assignments_operations.py @@ -0,0 +1,468 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspace_manager_assignments_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspaceManagerAssignmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`workspace_manager_assignments` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceManagerAssignment"]: + """Get all workspace manager assignments for the Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerAssignment or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment] + :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.WorkspaceManagerAssignmentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerAssignmentList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Gets a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :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.WorkspaceManagerAssignment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_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 = 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("WorkspaceManagerAssignment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: _models.WorkspaceManagerAssignment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Required. + :type workspace_manager_assignment: + ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :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: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Required. + :type workspace_manager_assignment: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: Union[_models.WorkspaceManagerAssignment, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Is either a + WorkspaceManagerAssignment type or a IO type. Required. + :type workspace_manager_assignment: + ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerAssignment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_assignment, (IOBase, bytes)): + _content = workspace_manager_assignment + else: + _json = self._serialize.body(workspace_manager_assignment, "WorkspaceManagerAssignment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerAssignment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerAssignment", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_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, + workspace_manager_assignment_name=workspace_manager_assignment_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_configurations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_configurations_operations.py new file mode 100644 index 000000000000..893c2ecdf078 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_configurations_operations.py @@ -0,0 +1,468 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspace_manager_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspaceManagerConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`workspace_manager_configurations` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceManagerConfiguration"]: + """Gets all workspace manager configurations for a Sentinel 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: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration] + :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.WorkspaceManagerConfigurationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerConfigurationList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_configuration_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Gets a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :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.WorkspaceManagerConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_configuration_name=workspace_manager_configuration_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 = 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("WorkspaceManagerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_configuration_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_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, + workspace_manager_configuration_name=workspace_manager_configuration_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: _models.WorkspaceManagerConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Required. + :type workspace_manager_configuration: + ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :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: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Required. + :type workspace_manager_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: Union[_models.WorkspaceManagerConfiguration, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Is either a + WorkspaceManagerConfiguration type or a IO type. Required. + :type workspace_manager_configuration: + ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_configuration, (IOBase, bytes)): + _content = workspace_manager_configuration + else: + _json = self._serialize.body(workspace_manager_configuration, "WorkspaceManagerConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_configuration_name=workspace_manager_configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerConfiguration", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_groups_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_groups_operations.py new file mode 100644 index 000000000000..5e3f0ee9b406 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_groups_operations.py @@ -0,0 +1,461 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspace_manager_groups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspaceManagerGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`workspace_manager_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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceManagerGroup"]: + """Gets all workspace manager groups in the Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerGroup] + :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.WorkspaceManagerGroupList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerGroupList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_group_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Gets a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :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.WorkspaceManagerGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_group_name=workspace_manager_group_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 = 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("WorkspaceManagerGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: _models.WorkspaceManagerGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Required. + :type workspace_manager_group: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :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: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Required. + :type workspace_manager_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: Union[_models.WorkspaceManagerGroup, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Is either a + WorkspaceManagerGroup type or a IO type. Required. + :type workspace_manager_group: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_group, (IOBase, bytes)): + _content = workspace_manager_group + else: + _json = self._serialize.body(workspace_manager_group, "WorkspaceManagerGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_group_name=workspace_manager_group_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerGroup", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_group_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_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, + workspace_manager_group_name=workspace_manager_group_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_members_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_members_operations.py new file mode 100644 index 000000000000..876ac8ea781d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_workspace_manager_members_operations.py @@ -0,0 +1,461 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workspace_manager_members_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkspaceManagerMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`workspace_manager_members` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceManagerMember"]: + """Gets all workspace manager members that exist for the given Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerMember or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerMember] + :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.WorkspaceManagerMembersList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerMembersList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_member_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Gets a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :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.WorkspaceManagerMember] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_member_name=workspace_manager_member_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 = 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("WorkspaceManagerMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: _models.WorkspaceManagerMember, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Required. + :type workspace_manager_member: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :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: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Required. + :type workspace_manager_member: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: Union[_models.WorkspaceManagerMember, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Is either a + WorkspaceManagerMember type or a IO type. Required. + :type workspace_manager_member: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerMember] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_member, (IOBase, bytes)): + _content = workspace_manager_member + else: + _json = self._serialize.body(workspace_manager_member, "WorkspaceManagerMember") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_member_name=workspace_manager_member_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerMember", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerMember", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_member_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_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, + workspace_manager_member_name=workspace_manager_member_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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py index 805bb3d2b327..dcf69fccd04b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py @@ -42,9 +42,11 @@ from ._models_py3 import AlertRuleTemplatesList from ._models_py3 import AlertRulesList from ._models_py3 import AlertsDataTypeOfDataConnector +from ._models_py3 import AnalyticsRuleRunTrigger from ._models_py3 import Anomalies from ._models_py3 import AnomalySecurityMLAnalyticsSettings from ._models_py3 import AnomalyTimelineItem +from ._models_py3 import AssignmentItem from ._models_py3 import AutomationRule from ._models_py3 import AutomationRuleAction from ._models_py3 import AutomationRuleAddIncidentTaskAction @@ -68,8 +70,11 @@ from ._models_py3 import AwsS3DataConnectorDataTypes from ._models_py3 import AwsS3DataConnectorDataTypesLogs from ._models_py3 import AzureDevOpsResourceInfo +from ._models_py3 import AzureEntityResource from ._models_py3 import AzureResourceEntity from ._models_py3 import AzureResourceEntityProperties +from ._models_py3 import BillingStatistic +from ._models_py3 import BillingStatisticList from ._models_py3 import Bookmark from ._models_py3 import BookmarkEntityMappings from ._models_py3 import BookmarkExpandParameters @@ -97,15 +102,26 @@ from ._models_py3 import CodelessUiDataConnector from ._models_py3 import ConnectedEntity from ._models_py3 import ConnectivityCriteria +from ._models_py3 import ConnectivityCriterion +from ._models_py3 import ConnectorDataType +from ._models_py3 import ConnectorDefinitionsAvailability +from ._models_py3 import ConnectorDefinitionsPermissions +from ._models_py3 import ConnectorDefinitionsResourceProvider from ._models_py3 import ConnectorInstructionModelBase from ._models_py3 import Content -from ._models_py3 import ContentPathMap from ._models_py3 import CustomEntityQuery +from ._models_py3 import CustomPermissionDetails +from ._models_py3 import CustomizableConnectionsConfig +from ._models_py3 import CustomizableConnectorDefinition +from ._models_py3 import CustomizableConnectorUiConfig from ._models_py3 import Customs from ._models_py3 import CustomsPermission +from ._models_py3 import DCRConfiguration from ._models_py3 import DataConnector from ._models_py3 import DataConnectorConnectBody from ._models_py3 import DataConnectorDataTypeCommon +from ._models_py3 import DataConnectorDefinition +from ._models_py3 import DataConnectorDefinitionArmCollectionWrapper from ._models_py3 import DataConnectorList from ._models_py3 import DataConnectorRequirementsState from ._models_py3 import DataConnectorTenantId @@ -141,6 +157,7 @@ from ._models_py3 import EntityInsightItem from ._models_py3 import EntityInsightItemQueryTimeInterval from ._models_py3 import EntityList +from ._models_py3 import EntityManualTriggerRequestBody from ._models_py3 import EntityMapping from ._models_py3 import EntityQuery from ._models_py3 import EntityQueryItem @@ -152,6 +169,10 @@ from ._models_py3 import EntityTimelineItem from ._models_py3 import EntityTimelineParameters from ._models_py3 import EntityTimelineResponse +from ._models_py3 import Error +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import EventGroupingSettings from ._models_py3 import ExpansionEntityQuery from ._models_py3 import ExpansionResultAggregation @@ -175,15 +196,26 @@ from ._models_py3 import FusionTemplateSourceSetting from ._models_py3 import FusionTemplateSourceSubType from ._models_py3 import FusionTemplateSubTypeSeverityFilter +from ._models_py3 import GCPAuthProperties +from ._models_py3 import GCPDataConnector +from ._models_py3 import GCPRequestProperties from ._models_py3 import GeoLocation from ._models_py3 import GetInsightsErrorKind from ._models_py3 import GetInsightsResultsMetadata from ._models_py3 import GetQueriesResponse from ._models_py3 import GitHubResourceInfo from ._models_py3 import GraphQueries +from ._models_py3 import GraphQuery from ._models_py3 import GroupingConfiguration from ._models_py3 import HostEntity from ._models_py3 import HostEntityProperties +from ._models_py3 import Hunt +from ._models_py3 import HuntComment +from ._models_py3 import HuntCommentList +from ._models_py3 import HuntList +from ._models_py3 import HuntOwner +from ._models_py3 import HuntRelation +from ._models_py3 import HuntRelationList from ._models_py3 import HuntingBookmark from ._models_py3 import HuntingBookmarkProperties from ._models_py3 import Incident @@ -213,6 +245,8 @@ from ._models_py3 import InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem from ._models_py3 import InsightsTableResult from ._models_py3 import InsightsTableResultColumnsItem +from ._models_py3 import InstructionStep +from ._models_py3 import InstructionStepDetails from ._models_py3 import InstructionSteps from ._models_py3 import InstructionStepsInstructionsItem from ._models_py3 import Instructions @@ -223,6 +257,9 @@ from ._models_py3 import IoTDeviceEntityProperties from ._models_py3 import IpEntity from ._models_py3 import IpEntityProperties +from ._models_py3 import Job +from ._models_py3 import JobItem +from ._models_py3 import JobList from ._models_py3 import LastDataReceivedDataType from ._models_py3 import MCASCheckRequirements from ._models_py3 import MCASCheckRequirementsProperties @@ -240,12 +277,12 @@ from ._models_py3 import MSTICheckRequirementsProperties from ._models_py3 import MSTIDataConnector from ._models_py3 import MSTIDataConnectorDataTypes -from ._models_py3 import MSTIDataConnectorDataTypesBingSafetyPhishingURL from ._models_py3 import MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed from ._models_py3 import MSTIDataConnectorProperties from ._models_py3 import MTPCheckRequirementsProperties from ._models_py3 import MTPDataConnector from ._models_py3 import MTPDataConnectorDataTypes +from ._models_py3 import MTPDataConnectorDataTypesAlerts from ._models_py3 import MTPDataConnectorDataTypesIncidents from ._models_py3 import MTPDataConnectorProperties from ._models_py3 import MailClusterEntity @@ -265,12 +302,19 @@ from ._models_py3 import MetadataPatch from ._models_py3 import MetadataSource from ._models_py3 import MetadataSupport +from ._models_py3 import MicrosoftPurviewInformationProtectionCheckRequirements +from ._models_py3 import MicrosoftPurviewInformationProtectionCheckRequirementsProperties +from ._models_py3 import MicrosoftPurviewInformationProtectionConnectorDataTypes +from ._models_py3 import MicrosoftPurviewInformationProtectionConnectorDataTypesLogs +from ._models_py3 import MicrosoftPurviewInformationProtectionDataConnector +from ._models_py3 import MicrosoftPurviewInformationProtectionDataConnectorProperties from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRule from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleCommonProperties from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleProperties from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplate from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties from ._models_py3 import MtpCheckRequirements +from ._models_py3 import MtpFilteredProviders from ._models_py3 import NicEntity from ._models_py3 import NicEntityProperties from ._models_py3 import NrtAlertRule @@ -307,16 +351,29 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationsList +from ._models_py3 import PackageBaseProperties +from ._models_py3 import PackageList +from ._models_py3 import PackageModel +from ._models_py3 import PackageProperties from ._models_py3 import Permissions from ._models_py3 import PermissionsCustomsItem from ._models_py3 import PermissionsResourceProviderItem from ._models_py3 import PlaybookActionProperties from ._models_py3 import ProcessEntity from ._models_py3 import ProcessEntityProperties +from ._models_py3 import ProductPackageAdditionalProperties +from ._models_py3 import ProductPackageList +from ._models_py3 import ProductPackageModel +from ._models_py3 import ProductPackageProperties +from ._models_py3 import ProductTemplateAdditionalProperties +from ._models_py3 import ProductTemplateList +from ._models_py3 import ProductTemplateModel +from ._models_py3 import ProductTemplateProperties from ._models_py3 import PropertyArrayChangedConditionProperties from ._models_py3 import PropertyArrayConditionProperties from ._models_py3 import PropertyChangedConditionProperties from ._models_py3 import PropertyConditionProperties +from ._models_py3 import PullRequest from ._models_py3 import QueryBasedAlertRuleTemplateProperties from ._models_py3 import Recommendation from ._models_py3 import RecommendationList @@ -331,12 +388,17 @@ from ._models_py3 import Repo from ._models_py3 import RepoList from ._models_py3 import Repository +from ._models_py3 import RepositoryAccess +from ._models_py3 import RepositoryAccessProperties from ._models_py3 import RepositoryResourceInfo from ._models_py3 import RequiredPermissions from ._models_py3 import Resource from ._models_py3 import ResourceProvider +from ._models_py3 import ResourceProviderRequiredPermissions from ._models_py3 import ResourceWithEtag from ._models_py3 import SampleQueries +from ._models_py3 import SampleQuery +from ._models_py3 import SapSolutionUsageStatistic from ._models_py3 import ScheduledAlertRule from ._models_py3 import ScheduledAlertRuleCommonProperties from ._models_py3 import ScheduledAlertRuleProperties @@ -353,6 +415,7 @@ from ._models_py3 import SentinelEntityMapping from ._models_py3 import SentinelOnboardingState from ._models_py3 import SentinelOnboardingStatesList +from ._models_py3 import ServicePrincipal from ._models_py3 import SettingList from ._models_py3 import Settings from ._models_py3 import SourceControl @@ -368,6 +431,11 @@ from ._models_py3 import TIDataConnectorProperties from ._models_py3 import TeamInformation from ._models_py3 import TeamProperties +from ._models_py3 import TemplateAdditionalProperties +from ._models_py3 import TemplateBaseProperties +from ._models_py3 import TemplateList +from ._models_py3 import TemplateModel +from ._models_py3 import TemplateProperties from ._models_py3 import ThreatIntelligence from ._models_py3 import ThreatIntelligenceAlertRule from ._models_py3 import ThreatIntelligenceAlertRuleTemplate @@ -397,16 +465,28 @@ from ._models_py3 import TimelineAggregation from ._models_py3 import TimelineError from ._models_py3 import TimelineResultsMetadata +from ._models_py3 import TriggeredAnalyticsRuleRun +from ._models_py3 import TriggeredAnalyticsRuleRuns from ._models_py3 import Ueba from ._models_py3 import UrlEntity from ._models_py3 import UrlEntityProperties from ._models_py3 import UserInfo from ._models_py3 import ValidationError +from ._models_py3 import Warning +from ._models_py3 import WarningBody from ._models_py3 import Watchlist from ._models_py3 import WatchlistItem from ._models_py3 import WatchlistItemList from ._models_py3 import WatchlistList from ._models_py3 import Webhook +from ._models_py3 import WorkspaceManagerAssignment +from ._models_py3 import WorkspaceManagerAssignmentList +from ._models_py3 import WorkspaceManagerConfiguration +from ._models_py3 import WorkspaceManagerConfigurationList +from ._models_py3 import WorkspaceManagerGroup +from ._models_py3 import WorkspaceManagerGroupList +from ._models_py3 import WorkspaceManagerMember +from ._models_py3 import WorkspaceManagerMembersList from ._security_insights_enums import ActionType from ._security_insights_enums import AlertDetail @@ -425,6 +505,7 @@ from ._security_insights_enums import AutomationRulePropertyChangedConditionSupportedPropertyType from ._security_insights_enums import AutomationRulePropertyConditionSupportedOperator from ._security_insights_enums import AutomationRulePropertyConditionSupportedProperty +from ._security_insights_enums import BillingStatisticKind from ._security_insights_enums import Category from ._security_insights_enums import ConditionType from ._security_insights_enums import ConfidenceLevel @@ -436,6 +517,7 @@ from ._security_insights_enums import CreatedByType from ._security_insights_enums import CustomEntityQueryKind from ._security_insights_enums import DataConnectorAuthorizationState +from ._security_insights_enums import DataConnectorDefinitionKind from ._security_insights_enums import DataConnectorKind from ._security_insights_enums import DataConnectorLicenseState from ._security_insights_enums import DataTypeState @@ -448,21 +530,23 @@ from ._security_insights_enums import DeviceImportance from ._security_insights_enums import ElevationToken from ._security_insights_enums import EntityItemQueryKind -from ._security_insights_enums import EntityKind +from ._security_insights_enums import EntityKindEnum from ._security_insights_enums import EntityMappingType from ._security_insights_enums import EntityProviders from ._security_insights_enums import EntityQueryKind from ._security_insights_enums import EntityQueryTemplateKind from ._security_insights_enums import EntityTimelineKind from ._security_insights_enums import EntityType -from ._security_insights_enums import Enum13 -from ._security_insights_enums import Enum15 +from ._security_insights_enums import Enum20 +from ._security_insights_enums import Enum22 from ._security_insights_enums import EventGroupingAggregationKind from ._security_insights_enums import FileFormat from ._security_insights_enums import FileHashAlgorithm from ._security_insights_enums import FileImportContentType from ._security_insights_enums import FileImportState +from ._security_insights_enums import Flag from ._security_insights_enums import GetInsightsError +from ._security_insights_enums import HypothesisStatus from ._security_insights_enums import IncidentClassification from ._security_insights_enums import IncidentClassificationReason from ._security_insights_enums import IncidentLabelType @@ -474,17 +558,23 @@ from ._security_insights_enums import Kind from ._security_insights_enums import MatchingMethod from ._security_insights_enums import MicrosoftSecurityProductName +from ._security_insights_enums import Mode +from ._security_insights_enums import MtpProvider from ._security_insights_enums import OSFamily from ._security_insights_enums import Operator from ._security_insights_enums import OutputType from ._security_insights_enums import OwnerType +from ._security_insights_enums import PackageKind from ._security_insights_enums import PermissionProviderScope from ._security_insights_enums import PollingFrequency from ._security_insights_enums import Priority from ._security_insights_enums import ProviderName +from ._security_insights_enums import ProviderPermissionsScope +from ._security_insights_enums import ProvisioningState from ._security_insights_enums import RegistryHive from ._security_insights_enums import RegistryValueKind from ._security_insights_enums import RepoType +from ._security_insights_enums import RepositoryAccessKind from ._security_insights_enums import SecurityMLAnalyticsSettingsKind from ._security_insights_enums import SettingKind from ._security_insights_enums import SettingType @@ -492,15 +582,17 @@ from ._security_insights_enums import SourceKind from ._security_insights_enums import SourceType from ._security_insights_enums import State +from ._security_insights_enums import Status from ._security_insights_enums import SupportTier from ._security_insights_enums import TemplateStatus -from ._security_insights_enums import ThreatIntelligenceResourceKindEnum -from ._security_insights_enums import ThreatIntelligenceSortingCriteriaEnum +from ._security_insights_enums import ThreatIntelligenceResourceInnerKind +from ._security_insights_enums import ThreatIntelligenceSortingOrder from ._security_insights_enums import TriggerOperator from ._security_insights_enums import TriggersOn from ._security_insights_enums import TriggersWhen from ._security_insights_enums import UebaDataSources from ._security_insights_enums import Version +from ._security_insights_enums import WarningCode from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -542,9 +634,11 @@ "AlertRuleTemplatesList", "AlertRulesList", "AlertsDataTypeOfDataConnector", + "AnalyticsRuleRunTrigger", "Anomalies", "AnomalySecurityMLAnalyticsSettings", "AnomalyTimelineItem", + "AssignmentItem", "AutomationRule", "AutomationRuleAction", "AutomationRuleAddIncidentTaskAction", @@ -568,8 +662,11 @@ "AwsS3DataConnectorDataTypes", "AwsS3DataConnectorDataTypesLogs", "AzureDevOpsResourceInfo", + "AzureEntityResource", "AzureResourceEntity", "AzureResourceEntityProperties", + "BillingStatistic", + "BillingStatisticList", "Bookmark", "BookmarkEntityMappings", "BookmarkExpandParameters", @@ -597,15 +694,26 @@ "CodelessUiDataConnector", "ConnectedEntity", "ConnectivityCriteria", + "ConnectivityCriterion", + "ConnectorDataType", + "ConnectorDefinitionsAvailability", + "ConnectorDefinitionsPermissions", + "ConnectorDefinitionsResourceProvider", "ConnectorInstructionModelBase", "Content", - "ContentPathMap", "CustomEntityQuery", + "CustomPermissionDetails", + "CustomizableConnectionsConfig", + "CustomizableConnectorDefinition", + "CustomizableConnectorUiConfig", "Customs", "CustomsPermission", + "DCRConfiguration", "DataConnector", "DataConnectorConnectBody", "DataConnectorDataTypeCommon", + "DataConnectorDefinition", + "DataConnectorDefinitionArmCollectionWrapper", "DataConnectorList", "DataConnectorRequirementsState", "DataConnectorTenantId", @@ -641,6 +749,7 @@ "EntityInsightItem", "EntityInsightItemQueryTimeInterval", "EntityList", + "EntityManualTriggerRequestBody", "EntityMapping", "EntityQuery", "EntityQueryItem", @@ -652,6 +761,10 @@ "EntityTimelineItem", "EntityTimelineParameters", "EntityTimelineResponse", + "Error", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "EventGroupingSettings", "ExpansionEntityQuery", "ExpansionResultAggregation", @@ -675,15 +788,26 @@ "FusionTemplateSourceSetting", "FusionTemplateSourceSubType", "FusionTemplateSubTypeSeverityFilter", + "GCPAuthProperties", + "GCPDataConnector", + "GCPRequestProperties", "GeoLocation", "GetInsightsErrorKind", "GetInsightsResultsMetadata", "GetQueriesResponse", "GitHubResourceInfo", "GraphQueries", + "GraphQuery", "GroupingConfiguration", "HostEntity", "HostEntityProperties", + "Hunt", + "HuntComment", + "HuntCommentList", + "HuntList", + "HuntOwner", + "HuntRelation", + "HuntRelationList", "HuntingBookmark", "HuntingBookmarkProperties", "Incident", @@ -713,6 +837,8 @@ "InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem", "InsightsTableResult", "InsightsTableResultColumnsItem", + "InstructionStep", + "InstructionStepDetails", "InstructionSteps", "InstructionStepsInstructionsItem", "Instructions", @@ -723,6 +849,9 @@ "IoTDeviceEntityProperties", "IpEntity", "IpEntityProperties", + "Job", + "JobItem", + "JobList", "LastDataReceivedDataType", "MCASCheckRequirements", "MCASCheckRequirementsProperties", @@ -740,12 +869,12 @@ "MSTICheckRequirementsProperties", "MSTIDataConnector", "MSTIDataConnectorDataTypes", - "MSTIDataConnectorDataTypesBingSafetyPhishingURL", "MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", "MSTIDataConnectorProperties", "MTPCheckRequirementsProperties", "MTPDataConnector", "MTPDataConnectorDataTypes", + "MTPDataConnectorDataTypesAlerts", "MTPDataConnectorDataTypesIncidents", "MTPDataConnectorProperties", "MailClusterEntity", @@ -765,12 +894,19 @@ "MetadataPatch", "MetadataSource", "MetadataSupport", + "MicrosoftPurviewInformationProtectionCheckRequirements", + "MicrosoftPurviewInformationProtectionCheckRequirementsProperties", + "MicrosoftPurviewInformationProtectionConnectorDataTypes", + "MicrosoftPurviewInformationProtectionConnectorDataTypesLogs", + "MicrosoftPurviewInformationProtectionDataConnector", + "MicrosoftPurviewInformationProtectionDataConnectorProperties", "MicrosoftSecurityIncidentCreationAlertRule", "MicrosoftSecurityIncidentCreationAlertRuleCommonProperties", "MicrosoftSecurityIncidentCreationAlertRuleProperties", "MicrosoftSecurityIncidentCreationAlertRuleTemplate", "MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties", "MtpCheckRequirements", + "MtpFilteredProviders", "NicEntity", "NicEntityProperties", "NrtAlertRule", @@ -807,16 +943,29 @@ "Operation", "OperationDisplay", "OperationsList", + "PackageBaseProperties", + "PackageList", + "PackageModel", + "PackageProperties", "Permissions", "PermissionsCustomsItem", "PermissionsResourceProviderItem", "PlaybookActionProperties", "ProcessEntity", "ProcessEntityProperties", + "ProductPackageAdditionalProperties", + "ProductPackageList", + "ProductPackageModel", + "ProductPackageProperties", + "ProductTemplateAdditionalProperties", + "ProductTemplateList", + "ProductTemplateModel", + "ProductTemplateProperties", "PropertyArrayChangedConditionProperties", "PropertyArrayConditionProperties", "PropertyChangedConditionProperties", "PropertyConditionProperties", + "PullRequest", "QueryBasedAlertRuleTemplateProperties", "Recommendation", "RecommendationList", @@ -831,12 +980,17 @@ "Repo", "RepoList", "Repository", + "RepositoryAccess", + "RepositoryAccessProperties", "RepositoryResourceInfo", "RequiredPermissions", "Resource", "ResourceProvider", + "ResourceProviderRequiredPermissions", "ResourceWithEtag", "SampleQueries", + "SampleQuery", + "SapSolutionUsageStatistic", "ScheduledAlertRule", "ScheduledAlertRuleCommonProperties", "ScheduledAlertRuleProperties", @@ -853,6 +1007,7 @@ "SentinelEntityMapping", "SentinelOnboardingState", "SentinelOnboardingStatesList", + "ServicePrincipal", "SettingList", "Settings", "SourceControl", @@ -868,6 +1023,11 @@ "TIDataConnectorProperties", "TeamInformation", "TeamProperties", + "TemplateAdditionalProperties", + "TemplateBaseProperties", + "TemplateList", + "TemplateModel", + "TemplateProperties", "ThreatIntelligence", "ThreatIntelligenceAlertRule", "ThreatIntelligenceAlertRuleTemplate", @@ -897,16 +1057,28 @@ "TimelineAggregation", "TimelineError", "TimelineResultsMetadata", + "TriggeredAnalyticsRuleRun", + "TriggeredAnalyticsRuleRuns", "Ueba", "UrlEntity", "UrlEntityProperties", "UserInfo", "ValidationError", + "Warning", + "WarningBody", "Watchlist", "WatchlistItem", "WatchlistItemList", "WatchlistList", "Webhook", + "WorkspaceManagerAssignment", + "WorkspaceManagerAssignmentList", + "WorkspaceManagerConfiguration", + "WorkspaceManagerConfigurationList", + "WorkspaceManagerGroup", + "WorkspaceManagerGroupList", + "WorkspaceManagerMember", + "WorkspaceManagerMembersList", "ActionType", "AlertDetail", "AlertProperty", @@ -924,6 +1096,7 @@ "AutomationRulePropertyChangedConditionSupportedPropertyType", "AutomationRulePropertyConditionSupportedOperator", "AutomationRulePropertyConditionSupportedProperty", + "BillingStatisticKind", "Category", "ConditionType", "ConfidenceLevel", @@ -935,6 +1108,7 @@ "CreatedByType", "CustomEntityQueryKind", "DataConnectorAuthorizationState", + "DataConnectorDefinitionKind", "DataConnectorKind", "DataConnectorLicenseState", "DataTypeState", @@ -947,21 +1121,23 @@ "DeviceImportance", "ElevationToken", "EntityItemQueryKind", - "EntityKind", + "EntityKindEnum", "EntityMappingType", "EntityProviders", "EntityQueryKind", "EntityQueryTemplateKind", "EntityTimelineKind", "EntityType", - "Enum13", - "Enum15", + "Enum20", + "Enum22", "EventGroupingAggregationKind", "FileFormat", "FileHashAlgorithm", "FileImportContentType", "FileImportState", + "Flag", "GetInsightsError", + "HypothesisStatus", "IncidentClassification", "IncidentClassificationReason", "IncidentLabelType", @@ -973,17 +1149,23 @@ "Kind", "MatchingMethod", "MicrosoftSecurityProductName", + "Mode", + "MtpProvider", "OSFamily", "Operator", "OutputType", "OwnerType", + "PackageKind", "PermissionProviderScope", "PollingFrequency", "Priority", "ProviderName", + "ProviderPermissionsScope", + "ProvisioningState", "RegistryHive", "RegistryValueKind", "RepoType", + "RepositoryAccessKind", "SecurityMLAnalyticsSettingsKind", "SettingKind", "SettingType", @@ -991,15 +1173,17 @@ "SourceKind", "SourceType", "State", + "Status", "SupportTier", "TemplateStatus", - "ThreatIntelligenceResourceKindEnum", - "ThreatIntelligenceSortingCriteriaEnum", + "ThreatIntelligenceResourceInnerKind", + "ThreatIntelligenceSortingOrder", "TriggerOperator", "TriggersOn", "TriggersWhen", "UebaDataSources", "Version", + "WarningCode", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py index 5a15e9c34571..9bb418896bdf 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py @@ -34,7 +34,8 @@ class DataConnectorsCheckRequirements(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AwsCloudTrailCheckRequirements, AwsS3CheckRequirements, AADCheckRequirements, AATPCheckRequirements, ASCCheckRequirements, Dynamics365CheckRequirements, - IoTCheckRequirements, MCASCheckRequirements, MDATPCheckRequirements, MSTICheckRequirements, + IoTCheckRequirements, MCASCheckRequirements, MDATPCheckRequirements, + MicrosoftPurviewInformationProtectionCheckRequirements, MSTICheckRequirements, MtpCheckRequirements, Office365ProjectCheckRequirements, OfficeATPCheckRequirements, OfficeIRMCheckRequirements, OfficePowerBICheckRequirements, TICheckRequirements, TiTaxiiCheckRequirements @@ -44,10 +45,10 @@ class DataConnectorsCheckRequirements(_serialization.Model): :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -70,6 +71,7 @@ class DataConnectorsCheckRequirements(_serialization.Model): "IOT": "IoTCheckRequirements", "MicrosoftCloudAppSecurity": "MCASCheckRequirements", "MicrosoftDefenderAdvancedThreatProtection": "MDATPCheckRequirements", + "MicrosoftPurviewInformationProtection": "MicrosoftPurviewInformationProtectionCheckRequirements", "MicrosoftThreatIntelligence": "MSTICheckRequirements", "MicrosoftThreatProtection": "MtpCheckRequirements", "Office365Project": "Office365ProjectCheckRequirements", @@ -81,24 +83,24 @@ class DataConnectorsCheckRequirements(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: Optional[str] = None class AADCheckRequirements(DataConnectorsCheckRequirements): - """Represents AAD (Azure Active Directory) requirements check request. + """Represents AADIP (Azure Active Directory Identity Protection) requirements check request. All required parameters must be populated in order to send to Azure. :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -113,7 +115,7 @@ class AADCheckRequirements(DataConnectorsCheckRequirements): "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str @@ -140,7 +142,7 @@ class DataConnectorTenantId(_serialization.Model): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -150,7 +152,7 @@ def __init__(self, *, tenant_id: str, **kwargs): class AADCheckRequirementsProperties(DataConnectorTenantId): - """AAD (Azure Active Directory) requirements check properties. + """AADIP (Azure Active Directory Identity Protection) requirements check properties. All required parameters must be populated in order to send to Azure. @@ -166,7 +168,7 @@ class AADCheckRequirementsProperties(DataConnectorTenantId): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -206,7 +208,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -250,7 +252,7 @@ class ResourceWithEtag(Resource): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -265,10 +267,10 @@ class DataConnector(ResourceWithEtag): You probably want to use the sub-classes and not this class directly. Known sub-classes are: CodelessApiPollingDataConnector, AwsCloudTrailDataConnector, AwsS3DataConnector, AADDataConnector, AATPDataConnector, ASCDataConnector, Dynamics365DataConnector, - CodelessUiDataConnector, IoTDataConnector, MCASDataConnector, MDATPDataConnector, - MSTIDataConnector, MTPDataConnector, OfficeDataConnector, Office365ProjectDataConnector, - OfficeATPDataConnector, OfficeIRMDataConnector, OfficePowerBIDataConnector, TIDataConnector, - TiTaxiiDataConnector + GCPDataConnector, CodelessUiDataConnector, IoTDataConnector, MCASDataConnector, + MDATPDataConnector, MicrosoftPurviewInformationProtectionDataConnector, MSTIDataConnector, + MTPDataConnector, OfficeDataConnector, Office365ProjectDataConnector, OfficeATPDataConnector, + OfficeIRMDataConnector, OfficePowerBIDataConnector, TIDataConnector, TiTaxiiDataConnector Variables are only populated by the server, and will be ignored when sending a request. @@ -290,10 +292,10 @@ class DataConnector(ResourceWithEtag): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -323,10 +325,12 @@ class DataConnector(ResourceWithEtag): "AzureAdvancedThreatProtection": "AATPDataConnector", "AzureSecurityCenter": "ASCDataConnector", "Dynamics365": "Dynamics365DataConnector", + "GCP": "GCPDataConnector", "GenericUI": "CodelessUiDataConnector", "IOT": "IoTDataConnector", "MicrosoftCloudAppSecurity": "MCASDataConnector", "MicrosoftDefenderAdvancedThreatProtection": "MDATPDataConnector", + "MicrosoftPurviewInformationProtection": "MicrosoftPurviewInformationProtectionDataConnector", "MicrosoftThreatIntelligence": "MSTIDataConnector", "MicrosoftThreatProtection": "MTPDataConnector", "Office365": "OfficeDataConnector", @@ -339,7 +343,7 @@ class DataConnector(ResourceWithEtag): } } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -349,7 +353,7 @@ def __init__(self, *, etag: Optional[str] = None, **kwargs): class AADDataConnector(DataConnector): - """Represents AAD (Azure Active Directory) data connector. + """Represents AADIP (Azure Active Directory Identity Protection) data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -371,10 +375,10 @@ class AADDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -407,8 +411,8 @@ def __init__( etag: Optional[str] = None, tenant_id: Optional[str] = None, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -434,7 +438,7 @@ class DataConnectorWithAlertsProperties(_serialization.Model): "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, } - def __init__(self, *, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs): + def __init__(self, *, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any) -> None: """ :keyword data_types: The available data types for the connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -444,7 +448,7 @@ def __init__(self, *, data_types: Optional["_models.AlertsDataTypeOfDataConnecto class AADDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): - """AAD (Azure Active Directory) data connector properties. + """AADIP (Azure Active Directory Identity Protection) data connector properties. All required parameters must be populated in order to send to Azure. @@ -464,8 +468,8 @@ class AADDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsP } def __init__( - self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs - ): + self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any + ) -> None: """ :keyword data_types: The available data types for the connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -485,10 +489,10 @@ class AATPCheckRequirements(DataConnectorsCheckRequirements): :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -503,7 +507,7 @@ class AATPCheckRequirements(DataConnectorsCheckRequirements): "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str @@ -530,7 +534,7 @@ class AATPCheckRequirementsProperties(DataConnectorTenantId): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -561,10 +565,10 @@ class AATPDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -597,8 +601,8 @@ def __init__( etag: Optional[str] = None, tenant_id: Optional[str] = None, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -634,8 +638,8 @@ class AATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlerts } def __init__( - self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs - ): + self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any + ) -> None: """ :keyword data_types: The available data types for the connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -675,7 +679,7 @@ class Entity(Resource): "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum """ _validation = { @@ -721,7 +725,7 @@ class Entity(Resource): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: Optional[str] = None @@ -749,7 +753,7 @@ class AccountEntity(Entity): # pylint: disable=too-many-instance-attributes "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -831,7 +835,7 @@ class AccountEntity(Entity): # pylint: disable=too-many-instance-attributes "dns_domain": {"key": "properties.dnsDomain", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "Account" @@ -874,7 +878,7 @@ class EntityCommonProperties(_serialization.Model): "friendly_name": {"key": "friendlyName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.additional_data = None @@ -957,7 +961,7 @@ class AccountEntityProperties(EntityCommonProperties): # pylint: disable=too-ma "dns_domain": {"key": "dnsDomain", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.aad_tenant_id = None @@ -993,7 +997,7 @@ class ActionPropertiesBase(_serialization.Model): "logic_app_resource_id": {"key": "logicAppResourceId", "type": "str"}, } - def __init__(self, *, logic_app_resource_id: str, **kwargs): + def __init__(self, *, logic_app_resource_id: str, **kwargs: Any) -> None: """ :keyword logic_app_resource_id: Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. @@ -1052,8 +1056,8 @@ def __init__( etag: Optional[str] = None, logic_app_resource_id: Optional[str] = None, trigger_uri: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1091,7 +1095,7 @@ class ActionRequestProperties(ActionPropertiesBase): "trigger_uri": {"key": "triggerUri", "type": "str"}, } - def __init__(self, *, logic_app_resource_id: str, trigger_uri: str, **kwargs): + def __init__(self, *, logic_app_resource_id: str, trigger_uri: str, **kwargs: Any) -> None: """ :keyword logic_app_resource_id: Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. @@ -1152,8 +1156,8 @@ def __init__( etag: Optional[str] = None, logic_app_resource_id: Optional[str] = None, workflow_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1190,7 +1194,7 @@ class ActionResponseProperties(ActionPropertiesBase): "workflow_id": {"key": "workflowId", "type": "str"}, } - def __init__(self, *, logic_app_resource_id: str, workflow_id: Optional[str] = None, **kwargs): + def __init__(self, *, logic_app_resource_id: str, workflow_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword logic_app_resource_id: Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. @@ -1226,7 +1230,7 @@ class ActionsList(_serialization.Model): "value": {"key": "value", "type": "[ActionResponse]"}, } - def __init__(self, *, value: List["_models.ActionResponse"], **kwargs): + def __init__(self, *, value: List["_models.ActionResponse"], **kwargs: Any) -> None: """ :keyword value: Array of actions. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.ActionResponse] @@ -1282,7 +1286,7 @@ class CustomEntityQuery(ResourceWithEtag): _subtype_map = {"kind": {"Activity": "ActivityCustomEntityQuery"}} - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1389,8 +1393,8 @@ def __init__( entities_filter: Optional[Dict[str, List[str]]] = None, template_name: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1445,7 +1449,7 @@ class ActivityEntityQueriesPropertiesQueryDefinitions(_serialization.Model): "query": {"key": "query", "type": "str"}, } - def __init__(self, *, query: Optional[str] = None, **kwargs): + def __init__(self, *, query: Optional[str] = None, **kwargs: Any) -> None: """ :keyword query: The Activity query to run on a given entity. :paramtype query: str @@ -1501,7 +1505,7 @@ class EntityQuery(ResourceWithEtag): _subtype_map = {"kind": {"Activity": "ActivityEntityQuery", "Expansion": "ExpansionEntityQuery"}} - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1609,8 +1613,8 @@ def __init__( entities_filter: Optional[Dict[str, List[str]]] = None, template_name: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -1697,7 +1701,7 @@ class EntityQueryTemplate(Resource): _subtype_map = {"kind": {"Activity": "ActivityEntityQueryTemplate"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: Optional[str] = None @@ -1785,8 +1789,8 @@ def __init__( input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Dict[str, List[str]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: The entity query title. :paramtype title: str @@ -1838,7 +1842,7 @@ class ActivityEntityQueryTemplatePropertiesQueryDefinitions(_serialization.Model "summarize_by": {"key": "summarizeBy", "type": "str"}, } - def __init__(self, *, query: Optional[str] = None, summarize_by: Optional[str] = None, **kwargs): + def __init__(self, *, query: Optional[str] = None, summarize_by: Optional[str] = None, **kwargs: Any) -> None: """ :keyword query: The Activity query to run on a given entity. :paramtype query: str @@ -1881,7 +1885,7 @@ class EntityTimelineItem(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: Optional[str] = None @@ -1943,8 +1947,8 @@ def __init__( last_activity_time_utc: datetime.datetime, content: str, title: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query_id: The activity query id. Required. :paramtype query_id: str @@ -1994,7 +1998,7 @@ class AddIncidentTaskActionProperties(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, title: str, description: Optional[str] = None, **kwargs): + def __init__(self, *, title: str, description: Optional[str] = None, **kwargs: Any) -> None: """ :keyword title: The title of the task. Required. :paramtype title: str @@ -2040,8 +2044,8 @@ def __init__( alert_tactics_column_name: Optional[str] = None, alert_severity_column_name: Optional[str] = None, alert_dynamic_properties: Optional[List["_models.AlertPropertyMapping"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_display_name_format: the format containing columns name(s) to override the alert name. @@ -2070,7 +2074,7 @@ class AlertPropertyMapping(_serialization.Model): :ivar alert_property: The V3 alert property. Known values are: "AlertLink", "ConfidenceLevel", "ConfidenceScore", "ExtendedLinks", "ProductName", "ProviderName", "ProductComponentName", - "RemediationSteps", and "Techniques". + "RemediationSteps", "Techniques", and "SubTechniques". :vartype alert_property: str or ~azure.mgmt.securityinsight.models.AlertProperty :ivar value: the column name to use to override this property. :vartype value: str @@ -2086,12 +2090,12 @@ def __init__( *, alert_property: Optional[Union[str, "_models.AlertProperty"]] = None, value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_property: The V3 alert property. Known values are: "AlertLink", "ConfidenceLevel", "ConfidenceScore", "ExtendedLinks", "ProductName", "ProviderName", - "ProductComponentName", "RemediationSteps", and "Techniques". + "ProductComponentName", "RemediationSteps", "Techniques", and "SubTechniques". :paramtype alert_property: str or ~azure.mgmt.securityinsight.models.AlertProperty :keyword value: the column name to use to override this property. :paramtype value: str @@ -2159,7 +2163,7 @@ class AlertRule(ResourceWithEtag): } } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -2191,7 +2195,7 @@ class AlertRulesList(_serialization.Model): "value": {"key": "value", "type": "[AlertRule]"}, } - def __init__(self, *, value: List["_models.AlertRule"], **kwargs): + def __init__(self, *, value: List["_models.AlertRule"], **kwargs: Any) -> None: """ :keyword value: Array of alert rules. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.AlertRule] @@ -2257,7 +2261,7 @@ class AlertRuleTemplate(Resource): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: Optional[str] = None @@ -2277,7 +2281,9 @@ class AlertRuleTemplateDataSource(_serialization.Model): "data_types": {"key": "dataTypes", "type": "[str]"}, } - def __init__(self, *, connector_id: Optional[str] = None, data_types: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, connector_id: Optional[str] = None, data_types: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword connector_id: The connector id that provides the following data types. :paramtype connector_id: str @@ -2336,8 +2342,8 @@ def __init__( display_name: Optional[str] = None, required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, status: Optional[Union[str, "_models.TemplateStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -2386,7 +2392,7 @@ class AlertRuleTemplatesList(_serialization.Model): "value": {"key": "value", "type": "[AlertRuleTemplate]"}, } - def __init__(self, *, value: List["_models.AlertRuleTemplate"], **kwargs): + def __init__(self, *, value: List["_models.AlertRuleTemplate"], **kwargs: Any) -> None: """ :keyword value: Array of alert rule templates. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.AlertRuleTemplate] @@ -2451,8 +2457,8 @@ def __init__( status: Optional[Union[str, "_models.TemplateStatus"]] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -2501,7 +2507,7 @@ class AlertsDataTypeOfDataConnector(_serialization.Model): "alerts": {"key": "alerts", "type": "DataConnectorDataTypeCommon"}, } - def __init__(self, *, alerts: "_models.DataConnectorDataTypeCommon", **kwargs): + def __init__(self, *, alerts: "_models.DataConnectorDataTypeCommon", **kwargs: Any) -> None: """ :keyword alerts: Alerts data type connection. Required. :paramtype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon @@ -2510,6 +2516,32 @@ def __init__(self, *, alerts: "_models.DataConnectorDataTypeCommon", **kwargs): self.alerts = alerts +class AnalyticsRuleRunTrigger(_serialization.Model): + """Analytics Rule Run Trigger request. + + All required parameters must be populated in order to send to Azure. + + :ivar execution_time_utc: Required. + :vartype execution_time_utc: ~datetime.datetime + """ + + _validation = { + "execution_time_utc": {"required": True}, + } + + _attribute_map = { + "execution_time_utc": {"key": "properties.executionTimeUtc", "type": "iso-8601"}, + } + + def __init__(self, *, execution_time_utc: datetime.datetime, **kwargs: Any) -> None: + """ + :keyword execution_time_utc: Required. + :paramtype execution_time_utc: ~datetime.datetime + """ + super().__init__(**kwargs) + self.execution_time_utc = execution_time_utc + + class Settings(ResourceWithEtag): """The Setting. @@ -2559,7 +2591,7 @@ class Settings(ResourceWithEtag): "kind": {"Anomalies": "Anomalies", "EntityAnalytics": "EntityAnalytics", "EyesOn": "EyesOn", "Ueba": "Ueba"} } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -2614,7 +2646,7 @@ class Anomalies(Settings): "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -2670,7 +2702,7 @@ class SecurityMLAnalyticsSetting(ResourceWithEtag): _subtype_map = {"kind": {"Anomaly": "AnomalySecurityMLAnalyticsSettings"}} - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -2788,8 +2820,8 @@ def __init__( is_default_settings: Optional[bool] = None, anomaly_settings_version: Optional[int] = None, settings_definition_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -2915,8 +2947,8 @@ def __init__( intent: Optional[str] = None, techniques: Optional[List[str]] = None, reasons: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_resource_id: The anomaly azure resource id. Required. :paramtype azure_resource_id: str @@ -2964,10 +2996,10 @@ class ASCCheckRequirements(DataConnectorsCheckRequirements): :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar subscription_id: The subscription id to connect to, and get the data from. :vartype subscription_id: str @@ -2982,7 +3014,7 @@ class ASCCheckRequirements(DataConnectorsCheckRequirements): "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, } - def __init__(self, *, subscription_id: Optional[str] = None, **kwargs): + def __init__(self, *, subscription_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword subscription_id: The subscription id to connect to, and get the data from. :paramtype subscription_id: str @@ -3015,10 +3047,10 @@ class ASCDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar data_types: The available data types for the connector. :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -3051,8 +3083,8 @@ def __init__( etag: Optional[str] = None, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -3086,8 +3118,8 @@ def __init__( *, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_types: The available data types for the connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -3098,6 +3130,26 @@ def __init__( self.subscription_id = subscription_id +class AssignmentItem(_serialization.Model): + """An entity describing a content item. + + :ivar resource_id: The resource id of the content item. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the content item. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + class AutomationRule(ResourceWithEtag): # pylint: disable=too-many-instance-attributes """AutomationRule. @@ -3175,8 +3227,8 @@ def __init__( triggering_logic: "_models.AutomationRuleTriggeringLogic", actions: List["_models.AutomationRuleAction"], etag: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -3234,7 +3286,7 @@ class AutomationRuleAction(_serialization.Model): } } - def __init__(self, *, order: int, **kwargs): + def __init__(self, *, order: int, **kwargs: Any) -> None: """ :keyword order: Required. :paramtype order: int @@ -3271,8 +3323,12 @@ class AutomationRuleAddIncidentTaskAction(AutomationRuleAction): } def __init__( - self, *, order: int, action_configuration: Optional["_models.AddIncidentTaskActionProperties"] = None, **kwargs - ): + self, + *, + order: int, + action_configuration: Optional["_models.AddIncidentTaskActionProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword order: Required. :paramtype order: int @@ -3288,7 +3344,7 @@ def __init__( class AutomationRuleBooleanCondition(_serialization.Model): """AutomationRuleBooleanCondition. - :ivar operator: Known values are: "And" and "Or". + :ivar operator: Known values are: "And", "Or", "And", and "Or". :vartype operator: str or ~azure.mgmt.securityinsight.models.AutomationRuleBooleanConditionSupportedOperator :ivar inner_conditions: @@ -3309,10 +3365,10 @@ def __init__( *, operator: Optional[Union[str, "_models.AutomationRuleBooleanConditionSupportedOperator"]] = None, inner_conditions: Optional[List["_models.AutomationRuleCondition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword operator: Known values are: "And" and "Or". + :keyword operator: Known values are: "And", "Or", "And", and "Or". :paramtype operator: str or ~azure.mgmt.securityinsight.models.AutomationRuleBooleanConditionSupportedOperator :keyword inner_conditions: @@ -3355,7 +3411,7 @@ class AutomationRuleCondition(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.condition_type: Optional[str] = None @@ -3387,8 +3443,8 @@ class AutomationRuleModifyPropertiesAction(AutomationRuleAction): } def __init__( - self, *, order: int, action_configuration: Optional["_models.IncidentPropertiesAction"] = None, **kwargs - ): + self, *, order: int, action_configuration: Optional["_models.IncidentPropertiesAction"] = None, **kwargs: Any + ) -> None: """ :keyword order: Required. :paramtype order: int @@ -3425,8 +3481,8 @@ def __init__( change_type: Optional[ Union[str, "_models.AutomationRulePropertyArrayChangedConditionSupportedChangeType"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword array_type: Known values are: "Alerts", "Labels", "Tactics", and "Comments". :paramtype array_type: str or @@ -3471,8 +3527,8 @@ def __init__( Union[str, "_models.AutomationRulePropertyArrayConditionSupportedArrayConditionType"] ] = None, item_conditions: Optional[List["_models.AutomationRuleCondition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword array_type: Known values are: "CustomDetails" and "CustomDetailValues". :paramtype array_type: str or @@ -3523,8 +3579,8 @@ def __init__( change_type: Optional[Union[str, "_models.AutomationRulePropertyChangedConditionSupportedChangedType"]] = None, operator: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedOperator"]] = None, property_values: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property_name: Known values are: "IncidentSeverity", "IncidentStatus", and "IncidentOwner". @@ -3588,8 +3644,8 @@ def __init__( property_name: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedProperty"]] = None, operator: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedOperator"]] = None, property_values: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property_name: The property to evaluate in an automation rule property condition. Known values are: "IncidentTitle", "IncidentDescription", "IncidentSeverity", "IncidentStatus", @@ -3648,8 +3704,8 @@ class AutomationRuleRunPlaybookAction(AutomationRuleAction): } def __init__( - self, *, order: int, action_configuration: Optional["_models.PlaybookActionProperties"] = None, **kwargs - ): + self, *, order: int, action_configuration: Optional["_models.PlaybookActionProperties"] = None, **kwargs: Any + ) -> None: """ :keyword order: Required. :paramtype order: int @@ -3676,8 +3732,8 @@ class AutomationRulesList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.AutomationRule"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.AutomationRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: :paramtype value: list[~azure.mgmt.securityinsight.models.AutomationRule] @@ -3731,8 +3787,8 @@ def __init__( triggers_when: Union[str, "_models.TriggersWhen"], expiration_time_utc: Optional[datetime.datetime] = None, conditions: Optional[List["_models.AutomationRuleCondition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_enabled: Determines whether the automation rule is enabled or disabled. Required. :paramtype is_enabled: bool @@ -3769,7 +3825,9 @@ class Availability(_serialization.Model): "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__(self, *, status: Optional[Literal[1]] = None, is_preview: Optional[bool] = None, **kwargs): + def __init__( + self, *, status: Optional[Literal[1]] = None, is_preview: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword status: The connector Availability Status. Default value is 1. :paramtype status: int @@ -3789,10 +3847,10 @@ class AwsCloudTrailCheckRequirements(DataConnectorsCheckRequirements): :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -3804,7 +3862,7 @@ class AwsCloudTrailCheckRequirements(DataConnectorsCheckRequirements): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "AmazonWebServicesCloudTrail" @@ -3833,10 +3891,10 @@ class AwsCloudTrailDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar aws_role_arn: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws account. @@ -3870,8 +3928,8 @@ def __init__( etag: Optional[str] = None, aws_role_arn: Optional[str] = None, data_types: Optional["_models.AwsCloudTrailDataConnectorDataTypes"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -3904,7 +3962,7 @@ class AwsCloudTrailDataConnectorDataTypes(_serialization.Model): "logs": {"key": "logs", "type": "AwsCloudTrailDataConnectorDataTypesLogs"}, } - def __init__(self, *, logs: "_models.AwsCloudTrailDataConnectorDataTypesLogs", **kwargs): + def __init__(self, *, logs: "_models.AwsCloudTrailDataConnectorDataTypesLogs", **kwargs: Any) -> None: """ :keyword logs: Logs data type. Required. :paramtype logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs @@ -3931,7 +3989,7 @@ class DataConnectorDataTypeCommon(_serialization.Model): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". @@ -3959,7 +4017,7 @@ class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". @@ -3976,10 +4034,10 @@ class AwsS3CheckRequirements(DataConnectorsCheckRequirements): :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -3991,7 +4049,7 @@ class AwsS3CheckRequirements(DataConnectorsCheckRequirements): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "AmazonWebServicesS3" @@ -4020,10 +4078,10 @@ class AwsS3DataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar destination_table: The logs destination table name in LogAnalytics. :vartype destination_table: str @@ -4064,8 +4122,8 @@ def __init__( sqs_urls: Optional[List[str]] = None, role_arn: Optional[str] = None, data_types: Optional["_models.AwsS3DataConnectorDataTypes"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -4103,7 +4161,7 @@ class AwsS3DataConnectorDataTypes(_serialization.Model): "logs": {"key": "logs", "type": "AwsS3DataConnectorDataTypesLogs"}, } - def __init__(self, *, logs: "_models.AwsS3DataConnectorDataTypesLogs", **kwargs): + def __init__(self, *, logs: "_models.AwsS3DataConnectorDataTypesLogs", **kwargs: Any) -> None: """ :keyword logs: Logs data type. Required. :paramtype logs: ~azure.mgmt.securityinsight.models.AwsS3DataConnectorDataTypesLogs @@ -4130,7 +4188,7 @@ class AwsS3DataConnectorDataTypesLogs(DataConnectorDataTypeCommon): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". @@ -4153,7 +4211,9 @@ class AzureDevOpsResourceInfo(_serialization.Model): "service_connection_id": {"key": "serviceConnectionId", "type": "str"}, } - def __init__(self, *, pipeline_id: Optional[str] = None, service_connection_id: Optional[str] = None, **kwargs): + def __init__( + self, *, pipeline_id: Optional[str] = None, service_connection_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword pipeline_id: Id of the pipeline created for the source-control. :paramtype pipeline_id: str @@ -4165,6 +4225,48 @@ def __init__(self, *, pipeline_id: Optional[str] = None, service_connection_id: self.service_connection_id = service_connection_id +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. + + 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.securityinsight.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.etag = None + + class AzureResourceEntity(Entity): """Represents an azure resource entity. @@ -4187,7 +4289,7 @@ class AzureResourceEntity(Entity): "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -4224,7 +4326,7 @@ class AzureResourceEntity(Entity): "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "AzureResource" @@ -4265,13 +4367,99 @@ class AzureResourceEntityProperties(EntityCommonProperties): "subscription_id": {"key": "subscriptionId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None self.subscription_id = None +class BillingStatistic(AzureEntityResource): + """Billing statistic. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SapSolutionUsageStatistic + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar kind: The kind of the billing statistic. Required. "SapSolutionUsage" + :vartype kind: str or ~azure.mgmt.securityinsight.models.BillingStatisticKind + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + } + + _subtype_map = {"kind": {"SapSolutionUsage": "SapSolutionUsageStatistic"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: Optional[str] = None + + +class BillingStatisticList(_serialization.Model): + """List of all Microsoft Sentinel billing statistics. + + 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 next_link: URL to fetch the next set of billing statistics. + :vartype next_link: str + :ivar value: Array of billing statistics. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.BillingStatistic] + """ + + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[BillingStatistic]"}, + } + + def __init__(self, *, value: List["_models.BillingStatistic"], **kwargs: Any) -> None: + """ + :keyword value: Array of billing statistics. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.BillingStatistic] + """ + super().__init__(**kwargs) + self.next_link = None + self.value = value + + class Bookmark(ResourceWithEtag): # pylint: disable=too-many-instance-attributes """Represents a bookmark in Azure Security Insights. @@ -4375,8 +4563,8 @@ def __init__( entity_mappings: Optional[List["_models.BookmarkEntityMappings"]] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -4451,8 +4639,8 @@ def __init__( *, entity_type: Optional[str] = None, field_mappings: Optional[List["_models.EntityFieldMapping"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword entity_type: The entity type. :paramtype entity_type: str @@ -4489,8 +4677,8 @@ def __init__( end_time: Optional[datetime.datetime] = None, expansion_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword end_time: The end date filter, so the only expansion results returned are before this date. @@ -4526,8 +4714,8 @@ def __init__( *, meta_data: Optional["_models.ExpansionResultsMetadata"] = None, value: Optional["_models.BookmarkExpandResponseValue"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword meta_data: The metadata from the expansion operation results. :paramtype meta_data: ~azure.mgmt.securityinsight.models.ExpansionResultsMetadata @@ -4558,8 +4746,8 @@ def __init__( *, entities: Optional[List["_models.Entity"]] = None, edges: Optional[List["_models.ConnectedEntity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword entities: Array of the expansion result entities. :paramtype entities: list[~azure.mgmt.securityinsight.models.Entity] @@ -4594,7 +4782,7 @@ class BookmarkList(_serialization.Model): "value": {"key": "value", "type": "[Bookmark]"}, } - def __init__(self, *, value: List["_models.Bookmark"], **kwargs): + def __init__(self, *, value: List["_models.Bookmark"], **kwargs: Any) -> None: """ :keyword value: Array of bookmarks. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.Bookmark] @@ -4658,8 +4846,8 @@ def __init__( event_time: Optional[datetime.datetime] = None, created_by: Optional["_models.UserInfo"] = None, labels: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_resource_id: The bookmark azure resource id. Required. :paramtype azure_resource_id: str @@ -4691,7 +4879,8 @@ def __init__( class BooleanConditionProperties(AutomationRuleCondition): - """Describes an automation rule condition that applies a boolean operator (e.g AND, OR) to conditions. + """Describes an automation rule condition that applies a boolean operator (e.g AND, OR) to + conditions. All required parameters must be populated in order to send to Azure. @@ -4712,7 +4901,9 @@ class BooleanConditionProperties(AutomationRuleCondition): "condition_properties": {"key": "conditionProperties", "type": "AutomationRuleBooleanCondition"}, } - def __init__(self, *, condition_properties: Optional["_models.AutomationRuleBooleanCondition"] = None, **kwargs): + def __init__( + self, *, condition_properties: Optional["_models.AutomationRuleBooleanCondition"] = None, **kwargs: Any + ) -> None: """ :keyword condition_properties: :paramtype condition_properties: @@ -4750,8 +4941,8 @@ def __init__( name: Optional[str] = None, object_id: Optional[str] = None, user_principal_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword email: The email of the client. :paramtype email: str @@ -4791,7 +4982,7 @@ class CloudApplicationEntity(Entity): "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -4833,7 +5024,7 @@ class CloudApplicationEntity(Entity): "instance_name": {"key": "properties.instanceName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "CloudApplication" @@ -4880,7 +5071,7 @@ class CloudApplicationEntityProperties(EntityCommonProperties): "instance_name": {"key": "instanceName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.app_id = None @@ -4911,7 +5102,7 @@ class CloudErrorBody(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -4941,10 +5132,10 @@ class CodelessApiPollingDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar connector_ui_config: Config to describe the instructions blade. :vartype connector_ui_config: @@ -4979,8 +5170,8 @@ def __init__( etag: Optional[str] = None, connector_ui_config: Optional["_models.CodelessUiConnectorConfigProperties"] = None, polling_config: Optional["_models.CodelessConnectorPollingConfigProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -5070,8 +5261,8 @@ def __init__( token_endpoint_query_parameters: Optional[JSON] = None, is_client_secret_in_header: Optional[bool] = None, scope: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auth_type: The authentication type. Required. :paramtype auth_type: str @@ -5161,8 +5352,8 @@ def __init__( is_active: Optional[bool] = None, paging: Optional["_models.CodelessConnectorPollingPagingProperties"] = None, response: Optional["_models.CodelessConnectorPollingResponseProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_active: The poller active status. :paramtype is_active: bool @@ -5243,8 +5434,8 @@ def __init__( search_the_latest_time_stamp_from_events_list: Optional[str] = None, page_size_para_name: Optional[str] = None, page_size: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword paging_type: Describes the type. could be 'None', 'PageToken', 'PageCount', 'TimeStamp'. Required. @@ -5352,8 +5543,8 @@ def __init__( query_parameters_template: Optional[str] = None, start_time_attribute_name: Optional[str] = None, end_time_attribute_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword api_endpoint: Describe the endpoint we should pull the data from. Required. :paramtype api_endpoint: str @@ -5437,8 +5628,8 @@ def __init__( success_status_json_path: Optional[str] = None, success_status_value: Optional[str] = None, is_gzip_compressed: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword events_json_paths: Describes the path we should extract the data in the response. Required. @@ -5547,8 +5738,8 @@ def __init__( permissions: "_models.Permissions", instruction_steps: List["_models.CodelessUiConnectorConfigPropertiesInstructionStepsItem"], custom_image: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Connector blade title. Required. :paramtype title: str @@ -5616,8 +5807,8 @@ def __init__( *, type: Optional[Union[str, "_models.ConnectivityType"]] = None, value: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: type of connectivity. "IsConnectedQuery" :paramtype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType @@ -5648,8 +5839,8 @@ def __init__( *, type: Optional[Union[str, "_models.ConnectivityType"]] = None, value: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: type of connectivity. "IsConnectedQuery" :paramtype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType @@ -5674,7 +5865,9 @@ class LastDataReceivedDataType(_serialization.Model): "last_data_received_query": {"key": "lastDataReceivedQuery", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, last_data_received_query: Optional[str] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, last_data_received_query: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder. @@ -5702,7 +5895,9 @@ class CodelessUiConnectorConfigPropertiesDataTypesItem(LastDataReceivedDataType) "last_data_received_query": {"key": "lastDataReceivedQuery", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, last_data_received_query: Optional[str] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, last_data_received_query: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder. @@ -5736,8 +5931,8 @@ def __init__( metric_name: Optional[str] = None, legend: Optional[str] = None, base_query: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_name: the metric that the query is checking. :paramtype metric_name: str @@ -5775,8 +5970,8 @@ def __init__( metric_name: Optional[str] = None, legend: Optional[str] = None, base_query: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric_name: the metric that the query is checking. :paramtype metric_name: str @@ -5812,8 +6007,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, instructions: Optional[List["_models.InstructionStepsInstructionsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Instruction step title. :paramtype title: str @@ -5853,8 +6048,8 @@ def __init__( title: Optional[str] = None, description: Optional[str] = None, instructions: Optional[List["_models.InstructionStepsInstructionsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword title: Instruction step title. :paramtype title: str @@ -5881,7 +6076,7 @@ class SampleQueries(_serialization.Model): "query": {"key": "query", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, query: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: The sample query description. :paramtype description: str @@ -5907,7 +6102,7 @@ class CodelessUiConnectorConfigPropertiesSampleQueriesItem(SampleQueries): "query": {"key": "query", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, query: Optional[str] = None, **kwargs): + def __init__(self, *, description: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: """ :keyword description: The sample query description. :paramtype description: str @@ -5940,10 +6135,10 @@ class CodelessUiDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar connector_ui_config: Config to describe the instructions blade. :vartype connector_ui_config: @@ -5973,8 +6168,8 @@ def __init__( *, etag: Optional[str] = None, connector_ui_config: Optional["_models.CodelessUiConnectorConfigProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -6001,7 +6196,9 @@ class ConnectedEntity(_serialization.Model): "additional_data": {"key": "additionalData", "type": "object"}, } - def __init__(self, *, target_entity_id: Optional[str] = None, additional_data: Optional[JSON] = None, **kwargs): + def __init__( + self, *, target_entity_id: Optional[str] = None, additional_data: Optional[JSON] = None, **kwargs: Any + ) -> None: """ :keyword target_entity_id: Entity Id of the connected entity. :paramtype target_entity_id: str @@ -6013,16 +6210,16 @@ def __init__(self, *, target_entity_id: Optional[str] = None, additional_data: O self.additional_data = additional_data -class ConnectorInstructionModelBase(_serialization.Model): - """Instruction step details. +class ConnectivityCriterion(_serialization.Model): + """The criteria by which we determine whether the connector is connected or not. + For Example, use a KQL query to check if the expected data type is flowing). All required parameters must be populated in order to send to Azure. - :ivar parameters: The parameters for the setting. - :vartype parameters: JSON - :ivar type: The kind of the setting. Required. Known values are: "CopyableLabel", - "InstructionStepsGroup", and "InfoMessage". - :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType + :ivar type: Gets or sets the type of connectivity. Required. + :vartype type: str + :ivar value: Gets or sets the queries for checking connectivity. + :vartype value: list[str] """ _validation = { @@ -6030,435 +6227,387 @@ class ConnectorInstructionModelBase(_serialization.Model): } _attribute_map = { - "parameters": {"key": "parameters", "type": "object"}, "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "[str]"}, } - def __init__(self, *, type: Union[str, "_models.SettingType"], parameters: Optional[JSON] = None, **kwargs): + def __init__(self, *, type: str, value: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword parameters: The parameters for the setting. - :paramtype parameters: JSON - :keyword type: The kind of the setting. Required. Known values are: "CopyableLabel", - "InstructionStepsGroup", and "InfoMessage". - :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType + :keyword type: Gets or sets the type of connectivity. Required. + :paramtype type: str + :keyword value: Gets or sets the queries for checking connectivity. + :paramtype value: list[str] """ super().__init__(**kwargs) - self.parameters = parameters self.type = type + self.value = value -class Content(_serialization.Model): - """Content section of the recommendation. +class ConnectorDataType(_serialization.Model): + """The data type which is created by the connector, + including a query indicated when was the last time that data type was received in the + workspace. All required parameters must be populated in order to send to Azure. - :ivar title: Title of the content. Required. - :vartype title: str - :ivar description: Description of the content. Required. - :vartype description: str + :ivar name: Gets or sets the name of the data type to show in the graph. Required. + :vartype name: str + :ivar last_data_received_query: Gets or sets the query to indicate when relevant data was last + received in the workspace. Required. + :vartype last_data_received_query: str """ _validation = { - "title": {"required": True}, - "description": {"required": True}, + "name": {"required": True}, + "last_data_received_query": {"required": True}, } _attribute_map = { - "title": {"key": "title", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "last_data_received_query": {"key": "lastDataReceivedQuery", "type": "str"}, } - def __init__(self, *, title: str, description: str, **kwargs): + def __init__(self, *, name: str, last_data_received_query: str, **kwargs: Any) -> None: """ - :keyword title: Title of the content. Required. - :paramtype title: str - :keyword description: Description of the content. Required. - :paramtype description: str + :keyword name: Gets or sets the name of the data type to show in the graph. Required. + :paramtype name: str + :keyword last_data_received_query: Gets or sets the query to indicate when relevant data was + last received in the workspace. Required. + :paramtype last_data_received_query: str """ super().__init__(**kwargs) - self.title = title - self.description = description + self.name = name + self.last_data_received_query = last_data_received_query -class ContentPathMap(_serialization.Model): - """The mapping of content type to a repo path. +class ConnectorDefinitionsAvailability(_serialization.Model): + """The exposure status of the connector to the customers. - :ivar content_type: Content type. Known values are: "AnalyticRule" and "Workbook". - :vartype content_type: str or ~azure.mgmt.securityinsight.models.ContentType - :ivar path: The path to the content. - :vartype path: str + :ivar status: The exposure status of the connector to the customers. Available values are 0-4 + (0=None, 1=Available, 2=FeatureFlag, 3=Internal). + :vartype status: int + :ivar is_preview: Gets or sets a value indicating whether the connector is preview. + :vartype is_preview: bool """ _attribute_map = { - "content_type": {"key": "contentType", "type": "str"}, - "path": {"key": "path", "type": "str"}, + "status": {"key": "status", "type": "int"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, *, content_type: Optional[Union[str, "_models.ContentType"]] = None, path: Optional[str] = None, **kwargs - ): + def __init__(self, *, status: Optional[int] = None, is_preview: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword content_type: Content type. Known values are: "AnalyticRule" and "Workbook". - :paramtype content_type: str or ~azure.mgmt.securityinsight.models.ContentType - :keyword path: The path to the content. - :paramtype path: str + :keyword status: The exposure status of the connector to the customers. Available values are + 0-4 (0=None, 1=Available, 2=FeatureFlag, 3=Internal). + :paramtype status: int + :keyword is_preview: Gets or sets a value indicating whether the connector is preview. + :paramtype is_preview: bool """ super().__init__(**kwargs) - self.content_type = content_type - self.path = path + self.status = status + self.is_preview = is_preview -class CustomsPermission(_serialization.Model): - """Customs permissions required for the connector. +class ConnectorDefinitionsPermissions(_serialization.Model): + """The required Permissions for the connector. - :ivar name: Customs permissions name. - :vartype name: str - :ivar description: Customs permissions description. - :vartype description: str + :ivar tenant: Gets or sets the required tenant permissions for the connector. + :vartype tenant: list[str] + :ivar licenses: Gets or sets the required licenses for the user to create connections. + :vartype licenses: list[str] + :ivar resource_provider: Gets or sets the resource provider permissions required for the user + to create connections. + :vartype resource_provider: + list[~azure.mgmt.securityinsight.models.ConnectorDefinitionsResourceProvider] + :ivar customs: Gets or sets the customs permissions required for the user to create + connections. + :vartype customs: list[~azure.mgmt.securityinsight.models.CustomPermissionDetails] """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "tenant": {"key": "tenant", "type": "[str]"}, + "licenses": {"key": "licenses", "type": "[str]"}, + "resource_provider": {"key": "resourceProvider", "type": "[ConnectorDefinitionsResourceProvider]"}, + "customs": {"key": "customs", "type": "[CustomPermissionDetails]"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): - """ - :keyword name: Customs permissions name. - :paramtype name: str - :keyword description: Customs permissions description. - :paramtype description: str + def __init__( + self, + *, + tenant: Optional[List[str]] = None, + licenses: Optional[List[str]] = None, + resource_provider: Optional[List["_models.ConnectorDefinitionsResourceProvider"]] = None, + customs: Optional[List["_models.CustomPermissionDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tenant: Gets or sets the required tenant permissions for the connector. + :paramtype tenant: list[str] + :keyword licenses: Gets or sets the required licenses for the user to create connections. + :paramtype licenses: list[str] + :keyword resource_provider: Gets or sets the resource provider permissions required for the + user to create connections. + :paramtype resource_provider: + list[~azure.mgmt.securityinsight.models.ConnectorDefinitionsResourceProvider] + :keyword customs: Gets or sets the customs permissions required for the user to create + connections. + :paramtype customs: list[~azure.mgmt.securityinsight.models.CustomPermissionDetails] """ super().__init__(**kwargs) - self.name = name - self.description = description + self.tenant = tenant + self.licenses = licenses + self.resource_provider = resource_provider + self.customs = customs -class Customs(CustomsPermission): - """Customs permissions required for the connector. +class ConnectorDefinitionsResourceProvider(_serialization.Model): + """The resource provider details include the required permissions for the user to create + connections. + The user should have the required permissions(Read\Write, ..) in the specified scope + ProviderPermissionsScope against the specified resource provider. - :ivar name: Customs permissions name. - :vartype name: str - :ivar description: Customs permissions description. - :vartype description: str + All required parameters must be populated in order to send to Azure. + + :ivar provider: Gets or sets the provider name. Required. + :vartype provider: str + :ivar permissions_display_text: Gets or sets the permissions description text. Required. + :vartype permissions_display_text: str + :ivar provider_display_name: Gets or sets the permissions provider display name. Required. + :vartype provider_display_name: str + :ivar scope: The scope on which the user should have permissions, in order to be able to create + connections. Required. Known values are: "Subscription", "ResourceGroup", and "Workspace". + :vartype scope: str or ~azure.mgmt.securityinsight.models.ProviderPermissionsScope + :ivar required_permissions: Required permissions for the connector resource provider that + define in ResourceProviders. + For more information about the permissions see :code:`here`. + Required. + :vartype required_permissions: + ~azure.mgmt.securityinsight.models.ResourceProviderRequiredPermissions """ + _validation = { + "provider": {"required": True}, + "permissions_display_text": {"required": True}, + "provider_display_name": {"required": True}, + "scope": {"required": True}, + "required_permissions": {"required": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "permissions_display_text": {"key": "permissionsDisplayText", "type": "str"}, + "provider_display_name": {"key": "providerDisplayName", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + "required_permissions": {"key": "requiredPermissions", "type": "ResourceProviderRequiredPermissions"}, } - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): - """ - :keyword name: Customs permissions name. - :paramtype name: str - :keyword description: Customs permissions description. - :paramtype description: str + def __init__( + self, + *, + provider: str, + permissions_display_text: str, + provider_display_name: str, + scope: Union[str, "_models.ProviderPermissionsScope"], + required_permissions: "_models.ResourceProviderRequiredPermissions", + **kwargs: Any + ) -> None: + """ + :keyword provider: Gets or sets the provider name. Required. + :paramtype provider: str + :keyword permissions_display_text: Gets or sets the permissions description text. Required. + :paramtype permissions_display_text: str + :keyword provider_display_name: Gets or sets the permissions provider display name. Required. + :paramtype provider_display_name: str + :keyword scope: The scope on which the user should have permissions, in order to be able to + create connections. Required. Known values are: "Subscription", "ResourceGroup", and + "Workspace". + :paramtype scope: str or ~azure.mgmt.securityinsight.models.ProviderPermissionsScope + :keyword required_permissions: Required permissions for the connector resource provider that + define in ResourceProviders. + For more information about the permissions see :code:`here`. + Required. + :paramtype required_permissions: + ~azure.mgmt.securityinsight.models.ResourceProviderRequiredPermissions """ - super().__init__(name=name, description=description, **kwargs) - + super().__init__(**kwargs) + self.provider = provider + self.permissions_display_text = permissions_display_text + self.provider_display_name = provider_display_name + self.scope = scope + self.required_permissions = required_permissions -class DataConnectorConnectBody(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Represents Codeless API Polling data connector. - :ivar kind: The authentication kind used to poll the data. Known values are: "Basic", "OAuth2", - and "APIKey". - :vartype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind - :ivar api_key: The API key of the audit server. - :vartype api_key: str - :ivar data_collection_endpoint: Used in v2 logs connector. Represents the data collection - ingestion endpoint in log analytics. - :vartype data_collection_endpoint: str - :ivar data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule - immutable id, the rule defines the transformation and data destination. - :vartype data_collection_rule_immutable_id: str - :ivar output_stream: Used in v2 logs connector. The stream we are sending the data to, this is - the name of the streamDeclarations defined in the DCR. - :vartype output_stream: str - :ivar client_secret: The client secret of the OAuth 2.0 application. - :vartype client_secret: str - :ivar client_id: The client id of the OAuth 2.0 application. - :vartype client_id: str - :ivar authorization_code: The authorization code used in OAuth 2.0 code flow to issue a token. - :vartype authorization_code: str - :ivar user_name: The user name in the audit log server. - :vartype user_name: str - :ivar password: The user password in the audit log server. - :vartype password: str - :ivar request_config_user_input_values: - :vartype request_config_user_input_values: list[JSON] +class ConnectorInstructionModelBase(_serialization.Model): + """Instruction step details. + + All required parameters must be populated in order to send to Azure. + + :ivar parameters: The parameters for the setting. + :vartype parameters: JSON + :ivar type: The kind of the setting. Required. Known values are: "CopyableLabel", + "InstructionStepsGroup", and "InfoMessage". + :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType """ + _validation = { + "type": {"required": True}, + } + _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "api_key": {"key": "apiKey", "type": "str"}, - "data_collection_endpoint": {"key": "dataCollectionEndpoint", "type": "str"}, - "data_collection_rule_immutable_id": {"key": "dataCollectionRuleImmutableId", "type": "str"}, - "output_stream": {"key": "outputStream", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - "authorization_code": {"key": "authorizationCode", "type": "str"}, - "user_name": {"key": "userName", "type": "str"}, - "password": {"key": "password", "type": "str"}, - "request_config_user_input_values": {"key": "requestConfigUserInputValues", "type": "[object]"}, + "parameters": {"key": "parameters", "type": "object"}, + "type": {"key": "type", "type": "str"}, } def __init__( - self, - *, - kind: Optional[Union[str, "_models.ConnectAuthKind"]] = None, - api_key: Optional[str] = None, - data_collection_endpoint: Optional[str] = None, - data_collection_rule_immutable_id: Optional[str] = None, - output_stream: Optional[str] = None, - client_secret: Optional[str] = None, - client_id: Optional[str] = None, - authorization_code: Optional[str] = None, - user_name: Optional[str] = None, - password: Optional[str] = None, - request_config_user_input_values: Optional[List[JSON]] = None, - **kwargs - ): + self, *, type: Union[str, "_models.SettingType"], parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ - :keyword kind: The authentication kind used to poll the data. Known values are: "Basic", - "OAuth2", and "APIKey". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind - :keyword api_key: The API key of the audit server. - :paramtype api_key: str - :keyword data_collection_endpoint: Used in v2 logs connector. Represents the data collection - ingestion endpoint in log analytics. - :paramtype data_collection_endpoint: str - :keyword data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule - immutable id, the rule defines the transformation and data destination. - :paramtype data_collection_rule_immutable_id: str - :keyword output_stream: Used in v2 logs connector. The stream we are sending the data to, this - is the name of the streamDeclarations defined in the DCR. - :paramtype output_stream: str - :keyword client_secret: The client secret of the OAuth 2.0 application. - :paramtype client_secret: str - :keyword client_id: The client id of the OAuth 2.0 application. - :paramtype client_id: str - :keyword authorization_code: The authorization code used in OAuth 2.0 code flow to issue a - token. - :paramtype authorization_code: str - :keyword user_name: The user name in the audit log server. - :paramtype user_name: str - :keyword password: The user password in the audit log server. - :paramtype password: str - :keyword request_config_user_input_values: - :paramtype request_config_user_input_values: list[JSON] + :keyword parameters: The parameters for the setting. + :paramtype parameters: JSON + :keyword type: The kind of the setting. Required. Known values are: "CopyableLabel", + "InstructionStepsGroup", and "InfoMessage". + :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType """ super().__init__(**kwargs) - self.kind = kind - self.api_key = api_key - self.data_collection_endpoint = data_collection_endpoint - self.data_collection_rule_immutable_id = data_collection_rule_immutable_id - self.output_stream = output_stream - self.client_secret = client_secret - self.client_id = client_id - self.authorization_code = authorization_code - self.user_name = user_name - self.password = password - self.request_config_user_input_values = request_config_user_input_values - + self.parameters = parameters + self.type = type -class DataConnectorList(_serialization.Model): - """List all the data connectors. - Variables are only populated by the server, and will be ignored when sending a request. +class Content(_serialization.Model): + """Content section of the recommendation. All required parameters must be populated in order to send to Azure. - :ivar next_link: URL to fetch the next set of data connectors. - :vartype next_link: str - :ivar value: Array of data connectors. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.DataConnector] + :ivar title: Title of the content. Required. + :vartype title: str + :ivar description: Description of the content. Required. + :vartype description: str """ _validation = { - "next_link": {"readonly": True}, - "value": {"required": True}, + "title": {"required": True}, + "description": {"required": True}, } _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DataConnector]"}, + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__(self, *, value: List["_models.DataConnector"], **kwargs): + def __init__(self, *, title: str, description: str, **kwargs: Any) -> None: """ - :keyword value: Array of data connectors. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.DataConnector] + :keyword title: Title of the content. Required. + :paramtype title: str + :keyword description: Description of the content. Required. + :paramtype description: str """ super().__init__(**kwargs) - self.next_link = None - self.value = value + self.title = title + self.description = description -class DataConnectorRequirementsState(_serialization.Model): - """Data connector requirements status. +class CustomizableConnectionsConfig(_serialization.Model): + """The UiConfig for 'Customizable' connector definition kind. - :ivar authorization_state: Authorization state for this connector. Known values are: "Valid" - and "Invalid". - :vartype authorization_state: str or - ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState - :ivar license_state: License state for this connector. Known values are: "Valid", "Invalid", - and "Unknown". - :vartype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState + All required parameters must be populated in order to send to Azure. + + :ivar template_spec_name: Gets or sets the template name. The template includes ARM templates + that can be created by the connector, usually it will be the dataConnectors ARM templates. + Required. + :vartype template_spec_name: str + :ivar template_spec_version: Gets or sets the template version. Required. + :vartype template_spec_version: str """ + _validation = { + "template_spec_name": {"required": True}, + "template_spec_version": {"required": True}, + } + _attribute_map = { - "authorization_state": {"key": "authorizationState", "type": "str"}, - "license_state": {"key": "licenseState", "type": "str"}, + "template_spec_name": {"key": "templateSpecName", "type": "str"}, + "template_spec_version": {"key": "templateSpecVersion", "type": "str"}, } - def __init__( - self, - *, - authorization_state: Optional[Union[str, "_models.DataConnectorAuthorizationState"]] = None, - license_state: Optional[Union[str, "_models.DataConnectorLicenseState"]] = None, - **kwargs - ): + def __init__(self, *, template_spec_name: str, template_spec_version: str, **kwargs: Any) -> None: """ - :keyword authorization_state: Authorization state for this connector. Known values are: "Valid" - and "Invalid". - :paramtype authorization_state: str or - ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState - :keyword license_state: License state for this connector. Known values are: "Valid", "Invalid", - and "Unknown". - :paramtype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState + :keyword template_spec_name: Gets or sets the template name. The template includes ARM + templates that can be created by the connector, usually it will be the dataConnectors ARM + templates. Required. + :paramtype template_spec_name: str + :keyword template_spec_version: Gets or sets the template version. Required. + :paramtype template_spec_version: str """ super().__init__(**kwargs) - self.authorization_state = authorization_state - self.license_state = license_state + self.template_spec_name = template_spec_name + self.template_spec_version = template_spec_version -class DataTypeDefinitions(_serialization.Model): - """The data type definition. +class DataConnectorDefinition(ResourceWithEtag): + """An Azure resource, which encapsulate the entire info requires to display a data connector page + in Azure portal, + and the info required to define data connections. - :ivar data_type: The data type name. - :vartype data_type: str + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CustomizableConnectorDefinition + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. "Customizable" + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorDefinitionKind """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + } + _attribute_map = { - "data_type": {"key": "dataType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, data_type: Optional[str] = None, **kwargs): + _subtype_map = {"kind": {"Customizable": "CustomizableConnectorDefinition"}} + + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword data_type: The data type name. - :paramtype data_type: str + :keyword etag: Etag of the azure resource. + :paramtype etag: str """ - super().__init__(**kwargs) - self.data_type = data_type + super().__init__(etag=etag, **kwargs) + self.kind: Optional[str] = None -class Deployment(_serialization.Model): - """Description about a deployment. +class CustomizableConnectorDefinition(DataConnectorDefinition): + """Connector definition for kind 'Customizable'. - :ivar deployment_id: Deployment identifier. - :vartype deployment_id: str - :ivar deployment_state: Current status of the deployment. Known values are: "In_Progress", - "Completed", "Queued", and "Canceling". - :vartype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState - :ivar deployment_result: The outcome of the deployment. Known values are: "Success", - "Canceled", and "Failed". - :vartype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult - :ivar deployment_time: The time when the deployment finished. - :vartype deployment_time: ~datetime.datetime - :ivar deployment_logs_url: Url to access repository action logs. - :vartype deployment_logs_url: str - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "deployment_id": {"key": "deploymentId", "type": "str"}, - "deployment_state": {"key": "deploymentState", "type": "str"}, - "deployment_result": {"key": "deploymentResult", "type": "str"}, - "deployment_time": {"key": "deploymentTime", "type": "iso-8601"}, - "deployment_logs_url": {"key": "deploymentLogsUrl", "type": "str"}, - } - - def __init__( - self, - *, - deployment_id: Optional[str] = None, - deployment_state: Optional[Union[str, "_models.DeploymentState"]] = None, - deployment_result: Optional[Union[str, "_models.DeploymentResult"]] = None, - deployment_time: Optional[datetime.datetime] = None, - deployment_logs_url: Optional[str] = None, - **kwargs - ): - """ - :keyword deployment_id: Deployment identifier. - :paramtype deployment_id: str - :keyword deployment_state: Current status of the deployment. Known values are: "In_Progress", - "Completed", "Queued", and "Canceling". - :paramtype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState - :keyword deployment_result: The outcome of the deployment. Known values are: "Success", - "Canceled", and "Failed". - :paramtype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult - :keyword deployment_time: The time when the deployment finished. - :paramtype deployment_time: ~datetime.datetime - :keyword deployment_logs_url: Url to access repository action logs. - :paramtype deployment_logs_url: str - """ - super().__init__(**kwargs) - self.deployment_id = deployment_id - self.deployment_state = deployment_state - self.deployment_result = deployment_result - self.deployment_time = deployment_time - self.deployment_logs_url = deployment_logs_url - - -class DeploymentInfo(_serialization.Model): - """Information regarding a deployment. - - :ivar deployment_fetch_status: Status while fetching the last deployment. Known values are: - "Success", "Unauthorized", and "NotFound". - :vartype deployment_fetch_status: str or - ~azure.mgmt.securityinsight.models.DeploymentFetchStatus - :ivar deployment: Deployment information. - :vartype deployment: ~azure.mgmt.securityinsight.models.Deployment - :ivar message: Additional details about the deployment that can be shown to the user. - :vartype message: str - """ - - _attribute_map = { - "deployment_fetch_status": {"key": "deploymentFetchStatus", "type": "str"}, - "deployment": {"key": "deployment", "type": "Deployment"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - *, - deployment_fetch_status: Optional[Union[str, "_models.DeploymentFetchStatus"]] = None, - deployment: Optional["_models.Deployment"] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword deployment_fetch_status: Status while fetching the last deployment. Known values are: - "Success", "Unauthorized", and "NotFound". - :paramtype deployment_fetch_status: str or - ~azure.mgmt.securityinsight.models.DeploymentFetchStatus - :keyword deployment: Deployment information. - :paramtype deployment: ~azure.mgmt.securityinsight.models.Deployment - :keyword message: Additional details about the deployment that can be shown to the user. - :paramtype message: str - """ - super().__init__(**kwargs) - self.deployment_fetch_status = deployment_fetch_status - self.deployment = deployment - self.message = message - - -class DnsEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a dns entity. - - 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 Azure. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6471,25 +6620,19 @@ class DnsEntity(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar dns_server_ip_entity_id: An ip entity id for the dns server resolving the request. - :vartype dns_server_ip_entity_id: str - :ivar domain_name: The name of the dns record associated with the alert. - :vartype domain_name: str - :ivar host_ip_address_entity_id: An ip entity id for the dns request client. - :vartype host_ip_address_entity_id: str - :ivar ip_address_entity_ids: Ip entity identifiers for the resolved ip address. - :vartype ip_address_entity_ids: list[str] + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. "Customizable" + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorDefinitionKind + :ivar created_time_utc: Gets or sets the connector definition created date in UTC format. + :vartype created_time_utc: ~datetime.datetime + :ivar last_modified_utc: Gets or sets the connector definition last modified date in UTC + format. + :vartype last_modified_utc: ~datetime.datetime + :ivar connector_ui_config: The UiConfig for 'Customizable' connector definition kind. + :vartype connector_ui_config: ~azure.mgmt.securityinsight.models.CustomizableConnectorUiConfig + :ivar connections_config: The UiConfig for 'Customizable' connector definition kind. + :vartype connections_config: ~azure.mgmt.securityinsight.models.CustomizableConnectionsConfig """ _validation = { @@ -6498,12 +6641,6 @@ class DnsEntity(Entity): # pylint: disable=too-many-instance-attributes "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "dns_server_ip_entity_id": {"readonly": True}, - "domain_name": {"readonly": True}, - "host_ip_address_entity_id": {"readonly": True}, - "ip_address_entity_ids": {"readonly": True}, } _attribute_map = { @@ -6511,752 +6648,654 @@ class DnsEntity(Entity): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "dns_server_ip_entity_id": {"key": "properties.dnsServerIpEntityId", "type": "str"}, - "domain_name": {"key": "properties.domainName", "type": "str"}, - "host_ip_address_entity_id": {"key": "properties.hostIpAddressEntityId", "type": "str"}, - "ip_address_entity_ids": {"key": "properties.ipAddressEntityIds", "type": "[str]"}, + "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, + "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + "connector_ui_config": {"key": "properties.connectorUiConfig", "type": "CustomizableConnectorUiConfig"}, + "connections_config": {"key": "properties.connectionsConfig", "type": "CustomizableConnectionsConfig"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.kind: str = "DnsResolution" - self.additional_data = None - self.friendly_name = None - self.dns_server_ip_entity_id = None - self.domain_name = None - self.host_ip_address_entity_id = None - self.ip_address_entity_ids = None + def __init__( + self, + *, + etag: Optional[str] = None, + created_time_utc: Optional[datetime.datetime] = None, + last_modified_utc: Optional[datetime.datetime] = None, + connector_ui_config: Optional["_models.CustomizableConnectorUiConfig"] = None, + connections_config: Optional["_models.CustomizableConnectionsConfig"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword created_time_utc: Gets or sets the connector definition created date in UTC format. + :paramtype created_time_utc: ~datetime.datetime + :keyword last_modified_utc: Gets or sets the connector definition last modified date in UTC + format. + :paramtype last_modified_utc: ~datetime.datetime + :keyword connector_ui_config: The UiConfig for 'Customizable' connector definition kind. + :paramtype connector_ui_config: + ~azure.mgmt.securityinsight.models.CustomizableConnectorUiConfig + :keyword connections_config: The UiConfig for 'Customizable' connector definition kind. + :paramtype connections_config: ~azure.mgmt.securityinsight.models.CustomizableConnectionsConfig + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "Customizable" + self.created_time_utc = created_time_utc + self.last_modified_utc = last_modified_utc + self.connector_ui_config = connector_ui_config + self.connections_config = connections_config -class DnsEntityProperties(EntityCommonProperties): - """Dns entity property bag. +class CustomizableConnectorUiConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The UiConfig for 'Customizable' connector definition kind. - 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 additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar dns_server_ip_entity_id: An ip entity id for the dns server resolving the request. - :vartype dns_server_ip_entity_id: str - :ivar domain_name: The name of the dns record associated with the alert. - :vartype domain_name: str - :ivar host_ip_address_entity_id: An ip entity id for the dns request client. - :vartype host_ip_address_entity_id: str - :ivar ip_address_entity_ids: Ip entity identifiers for the resolved ip address. - :vartype ip_address_entity_ids: list[str] + :ivar id: Gets or sets custom connector id. optional field. + :vartype id: str + :ivar title: Gets or sets the connector blade title. Required. + :vartype title: str + :ivar publisher: Gets or sets the connector publisher name. Required. + :vartype publisher: str + :ivar description_markdown: Gets or sets the connector description in markdown format. + Required. + :vartype description_markdown: str + :ivar graph_queries_table_name: Gets or sets the name of the table the connector will insert + the data to. + This name can be used in other queries by specifying {{graphQueriesTableName}} placeholder + in Query and LastDataReceivedQuery values. + :vartype graph_queries_table_name: str + :ivar graph_queries: Gets or sets the graph queries to show the current data volume over time. + Required. + :vartype graph_queries: list[~azure.mgmt.securityinsight.models.GraphQuery] + :ivar sample_queries: Gets or sets the sample queries for the connector. Required. + :vartype sample_queries: list[~azure.mgmt.securityinsight.models.SampleQuery] + :ivar data_types: Gets or sets the data types to check for last data received. Required. + :vartype data_types: list[~azure.mgmt.securityinsight.models.ConnectorDataType] + :ivar connectivity_criteria: Gets or sets the way the connector checks whether the connector is + connected. Required. + :vartype connectivity_criteria: list[~azure.mgmt.securityinsight.models.ConnectivityCriterion] + :ivar availability: The exposure status of the connector to the customers. + :vartype availability: ~azure.mgmt.securityinsight.models.ConnectorDefinitionsAvailability + :ivar permissions: The required Permissions for the connector. Required. + :vartype permissions: ~azure.mgmt.securityinsight.models.ConnectorDefinitionsPermissions + :ivar instruction_steps: Gets or sets the instruction steps to enable the connector. Required. + :vartype instruction_steps: list[~azure.mgmt.securityinsight.models.InstructionStep] + :ivar logo: Gets or sets the connector logo to be used when displaying the connector within + Azure Sentinel's connector's gallery. + The logo value should be in SVG format. + :vartype logo: str + :ivar is_connectivity_criterias_match_some: Gets or sets a value indicating whether to use + 'OR'(SOME) or 'AND' between ConnectivityCriteria items. + :vartype is_connectivity_criterias_match_some: bool """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "dns_server_ip_entity_id": {"readonly": True}, - "domain_name": {"readonly": True}, - "host_ip_address_entity_id": {"readonly": True}, - "ip_address_entity_ids": {"readonly": True}, + "title": {"required": True}, + "publisher": {"required": True}, + "description_markdown": {"required": True}, + "graph_queries": {"required": True}, + "sample_queries": {"required": True}, + "data_types": {"required": True}, + "connectivity_criteria": {"required": True}, + "permissions": {"required": True}, + "instruction_steps": {"required": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "dns_server_ip_entity_id": {"key": "dnsServerIpEntityId", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - "host_ip_address_entity_id": {"key": "hostIpAddressEntityId", "type": "str"}, - "ip_address_entity_ids": {"key": "ipAddressEntityIds", "type": "[str]"}, + "id": {"key": "id", "type": "str"}, + "title": {"key": "title", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "description_markdown": {"key": "descriptionMarkdown", "type": "str"}, + "graph_queries_table_name": {"key": "graphQueriesTableName", "type": "str"}, + "graph_queries": {"key": "graphQueries", "type": "[GraphQuery]"}, + "sample_queries": {"key": "sampleQueries", "type": "[SampleQuery]"}, + "data_types": {"key": "dataTypes", "type": "[ConnectorDataType]"}, + "connectivity_criteria": {"key": "connectivityCriteria", "type": "[ConnectivityCriterion]"}, + "availability": {"key": "availability", "type": "ConnectorDefinitionsAvailability"}, + "permissions": {"key": "permissions", "type": "ConnectorDefinitionsPermissions"}, + "instruction_steps": {"key": "instructionSteps", "type": "[InstructionStep]"}, + "logo": {"key": "logo", "type": "str"}, + "is_connectivity_criterias_match_some": {"key": "isConnectivityCriteriasMatchSome", "type": "bool"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + title: str, + publisher: str, + description_markdown: str, + graph_queries: List["_models.GraphQuery"], + sample_queries: List["_models.SampleQuery"], + data_types: List["_models.ConnectorDataType"], + connectivity_criteria: List["_models.ConnectivityCriterion"], + permissions: "_models.ConnectorDefinitionsPermissions", + instruction_steps: List["_models.InstructionStep"], + id: Optional[str] = None, # pylint: disable=redefined-builtin + graph_queries_table_name: Optional[str] = None, + availability: Optional["_models.ConnectorDefinitionsAvailability"] = None, + logo: Optional[str] = None, + is_connectivity_criterias_match_some: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Gets or sets custom connector id. optional field. + :paramtype id: str + :keyword title: Gets or sets the connector blade title. Required. + :paramtype title: str + :keyword publisher: Gets or sets the connector publisher name. Required. + :paramtype publisher: str + :keyword description_markdown: Gets or sets the connector description in markdown format. + Required. + :paramtype description_markdown: str + :keyword graph_queries_table_name: Gets or sets the name of the table the connector will insert + the data to. + This name can be used in other queries by specifying {{graphQueriesTableName}} placeholder + in Query and LastDataReceivedQuery values. + :paramtype graph_queries_table_name: str + :keyword graph_queries: Gets or sets the graph queries to show the current data volume over + time. Required. + :paramtype graph_queries: list[~azure.mgmt.securityinsight.models.GraphQuery] + :keyword sample_queries: Gets or sets the sample queries for the connector. Required. + :paramtype sample_queries: list[~azure.mgmt.securityinsight.models.SampleQuery] + :keyword data_types: Gets or sets the data types to check for last data received. Required. + :paramtype data_types: list[~azure.mgmt.securityinsight.models.ConnectorDataType] + :keyword connectivity_criteria: Gets or sets the way the connector checks whether the connector + is connected. Required. + :paramtype connectivity_criteria: + list[~azure.mgmt.securityinsight.models.ConnectivityCriterion] + :keyword availability: The exposure status of the connector to the customers. + :paramtype availability: ~azure.mgmt.securityinsight.models.ConnectorDefinitionsAvailability + :keyword permissions: The required Permissions for the connector. Required. + :paramtype permissions: ~azure.mgmt.securityinsight.models.ConnectorDefinitionsPermissions + :keyword instruction_steps: Gets or sets the instruction steps to enable the connector. + Required. + :paramtype instruction_steps: list[~azure.mgmt.securityinsight.models.InstructionStep] + :keyword logo: Gets or sets the connector logo to be used when displaying the connector within + Azure Sentinel's connector's gallery. + The logo value should be in SVG format. + :paramtype logo: str + :keyword is_connectivity_criterias_match_some: Gets or sets a value indicating whether to use + 'OR'(SOME) or 'AND' between ConnectivityCriteria items. + :paramtype is_connectivity_criterias_match_some: bool + """ super().__init__(**kwargs) - self.dns_server_ip_entity_id = None - self.domain_name = None - self.host_ip_address_entity_id = None - self.ip_address_entity_ids = None + self.id = id + self.title = title + self.publisher = publisher + self.description_markdown = description_markdown + self.graph_queries_table_name = graph_queries_table_name + self.graph_queries = graph_queries + self.sample_queries = sample_queries + self.data_types = data_types + self.connectivity_criteria = connectivity_criteria + self.availability = availability + self.permissions = permissions + self.instruction_steps = instruction_steps + self.logo = logo + self.is_connectivity_criterias_match_some = is_connectivity_criterias_match_some -class Dynamics365CheckRequirements(DataConnectorsCheckRequirements): - """Represents Dynamics365 requirements check request. +class CustomPermissionDetails(_serialization.Model): + """The Custom permissions required for the connector. All required parameters must be populated in order to send to Azure. - :ivar kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar name: Gets or sets the custom permissions name. Required. + :vartype name: str + :ivar description: Gets or sets the custom permissions description. Required. + :vartype description: str """ _validation = { - "kind": {"required": True}, + "name": {"required": True}, + "description": {"required": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, description: str, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword name: Gets or sets the custom permissions name. Required. + :paramtype name: str + :keyword description: Gets or sets the custom permissions description. Required. + :paramtype description: str """ super().__init__(**kwargs) - self.kind: str = "Dynamics365" - self.tenant_id = tenant_id - + self.name = name + self.description = description -class Dynamics365CheckRequirementsProperties(DataConnectorTenantId): - """Dynamics365 requirements check properties. - All required parameters must be populated in order to send to Azure. +class CustomsPermission(_serialization.Model): + """Customs permissions required for the connector. - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar name: Customs permissions name. + :vartype name: str + :ivar description: Customs permissions description. + :vartype description: str """ - _validation = { - "tenant_id": {"required": True}, - } - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword name: Customs permissions name. + :paramtype name: str + :keyword description: Customs permissions description. + :paramtype description: str """ - super().__init__(tenant_id=tenant_id, **kwargs) - - -class Dynamics365DataConnector(DataConnector): - """Represents Dynamics365 data connector. + super().__init__(**kwargs) + self.name = name + 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 Customs(CustomsPermission): + """Customs permissions required for the connector. - :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. + :ivar name: Customs permissions name. :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.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes + :ivar description: Customs permissions description. + :vartype description: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "Dynamics365DataConnectorDataTypes"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.Dynamics365DataConnectorDataTypes"] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes + :keyword name: Customs permissions name. + :paramtype name: str + :keyword description: Customs permissions description. + :paramtype description: str """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "Dynamics365" - self.tenant_id = tenant_id - self.data_types = data_types - + super().__init__(name=name, description=description, **kwargs) -class Dynamics365DataConnectorDataTypes(_serialization.Model): - """The available data types for Dynamics365 data connector. - All required parameters must be populated in order to send to Azure. +class DataConnectorConnectBody(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Represents Codeless API Polling data connector. - :ivar dynamics365_cds_activities: Common Data Service data type connection. Required. - :vartype dynamics365_cds_activities: - ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities + :ivar kind: The authentication kind used to poll the data. Known values are: "Basic", "OAuth2", + and "APIKey". + :vartype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind + :ivar api_key: The API key of the audit server. + :vartype api_key: str + :ivar data_collection_endpoint: Used in v2 logs connector. Represents the data collection + ingestion endpoint in log analytics. + :vartype data_collection_endpoint: str + :ivar data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule + immutable id, the rule defines the transformation and data destination. + :vartype data_collection_rule_immutable_id: str + :ivar output_stream: Used in v2 logs connector. The stream we are sending the data to, this is + the name of the streamDeclarations defined in the DCR. + :vartype output_stream: str + :ivar client_secret: The client secret of the OAuth 2.0 application. + :vartype client_secret: str + :ivar client_id: The client id of the OAuth 2.0 application. + :vartype client_id: str + :ivar authorization_code: The authorization code used in OAuth 2.0 code flow to issue a token. + :vartype authorization_code: str + :ivar user_name: The user name in the audit log server. + :vartype user_name: str + :ivar password: The user password in the audit log server. + :vartype password: str + :ivar request_config_user_input_values: + :vartype request_config_user_input_values: list[JSON] """ - _validation = { - "dynamics365_cds_activities": {"required": True}, - } - _attribute_map = { - "dynamics365_cds_activities": { - "key": "dynamics365CdsActivities", - "type": "Dynamics365DataConnectorDataTypesDynamics365CdsActivities", - }, + "kind": {"key": "kind", "type": "str"}, + "api_key": {"key": "apiKey", "type": "str"}, + "data_collection_endpoint": {"key": "dataCollectionEndpoint", "type": "str"}, + "data_collection_rule_immutable_id": {"key": "dataCollectionRuleImmutableId", "type": "str"}, + "output_stream": {"key": "outputStream", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "authorization_code": {"key": "authorizationCode", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "request_config_user_input_values": {"key": "requestConfigUserInputValues", "type": "[object]"}, } def __init__( self, *, - dynamics365_cds_activities: "_models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities", - **kwargs - ): + kind: Optional[Union[str, "_models.ConnectAuthKind"]] = None, + api_key: Optional[str] = None, + data_collection_endpoint: Optional[str] = None, + data_collection_rule_immutable_id: Optional[str] = None, + output_stream: Optional[str] = None, + client_secret: Optional[str] = None, + client_id: Optional[str] = None, + authorization_code: Optional[str] = None, + user_name: Optional[str] = None, + password: Optional[str] = None, + request_config_user_input_values: Optional[List[JSON]] = None, + **kwargs: Any + ) -> None: """ - :keyword dynamics365_cds_activities: Common Data Service data type connection. Required. - :paramtype dynamics365_cds_activities: - ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities + :keyword kind: The authentication kind used to poll the data. Known values are: "Basic", + "OAuth2", and "APIKey". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind + :keyword api_key: The API key of the audit server. + :paramtype api_key: str + :keyword data_collection_endpoint: Used in v2 logs connector. Represents the data collection + ingestion endpoint in log analytics. + :paramtype data_collection_endpoint: str + :keyword data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule + immutable id, the rule defines the transformation and data destination. + :paramtype data_collection_rule_immutable_id: str + :keyword output_stream: Used in v2 logs connector. The stream we are sending the data to, this + is the name of the streamDeclarations defined in the DCR. + :paramtype output_stream: str + :keyword client_secret: The client secret of the OAuth 2.0 application. + :paramtype client_secret: str + :keyword client_id: The client id of the OAuth 2.0 application. + :paramtype client_id: str + :keyword authorization_code: The authorization code used in OAuth 2.0 code flow to issue a + token. + :paramtype authorization_code: str + :keyword user_name: The user name in the audit log server. + :paramtype user_name: str + :keyword password: The user password in the audit log server. + :paramtype password: str + :keyword request_config_user_input_values: + :paramtype request_config_user_input_values: list[JSON] """ super().__init__(**kwargs) - self.dynamics365_cds_activities = dynamics365_cds_activities - + self.kind = kind + self.api_key = api_key + self.data_collection_endpoint = data_collection_endpoint + self.data_collection_rule_immutable_id = data_collection_rule_immutable_id + self.output_stream = output_stream + self.client_secret = client_secret + self.client_id = client_id + self.authorization_code = authorization_code + self.user_name = user_name + self.password = password + self.request_config_user_input_values = request_config_user_input_values -class Dynamics365DataConnectorDataTypesDynamics365CdsActivities(DataConnectorDataTypeCommon): - """Common Data Service data type connection. - All required parameters must be populated in order to send to Azure. +class DataConnectorDefinitionArmCollectionWrapper(_serialization.Model): + """Encapsulate the data connector definition object. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar value: + :vartype value: list[~azure.mgmt.securityinsight.models.DataConnectorDefinition] + :ivar next_link: + :vartype next_link: str """ - _validation = { - "state": {"required": True}, - } - _attribute_map = { - "state": {"key": "state", "type": "str"}, + "value": {"key": "value", "type": "[DataConnectorDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__( + self, + *, + value: Optional[List["_models.DataConnectorDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword value: + :paramtype value: list[~azure.mgmt.securityinsight.models.DataConnectorDefinition] + :keyword next_link: + :paramtype next_link: str """ - super().__init__(state=state, **kwargs) + super().__init__(**kwargs) + self.value = value + self.next_link = next_link -class Dynamics365DataConnectorProperties(DataConnectorTenantId): - """Dynamics365 data connector properties. +class DataConnectorList(_serialization.Model): + """List all the data connectors. + + 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes + :ivar next_link: URL to fetch the next set of data connectors. + :vartype next_link: str + :ivar value: Array of data connectors. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.DataConnector] """ _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "Dynamics365DataConnectorDataTypes"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[DataConnector]"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.Dynamics365DataConnectorDataTypes", **kwargs): + def __init__(self, *, value: List["_models.DataConnector"], **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes + :keyword value: Array of data connectors. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.DataConnector] """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types + super().__init__(**kwargs) + self.next_link = None + self.value = value -class EnrichmentDomainWhois(_serialization.Model): - """Whois information for a given domain and associated metadata. +class DataConnectorRequirementsState(_serialization.Model): + """Data connector requirements status. - :ivar domain: The domain for this whois record. - :vartype domain: str - :ivar server: The hostname of this registrar's whois server. - :vartype server: str - :ivar created: The timestamp at which this record was created. - :vartype created: ~datetime.datetime - :ivar updated: The timestamp at which this record was last updated. - :vartype updated: ~datetime.datetime - :ivar expires: The timestamp at which this record will expire. - :vartype expires: ~datetime.datetime - :ivar parsed_whois: The whois record for a given domain. - :vartype parsed_whois: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisDetails + :ivar authorization_state: Authorization state for this connector. Known values are: "Valid" + and "Invalid". + :vartype authorization_state: str or + ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState + :ivar license_state: License state for this connector. Known values are: "Valid", "Invalid", + and "Unknown". + :vartype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState """ _attribute_map = { - "domain": {"key": "domain", "type": "str"}, - "server": {"key": "server", "type": "str"}, - "created": {"key": "created", "type": "iso-8601"}, - "updated": {"key": "updated", "type": "iso-8601"}, - "expires": {"key": "expires", "type": "iso-8601"}, - "parsed_whois": {"key": "parsedWhois", "type": "EnrichmentDomainWhoisDetails"}, + "authorization_state": {"key": "authorizationState", "type": "str"}, + "license_state": {"key": "licenseState", "type": "str"}, } def __init__( self, *, - domain: Optional[str] = None, - server: Optional[str] = None, - created: Optional[datetime.datetime] = None, - updated: Optional[datetime.datetime] = None, - expires: Optional[datetime.datetime] = None, - parsed_whois: Optional["_models.EnrichmentDomainWhoisDetails"] = None, - **kwargs - ): + authorization_state: Optional[Union[str, "_models.DataConnectorAuthorizationState"]] = None, + license_state: Optional[Union[str, "_models.DataConnectorLicenseState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword domain: The domain for this whois record. - :paramtype domain: str - :keyword server: The hostname of this registrar's whois server. - :paramtype server: str - :keyword created: The timestamp at which this record was created. - :paramtype created: ~datetime.datetime - :keyword updated: The timestamp at which this record was last updated. - :paramtype updated: ~datetime.datetime - :keyword expires: The timestamp at which this record will expire. - :paramtype expires: ~datetime.datetime - :keyword parsed_whois: The whois record for a given domain. - :paramtype parsed_whois: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisDetails + :keyword authorization_state: Authorization state for this connector. Known values are: "Valid" + and "Invalid". + :paramtype authorization_state: str or + ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState + :keyword license_state: License state for this connector. Known values are: "Valid", "Invalid", + and "Unknown". + :paramtype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState """ super().__init__(**kwargs) - self.domain = domain - self.server = server - self.created = created - self.updated = updated - self.expires = expires - self.parsed_whois = parsed_whois + self.authorization_state = authorization_state + self.license_state = license_state -class EnrichmentDomainWhoisContact(_serialization.Model): - """An individual contact associated with this domain. +class DataTypeDefinitions(_serialization.Model): + """The data type definition. - :ivar name: The name of this contact. - :vartype name: str - :ivar org: The organization for this contact. - :vartype org: str - :ivar street: A list describing the street address for this contact. - :vartype street: list[str] - :ivar city: The city for this contact. - :vartype city: str - :ivar state: The state for this contact. - :vartype state: str - :ivar postal: The postal code for this contact. - :vartype postal: str - :ivar country: The country for this contact. - :vartype country: str - :ivar phone: The phone number for this contact. - :vartype phone: str - :ivar fax: The fax number for this contact. - :vartype fax: str - :ivar email: The email address for this contact. - :vartype email: str + :ivar data_type: The data type name. + :vartype data_type: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "org": {"key": "org", "type": "str"}, - "street": {"key": "street", "type": "[str]"}, - "city": {"key": "city", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "postal": {"key": "postal", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "phone": {"key": "phone", "type": "str"}, - "fax": {"key": "fax", "type": "str"}, - "email": {"key": "email", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - org: Optional[str] = None, - street: Optional[List[str]] = None, - city: Optional[str] = None, - state: Optional[str] = None, - postal: Optional[str] = None, - country: Optional[str] = None, - phone: Optional[str] = None, - fax: Optional[str] = None, - email: Optional[str] = None, - **kwargs - ): + def __init__(self, *, data_type: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: The name of this contact. - :paramtype name: str - :keyword org: The organization for this contact. - :paramtype org: str - :keyword street: A list describing the street address for this contact. - :paramtype street: list[str] - :keyword city: The city for this contact. - :paramtype city: str - :keyword state: The state for this contact. - :paramtype state: str - :keyword postal: The postal code for this contact. - :paramtype postal: str - :keyword country: The country for this contact. - :paramtype country: str - :keyword phone: The phone number for this contact. - :paramtype phone: str - :keyword fax: The fax number for this contact. - :paramtype fax: str - :keyword email: The email address for this contact. - :paramtype email: str + :keyword data_type: The data type name. + :paramtype data_type: str """ super().__init__(**kwargs) - self.name = name - self.org = org - self.street = street - self.city = city - self.state = state - self.postal = postal - self.country = country - self.phone = phone - self.fax = fax - self.email = email + self.data_type = data_type -class EnrichmentDomainWhoisContacts(_serialization.Model): - """The set of contacts associated with this domain. +class DCRConfiguration(_serialization.Model): + """The configuration of the destination of the data. - :ivar admin: The admin contact for this whois record. - :vartype admin: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :ivar billing: The billing contact for this whois record. - :vartype billing: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :ivar registrant: The registrant contact for this whois record. - :vartype registrant: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :ivar tech: The technical contact for this whois record. - :vartype tech: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + All required parameters must be populated in order to send to Azure. + + :ivar data_collection_endpoint: Represents the data collection ingestion endpoint in log + analytics. Required. + :vartype data_collection_endpoint: str + :ivar data_collection_rule_immutable_id: The data collection rule immutable id, the rule + defines the transformation and data destination. Required. + :vartype data_collection_rule_immutable_id: str + :ivar stream_name: The stream we are sending the data to. Required. + :vartype stream_name: str """ + _validation = { + "data_collection_endpoint": {"required": True}, + "data_collection_rule_immutable_id": {"required": True}, + "stream_name": {"required": True}, + } + _attribute_map = { - "admin": {"key": "admin", "type": "EnrichmentDomainWhoisContact"}, - "billing": {"key": "billing", "type": "EnrichmentDomainWhoisContact"}, - "registrant": {"key": "registrant", "type": "EnrichmentDomainWhoisContact"}, - "tech": {"key": "tech", "type": "EnrichmentDomainWhoisContact"}, + "data_collection_endpoint": {"key": "dataCollectionEndpoint", "type": "str"}, + "data_collection_rule_immutable_id": {"key": "dataCollectionRuleImmutableId", "type": "str"}, + "stream_name": {"key": "streamName", "type": "str"}, } def __init__( - self, - *, - admin: Optional["_models.EnrichmentDomainWhoisContact"] = None, - billing: Optional["_models.EnrichmentDomainWhoisContact"] = None, - registrant: Optional["_models.EnrichmentDomainWhoisContact"] = None, - tech: Optional["_models.EnrichmentDomainWhoisContact"] = None, - **kwargs - ): + self, *, data_collection_endpoint: str, data_collection_rule_immutable_id: str, stream_name: str, **kwargs: Any + ) -> None: """ - :keyword admin: The admin contact for this whois record. - :paramtype admin: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :keyword billing: The billing contact for this whois record. - :paramtype billing: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :keyword registrant: The registrant contact for this whois record. - :paramtype registrant: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact - :keyword tech: The technical contact for this whois record. - :paramtype tech: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :keyword data_collection_endpoint: Represents the data collection ingestion endpoint in log + analytics. Required. + :paramtype data_collection_endpoint: str + :keyword data_collection_rule_immutable_id: The data collection rule immutable id, the rule + defines the transformation and data destination. Required. + :paramtype data_collection_rule_immutable_id: str + :keyword stream_name: The stream we are sending the data to. Required. + :paramtype stream_name: str """ super().__init__(**kwargs) - self.admin = admin - self.billing = billing - self.registrant = registrant - self.tech = tech + self.data_collection_endpoint = data_collection_endpoint + self.data_collection_rule_immutable_id = data_collection_rule_immutable_id + self.stream_name = stream_name -class EnrichmentDomainWhoisDetails(_serialization.Model): - """The whois record for a given domain. +class Deployment(_serialization.Model): + """Description about a deployment. - :ivar registrar: The registrar associated with this domain. - :vartype registrar: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisRegistrarDetails - :ivar contacts: The set of contacts associated with this domain. - :vartype contacts: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContacts - :ivar name_servers: A list of name servers associated with this domain. - :vartype name_servers: list[str] - :ivar statuses: The set of status flags for this whois record. - :vartype statuses: list[str] + :ivar deployment_id: Deployment identifier. + :vartype deployment_id: str + :ivar deployment_state: Current status of the deployment. Known values are: "In_Progress", + "Completed", "Queued", and "Canceling". + :vartype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState + :ivar deployment_result: The outcome of the deployment. Known values are: "Success", + "Canceled", and "Failed". + :vartype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult + :ivar deployment_time: The time when the deployment finished. + :vartype deployment_time: ~datetime.datetime + :ivar deployment_logs_url: Url to access repository action logs. + :vartype deployment_logs_url: str """ _attribute_map = { - "registrar": {"key": "registrar", "type": "EnrichmentDomainWhoisRegistrarDetails"}, - "contacts": {"key": "contacts", "type": "EnrichmentDomainWhoisContacts"}, - "name_servers": {"key": "nameServers", "type": "[str]"}, - "statuses": {"key": "statuses", "type": "[str]"}, + "deployment_id": {"key": "deploymentId", "type": "str"}, + "deployment_state": {"key": "deploymentState", "type": "str"}, + "deployment_result": {"key": "deploymentResult", "type": "str"}, + "deployment_time": {"key": "deploymentTime", "type": "iso-8601"}, + "deployment_logs_url": {"key": "deploymentLogsUrl", "type": "str"}, } def __init__( self, *, - registrar: Optional["_models.EnrichmentDomainWhoisRegistrarDetails"] = None, - contacts: Optional["_models.EnrichmentDomainWhoisContacts"] = None, - name_servers: Optional[List[str]] = None, - statuses: Optional[List[str]] = None, - **kwargs - ): + deployment_id: Optional[str] = None, + deployment_state: Optional[Union[str, "_models.DeploymentState"]] = None, + deployment_result: Optional[Union[str, "_models.DeploymentResult"]] = None, + deployment_time: Optional[datetime.datetime] = None, + deployment_logs_url: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword registrar: The registrar associated with this domain. - :paramtype registrar: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisRegistrarDetails - :keyword contacts: The set of contacts associated with this domain. - :paramtype contacts: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContacts - :keyword name_servers: A list of name servers associated with this domain. - :paramtype name_servers: list[str] - :keyword statuses: The set of status flags for this whois record. - :paramtype statuses: list[str] + :keyword deployment_id: Deployment identifier. + :paramtype deployment_id: str + :keyword deployment_state: Current status of the deployment. Known values are: "In_Progress", + "Completed", "Queued", and "Canceling". + :paramtype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState + :keyword deployment_result: The outcome of the deployment. Known values are: "Success", + "Canceled", and "Failed". + :paramtype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult + :keyword deployment_time: The time when the deployment finished. + :paramtype deployment_time: ~datetime.datetime + :keyword deployment_logs_url: Url to access repository action logs. + :paramtype deployment_logs_url: str """ super().__init__(**kwargs) - self.registrar = registrar - self.contacts = contacts - self.name_servers = name_servers - self.statuses = statuses - - -class EnrichmentDomainWhoisRegistrarDetails(_serialization.Model): - """The registrar associated with this domain. - - :ivar name: The name of this registrar. - :vartype name: str - :ivar abuse_contact_email: This registrar's abuse contact email. - :vartype abuse_contact_email: str - :ivar abuse_contact_phone: This registrar's abuse contact phone number. - :vartype abuse_contact_phone: str - :ivar iana_id: This registrar's Internet Assigned Numbers Authority id. - :vartype iana_id: str - :ivar url: This registrar's URL. - :vartype url: str - :ivar whois_server: The hostname of this registrar's whois server. - :vartype whois_server: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "abuse_contact_email": {"key": "abuseContactEmail", "type": "str"}, - "abuse_contact_phone": {"key": "abuseContactPhone", "type": "str"}, - "iana_id": {"key": "ianaId", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "whois_server": {"key": "whoisServer", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - abuse_contact_email: Optional[str] = None, - abuse_contact_phone: Optional[str] = None, - iana_id: Optional[str] = None, - url: Optional[str] = None, - whois_server: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of this registrar. - :paramtype name: str - :keyword abuse_contact_email: This registrar's abuse contact email. - :paramtype abuse_contact_email: str - :keyword abuse_contact_phone: This registrar's abuse contact phone number. - :paramtype abuse_contact_phone: str - :keyword iana_id: This registrar's Internet Assigned Numbers Authority id. - :paramtype iana_id: str - :keyword url: This registrar's URL. - :paramtype url: str - :keyword whois_server: The hostname of this registrar's whois server. - :paramtype whois_server: str - """ - super().__init__(**kwargs) - self.name = name - self.abuse_contact_email = abuse_contact_email - self.abuse_contact_phone = abuse_contact_phone - self.iana_id = iana_id - self.url = url - self.whois_server = whois_server + self.deployment_id = deployment_id + self.deployment_state = deployment_state + self.deployment_result = deployment_result + self.deployment_time = deployment_time + self.deployment_logs_url = deployment_logs_url -class EnrichmentIpGeodata(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Geodata information for a given IP address. +class DeploymentInfo(_serialization.Model): + """Information regarding a deployment. - :ivar asn: The autonomous system number associated with this IP address. - :vartype asn: str - :ivar carrier: The name of the carrier for this IP address. - :vartype carrier: str - :ivar city: The city this IP address is located in. - :vartype city: str - :ivar city_cf: A numeric rating of confidence that the value in the 'city' field is correct, on - a scale of 0-100. - :vartype city_cf: int - :ivar continent: The continent this IP address is located on. - :vartype continent: str - :ivar country: The county this IP address is located in. - :vartype country: str - :ivar country_cf: A numeric rating of confidence that the value in the 'country' field is - correct on a scale of 0-100. - :vartype country_cf: int - :ivar ip_addr: The dotted-decimal or colon-separated string representation of the IP address. - :vartype ip_addr: str - :ivar ip_routing_type: A description of the connection type of this IP address. - :vartype ip_routing_type: str - :ivar latitude: The latitude of this IP address. - :vartype latitude: str - :ivar longitude: The longitude of this IP address. - :vartype longitude: str - :ivar organization: The name of the organization for this IP address. - :vartype organization: str - :ivar organization_type: The type of the organization for this IP address. - :vartype organization_type: str - :ivar region: The geographic region this IP address is located in. - :vartype region: str - :ivar state: The state this IP address is located in. - :vartype state: str - :ivar state_cf: A numeric rating of confidence that the value in the 'state' field is correct - on a scale of 0-100. - :vartype state_cf: int - :ivar state_code: The abbreviated name for the state this IP address is located in. - :vartype state_code: str + :ivar deployment_fetch_status: Status while fetching the last deployment. Known values are: + "Success", "Unauthorized", and "NotFound". + :vartype deployment_fetch_status: str or + ~azure.mgmt.securityinsight.models.DeploymentFetchStatus + :ivar deployment: Deployment information. + :vartype deployment: ~azure.mgmt.securityinsight.models.Deployment + :ivar message: Additional details about the deployment that can be shown to the user. + :vartype message: str """ _attribute_map = { - "asn": {"key": "asn", "type": "str"}, - "carrier": {"key": "carrier", "type": "str"}, - "city": {"key": "city", "type": "str"}, - "city_cf": {"key": "cityCf", "type": "int"}, - "continent": {"key": "continent", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "country_cf": {"key": "countryCf", "type": "int"}, - "ip_addr": {"key": "ipAddr", "type": "str"}, - "ip_routing_type": {"key": "ipRoutingType", "type": "str"}, - "latitude": {"key": "latitude", "type": "str"}, - "longitude": {"key": "longitude", "type": "str"}, - "organization": {"key": "organization", "type": "str"}, - "organization_type": {"key": "organizationType", "type": "str"}, - "region": {"key": "region", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "state_cf": {"key": "stateCf", "type": "int"}, - "state_code": {"key": "stateCode", "type": "str"}, + "deployment_fetch_status": {"key": "deploymentFetchStatus", "type": "str"}, + "deployment": {"key": "deployment", "type": "Deployment"}, + "message": {"key": "message", "type": "str"}, } def __init__( self, *, - asn: Optional[str] = None, - carrier: Optional[str] = None, - city: Optional[str] = None, - city_cf: Optional[int] = None, - continent: Optional[str] = None, - country: Optional[str] = None, - country_cf: Optional[int] = None, - ip_addr: Optional[str] = None, - ip_routing_type: Optional[str] = None, - latitude: Optional[str] = None, - longitude: Optional[str] = None, - organization: Optional[str] = None, - organization_type: Optional[str] = None, - region: Optional[str] = None, - state: Optional[str] = None, - state_cf: Optional[int] = None, - state_code: Optional[str] = None, - **kwargs - ): + deployment_fetch_status: Optional[Union[str, "_models.DeploymentFetchStatus"]] = None, + deployment: Optional["_models.Deployment"] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword asn: The autonomous system number associated with this IP address. - :paramtype asn: str - :keyword carrier: The name of the carrier for this IP address. - :paramtype carrier: str - :keyword city: The city this IP address is located in. - :paramtype city: str - :keyword city_cf: A numeric rating of confidence that the value in the 'city' field is correct, - on a scale of 0-100. - :paramtype city_cf: int - :keyword continent: The continent this IP address is located on. - :paramtype continent: str - :keyword country: The county this IP address is located in. - :paramtype country: str - :keyword country_cf: A numeric rating of confidence that the value in the 'country' field is - correct on a scale of 0-100. - :paramtype country_cf: int - :keyword ip_addr: The dotted-decimal or colon-separated string representation of the IP - address. - :paramtype ip_addr: str - :keyword ip_routing_type: A description of the connection type of this IP address. - :paramtype ip_routing_type: str - :keyword latitude: The latitude of this IP address. - :paramtype latitude: str - :keyword longitude: The longitude of this IP address. - :paramtype longitude: str - :keyword organization: The name of the organization for this IP address. - :paramtype organization: str - :keyword organization_type: The type of the organization for this IP address. - :paramtype organization_type: str - :keyword region: The geographic region this IP address is located in. - :paramtype region: str - :keyword state: The state this IP address is located in. - :paramtype state: str - :keyword state_cf: A numeric rating of confidence that the value in the 'state' field is - correct on a scale of 0-100. - :paramtype state_cf: int - :keyword state_code: The abbreviated name for the state this IP address is located in. - :paramtype state_code: str + :keyword deployment_fetch_status: Status while fetching the last deployment. Known values are: + "Success", "Unauthorized", and "NotFound". + :paramtype deployment_fetch_status: str or + ~azure.mgmt.securityinsight.models.DeploymentFetchStatus + :keyword deployment: Deployment information. + :paramtype deployment: ~azure.mgmt.securityinsight.models.Deployment + :keyword message: Additional details about the deployment that can be shown to the user. + :paramtype message: str """ super().__init__(**kwargs) - self.asn = asn - self.carrier = carrier - self.city = city - self.city_cf = city_cf - self.continent = continent - self.country = country - self.country_cf = country_cf - self.ip_addr = ip_addr - self.ip_routing_type = ip_routing_type - self.latitude = latitude - self.longitude = longitude - self.organization = organization - self.organization_type = organization_type - self.region = region - self.state = state - self.state_cf = state_cf - self.state_code = state_code + self.deployment_fetch_status = deployment_fetch_status + self.deployment = deployment + self.message = message -class EntityAnalytics(Settings): - """Settings with single toggle. +class DnsEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a dns entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -7273,13 +7312,25 @@ class EntityAnalytics(Settings): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", - "EntityAnalytics", and "Ueba". - :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind - :ivar entity_providers: The relevant entity providers that are synced. - :vartype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar dns_server_ip_entity_id: An ip entity id for the dns server resolving the request. + :vartype dns_server_ip_entity_id: str + :ivar domain_name: The name of the dns record associated with the alert. + :vartype domain_name: str + :ivar host_ip_address_entity_id: An ip entity id for the dns request client. + :vartype host_ip_address_entity_id: str + :ivar ip_address_entity_ids: Ip entity identifiers for the resolved ip address. + :vartype ip_address_entity_ids: list[str] """ _validation = { @@ -7288,6 +7339,12 @@ class EntityAnalytics(Settings): "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "dns_server_ip_entity_id": {"readonly": True}, + "domain_name": {"readonly": True}, + "host_ip_address_entity_id": {"readonly": True}, + "ip_address_entity_ids": {"readonly": True}, } _attribute_map = { @@ -7295,1378 +7352,1433 @@ class EntityAnalytics(Settings): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "entity_providers": {"key": "properties.entityProviders", "type": "[str]"}, - } + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "dns_server_ip_entity_id": {"key": "properties.dnsServerIpEntityId", "type": "str"}, + "domain_name": {"key": "properties.domainName", "type": "str"}, + "host_ip_address_entity_id": {"key": "properties.hostIpAddressEntityId", "type": "str"}, + "ip_address_entity_ids": {"key": "properties.ipAddressEntityIds", "type": "[str]"}, + } - def __init__( - self, - *, - etag: Optional[str] = None, - entity_providers: Optional[List[Union[str, "_models.EntityProviders"]]] = None, - **kwargs - ): - """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword entity_providers: The relevant entity providers that are synced. - :paramtype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] - """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "EntityAnalytics" - self.entity_providers = entity_providers + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "DnsResolution" + self.additional_data = None + self.friendly_name = None + self.dns_server_ip_entity_id = None + self.domain_name = None + self.host_ip_address_entity_id = None + self.ip_address_entity_ids = None -class EntityEdges(_serialization.Model): - """The edge that connects the entity to the other entity. +class DnsEntityProperties(EntityCommonProperties): + """Dns entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar target_entity_id: The target entity Id. - :vartype target_entity_id: str :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar dns_server_ip_entity_id: An ip entity id for the dns server resolving the request. + :vartype dns_server_ip_entity_id: str + :ivar domain_name: The name of the dns record associated with the alert. + :vartype domain_name: str + :ivar host_ip_address_entity_id: An ip entity id for the dns request client. + :vartype host_ip_address_entity_id: str + :ivar ip_address_entity_ids: Ip entity identifiers for the resolved ip address. + :vartype ip_address_entity_ids: list[str] """ + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "dns_server_ip_entity_id": {"readonly": True}, + "domain_name": {"readonly": True}, + "host_ip_address_entity_id": {"readonly": True}, + "ip_address_entity_ids": {"readonly": True}, + } + _attribute_map = { - "target_entity_id": {"key": "targetEntityId", "type": "str"}, "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "dns_server_ip_entity_id": {"key": "dnsServerIpEntityId", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + "host_ip_address_entity_id": {"key": "hostIpAddressEntityId", "type": "str"}, + "ip_address_entity_ids": {"key": "ipAddressEntityIds", "type": "[str]"}, } - def __init__( - self, *, target_entity_id: Optional[str] = None, additional_data: Optional[Dict[str, Any]] = None, **kwargs - ): - """ - :keyword target_entity_id: The target entity Id. - :paramtype target_entity_id: str - :keyword additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :paramtype additional_data: dict[str, any] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.target_entity_id = target_entity_id - self.additional_data = additional_data + self.dns_server_ip_entity_id = None + self.domain_name = None + self.host_ip_address_entity_id = None + self.ip_address_entity_ids = None -class EntityExpandParameters(_serialization.Model): - """The parameters required to execute an expand operation on the given entity. +class Dynamics365CheckRequirements(DataConnectorsCheckRequirements): + """Represents Dynamics365 requirements check request. - :ivar end_time: The end date filter, so the only expansion results returned are before this - date. - :vartype end_time: ~datetime.datetime - :ivar expansion_id: The Id of the expansion to perform. - :vartype expansion_id: str - :ivar start_time: The start date filter, so the only expansion results returned are after this - date. - :vartype start_time: ~datetime.datetime + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str """ + _validation = { + "kind": {"required": True}, + } + _attribute_map = { - "end_time": {"key": "endTime", "type": "iso-8601"}, - "expansion_id": {"key": "expansionId", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__( - self, - *, - end_time: Optional[datetime.datetime] = None, - expansion_id: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword end_time: The end date filter, so the only expansion results returned are before this - date. - :paramtype end_time: ~datetime.datetime - :keyword expansion_id: The Id of the expansion to perform. - :paramtype expansion_id: str - :keyword start_time: The start date filter, so the only expansion results returned are after - this date. - :paramtype start_time: ~datetime.datetime + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str """ super().__init__(**kwargs) - self.end_time = end_time - self.expansion_id = expansion_id - self.start_time = start_time + self.kind: str = "Dynamics365" + self.tenant_id = tenant_id -class EntityExpandResponse(_serialization.Model): - """The entity expansion result operation response. +class Dynamics365CheckRequirementsProperties(DataConnectorTenantId): + """Dynamics365 requirements check properties. - :ivar meta_data: The metadata from the expansion operation results. - :vartype meta_data: ~azure.mgmt.securityinsight.models.ExpansionResultsMetadata - :ivar value: The expansion result values. - :vartype value: ~azure.mgmt.securityinsight.models.EntityExpandResponseValue + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str """ + _validation = { + "tenant_id": {"required": True}, + } + _attribute_map = { - "meta_data": {"key": "metaData", "type": "ExpansionResultsMetadata"}, - "value": {"key": "value", "type": "EntityExpandResponseValue"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__( - self, - *, - meta_data: Optional["_models.ExpansionResultsMetadata"] = None, - value: Optional["_models.EntityExpandResponseValue"] = None, - **kwargs - ): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ - :keyword meta_data: The metadata from the expansion operation results. - :paramtype meta_data: ~azure.mgmt.securityinsight.models.ExpansionResultsMetadata - :keyword value: The expansion result values. - :paramtype value: ~azure.mgmt.securityinsight.models.EntityExpandResponseValue + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str """ - super().__init__(**kwargs) - self.meta_data = meta_data - self.value = value + super().__init__(tenant_id=tenant_id, **kwargs) -class EntityExpandResponseValue(_serialization.Model): - """The expansion result values. +class Dynamics365DataConnector(DataConnector): + """Represents Dynamics365 data connector. - :ivar entities: Array of the expansion result entities. - :vartype entities: list[~azure.mgmt.securityinsight.models.Entity] - :ivar edges: Array of edges that connects the entity to the list of entities. - :vartype edges: list[~azure.mgmt.securityinsight.models.EntityEdges] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + } + _attribute_map = { - "entities": {"key": "entities", "type": "[Entity]"}, - "edges": {"key": "edges", "type": "[EntityEdges]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "Dynamics365DataConnectorDataTypes"}, } def __init__( self, *, - entities: Optional[List["_models.Entity"]] = None, - edges: Optional[List["_models.EntityEdges"]] = None, - **kwargs - ): + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.Dynamics365DataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: """ - :keyword entities: Array of the expansion result entities. - :paramtype entities: list[~azure.mgmt.securityinsight.models.Entity] - :keyword edges: Array of edges that connects the entity to the list of entities. - :paramtype edges: list[~azure.mgmt.securityinsight.models.EntityEdges] + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes """ - super().__init__(**kwargs) - self.entities = entities - self.edges = edges + super().__init__(etag=etag, **kwargs) + self.kind: str = "Dynamics365" + self.tenant_id = tenant_id + self.data_types = data_types -class EntityFieldMapping(_serialization.Model): - """Map identifiers of a single entity. +class Dynamics365DataConnectorDataTypes(_serialization.Model): + """The available data types for Dynamics365 data connector. - :ivar identifier: Alert V3 identifier. - :vartype identifier: str - :ivar value: The value of the identifier. - :vartype value: str + All required parameters must be populated in order to send to Azure. + + :ivar dynamics365_cds_activities: Common Data Service data type connection. Required. + :vartype dynamics365_cds_activities: + ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities """ - _attribute_map = { - "identifier": {"key": "identifier", "type": "str"}, - "value": {"key": "value", "type": "str"}, + _validation = { + "dynamics365_cds_activities": {"required": True}, } - def __init__(self, *, identifier: Optional[str] = None, value: Optional[str] = None, **kwargs): - """ - :keyword identifier: Alert V3 identifier. - :paramtype identifier: str - :keyword value: The value of the identifier. - :paramtype value: str + _attribute_map = { + "dynamics365_cds_activities": { + "key": "dynamics365CdsActivities", + "type": "Dynamics365DataConnectorDataTypesDynamics365CdsActivities", + }, + } + + def __init__( + self, + *, + dynamics365_cds_activities: "_models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities", + **kwargs: Any + ) -> None: + """ + :keyword dynamics365_cds_activities: Common Data Service data type connection. Required. + :paramtype dynamics365_cds_activities: + ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities """ super().__init__(**kwargs) - self.identifier = identifier - self.value = value + self.dynamics365_cds_activities = dynamics365_cds_activities -class EntityGetInsightsParameters(_serialization.Model): - """The parameters required to execute insights operation on the given entity. +class Dynamics365DataConnectorDataTypesDynamics365CdsActivities(DataConnectorDataTypeCommon): + """Common Data Service data type connection. All required parameters must be populated in order to send to Azure. - :ivar start_time: The start timeline date, so the results returned are after this date. - Required. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end timeline date, so the results returned are before this date. Required. - :vartype end_time: ~datetime.datetime - :ivar add_default_extended_time_range: Indicates if query time range should be extended with - default time range of the query. Default value is false. - :vartype add_default_extended_time_range: bool - :ivar insight_query_ids: List of Insights Query Id. If empty, default value is all insights of - this entity. - :vartype insight_query_ids: list[str] + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _validation = { - "start_time": {"required": True}, - "end_time": {"required": True}, + "state": {"required": True}, } _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "add_default_extended_time_range": {"key": "addDefaultExtendedTimeRange", "type": "bool"}, - "insight_query_ids": {"key": "insightQueryIds", "type": "[str]"}, + "state": {"key": "state", "type": "str"}, } - def __init__( - self, - *, - start_time: datetime.datetime, - end_time: datetime.datetime, - add_default_extended_time_range: Optional[bool] = None, - insight_query_ids: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ - :keyword start_time: The start timeline date, so the results returned are after this date. - Required. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end timeline date, so the results returned are before this date. - Required. - :paramtype end_time: ~datetime.datetime - :keyword add_default_extended_time_range: Indicates if query time range should be extended with - default time range of the query. Default value is false. - :paramtype add_default_extended_time_range: bool - :keyword insight_query_ids: List of Insights Query Id. If empty, default value is all insights - of this entity. - :paramtype insight_query_ids: list[str] + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ - super().__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - self.add_default_extended_time_range = add_default_extended_time_range - self.insight_query_ids = insight_query_ids + super().__init__(state=state, **kwargs) -class EntityGetInsightsResponse(_serialization.Model): - """The Get Insights result operation response. +class Dynamics365DataConnectorProperties(DataConnectorTenantId): + """Dynamics365 data connector properties. - :ivar meta_data: The metadata from the get insights operation results. - :vartype meta_data: ~azure.mgmt.securityinsight.models.GetInsightsResultsMetadata - :ivar value: The insights result values. - :vartype value: list[~azure.mgmt.securityinsight.models.EntityInsightItem] + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes """ + _validation = { + "tenant_id": {"required": True}, + "data_types": {"required": True}, + } + _attribute_map = { - "meta_data": {"key": "metaData", "type": "GetInsightsResultsMetadata"}, - "value": {"key": "value", "type": "[EntityInsightItem]"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "Dynamics365DataConnectorDataTypes"}, } def __init__( - self, - *, - meta_data: Optional["_models.GetInsightsResultsMetadata"] = None, - value: Optional[List["_models.EntityInsightItem"]] = None, - **kwargs - ): + self, *, tenant_id: str, data_types: "_models.Dynamics365DataConnectorDataTypes", **kwargs: Any + ) -> None: """ - :keyword meta_data: The metadata from the get insights operation results. - :paramtype meta_data: ~azure.mgmt.securityinsight.models.GetInsightsResultsMetadata - :keyword value: The insights result values. - :paramtype value: list[~azure.mgmt.securityinsight.models.EntityInsightItem] + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.Dynamics365DataConnectorDataTypes """ - super().__init__(**kwargs) - self.meta_data = meta_data - self.value = value + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types -class EntityInsightItem(_serialization.Model): - """Entity insight Item. +class EnrichmentDomainWhois(_serialization.Model): + """Whois information for a given domain and associated metadata. - :ivar query_id: The query id of the insight. - :vartype query_id: str - :ivar query_time_interval: The Time interval that the query actually executed on. - :vartype query_time_interval: - ~azure.mgmt.securityinsight.models.EntityInsightItemQueryTimeInterval - :ivar table_query_results: Query results for table insights query. - :vartype table_query_results: ~azure.mgmt.securityinsight.models.InsightsTableResult - :ivar chart_query_results: Query results for table insights query. - :vartype chart_query_results: list[~azure.mgmt.securityinsight.models.InsightsTableResult] + :ivar domain: The domain for this whois record. + :vartype domain: str + :ivar server: The hostname of this registrar's whois server. + :vartype server: str + :ivar created: The timestamp at which this record was created. + :vartype created: ~datetime.datetime + :ivar updated: The timestamp at which this record was last updated. + :vartype updated: ~datetime.datetime + :ivar expires: The timestamp at which this record will expire. + :vartype expires: ~datetime.datetime + :ivar parsed_whois: The whois record for a given domain. + :vartype parsed_whois: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisDetails """ _attribute_map = { - "query_id": {"key": "queryId", "type": "str"}, - "query_time_interval": {"key": "queryTimeInterval", "type": "EntityInsightItemQueryTimeInterval"}, - "table_query_results": {"key": "tableQueryResults", "type": "InsightsTableResult"}, - "chart_query_results": {"key": "chartQueryResults", "type": "[InsightsTableResult]"}, + "domain": {"key": "domain", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "created": {"key": "created", "type": "iso-8601"}, + "updated": {"key": "updated", "type": "iso-8601"}, + "expires": {"key": "expires", "type": "iso-8601"}, + "parsed_whois": {"key": "parsedWhois", "type": "EnrichmentDomainWhoisDetails"}, } def __init__( self, *, - query_id: Optional[str] = None, - query_time_interval: Optional["_models.EntityInsightItemQueryTimeInterval"] = None, - table_query_results: Optional["_models.InsightsTableResult"] = None, - chart_query_results: Optional[List["_models.InsightsTableResult"]] = None, - **kwargs - ): + domain: Optional[str] = None, + server: Optional[str] = None, + created: Optional[datetime.datetime] = None, + updated: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + parsed_whois: Optional["_models.EnrichmentDomainWhoisDetails"] = None, + **kwargs: Any + ) -> None: """ - :keyword query_id: The query id of the insight. - :paramtype query_id: str - :keyword query_time_interval: The Time interval that the query actually executed on. - :paramtype query_time_interval: - ~azure.mgmt.securityinsight.models.EntityInsightItemQueryTimeInterval - :keyword table_query_results: Query results for table insights query. - :paramtype table_query_results: ~azure.mgmt.securityinsight.models.InsightsTableResult - :keyword chart_query_results: Query results for table insights query. - :paramtype chart_query_results: list[~azure.mgmt.securityinsight.models.InsightsTableResult] + :keyword domain: The domain for this whois record. + :paramtype domain: str + :keyword server: The hostname of this registrar's whois server. + :paramtype server: str + :keyword created: The timestamp at which this record was created. + :paramtype created: ~datetime.datetime + :keyword updated: The timestamp at which this record was last updated. + :paramtype updated: ~datetime.datetime + :keyword expires: The timestamp at which this record will expire. + :paramtype expires: ~datetime.datetime + :keyword parsed_whois: The whois record for a given domain. + :paramtype parsed_whois: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisDetails """ super().__init__(**kwargs) - self.query_id = query_id - self.query_time_interval = query_time_interval - self.table_query_results = table_query_results - self.chart_query_results = chart_query_results + self.domain = domain + self.server = server + self.created = created + self.updated = updated + self.expires = expires + self.parsed_whois = parsed_whois -class EntityInsightItemQueryTimeInterval(_serialization.Model): - """The Time interval that the query actually executed on. +class EnrichmentDomainWhoisContact(_serialization.Model): + """An individual contact associated with this domain. - :ivar start_time: Insight query start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Insight query end time. - :vartype end_time: ~datetime.datetime + :ivar name: The name of this contact. + :vartype name: str + :ivar org: The organization for this contact. + :vartype org: str + :ivar street: A list describing the street address for this contact. + :vartype street: list[str] + :ivar city: The city for this contact. + :vartype city: str + :ivar state: The state for this contact. + :vartype state: str + :ivar postal: The postal code for this contact. + :vartype postal: str + :ivar country: The country for this contact. + :vartype country: str + :ivar phone: The phone number for this contact. + :vartype phone: str + :ivar fax: The fax number for this contact. + :vartype fax: str + :ivar email: The email address for this contact. + :vartype email: str """ _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, + "name": {"key": "name", "type": "str"}, + "org": {"key": "org", "type": "str"}, + "street": {"key": "street", "type": "[str]"}, + "city": {"key": "city", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "postal": {"key": "postal", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "fax": {"key": "fax", "type": "str"}, + "email": {"key": "email", "type": "str"}, } def __init__( - self, *, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, **kwargs - ): - """ - :keyword start_time: Insight query start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Insight query end time. - :paramtype end_time: ~datetime.datetime + self, + *, + name: Optional[str] = None, + org: Optional[str] = None, + street: Optional[List[str]] = None, + city: Optional[str] = None, + state: Optional[str] = None, + postal: Optional[str] = None, + country: Optional[str] = None, + phone: Optional[str] = None, + fax: Optional[str] = None, + email: Optional[str] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - - -class EntityList(_serialization.Model): - """List of all the entities. - - Variables are only populated by the server, and will be ignored when sending a request. + :keyword name: The name of this contact. + :paramtype name: str + :keyword org: The organization for this contact. + :paramtype org: str + :keyword street: A list describing the street address for this contact. + :paramtype street: list[str] + :keyword city: The city for this contact. + :paramtype city: str + :keyword state: The state for this contact. + :paramtype state: str + :keyword postal: The postal code for this contact. + :paramtype postal: str + :keyword country: The country for this contact. + :paramtype country: str + :keyword phone: The phone number for this contact. + :paramtype phone: str + :keyword fax: The fax number for this contact. + :paramtype fax: str + :keyword email: The email address for this contact. + :paramtype email: str + """ + super().__init__(**kwargs) + self.name = name + self.org = org + self.street = street + self.city = city + self.state = state + self.postal = postal + self.country = country + self.phone = phone + self.fax = fax + self.email = email - All required parameters must be populated in order to send to Azure. - :ivar next_link: URL to fetch the next set of entities. - :vartype next_link: str - :ivar value: Array of entities. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.Entity] - """ +class EnrichmentDomainWhoisContacts(_serialization.Model): + """The set of contacts associated with this domain. - _validation = { - "next_link": {"readonly": True}, - "value": {"required": True}, - } + :ivar admin: The admin contact for this whois record. + :vartype admin: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :ivar billing: The billing contact for this whois record. + :vartype billing: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :ivar registrant: The registrant contact for this whois record. + :vartype registrant: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :ivar tech: The technical contact for this whois record. + :vartype tech: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Entity]"}, + "admin": {"key": "admin", "type": "EnrichmentDomainWhoisContact"}, + "billing": {"key": "billing", "type": "EnrichmentDomainWhoisContact"}, + "registrant": {"key": "registrant", "type": "EnrichmentDomainWhoisContact"}, + "tech": {"key": "tech", "type": "EnrichmentDomainWhoisContact"}, } - def __init__(self, *, value: List["_models.Entity"], **kwargs): + def __init__( + self, + *, + admin: Optional["_models.EnrichmentDomainWhoisContact"] = None, + billing: Optional["_models.EnrichmentDomainWhoisContact"] = None, + registrant: Optional["_models.EnrichmentDomainWhoisContact"] = None, + tech: Optional["_models.EnrichmentDomainWhoisContact"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Array of entities. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.Entity] + :keyword admin: The admin contact for this whois record. + :paramtype admin: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :keyword billing: The billing contact for this whois record. + :paramtype billing: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :keyword registrant: The registrant contact for this whois record. + :paramtype registrant: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact + :keyword tech: The technical contact for this whois record. + :paramtype tech: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContact """ super().__init__(**kwargs) - self.next_link = None - self.value = value + self.admin = admin + self.billing = billing + self.registrant = registrant + self.tech = tech -class EntityMapping(_serialization.Model): - """Single entity mapping for the alert rule. +class EnrichmentDomainWhoisDetails(_serialization.Model): + """The whois record for a given domain. - :ivar entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", "IP", - "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", - "MailMessage", and "SubmissionMail". - :vartype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType - :ivar field_mappings: array of field mappings for the given entity mapping. - :vartype field_mappings: list[~azure.mgmt.securityinsight.models.FieldMapping] + :ivar registrar: The registrar associated with this domain. + :vartype registrar: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisRegistrarDetails + :ivar contacts: The set of contacts associated with this domain. + :vartype contacts: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContacts + :ivar name_servers: A list of name servers associated with this domain. + :vartype name_servers: list[str] + :ivar statuses: The set of status flags for this whois record. + :vartype statuses: list[str] """ _attribute_map = { - "entity_type": {"key": "entityType", "type": "str"}, - "field_mappings": {"key": "fieldMappings", "type": "[FieldMapping]"}, + "registrar": {"key": "registrar", "type": "EnrichmentDomainWhoisRegistrarDetails"}, + "contacts": {"key": "contacts", "type": "EnrichmentDomainWhoisContacts"}, + "name_servers": {"key": "nameServers", "type": "[str]"}, + "statuses": {"key": "statuses", "type": "[str]"}, } def __init__( self, *, - entity_type: Optional[Union[str, "_models.EntityMappingType"]] = None, - field_mappings: Optional[List["_models.FieldMapping"]] = None, - **kwargs - ): + registrar: Optional["_models.EnrichmentDomainWhoisRegistrarDetails"] = None, + contacts: Optional["_models.EnrichmentDomainWhoisContacts"] = None, + name_servers: Optional[List[str]] = None, + statuses: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", - "IP", "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", - "MailMessage", and "SubmissionMail". - :paramtype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType - :keyword field_mappings: array of field mappings for the given entity mapping. - :paramtype field_mappings: list[~azure.mgmt.securityinsight.models.FieldMapping] + :keyword registrar: The registrar associated with this domain. + :paramtype registrar: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisRegistrarDetails + :keyword contacts: The set of contacts associated with this domain. + :paramtype contacts: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhoisContacts + :keyword name_servers: A list of name servers associated with this domain. + :paramtype name_servers: list[str] + :keyword statuses: The set of status flags for this whois record. + :paramtype statuses: list[str] """ super().__init__(**kwargs) - self.entity_type = entity_type - self.field_mappings = field_mappings - - -class EntityQueryItem(_serialization.Model): - """An abstract Query item for entity. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - InsightQueryItem + self.registrar = registrar + self.contacts = contacts + self.name_servers = name_servers + self.statuses = statuses - 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 EnrichmentDomainWhoisRegistrarDetails(_serialization.Model): + """The registrar associated with this domain. - :ivar id: Query Template ARM ID. - :vartype id: str - :ivar name: Query Template ARM Name. + :ivar name: The name of this registrar. :vartype name: str - :ivar type: ARM Type. - :vartype type: str - :ivar kind: The kind of the entity query. Required. Known values are: "Expansion", "Insight", - and "Activity". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind + :ivar abuse_contact_email: This registrar's abuse contact email. + :vartype abuse_contact_email: str + :ivar abuse_contact_phone: This registrar's abuse contact phone number. + :vartype abuse_contact_phone: str + :ivar iana_id: This registrar's Internet Assigned Numbers Authority id. + :vartype iana_id: str + :ivar url: This registrar's URL. + :vartype url: str + :ivar whois_server: The hostname of this registrar's whois server. + :vartype whois_server: str """ - _validation = { - "id": {"readonly": True}, - "kind": {"required": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, + "abuse_contact_email": {"key": "abuseContactEmail", "type": "str"}, + "abuse_contact_phone": {"key": "abuseContactPhone", "type": "str"}, + "iana_id": {"key": "ianaId", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "whois_server": {"key": "whoisServer", "type": "str"}, } - _subtype_map = {"kind": {"Insight": "InsightQueryItem"}} - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + abuse_contact_email: Optional[str] = None, + abuse_contact_phone: Optional[str] = None, + iana_id: Optional[str] = None, + url: Optional[str] = None, + whois_server: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Query Template ARM Name. + :keyword name: The name of this registrar. :paramtype name: str - :keyword type: ARM Type. - :paramtype type: str + :keyword abuse_contact_email: This registrar's abuse contact email. + :paramtype abuse_contact_email: str + :keyword abuse_contact_phone: This registrar's abuse contact phone number. + :paramtype abuse_contact_phone: str + :keyword iana_id: This registrar's Internet Assigned Numbers Authority id. + :paramtype iana_id: str + :keyword url: This registrar's URL. + :paramtype url: str + :keyword whois_server: The hostname of this registrar's whois server. + :paramtype whois_server: str """ super().__init__(**kwargs) - self.id = None self.name = name - self.type = type - self.kind: Optional[str] = None - - -class EntityQueryItemProperties(_serialization.Model): - """An properties abstract Query item for entity. + self.abuse_contact_email = abuse_contact_email + self.abuse_contact_phone = abuse_contact_phone + self.iana_id = iana_id + self.url = url + self.whois_server = whois_server - :ivar data_types: Data types for template. - :vartype data_types: - list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", - "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :ivar required_input_fields_sets: Data types for template. - :vartype required_input_fields_sets: list[list[str]] - :ivar entities_filter: The query applied only to entities matching to all filters. - :vartype entities_filter: JSON - """ - _attribute_map = { - "data_types": {"key": "dataTypes", "type": "[EntityQueryItemPropertiesDataTypesItem]"}, - "input_entity_type": {"key": "inputEntityType", "type": "str"}, - "required_input_fields_sets": {"key": "requiredInputFieldsSets", "type": "[[str]]"}, - "entities_filter": {"key": "entitiesFilter", "type": "object"}, - } +class EnrichmentIpGeodata(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Geodata information for a given IP address. - def __init__( - self, - *, - data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, - input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, - required_input_fields_sets: Optional[List[List[str]]] = None, - entities_filter: Optional[JSON] = None, - **kwargs - ): - """ - :keyword data_types: Data types for template. - :paramtype data_types: - list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", - "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", - "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :keyword required_input_fields_sets: Data types for template. - :paramtype required_input_fields_sets: list[list[str]] - :keyword entities_filter: The query applied only to entities matching to all filters. - :paramtype entities_filter: JSON - """ - super().__init__(**kwargs) - self.data_types = data_types - self.input_entity_type = input_entity_type - self.required_input_fields_sets = required_input_fields_sets - self.entities_filter = entities_filter - - -class EntityQueryItemPropertiesDataTypesItem(_serialization.Model): - """EntityQueryItemPropertiesDataTypesItem. - - :ivar data_type: Data type name. - :vartype data_type: str + :ivar asn: The autonomous system number associated with this IP address. + :vartype asn: str + :ivar carrier: The name of the carrier for this IP address. + :vartype carrier: str + :ivar city: The city this IP address is located in. + :vartype city: str + :ivar city_cf: A numeric rating of confidence that the value in the 'city' field is correct, on + a scale of 0-100. + :vartype city_cf: int + :ivar continent: The continent this IP address is located on. + :vartype continent: str + :ivar country: The county this IP address is located in. + :vartype country: str + :ivar country_cf: A numeric rating of confidence that the value in the 'country' field is + correct on a scale of 0-100. + :vartype country_cf: int + :ivar ip_addr: The dotted-decimal or colon-separated string representation of the IP address. + :vartype ip_addr: str + :ivar ip_routing_type: A description of the connection type of this IP address. + :vartype ip_routing_type: str + :ivar latitude: The latitude of this IP address. + :vartype latitude: str + :ivar longitude: The longitude of this IP address. + :vartype longitude: str + :ivar organization: The name of the organization for this IP address. + :vartype organization: str + :ivar organization_type: The type of the organization for this IP address. + :vartype organization_type: str + :ivar region: The geographic region this IP address is located in. + :vartype region: str + :ivar state: The state this IP address is located in. + :vartype state: str + :ivar state_cf: A numeric rating of confidence that the value in the 'state' field is correct + on a scale of 0-100. + :vartype state_cf: int + :ivar state_code: The abbreviated name for the state this IP address is located in. + :vartype state_code: str """ _attribute_map = { - "data_type": {"key": "dataType", "type": "str"}, + "asn": {"key": "asn", "type": "str"}, + "carrier": {"key": "carrier", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "city_cf": {"key": "cityCf", "type": "int"}, + "continent": {"key": "continent", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "country_cf": {"key": "countryCf", "type": "int"}, + "ip_addr": {"key": "ipAddr", "type": "str"}, + "ip_routing_type": {"key": "ipRoutingType", "type": "str"}, + "latitude": {"key": "latitude", "type": "str"}, + "longitude": {"key": "longitude", "type": "str"}, + "organization": {"key": "organization", "type": "str"}, + "organization_type": {"key": "organizationType", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "state_cf": {"key": "stateCf", "type": "int"}, + "state_code": {"key": "stateCode", "type": "str"}, } - def __init__(self, *, data_type: Optional[str] = None, **kwargs): + def __init__( + self, + *, + asn: Optional[str] = None, + carrier: Optional[str] = None, + city: Optional[str] = None, + city_cf: Optional[int] = None, + continent: Optional[str] = None, + country: Optional[str] = None, + country_cf: Optional[int] = None, + ip_addr: Optional[str] = None, + ip_routing_type: Optional[str] = None, + latitude: Optional[str] = None, + longitude: Optional[str] = None, + organization: Optional[str] = None, + organization_type: Optional[str] = None, + region: Optional[str] = None, + state: Optional[str] = None, + state_cf: Optional[int] = None, + state_code: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword data_type: Data type name. - :paramtype data_type: str + :keyword asn: The autonomous system number associated with this IP address. + :paramtype asn: str + :keyword carrier: The name of the carrier for this IP address. + :paramtype carrier: str + :keyword city: The city this IP address is located in. + :paramtype city: str + :keyword city_cf: A numeric rating of confidence that the value in the 'city' field is correct, + on a scale of 0-100. + :paramtype city_cf: int + :keyword continent: The continent this IP address is located on. + :paramtype continent: str + :keyword country: The county this IP address is located in. + :paramtype country: str + :keyword country_cf: A numeric rating of confidence that the value in the 'country' field is + correct on a scale of 0-100. + :paramtype country_cf: int + :keyword ip_addr: The dotted-decimal or colon-separated string representation of the IP + address. + :paramtype ip_addr: str + :keyword ip_routing_type: A description of the connection type of this IP address. + :paramtype ip_routing_type: str + :keyword latitude: The latitude of this IP address. + :paramtype latitude: str + :keyword longitude: The longitude of this IP address. + :paramtype longitude: str + :keyword organization: The name of the organization for this IP address. + :paramtype organization: str + :keyword organization_type: The type of the organization for this IP address. + :paramtype organization_type: str + :keyword region: The geographic region this IP address is located in. + :paramtype region: str + :keyword state: The state this IP address is located in. + :paramtype state: str + :keyword state_cf: A numeric rating of confidence that the value in the 'state' field is + correct on a scale of 0-100. + :paramtype state_cf: int + :keyword state_code: The abbreviated name for the state this IP address is located in. + :paramtype state_code: str """ super().__init__(**kwargs) - self.data_type = data_type + self.asn = asn + self.carrier = carrier + self.city = city + self.city_cf = city_cf + self.continent = continent + self.country = country + self.country_cf = country_cf + self.ip_addr = ip_addr + self.ip_routing_type = ip_routing_type + self.latitude = latitude + self.longitude = longitude + self.organization = organization + self.organization_type = organization_type + self.region = region + self.state = state + self.state_cf = state_cf + self.state_code = state_code -class EntityQueryList(_serialization.Model): - """List of all the entity queries. +class EntityAnalytics(Settings): + """Settings with single toggle. 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 next_link: URL to fetch the next set of entity queries. - :vartype next_link: str - :ivar value: Array of entity queries. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.EntityQuery] + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", + "EntityAnalytics", and "Ueba". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar entity_providers: The relevant entity providers that are synced. + :vartype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] """ _validation = { - "next_link": {"readonly": True}, - "value": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EntityQuery]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "entity_providers": {"key": "properties.entityProviders", "type": "[str]"}, } - def __init__(self, *, value: List["_models.EntityQuery"], **kwargs): + def __init__( + self, + *, + etag: Optional[str] = None, + entity_providers: Optional[List[Union[str, "_models.EntityProviders"]]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Array of entity queries. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQuery] + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword entity_providers: The relevant entity providers that are synced. + :paramtype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] """ - super().__init__(**kwargs) - self.next_link = None - self.value = value - - -class EntityQueryTemplateList(_serialization.Model): - """List of all the entity query templates. + super().__init__(etag=etag, **kwargs) + self.kind: str = "EntityAnalytics" + self.entity_providers = entity_providers - 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 EntityEdges(_serialization.Model): + """The edge that connects the entity to the other entity. - :ivar next_link: URL to fetch the next set of entity query templates. - :vartype next_link: str - :ivar value: Array of entity query templates. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.EntityQueryTemplate] + :ivar target_entity_id: The target entity Id. + :vartype target_entity_id: str + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] """ - _validation = { - "next_link": {"readonly": True}, - "value": {"required": True}, - } - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EntityQueryTemplate]"}, + "target_entity_id": {"key": "targetEntityId", "type": "str"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, } - def __init__(self, *, value: List["_models.EntityQueryTemplate"], **kwargs): + def __init__( + self, *, target_entity_id: Optional[str] = None, additional_data: Optional[Dict[str, Any]] = None, **kwargs: Any + ) -> None: """ - :keyword value: Array of entity query templates. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQueryTemplate] + :keyword target_entity_id: The target entity Id. + :paramtype target_entity_id: str + :keyword additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :paramtype additional_data: dict[str, any] """ super().__init__(**kwargs) - self.next_link = None - self.value = value - + self.target_entity_id = target_entity_id + self.additional_data = additional_data -class EntityTimelineParameters(_serialization.Model): - """The parameters required to execute s timeline operation on the given entity. - All required parameters must be populated in order to send to Azure. +class EntityExpandParameters(_serialization.Model): + """The parameters required to execute an expand operation on the given entity. - :ivar kinds: Array of timeline Item kinds. - :vartype kinds: list[str or ~azure.mgmt.securityinsight.models.EntityTimelineKind] - :ivar start_time: The start timeline date, so the results returned are after this date. - Required. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end timeline date, so the results returned are before this date. Required. - :vartype end_time: ~datetime.datetime - :ivar number_of_bucket: The number of bucket for timeline queries aggregation. - :vartype number_of_bucket: int + :ivar end_time: The end date filter, so the only expansion results returned are before this + date. + :vartype end_time: ~datetime.datetime + :ivar expansion_id: The Id of the expansion to perform. + :vartype expansion_id: str + :ivar start_time: The start date filter, so the only expansion results returned are after this + date. + :vartype start_time: ~datetime.datetime """ - _validation = { - "start_time": {"required": True}, - "end_time": {"required": True}, - } - _attribute_map = { - "kinds": {"key": "kinds", "type": "[str]"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, "end_time": {"key": "endTime", "type": "iso-8601"}, - "number_of_bucket": {"key": "numberOfBucket", "type": "int"}, + "expansion_id": {"key": "expansionId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, } def __init__( self, *, - start_time: datetime.datetime, - end_time: datetime.datetime, - kinds: Optional[List[Union[str, "_models.EntityTimelineKind"]]] = None, - number_of_bucket: Optional[int] = None, - **kwargs - ): + end_time: Optional[datetime.datetime] = None, + expansion_id: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword kinds: Array of timeline Item kinds. - :paramtype kinds: list[str or ~azure.mgmt.securityinsight.models.EntityTimelineKind] - :keyword start_time: The start timeline date, so the results returned are after this date. - Required. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end timeline date, so the results returned are before this date. - Required. + :keyword end_time: The end date filter, so the only expansion results returned are before this + date. :paramtype end_time: ~datetime.datetime - :keyword number_of_bucket: The number of bucket for timeline queries aggregation. - :paramtype number_of_bucket: int + :keyword expansion_id: The Id of the expansion to perform. + :paramtype expansion_id: str + :keyword start_time: The start date filter, so the only expansion results returned are after + this date. + :paramtype start_time: ~datetime.datetime """ super().__init__(**kwargs) - self.kinds = kinds - self.start_time = start_time self.end_time = end_time - self.number_of_bucket = number_of_bucket + self.expansion_id = expansion_id + self.start_time = start_time -class EntityTimelineResponse(_serialization.Model): - """The entity timeline result operation response. +class EntityExpandResponse(_serialization.Model): + """The entity expansion result operation response. - :ivar meta_data: The metadata from the timeline operation results. - :vartype meta_data: ~azure.mgmt.securityinsight.models.TimelineResultsMetadata - :ivar value: The timeline result values. - :vartype value: list[~azure.mgmt.securityinsight.models.EntityTimelineItem] + :ivar meta_data: The metadata from the expansion operation results. + :vartype meta_data: ~azure.mgmt.securityinsight.models.ExpansionResultsMetadata + :ivar value: The expansion result values. + :vartype value: ~azure.mgmt.securityinsight.models.EntityExpandResponseValue """ _attribute_map = { - "meta_data": {"key": "metaData", "type": "TimelineResultsMetadata"}, - "value": {"key": "value", "type": "[EntityTimelineItem]"}, + "meta_data": {"key": "metaData", "type": "ExpansionResultsMetadata"}, + "value": {"key": "value", "type": "EntityExpandResponseValue"}, } def __init__( self, *, - meta_data: Optional["_models.TimelineResultsMetadata"] = None, - value: Optional[List["_models.EntityTimelineItem"]] = None, - **kwargs - ): + meta_data: Optional["_models.ExpansionResultsMetadata"] = None, + value: Optional["_models.EntityExpandResponseValue"] = None, + **kwargs: Any + ) -> None: """ - :keyword meta_data: The metadata from the timeline operation results. - :paramtype meta_data: ~azure.mgmt.securityinsight.models.TimelineResultsMetadata - :keyword value: The timeline result values. - :paramtype value: list[~azure.mgmt.securityinsight.models.EntityTimelineItem] + :keyword meta_data: The metadata from the expansion operation results. + :paramtype meta_data: ~azure.mgmt.securityinsight.models.ExpansionResultsMetadata + :keyword value: The expansion result values. + :paramtype value: ~azure.mgmt.securityinsight.models.EntityExpandResponseValue """ super().__init__(**kwargs) self.meta_data = meta_data self.value = value -class EventGroupingSettings(_serialization.Model): - """Event grouping settings property bag. +class EntityExpandResponseValue(_serialization.Model): + """The expansion result values. - :ivar aggregation_kind: The event grouping aggregation kinds. Known values are: "SingleAlert" - and "AlertPerResult". - :vartype aggregation_kind: str or - ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind + :ivar entities: Array of the expansion result entities. + :vartype entities: list[~azure.mgmt.securityinsight.models.Entity] + :ivar edges: Array of edges that connects the entity to the list of entities. + :vartype edges: list[~azure.mgmt.securityinsight.models.EntityEdges] """ _attribute_map = { - "aggregation_kind": {"key": "aggregationKind", "type": "str"}, + "entities": {"key": "entities", "type": "[Entity]"}, + "edges": {"key": "edges", "type": "[EntityEdges]"}, } def __init__( - self, *, aggregation_kind: Optional[Union[str, "_models.EventGroupingAggregationKind"]] = None, **kwargs - ): + self, + *, + entities: Optional[List["_models.Entity"]] = None, + edges: Optional[List["_models.EntityEdges"]] = None, + **kwargs: Any + ) -> None: """ - :keyword aggregation_kind: The event grouping aggregation kinds. Known values are: - "SingleAlert" and "AlertPerResult". - :paramtype aggregation_kind: str or - ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind + :keyword entities: Array of the expansion result entities. + :paramtype entities: list[~azure.mgmt.securityinsight.models.Entity] + :keyword edges: Array of edges that connects the entity to the list of entities. + :paramtype edges: list[~azure.mgmt.securityinsight.models.EntityEdges] """ super().__init__(**kwargs) - self.aggregation_kind = aggregation_kind - - -class ExpansionEntityQuery(EntityQuery): # pylint: disable=too-many-instance-attributes - """Represents Expansion entity query. + self.entities = entities + self.edges = edges - 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 EntityFieldMapping(_serialization.Model): + """Map identifiers of a single entity. - :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.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: the entity query kind. Required. Known values are: "Expansion", "Insight", and - "Activity". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind - :ivar data_sources: List of the data sources that are required to run the query. - :vartype data_sources: list[str] - :ivar display_name: The query display name. - :vartype display_name: str - :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", - "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", - "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", - and "Nic". - :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :ivar input_fields: List of the fields of the source entity that are required to run the query. - :vartype input_fields: list[str] - :ivar output_entity_types: List of the desired output types to be constructed from the result. - :vartype output_entity_types: list[str or ~azure.mgmt.securityinsight.models.EntityType] - :ivar query_template: The template query string to be parsed and formatted. - :vartype query_template: str + :ivar identifier: Alert V3 identifier. + :vartype identifier: str + :ivar value: The value of the identifier. + :vartype value: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "data_sources": {"key": "properties.dataSources", "type": "[str]"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "input_entity_type": {"key": "properties.inputEntityType", "type": "str"}, - "input_fields": {"key": "properties.inputFields", "type": "[str]"}, - "output_entity_types": {"key": "properties.outputEntityTypes", "type": "[str]"}, - "query_template": {"key": "properties.queryTemplate", "type": "str"}, + "identifier": {"key": "identifier", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - etag: Optional[str] = None, - data_sources: Optional[List[str]] = None, - display_name: Optional[str] = None, - input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, - input_fields: Optional[List[str]] = None, - output_entity_types: Optional[List[Union[str, "_models.EntityType"]]] = None, - query_template: Optional[str] = None, - **kwargs - ): + def __init__(self, *, identifier: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword data_sources: List of the data sources that are required to run the query. - :paramtype data_sources: list[str] - :keyword display_name: The query display name. - :paramtype display_name: str - :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", - "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", - "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", - and "Nic". - :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :keyword input_fields: List of the fields of the source entity that are required to run the - query. - :paramtype input_fields: list[str] - :keyword output_entity_types: List of the desired output types to be constructed from the - result. - :paramtype output_entity_types: list[str or ~azure.mgmt.securityinsight.models.EntityType] - :keyword query_template: The template query string to be parsed and formatted. - :paramtype query_template: str + :keyword identifier: Alert V3 identifier. + :paramtype identifier: str + :keyword value: The value of the identifier. + :paramtype value: str """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "Expansion" - self.data_sources = data_sources - self.display_name = display_name - self.input_entity_type = input_entity_type - self.input_fields = input_fields - self.output_entity_types = output_entity_types - self.query_template = query_template + super().__init__(**kwargs) + self.identifier = identifier + self.value = value -class ExpansionResultAggregation(_serialization.Model): - """Information of a specific aggregation in the expansion result. +class EntityGetInsightsParameters(_serialization.Model): + """The parameters required to execute insights operation on the given entity. All required parameters must be populated in order to send to Azure. - :ivar aggregation_type: The common type of the aggregation. (for e.g. entity field name). - :vartype aggregation_type: str - :ivar count: Total number of aggregations of the given kind (and aggregationType if given) in - the expansion result. Required. - :vartype count: int - :ivar display_name: The display name of the aggregation by type. - :vartype display_name: str - :ivar entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", - "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and - "Nic". - :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :ivar start_time: The start timeline date, so the results returned are after this date. + Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end timeline date, so the results returned are before this date. Required. + :vartype end_time: ~datetime.datetime + :ivar add_default_extended_time_range: Indicates if query time range should be extended with + default time range of the query. Default value is false. + :vartype add_default_extended_time_range: bool + :ivar insight_query_ids: List of Insights Query Id. If empty, default value is all insights of + this entity. + :vartype insight_query_ids: list[str] """ _validation = { - "count": {"required": True}, - "entity_kind": {"required": True}, + "start_time": {"required": True}, + "end_time": {"required": True}, } _attribute_map = { - "aggregation_type": {"key": "aggregationType", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "display_name": {"key": "displayName", "type": "str"}, - "entity_kind": {"key": "entityKind", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "add_default_extended_time_range": {"key": "addDefaultExtendedTimeRange", "type": "bool"}, + "insight_query_ids": {"key": "insightQueryIds", "type": "[str]"}, } def __init__( self, *, - count: int, - entity_kind: Union[str, "_models.EntityKind"], - aggregation_type: Optional[str] = None, - display_name: Optional[str] = None, - **kwargs - ): + start_time: datetime.datetime, + end_time: datetime.datetime, + add_default_extended_time_range: Optional[bool] = None, + insight_query_ids: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword aggregation_type: The common type of the aggregation. (for e.g. entity field name). - :paramtype aggregation_type: str - :keyword count: Total number of aggregations of the given kind (and aggregationType if given) - in the expansion result. Required. - :paramtype count: int - :keyword display_name: The display name of the aggregation by type. - :paramtype display_name: str - :keyword entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", - "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and - "Nic". - :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :keyword start_time: The start timeline date, so the results returned are after this date. + Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end timeline date, so the results returned are before this date. + Required. + :paramtype end_time: ~datetime.datetime + :keyword add_default_extended_time_range: Indicates if query time range should be extended with + default time range of the query. Default value is false. + :paramtype add_default_extended_time_range: bool + :keyword insight_query_ids: List of Insights Query Id. If empty, default value is all insights + of this entity. + :paramtype insight_query_ids: list[str] """ super().__init__(**kwargs) - self.aggregation_type = aggregation_type - self.count = count - self.display_name = display_name - self.entity_kind = entity_kind + self.start_time = start_time + self.end_time = end_time + self.add_default_extended_time_range = add_default_extended_time_range + self.insight_query_ids = insight_query_ids -class ExpansionResultsMetadata(_serialization.Model): - """Expansion result metadata. +class EntityGetInsightsResponse(_serialization.Model): + """The Get Insights result operation response. - :ivar aggregations: Information of the aggregated nodes in the expansion result. - :vartype aggregations: list[~azure.mgmt.securityinsight.models.ExpansionResultAggregation] + :ivar meta_data: The metadata from the get insights operation results. + :vartype meta_data: ~azure.mgmt.securityinsight.models.GetInsightsResultsMetadata + :ivar value: The insights result values. + :vartype value: list[~azure.mgmt.securityinsight.models.EntityInsightItem] """ _attribute_map = { - "aggregations": {"key": "aggregations", "type": "[ExpansionResultAggregation]"}, + "meta_data": {"key": "metaData", "type": "GetInsightsResultsMetadata"}, + "value": {"key": "value", "type": "[EntityInsightItem]"}, } - def __init__(self, *, aggregations: Optional[List["_models.ExpansionResultAggregation"]] = None, **kwargs): + def __init__( + self, + *, + meta_data: Optional["_models.GetInsightsResultsMetadata"] = None, + value: Optional[List["_models.EntityInsightItem"]] = None, + **kwargs: Any + ) -> None: """ - :keyword aggregations: Information of the aggregated nodes in the expansion result. - :paramtype aggregations: list[~azure.mgmt.securityinsight.models.ExpansionResultAggregation] + :keyword meta_data: The metadata from the get insights operation results. + :paramtype meta_data: ~azure.mgmt.securityinsight.models.GetInsightsResultsMetadata + :keyword value: The insights result values. + :paramtype value: list[~azure.mgmt.securityinsight.models.EntityInsightItem] """ super().__init__(**kwargs) - self.aggregations = aggregations - - -class EyesOn(Settings): - """Settings with single toggle. + self.meta_data = meta_data + 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 EntityInsightItem(_serialization.Model): + """Entity insight Item. - :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.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", - "EntityAnalytics", and "Ueba". - :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind - :ivar is_enabled: Determines whether the setting is enable or disabled. - :vartype is_enabled: bool + :ivar query_id: The query id of the insight. + :vartype query_id: str + :ivar query_time_interval: The Time interval that the query actually executed on. + :vartype query_time_interval: + ~azure.mgmt.securityinsight.models.EntityInsightItemQueryTimeInterval + :ivar table_query_results: Query results for table insights query. + :vartype table_query_results: ~azure.mgmt.securityinsight.models.InsightsTableResult + :ivar chart_query_results: Query results for table insights query. + :vartype chart_query_results: list[~azure.mgmt.securityinsight.models.InsightsTableResult] """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "is_enabled": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, + "query_id": {"key": "queryId", "type": "str"}, + "query_time_interval": {"key": "queryTimeInterval", "type": "EntityInsightItemQueryTimeInterval"}, + "table_query_results": {"key": "tableQueryResults", "type": "InsightsTableResult"}, + "chart_query_results": {"key": "chartQueryResults", "type": "[InsightsTableResult]"}, } - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__( + self, + *, + query_id: Optional[str] = None, + query_time_interval: Optional["_models.EntityInsightItemQueryTimeInterval"] = None, + table_query_results: Optional["_models.InsightsTableResult"] = None, + chart_query_results: Optional[List["_models.InsightsTableResult"]] = None, + **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str + :keyword query_id: The query id of the insight. + :paramtype query_id: str + :keyword query_time_interval: The Time interval that the query actually executed on. + :paramtype query_time_interval: + ~azure.mgmt.securityinsight.models.EntityInsightItemQueryTimeInterval + :keyword table_query_results: Query results for table insights query. + :paramtype table_query_results: ~azure.mgmt.securityinsight.models.InsightsTableResult + :keyword chart_query_results: Query results for table insights query. + :paramtype chart_query_results: list[~azure.mgmt.securityinsight.models.InsightsTableResult] """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "EyesOn" - self.is_enabled = None + super().__init__(**kwargs) + self.query_id = query_id + self.query_time_interval = query_time_interval + self.table_query_results = table_query_results + self.chart_query_results = chart_query_results -class FieldMapping(_serialization.Model): - """A single field mapping of the mapped entity. +class EntityInsightItemQueryTimeInterval(_serialization.Model): + """The Time interval that the query actually executed on. - :ivar identifier: the V3 identifier of the entity. - :vartype identifier: str - :ivar column_name: the column name to be mapped to the identifier. - :vartype column_name: str + :ivar start_time: Insight query start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Insight query end time. + :vartype end_time: ~datetime.datetime """ _attribute_map = { - "identifier": {"key": "identifier", "type": "str"}, - "column_name": {"key": "columnName", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } - def __init__(self, *, identifier: Optional[str] = None, column_name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword identifier: the V3 identifier of the entity. - :paramtype identifier: str - :keyword column_name: the column name to be mapped to the identifier. - :paramtype column_name: str + :keyword start_time: Insight query start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Insight query end time. + :paramtype end_time: ~datetime.datetime """ super().__init__(**kwargs) - self.identifier = identifier - self.column_name = column_name + self.start_time = start_time + self.end_time = end_time -class FileEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a file entity. +class EntityList(_serialization.Model): + """List of all the entities. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar directory: The full path to the file. - :vartype directory: str - :ivar file_hash_entity_ids: The file hash entity identifiers associated with this file. - :vartype file_hash_entity_ids: list[str] - :ivar file_name: The file name without path (some alerts might not include path). - :vartype file_name: str - :ivar host_entity_id: The Host entity id which the file belongs to. - :vartype host_entity_id: str + :ivar next_link: URL to fetch the next set of entities. + :vartype next_link: str + :ivar value: Array of entities. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Entity] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "directory": {"readonly": True}, - "file_hash_entity_ids": {"readonly": True}, - "file_name": {"readonly": True}, - "host_entity_id": {"readonly": True}, + "next_link": {"readonly": True}, + "value": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "directory": {"key": "properties.directory", "type": "str"}, - "file_hash_entity_ids": {"key": "properties.fileHashEntityIds", "type": "[str]"}, - "file_name": {"key": "properties.fileName", "type": "str"}, - "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Entity]"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, value: List["_models.Entity"], **kwargs: Any) -> None: + """ + :keyword value: Array of entities. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Entity] + """ super().__init__(**kwargs) - self.kind: str = "File" - self.additional_data = None - self.friendly_name = None - self.directory = None - self.file_hash_entity_ids = None - self.file_name = None - self.host_entity_id = None - + self.next_link = None + self.value = value -class FileEntityProperties(EntityCommonProperties): - """File entity property bag. - Variables are only populated by the server, and will be ignored when sending a request. +class EntityManualTriggerRequestBody(_serialization.Model): + """Describes the request body for triggering a playbook on an entity. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar directory: The full path to the file. - :vartype directory: str - :ivar file_hash_entity_ids: The file hash entity identifiers associated with this file. - :vartype file_hash_entity_ids: list[str] - :ivar file_name: The file name without path (some alerts might not include path). - :vartype file_name: str - :ivar host_entity_id: The Host entity id which the file belongs to. - :vartype host_entity_id: str + All required parameters must be populated in order to send to Azure. + + :ivar incident_arm_id: Incident ARM id. + :vartype incident_arm_id: str + :ivar tenant_id: The tenant id of the playbook resource. + :vartype tenant_id: str + :ivar logic_apps_resource_id: The resource id of the playbook resource. Required. + :vartype logic_apps_resource_id: str """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "directory": {"readonly": True}, - "file_hash_entity_ids": {"readonly": True}, - "file_name": {"readonly": True}, - "host_entity_id": {"readonly": True}, + "logic_apps_resource_id": {"required": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "directory": {"key": "directory", "type": "str"}, - "file_hash_entity_ids": {"key": "fileHashEntityIds", "type": "[str]"}, - "file_name": {"key": "fileName", "type": "str"}, - "host_entity_id": {"key": "hostEntityId", "type": "str"}, + "incident_arm_id": {"key": "incidentArmId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "logic_apps_resource_id": {"key": "logicAppsResourceId", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + logic_apps_resource_id: str, + incident_arm_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword incident_arm_id: Incident ARM id. + :paramtype incident_arm_id: str + :keyword tenant_id: The tenant id of the playbook resource. + :paramtype tenant_id: str + :keyword logic_apps_resource_id: The resource id of the playbook resource. Required. + :paramtype logic_apps_resource_id: str + """ super().__init__(**kwargs) - self.directory = None - self.file_hash_entity_ids = None - self.file_name = None - self.host_entity_id = None + self.incident_arm_id = incident_arm_id + self.tenant_id = tenant_id + self.logic_apps_resource_id = logic_apps_resource_id -class FileHashEntity(Entity): - """Represents a file hash entity. +class EntityMapping(_serialization.Model): + """Single entity mapping for the alert rule. + + :ivar entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", "IP", + "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", + "MailMessage", and "SubmissionMail". + :vartype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType + :ivar field_mappings: array of field mappings for the given entity mapping. + :vartype field_mappings: list[~azure.mgmt.securityinsight.models.FieldMapping] + """ + + _attribute_map = { + "entity_type": {"key": "entityType", "type": "str"}, + "field_mappings": {"key": "fieldMappings", "type": "[FieldMapping]"}, + } + + def __init__( + self, + *, + entity_type: Optional[Union[str, "_models.EntityMappingType"]] = None, + field_mappings: Optional[List["_models.FieldMapping"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", + "IP", "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", + "MailMessage", and "SubmissionMail". + :paramtype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType + :keyword field_mappings: array of field mappings for the given entity mapping. + :paramtype field_mappings: list[~azure.mgmt.securityinsight.models.FieldMapping] + """ + super().__init__(**kwargs) + self.entity_type = entity_type + self.field_mappings = field_mappings + + +class EntityQueryItem(_serialization.Model): + """An abstract Query item for entity. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + InsightQueryItem 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}. + :ivar id: Query Template ARM ID. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Query Template ARM Name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: ARM Type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", - and "SHA256AC". - :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm - :ivar hash_value: The file hash value. - :vartype hash_value: str + :ivar kind: The kind of the entity query. Required. Known values are: "Expansion", "Insight", + and "Activity". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind """ _validation = { "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "algorithm": {"readonly": True}, - "hash_value": {"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"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "algorithm": {"key": "properties.algorithm", "type": "str"}, - "hash_value": {"key": "properties.hashValue", "type": "str"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.kind: str = "FileHash" - self.additional_data = None - self.friendly_name = None - self.algorithm = None - self.hash_value = None + _subtype_map = {"kind": {"Insight": "InsightQueryItem"}} + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Query Template ARM Name. + :paramtype name: str + :keyword type: ARM Type. + :paramtype type: str + """ + super().__init__(**kwargs) + self.id = None + self.name = name + self.type = type + self.kind: Optional[str] = None -class FileHashEntityProperties(EntityCommonProperties): - """FileHash entity property bag. - Variables are only populated by the server, and will be ignored when sending a request. +class EntityQueryItemProperties(_serialization.Model): + """An properties abstract Query item for entity. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", - and "SHA256AC". - :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm - :ivar hash_value: The file hash value. - :vartype hash_value: str + :ivar data_types: Data types for template. + :vartype data_types: + list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] + :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", + "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :ivar required_input_fields_sets: Data types for template. + :vartype required_input_fields_sets: list[list[str]] + :ivar entities_filter: The query applied only to entities matching to all filters. + :vartype entities_filter: JSON """ - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "algorithm": {"readonly": True}, - "hash_value": {"readonly": True}, + _attribute_map = { + "data_types": {"key": "dataTypes", "type": "[EntityQueryItemPropertiesDataTypesItem]"}, + "input_entity_type": {"key": "inputEntityType", "type": "str"}, + "required_input_fields_sets": {"key": "requiredInputFieldsSets", "type": "[[str]]"}, + "entities_filter": {"key": "entitiesFilter", "type": "object"}, } + def __init__( + self, + *, + data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, + required_input_fields_sets: Optional[List[List[str]]] = None, + entities_filter: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_types: Data types for template. + :paramtype data_types: + list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] + :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", + "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :keyword required_input_fields_sets: Data types for template. + :paramtype required_input_fields_sets: list[list[str]] + :keyword entities_filter: The query applied only to entities matching to all filters. + :paramtype entities_filter: JSON + """ + super().__init__(**kwargs) + self.data_types = data_types + self.input_entity_type = input_entity_type + self.required_input_fields_sets = required_input_fields_sets + self.entities_filter = entities_filter + + +class EntityQueryItemPropertiesDataTypesItem(_serialization.Model): + """EntityQueryItemPropertiesDataTypesItem. + + :ivar data_type: Data type name. + :vartype data_type: str + """ + _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "algorithm": {"key": "algorithm", "type": "str"}, - "hash_value": {"key": "hashValue", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, data_type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword data_type: Data type name. + :paramtype data_type: str + """ super().__init__(**kwargs) - self.algorithm = None - self.hash_value = None + self.data_type = data_type -class FileImport(Resource): # pylint: disable=too-many-instance-attributes - """Represents a file import in Azure Security Insights. +class EntityQueryList(_serialization.Model): + """List of all the entity queries. 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.securityinsight.models.SystemData - :ivar ingestion_mode: Describes how to ingest the records in the file. Known values are: - "IngestOnlyIfAllAreValid", "IngestAnyValidRecords", and "Unspecified". - :vartype ingestion_mode: str or ~azure.mgmt.securityinsight.models.IngestionMode - :ivar content_type: The content type of this file. Known values are: "BasicIndicator", - "StixIndicator", and "Unspecified". - :vartype content_type: str or ~azure.mgmt.securityinsight.models.FileImportContentType - :ivar created_time_utc: The time the file was imported. - :vartype created_time_utc: ~datetime.datetime - :ivar error_file: Represents the error file (if the import was ingested with errors or failed - the validation). - :vartype error_file: ~azure.mgmt.securityinsight.models.FileMetadata - :ivar errors_preview: An ordered list of some of the errors that were encountered during - validation. - :vartype errors_preview: list[~azure.mgmt.securityinsight.models.ValidationError] - :ivar import_file: Represents the imported file. - :vartype import_file: ~azure.mgmt.securityinsight.models.FileMetadata - :ivar ingested_record_count: The number of records that have been successfully ingested. - :vartype ingested_record_count: int - :ivar source: The source for the data in the file. - :vartype source: str - :ivar state: The state of the file import. Known values are: "FatalError", "Ingested", - "IngestedWithErrors", "InProgress", "Invalid", "WaitingForUpload", and "Unspecified". - :vartype state: str or ~azure.mgmt.securityinsight.models.FileImportState - :ivar total_record_count: The number of records in the file. - :vartype total_record_count: int - :ivar valid_record_count: The number of records that have passed validation. - :vartype valid_record_count: int - :ivar files_valid_until_time_utc: The time the files associated with this import are deleted - from the storage account. - :vartype files_valid_until_time_utc: ~datetime.datetime - :ivar import_valid_until_time_utc: The time the file import record is soft deleted from the - database and history. - :vartype import_valid_until_time_utc: ~datetime.datetime + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of entity queries. + :vartype next_link: str + :ivar value: Array of entity queries. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.EntityQuery] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_time_utc": {"readonly": True}, - "error_file": {"readonly": True}, - "errors_preview": {"readonly": True}, - "ingested_record_count": {"readonly": True}, - "state": {"readonly": True}, - "total_record_count": {"readonly": True}, - "valid_record_count": {"readonly": True}, - "files_valid_until_time_utc": {"readonly": True}, - "import_valid_until_time_utc": {"readonly": True}, + "next_link": {"readonly": True}, + "value": {"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"}, - "ingestion_mode": {"key": "properties.ingestionMode", "type": "str"}, - "content_type": {"key": "properties.contentType", "type": "str"}, - "created_time_utc": {"key": "properties.createdTimeUTC", "type": "iso-8601"}, - "error_file": {"key": "properties.errorFile", "type": "FileMetadata"}, - "errors_preview": {"key": "properties.errorsPreview", "type": "[ValidationError]"}, - "import_file": {"key": "properties.importFile", "type": "FileMetadata"}, - "ingested_record_count": {"key": "properties.ingestedRecordCount", "type": "int"}, - "source": {"key": "properties.source", "type": "str"}, - "state": {"key": "properties.state", "type": "str"}, - "total_record_count": {"key": "properties.totalRecordCount", "type": "int"}, - "valid_record_count": {"key": "properties.validRecordCount", "type": "int"}, - "files_valid_until_time_utc": {"key": "properties.filesValidUntilTimeUTC", "type": "iso-8601"}, - "import_valid_until_time_utc": {"key": "properties.importValidUntilTimeUTC", "type": "iso-8601"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EntityQuery]"}, } - def __init__( - self, - *, - ingestion_mode: Optional[Union[str, "_models.IngestionMode"]] = None, - content_type: Optional[Union[str, "_models.FileImportContentType"]] = None, - import_file: Optional["_models.FileMetadata"] = None, - source: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: List["_models.EntityQuery"], **kwargs: Any) -> None: """ - :keyword ingestion_mode: Describes how to ingest the records in the file. Known values are: - "IngestOnlyIfAllAreValid", "IngestAnyValidRecords", and "Unspecified". - :paramtype ingestion_mode: str or ~azure.mgmt.securityinsight.models.IngestionMode - :keyword content_type: The content type of this file. Known values are: "BasicIndicator", - "StixIndicator", and "Unspecified". - :paramtype content_type: str or ~azure.mgmt.securityinsight.models.FileImportContentType - :keyword import_file: Represents the imported file. - :paramtype import_file: ~azure.mgmt.securityinsight.models.FileMetadata - :keyword source: The source for the data in the file. - :paramtype source: str + :keyword value: Array of entity queries. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQuery] """ super().__init__(**kwargs) - self.ingestion_mode = ingestion_mode - self.content_type = content_type - self.created_time_utc = None - self.error_file = None - self.errors_preview = None - self.import_file = import_file - self.ingested_record_count = None - self.source = source - self.state = None - self.total_record_count = None - self.valid_record_count = None - self.files_valid_until_time_utc = None - self.import_valid_until_time_utc = None + self.next_link = None + self.value = value -class FileImportList(_serialization.Model): - """List all the file imports. +class EntityQueryTemplateList(_serialization.Model): + """List of all the entity query templates. 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 next_link: URL to fetch the next set of file imports. + :ivar next_link: URL to fetch the next set of entity query templates. :vartype next_link: str - :ivar value: Array of file imports. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.FileImport] + :ivar value: Array of entity query templates. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.EntityQueryTemplate] """ _validation = { @@ -8676,199 +8788,262 @@ class FileImportList(_serialization.Model): _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[FileImport]"}, + "value": {"key": "value", "type": "[EntityQueryTemplate]"}, } - def __init__(self, *, value: List["_models.FileImport"], **kwargs): + def __init__(self, *, value: List["_models.EntityQueryTemplate"], **kwargs: Any) -> None: """ - :keyword value: Array of file imports. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.FileImport] + :keyword value: Array of entity query templates. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQueryTemplate] """ super().__init__(**kwargs) self.next_link = None self.value = value -class FileMetadata(_serialization.Model): - """Represents a file. +class EntityTimelineParameters(_serialization.Model): + """The parameters required to execute s timeline operation on the given entity. - 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 file_format: The format of the file. Known values are: "CSV", "JSON", and "Unspecified". - :vartype file_format: str or ~azure.mgmt.securityinsight.models.FileFormat - :ivar file_name: The name of the file. - :vartype file_name: str - :ivar file_size: The size of the file. - :vartype file_size: int - :ivar file_content_uri: A URI with a valid SAS token to allow uploading / downloading the file. - :vartype file_content_uri: str - :ivar delete_status: Indicates whether the file was deleted from the storage account. Known - values are: "Deleted", "NotDeleted", and "Unspecified". - :vartype delete_status: str or ~azure.mgmt.securityinsight.models.DeleteStatus + :ivar kinds: Array of timeline Item kinds. + :vartype kinds: list[str or ~azure.mgmt.securityinsight.models.EntityTimelineKind] + :ivar start_time: The start timeline date, so the results returned are after this date. + Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end timeline date, so the results returned are before this date. Required. + :vartype end_time: ~datetime.datetime + :ivar number_of_bucket: The number of bucket for timeline queries aggregation. + :vartype number_of_bucket: int """ _validation = { - "file_content_uri": {"readonly": True}, - "delete_status": {"readonly": True}, + "start_time": {"required": True}, + "end_time": {"required": True}, } _attribute_map = { - "file_format": {"key": "fileFormat", "type": "str"}, - "file_name": {"key": "fileName", "type": "str"}, - "file_size": {"key": "fileSize", "type": "int"}, - "file_content_uri": {"key": "fileContentUri", "type": "str"}, - "delete_status": {"key": "deleteStatus", "type": "str"}, + "kinds": {"key": "kinds", "type": "[str]"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "number_of_bucket": {"key": "numberOfBucket", "type": "int"}, } def __init__( self, *, - file_format: Optional[Union[str, "_models.FileFormat"]] = None, - file_name: Optional[str] = None, - file_size: Optional[int] = None, - **kwargs - ): + start_time: datetime.datetime, + end_time: datetime.datetime, + kinds: Optional[List[Union[str, "_models.EntityTimelineKind"]]] = None, + number_of_bucket: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword file_format: The format of the file. Known values are: "CSV", "JSON", and - "Unspecified". - :paramtype file_format: str or ~azure.mgmt.securityinsight.models.FileFormat - :keyword file_name: The name of the file. - :paramtype file_name: str - :keyword file_size: The size of the file. - :paramtype file_size: int + :keyword kinds: Array of timeline Item kinds. + :paramtype kinds: list[str or ~azure.mgmt.securityinsight.models.EntityTimelineKind] + :keyword start_time: The start timeline date, so the results returned are after this date. + Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end timeline date, so the results returned are before this date. + Required. + :paramtype end_time: ~datetime.datetime + :keyword number_of_bucket: The number of bucket for timeline queries aggregation. + :paramtype number_of_bucket: int """ super().__init__(**kwargs) - self.file_format = file_format - self.file_name = file_name - self.file_size = file_size - self.file_content_uri = None - self.delete_status = None + self.kinds = kinds + self.start_time = start_time + self.end_time = end_time + self.number_of_bucket = number_of_bucket -class FusionAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes - """Represents Fusion alert rule. +class EntityTimelineResponse(_serialization.Model): + """The entity timeline result operation response. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar meta_data: The metadata from the timeline operation results. + :vartype meta_data: ~azure.mgmt.securityinsight.models.TimelineResultsMetadata + :ivar value: The timeline result values. + :vartype value: list[~azure.mgmt.securityinsight.models.EntityTimelineItem] + """ + + _attribute_map = { + "meta_data": {"key": "metaData", "type": "TimelineResultsMetadata"}, + "value": {"key": "value", "type": "[EntityTimelineItem]"}, + } + + def __init__( + self, + *, + meta_data: Optional["_models.TimelineResultsMetadata"] = None, + value: Optional[List["_models.EntityTimelineItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword meta_data: The metadata from the timeline operation results. + :paramtype meta_data: ~azure.mgmt.securityinsight.models.TimelineResultsMetadata + :keyword value: The timeline result values. + :paramtype value: list[~azure.mgmt.securityinsight.models.EntityTimelineItem] + """ + super().__init__(**kwargs) + self.meta_data = meta_data + self.value = value + + +class Error(_serialization.Model): + """The error description for why a publication failed. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. - :vartype alert_rule_template_name: str - :ivar description: The description of the alert rule. - :vartype description: str - :ivar display_name: The display name for alerts created by this alert rule. - :vartype display_name: str - :ivar enabled: Determines whether this alert rule is enabled or disabled. - :vartype enabled: bool - :ivar source_settings: Configuration for all supported source signals in fusion detection. - :vartype source_settings: list[~azure.mgmt.securityinsight.models.FusionSourceSettings] - :ivar scenario_exclusion_patterns: Configuration to exclude scenarios in fusion detection. - :vartype scenario_exclusion_patterns: - list[~azure.mgmt.securityinsight.models.FusionScenarioExclusionPattern] - :ivar last_modified_utc: The last time that this alert has been modified. - :vartype last_modified_utc: ~datetime.datetime - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] + :ivar member_resource_name: The member resource name for which the publication error occured. + Required. + :vartype member_resource_name: str + :ivar error_message: The error message. Required. + :vartype error_message: str + """ + + _validation = { + "member_resource_name": {"required": True}, + "error_message": {"required": True}, + } + + _attribute_map = { + "member_resource_name": {"key": "memberResourceName", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + } + + def __init__(self, *, member_resource_name: str, error_message: str, **kwargs: Any) -> None: + """ + :keyword member_resource_name: The member resource name for which the publication error + occured. Required. + :paramtype member_resource_name: str + :keyword error_message: The error message. Required. + :paramtype error_message: str + """ + super().__init__(**kwargs) + self.member_resource_name = member_resource_name + self.error_message = error_message + + +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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "description": {"readonly": True}, - "display_name": {"readonly": True}, - "last_modified_utc": {"readonly": True}, - "severity": {"readonly": True}, - "tactics": {"readonly": True}, - "techniques": {"readonly": True}, + "info": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "source_settings": {"key": "properties.sourceSettings", "type": "[FusionSourceSettings]"}, - "scenario_exclusion_patterns": { - "key": "properties.scenarioExclusionPatterns", - "type": "[FusionScenarioExclusionPattern]", - }, - "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, - "severity": {"key": "properties.severity", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "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.securityinsight.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.securityinsight.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.securityinsight.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.securityinsight.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class EventGroupingSettings(_serialization.Model): + """Event grouping settings property bag. + + :ivar aggregation_kind: The event grouping aggregation kinds. Known values are: "SingleAlert" + and "AlertPerResult". + :vartype aggregation_kind: str or + ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind + """ + + _attribute_map = { + "aggregation_kind": {"key": "aggregationKind", "type": "str"}, } def __init__( - self, - *, - etag: Optional[str] = None, - alert_rule_template_name: Optional[str] = None, - enabled: Optional[bool] = None, - source_settings: Optional[List["_models.FusionSourceSettings"]] = None, - scenario_exclusion_patterns: Optional[List["_models.FusionScenarioExclusionPattern"]] = None, - **kwargs - ): + self, *, aggregation_kind: Optional[Union[str, "_models.EventGroupingAggregationKind"]] = None, **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword alert_rule_template_name: The Name of the alert rule template used to create this - rule. - :paramtype alert_rule_template_name: str - :keyword enabled: Determines whether this alert rule is enabled or disabled. - :paramtype enabled: bool - :keyword source_settings: Configuration for all supported source signals in fusion detection. - :paramtype source_settings: list[~azure.mgmt.securityinsight.models.FusionSourceSettings] - :keyword scenario_exclusion_patterns: Configuration to exclude scenarios in fusion detection. - :paramtype scenario_exclusion_patterns: - list[~azure.mgmt.securityinsight.models.FusionScenarioExclusionPattern] + :keyword aggregation_kind: The event grouping aggregation kinds. Known values are: + "SingleAlert" and "AlertPerResult". + :paramtype aggregation_kind: str or + ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "Fusion" - self.alert_rule_template_name = alert_rule_template_name - self.description = None - self.display_name = None - self.enabled = enabled - self.source_settings = source_settings - self.scenario_exclusion_patterns = scenario_exclusion_patterns - self.last_modified_utc = None - self.severity = None - self.tactics = None - self.techniques = None + super().__init__(**kwargs) + self.aggregation_kind = aggregation_kind -class FusionAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes - """Represents Fusion alert rule template. +class ExpansionEntityQuery(EntityQuery): # pylint: disable=too-many-instance-attributes + """Represents Expansion entity query. Variables are only populated by the server, and will be ignored when sending a request. @@ -8885,36 +9060,27 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-in :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar last_updated_date_utc: The time that this alert rule template was last updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: the entity query kind. Required. Known values are: "Expansion", "Insight", and + "Activity". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind + :ivar data_sources: List of the data sources that are required to run the query. + :vartype data_sources: list[str] + :ivar display_name: The query display name. :vartype display_name: str - :ivar required_data_connectors: The required data connectors for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar tactics: The tactics of the alert rule template. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] - :ivar source_settings: All supported source signal configurations consumed in fusion detection. - :vartype source_settings: list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSetting] + :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", + and "Nic". + :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :ivar input_fields: List of the fields of the source entity that are required to run the query. + :vartype input_fields: list[str] + :ivar output_entity_types: List of the desired output types to be constructed from the result. + :vartype output_entity_types: list[str or ~azure.mgmt.securityinsight.models.EntityType] + :ivar query_template: The template query string to be parsed and formatted. + :vartype query_template: str """ _validation = { @@ -8923,8 +9089,6 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-in "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "created_date_utc": {"readonly": True}, - "last_updated_date_utc": {"readonly": True}, } _attribute_map = { @@ -8932,693 +9096,678 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-in "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, - "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, - "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, + "data_sources": {"key": "properties.dataSources", "type": "[str]"}, "display_name": {"key": "properties.displayName", "type": "str"}, - "required_data_connectors": { - "key": "properties.requiredDataConnectors", - "type": "[AlertRuleTemplateDataSource]", - }, - "status": {"key": "properties.status", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "type": "[str]"}, - "source_settings": {"key": "properties.sourceSettings", "type": "[FusionTemplateSourceSetting]"}, + "input_entity_type": {"key": "properties.inputEntityType", "type": "str"}, + "input_fields": {"key": "properties.inputFields", "type": "[str]"}, + "output_entity_types": {"key": "properties.outputEntityTypes", "type": "[str]"}, + "query_template": {"key": "properties.queryTemplate", "type": "str"}, } def __init__( self, *, - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, + etag: Optional[str] = None, + data_sources: Optional[List[str]] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, - techniques: Optional[List[str]] = None, - source_settings: Optional[List["_models.FusionTemplateSourceSetting"]] = None, - **kwargs - ): + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, + input_fields: Optional[List[str]] = None, + output_entity_types: Optional[List[Union[str, "_models.EntityType"]]] = None, + query_template: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword data_sources: List of the data sources that are required to run the query. + :paramtype data_sources: list[str] + :keyword display_name: The query display name. :paramtype display_name: str - :keyword required_data_connectors: The required data connectors for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword tactics: The tactics of the alert rule template. - :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :keyword techniques: The techniques of the alert rule. - :paramtype techniques: list[str] - :keyword source_settings: All supported source signal configurations consumed in fusion - detection. - :paramtype source_settings: - list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSetting] + :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", + and "Nic". + :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :keyword input_fields: List of the fields of the source entity that are required to run the + query. + :paramtype input_fields: list[str] + :keyword output_entity_types: List of the desired output types to be constructed from the + result. + :paramtype output_entity_types: list[str or ~azure.mgmt.securityinsight.models.EntityType] + :keyword query_template: The template query string to be parsed and formatted. + :paramtype query_template: str """ - super().__init__(**kwargs) - self.kind: str = "Fusion" - self.alert_rules_created_by_template_count = alert_rules_created_by_template_count - self.created_date_utc = None - self.last_updated_date_utc = None - self.description = description + super().__init__(etag=etag, **kwargs) + self.kind: str = "Expansion" + self.data_sources = data_sources self.display_name = display_name - self.required_data_connectors = required_data_connectors - self.status = status - self.severity = severity - self.tactics = tactics - self.techniques = techniques - self.source_settings = source_settings + self.input_entity_type = input_entity_type + self.input_fields = input_fields + self.output_entity_types = output_entity_types + self.query_template = query_template -class FusionScenarioExclusionPattern(_serialization.Model): - """Represents a Fusion scenario exclusion patterns in Fusion detection. +class ExpansionResultAggregation(_serialization.Model): + """Information of a specific aggregation in the expansion result. All required parameters must be populated in order to send to Azure. - :ivar exclusion_pattern: Scenario exclusion pattern. Required. - :vartype exclusion_pattern: str - :ivar date_added_in_utc: DateTime when scenario exclusion pattern is added in UTC. Required. - :vartype date_added_in_utc: str + :ivar aggregation_type: The common type of the aggregation. (for e.g. entity field name). + :vartype aggregation_type: str + :ivar count: Total number of aggregations of the given kind (and aggregationType if given) in + the expansion result. Required. + :vartype count: int + :ivar display_name: The display name of the aggregation by type. + :vartype display_name: str + :ivar entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and + "Nic". + :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum """ _validation = { - "exclusion_pattern": {"required": True}, - "date_added_in_utc": {"required": True}, + "count": {"required": True}, + "entity_kind": {"required": True}, } _attribute_map = { - "exclusion_pattern": {"key": "exclusionPattern", "type": "str"}, - "date_added_in_utc": {"key": "dateAddedInUTC", "type": "str"}, + "aggregation_type": {"key": "aggregationType", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "display_name": {"key": "displayName", "type": "str"}, + "entity_kind": {"key": "entityKind", "type": "str"}, } - def __init__(self, *, exclusion_pattern: str, date_added_in_utc: str, **kwargs): + def __init__( + self, + *, + count: int, + entity_kind: Union[str, "_models.EntityKindEnum"], + aggregation_type: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword exclusion_pattern: Scenario exclusion pattern. Required. - :paramtype exclusion_pattern: str - :keyword date_added_in_utc: DateTime when scenario exclusion pattern is added in UTC. Required. - :paramtype date_added_in_utc: str + :keyword aggregation_type: The common type of the aggregation. (for e.g. entity field name). + :paramtype aggregation_type: str + :keyword count: Total number of aggregations of the given kind (and aggregationType if given) + in the expansion result. Required. + :paramtype count: int + :keyword display_name: The display name of the aggregation by type. + :paramtype display_name: str + :keyword entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and + "Nic". + :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum """ super().__init__(**kwargs) - self.exclusion_pattern = exclusion_pattern - self.date_added_in_utc = date_added_in_utc - + self.aggregation_type = aggregation_type + self.count = count + self.display_name = display_name + self.entity_kind = entity_kind -class FusionSourceSettings(_serialization.Model): - """Represents a supported source signal configuration in Fusion detection. - All required parameters must be populated in order to send to Azure. +class ExpansionResultsMetadata(_serialization.Model): + """Expansion result metadata. - :ivar enabled: Determines whether this source signal is enabled or disabled in Fusion - detection. Required. - :vartype enabled: bool - :ivar source_name: Name of the Fusion source signal. Refer to Fusion alert rule template for - supported values. Required. - :vartype source_name: str - :ivar source_sub_types: Configuration for all source subtypes under this source signal consumed - in fusion detection. - :vartype source_sub_types: list[~azure.mgmt.securityinsight.models.FusionSourceSubTypeSetting] + :ivar aggregations: Information of the aggregated nodes in the expansion result. + :vartype aggregations: list[~azure.mgmt.securityinsight.models.ExpansionResultAggregation] """ - _validation = { - "enabled": {"required": True}, - "source_name": {"required": True}, - } - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "source_name": {"key": "sourceName", "type": "str"}, - "source_sub_types": {"key": "sourceSubTypes", "type": "[FusionSourceSubTypeSetting]"}, + "aggregations": {"key": "aggregations", "type": "[ExpansionResultAggregation]"}, } def __init__( - self, - *, - enabled: bool, - source_name: str, - source_sub_types: Optional[List["_models.FusionSourceSubTypeSetting"]] = None, - **kwargs - ): + self, *, aggregations: Optional[List["_models.ExpansionResultAggregation"]] = None, **kwargs: Any + ) -> None: """ - :keyword enabled: Determines whether this source signal is enabled or disabled in Fusion - detection. Required. - :paramtype enabled: bool - :keyword source_name: Name of the Fusion source signal. Refer to Fusion alert rule template for - supported values. Required. - :paramtype source_name: str - :keyword source_sub_types: Configuration for all source subtypes under this source signal - consumed in fusion detection. - :paramtype source_sub_types: - list[~azure.mgmt.securityinsight.models.FusionSourceSubTypeSetting] + :keyword aggregations: Information of the aggregated nodes in the expansion result. + :paramtype aggregations: list[~azure.mgmt.securityinsight.models.ExpansionResultAggregation] """ super().__init__(**kwargs) - self.enabled = enabled - self.source_name = source_name - self.source_sub_types = source_sub_types + self.aggregations = aggregations -class FusionSourceSubTypeSetting(_serialization.Model): - """Represents a supported source subtype configuration under a source signal in Fusion detection. +class EyesOn(Settings): + """Settings with single toggle. 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 enabled: Determines whether this source subtype under source signal is enabled or - disabled in Fusion detection. Required. - :vartype enabled: bool - :ivar source_sub_type_name: The Name of the source subtype under a given source signal in - Fusion detection. Refer to Fusion alert rule template for supported values. Required. - :vartype source_sub_type_name: str - :ivar source_sub_type_display_name: The display name of source subtype under a source signal - consumed in Fusion detection. - :vartype source_sub_type_display_name: str - :ivar severity_filters: Severity configuration for a source subtype consumed in fusion - detection. Required. - :vartype severity_filters: ~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFilter + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", + "EntityAnalytics", and "Ueba". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar is_enabled: Determines whether the setting is enable or disabled. + :vartype is_enabled: bool """ _validation = { - "enabled": {"required": True}, - "source_sub_type_name": {"required": True}, - "source_sub_type_display_name": {"readonly": True}, - "severity_filters": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "is_enabled": {"readonly": True}, } _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "source_sub_type_name": {"key": "sourceSubTypeName", "type": "str"}, - "source_sub_type_display_name": {"key": "sourceSubTypeDisplayName", "type": "str"}, - "severity_filters": {"key": "severityFilters", "type": "FusionSubTypeSeverityFilter"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: bool, - source_sub_type_name: str, - severity_filters: "_models.FusionSubTypeSeverityFilter", - **kwargs - ): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword enabled: Determines whether this source subtype under source signal is enabled or - disabled in Fusion detection. Required. - :paramtype enabled: bool - :keyword source_sub_type_name: The Name of the source subtype under a given source signal in - Fusion detection. Refer to Fusion alert rule template for supported values. Required. - :paramtype source_sub_type_name: str - :keyword severity_filters: Severity configuration for a source subtype consumed in fusion - detection. Required. - :paramtype severity_filters: ~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFilter + :keyword etag: Etag of the azure resource. + :paramtype etag: str """ - super().__init__(**kwargs) - self.enabled = enabled - self.source_sub_type_name = source_sub_type_name - self.source_sub_type_display_name = None - self.severity_filters = severity_filters - + super().__init__(etag=etag, **kwargs) + self.kind: str = "EyesOn" + self.is_enabled = None -class FusionSubTypeSeverityFilter(_serialization.Model): - """Represents severity configuration for a source subtype consumed in Fusion detection. - Variables are only populated by the server, and will be ignored when sending a request. +class FieldMapping(_serialization.Model): + """A single field mapping of the mapped entity. - :ivar is_supported: Determines whether this source subtype supports severity configuration or - not. - :vartype is_supported: bool - :ivar filters: Individual Severity configuration settings for a given source subtype consumed - in Fusion detection. - :vartype filters: list[~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFiltersItem] + :ivar identifier: the V3 identifier of the entity. + :vartype identifier: str + :ivar column_name: the column name to be mapped to the identifier. + :vartype column_name: str """ - _validation = { - "is_supported": {"readonly": True}, - } - _attribute_map = { - "is_supported": {"key": "isSupported", "type": "bool"}, - "filters": {"key": "filters", "type": "[FusionSubTypeSeverityFiltersItem]"}, + "identifier": {"key": "identifier", "type": "str"}, + "column_name": {"key": "columnName", "type": "str"}, } - def __init__(self, *, filters: Optional[List["_models.FusionSubTypeSeverityFiltersItem"]] = None, **kwargs): + def __init__(self, *, identifier: Optional[str] = None, column_name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword filters: Individual Severity configuration settings for a given source subtype - consumed in Fusion detection. - :paramtype filters: list[~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFiltersItem] + :keyword identifier: the V3 identifier of the entity. + :paramtype identifier: str + :keyword column_name: the column name to be mapped to the identifier. + :paramtype column_name: str """ super().__init__(**kwargs) - self.is_supported = None - self.filters = filters + self.identifier = identifier + self.column_name = column_name -class FusionSubTypeSeverityFiltersItem(_serialization.Model): - """Represents a Severity filter setting for a given source subtype consumed in Fusion detection. +class FileEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a file entity. + + 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 severity: The Severity for a given source subtype consumed in Fusion detection. Required. - Known values are: "High", "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar enabled: Determines whether this severity is enabled or disabled for this source subtype - consumed in Fusion detection. Required. - :vartype enabled: bool + :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.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar directory: The full path to the file. + :vartype directory: str + :ivar file_hash_entity_ids: The file hash entity identifiers associated with this file. + :vartype file_hash_entity_ids: list[str] + :ivar file_name: The file name without path (some alerts might not include path). + :vartype file_name: str + :ivar host_entity_id: The Host entity id which the file belongs to. + :vartype host_entity_id: str """ _validation = { - "severity": {"required": True}, - "enabled": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "directory": {"readonly": True}, + "file_hash_entity_ids": {"readonly": True}, + "file_name": {"readonly": True}, + "host_entity_id": {"readonly": True}, } _attribute_map = { - "severity": {"key": "severity", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "directory": {"key": "properties.directory", "type": "str"}, + "file_hash_entity_ids": {"key": "properties.fileHashEntityIds", "type": "[str]"}, + "file_name": {"key": "properties.fileName", "type": "str"}, + "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, } - def __init__(self, *, severity: Union[str, "_models.AlertSeverity"], enabled: bool, **kwargs): - """ - :keyword severity: The Severity for a given source subtype consumed in Fusion detection. - Required. Known values are: "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword enabled: Determines whether this severity is enabled or disabled for this source - subtype consumed in Fusion detection. Required. - :paramtype enabled: bool - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.severity = severity - self.enabled = enabled + self.kind: str = "File" + self.additional_data = None + self.friendly_name = None + self.directory = None + self.file_hash_entity_ids = None + self.file_name = None + self.host_entity_id = None -class FusionTemplateSourceSetting(_serialization.Model): - """Represents a source signal consumed in Fusion detection. +class FileEntityProperties(EntityCommonProperties): + """File entity property bag. - 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 source_name: The name of a source signal consumed in Fusion detection. Required. - :vartype source_name: str - :ivar source_sub_types: All supported source subtypes under this source signal consumed in - fusion detection. - :vartype source_sub_types: list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSubType] + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar directory: The full path to the file. + :vartype directory: str + :ivar file_hash_entity_ids: The file hash entity identifiers associated with this file. + :vartype file_hash_entity_ids: list[str] + :ivar file_name: The file name without path (some alerts might not include path). + :vartype file_name: str + :ivar host_entity_id: The Host entity id which the file belongs to. + :vartype host_entity_id: str """ _validation = { - "source_name": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "directory": {"readonly": True}, + "file_hash_entity_ids": {"readonly": True}, + "file_name": {"readonly": True}, + "host_entity_id": {"readonly": True}, } _attribute_map = { - "source_name": {"key": "sourceName", "type": "str"}, - "source_sub_types": {"key": "sourceSubTypes", "type": "[FusionTemplateSourceSubType]"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "directory": {"key": "directory", "type": "str"}, + "file_hash_entity_ids": {"key": "fileHashEntityIds", "type": "[str]"}, + "file_name": {"key": "fileName", "type": "str"}, + "host_entity_id": {"key": "hostEntityId", "type": "str"}, } - def __init__( - self, - *, - source_name: str, - source_sub_types: Optional[List["_models.FusionTemplateSourceSubType"]] = None, - **kwargs - ): - """ - :keyword source_name: The name of a source signal consumed in Fusion detection. Required. - :paramtype source_name: str - :keyword source_sub_types: All supported source subtypes under this source signal consumed in - fusion detection. - :paramtype source_sub_types: - list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSubType] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.source_name = source_name - self.source_sub_types = source_sub_types + self.directory = None + self.file_hash_entity_ids = None + self.file_name = None + self.host_entity_id = None -class FusionTemplateSourceSubType(_serialization.Model): - """Represents a source subtype under a source signal consumed in Fusion detection. +class FileHashEntity(Entity): + """Represents a file hash entity. 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 source_sub_type_name: The name of source subtype under a source signal consumed in Fusion - detection. Required. - :vartype source_sub_type_name: str - :ivar source_sub_type_display_name: The display name of source subtype under a source signal - consumed in Fusion detection. - :vartype source_sub_type_display_name: str - :ivar severity_filter: Severity configuration available for a source subtype consumed in fusion - detection. Required. - :vartype severity_filter: - ~azure.mgmt.securityinsight.models.FusionTemplateSubTypeSeverityFilter + :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.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", + and "SHA256AC". + :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm + :ivar hash_value: The file hash value. + :vartype hash_value: str """ _validation = { - "source_sub_type_name": {"required": True}, - "source_sub_type_display_name": {"readonly": True}, - "severity_filter": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "algorithm": {"readonly": True}, + "hash_value": {"readonly": True}, } _attribute_map = { - "source_sub_type_name": {"key": "sourceSubTypeName", "type": "str"}, - "source_sub_type_display_name": {"key": "sourceSubTypeDisplayName", "type": "str"}, - "severity_filter": {"key": "severityFilter", "type": "FusionTemplateSubTypeSeverityFilter"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "algorithm": {"key": "properties.algorithm", "type": "str"}, + "hash_value": {"key": "properties.hashValue", "type": "str"}, } - def __init__( - self, *, source_sub_type_name: str, severity_filter: "_models.FusionTemplateSubTypeSeverityFilter", **kwargs - ): - """ - :keyword source_sub_type_name: The name of source subtype under a source signal consumed in - Fusion detection. Required. - :paramtype source_sub_type_name: str - :keyword severity_filter: Severity configuration available for a source subtype consumed in - fusion detection. Required. - :paramtype severity_filter: - ~azure.mgmt.securityinsight.models.FusionTemplateSubTypeSeverityFilter - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.source_sub_type_name = source_sub_type_name - self.source_sub_type_display_name = None - self.severity_filter = severity_filter - - -class FusionTemplateSubTypeSeverityFilter(_serialization.Model): - """Represents severity configurations available for a source subtype consumed in Fusion detection. + self.kind: str = "FileHash" + self.additional_data = None + self.friendly_name = None + self.algorithm = None + self.hash_value = None - All required parameters must be populated in order to send to Azure. - :ivar is_supported: Determines whether severity configuration is supported for this source - subtype consumed in Fusion detection. Required. - :vartype is_supported: bool - :ivar severity_filters: List of all supported severities for this source subtype consumed in - Fusion detection. - :vartype severity_filters: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - """ +class FileHashEntityProperties(EntityCommonProperties): + """FileHash entity property bag. - _validation = { - "is_supported": {"required": True}, - } + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "is_supported": {"key": "isSupported", "type": "bool"}, - "severity_filters": {"key": "severityFilters", "type": "[str]"}, - } - - def __init__( - self, - *, - is_supported: bool, - severity_filters: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - **kwargs - ): - """ - :keyword is_supported: Determines whether severity configuration is supported for this source - subtype consumed in Fusion detection. Required. - :paramtype is_supported: bool - :keyword severity_filters: List of all supported severities for this source subtype consumed in - Fusion detection. - :paramtype severity_filters: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - """ - super().__init__(**kwargs) - self.is_supported = is_supported - self.severity_filters = severity_filters - - -class GeoLocation(_serialization.Model): - """The geo-location context attached to the ip entity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar asn: Autonomous System Number. - :vartype asn: int - :ivar city: City name. - :vartype city: str - :ivar country_code: The country code according to ISO 3166 format. - :vartype country_code: str - :ivar country_name: Country name according to ISO 3166 Alpha 2: the lowercase of the English - Short Name. - :vartype country_name: str - :ivar latitude: The longitude of the identified location, expressed as a floating point number - with range of -180 to 180, with positive numbers representing East and negative numbers - representing West. Latitude and longitude are derived from the city or postal code. - :vartype latitude: float - :ivar longitude: The latitude of the identified location, expressed as a floating point number - with range of - 90 to 90, with positive numbers representing North and negative numbers - representing South. Latitude and longitude are derived from the city or postal code. - :vartype longitude: float - :ivar state: State name. - :vartype state: str + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", + and "SHA256AC". + :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm + :ivar hash_value: The file hash value. + :vartype hash_value: str """ _validation = { - "asn": {"readonly": True}, - "city": {"readonly": True}, - "country_code": {"readonly": True}, - "country_name": {"readonly": True}, - "latitude": {"readonly": True}, - "longitude": {"readonly": True}, - "state": {"readonly": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "algorithm": {"readonly": True}, + "hash_value": {"readonly": True}, } _attribute_map = { - "asn": {"key": "asn", "type": "int"}, - "city": {"key": "city", "type": "str"}, - "country_code": {"key": "countryCode", "type": "str"}, - "country_name": {"key": "countryName", "type": "str"}, - "latitude": {"key": "latitude", "type": "float"}, - "longitude": {"key": "longitude", "type": "float"}, - "state": {"key": "state", "type": "str"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "algorithm": {"key": "algorithm", "type": "str"}, + "hash_value": {"key": "hashValue", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.asn = None - self.city = None - self.country_code = None - self.country_name = None - self.latitude = None - self.longitude = None - self.state = None + self.algorithm = None + self.hash_value = None -class GetInsightsErrorKind(_serialization.Model): - """GetInsights Query Errors. +class FileImport(Resource): # pylint: disable=too-many-instance-attributes + """Represents a file import in Azure Security Insights. - 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 kind: the query kind. Required. "Insight" - :vartype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError - :ivar query_id: the query id. - :vartype query_id: str - :ivar error_message: the error message. Required. - :vartype error_message: str + :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.securityinsight.models.SystemData + :ivar ingestion_mode: Describes how to ingest the records in the file. Known values are: + "IngestOnlyIfAllAreValid", "IngestAnyValidRecords", and "Unspecified". + :vartype ingestion_mode: str or ~azure.mgmt.securityinsight.models.IngestionMode + :ivar content_type: The content type of this file. Known values are: "BasicIndicator", + "StixIndicator", and "Unspecified". + :vartype content_type: str or ~azure.mgmt.securityinsight.models.FileImportContentType + :ivar created_time_utc: The time the file was imported. + :vartype created_time_utc: ~datetime.datetime + :ivar error_file: Represents the error file (if the import was ingested with errors or failed + the validation). + :vartype error_file: ~azure.mgmt.securityinsight.models.FileMetadata + :ivar errors_preview: An ordered list of some of the errors that were encountered during + validation. + :vartype errors_preview: list[~azure.mgmt.securityinsight.models.ValidationError] + :ivar import_file: Represents the imported file. + :vartype import_file: ~azure.mgmt.securityinsight.models.FileMetadata + :ivar ingested_record_count: The number of records that have been successfully ingested. + :vartype ingested_record_count: int + :ivar source: The source for the data in the file. + :vartype source: str + :ivar state: The state of the file import. Known values are: "FatalError", "Ingested", + "IngestedWithErrors", "InProgress", "Invalid", "WaitingForUpload", and "Unspecified". + :vartype state: str or ~azure.mgmt.securityinsight.models.FileImportState + :ivar total_record_count: The number of records in the file. + :vartype total_record_count: int + :ivar valid_record_count: The number of records that have passed validation. + :vartype valid_record_count: int + :ivar files_valid_until_time_utc: The time the files associated with this import are deleted + from the storage account. + :vartype files_valid_until_time_utc: ~datetime.datetime + :ivar import_valid_until_time_utc: The time the file import record is soft deleted from the + database and history. + :vartype import_valid_until_time_utc: ~datetime.datetime """ _validation = { - "kind": {"required": True}, - "error_message": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "created_time_utc": {"readonly": True}, + "error_file": {"readonly": True}, + "errors_preview": {"readonly": True}, + "ingested_record_count": {"readonly": True}, + "state": {"readonly": True}, + "total_record_count": {"readonly": True}, + "valid_record_count": {"readonly": True}, + "files_valid_until_time_utc": {"readonly": True}, + "import_valid_until_time_utc": {"readonly": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "query_id": {"key": "queryId", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "ingestion_mode": {"key": "properties.ingestionMode", "type": "str"}, + "content_type": {"key": "properties.contentType", "type": "str"}, + "created_time_utc": {"key": "properties.createdTimeUTC", "type": "iso-8601"}, + "error_file": {"key": "properties.errorFile", "type": "FileMetadata"}, + "errors_preview": {"key": "properties.errorsPreview", "type": "[ValidationError]"}, + "import_file": {"key": "properties.importFile", "type": "FileMetadata"}, + "ingested_record_count": {"key": "properties.ingestedRecordCount", "type": "int"}, + "source": {"key": "properties.source", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "total_record_count": {"key": "properties.totalRecordCount", "type": "int"}, + "valid_record_count": {"key": "properties.validRecordCount", "type": "int"}, + "files_valid_until_time_utc": {"key": "properties.filesValidUntilTimeUTC", "type": "iso-8601"}, + "import_valid_until_time_utc": {"key": "properties.importValidUntilTimeUTC", "type": "iso-8601"}, } def __init__( self, *, - kind: Union[str, "_models.GetInsightsError"], - error_message: str, - query_id: Optional[str] = None, - **kwargs - ): + ingestion_mode: Optional[Union[str, "_models.IngestionMode"]] = None, + content_type: Optional[Union[str, "_models.FileImportContentType"]] = None, + import_file: Optional["_models.FileMetadata"] = None, + source: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword kind: the query kind. Required. "Insight" - :paramtype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError - :keyword query_id: the query id. - :paramtype query_id: str - :keyword error_message: the error message. Required. - :paramtype error_message: str + :keyword ingestion_mode: Describes how to ingest the records in the file. Known values are: + "IngestOnlyIfAllAreValid", "IngestAnyValidRecords", and "Unspecified". + :paramtype ingestion_mode: str or ~azure.mgmt.securityinsight.models.IngestionMode + :keyword content_type: The content type of this file. Known values are: "BasicIndicator", + "StixIndicator", and "Unspecified". + :paramtype content_type: str or ~azure.mgmt.securityinsight.models.FileImportContentType + :keyword import_file: Represents the imported file. + :paramtype import_file: ~azure.mgmt.securityinsight.models.FileMetadata + :keyword source: The source for the data in the file. + :paramtype source: str """ super().__init__(**kwargs) - self.kind = kind - self.query_id = query_id - self.error_message = error_message + self.ingestion_mode = ingestion_mode + self.content_type = content_type + self.created_time_utc = None + self.error_file = None + self.errors_preview = None + self.import_file = import_file + self.ingested_record_count = None + self.source = source + self.state = None + self.total_record_count = None + self.valid_record_count = None + self.files_valid_until_time_utc = None + self.import_valid_until_time_utc = None -class GetInsightsResultsMetadata(_serialization.Model): - """Get Insights result metadata. +class FileImportList(_serialization.Model): + """List all the file imports. + + 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 total_count: the total items found for the insights request. Required. - :vartype total_count: int - :ivar errors: information about the failed queries. - :vartype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] + :ivar next_link: URL to fetch the next set of file imports. + :vartype next_link: str + :ivar value: Array of file imports. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.FileImport] """ _validation = { - "total_count": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "total_count": {"key": "totalCount", "type": "int"}, - "errors": {"key": "errors", "type": "[GetInsightsErrorKind]"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[FileImport]"}, } - def __init__(self, *, total_count: int, errors: Optional[List["_models.GetInsightsErrorKind"]] = None, **kwargs): + def __init__(self, *, value: List["_models.FileImport"], **kwargs: Any) -> None: """ - :keyword total_count: the total items found for the insights request. Required. - :paramtype total_count: int - :keyword errors: information about the failed queries. - :paramtype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] + :keyword value: Array of file imports. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.FileImport] """ super().__init__(**kwargs) - self.total_count = total_count - self.errors = errors - + self.next_link = None + self.value = value -class GetQueriesResponse(_serialization.Model): - """Retrieve queries for entity result operation response. - :ivar value: The query result values. - :vartype value: list[~azure.mgmt.securityinsight.models.EntityQueryItem] - """ +class FileMetadata(_serialization.Model): + """Represents a file. - _attribute_map = { - "value": {"key": "value", "type": "[EntityQueryItem]"}, - } + Variables are only populated by the server, and will be ignored when sending a request. - def __init__(self, *, value: Optional[List["_models.EntityQueryItem"]] = None, **kwargs): - """ - :keyword value: The query result values. - :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQueryItem] - """ - super().__init__(**kwargs) - self.value = value - - -class GitHubResourceInfo(_serialization.Model): - """Resources created in GitHub repository. - - :ivar app_installation_id: GitHub application installation id. - :vartype app_installation_id: str - """ - - _attribute_map = { - "app_installation_id": {"key": "appInstallationId", "type": "str"}, - } - - def __init__(self, *, app_installation_id: Optional[str] = None, **kwargs): - """ - :keyword app_installation_id: GitHub application installation id. - :paramtype app_installation_id: str - """ - super().__init__(**kwargs) - self.app_installation_id = app_installation_id - - -class GroupingConfiguration(_serialization.Model): - """Grouping configuration property bag. - - All required parameters must be populated in order to send to Azure. - - :ivar enabled: Grouping enabled. Required. - :vartype enabled: bool - :ivar reopen_closed_incident: Re-open closed matching incidents. Required. - :vartype reopen_closed_incident: bool - :ivar lookback_duration: Limit the group to alerts created within the lookback duration (in ISO - 8601 duration format). Required. - :vartype lookback_duration: ~datetime.timedelta - :ivar matching_method: Grouping matching method. When method is Selected at least one of - groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. - Required. Known values are: "AllEntities", "AnyAlert", and "Selected". - :vartype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod - :ivar group_by_entities: A list of entity types to group by (when matchingMethod is Selected). - Only entities defined in the current alert rule may be used. - :vartype group_by_entities: list[str or ~azure.mgmt.securityinsight.models.EntityMappingType] - :ivar group_by_alert_details: A list of alert details to group by (when matchingMethod is - Selected). - :vartype group_by_alert_details: list[str or ~azure.mgmt.securityinsight.models.AlertDetail] - :ivar group_by_custom_details: A list of custom details keys to group by (when matchingMethod - is Selected). Only keys defined in the current alert rule may be used. - :vartype group_by_custom_details: list[str] + :ivar file_format: The format of the file. Known values are: "CSV", "JSON", and "Unspecified". + :vartype file_format: str or ~azure.mgmt.securityinsight.models.FileFormat + :ivar file_name: The name of the file. + :vartype file_name: str + :ivar file_size: The size of the file. + :vartype file_size: int + :ivar file_content_uri: A URI with a valid SAS token to allow uploading / downloading the file. + :vartype file_content_uri: str + :ivar delete_status: Indicates whether the file was deleted from the storage account. Known + values are: "Deleted", "NotDeleted", and "Unspecified". + :vartype delete_status: str or ~azure.mgmt.securityinsight.models.DeleteStatus """ _validation = { - "enabled": {"required": True}, - "reopen_closed_incident": {"required": True}, - "lookback_duration": {"required": True}, - "matching_method": {"required": True}, + "file_content_uri": {"readonly": True}, + "delete_status": {"readonly": True}, } _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "reopen_closed_incident": {"key": "reopenClosedIncident", "type": "bool"}, - "lookback_duration": {"key": "lookbackDuration", "type": "duration"}, - "matching_method": {"key": "matchingMethod", "type": "str"}, - "group_by_entities": {"key": "groupByEntities", "type": "[str]"}, - "group_by_alert_details": {"key": "groupByAlertDetails", "type": "[str]"}, - "group_by_custom_details": {"key": "groupByCustomDetails", "type": "[str]"}, + "file_format": {"key": "fileFormat", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "file_size": {"key": "fileSize", "type": "int"}, + "file_content_uri": {"key": "fileContentUri", "type": "str"}, + "delete_status": {"key": "deleteStatus", "type": "str"}, } def __init__( self, *, - enabled: bool, - reopen_closed_incident: bool, - lookback_duration: datetime.timedelta, - matching_method: Union[str, "_models.MatchingMethod"], - group_by_entities: Optional[List[Union[str, "_models.EntityMappingType"]]] = None, - group_by_alert_details: Optional[List[Union[str, "_models.AlertDetail"]]] = None, - group_by_custom_details: Optional[List[str]] = None, - **kwargs - ): + file_format: Optional[Union[str, "_models.FileFormat"]] = None, + file_name: Optional[str] = None, + file_size: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword enabled: Grouping enabled. Required. - :paramtype enabled: bool - :keyword reopen_closed_incident: Re-open closed matching incidents. Required. - :paramtype reopen_closed_incident: bool - :keyword lookback_duration: Limit the group to alerts created within the lookback duration (in - ISO 8601 duration format). Required. - :paramtype lookback_duration: ~datetime.timedelta - :keyword matching_method: Grouping matching method. When method is Selected at least one of - groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. - Required. Known values are: "AllEntities", "AnyAlert", and "Selected". - :paramtype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod - :keyword group_by_entities: A list of entity types to group by (when matchingMethod is - Selected). Only entities defined in the current alert rule may be used. - :paramtype group_by_entities: list[str or ~azure.mgmt.securityinsight.models.EntityMappingType] - :keyword group_by_alert_details: A list of alert details to group by (when matchingMethod is - Selected). - :paramtype group_by_alert_details: list[str or ~azure.mgmt.securityinsight.models.AlertDetail] - :keyword group_by_custom_details: A list of custom details keys to group by (when - matchingMethod is Selected). Only keys defined in the current alert rule may be used. - :paramtype group_by_custom_details: list[str] + :keyword file_format: The format of the file. Known values are: "CSV", "JSON", and + "Unspecified". + :paramtype file_format: str or ~azure.mgmt.securityinsight.models.FileFormat + :keyword file_name: The name of the file. + :paramtype file_name: str + :keyword file_size: The size of the file. + :paramtype file_size: int """ super().__init__(**kwargs) - self.enabled = enabled - self.reopen_closed_incident = reopen_closed_incident - self.lookback_duration = lookback_duration - self.matching_method = matching_method - self.group_by_entities = group_by_entities - self.group_by_alert_details = group_by_alert_details - self.group_by_custom_details = group_by_custom_details + self.file_format = file_format + self.file_name = file_name + self.file_size = file_size + self.file_content_uri = None + self.delete_status = None -class HostEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a host entity. +class FusionAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes + """Represents Fusion alert rule. Variables are only populated by the server, and will be ignored when sending a request. @@ -9635,39 +9784,36 @@ class HostEntity(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar azure_id: The azure resource id of the VM. - :vartype azure_id: str - :ivar dns_domain: The DNS domain that this host belongs to. Should contain the compete DNS - suffix for the domain. - :vartype dns_domain: str - :ivar host_name: The hostname without the domain suffix. - :vartype host_name: str - :ivar is_domain_joined: Determines whether this host belongs to a domain. - :vartype is_domain_joined: bool - :ivar net_bios_name: The host name (pre-windows2000). - :vartype net_bios_name: str - :ivar nt_domain: The NT domain that this host belongs to. - :vartype nt_domain: str - :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. - :vartype oms_agent_id: str - :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", - "IOS", and "Unknown". - :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily - :ivar os_version: A free text representation of the operating system. This field is meant to - hold specific versions the are more fine grained than OSFamily or future values not supported - by OSFamily enumeration. - :vartype os_version: str + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool + :ivar source_settings: Configuration for all supported source signals in fusion detection. + :vartype source_settings: list[~azure.mgmt.securityinsight.models.FusionSourceSettings] + :ivar scenario_exclusion_patterns: Configuration to exclude scenarios in fusion detection. + :vartype scenario_exclusion_patterns: + list[~azure.mgmt.securityinsight.models.FusionScenarioExclusionPattern] + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] """ _validation = { @@ -9676,16 +9822,13 @@ class HostEntity(Entity): # pylint: disable=too-many-instance-attributes "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "azure_id": {"readonly": True}, - "dns_domain": {"readonly": True}, - "host_name": {"readonly": True}, - "is_domain_joined": {"readonly": True}, - "net_bios_name": {"readonly": True}, - "nt_domain": {"readonly": True}, - "oms_agent_id": {"readonly": True}, - "os_version": {"readonly": True}, + "description": {"readonly": True}, + "display_name": {"readonly": True}, + "last_modified_utc": {"readonly": True}, + "severity": {"readonly": True}, + "tactics": {"readonly": True}, + "techniques": {"readonly": True}, + "sub_techniques": {"readonly": True}, } _attribute_map = { @@ -9693,123 +9836,65 @@ class HostEntity(Entity): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "azure_id": {"key": "properties.azureID", "type": "str"}, - "dns_domain": {"key": "properties.dnsDomain", "type": "str"}, - "host_name": {"key": "properties.hostName", "type": "str"}, - "is_domain_joined": {"key": "properties.isDomainJoined", "type": "bool"}, - "net_bios_name": {"key": "properties.netBiosName", "type": "str"}, - "nt_domain": {"key": "properties.ntDomain", "type": "str"}, - "oms_agent_id": {"key": "properties.omsAgentID", "type": "str"}, - "os_family": {"key": "properties.osFamily", "type": "str"}, - "os_version": {"key": "properties.osVersion", "type": "str"}, + "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "source_settings": {"key": "properties.sourceSettings", "type": "[FusionSourceSettings]"}, + "scenario_exclusion_patterns": { + "key": "properties.scenarioExclusionPatterns", + "type": "[FusionScenarioExclusionPattern]", + }, + "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + "severity": {"key": "properties.severity", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, } - def __init__(self, *, os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs): - """ - :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", - "IOS", and "Unknown". - :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + def __init__( + self, + *, + etag: Optional[str] = None, + alert_rule_template_name: Optional[str] = None, + enabled: Optional[bool] = None, + source_settings: Optional[List["_models.FusionSourceSettings"]] = None, + scenario_exclusion_patterns: Optional[List["_models.FusionScenarioExclusionPattern"]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.kind: str = "Host" - self.additional_data = None - self.friendly_name = None - self.azure_id = None - self.dns_domain = None - self.host_name = None - self.is_domain_joined = None - self.net_bios_name = None - self.nt_domain = None - self.oms_agent_id = None - self.os_family = os_family - self.os_version = None - - -class HostEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """Host entity property bag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar azure_id: The azure resource id of the VM. - :vartype azure_id: str - :ivar dns_domain: The DNS domain that this host belongs to. Should contain the compete DNS - suffix for the domain. - :vartype dns_domain: str - :ivar host_name: The hostname without the domain suffix. - :vartype host_name: str - :ivar is_domain_joined: Determines whether this host belongs to a domain. - :vartype is_domain_joined: bool - :ivar net_bios_name: The host name (pre-windows2000). - :vartype net_bios_name: str - :ivar nt_domain: The NT domain that this host belongs to. - :vartype nt_domain: str - :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. - :vartype oms_agent_id: str - :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", - "IOS", and "Unknown". - :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily - :ivar os_version: A free text representation of the operating system. This field is meant to - hold specific versions the are more fine grained than OSFamily or future values not supported - by OSFamily enumeration. - :vartype os_version: str - """ - - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "azure_id": {"readonly": True}, - "dns_domain": {"readonly": True}, - "host_name": {"readonly": True}, - "is_domain_joined": {"readonly": True}, - "net_bios_name": {"readonly": True}, - "nt_domain": {"readonly": True}, - "oms_agent_id": {"readonly": True}, - "os_version": {"readonly": True}, - } - - _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "azure_id": {"key": "azureID", "type": "str"}, - "dns_domain": {"key": "dnsDomain", "type": "str"}, - "host_name": {"key": "hostName", "type": "str"}, - "is_domain_joined": {"key": "isDomainJoined", "type": "bool"}, - "net_bios_name": {"key": "netBiosName", "type": "str"}, - "nt_domain": {"key": "ntDomain", "type": "str"}, - "oms_agent_id": {"key": "omsAgentID", "type": "str"}, - "os_family": {"key": "osFamily", "type": "str"}, - "os_version": {"key": "osVersion", "type": "str"}, - } - - def __init__(self, *, os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs): - """ - :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", - "IOS", and "Unknown". - :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + :keyword source_settings: Configuration for all supported source signals in fusion detection. + :paramtype source_settings: list[~azure.mgmt.securityinsight.models.FusionSourceSettings] + :keyword scenario_exclusion_patterns: Configuration to exclude scenarios in fusion detection. + :paramtype scenario_exclusion_patterns: + list[~azure.mgmt.securityinsight.models.FusionScenarioExclusionPattern] """ - super().__init__(**kwargs) - self.azure_id = None - self.dns_domain = None - self.host_name = None - self.is_domain_joined = None - self.net_bios_name = None - self.nt_domain = None - self.oms_agent_id = None - self.os_family = os_family - self.os_version = None + super().__init__(etag=etag, **kwargs) + self.kind: str = "Fusion" + self.alert_rule_template_name = alert_rule_template_name + self.description = None + self.display_name = None + self.enabled = enabled + self.source_settings = source_settings + self.scenario_exclusion_patterns = scenario_exclusion_patterns + self.last_modified_utc = None + self.severity = None + self.tactics = None + self.techniques = None + self.sub_techniques = None -class HuntingBookmark(Entity): # pylint: disable=too-many-instance-attributes - """Represents a Hunting bookmark entity. +class FusionAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes + """Represents Fusion alert rule template. Variables are only populated by the server, and will be ignored when sending a request. @@ -9826,39 +9911,38 @@ class HuntingBookmark(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar created: The time the bookmark was created. - :vartype created: ~datetime.datetime - :ivar created_by: Describes a user that created the bookmark. - :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar display_name: The display name of the bookmark. + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar last_updated_date_utc: The time that this alert rule template was last updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. :vartype display_name: str - :ivar event_time: The time of the event. - :vartype event_time: ~datetime.datetime - :ivar labels: List of labels relevant to this bookmark. - :vartype labels: list[str] - :ivar notes: The notes of the bookmark. - :vartype notes: str - :ivar query: The query of the bookmark. - :vartype query: str - :ivar query_result: The query result of the bookmark. - :vartype query_result: str - :ivar updated: The last time the bookmark was updated. - :vartype updated: ~datetime.datetime - :ivar updated_by: Describes a user that updated the bookmark. - :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar incident_info: Describes an incident that relates to bookmark. - :vartype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + :ivar required_data_connectors: The required data connectors for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule template. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] + :ivar source_settings: All supported source signal configurations consumed in fusion detection. + :vartype source_settings: list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSetting] """ _validation = { @@ -9867,8 +9951,8 @@ class HuntingBookmark(Entity): # pylint: disable=too-many-instance-attributes "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, + "created_date_utc": {"readonly": True}, + "last_updated_date_utc": {"readonly": True}, } _attribute_map = { @@ -9877,1661 +9961,1756 @@ class HuntingBookmark(Entity): # pylint: disable=too-many-instance-attributes "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "created": {"key": "properties.created", "type": "iso-8601"}, - "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, + "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, + "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, + "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, + "description": {"key": "properties.description", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, - "event_time": {"key": "properties.eventTime", "type": "iso-8601"}, - "labels": {"key": "properties.labels", "type": "[str]"}, - "notes": {"key": "properties.notes", "type": "str"}, - "query": {"key": "properties.query", "type": "str"}, - "query_result": {"key": "properties.queryResult", "type": "str"}, - "updated": {"key": "properties.updated", "type": "iso-8601"}, - "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, - "incident_info": {"key": "properties.incidentInfo", "type": "IncidentInfo"}, + "required_data_connectors": { + "key": "properties.requiredDataConnectors", + "type": "[AlertRuleTemplateDataSource]", + }, + "status": {"key": "properties.status", "type": "str"}, + "severity": {"key": "properties.severity", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, + "source_settings": {"key": "properties.sourceSettings", "type": "[FusionTemplateSourceSetting]"}, } def __init__( self, *, - created: Optional[datetime.datetime] = None, - created_by: Optional["_models.UserInfo"] = None, + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, display_name: Optional[str] = None, - event_time: Optional[datetime.datetime] = None, - labels: Optional[List[str]] = None, - notes: Optional[str] = None, - query: Optional[str] = None, - query_result: Optional[str] = None, - updated: Optional[datetime.datetime] = None, - updated_by: Optional["_models.UserInfo"] = None, - incident_info: Optional["_models.IncidentInfo"] = None, - **kwargs - ): + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + sub_techniques: Optional[List[str]] = None, + source_settings: Optional[List["_models.FusionTemplateSourceSetting"]] = None, + **kwargs: Any + ) -> None: """ - :keyword created: The time the bookmark was created. - :paramtype created: ~datetime.datetime - :keyword created_by: Describes a user that created the bookmark. - :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword display_name: The display name of the bookmark. + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. :paramtype display_name: str - :keyword event_time: The time of the event. - :paramtype event_time: ~datetime.datetime - :keyword labels: List of labels relevant to this bookmark. - :paramtype labels: list[str] - :keyword notes: The notes of the bookmark. - :paramtype notes: str - :keyword query: The query of the bookmark. - :paramtype query: str - :keyword query_result: The query result of the bookmark. - :paramtype query_result: str - :keyword updated: The last time the bookmark was updated. - :paramtype updated: ~datetime.datetime - :keyword updated_by: Describes a user that updated the bookmark. - :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword incident_info: Describes an incident that relates to bookmark. - :paramtype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo - """ - super().__init__(**kwargs) - self.kind: str = "Bookmark" - self.additional_data = None - self.friendly_name = None - self.created = created - self.created_by = created_by - self.display_name = display_name - self.event_time = event_time - self.labels = labels - self.notes = notes - self.query = query - self.query_result = query_result - self.updated = updated - self.updated_by = updated_by - self.incident_info = incident_info - + :keyword required_data_connectors: The required data connectors for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword tactics: The tactics of the alert rule template. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the alert rule. + :paramtype techniques: list[str] + :keyword sub_techniques: The sub-techniques of the alert rule. + :paramtype sub_techniques: list[str] + :keyword source_settings: All supported source signal configurations consumed in fusion + detection. + :paramtype source_settings: + list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSetting] + """ + super().__init__(**kwargs) + self.kind: str = "Fusion" + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.created_date_utc = None + self.last_updated_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.severity = severity + self.tactics = tactics + self.techniques = techniques + self.sub_techniques = sub_techniques + self.source_settings = source_settings -class HuntingBookmarkProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """Describes bookmark properties. - Variables are only populated by the server, and will be ignored when sending a request. +class FusionScenarioExclusionPattern(_serialization.Model): + """Represents a Fusion scenario exclusion patterns in Fusion detection. All required parameters must be populated in order to send to Azure. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar created: The time the bookmark was created. - :vartype created: ~datetime.datetime - :ivar created_by: Describes a user that created the bookmark. - :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar display_name: The display name of the bookmark. Required. - :vartype display_name: str - :ivar event_time: The time of the event. - :vartype event_time: ~datetime.datetime - :ivar labels: List of labels relevant to this bookmark. - :vartype labels: list[str] - :ivar notes: The notes of the bookmark. - :vartype notes: str - :ivar query: The query of the bookmark. Required. - :vartype query: str - :ivar query_result: The query result of the bookmark. - :vartype query_result: str - :ivar updated: The last time the bookmark was updated. - :vartype updated: ~datetime.datetime - :ivar updated_by: Describes a user that updated the bookmark. - :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar incident_info: Describes an incident that relates to bookmark. - :vartype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + :ivar exclusion_pattern: Scenario exclusion pattern. Required. + :vartype exclusion_pattern: str + :ivar date_added_in_utc: DateTime when scenario exclusion pattern is added in UTC. Required. + :vartype date_added_in_utc: str """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "display_name": {"required": True}, - "query": {"required": True}, + "exclusion_pattern": {"required": True}, + "date_added_in_utc": {"required": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "created": {"key": "created", "type": "iso-8601"}, - "created_by": {"key": "createdBy", "type": "UserInfo"}, - "display_name": {"key": "displayName", "type": "str"}, - "event_time": {"key": "eventTime", "type": "iso-8601"}, - "labels": {"key": "labels", "type": "[str]"}, - "notes": {"key": "notes", "type": "str"}, - "query": {"key": "query", "type": "str"}, - "query_result": {"key": "queryResult", "type": "str"}, - "updated": {"key": "updated", "type": "iso-8601"}, - "updated_by": {"key": "updatedBy", "type": "UserInfo"}, - "incident_info": {"key": "incidentInfo", "type": "IncidentInfo"}, + "exclusion_pattern": {"key": "exclusionPattern", "type": "str"}, + "date_added_in_utc": {"key": "dateAddedInUTC", "type": "str"}, } - def __init__( - self, - *, - display_name: str, - query: str, - created: Optional[datetime.datetime] = None, - created_by: Optional["_models.UserInfo"] = None, - event_time: Optional[datetime.datetime] = None, - labels: Optional[List[str]] = None, - notes: Optional[str] = None, - query_result: Optional[str] = None, - updated: Optional[datetime.datetime] = None, - updated_by: Optional["_models.UserInfo"] = None, - incident_info: Optional["_models.IncidentInfo"] = None, - **kwargs - ): + def __init__(self, *, exclusion_pattern: str, date_added_in_utc: str, **kwargs: Any) -> None: """ - :keyword created: The time the bookmark was created. - :paramtype created: ~datetime.datetime - :keyword created_by: Describes a user that created the bookmark. - :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword display_name: The display name of the bookmark. Required. - :paramtype display_name: str - :keyword event_time: The time of the event. - :paramtype event_time: ~datetime.datetime - :keyword labels: List of labels relevant to this bookmark. - :paramtype labels: list[str] - :keyword notes: The notes of the bookmark. - :paramtype notes: str - :keyword query: The query of the bookmark. Required. - :paramtype query: str - :keyword query_result: The query result of the bookmark. - :paramtype query_result: str - :keyword updated: The last time the bookmark was updated. - :paramtype updated: ~datetime.datetime - :keyword updated_by: Describes a user that updated the bookmark. - :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword incident_info: Describes an incident that relates to bookmark. - :paramtype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + :keyword exclusion_pattern: Scenario exclusion pattern. Required. + :paramtype exclusion_pattern: str + :keyword date_added_in_utc: DateTime when scenario exclusion pattern is added in UTC. Required. + :paramtype date_added_in_utc: str """ super().__init__(**kwargs) - self.created = created - self.created_by = created_by - self.display_name = display_name - self.event_time = event_time - self.labels = labels - self.notes = notes - self.query = query - self.query_result = query_result - self.updated = updated - self.updated_by = updated_by - self.incident_info = incident_info + self.exclusion_pattern = exclusion_pattern + self.date_added_in_utc = date_added_in_utc -class Incident(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """Incident. +class FusionSourceSettings(_serialization.Model): + """Represents a supported source signal configuration in Fusion detection. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar title: The title of the incident. - :vartype title: str - :ivar description: The description of the incident. - :vartype description: str - :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :ivar status: The status of the incident. Known values are: "New", "Active", and "Closed". - :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :ivar classification: The reason the incident was closed. Known values are: "Undetermined", - "TruePositive", "BenignPositive", and "FalsePositive". - :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :ivar classification_reason: The classification reason the incident was closed with. Known - values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and - "InaccurateData". - :vartype classification_reason: str or - ~azure.mgmt.securityinsight.models.IncidentClassificationReason - :ivar classification_comment: Describes the reason the incident was closed. - :vartype classification_comment: str - :ivar owner: Describes a user that the incident is assigned to. - :vartype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo - :ivar labels: List of labels relevant to this incident. - :vartype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] - :ivar first_activity_time_utc: The time of the first activity in the incident. - :vartype first_activity_time_utc: ~datetime.datetime - :ivar last_activity_time_utc: The time of the last activity in the incident. - :vartype last_activity_time_utc: ~datetime.datetime - :ivar last_modified_time_utc: The last time the incident was updated. - :vartype last_modified_time_utc: ~datetime.datetime - :ivar created_time_utc: The time the incident was created. - :vartype created_time_utc: ~datetime.datetime - :ivar incident_number: A sequential number. - :vartype incident_number: int - :ivar additional_data: Additional data on the incident. - :vartype additional_data: ~azure.mgmt.securityinsight.models.IncidentAdditionalData - :ivar related_analytic_rule_ids: List of resource ids of Analytic rules related to the - incident. - :vartype related_analytic_rule_ids: list[str] - :ivar incident_url: The deep-link url to the incident in Azure portal. - :vartype incident_url: str - :ivar provider_name: The name of the source provider that generated the incident. - :vartype provider_name: str - :ivar provider_incident_id: The incident ID assigned by the incident provider. - :vartype provider_incident_id: str - :ivar team_information: Describes a team for the incident. - :vartype team_information: ~azure.mgmt.securityinsight.models.TeamInformation + :ivar enabled: Determines whether this source signal is enabled or disabled in Fusion + detection. Required. + :vartype enabled: bool + :ivar source_name: Name of the Fusion source signal. Refer to Fusion alert rule template for + supported values. Required. + :vartype source_name: str + :ivar source_sub_types: Configuration for all source subtypes under this source signal consumed + in fusion detection. + :vartype source_sub_types: list[~azure.mgmt.securityinsight.models.FusionSourceSubTypeSetting] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "last_modified_time_utc": {"readonly": True}, - "created_time_utc": {"readonly": True}, - "incident_number": {"readonly": True}, - "additional_data": {"readonly": True}, - "related_analytic_rule_ids": {"readonly": True}, - "incident_url": {"readonly": True}, + "enabled": {"required": True}, + "source_name": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "classification": {"key": "properties.classification", "type": "str"}, - "classification_reason": {"key": "properties.classificationReason", "type": "str"}, - "classification_comment": {"key": "properties.classificationComment", "type": "str"}, - "owner": {"key": "properties.owner", "type": "IncidentOwnerInfo"}, - "labels": {"key": "properties.labels", "type": "[IncidentLabel]"}, - "first_activity_time_utc": {"key": "properties.firstActivityTimeUtc", "type": "iso-8601"}, - "last_activity_time_utc": {"key": "properties.lastActivityTimeUtc", "type": "iso-8601"}, - "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, - "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, - "incident_number": {"key": "properties.incidentNumber", "type": "int"}, - "additional_data": {"key": "properties.additionalData", "type": "IncidentAdditionalData"}, - "related_analytic_rule_ids": {"key": "properties.relatedAnalyticRuleIds", "type": "[str]"}, - "incident_url": {"key": "properties.incidentUrl", "type": "str"}, - "provider_name": {"key": "properties.providerName", "type": "str"}, - "provider_incident_id": {"key": "properties.providerIncidentId", "type": "str"}, - "team_information": {"key": "properties.teamInformation", "type": "TeamInformation"}, + "enabled": {"key": "enabled", "type": "bool"}, + "source_name": {"key": "sourceName", "type": "str"}, + "source_sub_types": {"key": "sourceSubTypes", "type": "[FusionSourceSubTypeSetting]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - etag: Optional[str] = None, - title: Optional[str] = None, - description: Optional[str] = None, - severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, - status: Optional[Union[str, "_models.IncidentStatus"]] = None, - classification: Optional[Union[str, "_models.IncidentClassification"]] = None, - classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, - classification_comment: Optional[str] = None, - owner: Optional["_models.IncidentOwnerInfo"] = None, - labels: Optional[List["_models.IncidentLabel"]] = None, - first_activity_time_utc: Optional[datetime.datetime] = None, - last_activity_time_utc: Optional[datetime.datetime] = None, - provider_name: Optional[str] = None, - provider_incident_id: Optional[str] = None, - team_information: Optional["_models.TeamInformation"] = None, - **kwargs - ): + enabled: bool, + source_name: str, + source_sub_types: Optional[List["_models.FusionSourceSubTypeSetting"]] = None, + **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword title: The title of the incident. - :paramtype title: str - :keyword description: The description of the incident. - :paramtype description: str - :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :keyword status: The status of the incident. Known values are: "New", "Active", and "Closed". - :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :keyword classification: The reason the incident was closed. Known values are: "Undetermined", - "TruePositive", "BenignPositive", and "FalsePositive". - :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :keyword classification_reason: The classification reason the incident was closed with. Known - values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and - "InaccurateData". - :paramtype classification_reason: str or - ~azure.mgmt.securityinsight.models.IncidentClassificationReason - :keyword classification_comment: Describes the reason the incident was closed. - :paramtype classification_comment: str - :keyword owner: Describes a user that the incident is assigned to. - :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo - :keyword labels: List of labels relevant to this incident. - :paramtype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] - :keyword first_activity_time_utc: The time of the first activity in the incident. - :paramtype first_activity_time_utc: ~datetime.datetime - :keyword last_activity_time_utc: The time of the last activity in the incident. - :paramtype last_activity_time_utc: ~datetime.datetime - :keyword provider_name: The name of the source provider that generated the incident. - :paramtype provider_name: str - :keyword provider_incident_id: The incident ID assigned by the incident provider. - :paramtype provider_incident_id: str - :keyword team_information: Describes a team for the incident. - :paramtype team_information: ~azure.mgmt.securityinsight.models.TeamInformation + :keyword enabled: Determines whether this source signal is enabled or disabled in Fusion + detection. Required. + :paramtype enabled: bool + :keyword source_name: Name of the Fusion source signal. Refer to Fusion alert rule template for + supported values. Required. + :paramtype source_name: str + :keyword source_sub_types: Configuration for all source subtypes under this source signal + consumed in fusion detection. + :paramtype source_sub_types: + list[~azure.mgmt.securityinsight.models.FusionSourceSubTypeSetting] """ - super().__init__(etag=etag, **kwargs) - self.title = title - self.description = description - self.severity = severity - self.status = status - self.classification = classification - self.classification_reason = classification_reason - self.classification_comment = classification_comment - self.owner = owner - self.labels = labels - self.first_activity_time_utc = first_activity_time_utc - self.last_activity_time_utc = last_activity_time_utc - self.last_modified_time_utc = None - self.created_time_utc = None - self.incident_number = None - self.additional_data = None - self.related_analytic_rule_ids = None - self.incident_url = None - self.provider_name = provider_name - self.provider_incident_id = provider_incident_id - self.team_information = team_information + super().__init__(**kwargs) + self.enabled = enabled + self.source_name = source_name + self.source_sub_types = source_sub_types -class IncidentAdditionalData(_serialization.Model): - """Incident additional data property bag. +class FusionSourceSubTypeSetting(_serialization.Model): + """Represents a supported source subtype configuration under a source signal in Fusion detection. Variables are only populated by the server, and will be ignored when sending a request. - :ivar alerts_count: The number of alerts in the incident. - :vartype alerts_count: int - :ivar bookmarks_count: The number of bookmarks in the incident. - :vartype bookmarks_count: int - :ivar comments_count: The number of comments in the incident. - :vartype comments_count: int - :ivar alert_product_names: List of product names of alerts in the incident. - :vartype alert_product_names: list[str] - :ivar tactics: The tactics associated with incident. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques associated with incident's tactics. - :vartype techniques: list[str] - :ivar provider_incident_url: The provider incident url to the incident in Microsoft 365 - Defender portal. - :vartype provider_incident_url: str + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Determines whether this source subtype under source signal is enabled or + disabled in Fusion detection. Required. + :vartype enabled: bool + :ivar source_sub_type_name: The Name of the source subtype under a given source signal in + Fusion detection. Refer to Fusion alert rule template for supported values. Required. + :vartype source_sub_type_name: str + :ivar source_sub_type_display_name: The display name of source subtype under a source signal + consumed in Fusion detection. + :vartype source_sub_type_display_name: str + :ivar severity_filters: Severity configuration for a source subtype consumed in fusion + detection. Required. + :vartype severity_filters: ~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFilter """ _validation = { - "alerts_count": {"readonly": True}, - "bookmarks_count": {"readonly": True}, - "comments_count": {"readonly": True}, - "alert_product_names": {"readonly": True}, - "tactics": {"readonly": True}, - "techniques": {"readonly": True}, - "provider_incident_url": {"readonly": True}, + "enabled": {"required": True}, + "source_sub_type_name": {"required": True}, + "source_sub_type_display_name": {"readonly": True}, + "severity_filters": {"required": True}, } _attribute_map = { - "alerts_count": {"key": "alertsCount", "type": "int"}, - "bookmarks_count": {"key": "bookmarksCount", "type": "int"}, - "comments_count": {"key": "commentsCount", "type": "int"}, - "alert_product_names": {"key": "alertProductNames", "type": "[str]"}, - "tactics": {"key": "tactics", "type": "[str]"}, - "techniques": {"key": "techniques", "type": "[str]"}, - "provider_incident_url": {"key": "providerIncidentUrl", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + "source_sub_type_name": {"key": "sourceSubTypeName", "type": "str"}, + "source_sub_type_display_name": {"key": "sourceSubTypeDisplayName", "type": "str"}, + "severity_filters": {"key": "severityFilters", "type": "FusionSubTypeSeverityFilter"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + enabled: bool, + source_sub_type_name: str, + severity_filters: "_models.FusionSubTypeSeverityFilter", + **kwargs: Any + ) -> None: + """ + :keyword enabled: Determines whether this source subtype under source signal is enabled or + disabled in Fusion detection. Required. + :paramtype enabled: bool + :keyword source_sub_type_name: The Name of the source subtype under a given source signal in + Fusion detection. Refer to Fusion alert rule template for supported values. Required. + :paramtype source_sub_type_name: str + :keyword severity_filters: Severity configuration for a source subtype consumed in fusion + detection. Required. + :paramtype severity_filters: ~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFilter + """ super().__init__(**kwargs) - self.alerts_count = None - self.bookmarks_count = None - self.comments_count = None - self.alert_product_names = None - self.tactics = None - self.techniques = None - self.provider_incident_url = None + self.enabled = enabled + self.source_sub_type_name = source_sub_type_name + self.source_sub_type_display_name = None + self.severity_filters = severity_filters -class IncidentAlertList(_serialization.Model): - """List of incident alerts. +class FusionSubTypeSeverityFilter(_serialization.Model): + """Represents severity configuration for a source subtype consumed in Fusion detection. - 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 value: Array of incident alerts. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.SecurityAlert] + :ivar is_supported: Determines whether this source subtype supports severity configuration or + not. + :vartype is_supported: bool + :ivar filters: Individual Severity configuration settings for a given source subtype consumed + in Fusion detection. + :vartype filters: list[~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFiltersItem] """ _validation = { - "value": {"required": True}, + "is_supported": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SecurityAlert]"}, + "is_supported": {"key": "isSupported", "type": "bool"}, + "filters": {"key": "filters", "type": "[FusionSubTypeSeverityFiltersItem]"}, } - def __init__(self, *, value: List["_models.SecurityAlert"], **kwargs): + def __init__( + self, *, filters: Optional[List["_models.FusionSubTypeSeverityFiltersItem"]] = None, **kwargs: Any + ) -> None: """ - :keyword value: Array of incident alerts. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.SecurityAlert] + :keyword filters: Individual Severity configuration settings for a given source subtype + consumed in Fusion detection. + :paramtype filters: list[~azure.mgmt.securityinsight.models.FusionSubTypeSeverityFiltersItem] """ super().__init__(**kwargs) - self.value = value + self.is_supported = None + self.filters = filters -class IncidentBookmarkList(_serialization.Model): - """List of incident bookmarks. +class FusionSubTypeSeverityFiltersItem(_serialization.Model): + """Represents a Severity filter setting for a given source subtype consumed in Fusion detection. All required parameters must be populated in order to send to Azure. - :ivar value: Array of incident bookmarks. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.HuntingBookmark] + :ivar severity: The Severity for a given source subtype consumed in Fusion detection. Required. + Known values are: "High", "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar enabled: Determines whether this severity is enabled or disabled for this source subtype + consumed in Fusion detection. Required. + :vartype enabled: bool """ _validation = { - "value": {"required": True}, + "severity": {"required": True}, + "enabled": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[HuntingBookmark]"}, + "severity": {"key": "severity", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__(self, *, value: List["_models.HuntingBookmark"], **kwargs): + def __init__(self, *, severity: Union[str, "_models.AlertSeverity"], enabled: bool, **kwargs: Any) -> None: """ - :keyword value: Array of incident bookmarks. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.HuntingBookmark] + :keyword severity: The Severity for a given source subtype consumed in Fusion detection. + Required. Known values are: "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword enabled: Determines whether this severity is enabled or disabled for this source + subtype consumed in Fusion detection. Required. + :paramtype enabled: bool """ super().__init__(**kwargs) - self.value = value + self.severity = severity + self.enabled = enabled -class IncidentComment(ResourceWithEtag): - """Represents an incident comment. +class FusionTemplateSourceSetting(_serialization.Model): + """Represents a source signal consumed in Fusion detection. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar message: The comment message. - :vartype message: str - :ivar created_time_utc: The time the comment was created. - :vartype created_time_utc: ~datetime.datetime - :ivar last_modified_time_utc: The time the comment was updated. - :vartype last_modified_time_utc: ~datetime.datetime - :ivar author: Describes the client that created the comment. - :vartype author: ~azure.mgmt.securityinsight.models.ClientInfo - """ + :ivar source_name: The name of a source signal consumed in Fusion detection. Required. + :vartype source_name: str + :ivar source_sub_types: All supported source subtypes under this source signal consumed in + fusion detection. + :vartype source_sub_types: list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSubType] + """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_time_utc": {"readonly": True}, - "last_modified_time_utc": {"readonly": True}, - "author": {"readonly": True}, + "source_name": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "message": {"key": "properties.message", "type": "str"}, - "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, - "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, - "author": {"key": "properties.author", "type": "ClientInfo"}, + "source_name": {"key": "sourceName", "type": "str"}, + "source_sub_types": {"key": "sourceSubTypes", "type": "[FusionTemplateSourceSubType]"}, } - def __init__(self, *, etag: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + source_name: str, + source_sub_types: Optional[List["_models.FusionTemplateSourceSubType"]] = None, + **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword message: The comment message. - :paramtype message: str + :keyword source_name: The name of a source signal consumed in Fusion detection. Required. + :paramtype source_name: str + :keyword source_sub_types: All supported source subtypes under this source signal consumed in + fusion detection. + :paramtype source_sub_types: + list[~azure.mgmt.securityinsight.models.FusionTemplateSourceSubType] """ - super().__init__(etag=etag, **kwargs) - self.message = message - self.created_time_utc = None - self.last_modified_time_utc = None - self.author = None + super().__init__(**kwargs) + self.source_name = source_name + self.source_sub_types = source_sub_types -class IncidentCommentList(_serialization.Model): - """IncidentCommentList. +class FusionTemplateSourceSubType(_serialization.Model): + """Represents a source subtype under a source signal consumed in Fusion detection. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. - :vartype value: list[~azure.mgmt.securityinsight.models.IncidentComment] - :ivar next_link: - :vartype next_link: str + :ivar source_sub_type_name: The name of source subtype under a source signal consumed in Fusion + detection. Required. + :vartype source_sub_type_name: str + :ivar source_sub_type_display_name: The display name of source subtype under a source signal + consumed in Fusion detection. + :vartype source_sub_type_display_name: str + :ivar severity_filter: Severity configuration available for a source subtype consumed in fusion + detection. Required. + :vartype severity_filter: + ~azure.mgmt.securityinsight.models.FusionTemplateSubTypeSeverityFilter """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "source_sub_type_name": {"required": True}, + "source_sub_type_display_name": {"readonly": True}, + "severity_filter": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[IncidentComment]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "source_sub_type_name": {"key": "sourceSubTypeName", "type": "str"}, + "source_sub_type_display_name": {"key": "sourceSubTypeDisplayName", "type": "str"}, + "severity_filter": {"key": "severityFilter", "type": "FusionTemplateSubTypeSeverityFilter"}, } - def __init__(self, *, value: List["_models.IncidentComment"], **kwargs): + def __init__( + self, + *, + source_sub_type_name: str, + severity_filter: "_models.FusionTemplateSubTypeSeverityFilter", + **kwargs: Any + ) -> None: """ - :keyword value: Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.IncidentComment] + :keyword source_sub_type_name: The name of source subtype under a source signal consumed in + Fusion detection. Required. + :paramtype source_sub_type_name: str + :keyword severity_filter: Severity configuration available for a source subtype consumed in + fusion detection. Required. + :paramtype severity_filter: + ~azure.mgmt.securityinsight.models.FusionTemplateSubTypeSeverityFilter """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.source_sub_type_name = source_sub_type_name + self.source_sub_type_display_name = None + self.severity_filter = severity_filter -class IncidentConfiguration(_serialization.Model): - """Incident Configuration property bag. +class FusionTemplateSubTypeSeverityFilter(_serialization.Model): + """Represents severity configurations available for a source subtype consumed in Fusion detection. All required parameters must be populated in order to send to Azure. - :ivar create_incident: Create incidents from alerts triggered by this analytics rule. Required. - :vartype create_incident: bool - :ivar grouping_configuration: Set how the alerts that are triggered by this analytics rule, are - grouped into incidents. - :vartype grouping_configuration: ~azure.mgmt.securityinsight.models.GroupingConfiguration + :ivar is_supported: Determines whether severity configuration is supported for this source + subtype consumed in Fusion detection. Required. + :vartype is_supported: bool + :ivar severity_filters: List of all supported severities for this source subtype consumed in + Fusion detection. + :vartype severity_filters: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] """ _validation = { - "create_incident": {"required": True}, + "is_supported": {"required": True}, } _attribute_map = { - "create_incident": {"key": "createIncident", "type": "bool"}, - "grouping_configuration": {"key": "groupingConfiguration", "type": "GroupingConfiguration"}, + "is_supported": {"key": "isSupported", "type": "bool"}, + "severity_filters": {"key": "severityFilters", "type": "[str]"}, } def __init__( self, *, - create_incident: bool, - grouping_configuration: Optional["_models.GroupingConfiguration"] = None, - **kwargs - ): + is_supported: bool, + severity_filters: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + **kwargs: Any + ) -> None: """ - :keyword create_incident: Create incidents from alerts triggered by this analytics rule. - Required. - :paramtype create_incident: bool - :keyword grouping_configuration: Set how the alerts that are triggered by this analytics rule, - are grouped into incidents. - :paramtype grouping_configuration: ~azure.mgmt.securityinsight.models.GroupingConfiguration + :keyword is_supported: Determines whether severity configuration is supported for this source + subtype consumed in Fusion detection. Required. + :paramtype is_supported: bool + :keyword severity_filters: List of all supported severities for this source subtype consumed in + Fusion detection. + :paramtype severity_filters: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] """ super().__init__(**kwargs) - self.create_incident = create_incident - self.grouping_configuration = grouping_configuration + self.is_supported = is_supported + self.severity_filters = severity_filters -class IncidentEntitiesResponse(_serialization.Model): - """The incident related entities response. +class GCPAuthProperties(_serialization.Model): + """Google Cloud Platform auth section properties. - :ivar entities: Array of the incident related entities. - :vartype entities: list[~azure.mgmt.securityinsight.models.Entity] - :ivar meta_data: The metadata from the incident related entities results. - :vartype meta_data: list[~azure.mgmt.securityinsight.models.IncidentEntitiesResultsMetadata] + All required parameters must be populated in order to send to Azure. + + :ivar service_account_email: The service account that is used to access the GCP project. + Required. + :vartype service_account_email: str + :ivar project_number: The GCP project number. Required. + :vartype project_number: str + :ivar workload_identity_provider_id: The workload identity provider id that is used to gain + access to the GCP project. Required. + :vartype workload_identity_provider_id: str """ + _validation = { + "service_account_email": {"required": True}, + "project_number": {"required": True}, + "workload_identity_provider_id": {"required": True}, + } + _attribute_map = { - "entities": {"key": "entities", "type": "[Entity]"}, - "meta_data": {"key": "metaData", "type": "[IncidentEntitiesResultsMetadata]"}, + "service_account_email": {"key": "serviceAccountEmail", "type": "str"}, + "project_number": {"key": "projectNumber", "type": "str"}, + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, } def __init__( - self, - *, - entities: Optional[List["_models.Entity"]] = None, - meta_data: Optional[List["_models.IncidentEntitiesResultsMetadata"]] = None, - **kwargs - ): + self, *, service_account_email: str, project_number: str, workload_identity_provider_id: str, **kwargs: Any + ) -> None: """ - :keyword entities: Array of the incident related entities. - :paramtype entities: list[~azure.mgmt.securityinsight.models.Entity] - :keyword meta_data: The metadata from the incident related entities results. - :paramtype meta_data: list[~azure.mgmt.securityinsight.models.IncidentEntitiesResultsMetadata] + :keyword service_account_email: The service account that is used to access the GCP project. + Required. + :paramtype service_account_email: str + :keyword project_number: The GCP project number. Required. + :paramtype project_number: str + :keyword workload_identity_provider_id: The workload identity provider id that is used to gain + access to the GCP project. Required. + :paramtype workload_identity_provider_id: str """ super().__init__(**kwargs) - self.entities = entities - self.meta_data = meta_data + self.service_account_email = service_account_email + self.project_number = project_number + self.workload_identity_provider_id = workload_identity_provider_id -class IncidentEntitiesResultsMetadata(_serialization.Model): - """Information of a specific aggregation in the incident related entities result. +class GCPDataConnector(DataConnector): + """Represents Google Cloud Platform data connector. + + 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 entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", - "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and - "Nic". - :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar count: Total number of aggregations of the given kind in the incident related entities - result. Required. - :vartype count: int + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar connector_definition_name: The name of the connector definition that represents the UI + config. + :vartype connector_definition_name: str + :ivar auth: The auth section of the connector. + :vartype auth: ~azure.mgmt.securityinsight.models.GCPAuthProperties + :ivar request: The request section of the connector. + :vartype request: ~azure.mgmt.securityinsight.models.GCPRequestProperties + :ivar dcr_config: The configuration of the destination of the data. + :vartype dcr_config: ~azure.mgmt.securityinsight.models.DCRConfiguration """ _validation = { - "entity_kind": {"required": True}, - "count": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { - "entity_kind": {"key": "entityKind", "type": "str"}, - "count": {"key": "count", "type": "int"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "connector_definition_name": {"key": "properties.connectorDefinitionName", "type": "str"}, + "auth": {"key": "properties.auth", "type": "GCPAuthProperties"}, + "request": {"key": "properties.request", "type": "GCPRequestProperties"}, + "dcr_config": {"key": "properties.dcrConfig", "type": "DCRConfiguration"}, } - def __init__(self, *, entity_kind: Union[str, "_models.EntityKind"], count: int, **kwargs): + def __init__( + self, + *, + etag: Optional[str] = None, + connector_definition_name: Optional[str] = None, + auth: Optional["_models.GCPAuthProperties"] = None, + request: Optional["_models.GCPRequestProperties"] = None, + dcr_config: Optional["_models.DCRConfiguration"] = None, + **kwargs: Any + ) -> None: """ - :keyword entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", - "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", - "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and - "Nic". - :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :keyword count: Total number of aggregations of the given kind in the incident related entities - result. Required. - :paramtype count: int + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword connector_definition_name: The name of the connector definition that represents the UI + config. + :paramtype connector_definition_name: str + :keyword auth: The auth section of the connector. + :paramtype auth: ~azure.mgmt.securityinsight.models.GCPAuthProperties + :keyword request: The request section of the connector. + :paramtype request: ~azure.mgmt.securityinsight.models.GCPRequestProperties + :keyword dcr_config: The configuration of the destination of the data. + :paramtype dcr_config: ~azure.mgmt.securityinsight.models.DCRConfiguration """ - super().__init__(**kwargs) - self.entity_kind = entity_kind - self.count = count + super().__init__(etag=etag, **kwargs) + self.kind: str = "GCP" + self.connector_definition_name = connector_definition_name + self.auth = auth + self.request = request + self.dcr_config = dcr_config -class IncidentInfo(_serialization.Model): - """Describes related incident information for the bookmark. +class GCPRequestProperties(_serialization.Model): + """Google Cloud Platform request section properties. - :ivar incident_id: Incident Id. - :vartype incident_id: str - :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :ivar title: The title of the incident. - :vartype title: str - :ivar relation_name: Relation Name. - :vartype relation_name: str + All required parameters must be populated in order to send to Azure. + + :ivar project_id: The GCP project id. Required. + :vartype project_id: str + :ivar subscription_names: The GCP pub/sub subscription names. Required. + :vartype subscription_names: list[str] """ + _validation = { + "project_id": {"required": True}, + "subscription_names": {"required": True}, + } + _attribute_map = { - "incident_id": {"key": "incidentId", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "title": {"key": "title", "type": "str"}, - "relation_name": {"key": "relationName", "type": "str"}, + "project_id": {"key": "projectId", "type": "str"}, + "subscription_names": {"key": "subscriptionNames", "type": "[str]"}, } - def __init__( - self, - *, - incident_id: Optional[str] = None, - severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, - title: Optional[str] = None, - relation_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, project_id: str, subscription_names: List[str], **kwargs: Any) -> None: """ - :keyword incident_id: Incident Id. - :paramtype incident_id: str - :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :keyword title: The title of the incident. - :paramtype title: str - :keyword relation_name: Relation Name. - :paramtype relation_name: str + :keyword project_id: The GCP project id. Required. + :paramtype project_id: str + :keyword subscription_names: The GCP pub/sub subscription names. Required. + :paramtype subscription_names: list[str] """ super().__init__(**kwargs) - self.incident_id = incident_id - self.severity = severity - self.title = title - self.relation_name = relation_name + self.project_id = project_id + self.subscription_names = subscription_names -class IncidentLabel(_serialization.Model): - """Represents an incident label. +class GeoLocation(_serialization.Model): + """The geo-location context attached to the ip entity. Variables are only populated by the server, and will be ignored when sending a request. + :ivar asn: Autonomous System Number. + :vartype asn: int + :ivar city: City name. + :vartype city: str + :ivar country_code: The country code according to ISO 3166 format. + :vartype country_code: str + :ivar country_name: Country name according to ISO 3166 Alpha 2: the lowercase of the English + Short Name. + :vartype country_name: str + :ivar latitude: The latitude of the identified location, expressed as a floating point number + with range of - 90 to 90. Latitude and longitude are derived from the city or postal code. + :vartype latitude: float + :ivar longitude: The longitude of the identified location, expressed as a floating point number + with range of -180 to 180. Latitude and longitude are derived from the city or postal code. + :vartype longitude: float + :ivar state: State name. + :vartype state: str + """ + + _validation = { + "asn": {"readonly": True}, + "city": {"readonly": True}, + "country_code": {"readonly": True}, + "country_name": {"readonly": True}, + "latitude": {"readonly": True}, + "longitude": {"readonly": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "asn": {"key": "asn", "type": "int"}, + "city": {"key": "city", "type": "str"}, + "country_code": {"key": "countryCode", "type": "str"}, + "country_name": {"key": "countryName", "type": "str"}, + "latitude": {"key": "latitude", "type": "float"}, + "longitude": {"key": "longitude", "type": "float"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.asn = None + self.city = None + self.country_code = None + self.country_name = None + self.latitude = None + self.longitude = None + self.state = None + + +class GetInsightsErrorKind(_serialization.Model): + """GetInsights Query Errors. + All required parameters must be populated in order to send to Azure. - :ivar label_name: The name of the label. Required. - :vartype label_name: str - :ivar label_type: The type of the label. Known values are: "User" and "AutoAssigned". - :vartype label_type: str or ~azure.mgmt.securityinsight.models.IncidentLabelType + :ivar kind: the query kind. Required. "Insight" + :vartype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError + :ivar query_id: the query id. + :vartype query_id: str + :ivar error_message: the error message. Required. + :vartype error_message: str """ _validation = { - "label_name": {"required": True}, - "label_type": {"readonly": True}, + "kind": {"required": True}, + "error_message": {"required": True}, } _attribute_map = { - "label_name": {"key": "labelName", "type": "str"}, - "label_type": {"key": "labelType", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "query_id": {"key": "queryId", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, } - def __init__(self, *, label_name: str, **kwargs): + def __init__( + self, + *, + kind: Union[str, "_models.GetInsightsError"], + error_message: str, + query_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword label_name: The name of the label. Required. - :paramtype label_name: str + :keyword kind: the query kind. Required. "Insight" + :paramtype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError + :keyword query_id: the query id. + :paramtype query_id: str + :keyword error_message: the error message. Required. + :paramtype error_message: str """ super().__init__(**kwargs) - self.label_name = label_name - self.label_type = None - + self.kind = kind + self.query_id = query_id + self.error_message = error_message -class IncidentList(_serialization.Model): - """List all the incidents. - Variables are only populated by the server, and will be ignored when sending a request. +class GetInsightsResultsMetadata(_serialization.Model): + """Get Insights result metadata. All required parameters must be populated in order to send to Azure. - :ivar value: Required. - :vartype value: list[~azure.mgmt.securityinsight.models.Incident] - :ivar next_link: URL to fetch the next set of incidents. - :vartype next_link: str + :ivar total_count: the total items found for the insights request. Required. + :vartype total_count: int + :ivar errors: information about the failed queries. + :vartype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "total_count": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Incident]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "total_count": {"key": "totalCount", "type": "int"}, + "errors": {"key": "errors", "type": "[GetInsightsErrorKind]"}, } - def __init__(self, *, value: List["_models.Incident"], **kwargs): + def __init__( + self, *, total_count: int, errors: Optional[List["_models.GetInsightsErrorKind"]] = None, **kwargs: Any + ) -> None: """ - :keyword value: Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.Incident] + :keyword total_count: the total items found for the insights request. Required. + :paramtype total_count: int + :keyword errors: information about the failed queries. + :paramtype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.total_count = total_count + self.errors = errors -class IncidentOwnerInfo(_serialization.Model): - """Information on the user an incident is assigned to. +class GetQueriesResponse(_serialization.Model): + """Retrieve queries for entity result operation response. - :ivar email: The email of the user the incident is assigned to. - :vartype email: str - :ivar assigned_to: The name of the user the incident is assigned to. - :vartype assigned_to: str - :ivar object_id: The object id of the user the incident is assigned to. - :vartype object_id: str - :ivar user_principal_name: The user principal name of the user the incident is assigned to. - :vartype user_principal_name: str - :ivar owner_type: The type of the owner the incident is assigned to. Known values are: - "Unknown", "User", and "Group". - :vartype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType + :ivar value: The query result values. + :vartype value: list[~azure.mgmt.securityinsight.models.EntityQueryItem] """ _attribute_map = { - "email": {"key": "email", "type": "str"}, - "assigned_to": {"key": "assignedTo", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "user_principal_name": {"key": "userPrincipalName", "type": "str"}, - "owner_type": {"key": "ownerType", "type": "str"}, + "value": {"key": "value", "type": "[EntityQueryItem]"}, } - def __init__( - self, - *, - email: Optional[str] = None, - assigned_to: Optional[str] = None, - object_id: Optional[str] = None, - user_principal_name: Optional[str] = None, - owner_type: Optional[Union[str, "_models.OwnerType"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.EntityQueryItem"]] = None, **kwargs: Any) -> None: """ - :keyword email: The email of the user the incident is assigned to. - :paramtype email: str - :keyword assigned_to: The name of the user the incident is assigned to. - :paramtype assigned_to: str - :keyword object_id: The object id of the user the incident is assigned to. - :paramtype object_id: str - :keyword user_principal_name: The user principal name of the user the incident is assigned to. - :paramtype user_principal_name: str - :keyword owner_type: The type of the owner the incident is assigned to. Known values are: - "Unknown", "User", and "Group". - :paramtype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType + :keyword value: The query result values. + :paramtype value: list[~azure.mgmt.securityinsight.models.EntityQueryItem] """ super().__init__(**kwargs) - self.email = email - self.assigned_to = assigned_to - self.object_id = object_id - self.user_principal_name = user_principal_name - self.owner_type = owner_type + self.value = value -class IncidentPropertiesAction(_serialization.Model): - """IncidentPropertiesAction. +class GitHubResourceInfo(_serialization.Model): + """Resources created in GitHub repository. - :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :ivar status: The status of the incident. Known values are: "New", "Active", and "Closed". - :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :ivar classification: The reason the incident was closed. Known values are: "Undetermined", - "TruePositive", "BenignPositive", and "FalsePositive". - :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :ivar classification_reason: The classification reason the incident was closed with. Known - values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and - "InaccurateData". - :vartype classification_reason: str or - ~azure.mgmt.securityinsight.models.IncidentClassificationReason - :ivar classification_comment: Describes the reason the incident was closed. - :vartype classification_comment: str - :ivar owner: Information on the user an incident is assigned to. - :vartype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo - :ivar labels: List of labels to add to the incident. - :vartype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :ivar app_installation_id: GitHub application installation id. + :vartype app_installation_id: str """ _attribute_map = { - "severity": {"key": "severity", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "classification": {"key": "classification", "type": "str"}, - "classification_reason": {"key": "classificationReason", "type": "str"}, - "classification_comment": {"key": "classificationComment", "type": "str"}, - "owner": {"key": "owner", "type": "IncidentOwnerInfo"}, - "labels": {"key": "labels", "type": "[IncidentLabel]"}, + "app_installation_id": {"key": "appInstallationId", "type": "str"}, } - def __init__( - self, - *, - severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, - status: Optional[Union[str, "_models.IncidentStatus"]] = None, - classification: Optional[Union[str, "_models.IncidentClassification"]] = None, - classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, - classification_comment: Optional[str] = None, - owner: Optional["_models.IncidentOwnerInfo"] = None, - labels: Optional[List["_models.IncidentLabel"]] = None, - **kwargs - ): + def __init__(self, *, app_installation_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and - "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :keyword status: The status of the incident. Known values are: "New", "Active", and "Closed". - :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :keyword classification: The reason the incident was closed. Known values are: "Undetermined", - "TruePositive", "BenignPositive", and "FalsePositive". - :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :keyword classification_reason: The classification reason the incident was closed with. Known - values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and - "InaccurateData". - :paramtype classification_reason: str or - ~azure.mgmt.securityinsight.models.IncidentClassificationReason - :keyword classification_comment: Describes the reason the incident was closed. - :paramtype classification_comment: str - :keyword owner: Information on the user an incident is assigned to. - :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo - :keyword labels: List of labels to add to the incident. - :paramtype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :keyword app_installation_id: GitHub application installation id. + :paramtype app_installation_id: str """ super().__init__(**kwargs) - self.severity = severity - self.status = status - self.classification = classification - self.classification_reason = classification_reason - self.classification_comment = classification_comment - self.owner = owner - self.labels = labels + self.app_installation_id = app_installation_id -class IncidentTask(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """IncidentTask. - - Variables are only populated by the server, and will be ignored when sending a request. +class GraphQuery(_serialization.Model): + """The graph query to show the volume of data arriving into the workspace over time. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar title: The title of the task. Required. - :vartype title: str - :ivar description: The description of the task. - :vartype description: str - :ivar status: Required. Known values are: "New" and "Completed". - :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentTaskStatus - :ivar created_time_utc: The time the task was created. - :vartype created_time_utc: ~datetime.datetime - :ivar last_modified_time_utc: The last time the task was updated. - :vartype last_modified_time_utc: ~datetime.datetime - :ivar created_by: Information on the client (user or application) that made some action. - :vartype created_by: ~azure.mgmt.securityinsight.models.ClientInfo - :ivar last_modified_by: Information on the client (user or application) that made some action. - :vartype last_modified_by: ~azure.mgmt.securityinsight.models.ClientInfo + :ivar metric_name: Gets or sets the metric name that the query is checking. For example: 'Total + data receive'. Required. + :vartype metric_name: str + :ivar legend: Gets or sets the legend for the graph. Required. + :vartype legend: str + :ivar base_query: Gets or sets the base query for the graph. + The base query is wrapped by Sentinel UI infra with a KQL query, that measures the volume over + time. Required. + :vartype base_query: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "title": {"required": True}, - "status": {"required": True}, - "created_time_utc": {"readonly": True}, - "last_modified_time_utc": {"readonly": True}, + "metric_name": {"required": True}, + "legend": {"required": True}, + "base_query": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, - "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, - "created_by": {"key": "properties.createdBy", "type": "ClientInfo"}, - "last_modified_by": {"key": "properties.lastModifiedBy", "type": "ClientInfo"}, + "metric_name": {"key": "metricName", "type": "str"}, + "legend": {"key": "legend", "type": "str"}, + "base_query": {"key": "baseQuery", "type": "str"}, } - def __init__( - self, - *, - title: str, - status: Union[str, "_models.IncidentTaskStatus"], - etag: Optional[str] = None, - description: Optional[str] = None, - created_by: Optional["_models.ClientInfo"] = None, - last_modified_by: Optional["_models.ClientInfo"] = None, - **kwargs - ): + def __init__(self, *, metric_name: str, legend: str, base_query: str, **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword title: The title of the task. Required. - :paramtype title: str - :keyword description: The description of the task. - :paramtype description: str - :keyword status: Required. Known values are: "New" and "Completed". - :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentTaskStatus - :keyword created_by: Information on the client (user or application) that made some action. - :paramtype created_by: ~azure.mgmt.securityinsight.models.ClientInfo - :keyword last_modified_by: Information on the client (user or application) that made some - action. - :paramtype last_modified_by: ~azure.mgmt.securityinsight.models.ClientInfo + :keyword metric_name: Gets or sets the metric name that the query is checking. For example: + 'Total data receive'. Required. + :paramtype metric_name: str + :keyword legend: Gets or sets the legend for the graph. Required. + :paramtype legend: str + :keyword base_query: Gets or sets the base query for the graph. + The base query is wrapped by Sentinel UI infra with a KQL query, that measures the volume over + time. Required. + :paramtype base_query: str """ - super().__init__(etag=etag, **kwargs) - self.title = title - self.description = description - self.status = status - self.created_time_utc = None - self.last_modified_time_utc = None - self.created_by = created_by - self.last_modified_by = last_modified_by + super().__init__(**kwargs) + self.metric_name = metric_name + self.legend = legend + self.base_query = base_query -class IncidentTaskList(_serialization.Model): - """IncidentTaskList. +class GroupingConfiguration(_serialization.Model): + """Grouping configuration property bag. - :ivar value: - :vartype value: list[~azure.mgmt.securityinsight.models.IncidentTask] - :ivar next_link: - :vartype next_link: str + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Grouping enabled. Required. + :vartype enabled: bool + :ivar reopen_closed_incident: Re-open closed matching incidents. Required. + :vartype reopen_closed_incident: bool + :ivar lookback_duration: Limit the group to alerts created within the lookback duration (in ISO + 8601 duration format). Required. + :vartype lookback_duration: ~datetime.timedelta + :ivar matching_method: Grouping matching method. When method is Selected at least one of + groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. + Required. Known values are: "AllEntities", "AnyAlert", and "Selected". + :vartype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod + :ivar group_by_entities: A list of entity types to group by (when matchingMethod is Selected). + Only entities defined in the current alert rule may be used. + :vartype group_by_entities: list[str or ~azure.mgmt.securityinsight.models.EntityMappingType] + :ivar group_by_alert_details: A list of alert details to group by (when matchingMethod is + Selected). + :vartype group_by_alert_details: list[str or ~azure.mgmt.securityinsight.models.AlertDetail] + :ivar group_by_custom_details: A list of custom details keys to group by (when matchingMethod + is Selected). Only keys defined in the current alert rule may be used. + :vartype group_by_custom_details: list[str] """ + _validation = { + "enabled": {"required": True}, + "reopen_closed_incident": {"required": True}, + "lookback_duration": {"required": True}, + "matching_method": {"required": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[IncidentTask]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + "reopen_closed_incident": {"key": "reopenClosedIncident", "type": "bool"}, + "lookback_duration": {"key": "lookbackDuration", "type": "duration"}, + "matching_method": {"key": "matchingMethod", "type": "str"}, + "group_by_entities": {"key": "groupByEntities", "type": "[str]"}, + "group_by_alert_details": {"key": "groupByAlertDetails", "type": "[str]"}, + "group_by_custom_details": {"key": "groupByCustomDetails", "type": "[str]"}, } def __init__( - self, *, value: Optional[List["_models.IncidentTask"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + enabled: bool, + reopen_closed_incident: bool, + lookback_duration: datetime.timedelta, + matching_method: Union[str, "_models.MatchingMethod"], + group_by_entities: Optional[List[Union[str, "_models.EntityMappingType"]]] = None, + group_by_alert_details: Optional[List[Union[str, "_models.AlertDetail"]]] = None, + group_by_custom_details: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: - :paramtype value: list[~azure.mgmt.securityinsight.models.IncidentTask] - :keyword next_link: - :paramtype next_link: str + :keyword enabled: Grouping enabled. Required. + :paramtype enabled: bool + :keyword reopen_closed_incident: Re-open closed matching incidents. Required. + :paramtype reopen_closed_incident: bool + :keyword lookback_duration: Limit the group to alerts created within the lookback duration (in + ISO 8601 duration format). Required. + :paramtype lookback_duration: ~datetime.timedelta + :keyword matching_method: Grouping matching method. When method is Selected at least one of + groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. + Required. Known values are: "AllEntities", "AnyAlert", and "Selected". + :paramtype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod + :keyword group_by_entities: A list of entity types to group by (when matchingMethod is + Selected). Only entities defined in the current alert rule may be used. + :paramtype group_by_entities: list[str or ~azure.mgmt.securityinsight.models.EntityMappingType] + :keyword group_by_alert_details: A list of alert details to group by (when matchingMethod is + Selected). + :paramtype group_by_alert_details: list[str or ~azure.mgmt.securityinsight.models.AlertDetail] + :keyword group_by_custom_details: A list of custom details keys to group by (when + matchingMethod is Selected). Only keys defined in the current alert rule may be used. + :paramtype group_by_custom_details: list[str] """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.enabled = enabled + self.reopen_closed_incident = reopen_closed_incident + self.lookback_duration = lookback_duration + self.matching_method = matching_method + self.group_by_entities = group_by_entities + self.group_by_alert_details = group_by_alert_details + self.group_by_custom_details = group_by_custom_details -class InsightQueryItem(EntityQueryItem): - """Represents Insight Query. +class HostEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a host entity. 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: Query Template ARM ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Query Template ARM Name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: ARM Type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar kind: The kind of the entity query. Required. Known values are: "Expansion", "Insight", - and "Activity". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind - :ivar properties: Properties bag for InsightQueryItem. - :vartype properties: ~azure.mgmt.securityinsight.models.InsightQueryItemProperties + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar azure_id: The azure resource id of the VM. + :vartype azure_id: str + :ivar dns_domain: The DNS domain that this host belongs to. Should contain the compete DNS + suffix for the domain. + :vartype dns_domain: str + :ivar host_name: The hostname without the domain suffix. + :vartype host_name: str + :ivar is_domain_joined: Determines whether this host belongs to a domain. + :vartype is_domain_joined: bool + :ivar net_bios_name: The host name (pre-windows2000). + :vartype net_bios_name: str + :ivar nt_domain: The NT domain that this host belongs to. + :vartype nt_domain: str + :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. + :vartype oms_agent_id: str + :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", and "Unknown". + :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + :ivar os_version: A free text representation of the operating system. This field is meant to + hold specific versions the are more fine grained than OSFamily or future values not supported + by OSFamily enumeration. + :vartype os_version: str """ _validation = { "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "azure_id": {"readonly": True}, + "dns_domain": {"readonly": True}, + "host_name": {"readonly": True}, + "is_domain_joined": {"readonly": True}, + "net_bios_name": {"readonly": True}, + "nt_domain": {"readonly": True}, + "oms_agent_id": {"readonly": True}, + "os_version": {"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"}, "kind": {"key": "kind", "type": "str"}, - "properties": {"key": "properties", "type": "InsightQueryItemProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - properties: Optional["_models.InsightQueryItemProperties"] = None, - **kwargs - ): - """ - :keyword name: Query Template ARM Name. - :paramtype name: str - :keyword type: ARM Type. - :paramtype type: str - :keyword properties: Properties bag for InsightQueryItem. - :paramtype properties: ~azure.mgmt.securityinsight.models.InsightQueryItemProperties + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "azure_id": {"key": "properties.azureID", "type": "str"}, + "dns_domain": {"key": "properties.dnsDomain", "type": "str"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "is_domain_joined": {"key": "properties.isDomainJoined", "type": "bool"}, + "net_bios_name": {"key": "properties.netBiosName", "type": "str"}, + "nt_domain": {"key": "properties.ntDomain", "type": "str"}, + "oms_agent_id": {"key": "properties.omsAgentID", "type": "str"}, + "os_family": {"key": "properties.osFamily", "type": "str"}, + "os_version": {"key": "properties.osVersion", "type": "str"}, + } + + def __init__(self, *, os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs: Any) -> None: """ - super().__init__(name=name, type=type, **kwargs) - self.kind: str = "Insight" - self.properties = properties + :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", and "Unknown". + :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + """ + super().__init__(**kwargs) + self.kind: str = "Host" + self.additional_data = None + self.friendly_name = None + self.azure_id = None + self.dns_domain = None + self.host_name = None + self.is_domain_joined = None + self.net_bios_name = None + self.nt_domain = None + self.oms_agent_id = None + self.os_family = os_family + self.os_version = None -class InsightQueryItemProperties(EntityQueryItemProperties): # pylint: disable=too-many-instance-attributes - """Represents Insight Query. +class HostEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """Host entity property bag. - :ivar data_types: Data types for template. - :vartype data_types: - list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", - "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :ivar required_input_fields_sets: Data types for template. - :vartype required_input_fields_sets: list[list[str]] - :ivar entities_filter: The query applied only to entities matching to all filters. - :vartype entities_filter: JSON - :ivar display_name: The insight display name. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar azure_id: The azure resource id of the VM. + :vartype azure_id: str + :ivar dns_domain: The DNS domain that this host belongs to. Should contain the compete DNS + suffix for the domain. + :vartype dns_domain: str + :ivar host_name: The hostname without the domain suffix. + :vartype host_name: str + :ivar is_domain_joined: Determines whether this host belongs to a domain. + :vartype is_domain_joined: bool + :ivar net_bios_name: The host name (pre-windows2000). + :vartype net_bios_name: str + :ivar nt_domain: The NT domain that this host belongs to. + :vartype nt_domain: str + :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. + :vartype oms_agent_id: str + :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", and "Unknown". + :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + :ivar os_version: A free text representation of the operating system. This field is meant to + hold specific versions the are more fine grained than OSFamily or future values not supported + by OSFamily enumeration. + :vartype os_version: str + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "azure_id": {"readonly": True}, + "dns_domain": {"readonly": True}, + "host_name": {"readonly": True}, + "is_domain_joined": {"readonly": True}, + "net_bios_name": {"readonly": True}, + "nt_domain": {"readonly": True}, + "oms_agent_id": {"readonly": True}, + "os_version": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "azure_id": {"key": "azureID", "type": "str"}, + "dns_domain": {"key": "dnsDomain", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "is_domain_joined": {"key": "isDomainJoined", "type": "bool"}, + "net_bios_name": {"key": "netBiosName", "type": "str"}, + "nt_domain": {"key": "ntDomain", "type": "str"}, + "oms_agent_id": {"key": "omsAgentID", "type": "str"}, + "os_family": {"key": "osFamily", "type": "str"}, + "os_version": {"key": "osVersion", "type": "str"}, + } + + def __init__(self, *, os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs: Any) -> None: + """ + :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", and "Unknown". + :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily + """ + super().__init__(**kwargs) + self.azure_id = None + self.dns_domain = None + self.host_name = None + self.is_domain_joined = None + self.net_bios_name = None + self.nt_domain = None + self.oms_agent_id = None + self.os_family = os_family + self.os_version = None + + +class Hunt(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Represents a Hunt in Azure Security Insights. + + 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar display_name: The display name of the hunt. :vartype display_name: str - :ivar description: The insight description. + :ivar description: The description of the hunt. :vartype description: str - :ivar base_query: The base query of the insight. - :vartype base_query: str - :ivar table_query: The insight table query. - :vartype table_query: ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQuery - :ivar chart_query: The insight chart query. - :vartype chart_query: JSON - :ivar additional_query: The activity query definitions. - :vartype additional_query: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesAdditionalQuery - :ivar default_time_range: The insight chart query. - :vartype default_time_range: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesDefaultTimeRange - :ivar reference_time_range: The insight chart query. - :vartype reference_time_range: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesReferenceTimeRange + :ivar status: The status of the hunt. Known values are: "New", "Active", "Closed", "Backlog", + "Approved", "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.securityinsight.models.Status + :ivar hypothesis_status: The hypothesis status of the hunt. Known values are: "Unknown", + "Invalidated", and "Validated". + :vartype hypothesis_status: str or ~azure.mgmt.securityinsight.models.HypothesisStatus + :ivar attack_tactics: A list of mitre attack tactics the hunt is associated with. + :vartype attack_tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar attack_techniques: A list of a mitre attack techniques the hunt is associated with. + :vartype attack_techniques: list[str] + :ivar labels: List of labels relevant to this hunt. + :vartype labels: list[str] + :ivar owner: Describes a user that the hunt is assigned to. + :vartype owner: ~azure.mgmt.securityinsight.models.HuntOwner """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + _attribute_map = { - "data_types": {"key": "dataTypes", "type": "[EntityQueryItemPropertiesDataTypesItem]"}, - "input_entity_type": {"key": "inputEntityType", "type": "str"}, - "required_input_fields_sets": {"key": "requiredInputFieldsSets", "type": "[[str]]"}, - "entities_filter": {"key": "entitiesFilter", "type": "object"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "base_query": {"key": "baseQuery", "type": "str"}, - "table_query": {"key": "tableQuery", "type": "InsightQueryItemPropertiesTableQuery"}, - "chart_query": {"key": "chartQuery", "type": "object"}, - "additional_query": {"key": "additionalQuery", "type": "InsightQueryItemPropertiesAdditionalQuery"}, - "default_time_range": {"key": "defaultTimeRange", "type": "InsightQueryItemPropertiesDefaultTimeRange"}, - "reference_time_range": {"key": "referenceTimeRange", "type": "InsightQueryItemPropertiesReferenceTimeRange"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "hypothesis_status": {"key": "properties.hypothesisStatus", "type": "str"}, + "attack_tactics": {"key": "properties.attackTactics", "type": "[str]"}, + "attack_techniques": {"key": "properties.attackTechniques", "type": "[str]"}, + "labels": {"key": "properties.labels", "type": "[str]"}, + "owner": {"key": "properties.owner", "type": "HuntOwner"}, } def __init__( self, *, - data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, - input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, - required_input_fields_sets: Optional[List[List[str]]] = None, - entities_filter: Optional[JSON] = None, + etag: Optional[str] = None, display_name: Optional[str] = None, description: Optional[str] = None, - base_query: Optional[str] = None, - table_query: Optional["_models.InsightQueryItemPropertiesTableQuery"] = None, - chart_query: Optional[JSON] = None, - additional_query: Optional["_models.InsightQueryItemPropertiesAdditionalQuery"] = None, - default_time_range: Optional["_models.InsightQueryItemPropertiesDefaultTimeRange"] = None, - reference_time_range: Optional["_models.InsightQueryItemPropertiesReferenceTimeRange"] = None, - **kwargs - ): + status: Optional[Union[str, "_models.Status"]] = None, + hypothesis_status: Union[str, "_models.HypothesisStatus"] = "Unknown", + attack_tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + attack_techniques: Optional[List[str]] = None, + labels: Optional[List[str]] = None, + owner: Optional["_models.HuntOwner"] = None, + **kwargs: Any + ) -> None: """ - :keyword data_types: Data types for template. - :paramtype data_types: - list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", - "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", - "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType - :keyword required_input_fields_sets: Data types for template. - :paramtype required_input_fields_sets: list[list[str]] - :keyword entities_filter: The query applied only to entities matching to all filters. - :paramtype entities_filter: JSON - :keyword display_name: The insight display name. + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword display_name: The display name of the hunt. :paramtype display_name: str - :keyword description: The insight description. + :keyword description: The description of the hunt. :paramtype description: str - :keyword base_query: The base query of the insight. - :paramtype base_query: str - :keyword table_query: The insight table query. - :paramtype table_query: ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQuery - :keyword chart_query: The insight chart query. - :paramtype chart_query: JSON - :keyword additional_query: The activity query definitions. - :paramtype additional_query: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesAdditionalQuery - :keyword default_time_range: The insight chart query. - :paramtype default_time_range: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesDefaultTimeRange - :keyword reference_time_range: The insight chart query. - :paramtype reference_time_range: - ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesReferenceTimeRange + :keyword status: The status of the hunt. Known values are: "New", "Active", "Closed", + "Backlog", "Approved", "Succeeded", "Failed", and "InProgress". + :paramtype status: str or ~azure.mgmt.securityinsight.models.Status + :keyword hypothesis_status: The hypothesis status of the hunt. Known values are: "Unknown", + "Invalidated", and "Validated". + :paramtype hypothesis_status: str or ~azure.mgmt.securityinsight.models.HypothesisStatus + :keyword attack_tactics: A list of mitre attack tactics the hunt is associated with. + :paramtype attack_tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword attack_techniques: A list of a mitre attack techniques the hunt is associated with. + :paramtype attack_techniques: list[str] + :keyword labels: List of labels relevant to this hunt. + :paramtype labels: list[str] + :keyword owner: Describes a user that the hunt is assigned to. + :paramtype owner: ~azure.mgmt.securityinsight.models.HuntOwner """ - super().__init__( - data_types=data_types, - input_entity_type=input_entity_type, - required_input_fields_sets=required_input_fields_sets, - entities_filter=entities_filter, - **kwargs - ) + super().__init__(etag=etag, **kwargs) self.display_name = display_name self.description = description - self.base_query = base_query - self.table_query = table_query - self.chart_query = chart_query - self.additional_query = additional_query - self.default_time_range = default_time_range - self.reference_time_range = reference_time_range + self.status = status + self.hypothesis_status = hypothesis_status + self.attack_tactics = attack_tactics + self.attack_techniques = attack_techniques + self.labels = labels + self.owner = owner -class InsightQueryItemPropertiesAdditionalQuery(_serialization.Model): - """The activity query definitions. +class HuntComment(ResourceWithEtag): + """Represents a Hunt Comment in Azure Security Insights. - :ivar query: The insight query. - :vartype query: str - :ivar text: The insight text. - :vartype text: str + 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar message: The message for the comment. + :vartype message: str """ - _attribute_map = { - "query": {"key": "query", "type": "str"}, - "text": {"key": "text", "type": "str"}, + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } - def __init__(self, *, query: Optional[str] = None, text: Optional[str] = None, **kwargs): - """ - :keyword query: The insight query. - :paramtype query: str - :keyword text: The insight text. - :paramtype text: str - """ - super().__init__(**kwargs) - self.query = query - self.text = text - - -class InsightQueryItemPropertiesDefaultTimeRange(_serialization.Model): - """The insight chart query. - - :ivar before_range: The padding for the start time of the query. - :vartype before_range: str - :ivar after_range: The padding for the end time of the query. - :vartype after_range: str - """ - _attribute_map = { - "before_range": {"key": "beforeRange", "type": "str"}, - "after_range": {"key": "afterRange", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "message": {"key": "properties.message", "type": "str"}, } - def __init__(self, *, before_range: Optional[str] = None, after_range: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword before_range: The padding for the start time of the query. - :paramtype before_range: str - :keyword after_range: The padding for the end time of the query. - :paramtype after_range: str + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword message: The message for the comment. + :paramtype message: str """ - super().__init__(**kwargs) - self.before_range = before_range - self.after_range = after_range + super().__init__(etag=etag, **kwargs) + self.message = message -class InsightQueryItemPropertiesReferenceTimeRange(_serialization.Model): - """The insight chart query. +class HuntCommentList(_serialization.Model): + """List of all hunt comments. - :ivar before_range: Additional query time for looking back. - :vartype before_range: 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 Azure. + + :ivar next_link: URL to fetch the next set of hunt comments. + :vartype next_link: str + :ivar value: Array of hunt comments. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.HuntComment] """ + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + _attribute_map = { - "before_range": {"key": "beforeRange", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[HuntComment]"}, } - def __init__(self, *, before_range: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.HuntComment"], **kwargs: Any) -> None: """ - :keyword before_range: Additional query time for looking back. - :paramtype before_range: str + :keyword value: Array of hunt comments. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.HuntComment] """ super().__init__(**kwargs) - self.before_range = before_range + self.next_link = None + self.value = value -class InsightQueryItemPropertiesTableQuery(_serialization.Model): - """The insight table query. +class HuntingBookmark(Entity): # pylint: disable=too-many-instance-attributes + """Represents a Hunting bookmark entity. - :ivar columns_definitions: List of insight column definitions. - :vartype columns_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem] - :ivar queries_definitions: List of insight queries definitions. - :vartype queries_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar created: The time the bookmark was created. + :vartype created: ~datetime.datetime + :ivar created_by: Describes a user that created the bookmark. + :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar display_name: The display name of the bookmark. + :vartype display_name: str + :ivar event_time: The time of the event. + :vartype event_time: ~datetime.datetime + :ivar labels: List of labels relevant to this bookmark. + :vartype labels: list[str] + :ivar notes: The notes of the bookmark. + :vartype notes: str + :ivar query: The query of the bookmark. + :vartype query: str + :ivar query_result: The query result of the bookmark. + :vartype query_result: str + :ivar updated: The last time the bookmark was updated. + :vartype updated: ~datetime.datetime + :ivar updated_by: Describes a user that updated the bookmark. + :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar incident_info: Describes an incident that relates to bookmark. + :vartype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + } + _attribute_map = { - "columns_definitions": { - "key": "columnsDefinitions", - "type": "[InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem]", - }, - "queries_definitions": { - "key": "queriesDefinitions", - "type": "[InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem]", - }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "created": {"key": "properties.created", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "event_time": {"key": "properties.eventTime", "type": "iso-8601"}, + "labels": {"key": "properties.labels", "type": "[str]"}, + "notes": {"key": "properties.notes", "type": "str"}, + "query": {"key": "properties.query", "type": "str"}, + "query_result": {"key": "properties.queryResult", "type": "str"}, + "updated": {"key": "properties.updated", "type": "iso-8601"}, + "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, + "incident_info": {"key": "properties.incidentInfo", "type": "IncidentInfo"}, } def __init__( self, *, - columns_definitions: Optional[ - List["_models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem"] - ] = None, - queries_definitions: Optional[ - List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem"] - ] = None, - **kwargs - ): + created: Optional[datetime.datetime] = None, + created_by: Optional["_models.UserInfo"] = None, + display_name: Optional[str] = None, + event_time: Optional[datetime.datetime] = None, + labels: Optional[List[str]] = None, + notes: Optional[str] = None, + query: Optional[str] = None, + query_result: Optional[str] = None, + updated: Optional[datetime.datetime] = None, + updated_by: Optional["_models.UserInfo"] = None, + incident_info: Optional["_models.IncidentInfo"] = None, + **kwargs: Any + ) -> None: """ - :keyword columns_definitions: List of insight column definitions. - :paramtype columns_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem] - :keyword queries_definitions: List of insight queries definitions. - :paramtype queries_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem] + :keyword created: The time the bookmark was created. + :paramtype created: ~datetime.datetime + :keyword created_by: Describes a user that created the bookmark. + :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword display_name: The display name of the bookmark. + :paramtype display_name: str + :keyword event_time: The time of the event. + :paramtype event_time: ~datetime.datetime + :keyword labels: List of labels relevant to this bookmark. + :paramtype labels: list[str] + :keyword notes: The notes of the bookmark. + :paramtype notes: str + :keyword query: The query of the bookmark. + :paramtype query: str + :keyword query_result: The query result of the bookmark. + :paramtype query_result: str + :keyword updated: The last time the bookmark was updated. + :paramtype updated: ~datetime.datetime + :keyword updated_by: Describes a user that updated the bookmark. + :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword incident_info: Describes an incident that relates to bookmark. + :paramtype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ super().__init__(**kwargs) - self.columns_definitions = columns_definitions - self.queries_definitions = queries_definitions + self.kind: str = "Bookmark" + self.additional_data = None + self.friendly_name = None + self.created = created + self.created_by = created_by + self.display_name = display_name + self.event_time = event_time + self.labels = labels + self.notes = notes + self.query = query + self.query_result = query_result + self.updated = updated + self.updated_by = updated_by + self.incident_info = incident_info -class InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem(_serialization.Model): - """InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem. +class HuntingBookmarkProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """Describes bookmark properties. - :ivar header: Insight column header. - :vartype header: str - :ivar output_type: Insights Column type. Known values are: "Number", "String", "Date", and - "Entity". - :vartype output_type: str or ~azure.mgmt.securityinsight.models.OutputType - :ivar support_deep_link: Is query supports deep-link. - :vartype support_deep_link: bool - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "header": {"key": "header", "type": "str"}, - "output_type": {"key": "outputType", "type": "str"}, - "support_deep_link": {"key": "supportDeepLink", "type": "bool"}, - } - - def __init__( - self, - *, - header: Optional[str] = None, - output_type: Optional[Union[str, "_models.OutputType"]] = None, - support_deep_link: Optional[bool] = None, - **kwargs - ): - """ - :keyword header: Insight column header. - :paramtype header: str - :keyword output_type: Insights Column type. Known values are: "Number", "String", "Date", and - "Entity". - :paramtype output_type: str or ~azure.mgmt.securityinsight.models.OutputType - :keyword support_deep_link: Is query supports deep-link. - :paramtype support_deep_link: bool - """ - super().__init__(**kwargs) - self.header = header - self.output_type = output_type - self.support_deep_link = support_deep_link - - -class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem(_serialization.Model): - """InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem. + All required parameters must be populated in order to send to Azure. - :ivar filter: Insight column header. - :vartype filter: str - :ivar summarize: Insight column header. - :vartype summarize: str - :ivar project: Insight column header. - :vartype project: str - :ivar link_columns_definitions: Insight column header. - :vartype link_columns_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem] + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar created: The time the bookmark was created. + :vartype created: ~datetime.datetime + :ivar created_by: Describes a user that created the bookmark. + :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar display_name: The display name of the bookmark. Required. + :vartype display_name: str + :ivar event_time: The time of the event. + :vartype event_time: ~datetime.datetime + :ivar labels: List of labels relevant to this bookmark. + :vartype labels: list[str] + :ivar notes: The notes of the bookmark. + :vartype notes: str + :ivar query: The query of the bookmark. Required. + :vartype query: str + :ivar query_result: The query result of the bookmark. + :vartype query_result: str + :ivar updated: The last time the bookmark was updated. + :vartype updated: ~datetime.datetime + :ivar updated_by: Describes a user that updated the bookmark. + :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar incident_info: Describes an incident that relates to bookmark. + :vartype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "display_name": {"required": True}, + "query": {"required": True}, + } + _attribute_map = { - "filter": {"key": "filter", "type": "str"}, - "summarize": {"key": "summarize", "type": "str"}, - "project": {"key": "project", "type": "str"}, - "link_columns_definitions": { - "key": "linkColumnsDefinitions", - "type": "[InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem]", - }, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "created": {"key": "created", "type": "iso-8601"}, + "created_by": {"key": "createdBy", "type": "UserInfo"}, + "display_name": {"key": "displayName", "type": "str"}, + "event_time": {"key": "eventTime", "type": "iso-8601"}, + "labels": {"key": "labels", "type": "[str]"}, + "notes": {"key": "notes", "type": "str"}, + "query": {"key": "query", "type": "str"}, + "query_result": {"key": "queryResult", "type": "str"}, + "updated": {"key": "updated", "type": "iso-8601"}, + "updated_by": {"key": "updatedBy", "type": "UserInfo"}, + "incident_info": {"key": "incidentInfo", "type": "IncidentInfo"}, } def __init__( self, *, - filter: Optional[str] = None, # pylint: disable=redefined-builtin - summarize: Optional[str] = None, - project: Optional[str] = None, - link_columns_definitions: Optional[ - List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem"] - ] = None, - **kwargs - ): + display_name: str, + query: str, + created: Optional[datetime.datetime] = None, + created_by: Optional["_models.UserInfo"] = None, + event_time: Optional[datetime.datetime] = None, + labels: Optional[List[str]] = None, + notes: Optional[str] = None, + query_result: Optional[str] = None, + updated: Optional[datetime.datetime] = None, + updated_by: Optional["_models.UserInfo"] = None, + incident_info: Optional["_models.IncidentInfo"] = None, + **kwargs: Any + ) -> None: """ - :keyword filter: Insight column header. - :paramtype filter: str - :keyword summarize: Insight column header. - :paramtype summarize: str - :keyword project: Insight column header. - :paramtype project: str - :keyword link_columns_definitions: Insight column header. - :paramtype link_columns_definitions: - list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem] + :keyword created: The time the bookmark was created. + :paramtype created: ~datetime.datetime + :keyword created_by: Describes a user that created the bookmark. + :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword display_name: The display name of the bookmark. Required. + :paramtype display_name: str + :keyword event_time: The time of the event. + :paramtype event_time: ~datetime.datetime + :keyword labels: List of labels relevant to this bookmark. + :paramtype labels: list[str] + :keyword notes: The notes of the bookmark. + :paramtype notes: str + :keyword query: The query of the bookmark. Required. + :paramtype query: str + :keyword query_result: The query result of the bookmark. + :paramtype query_result: str + :keyword updated: The last time the bookmark was updated. + :paramtype updated: ~datetime.datetime + :keyword updated_by: Describes a user that updated the bookmark. + :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword incident_info: Describes an incident that relates to bookmark. + :paramtype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ super().__init__(**kwargs) - self.filter = filter - self.summarize = summarize - self.project = project - self.link_columns_definitions = link_columns_definitions + self.created = created + self.created_by = created_by + self.display_name = display_name + self.event_time = event_time + self.labels = labels + self.notes = notes + self.query = query + self.query_result = query_result + self.updated = updated + self.updated_by = updated_by + self.incident_info = incident_info -class InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem(_serialization.Model): - """InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem. +class HuntList(_serialization.Model): + """List all the hunts. - :ivar projected_name: Insight Link Definition Projected Name. - :vartype projected_name: str - :ivar query: Insight Link Definition Query. - :vartype query: 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 Azure. + + :ivar next_link: URL to fetch the next set of hunts. + :vartype next_link: str + :ivar value: Array of hunts. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Hunt] """ + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + _attribute_map = { - "projected_name": {"key": "projectedName", "type": "str"}, - "query": {"key": "Query", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Hunt]"}, } - def __init__(self, *, projected_name: Optional[str] = None, query: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Hunt"], **kwargs: Any) -> None: """ - :keyword projected_name: Insight Link Definition Projected Name. - :paramtype projected_name: str - :keyword query: Insight Link Definition Query. - :paramtype query: str + :keyword value: Array of hunts. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Hunt] """ super().__init__(**kwargs) - self.projected_name = projected_name - self.query = query + self.next_link = None + self.value = value -class InsightsTableResult(_serialization.Model): - """Query results for table insights query. +class HuntOwner(_serialization.Model): + """Describes a user that the hunt is assigned to. - :ivar columns: Columns Metadata of the table. - :vartype columns: list[~azure.mgmt.securityinsight.models.InsightsTableResultColumnsItem] - :ivar rows: Rows data of the table. - :vartype rows: list[list[str]] + :ivar email: The email of the user the hunt is assigned to. + :vartype email: str + :ivar assigned_to: The name of the user the hunt is assigned to. + :vartype assigned_to: str + :ivar object_id: The object id of the user the hunt is assigned to. + :vartype object_id: str + :ivar user_principal_name: The user principal name of the user the hunt is assigned to. + :vartype user_principal_name: str + :ivar owner_type: The type of the owner the hunt is assigned to. Known values are: "Unknown", + "User", and "Group". + :vartype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType """ _attribute_map = { - "columns": {"key": "columns", "type": "[InsightsTableResultColumnsItem]"}, - "rows": {"key": "rows", "type": "[[str]]"}, + "email": {"key": "email", "type": "str"}, + "assigned_to": {"key": "assignedTo", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "user_principal_name": {"key": "userPrincipalName", "type": "str"}, + "owner_type": {"key": "ownerType", "type": "str"}, } def __init__( self, *, - columns: Optional[List["_models.InsightsTableResultColumnsItem"]] = None, - rows: Optional[List[List[str]]] = None, - **kwargs - ): + email: Optional[str] = None, + assigned_to: Optional[str] = None, + object_id: Optional[str] = None, + user_principal_name: Optional[str] = None, + owner_type: Optional[Union[str, "_models.OwnerType"]] = None, + **kwargs: Any + ) -> None: """ - :keyword columns: Columns Metadata of the table. - :paramtype columns: list[~azure.mgmt.securityinsight.models.InsightsTableResultColumnsItem] - :keyword rows: Rows data of the table. - :paramtype rows: list[list[str]] + :keyword email: The email of the user the hunt is assigned to. + :paramtype email: str + :keyword assigned_to: The name of the user the hunt is assigned to. + :paramtype assigned_to: str + :keyword object_id: The object id of the user the hunt is assigned to. + :paramtype object_id: str + :keyword user_principal_name: The user principal name of the user the hunt is assigned to. + :paramtype user_principal_name: str + :keyword owner_type: The type of the owner the hunt is assigned to. Known values are: + "Unknown", "User", and "Group". + :paramtype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType """ super().__init__(**kwargs) - self.columns = columns - self.rows = rows + self.email = email + self.assigned_to = assigned_to + self.object_id = object_id + self.user_principal_name = user_principal_name + self.owner_type = owner_type -class InsightsTableResultColumnsItem(_serialization.Model): - """InsightsTableResultColumnsItem. +class HuntRelation(ResourceWithEtag): + """Represents a Hunt Relation in Azure Security Insights. - :ivar type: the type of the colum. - :vartype type: str - :ivar name: the name of the colum. + 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 - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): - """ - :keyword type: the type of the colum. - :paramtype type: str - :keyword name: the name of the colum. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class Instructions(_serialization.Model): - """Instructions section of a recommendation. - - All required parameters must be populated in order to send to Azure. - - :ivar actions_to_be_performed: What actions should be taken to complete the recommendation. - Required. - :vartype actions_to_be_performed: str - :ivar recommendation_importance: Explains why the recommendation is important. Required. - :vartype recommendation_importance: str - :ivar how_to_perform_action_details: How should the user complete the recommendation. - :vartype how_to_perform_action_details: 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar related_resource_id: The id of the related resource. + :vartype related_resource_id: str + :ivar related_resource_name: The name of the related resource. + :vartype related_resource_name: str + :ivar relation_type: The type of the hunt relation. + :vartype relation_type: str + :ivar related_resource_kind: The resource that the relation is related to. + :vartype related_resource_kind: str + :ivar labels: List of labels relevant to this hunt. + :vartype labels: list[str] """ _validation = { - "actions_to_be_performed": {"required": True}, - "recommendation_importance": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "related_resource_name": {"readonly": True}, + "relation_type": {"readonly": True}, + "related_resource_kind": {"readonly": True}, } _attribute_map = { - "actions_to_be_performed": {"key": "actionsToBePerformed", "type": "str"}, - "recommendation_importance": {"key": "recommendationImportance", "type": "str"}, - "how_to_perform_action_details": {"key": "howToPerformActionDetails", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "related_resource_id": {"key": "properties.relatedResourceId", "type": "str"}, + "related_resource_name": {"key": "properties.relatedResourceName", "type": "str"}, + "relation_type": {"key": "properties.relationType", "type": "str"}, + "related_resource_kind": {"key": "properties.relatedResourceKind", "type": "str"}, + "labels": {"key": "properties.labels", "type": "[str]"}, } def __init__( self, *, - actions_to_be_performed: str, - recommendation_importance: str, - how_to_perform_action_details: Optional[str] = None, - **kwargs - ): + etag: Optional[str] = None, + related_resource_id: Optional[str] = None, + labels: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword actions_to_be_performed: What actions should be taken to complete the recommendation. - Required. - :paramtype actions_to_be_performed: str - :keyword recommendation_importance: Explains why the recommendation is important. Required. - :paramtype recommendation_importance: str - :keyword how_to_perform_action_details: How should the user complete the recommendation. - :paramtype how_to_perform_action_details: str + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword related_resource_id: The id of the related resource. + :paramtype related_resource_id: str + :keyword labels: List of labels relevant to this hunt. + :paramtype labels: list[str] """ - super().__init__(**kwargs) - self.actions_to_be_performed = actions_to_be_performed - self.recommendation_importance = recommendation_importance - self.how_to_perform_action_details = how_to_perform_action_details - - -class InstructionStepsInstructionsItem(ConnectorInstructionModelBase): - """InstructionStepsInstructionsItem. - - All required parameters must be populated in order to send to Azure. - - :ivar parameters: The parameters for the setting. - :vartype parameters: JSON - :ivar type: The kind of the setting. Required. Known values are: "CopyableLabel", - "InstructionStepsGroup", and "InfoMessage". - :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "parameters": {"key": "parameters", "type": "object"}, - "type": {"key": "type", "type": "str"}, - } + super().__init__(etag=etag, **kwargs) + self.related_resource_id = related_resource_id + self.related_resource_name = None + self.relation_type = None + self.related_resource_kind = None + self.labels = labels - def __init__(self, *, type: Union[str, "_models.SettingType"], parameters: Optional[JSON] = None, **kwargs): - """ - :keyword parameters: The parameters for the setting. - :paramtype parameters: JSON - :keyword type: The kind of the setting. Required. Known values are: "CopyableLabel", - "InstructionStepsGroup", and "InfoMessage". - :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType - """ - super().__init__(parameters=parameters, type=type, **kwargs) +class HuntRelationList(_serialization.Model): + """List of all the hunt relations. -class IoTCheckRequirements(DataConnectorsCheckRequirements): - """Represents IoT requirements check request. + 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 kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar subscription_id: The subscription id to connect to, and get the data from. - :vartype subscription_id: str + :ivar next_link: URL to fetch the next set of hunt relations. + :vartype next_link: str + :ivar value: Array of hunt relations. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.HuntRelation] """ _validation = { - "kind": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[HuntRelation]"}, } - def __init__(self, *, subscription_id: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.HuntRelation"], **kwargs: Any) -> None: """ - :keyword subscription_id: The subscription id to connect to, and get the data from. - :paramtype subscription_id: str + :keyword value: Array of hunt relations. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.HuntRelation] """ super().__init__(**kwargs) - self.kind: str = "IOT" - self.subscription_id = subscription_id + self.next_link = None + self.value = value -class IoTDataConnector(DataConnector): - """Represents IoT data connector. +class Incident(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Incident. 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 @@ -11545,18 +11724,52 @@ class IoTDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :ivar subscription_id: The subscription id to connect to, and get the data from. - :vartype subscription_id: str + :ivar title: The title of the incident. + :vartype title: str + :ivar description: The description of the incident. + :vartype description: str + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :ivar status: The status of the incident. Known values are: "New", "Active", and "Closed". + :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :ivar classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", and "FalsePositive". + :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :ivar classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and + "InaccurateData". + :vartype classification_reason: str or + ~azure.mgmt.securityinsight.models.IncidentClassificationReason + :ivar classification_comment: Describes the reason the incident was closed. + :vartype classification_comment: str + :ivar owner: Describes a user that the incident is assigned to. + :vartype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :ivar labels: List of labels relevant to this incident. + :vartype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :ivar first_activity_time_utc: The time of the first activity in the incident. + :vartype first_activity_time_utc: ~datetime.datetime + :ivar last_activity_time_utc: The time of the last activity in the incident. + :vartype last_activity_time_utc: ~datetime.datetime + :ivar last_modified_time_utc: The last time the incident was updated. + :vartype last_modified_time_utc: ~datetime.datetime + :ivar created_time_utc: The time the incident was created. + :vartype created_time_utc: ~datetime.datetime + :ivar incident_number: A sequential number. + :vartype incident_number: int + :ivar additional_data: Additional data on the incident. + :vartype additional_data: ~azure.mgmt.securityinsight.models.IncidentAdditionalData + :ivar related_analytic_rule_ids: List of resource ids of Analytic rules related to the + incident. + :vartype related_analytic_rule_ids: list[str] + :ivar incident_url: The deep-link url to the incident in Azure portal. + :vartype incident_url: str + :ivar provider_name: The name of the source provider that generated the incident. + :vartype provider_name: str + :ivar provider_incident_id: The incident ID assigned by the incident provider. + :vartype provider_incident_id: str + :ivar team_information: Describes a team for the incident. + :vartype team_information: ~azure.mgmt.securityinsight.models.TeamInformation """ _validation = { @@ -11564,7 +11777,14 @@ class IoTDataConnector(DataConnector): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, + "last_modified_time_utc": {"readonly": True}, + "created_time_utc": {"readonly": True}, + "incident_number": {"readonly": True}, + "additional_data": {"readonly": True}, + "related_analytic_rule_ids": {"readonly": True}, + "incident_url": {"readonly": True}, + "provider_name": {"readonly": True}, + "provider_incident_id": {"readonly": True}, } _attribute_map = { @@ -11573,71 +11793,213 @@ class IoTDataConnector(DataConnector): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, - "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, + "title": {"key": "properties.title", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "severity": {"key": "properties.severity", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "classification": {"key": "properties.classification", "type": "str"}, + "classification_reason": {"key": "properties.classificationReason", "type": "str"}, + "classification_comment": {"key": "properties.classificationComment", "type": "str"}, + "owner": {"key": "properties.owner", "type": "IncidentOwnerInfo"}, + "labels": {"key": "properties.labels", "type": "[IncidentLabel]"}, + "first_activity_time_utc": {"key": "properties.firstActivityTimeUtc", "type": "iso-8601"}, + "last_activity_time_utc": {"key": "properties.lastActivityTimeUtc", "type": "iso-8601"}, + "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, + "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, + "incident_number": {"key": "properties.incidentNumber", "type": "int"}, + "additional_data": {"key": "properties.additionalData", "type": "IncidentAdditionalData"}, + "related_analytic_rule_ids": {"key": "properties.relatedAnalyticRuleIds", "type": "[str]"}, + "incident_url": {"key": "properties.incidentUrl", "type": "str"}, + "provider_name": {"key": "properties.providerName", "type": "str"}, + "provider_incident_id": {"key": "properties.providerIncidentId", "type": "str"}, + "team_information": {"key": "properties.teamInformation", "type": "TeamInformation"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, etag: Optional[str] = None, - data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - subscription_id: Optional[str] = None, - **kwargs - ): + title: Optional[str] = None, + description: Optional[str] = None, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, + status: Optional[Union[str, "_models.IncidentStatus"]] = None, + classification: Optional[Union[str, "_models.IncidentClassification"]] = None, + classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, + classification_comment: Optional[str] = None, + owner: Optional["_models.IncidentOwnerInfo"] = None, + labels: Optional[List["_models.IncidentLabel"]] = None, + first_activity_time_utc: Optional[datetime.datetime] = None, + last_activity_time_utc: Optional[datetime.datetime] = None, + team_information: Optional["_models.TeamInformation"] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :keyword subscription_id: The subscription id to connect to, and get the data from. - :paramtype subscription_id: str - """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "IOT" - self.data_types = data_types - self.subscription_id = subscription_id - - -class IoTDataConnectorProperties(DataConnectorWithAlertsProperties): - """IoT data connector properties. - - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :ivar subscription_id: The subscription id to connect to, and get the data from. - :vartype subscription_id: str - """ - - _attribute_map = { - "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - } - - def __init__( - self, - *, - data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - subscription_id: Optional[str] = None, - **kwargs - ): - """ - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :keyword subscription_id: The subscription id to connect to, and get the data from. - :paramtype subscription_id: str + :keyword title: The title of the incident. + :paramtype title: str + :keyword description: The description of the incident. + :paramtype description: str + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :keyword status: The status of the incident. Known values are: "New", "Active", and "Closed". + :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :keyword classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", and "FalsePositive". + :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :keyword classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and + "InaccurateData". + :paramtype classification_reason: str or + ~azure.mgmt.securityinsight.models.IncidentClassificationReason + :keyword classification_comment: Describes the reason the incident was closed. + :paramtype classification_comment: str + :keyword owner: Describes a user that the incident is assigned to. + :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :keyword labels: List of labels relevant to this incident. + :paramtype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :keyword first_activity_time_utc: The time of the first activity in the incident. + :paramtype first_activity_time_utc: ~datetime.datetime + :keyword last_activity_time_utc: The time of the last activity in the incident. + :paramtype last_activity_time_utc: ~datetime.datetime + :keyword team_information: Describes a team for the incident. + :paramtype team_information: ~azure.mgmt.securityinsight.models.TeamInformation """ - super().__init__(data_types=data_types, **kwargs) - self.subscription_id = subscription_id + super().__init__(etag=etag, **kwargs) + self.title = title + self.description = description + self.severity = severity + self.status = status + self.classification = classification + self.classification_reason = classification_reason + self.classification_comment = classification_comment + self.owner = owner + self.labels = labels + self.first_activity_time_utc = first_activity_time_utc + self.last_activity_time_utc = last_activity_time_utc + self.last_modified_time_utc = None + self.created_time_utc = None + self.incident_number = None + self.additional_data = None + self.related_analytic_rule_ids = None + self.incident_url = None + self.provider_name = None + self.provider_incident_id = None + self.team_information = team_information -class IoTDeviceEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents an IoT device entity. +class IncidentAdditionalData(_serialization.Model): + """Incident additional data property bag. Variables are only populated by the server, and will be ignored when sending a request. + :ivar alerts_count: The number of alerts in the incident. + :vartype alerts_count: int + :ivar bookmarks_count: The number of bookmarks in the incident. + :vartype bookmarks_count: int + :ivar comments_count: The number of comments in the incident. + :vartype comments_count: int + :ivar alert_product_names: List of product names of alerts in the incident. + :vartype alert_product_names: list[str] + :ivar tactics: The tactics associated with incident. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques associated with incident's tactics. + :vartype techniques: list[str] + :ivar provider_incident_url: The provider incident url to the incident in Microsoft 365 + Defender portal. + :vartype provider_incident_url: str + """ + + _validation = { + "alerts_count": {"readonly": True}, + "bookmarks_count": {"readonly": True}, + "comments_count": {"readonly": True}, + "alert_product_names": {"readonly": True}, + "tactics": {"readonly": True}, + "techniques": {"readonly": True}, + "provider_incident_url": {"readonly": True}, + } + + _attribute_map = { + "alerts_count": {"key": "alertsCount", "type": "int"}, + "bookmarks_count": {"key": "bookmarksCount", "type": "int"}, + "comments_count": {"key": "commentsCount", "type": "int"}, + "alert_product_names": {"key": "alertProductNames", "type": "[str]"}, + "tactics": {"key": "tactics", "type": "[str]"}, + "techniques": {"key": "techniques", "type": "[str]"}, + "provider_incident_url": {"key": "providerIncidentUrl", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.alerts_count = None + self.bookmarks_count = None + self.comments_count = None + self.alert_product_names = None + self.tactics = None + self.techniques = None + self.provider_incident_url = None + + +class IncidentAlertList(_serialization.Model): + """List of incident alerts. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Array of incident alerts. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.SecurityAlert] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SecurityAlert]"}, + } + + def __init__(self, *, value: List["_models.SecurityAlert"], **kwargs: Any) -> None: + """ + :keyword value: Array of incident alerts. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.SecurityAlert] + """ + super().__init__(**kwargs) + self.value = value + + +class IncidentBookmarkList(_serialization.Model): + """List of incident bookmarks. + All required parameters must be populated in order to send to Azure. + :ivar value: Array of incident bookmarks. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.HuntingBookmark] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[HuntingBookmark]"}, + } + + def __init__(self, *, value: List["_models.HuntingBookmark"], **kwargs: Any) -> None: + """ + :keyword value: Array of incident bookmarks. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.HuntingBookmark] + """ + super().__init__(**kwargs) + self.value = value + + +class IncidentComment(ResourceWithEtag): + """Represents an incident comment. + + 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 @@ -11649,74 +12011,16 @@ class IoTDeviceEntity(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar device_id: The ID of the IoT Device in the IoT Hub. - :vartype device_id: str - :ivar device_name: The friendly name of the device. - :vartype device_name: str - :ivar source: The source of the device. - :vartype source: str - :ivar iot_security_agent_id: The ID of the security agent running on the device. - :vartype iot_security_agent_id: str - :ivar device_type: The type of the device. - :vartype device_type: str - :ivar vendor: The vendor of the device. - :vartype vendor: str - :ivar edge_id: The ID of the edge device. - :vartype edge_id: str - :ivar mac_address: The MAC address of the device. - :vartype mac_address: str - :ivar model: The model of the device. - :vartype model: str - :ivar serial_number: The serial number of the device. - :vartype serial_number: str - :ivar firmware_version: The firmware version of the device. - :vartype firmware_version: str - :ivar operating_system: The operating system of the device. - :vartype operating_system: str - :ivar iot_hub_entity_id: The AzureResource entity id of the IoT Hub. - :vartype iot_hub_entity_id: str - :ivar host_entity_id: The Host entity id of this device. - :vartype host_entity_id: str - :ivar ip_address_entity_id: The IP entity if of this device. - :vartype ip_address_entity_id: str - :ivar threat_intelligence: A list of TI contexts attached to the IoTDevice entity. - :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] - :ivar protocols: A list of protocols of the IoTDevice entity. - :vartype protocols: list[str] - :ivar owners: A list of owners of the IoTDevice entity. - :vartype owners: list[str] - :ivar nic_entity_ids: A list of Nic entity ids of the IoTDevice entity. - :vartype nic_entity_ids: list[str] - :ivar site: The site of the device. - :vartype site: str - :ivar zone: The zone location of the device within a site. - :vartype zone: str - :ivar sensor: The sensor the device is monitored by. - :vartype sensor: str - :ivar device_sub_type: The subType of the device ('PLC', 'HMI', 'EWS', etc.). - :vartype device_sub_type: str - :ivar importance: Device importance, determines if the device classified as 'crown jewel'. - Known values are: "Unknown", "Low", "Normal", and "High". - :vartype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance - :ivar purdue_layer: The Purdue Layer of the device. - :vartype purdue_layer: str - :ivar is_authorized: Determines whether the device classified as authorized device. - :vartype is_authorized: bool - :ivar is_programming: Determines whether the device classified as programming device. - :vartype is_programming: bool - :ivar is_scanner: Is the device classified as a scanner device. - :vartype is_scanner: bool + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar message: The comment message. + :vartype message: str + :ivar created_time_utc: The time the comment was created. + :vartype created_time_utc: ~datetime.datetime + :ivar last_modified_time_utc: The time the comment was updated. + :vartype last_modified_time_utc: ~datetime.datetime + :ivar author: Describes the client that created the comment. + :vartype author: ~azure.mgmt.securityinsight.models.ClientInfo """ _validation = { @@ -11724,36 +12028,9 @@ class IoTDeviceEntity(Entity): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "device_id": {"readonly": True}, - "device_name": {"readonly": True}, - "source": {"readonly": True}, - "iot_security_agent_id": {"readonly": True}, - "device_type": {"readonly": True}, - "vendor": {"readonly": True}, - "edge_id": {"readonly": True}, - "mac_address": {"readonly": True}, - "model": {"readonly": True}, - "serial_number": {"readonly": True}, - "firmware_version": {"readonly": True}, - "operating_system": {"readonly": True}, - "iot_hub_entity_id": {"readonly": True}, - "host_entity_id": {"readonly": True}, - "ip_address_entity_id": {"readonly": True}, - "threat_intelligence": {"readonly": True}, - "protocols": {"readonly": True}, - "owners": {"readonly": True}, - "nic_entity_ids": {"readonly": True}, - "site": {"readonly": True}, - "zone": {"readonly": True}, - "sensor": {"readonly": True}, - "device_sub_type": {"readonly": True}, - "purdue_layer": {"readonly": True}, - "is_authorized": {"readonly": True}, - "is_programming": {"readonly": True}, - "is_scanner": {"readonly": True}, + "created_time_utc": {"readonly": True}, + "last_modified_time_utc": {"readonly": True}, + "author": {"readonly": True}, } _attribute_map = { @@ -11761,742 +12038,424 @@ class IoTDeviceEntity(Entity): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "device_id": {"key": "properties.deviceId", "type": "str"}, - "device_name": {"key": "properties.deviceName", "type": "str"}, - "source": {"key": "properties.source", "type": "str"}, - "iot_security_agent_id": {"key": "properties.iotSecurityAgentId", "type": "str"}, - "device_type": {"key": "properties.deviceType", "type": "str"}, - "vendor": {"key": "properties.vendor", "type": "str"}, - "edge_id": {"key": "properties.edgeId", "type": "str"}, - "mac_address": {"key": "properties.macAddress", "type": "str"}, - "model": {"key": "properties.model", "type": "str"}, - "serial_number": {"key": "properties.serialNumber", "type": "str"}, - "firmware_version": {"key": "properties.firmwareVersion", "type": "str"}, - "operating_system": {"key": "properties.operatingSystem", "type": "str"}, - "iot_hub_entity_id": {"key": "properties.iotHubEntityId", "type": "str"}, - "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, - "ip_address_entity_id": {"key": "properties.ipAddressEntityId", "type": "str"}, - "threat_intelligence": {"key": "properties.threatIntelligence", "type": "[ThreatIntelligence]"}, - "protocols": {"key": "properties.protocols", "type": "[str]"}, - "owners": {"key": "properties.owners", "type": "[str]"}, - "nic_entity_ids": {"key": "properties.nicEntityIds", "type": "[str]"}, - "site": {"key": "properties.site", "type": "str"}, - "zone": {"key": "properties.zone", "type": "str"}, - "sensor": {"key": "properties.sensor", "type": "str"}, - "device_sub_type": {"key": "properties.deviceSubType", "type": "str"}, - "importance": {"key": "properties.importance", "type": "str"}, - "purdue_layer": {"key": "properties.purdueLayer", "type": "str"}, - "is_authorized": {"key": "properties.isAuthorized", "type": "bool"}, - "is_programming": {"key": "properties.isProgramming", "type": "bool"}, - "is_scanner": {"key": "properties.isScanner", "type": "bool"}, + "etag": {"key": "etag", "type": "str"}, + "message": {"key": "properties.message", "type": "str"}, + "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, + "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, + "author": {"key": "properties.author", "type": "ClientInfo"}, } - def __init__( # pylint: disable=too-many-locals - self, *, importance: Optional[Union[str, "_models.DeviceImportance"]] = None, **kwargs - ): + def __init__(self, *, etag: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword importance: Device importance, determines if the device classified as 'crown jewel'. - Known values are: "Unknown", "Low", "Normal", and "High". - :paramtype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword message: The comment message. + :paramtype message: str """ - super().__init__(**kwargs) - self.kind: str = "IoTDevice" - self.additional_data = None - self.friendly_name = None - self.device_id = None - self.device_name = None - self.source = None - self.iot_security_agent_id = None - self.device_type = None - self.vendor = None - self.edge_id = None - self.mac_address = None - self.model = None - self.serial_number = None - self.firmware_version = None - self.operating_system = None - self.iot_hub_entity_id = None - self.host_entity_id = None - self.ip_address_entity_id = None - self.threat_intelligence = None - self.protocols = None - self.owners = None - self.nic_entity_ids = None - self.site = None - self.zone = None - self.sensor = None - self.device_sub_type = None - self.importance = importance - self.purdue_layer = None - self.is_authorized = None - self.is_programming = None - self.is_scanner = None + super().__init__(etag=etag, **kwargs) + self.message = message + self.created_time_utc = None + self.last_modified_time_utc = None + self.author = None -class IoTDeviceEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """IoTDevice entity property bag. +class IncidentCommentList(_serialization.Model): + """IncidentCommentList. Variables are only populated by the server, and will be ignored when sending a request. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar device_id: The ID of the IoT Device in the IoT Hub. - :vartype device_id: str - :ivar device_name: The friendly name of the device. - :vartype device_name: str - :ivar source: The source of the device. - :vartype source: str - :ivar iot_security_agent_id: The ID of the security agent running on the device. - :vartype iot_security_agent_id: str - :ivar device_type: The type of the device. - :vartype device_type: str - :ivar vendor: The vendor of the device. - :vartype vendor: str - :ivar edge_id: The ID of the edge device. - :vartype edge_id: str - :ivar mac_address: The MAC address of the device. - :vartype mac_address: str - :ivar model: The model of the device. - :vartype model: str - :ivar serial_number: The serial number of the device. - :vartype serial_number: str - :ivar firmware_version: The firmware version of the device. - :vartype firmware_version: str - :ivar operating_system: The operating system of the device. - :vartype operating_system: str - :ivar iot_hub_entity_id: The AzureResource entity id of the IoT Hub. - :vartype iot_hub_entity_id: str - :ivar host_entity_id: The Host entity id of this device. - :vartype host_entity_id: str - :ivar ip_address_entity_id: The IP entity if of this device. - :vartype ip_address_entity_id: str - :ivar threat_intelligence: A list of TI contexts attached to the IoTDevice entity. - :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] - :ivar protocols: A list of protocols of the IoTDevice entity. - :vartype protocols: list[str] - :ivar owners: A list of owners of the IoTDevice entity. - :vartype owners: list[str] - :ivar nic_entity_ids: A list of Nic entity ids of the IoTDevice entity. - :vartype nic_entity_ids: list[str] - :ivar site: The site of the device. - :vartype site: str - :ivar zone: The zone location of the device within a site. - :vartype zone: str - :ivar sensor: The sensor the device is monitored by. - :vartype sensor: str - :ivar device_sub_type: The subType of the device ('PLC', 'HMI', 'EWS', etc.). - :vartype device_sub_type: str - :ivar importance: Device importance, determines if the device classified as 'crown jewel'. - Known values are: "Unknown", "Low", "Normal", and "High". - :vartype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance - :ivar purdue_layer: The Purdue Layer of the device. - :vartype purdue_layer: str - :ivar is_authorized: Determines whether the device classified as authorized device. - :vartype is_authorized: bool - :ivar is_programming: Determines whether the device classified as programming device. - :vartype is_programming: bool - :ivar is_scanner: Is the device classified as a scanner device. - :vartype is_scanner: bool + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. + :vartype value: list[~azure.mgmt.securityinsight.models.IncidentComment] + :ivar next_link: + :vartype next_link: str """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "device_id": {"readonly": True}, - "device_name": {"readonly": True}, - "source": {"readonly": True}, - "iot_security_agent_id": {"readonly": True}, - "device_type": {"readonly": True}, - "vendor": {"readonly": True}, - "edge_id": {"readonly": True}, - "mac_address": {"readonly": True}, - "model": {"readonly": True}, - "serial_number": {"readonly": True}, - "firmware_version": {"readonly": True}, - "operating_system": {"readonly": True}, - "iot_hub_entity_id": {"readonly": True}, - "host_entity_id": {"readonly": True}, - "ip_address_entity_id": {"readonly": True}, - "threat_intelligence": {"readonly": True}, - "protocols": {"readonly": True}, - "owners": {"readonly": True}, - "nic_entity_ids": {"readonly": True}, - "site": {"readonly": True}, - "zone": {"readonly": True}, - "sensor": {"readonly": True}, - "device_sub_type": {"readonly": True}, - "purdue_layer": {"readonly": True}, - "is_authorized": {"readonly": True}, - "is_programming": {"readonly": True}, - "is_scanner": {"readonly": True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "device_id": {"key": "deviceId", "type": "str"}, - "device_name": {"key": "deviceName", "type": "str"}, - "source": {"key": "source", "type": "str"}, - "iot_security_agent_id": {"key": "iotSecurityAgentId", "type": "str"}, - "device_type": {"key": "deviceType", "type": "str"}, - "vendor": {"key": "vendor", "type": "str"}, - "edge_id": {"key": "edgeId", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "model": {"key": "model", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "str"}, - "firmware_version": {"key": "firmwareVersion", "type": "str"}, - "operating_system": {"key": "operatingSystem", "type": "str"}, - "iot_hub_entity_id": {"key": "iotHubEntityId", "type": "str"}, - "host_entity_id": {"key": "hostEntityId", "type": "str"}, - "ip_address_entity_id": {"key": "ipAddressEntityId", "type": "str"}, - "threat_intelligence": {"key": "threatIntelligence", "type": "[ThreatIntelligence]"}, - "protocols": {"key": "protocols", "type": "[str]"}, - "owners": {"key": "owners", "type": "[str]"}, - "nic_entity_ids": {"key": "nicEntityIds", "type": "[str]"}, - "site": {"key": "site", "type": "str"}, - "zone": {"key": "zone", "type": "str"}, - "sensor": {"key": "sensor", "type": "str"}, - "device_sub_type": {"key": "deviceSubType", "type": "str"}, - "importance": {"key": "importance", "type": "str"}, - "purdue_layer": {"key": "purdueLayer", "type": "str"}, - "is_authorized": {"key": "isAuthorized", "type": "bool"}, - "is_programming": {"key": "isProgramming", "type": "bool"}, - "is_scanner": {"key": "isScanner", "type": "bool"}, + "value": {"key": "value", "type": "[IncidentComment]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals - self, *, importance: Optional[Union[str, "_models.DeviceImportance"]] = None, **kwargs - ): + def __init__(self, *, value: List["_models.IncidentComment"], **kwargs: Any) -> None: """ - :keyword importance: Device importance, determines if the device classified as 'crown jewel'. - Known values are: "Unknown", "Low", "Normal", and "High". - :paramtype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance + :keyword value: Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.IncidentComment] """ super().__init__(**kwargs) - self.device_id = None - self.device_name = None - self.source = None - self.iot_security_agent_id = None - self.device_type = None - self.vendor = None - self.edge_id = None - self.mac_address = None - self.model = None - self.serial_number = None - self.firmware_version = None - self.operating_system = None - self.iot_hub_entity_id = None - self.host_entity_id = None - self.ip_address_entity_id = None - self.threat_intelligence = None - self.protocols = None - self.owners = None - self.nic_entity_ids = None - self.site = None - self.zone = None - self.sensor = None - self.device_sub_type = None - self.importance = importance - self.purdue_layer = None - self.is_authorized = None - self.is_programming = None - self.is_scanner = None - + self.value = value + self.next_link = None -class IpEntity(Entity): - """Represents an ip entity. - Variables are only populated by the server, and will be ignored when sending a request. +class IncidentConfiguration(_serialization.Model): + """Incident Configuration property bag. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). - :vartype address: str - :ivar location: The geo-location context attached to the ip entity. - :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation - :ivar threat_intelligence: A list of TI contexts attached to the ip entity. - :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + :ivar create_incident: Create incidents from alerts triggered by this analytics rule. Required. + :vartype create_incident: bool + :ivar grouping_configuration: Set how the alerts that are triggered by this analytics rule, are + grouped into incidents. + :vartype grouping_configuration: ~azure.mgmt.securityinsight.models.GroupingConfiguration """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "address": {"readonly": True}, - "location": {"readonly": True}, - "threat_intelligence": {"readonly": True}, + "create_incident": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "address": {"key": "properties.address", "type": "str"}, - "location": {"key": "properties.location", "type": "GeoLocation"}, - "threat_intelligence": {"key": "properties.threatIntelligence", "type": "[ThreatIntelligence]"}, + "create_incident": {"key": "createIncident", "type": "bool"}, + "grouping_configuration": {"key": "groupingConfiguration", "type": "GroupingConfiguration"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + create_incident: bool, + grouping_configuration: Optional["_models.GroupingConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword create_incident: Create incidents from alerts triggered by this analytics rule. + Required. + :paramtype create_incident: bool + :keyword grouping_configuration: Set how the alerts that are triggered by this analytics rule, + are grouped into incidents. + :paramtype grouping_configuration: ~azure.mgmt.securityinsight.models.GroupingConfiguration + """ super().__init__(**kwargs) - self.kind: str = "Ip" - self.additional_data = None - self.friendly_name = None - self.address = None - self.location = None - self.threat_intelligence = None - + self.create_incident = create_incident + self.grouping_configuration = grouping_configuration -class IpEntityProperties(EntityCommonProperties): - """Ip entity property bag. - Variables are only populated by the server, and will be ignored when sending a request. +class IncidentEntitiesResponse(_serialization.Model): + """The incident related entities response. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). - :vartype address: str - :ivar location: The geo-location context attached to the ip entity. - :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation - :ivar threat_intelligence: A list of TI contexts attached to the ip entity. - :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + :ivar entities: Array of the incident related entities. + :vartype entities: list[~azure.mgmt.securityinsight.models.Entity] + :ivar meta_data: The metadata from the incident related entities results. + :vartype meta_data: list[~azure.mgmt.securityinsight.models.IncidentEntitiesResultsMetadata] """ - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "address": {"readonly": True}, - "location": {"readonly": True}, - "threat_intelligence": {"readonly": True}, - } - _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "address": {"key": "address", "type": "str"}, - "location": {"key": "location", "type": "GeoLocation"}, - "threat_intelligence": {"key": "threatIntelligence", "type": "[ThreatIntelligence]"}, + "entities": {"key": "entities", "type": "[Entity]"}, + "meta_data": {"key": "metaData", "type": "[IncidentEntitiesResultsMetadata]"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + entities: Optional[List["_models.Entity"]] = None, + meta_data: Optional[List["_models.IncidentEntitiesResultsMetadata"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword entities: Array of the incident related entities. + :paramtype entities: list[~azure.mgmt.securityinsight.models.Entity] + :keyword meta_data: The metadata from the incident related entities results. + :paramtype meta_data: list[~azure.mgmt.securityinsight.models.IncidentEntitiesResultsMetadata] + """ super().__init__(**kwargs) - self.address = None - self.location = None - self.threat_intelligence = None - + self.entities = entities + self.meta_data = meta_data -class MailboxEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a mailbox entity. - Variables are only populated by the server, and will be ignored when sending a request. +class IncidentEntitiesResultsMetadata(_serialization.Model): + """Information of a specific aggregation in the incident related entities result. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar mailbox_primary_address: The mailbox's primary address. - :vartype mailbox_primary_address: str - :ivar display_name: The mailbox's display name. - :vartype display_name: str - :ivar upn: The mailbox's UPN. - :vartype upn: str - :ivar external_directory_object_id: The AzureAD identifier of mailbox. Similar to AadUserId in - account entity but this property is specific to mailbox object on office side. - :vartype external_directory_object_id: str + :ivar entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and + "Nic". + :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar count: Total number of aggregations of the given kind in the incident related entities + result. Required. + :vartype count: int """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "mailbox_primary_address": {"readonly": True}, - "display_name": {"readonly": True}, - "upn": {"readonly": True}, - "external_directory_object_id": {"readonly": True}, + "entity_kind": {"required": True}, + "count": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "mailbox_primary_address": {"key": "properties.mailboxPrimaryAddress", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "upn": {"key": "properties.upn", "type": "str"}, - "external_directory_object_id": {"key": "properties.externalDirectoryObjectId", "type": "str"}, + "entity_kind": {"key": "entityKind", "type": "str"}, + "count": {"key": "count", "type": "int"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, entity_kind: Union[str, "_models.EntityKindEnum"], count: int, **kwargs: Any) -> None: + """ + :keyword entity_kind: The kind of the aggregated entity. Required. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and + "Nic". + :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :keyword count: Total number of aggregations of the given kind in the incident related entities + result. Required. + :paramtype count: int + """ super().__init__(**kwargs) - self.kind: str = "Mailbox" - self.additional_data = None - self.friendly_name = None - self.mailbox_primary_address = None - self.display_name = None - self.upn = None - self.external_directory_object_id = None + self.entity_kind = entity_kind + self.count = count -class MailboxEntityProperties(EntityCommonProperties): - """Mailbox entity property bag. +class IncidentInfo(_serialization.Model): + """Describes related incident information for the bookmark. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar incident_id: Incident Id. + :vartype incident_id: str + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :ivar title: The title of the incident. + :vartype title: str + :ivar relation_name: Relation Name. + :vartype relation_name: str + """ - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar mailbox_primary_address: The mailbox's primary address. - :vartype mailbox_primary_address: str - :ivar display_name: The mailbox's display name. - :vartype display_name: str - :ivar upn: The mailbox's UPN. - :vartype upn: str - :ivar external_directory_object_id: The AzureAD identifier of mailbox. Similar to AadUserId in - account entity but this property is specific to mailbox object on office side. - :vartype external_directory_object_id: str + _attribute_map = { + "incident_id": {"key": "incidentId", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "title": {"key": "title", "type": "str"}, + "relation_name": {"key": "relationName", "type": "str"}, + } + + def __init__( + self, + *, + incident_id: Optional[str] = None, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, + title: Optional[str] = None, + relation_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword incident_id: Incident Id. + :paramtype incident_id: str + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :keyword title: The title of the incident. + :paramtype title: str + :keyword relation_name: Relation Name. + :paramtype relation_name: str + """ + super().__init__(**kwargs) + self.incident_id = incident_id + self.severity = severity + self.title = title + self.relation_name = relation_name + + +class IncidentLabel(_serialization.Model): + """Represents an incident label. + + 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 label_name: The name of the label. Required. + :vartype label_name: str + :ivar label_type: The type of the label. Known values are: "User" and "AutoAssigned". + :vartype label_type: str or ~azure.mgmt.securityinsight.models.IncidentLabelType """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "mailbox_primary_address": {"readonly": True}, - "display_name": {"readonly": True}, - "upn": {"readonly": True}, - "external_directory_object_id": {"readonly": True}, + "label_name": {"required": True}, + "label_type": {"readonly": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "mailbox_primary_address": {"key": "mailboxPrimaryAddress", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "upn": {"key": "upn", "type": "str"}, - "external_directory_object_id": {"key": "externalDirectoryObjectId", "type": "str"}, + "label_name": {"key": "labelName", "type": "str"}, + "label_type": {"key": "labelType", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, label_name: str, **kwargs: Any) -> None: + """ + :keyword label_name: The name of the label. Required. + :paramtype label_name: str + """ super().__init__(**kwargs) - self.mailbox_primary_address = None - self.display_name = None - self.upn = None - self.external_directory_object_id = None + self.label_name = label_name + self.label_type = None -class MailClusterEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a mail cluster entity. +class IncidentList(_serialization.Model): + """List all the incidents. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar network_message_ids: The mail message IDs that are part of the mail cluster. - :vartype network_message_ids: list[str] - :ivar count_by_delivery_status: Count of mail messages by DeliveryStatus string representation. - :vartype count_by_delivery_status: JSON - :ivar count_by_threat_type: Count of mail messages by ThreatType string representation. - :vartype count_by_threat_type: JSON - :ivar count_by_protection_status: Count of mail messages by ProtectionStatus string - representation. - :vartype count_by_protection_status: JSON - :ivar threats: The threats of mail messages that are part of the mail cluster. - :vartype threats: list[str] - :ivar query: The query that was used to identify the messages of the mail cluster. - :vartype query: str - :ivar query_time: The query time. - :vartype query_time: ~datetime.datetime - :ivar mail_count: The number of mail messages that are part of the mail cluster. - :vartype mail_count: int - :ivar is_volume_anomaly: Is this a volume anomaly mail cluster. - :vartype is_volume_anomaly: bool - :ivar source: The source of the mail cluster (default is 'O365 ATP'). - :vartype source: str - :ivar cluster_source_identifier: The id of the cluster source. - :vartype cluster_source_identifier: str - :ivar cluster_source_type: The type of the cluster source. - :vartype cluster_source_type: str - :ivar cluster_query_start_time: The cluster query start time. - :vartype cluster_query_start_time: ~datetime.datetime - :ivar cluster_query_end_time: The cluster query end time. - :vartype cluster_query_end_time: ~datetime.datetime - :ivar cluster_group: The cluster group. - :vartype cluster_group: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Incident] + :ivar next_link: URL to fetch the next set of incidents. + :vartype next_link: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "network_message_ids": {"readonly": True}, - "count_by_delivery_status": {"readonly": True}, - "count_by_threat_type": {"readonly": True}, - "count_by_protection_status": {"readonly": True}, - "threats": {"readonly": True}, - "query": {"readonly": True}, - "query_time": {"readonly": True}, - "mail_count": {"readonly": True}, - "is_volume_anomaly": {"readonly": True}, - "source": {"readonly": True}, - "cluster_source_identifier": {"readonly": True}, - "cluster_source_type": {"readonly": True}, - "cluster_query_start_time": {"readonly": True}, - "cluster_query_end_time": {"readonly": True}, - "cluster_group": {"readonly": True}, + "value": {"required": True}, + "next_link": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "network_message_ids": {"key": "properties.networkMessageIds", "type": "[str]"}, - "count_by_delivery_status": {"key": "properties.countByDeliveryStatus", "type": "object"}, - "count_by_threat_type": {"key": "properties.countByThreatType", "type": "object"}, - "count_by_protection_status": {"key": "properties.countByProtectionStatus", "type": "object"}, - "threats": {"key": "properties.threats", "type": "[str]"}, - "query": {"key": "properties.query", "type": "str"}, - "query_time": {"key": "properties.queryTime", "type": "iso-8601"}, - "mail_count": {"key": "properties.mailCount", "type": "int"}, - "is_volume_anomaly": {"key": "properties.isVolumeAnomaly", "type": "bool"}, - "source": {"key": "properties.source", "type": "str"}, - "cluster_source_identifier": {"key": "properties.clusterSourceIdentifier", "type": "str"}, - "cluster_source_type": {"key": "properties.clusterSourceType", "type": "str"}, - "cluster_query_start_time": {"key": "properties.clusterQueryStartTime", "type": "iso-8601"}, - "cluster_query_end_time": {"key": "properties.clusterQueryEndTime", "type": "iso-8601"}, - "cluster_group": {"key": "properties.clusterGroup", "type": "str"}, + "value": {"key": "value", "type": "[Incident]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, value: List["_models.Incident"], **kwargs: Any) -> None: + """ + :keyword value: Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Incident] + """ super().__init__(**kwargs) - self.kind: str = "MailCluster" - self.additional_data = None - self.friendly_name = None - self.network_message_ids = None - self.count_by_delivery_status = None - self.count_by_threat_type = None - self.count_by_protection_status = None - self.threats = None - self.query = None - self.query_time = None - self.mail_count = None - self.is_volume_anomaly = None - self.source = None - self.cluster_source_identifier = None - self.cluster_source_type = None - self.cluster_query_start_time = None - self.cluster_query_end_time = None - self.cluster_group = None + self.value = value + self.next_link = None -class MailClusterEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """Mail cluster entity property bag. +class IncidentOwnerInfo(_serialization.Model): + """Information on the user an incident is assigned to. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar email: The email of the user the incident is assigned to. + :vartype email: str + :ivar assigned_to: The name of the user the incident is assigned to. + :vartype assigned_to: str + :ivar object_id: The object id of the user the incident is assigned to. + :vartype object_id: str + :ivar user_principal_name: The user principal name of the user the incident is assigned to. + :vartype user_principal_name: str + :ivar owner_type: The type of the owner the incident is assigned to. Known values are: + "Unknown", "User", and "Group". + :vartype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType + """ - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar network_message_ids: The mail message IDs that are part of the mail cluster. - :vartype network_message_ids: list[str] - :ivar count_by_delivery_status: Count of mail messages by DeliveryStatus string representation. - :vartype count_by_delivery_status: JSON - :ivar count_by_threat_type: Count of mail messages by ThreatType string representation. - :vartype count_by_threat_type: JSON - :ivar count_by_protection_status: Count of mail messages by ProtectionStatus string - representation. - :vartype count_by_protection_status: JSON - :ivar threats: The threats of mail messages that are part of the mail cluster. - :vartype threats: list[str] - :ivar query: The query that was used to identify the messages of the mail cluster. - :vartype query: str - :ivar query_time: The query time. - :vartype query_time: ~datetime.datetime - :ivar mail_count: The number of mail messages that are part of the mail cluster. - :vartype mail_count: int - :ivar is_volume_anomaly: Is this a volume anomaly mail cluster. - :vartype is_volume_anomaly: bool - :ivar source: The source of the mail cluster (default is 'O365 ATP'). - :vartype source: str - :ivar cluster_source_identifier: The id of the cluster source. - :vartype cluster_source_identifier: str - :ivar cluster_source_type: The type of the cluster source. - :vartype cluster_source_type: str - :ivar cluster_query_start_time: The cluster query start time. - :vartype cluster_query_start_time: ~datetime.datetime - :ivar cluster_query_end_time: The cluster query end time. - :vartype cluster_query_end_time: ~datetime.datetime - :ivar cluster_group: The cluster group. - :vartype cluster_group: str - """ - - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "network_message_ids": {"readonly": True}, - "count_by_delivery_status": {"readonly": True}, - "count_by_threat_type": {"readonly": True}, - "count_by_protection_status": {"readonly": True}, - "threats": {"readonly": True}, - "query": {"readonly": True}, - "query_time": {"readonly": True}, - "mail_count": {"readonly": True}, - "is_volume_anomaly": {"readonly": True}, - "source": {"readonly": True}, - "cluster_source_identifier": {"readonly": True}, - "cluster_source_type": {"readonly": True}, - "cluster_query_start_time": {"readonly": True}, - "cluster_query_end_time": {"readonly": True}, - "cluster_group": {"readonly": True}, + _attribute_map = { + "email": {"key": "email", "type": "str"}, + "assigned_to": {"key": "assignedTo", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "user_principal_name": {"key": "userPrincipalName", "type": "str"}, + "owner_type": {"key": "ownerType", "type": "str"}, } + def __init__( + self, + *, + email: Optional[str] = None, + assigned_to: Optional[str] = None, + object_id: Optional[str] = None, + user_principal_name: Optional[str] = None, + owner_type: Optional[Union[str, "_models.OwnerType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword email: The email of the user the incident is assigned to. + :paramtype email: str + :keyword assigned_to: The name of the user the incident is assigned to. + :paramtype assigned_to: str + :keyword object_id: The object id of the user the incident is assigned to. + :paramtype object_id: str + :keyword user_principal_name: The user principal name of the user the incident is assigned to. + :paramtype user_principal_name: str + :keyword owner_type: The type of the owner the incident is assigned to. Known values are: + "Unknown", "User", and "Group". + :paramtype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType + """ + super().__init__(**kwargs) + self.email = email + self.assigned_to = assigned_to + self.object_id = object_id + self.user_principal_name = user_principal_name + self.owner_type = owner_type + + +class IncidentPropertiesAction(_serialization.Model): + """IncidentPropertiesAction. + + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :ivar status: The status of the incident. Known values are: "New", "Active", and "Closed". + :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :ivar classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", and "FalsePositive". + :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :ivar classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and + "InaccurateData". + :vartype classification_reason: str or + ~azure.mgmt.securityinsight.models.IncidentClassificationReason + :ivar classification_comment: Describes the reason the incident was closed. + :vartype classification_comment: str + :ivar owner: Information on the user an incident is assigned to. + :vartype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :ivar labels: List of labels to add to the incident. + :vartype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + """ + _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "network_message_ids": {"key": "networkMessageIds", "type": "[str]"}, - "count_by_delivery_status": {"key": "countByDeliveryStatus", "type": "object"}, - "count_by_threat_type": {"key": "countByThreatType", "type": "object"}, - "count_by_protection_status": {"key": "countByProtectionStatus", "type": "object"}, - "threats": {"key": "threats", "type": "[str]"}, - "query": {"key": "query", "type": "str"}, - "query_time": {"key": "queryTime", "type": "iso-8601"}, - "mail_count": {"key": "mailCount", "type": "int"}, - "is_volume_anomaly": {"key": "isVolumeAnomaly", "type": "bool"}, - "source": {"key": "source", "type": "str"}, - "cluster_source_identifier": {"key": "clusterSourceIdentifier", "type": "str"}, - "cluster_source_type": {"key": "clusterSourceType", "type": "str"}, - "cluster_query_start_time": {"key": "clusterQueryStartTime", "type": "iso-8601"}, - "cluster_query_end_time": {"key": "clusterQueryEndTime", "type": "iso-8601"}, - "cluster_group": {"key": "clusterGroup", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "classification": {"key": "classification", "type": "str"}, + "classification_reason": {"key": "classificationReason", "type": "str"}, + "classification_comment": {"key": "classificationComment", "type": "str"}, + "owner": {"key": "owner", "type": "IncidentOwnerInfo"}, + "labels": {"key": "labels", "type": "[IncidentLabel]"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, + status: Optional[Union[str, "_models.IncidentStatus"]] = None, + classification: Optional[Union[str, "_models.IncidentClassification"]] = None, + classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, + classification_comment: Optional[str] = None, + owner: Optional["_models.IncidentOwnerInfo"] = None, + labels: Optional[List["_models.IncidentLabel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", and + "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :keyword status: The status of the incident. Known values are: "New", "Active", and "Closed". + :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :keyword classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", and "FalsePositive". + :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :keyword classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", and + "InaccurateData". + :paramtype classification_reason: str or + ~azure.mgmt.securityinsight.models.IncidentClassificationReason + :keyword classification_comment: Describes the reason the incident was closed. + :paramtype classification_comment: str + :keyword owner: Information on the user an incident is assigned to. + :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :keyword labels: List of labels to add to the incident. + :paramtype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + """ super().__init__(**kwargs) - self.network_message_ids = None - self.count_by_delivery_status = None - self.count_by_threat_type = None - self.count_by_protection_status = None - self.threats = None - self.query = None - self.query_time = None - self.mail_count = None - self.is_volume_anomaly = None - self.source = None - self.cluster_source_identifier = None - self.cluster_source_type = None - self.cluster_query_start_time = None - self.cluster_query_end_time = None - self.cluster_group = None + self.severity = severity + self.status = status + self.classification = classification + self.classification_reason = classification_reason + self.classification_comment = classification_comment + self.owner = owner + self.labels = labels -class MailMessageEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a mail message entity. +class IncidentTask(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """IncidentTask. Variables are only populated by the server, and will be ignored when sending a request. @@ -12513,100 +12472,33 @@ class MailMessageEntity(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar file_entity_ids: The File entity ids of this mail message's attachments. - :vartype file_entity_ids: list[str] - :ivar recipient: The recipient of this mail message. Note that in case of multiple recipients - the mail message is forked and each copy has one recipient. - :vartype recipient: str - :ivar urls: The Urls contained in this mail message. - :vartype urls: list[str] - :ivar threats: The threats of this mail message. - :vartype threats: list[str] - :ivar p1_sender: The p1 sender's email address. - :vartype p1_sender: str - :ivar p1_sender_display_name: The p1 sender's display name. - :vartype p1_sender_display_name: str - :ivar p1_sender_domain: The p1 sender's domain. - :vartype p1_sender_domain: str - :ivar sender_ip: The sender's IP address. - :vartype sender_ip: str - :ivar p2_sender: The p2 sender's email address. - :vartype p2_sender: str - :ivar p2_sender_display_name: The p2 sender's display name. - :vartype p2_sender_display_name: str - :ivar p2_sender_domain: The p2 sender's domain. - :vartype p2_sender_domain: str - :ivar receive_date: The receive date of this message. - :vartype receive_date: ~datetime.datetime - :ivar network_message_id: The network message id of this mail message. - :vartype network_message_id: str - :ivar internet_message_id: The internet message id of this mail message. - :vartype internet_message_id: str - :ivar subject: The subject of this mail message. - :vartype subject: str - :ivar language: The language of this mail message. - :vartype language: str - :ivar threat_detection_methods: The threat detection methods. - :vartype threat_detection_methods: list[str] - :ivar body_fingerprint_bin1: The bodyFingerprintBin1. - :vartype body_fingerprint_bin1: int - :ivar body_fingerprint_bin2: The bodyFingerprintBin2. - :vartype body_fingerprint_bin2: int - :ivar body_fingerprint_bin3: The bodyFingerprintBin3. - :vartype body_fingerprint_bin3: int - :ivar body_fingerprint_bin4: The bodyFingerprintBin4. - :vartype body_fingerprint_bin4: int - :ivar body_fingerprint_bin5: The bodyFingerprintBin5. - :vartype body_fingerprint_bin5: int - :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", - "Inbound", "Outbound", and "Intraorg". - :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection - :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and - "Replaced". - :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction - :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. - Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", - "Failed", "Dropped", and "Forwarded". - :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "file_entity_ids": {"readonly": True}, - "recipient": {"readonly": True}, - "urls": {"readonly": True}, - "threats": {"readonly": True}, - "p1_sender": {"readonly": True}, - "p1_sender_display_name": {"readonly": True}, - "p1_sender_domain": {"readonly": True}, - "sender_ip": {"readonly": True}, - "p2_sender": {"readonly": True}, - "p2_sender_display_name": {"readonly": True}, - "p2_sender_domain": {"readonly": True}, - "receive_date": {"readonly": True}, - "network_message_id": {"readonly": True}, - "internet_message_id": {"readonly": True}, - "subject": {"readonly": True}, - "language": {"readonly": True}, - "threat_detection_methods": {"readonly": True}, + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar title: The title of the task. Required. + :vartype title: str + :ivar description: The description of the task. + :vartype description: str + :ivar status: Required. Known values are: "New" and "Completed". + :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentTaskStatus + :ivar created_time_utc: The time the task was created. + :vartype created_time_utc: ~datetime.datetime + :ivar last_modified_time_utc: The last time the task was updated. + :vartype last_modified_time_utc: ~datetime.datetime + :ivar created_by: Information on the client (user or application) that made some action. + :vartype created_by: ~azure.mgmt.securityinsight.models.ClientInfo + :ivar last_modified_by: Information on the client (user or application) that made some action. + :vartype last_modified_by: ~azure.mgmt.securityinsight.models.ClientInfo + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "title": {"required": True}, + "status": {"required": True}, + "created_time_utc": {"readonly": True}, + "last_modified_time_utc": {"readonly": True}, } _attribute_map = { @@ -12614,998 +12506,757 @@ class MailMessageEntity(Entity): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "file_entity_ids": {"key": "properties.fileEntityIds", "type": "[str]"}, - "recipient": {"key": "properties.recipient", "type": "str"}, - "urls": {"key": "properties.urls", "type": "[str]"}, - "threats": {"key": "properties.threats", "type": "[str]"}, - "p1_sender": {"key": "properties.p1Sender", "type": "str"}, - "p1_sender_display_name": {"key": "properties.p1SenderDisplayName", "type": "str"}, - "p1_sender_domain": {"key": "properties.p1SenderDomain", "type": "str"}, - "sender_ip": {"key": "properties.senderIP", "type": "str"}, - "p2_sender": {"key": "properties.p2Sender", "type": "str"}, - "p2_sender_display_name": {"key": "properties.p2SenderDisplayName", "type": "str"}, - "p2_sender_domain": {"key": "properties.p2SenderDomain", "type": "str"}, - "receive_date": {"key": "properties.receiveDate", "type": "iso-8601"}, - "network_message_id": {"key": "properties.networkMessageId", "type": "str"}, - "internet_message_id": {"key": "properties.internetMessageId", "type": "str"}, - "subject": {"key": "properties.subject", "type": "str"}, - "language": {"key": "properties.language", "type": "str"}, - "threat_detection_methods": {"key": "properties.threatDetectionMethods", "type": "[str]"}, - "body_fingerprint_bin1": {"key": "properties.bodyFingerprintBin1", "type": "int"}, - "body_fingerprint_bin2": {"key": "properties.bodyFingerprintBin2", "type": "int"}, - "body_fingerprint_bin3": {"key": "properties.bodyFingerprintBin3", "type": "int"}, - "body_fingerprint_bin4": {"key": "properties.bodyFingerprintBin4", "type": "int"}, - "body_fingerprint_bin5": {"key": "properties.bodyFingerprintBin5", "type": "int"}, - "antispam_direction": {"key": "properties.antispamDirection", "type": "str"}, - "delivery_action": {"key": "properties.deliveryAction", "type": "str"}, - "delivery_location": {"key": "properties.deliveryLocation", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "title": {"key": "properties.title", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "created_time_utc": {"key": "properties.createdTimeUtc", "type": "iso-8601"}, + "last_modified_time_utc": {"key": "properties.lastModifiedTimeUtc", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "ClientInfo"}, + "last_modified_by": {"key": "properties.lastModifiedBy", "type": "ClientInfo"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - body_fingerprint_bin1: Optional[int] = None, - body_fingerprint_bin2: Optional[int] = None, - body_fingerprint_bin3: Optional[int] = None, - body_fingerprint_bin4: Optional[int] = None, - body_fingerprint_bin5: Optional[int] = None, - antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, - delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, - delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, - **kwargs - ): + title: str, + status: Union[str, "_models.IncidentTaskStatus"], + etag: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional["_models.ClientInfo"] = None, + last_modified_by: Optional["_models.ClientInfo"] = None, + **kwargs: Any + ) -> None: """ - :keyword body_fingerprint_bin1: The bodyFingerprintBin1. - :paramtype body_fingerprint_bin1: int - :keyword body_fingerprint_bin2: The bodyFingerprintBin2. - :paramtype body_fingerprint_bin2: int - :keyword body_fingerprint_bin3: The bodyFingerprintBin3. - :paramtype body_fingerprint_bin3: int - :keyword body_fingerprint_bin4: The bodyFingerprintBin4. - :paramtype body_fingerprint_bin4: int - :keyword body_fingerprint_bin5: The bodyFingerprintBin5. - :paramtype body_fingerprint_bin5: int - :keyword antispam_direction: The directionality of this mail message. Known values are: - "Unknown", "Inbound", "Outbound", and "Intraorg". - :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection - :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and - "Replaced". - :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction - :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder - etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", - "External", "Failed", "Dropped", and "Forwarded". - :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword title: The title of the task. Required. + :paramtype title: str + :keyword description: The description of the task. + :paramtype description: str + :keyword status: Required. Known values are: "New" and "Completed". + :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentTaskStatus + :keyword created_by: Information on the client (user or application) that made some action. + :paramtype created_by: ~azure.mgmt.securityinsight.models.ClientInfo + :keyword last_modified_by: Information on the client (user or application) that made some + action. + :paramtype last_modified_by: ~azure.mgmt.securityinsight.models.ClientInfo + """ + super().__init__(etag=etag, **kwargs) + self.title = title + self.description = description + self.status = status + self.created_time_utc = None + self.last_modified_time_utc = None + self.created_by = created_by + self.last_modified_by = last_modified_by + + +class IncidentTaskList(_serialization.Model): + """IncidentTaskList. + + :ivar value: + :vartype value: list[~azure.mgmt.securityinsight.models.IncidentTask] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[IncidentTask]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.IncidentTask"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.securityinsight.models.IncidentTask] + :keyword next_link: + :paramtype next_link: str """ super().__init__(**kwargs) - self.kind: str = "MailMessage" - self.additional_data = None - self.friendly_name = None - self.file_entity_ids = None - self.recipient = None - self.urls = None - self.threats = None - self.p1_sender = None - self.p1_sender_display_name = None - self.p1_sender_domain = None - self.sender_ip = None - self.p2_sender = None - self.p2_sender_display_name = None - self.p2_sender_domain = None - self.receive_date = None - self.network_message_id = None - self.internet_message_id = None - self.subject = None - self.language = None - self.threat_detection_methods = None - self.body_fingerprint_bin1 = body_fingerprint_bin1 - self.body_fingerprint_bin2 = body_fingerprint_bin2 - self.body_fingerprint_bin3 = body_fingerprint_bin3 - self.body_fingerprint_bin4 = body_fingerprint_bin4 - self.body_fingerprint_bin5 = body_fingerprint_bin5 - self.antispam_direction = antispam_direction - self.delivery_action = delivery_action - self.delivery_location = delivery_location + self.value = value + self.next_link = next_link -class MailMessageEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """Mail message entity property bag. +class InsightQueryItem(EntityQueryItem): + """Represents Insight Query. Variables are only populated by the server, and will be ignored when sending a request. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar file_entity_ids: The File entity ids of this mail message's attachments. - :vartype file_entity_ids: list[str] - :ivar recipient: The recipient of this mail message. Note that in case of multiple recipients - the mail message is forked and each copy has one recipient. - :vartype recipient: str - :ivar urls: The Urls contained in this mail message. - :vartype urls: list[str] - :ivar threats: The threats of this mail message. - :vartype threats: list[str] - :ivar p1_sender: The p1 sender's email address. - :vartype p1_sender: str - :ivar p1_sender_display_name: The p1 sender's display name. - :vartype p1_sender_display_name: str - :ivar p1_sender_domain: The p1 sender's domain. - :vartype p1_sender_domain: str - :ivar sender_ip: The sender's IP address. - :vartype sender_ip: str - :ivar p2_sender: The p2 sender's email address. - :vartype p2_sender: str - :ivar p2_sender_display_name: The p2 sender's display name. - :vartype p2_sender_display_name: str - :ivar p2_sender_domain: The p2 sender's domain. - :vartype p2_sender_domain: str - :ivar receive_date: The receive date of this message. - :vartype receive_date: ~datetime.datetime - :ivar network_message_id: The network message id of this mail message. - :vartype network_message_id: str - :ivar internet_message_id: The internet message id of this mail message. - :vartype internet_message_id: str - :ivar subject: The subject of this mail message. - :vartype subject: str - :ivar language: The language of this mail message. - :vartype language: str - :ivar threat_detection_methods: The threat detection methods. - :vartype threat_detection_methods: list[str] - :ivar body_fingerprint_bin1: The bodyFingerprintBin1. - :vartype body_fingerprint_bin1: int - :ivar body_fingerprint_bin2: The bodyFingerprintBin2. - :vartype body_fingerprint_bin2: int - :ivar body_fingerprint_bin3: The bodyFingerprintBin3. - :vartype body_fingerprint_bin3: int - :ivar body_fingerprint_bin4: The bodyFingerprintBin4. - :vartype body_fingerprint_bin4: int - :ivar body_fingerprint_bin5: The bodyFingerprintBin5. - :vartype body_fingerprint_bin5: int - :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", - "Inbound", "Outbound", and "Intraorg". - :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection - :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and - "Replaced". - :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction - :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. - Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", - "Failed", "Dropped", and "Forwarded". - :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation - """ + All required parameters must be populated in order to send to Azure. - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "file_entity_ids": {"readonly": True}, - "recipient": {"readonly": True}, - "urls": {"readonly": True}, - "threats": {"readonly": True}, - "p1_sender": {"readonly": True}, - "p1_sender_display_name": {"readonly": True}, - "p1_sender_domain": {"readonly": True}, - "sender_ip": {"readonly": True}, - "p2_sender": {"readonly": True}, - "p2_sender_display_name": {"readonly": True}, - "p2_sender_domain": {"readonly": True}, - "receive_date": {"readonly": True}, - "network_message_id": {"readonly": True}, - "internet_message_id": {"readonly": True}, - "subject": {"readonly": True}, - "language": {"readonly": True}, - "threat_detection_methods": {"readonly": True}, - } - - _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "file_entity_ids": {"key": "fileEntityIds", "type": "[str]"}, - "recipient": {"key": "recipient", "type": "str"}, - "urls": {"key": "urls", "type": "[str]"}, - "threats": {"key": "threats", "type": "[str]"}, - "p1_sender": {"key": "p1Sender", "type": "str"}, - "p1_sender_display_name": {"key": "p1SenderDisplayName", "type": "str"}, - "p1_sender_domain": {"key": "p1SenderDomain", "type": "str"}, - "sender_ip": {"key": "senderIP", "type": "str"}, - "p2_sender": {"key": "p2Sender", "type": "str"}, - "p2_sender_display_name": {"key": "p2SenderDisplayName", "type": "str"}, - "p2_sender_domain": {"key": "p2SenderDomain", "type": "str"}, - "receive_date": {"key": "receiveDate", "type": "iso-8601"}, - "network_message_id": {"key": "networkMessageId", "type": "str"}, - "internet_message_id": {"key": "internetMessageId", "type": "str"}, - "subject": {"key": "subject", "type": "str"}, - "language": {"key": "language", "type": "str"}, - "threat_detection_methods": {"key": "threatDetectionMethods", "type": "[str]"}, - "body_fingerprint_bin1": {"key": "bodyFingerprintBin1", "type": "int"}, - "body_fingerprint_bin2": {"key": "bodyFingerprintBin2", "type": "int"}, - "body_fingerprint_bin3": {"key": "bodyFingerprintBin3", "type": "int"}, - "body_fingerprint_bin4": {"key": "bodyFingerprintBin4", "type": "int"}, - "body_fingerprint_bin5": {"key": "bodyFingerprintBin5", "type": "int"}, - "antispam_direction": {"key": "antispamDirection", "type": "str"}, - "delivery_action": {"key": "deliveryAction", "type": "str"}, - "delivery_location": {"key": "deliveryLocation", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - body_fingerprint_bin1: Optional[int] = None, - body_fingerprint_bin2: Optional[int] = None, - body_fingerprint_bin3: Optional[int] = None, - body_fingerprint_bin4: Optional[int] = None, - body_fingerprint_bin5: Optional[int] = None, - antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, - delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, - delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, - **kwargs - ): - """ - :keyword body_fingerprint_bin1: The bodyFingerprintBin1. - :paramtype body_fingerprint_bin1: int - :keyword body_fingerprint_bin2: The bodyFingerprintBin2. - :paramtype body_fingerprint_bin2: int - :keyword body_fingerprint_bin3: The bodyFingerprintBin3. - :paramtype body_fingerprint_bin3: int - :keyword body_fingerprint_bin4: The bodyFingerprintBin4. - :paramtype body_fingerprint_bin4: int - :keyword body_fingerprint_bin5: The bodyFingerprintBin5. - :paramtype body_fingerprint_bin5: int - :keyword antispam_direction: The directionality of this mail message. Known values are: - "Unknown", "Inbound", "Outbound", and "Intraorg". - :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection - :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and - "Replaced". - :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction - :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder - etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", - "External", "Failed", "Dropped", and "Forwarded". - :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation - """ - super().__init__(**kwargs) - self.file_entity_ids = None - self.recipient = None - self.urls = None - self.threats = None - self.p1_sender = None - self.p1_sender_display_name = None - self.p1_sender_domain = None - self.sender_ip = None - self.p2_sender = None - self.p2_sender_display_name = None - self.p2_sender_domain = None - self.receive_date = None - self.network_message_id = None - self.internet_message_id = None - self.subject = None - self.language = None - self.threat_detection_methods = None - self.body_fingerprint_bin1 = body_fingerprint_bin1 - self.body_fingerprint_bin2 = body_fingerprint_bin2 - self.body_fingerprint_bin3 = body_fingerprint_bin3 - self.body_fingerprint_bin4 = body_fingerprint_bin4 - self.body_fingerprint_bin5 = body_fingerprint_bin5 - self.antispam_direction = antispam_direction - self.delivery_action = delivery_action - self.delivery_location = delivery_location - - -class MalwareEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a malware entity. - - 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}. + :ivar id: Query Template ARM ID. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Query Template ARM Name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: ARM Type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar category: The malware category by the vendor, e.g. Trojan. - :vartype category: str - :ivar file_entity_ids: List of linked file entity identifiers on which the malware was found. - :vartype file_entity_ids: list[str] - :ivar malware_name: The malware name by the vendor, e.g. Win32/Toga!rfn. - :vartype malware_name: str - :ivar process_entity_ids: List of linked process entity identifiers on which the malware was - found. - :vartype process_entity_ids: list[str] + :ivar kind: The kind of the entity query. Required. Known values are: "Expansion", "Insight", + and "Activity". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind + :ivar properties: Properties bag for InsightQueryItem. + :vartype properties: ~azure.mgmt.securityinsight.models.InsightQueryItemProperties """ _validation = { "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "category": {"readonly": True}, - "file_entity_ids": {"readonly": True}, - "malware_name": {"readonly": True}, - "process_entity_ids": {"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"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "file_entity_ids": {"key": "properties.fileEntityIds", "type": "[str]"}, - "malware_name": {"key": "properties.malwareName", "type": "str"}, - "process_entity_ids": {"key": "properties.processEntityIds", "type": "[str]"}, + "properties": {"key": "properties", "type": "InsightQueryItemProperties"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.kind: str = "Malware" - self.additional_data = None - self.friendly_name = None - self.category = None - self.file_entity_ids = None - self.malware_name = None - self.process_entity_ids = None - + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + properties: Optional["_models.InsightQueryItemProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Query Template ARM Name. + :paramtype name: str + :keyword type: ARM Type. + :paramtype type: str + :keyword properties: Properties bag for InsightQueryItem. + :paramtype properties: ~azure.mgmt.securityinsight.models.InsightQueryItemProperties + """ + super().__init__(name=name, type=type, **kwargs) + self.kind: str = "Insight" + self.properties = properties -class MalwareEntityProperties(EntityCommonProperties): - """Malware entity property bag. - Variables are only populated by the server, and will be ignored when sending a request. +class InsightQueryItemProperties(EntityQueryItemProperties): # pylint: disable=too-many-instance-attributes + """Represents Insight Query. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar category: The malware category by the vendor, e.g. Trojan. - :vartype category: str - :ivar file_entity_ids: List of linked file entity identifiers on which the malware was found. - :vartype file_entity_ids: list[str] - :ivar malware_name: The malware name by the vendor, e.g. Win32/Toga!rfn. - :vartype malware_name: str - :ivar process_entity_ids: List of linked process entity identifiers on which the malware was - found. - :vartype process_entity_ids: list[str] + :ivar data_types: Data types for template. + :vartype data_types: + list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] + :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", + "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :ivar required_input_fields_sets: Data types for template. + :vartype required_input_fields_sets: list[list[str]] + :ivar entities_filter: The query applied only to entities matching to all filters. + :vartype entities_filter: JSON + :ivar display_name: The insight display name. + :vartype display_name: str + :ivar description: The insight description. + :vartype description: str + :ivar base_query: The base query of the insight. + :vartype base_query: str + :ivar table_query: The insight table query. + :vartype table_query: ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQuery + :ivar chart_query: The insight chart query. + :vartype chart_query: JSON + :ivar additional_query: The activity query definitions. + :vartype additional_query: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesAdditionalQuery + :ivar default_time_range: The insight chart query. + :vartype default_time_range: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesDefaultTimeRange + :ivar reference_time_range: The insight chart query. + :vartype reference_time_range: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesReferenceTimeRange """ - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "category": {"readonly": True}, - "file_entity_ids": {"readonly": True}, - "malware_name": {"readonly": True}, - "process_entity_ids": {"readonly": True}, - } - _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "file_entity_ids": {"key": "fileEntityIds", "type": "[str]"}, - "malware_name": {"key": "malwareName", "type": "str"}, - "process_entity_ids": {"key": "processEntityIds", "type": "[str]"}, + "data_types": {"key": "dataTypes", "type": "[EntityQueryItemPropertiesDataTypesItem]"}, + "input_entity_type": {"key": "inputEntityType", "type": "str"}, + "required_input_fields_sets": {"key": "requiredInputFieldsSets", "type": "[[str]]"}, + "entities_filter": {"key": "entitiesFilter", "type": "object"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "base_query": {"key": "baseQuery", "type": "str"}, + "table_query": {"key": "tableQuery", "type": "InsightQueryItemPropertiesTableQuery"}, + "chart_query": {"key": "chartQuery", "type": "object"}, + "additional_query": {"key": "additionalQuery", "type": "InsightQueryItemPropertiesAdditionalQuery"}, + "default_time_range": {"key": "defaultTimeRange", "type": "InsightQueryItemPropertiesDefaultTimeRange"}, + "reference_time_range": {"key": "referenceTimeRange", "type": "InsightQueryItemPropertiesReferenceTimeRange"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.category = None - self.file_entity_ids = None - self.malware_name = None - self.process_entity_ids = None - + def __init__( + self, + *, + data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, + required_input_fields_sets: Optional[List[List[str]]] = None, + entities_filter: Optional[JSON] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + base_query: Optional[str] = None, + table_query: Optional["_models.InsightQueryItemPropertiesTableQuery"] = None, + chart_query: Optional[JSON] = None, + additional_query: Optional["_models.InsightQueryItemPropertiesAdditionalQuery"] = None, + default_time_range: Optional["_models.InsightQueryItemPropertiesDefaultTimeRange"] = None, + reference_time_range: Optional["_models.InsightQueryItemPropertiesReferenceTimeRange"] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_types: Data types for template. + :paramtype data_types: + list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] + :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", + "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType + :keyword required_input_fields_sets: Data types for template. + :paramtype required_input_fields_sets: list[list[str]] + :keyword entities_filter: The query applied only to entities matching to all filters. + :paramtype entities_filter: JSON + :keyword display_name: The insight display name. + :paramtype display_name: str + :keyword description: The insight description. + :paramtype description: str + :keyword base_query: The base query of the insight. + :paramtype base_query: str + :keyword table_query: The insight table query. + :paramtype table_query: ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQuery + :keyword chart_query: The insight chart query. + :paramtype chart_query: JSON + :keyword additional_query: The activity query definitions. + :paramtype additional_query: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesAdditionalQuery + :keyword default_time_range: The insight chart query. + :paramtype default_time_range: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesDefaultTimeRange + :keyword reference_time_range: The insight chart query. + :paramtype reference_time_range: + ~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesReferenceTimeRange + """ + super().__init__( + data_types=data_types, + input_entity_type=input_entity_type, + required_input_fields_sets=required_input_fields_sets, + entities_filter=entities_filter, + **kwargs + ) + self.display_name = display_name + self.description = description + self.base_query = base_query + self.table_query = table_query + self.chart_query = chart_query + self.additional_query = additional_query + self.default_time_range = default_time_range + self.reference_time_range = reference_time_range -class ManualTriggerRequestBody(_serialization.Model): - """ManualTriggerRequestBody. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesAdditionalQuery(_serialization.Model): + """The activity query definitions. - :ivar tenant_id: - :vartype tenant_id: str - :ivar logic_apps_resource_id: Required. - :vartype logic_apps_resource_id: str + :ivar query: The insight query. + :vartype query: str + :ivar text: The insight text. + :vartype text: str """ - _validation = { - "logic_apps_resource_id": {"required": True}, - } - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "logic_apps_resource_id": {"key": "logicAppsResourceId", "type": "str"}, + "query": {"key": "query", "type": "str"}, + "text": {"key": "text", "type": "str"}, } - def __init__(self, *, logic_apps_resource_id: str, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, query: Optional[str] = None, text: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: - :paramtype tenant_id: str - :keyword logic_apps_resource_id: Required. - :paramtype logic_apps_resource_id: str + :keyword query: The insight query. + :paramtype query: str + :keyword text: The insight text. + :paramtype text: str """ super().__init__(**kwargs) - self.tenant_id = tenant_id - self.logic_apps_resource_id = logic_apps_resource_id - + self.query = query + self.text = text -class MCASCheckRequirements(DataConnectorsCheckRequirements): - """Represents MCAS (Microsoft Cloud App Security) requirements check request. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesDefaultTimeRange(_serialization.Model): + """The insight chart query. - :ivar kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar before_range: The padding for the start time of the query. + :vartype before_range: str + :ivar after_range: The padding for the end time of the query. + :vartype after_range: str """ - _validation = { - "kind": {"required": True}, - } - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "before_range": {"key": "beforeRange", "type": "str"}, + "after_range": {"key": "afterRange", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, before_range: Optional[str] = None, after_range: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword before_range: The padding for the start time of the query. + :paramtype before_range: str + :keyword after_range: The padding for the end time of the query. + :paramtype after_range: str """ super().__init__(**kwargs) - self.kind: str = "MicrosoftCloudAppSecurity" - self.tenant_id = tenant_id - + self.before_range = before_range + self.after_range = after_range -class MCASCheckRequirementsProperties(DataConnectorTenantId): - """MCAS (Microsoft Cloud App Security) requirements check properties. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesReferenceTimeRange(_serialization.Model): + """The insight chart query. - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar before_range: Additional query time for looking back. + :vartype before_range: str """ - _validation = { - "tenant_id": {"required": True}, - } - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "before_range": {"key": "beforeRange", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, before_range: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword before_range: Additional query time for looking back. + :paramtype before_range: str """ - super().__init__(tenant_id=tenant_id, **kwargs) - - -class MCASDataConnector(DataConnector): - """Represents MCAS (Microsoft Cloud App Security) data connector. + super().__init__(**kwargs) + self.before_range = before_range - 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 InsightQueryItemPropertiesTableQuery(_serialization.Model): + """The insight table query. - :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.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + :ivar columns_definitions: List of insight column definitions. + :vartype columns_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem] + :ivar queries_definitions: List of insight queries definitions. + :vartype queries_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem] """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "MCASDataConnectorDataTypes"}, + "columns_definitions": { + "key": "columnsDefinitions", + "type": "[InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem]", + }, + "queries_definitions": { + "key": "queriesDefinitions", + "type": "[InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem]", + }, } def __init__( self, *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.MCASDataConnectorDataTypes"] = None, - **kwargs - ): - """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + columns_definitions: Optional[ + List["_models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem"] + ] = None, + queries_definitions: Optional[ + List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem"] + ] = None, + **kwargs: Any + ) -> None: """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "MicrosoftCloudAppSecurity" - self.tenant_id = tenant_id - self.data_types = data_types - + :keyword columns_definitions: List of insight column definitions. + :paramtype columns_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem] + :keyword queries_definitions: List of insight queries definitions. + :paramtype queries_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem] + """ + super().__init__(**kwargs) + self.columns_definitions = columns_definitions + self.queries_definitions = queries_definitions -class MCASDataConnectorDataTypes(AlertsDataTypeOfDataConnector): - """The available data types for MCAS (Microsoft Cloud App Security) data connector. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem(_serialization.Model): + """InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem. - :ivar alerts: Alerts data type connection. Required. - :vartype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon - :ivar discovery_logs: Discovery log data type connection. - :vartype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar header: Insight column header. + :vartype header: str + :ivar output_type: Insights Column type. Known values are: "Number", "String", "Date", and + "Entity". + :vartype output_type: str or ~azure.mgmt.securityinsight.models.OutputType + :ivar support_deep_link: Is query supports deep-link. + :vartype support_deep_link: bool """ - _validation = { - "alerts": {"required": True}, - } - _attribute_map = { - "alerts": {"key": "alerts", "type": "DataConnectorDataTypeCommon"}, - "discovery_logs": {"key": "discoveryLogs", "type": "DataConnectorDataTypeCommon"}, + "header": {"key": "header", "type": "str"}, + "output_type": {"key": "outputType", "type": "str"}, + "support_deep_link": {"key": "supportDeepLink", "type": "bool"}, } def __init__( self, *, - alerts: "_models.DataConnectorDataTypeCommon", - discovery_logs: Optional["_models.DataConnectorDataTypeCommon"] = None, - **kwargs - ): + header: Optional[str] = None, + output_type: Optional[Union[str, "_models.OutputType"]] = None, + support_deep_link: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword alerts: Alerts data type connection. Required. - :paramtype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon - :keyword discovery_logs: Discovery log data type connection. - :paramtype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :keyword header: Insight column header. + :paramtype header: str + :keyword output_type: Insights Column type. Known values are: "Number", "String", "Date", and + "Entity". + :paramtype output_type: str or ~azure.mgmt.securityinsight.models.OutputType + :keyword support_deep_link: Is query supports deep-link. + :paramtype support_deep_link: bool """ - super().__init__(alerts=alerts, **kwargs) - self.discovery_logs = discovery_logs - + super().__init__(**kwargs) + self.header = header + self.output_type = output_type + self.support_deep_link = support_deep_link -class MCASDataConnectorProperties(DataConnectorTenantId): - """MCAS (Microsoft Cloud App Security) data connector properties. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem(_serialization.Model): + """InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem. - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + :ivar filter: Insight column header. + :vartype filter: str + :ivar summarize: Insight column header. + :vartype summarize: str + :ivar project: Insight column header. + :vartype project: str + :ivar link_columns_definitions: Insight column header. + :vartype link_columns_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem] """ - _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, - } - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "MCASDataConnectorDataTypes"}, + "filter": {"key": "filter", "type": "str"}, + "summarize": {"key": "summarize", "type": "str"}, + "project": {"key": "project", "type": "str"}, + "link_columns_definitions": { + "key": "linkColumnsDefinitions", + "type": "[InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem]", + }, } - def __init__(self, *, tenant_id: str, data_types: "_models.MCASDataConnectorDataTypes", **kwargs): + def __init__( + self, + *, + filter: Optional[str] = None, # pylint: disable=redefined-builtin + summarize: Optional[str] = None, + project: Optional[str] = None, + link_columns_definitions: Optional[ + List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem"] + ] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + :keyword filter: Insight column header. + :paramtype filter: str + :keyword summarize: Insight column header. + :paramtype summarize: str + :keyword project: Insight column header. + :paramtype project: str + :keyword link_columns_definitions: Insight column header. + :paramtype link_columns_definitions: + list[~azure.mgmt.securityinsight.models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem] """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types - + super().__init__(**kwargs) + self.filter = filter + self.summarize = summarize + self.project = project + self.link_columns_definitions = link_columns_definitions -class MDATPCheckRequirements(DataConnectorsCheckRequirements): - """Represents MDATP (Microsoft Defender Advanced Threat Protection) requirements check request. - All required parameters must be populated in order to send to Azure. +class InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem(_serialization.Model): + """InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem. - :ivar kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar projected_name: Insight Link Definition Projected Name. + :vartype projected_name: str + :ivar query: Insight Link Definition Query. + :vartype query: str """ - _validation = { - "kind": {"required": True}, - } - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "projected_name": {"key": "projectedName", "type": "str"}, + "query": {"key": "Query", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, projected_name: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword projected_name: Insight Link Definition Projected Name. + :paramtype projected_name: str + :keyword query: Insight Link Definition Query. + :paramtype query: str """ super().__init__(**kwargs) - self.kind: str = "MicrosoftDefenderAdvancedThreatProtection" - self.tenant_id = tenant_id - + self.projected_name = projected_name + self.query = query -class MDATPCheckRequirementsProperties(DataConnectorTenantId): - """MDATP (Microsoft Defender Advanced Threat Protection) requirements check properties. - All required parameters must be populated in order to send to Azure. +class InsightsTableResult(_serialization.Model): + """Query results for table insights query. - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar columns: Columns Metadata of the table. + :vartype columns: list[~azure.mgmt.securityinsight.models.InsightsTableResultColumnsItem] + :ivar rows: Rows data of the table. + :vartype rows: list[list[str]] """ - _validation = { - "tenant_id": {"required": True}, + _attribute_map = { + "columns": {"key": "columns", "type": "[InsightsTableResultColumnsItem]"}, + "rows": {"key": "rows", "type": "[[str]]"}, } + def __init__( + self, + *, + columns: Optional[List["_models.InsightsTableResultColumnsItem"]] = None, + rows: Optional[List[List[str]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword columns: Columns Metadata of the table. + :paramtype columns: list[~azure.mgmt.securityinsight.models.InsightsTableResultColumnsItem] + :keyword rows: Rows data of the table. + :paramtype rows: list[list[str]] + """ + super().__init__(**kwargs) + self.columns = columns + self.rows = rows + + +class InsightsTableResultColumnsItem(_serialization.Model): + """InsightsTableResultColumnsItem. + + :ivar type: the type of the colum. + :vartype type: str + :ivar name: the name of the colum. + :vartype name: str + """ + _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword type: the type of the colum. + :paramtype type: str + :keyword name: the name of the colum. + :paramtype name: str """ - super().__init__(tenant_id=tenant_id, **kwargs) - + super().__init__(**kwargs) + self.type = type + self.name = name -class MDATPDataConnector(DataConnector): - """Represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. - Variables are only populated by the server, and will be ignored when sending a request. +class Instructions(_serialization.Model): + """Instructions section of a recommendation. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar actions_to_be_performed: What actions should be taken to complete the recommendation. + Required. + :vartype actions_to_be_performed: str + :ivar recommendation_importance: Explains why the recommendation is important. Required. + :vartype recommendation_importance: str + :ivar how_to_perform_action_details: How should the user complete the recommendation. + :vartype how_to_perform_action_details: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, + "actions_to_be_performed": {"required": True}, + "recommendation_importance": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + "actions_to_be_performed": {"key": "actionsToBePerformed", "type": "str"}, + "recommendation_importance": {"key": "recommendationImportance", "type": "str"}, + "how_to_perform_action_details": {"key": "howToPerformActionDetails", "type": "str"}, } def __init__( self, *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - **kwargs - ): + actions_to_be_performed: str, + recommendation_importance: str, + how_to_perform_action_details: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword actions_to_be_performed: What actions should be taken to complete the recommendation. + Required. + :paramtype actions_to_be_performed: str + :keyword recommendation_importance: Explains why the recommendation is important. Required. + :paramtype recommendation_importance: str + :keyword how_to_perform_action_details: How should the user complete the recommendation. + :paramtype how_to_perform_action_details: str """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "MicrosoftDefenderAdvancedThreatProtection" - self.tenant_id = tenant_id - self.data_types = data_types - + super().__init__(**kwargs) + self.actions_to_be_performed = actions_to_be_performed + self.recommendation_importance = recommendation_importance + self.how_to_perform_action_details = how_to_perform_action_details -class MDATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): - """MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. - All required parameters must be populated in order to send to Azure. +class InstructionStep(_serialization.Model): + """Instruction steps to enable the connector. - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar title: Gets or sets the instruction step title. + :vartype title: str + :ivar description: Gets or sets the instruction step description. + :vartype description: str + :ivar instructions: Gets or sets the instruction step details. + :vartype instructions: list[~azure.mgmt.securityinsight.models.InstructionStepDetails] + :ivar inner_steps: Gets or sets the inner instruction steps details. + Foe Example: instruction step 1 might contain inner instruction steps: [instruction step 1.1, + instruction step 1.2]. + :vartype inner_steps: list[~azure.mgmt.securityinsight.models.InstructionStep] """ - _validation = { - "tenant_id": {"required": True}, - } - _attribute_map = { - "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, - "tenant_id": {"key": "tenantId", "type": "str"}, + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "instructions": {"key": "instructions", "type": "[InstructionStepDetails]"}, + "inner_steps": {"key": "innerSteps", "type": "[InstructionStep]"}, } def __init__( - self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs - ): + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + instructions: Optional[List["_models.InstructionStepDetails"]] = None, + inner_steps: Optional[List["_models.InstructionStep"]] = None, + **kwargs: Any + ) -> None: """ - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword title: Gets or sets the instruction step title. + :paramtype title: str + :keyword description: Gets or sets the instruction step description. + :paramtype description: str + :keyword instructions: Gets or sets the instruction step details. + :paramtype instructions: list[~azure.mgmt.securityinsight.models.InstructionStepDetails] + :keyword inner_steps: Gets or sets the inner instruction steps details. + Foe Example: instruction step 1 might contain inner instruction steps: [instruction step 1.1, + instruction step 1.2]. + :paramtype inner_steps: list[~azure.mgmt.securityinsight.models.InstructionStep] """ - super().__init__(tenant_id=tenant_id, data_types=data_types, **kwargs) - self.data_types = data_types - self.tenant_id = tenant_id + super().__init__(**kwargs) + self.title = title + self.description = description + self.instructions = instructions + self.inner_steps = inner_steps -class MetadataAuthor(_serialization.Model): - """Publisher or creator of the content item. +class InstructionStepDetails(_serialization.Model): + """Instruction step details, to be displayed in the Instructions steps section in the connector's + page in Sentinel Portal. - :ivar name: Name of the author. Company or person. - :vartype name: str - :ivar email: Email of author contact. - :vartype email: str - :ivar link: Link for author/vendor page. - :vartype link: str + All required parameters must be populated in order to send to Azure. + + :ivar parameters: Gets or sets the instruction type parameters settings. Required. + :vartype parameters: JSON + :ivar type: Gets or sets the instruction type name. Required. + :vartype type: str """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "link": {"key": "link", "type": "str"}, + _validation = { + "parameters": {"required": True}, + "type": {"required": True}, } - def __init__( - self, *, name: Optional[str] = None, email: Optional[str] = None, link: Optional[str] = None, **kwargs - ): - """ - :keyword name: Name of the author. Company or person. - :paramtype name: str - :keyword email: Email of author contact. - :paramtype email: str - :keyword link: Link for author/vendor page. - :paramtype link: str - """ - super().__init__(**kwargs) - self.name = name - self.email = email - self.link = link - - -class MetadataCategories(_serialization.Model): - """ies for the solution content item. - - :ivar domains: domain for the solution content item. - :vartype domains: list[str] - :ivar verticals: Industry verticals for the solution content item. - :vartype verticals: list[str] - """ - _attribute_map = { - "domains": {"key": "domains", "type": "[str]"}, - "verticals": {"key": "verticals", "type": "[str]"}, + "parameters": {"key": "parameters", "type": "object"}, + "type": {"key": "type", "type": "str"}, } - def __init__(self, *, domains: Optional[List[str]] = None, verticals: Optional[List[str]] = None, **kwargs): + def __init__(self, *, parameters: JSON, type: str, **kwargs: Any) -> None: """ - :keyword domains: domain for the solution content item. - :paramtype domains: list[str] - :keyword verticals: Industry verticals for the solution content item. - :paramtype verticals: list[str] + :keyword parameters: Gets or sets the instruction type parameters settings. Required. + :paramtype parameters: JSON + :keyword type: Gets or sets the instruction type name. Required. + :paramtype type: str """ super().__init__(**kwargs) - self.domains = domains - self.verticals = verticals + self.parameters = parameters + self.type = type -class MetadataDependencies(_serialization.Model): - """Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or operator/criteria for complex dependencies. +class InstructionStepsInstructionsItem(ConnectorInstructionModelBase): + """InstructionStepsInstructionsItem. - :ivar content_id: Id of the content item we depend on. - :vartype content_id: str - :ivar kind: Type of the content item we depend on. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :vartype kind: str or ~azure.mgmt.securityinsight.models.Kind - :ivar version: Version of the the content item we depend on. Can be blank, * or missing to - indicate any version fulfills the dependency. If version does not match our defined numeric - format then an exact match is required. - :vartype version: str - :ivar name: Name of the content item. - :vartype name: str - :ivar operator: Operator used for list of dependencies in criteria array. Known values are: - "AND" and "OR". - :vartype operator: str or ~azure.mgmt.securityinsight.models.Operator - :ivar criteria: This is the list of dependencies we must fulfill, according to the AND/OR - operator. - :vartype criteria: list[~azure.mgmt.securityinsight.models.MetadataDependencies] + All required parameters must be populated in order to send to Azure. + + :ivar parameters: The parameters for the setting. + :vartype parameters: JSON + :ivar type: The kind of the setting. Required. Known values are: "CopyableLabel", + "InstructionStepsGroup", and "InfoMessage". + :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType """ + _validation = { + "type": {"required": True}, + } + _attribute_map = { - "content_id": {"key": "contentId", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "criteria": {"key": "criteria", "type": "[MetadataDependencies]"}, + "parameters": {"key": "parameters", "type": "object"}, + "type": {"key": "type", "type": "str"}, } def __init__( - self, - *, - content_id: Optional[str] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - version: Optional[str] = None, - name: Optional[str] = None, - operator: Optional[Union[str, "_models.Operator"]] = None, - criteria: Optional[List["_models.MetadataDependencies"]] = None, - **kwargs - ): + self, *, type: Union[str, "_models.SettingType"], parameters: Optional[JSON] = None, **kwargs: Any + ) -> None: """ - :keyword content_id: Id of the content item we depend on. - :paramtype content_id: str - :keyword kind: Type of the content item we depend on. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.Kind - :keyword version: Version of the the content item we depend on. Can be blank, * or missing to - indicate any version fulfills the dependency. If version does not match our defined numeric - format then an exact match is required. - :paramtype version: str - :keyword name: Name of the content item. - :paramtype name: str - :keyword operator: Operator used for list of dependencies in criteria array. Known values are: - "AND" and "OR". - :paramtype operator: str or ~azure.mgmt.securityinsight.models.Operator - :keyword criteria: This is the list of dependencies we must fulfill, according to the AND/OR - operator. - :paramtype criteria: list[~azure.mgmt.securityinsight.models.MetadataDependencies] + :keyword parameters: The parameters for the setting. + :paramtype parameters: JSON + :keyword type: The kind of the setting. Required. Known values are: "CopyableLabel", + "InstructionStepsGroup", and "InfoMessage". + :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType """ - super().__init__(**kwargs) - self.content_id = content_id - self.kind = kind - self.version = version - self.name = name - self.operator = operator - self.criteria = criteria - + super().__init__(parameters=parameters, type=type, **kwargs) -class MetadataList(_serialization.Model): - """List of all the metadata. - Variables are only populated by the server, and will be ignored when sending a request. +class IoTCheckRequirements(DataConnectorsCheckRequirements): + """Represents IoT requirements check request. All required parameters must be populated in order to send to Azure. - :ivar value: Array of metadata. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.MetadataModel] - :ivar next_link: URL to fetch the next page of metadata. - :vartype next_link: str + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar subscription_id: The subscription id to connect to, and get the data from. + :vartype subscription_id: str """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[MetadataModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, } - def __init__(self, *, value: List["_models.MetadataModel"], **kwargs): + def __init__(self, *, subscription_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Array of metadata. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.MetadataModel] + :keyword subscription_id: The subscription id to connect to, and get the data from. + :paramtype subscription_id: str """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.kind: str = "IOT" + self.subscription_id = subscription_id -class MetadataModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """Metadata resource definition. +class IoTDataConnector(DataConnector): + """Represents IoT data connector. 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 @@ -13619,59 +13270,18 @@ class MetadataModel(ResourceWithEtag): # pylint: disable=too-many-instance-attr :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar content_id: Static ID for the content. Used to identify dependencies and content from - solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic - for user-created. This is the resource name. - :vartype content_id: str - :ivar parent_id: Full parent resource ID of the content item the metadata is for. This is the - full resource ID including the scope (subscription and resource group). - :vartype parent_id: str - :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, - 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we - cannot guarantee any version checks. - :vartype version: str - :ivar kind: The kind of content the metadata is for. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :vartype kind: str or ~azure.mgmt.securityinsight.models.Kind - :ivar source: Source of the content. This is where/how it was created. - :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource - :ivar author: The creator of the content item. - :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor - :ivar support: Support information for the metadata - type, name, contact information. - :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport - :ivar dependencies: Dependencies for the content item, what other content items it requires to - work. Can describe more complex dependencies using a recursive/nested structure. For a single - dependency an id/kind/version can be supplied or operator/criteria for complex formats. - :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies - :ivar categories: Categories for the solution content item. - :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories - :ivar providers: Providers for the solution content item. - :vartype providers: list[str] - :ivar first_publish_date: first publish date solution content item. - :vartype first_publish_date: ~datetime.date - :ivar last_publish_date: last publish date for the solution content item. - :vartype last_publish_date: ~datetime.date - :ivar custom_version: The custom version of the content. A optional free text. - :vartype custom_version: str - :ivar content_schema_version: Schema version of the content. Can be used to distinguish between - different flow based on the schema version. - :vartype content_schema_version: str - :ivar icon: the icon identifier. this id can later be fetched from the solution template. - :vartype icon: str - :ivar threat_analysis_tactics: the tactics the resource covers. - :vartype threat_analysis_tactics: list[str] - :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned - with the tactics being used. - :vartype threat_analysis_techniques: list[str] - :ivar preview_images: preview image file names. These will be taken from the solution - artifacts. - :vartype preview_images: list[str] - :ivar preview_images_dark: preview image file names. These will be taken from the solution - artifacts. used for dark theme support. - :vartype preview_images_dark: list[str] + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar subscription_id: The subscription id to connect to, and get the data from. + :vartype subscription_id: str """ _validation = { @@ -13679,6 +13289,7 @@ class MetadataModel(ResourceWithEtag): # pylint: disable=too-many-instance-attr "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { @@ -13687,136 +13298,71 @@ class MetadataModel(ResourceWithEtag): # pylint: disable=too-many-instance-attr "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "content_id": {"key": "properties.contentId", "type": "str"}, - "parent_id": {"key": "properties.parentId", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "kind": {"key": "properties.kind", "type": "str"}, - "source": {"key": "properties.source", "type": "MetadataSource"}, - "author": {"key": "properties.author", "type": "MetadataAuthor"}, - "support": {"key": "properties.support", "type": "MetadataSupport"}, - "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, - "categories": {"key": "properties.categories", "type": "MetadataCategories"}, - "providers": {"key": "properties.providers", "type": "[str]"}, - "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, - "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, - "custom_version": {"key": "properties.customVersion", "type": "str"}, - "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, - "icon": {"key": "properties.icon", "type": "str"}, - "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, - "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, - "preview_images": {"key": "properties.previewImages", "type": "[str]"}, - "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + "kind": {"key": "kind", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, etag: Optional[str] = None, - content_id: Optional[str] = None, - parent_id: Optional[str] = None, - version: Optional[str] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - source: Optional["_models.MetadataSource"] = None, - author: Optional["_models.MetadataAuthor"] = None, - support: Optional["_models.MetadataSupport"] = None, - dependencies: Optional["_models.MetadataDependencies"] = None, - categories: Optional["_models.MetadataCategories"] = None, - providers: Optional[List[str]] = None, - first_publish_date: Optional[datetime.date] = None, - last_publish_date: Optional[datetime.date] = None, - custom_version: Optional[str] = None, - content_schema_version: Optional[str] = None, - icon: Optional[str] = None, - threat_analysis_tactics: Optional[List[str]] = None, - threat_analysis_techniques: Optional[List[str]] = None, - preview_images: Optional[List[str]] = None, - preview_images_dark: Optional[List[str]] = None, - **kwargs - ): + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, + subscription_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword content_id: Static ID for the content. Used to identify dependencies and content from - solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic - for user-created. This is the resource name. - :paramtype content_id: str - :keyword parent_id: Full parent resource ID of the content item the metadata is for. This is - the full resource ID including the scope (subscription and resource group). - :paramtype parent_id: str - :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, - 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then - we cannot guarantee any version checks. - :paramtype version: str - :keyword kind: The kind of content the metadata is for. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.Kind - :keyword source: Source of the content. This is where/how it was created. - :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource - :keyword author: The creator of the content item. - :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor - :keyword support: Support information for the metadata - type, name, contact information. - :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport - :keyword dependencies: Dependencies for the content item, what other content items it requires - to work. Can describe more complex dependencies using a recursive/nested structure. For a - single dependency an id/kind/version can be supplied or operator/criteria for complex formats. - :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies - :keyword categories: Categories for the solution content item. - :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories - :keyword providers: Providers for the solution content item. - :paramtype providers: list[str] - :keyword first_publish_date: first publish date solution content item. - :paramtype first_publish_date: ~datetime.date - :keyword last_publish_date: last publish date for the solution content item. - :paramtype last_publish_date: ~datetime.date - :keyword custom_version: The custom version of the content. A optional free text. - :paramtype custom_version: str - :keyword content_schema_version: Schema version of the content. Can be used to distinguish - between different flow based on the schema version. - :paramtype content_schema_version: str - :keyword icon: the icon identifier. this id can later be fetched from the solution template. - :paramtype icon: str - :keyword threat_analysis_tactics: the tactics the resource covers. - :paramtype threat_analysis_tactics: list[str] - :keyword threat_analysis_techniques: the techniques the resource covers, these have to be - aligned with the tactics being used. - :paramtype threat_analysis_techniques: list[str] - :keyword preview_images: preview image file names. These will be taken from the solution - artifacts. - :paramtype preview_images: list[str] - :keyword preview_images_dark: preview image file names. These will be taken from the solution - artifacts. used for dark theme support. - :paramtype preview_images_dark: list[str] + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword subscription_id: The subscription id to connect to, and get the data from. + :paramtype subscription_id: str """ super().__init__(etag=etag, **kwargs) - self.content_id = content_id - self.parent_id = parent_id - self.version = version - self.kind = kind - self.source = source - self.author = author - self.support = support - self.dependencies = dependencies - self.categories = categories - self.providers = providers - self.first_publish_date = first_publish_date - self.last_publish_date = last_publish_date - self.custom_version = custom_version - self.content_schema_version = content_schema_version - self.icon = icon - self.threat_analysis_tactics = threat_analysis_tactics - self.threat_analysis_techniques = threat_analysis_techniques - self.preview_images = preview_images - self.preview_images_dark = preview_images_dark + self.kind: str = "IOT" + self.data_types = data_types + self.subscription_id = subscription_id -class MetadataPatch(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """Metadata patch request body. +class IoTDataConnectorProperties(DataConnectorWithAlertsProperties): + """IoT data connector properties. + + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar subscription_id: The subscription id to connect to, and get the data from. + :vartype subscription_id: str + """ + + _attribute_map = { + "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + } + + def __init__( + self, + *, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, + subscription_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword subscription_id: The subscription id to connect to, and get the data from. + :paramtype subscription_id: str + """ + super().__init__(data_types=data_types, **kwargs) + self.subscription_id = subscription_id + + +class IoTDeviceEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents an IoT device entity. 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 @@ -13828,61 +13374,74 @@ class MetadataPatch(ResourceWithEtag): # pylint: disable=too-many-instance-attr :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar content_id: Static ID for the content. Used to identify dependencies and content from - solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic - for user-created. This is the resource name. - :vartype content_id: str - :ivar parent_id: Full parent resource ID of the content item the metadata is for. This is the - full resource ID including the scope (subscription and resource group). - :vartype parent_id: str - :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, - 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we - cannot guarantee any version checks. - :vartype version: str - :ivar kind: The kind of content the metadata is for. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :vartype kind: str or ~azure.mgmt.securityinsight.models.Kind - :ivar source: Source of the content. This is where/how it was created. - :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource - :ivar author: The creator of the content item. - :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor - :ivar support: Support information for the metadata - type, name, contact information. - :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport - :ivar dependencies: Dependencies for the content item, what other content items it requires to - work. Can describe more complex dependencies using a recursive/nested structure. For a single - dependency an id/kind/version can be supplied or operator/criteria for complex formats. - :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies - :ivar categories: Categories for the solution content item. - :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories - :ivar providers: Providers for the solution content item. - :vartype providers: list[str] - :ivar first_publish_date: first publish date solution content item. - :vartype first_publish_date: ~datetime.date - :ivar last_publish_date: last publish date for the solution content item. - :vartype last_publish_date: ~datetime.date - :ivar custom_version: The custom version of the content. A optional free text. - :vartype custom_version: str - :ivar content_schema_version: Schema version of the content. Can be used to distinguish between - different flow based on the schema version. - :vartype content_schema_version: str - :ivar icon: the icon identifier. this id can later be fetched from the solution template. - :vartype icon: str - :ivar threat_analysis_tactics: the tactics the resource covers. - :vartype threat_analysis_tactics: list[str] - :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned - with the tactics being used. - :vartype threat_analysis_techniques: list[str] - :ivar preview_images: preview image file names. These will be taken from the solution - artifacts. - :vartype preview_images: list[str] - :ivar preview_images_dark: preview image file names. These will be taken from the solution - artifacts. used for dark theme support. - :vartype preview_images_dark: list[str] + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar device_id: The ID of the IoT Device in the IoT Hub. + :vartype device_id: str + :ivar device_name: The friendly name of the device. + :vartype device_name: str + :ivar source: The source of the device. + :vartype source: str + :ivar iot_security_agent_id: The ID of the security agent running on the device. + :vartype iot_security_agent_id: str + :ivar device_type: The type of the device. + :vartype device_type: str + :ivar vendor: The vendor of the device. + :vartype vendor: str + :ivar edge_id: The ID of the edge device. + :vartype edge_id: str + :ivar mac_address: The MAC address of the device. + :vartype mac_address: str + :ivar model: The model of the device. + :vartype model: str + :ivar serial_number: The serial number of the device. + :vartype serial_number: str + :ivar firmware_version: The firmware version of the device. + :vartype firmware_version: str + :ivar operating_system: The operating system of the device. + :vartype operating_system: str + :ivar iot_hub_entity_id: The AzureResource entity id of the IoT Hub. + :vartype iot_hub_entity_id: str + :ivar host_entity_id: The Host entity id of this device. + :vartype host_entity_id: str + :ivar ip_address_entity_id: The IP entity if of this device. + :vartype ip_address_entity_id: str + :ivar threat_intelligence: A list of TI contexts attached to the IoTDevice entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + :ivar protocols: A list of protocols of the IoTDevice entity. + :vartype protocols: list[str] + :ivar owners: A list of owners of the IoTDevice entity. + :vartype owners: list[str] + :ivar nic_entity_ids: A list of Nic entity ids of the IoTDevice entity. + :vartype nic_entity_ids: list[str] + :ivar site: The site of the device. + :vartype site: str + :ivar zone: The zone location of the device within a site. + :vartype zone: str + :ivar sensor: The sensor the device is monitored by. + :vartype sensor: str + :ivar device_sub_type: The subType of the device ('PLC', 'HMI', 'EWS', etc.). + :vartype device_sub_type: str + :ivar importance: Device importance, determines if the device classified as 'crown jewel'. + Known values are: "Unknown", "Low", "Normal", and "High". + :vartype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance + :ivar purdue_layer: The Purdue Layer of the device. + :vartype purdue_layer: str + :ivar is_authorized: Determines whether the device classified as authorized device. + :vartype is_authorized: bool + :ivar is_programming: Determines whether the device classified as programming device. + :vartype is_programming: bool + :ivar is_scanner: Is the device classified as a scanner device. + :vartype is_scanner: bool """ _validation = { @@ -13890,6 +13449,36 @@ class MetadataPatch(ResourceWithEtag): # pylint: disable=too-many-instance-attr "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "device_id": {"readonly": True}, + "device_name": {"readonly": True}, + "source": {"readonly": True}, + "iot_security_agent_id": {"readonly": True}, + "device_type": {"readonly": True}, + "vendor": {"readonly": True}, + "edge_id": {"readonly": True}, + "mac_address": {"readonly": True}, + "model": {"readonly": True}, + "serial_number": {"readonly": True}, + "firmware_version": {"readonly": True}, + "operating_system": {"readonly": True}, + "iot_hub_entity_id": {"readonly": True}, + "host_entity_id": {"readonly": True}, + "ip_address_entity_id": {"readonly": True}, + "threat_intelligence": {"readonly": True}, + "protocols": {"readonly": True}, + "owners": {"readonly": True}, + "nic_entity_ids": {"readonly": True}, + "site": {"readonly": True}, + "zone": {"readonly": True}, + "sensor": {"readonly": True}, + "device_sub_type": {"readonly": True}, + "purdue_layer": {"readonly": True}, + "is_authorized": {"readonly": True}, + "is_programming": {"readonly": True}, + "is_scanner": {"readonly": True}, } _attribute_map = { @@ -13897,240 +13486,376 @@ class MetadataPatch(ResourceWithEtag): # pylint: disable=too-many-instance-attr "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - "content_id": {"key": "properties.contentId", "type": "str"}, - "parent_id": {"key": "properties.parentId", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "kind": {"key": "properties.kind", "type": "str"}, - "source": {"key": "properties.source", "type": "MetadataSource"}, - "author": {"key": "properties.author", "type": "MetadataAuthor"}, - "support": {"key": "properties.support", "type": "MetadataSupport"}, - "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, - "categories": {"key": "properties.categories", "type": "MetadataCategories"}, - "providers": {"key": "properties.providers", "type": "[str]"}, - "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, - "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, - "custom_version": {"key": "properties.customVersion", "type": "str"}, - "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, - "icon": {"key": "properties.icon", "type": "str"}, - "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, - "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, - "preview_images": {"key": "properties.previewImages", "type": "[str]"}, - "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "device_id": {"key": "properties.deviceId", "type": "str"}, + "device_name": {"key": "properties.deviceName", "type": "str"}, + "source": {"key": "properties.source", "type": "str"}, + "iot_security_agent_id": {"key": "properties.iotSecurityAgentId", "type": "str"}, + "device_type": {"key": "properties.deviceType", "type": "str"}, + "vendor": {"key": "properties.vendor", "type": "str"}, + "edge_id": {"key": "properties.edgeId", "type": "str"}, + "mac_address": {"key": "properties.macAddress", "type": "str"}, + "model": {"key": "properties.model", "type": "str"}, + "serial_number": {"key": "properties.serialNumber", "type": "str"}, + "firmware_version": {"key": "properties.firmwareVersion", "type": "str"}, + "operating_system": {"key": "properties.operatingSystem", "type": "str"}, + "iot_hub_entity_id": {"key": "properties.iotHubEntityId", "type": "str"}, + "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, + "ip_address_entity_id": {"key": "properties.ipAddressEntityId", "type": "str"}, + "threat_intelligence": {"key": "properties.threatIntelligence", "type": "[ThreatIntelligence]"}, + "protocols": {"key": "properties.protocols", "type": "[str]"}, + "owners": {"key": "properties.owners", "type": "[str]"}, + "nic_entity_ids": {"key": "properties.nicEntityIds", "type": "[str]"}, + "site": {"key": "properties.site", "type": "str"}, + "zone": {"key": "properties.zone", "type": "str"}, + "sensor": {"key": "properties.sensor", "type": "str"}, + "device_sub_type": {"key": "properties.deviceSubType", "type": "str"}, + "importance": {"key": "properties.importance", "type": "str"}, + "purdue_layer": {"key": "properties.purdueLayer", "type": "str"}, + "is_authorized": {"key": "properties.isAuthorized", "type": "bool"}, + "is_programming": {"key": "properties.isProgramming", "type": "bool"}, + "is_scanner": {"key": "properties.isScanner", "type": "bool"}, } def __init__( # pylint: disable=too-many-locals - self, - *, - etag: Optional[str] = None, - content_id: Optional[str] = None, - parent_id: Optional[str] = None, - version: Optional[str] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - source: Optional["_models.MetadataSource"] = None, - author: Optional["_models.MetadataAuthor"] = None, - support: Optional["_models.MetadataSupport"] = None, - dependencies: Optional["_models.MetadataDependencies"] = None, - categories: Optional["_models.MetadataCategories"] = None, - providers: Optional[List[str]] = None, - first_publish_date: Optional[datetime.date] = None, - last_publish_date: Optional[datetime.date] = None, - custom_version: Optional[str] = None, - content_schema_version: Optional[str] = None, - icon: Optional[str] = None, - threat_analysis_tactics: Optional[List[str]] = None, - threat_analysis_techniques: Optional[List[str]] = None, - preview_images: Optional[List[str]] = None, - preview_images_dark: Optional[List[str]] = None, - **kwargs - ): + self, *, importance: Optional[Union[str, "_models.DeviceImportance"]] = None, **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword content_id: Static ID for the content. Used to identify dependencies and content from - solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic - for user-created. This is the resource name. - :paramtype content_id: str - :keyword parent_id: Full parent resource ID of the content item the metadata is for. This is - the full resource ID including the scope (subscription and resource group). - :paramtype parent_id: str - :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, - 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then - we cannot guarantee any version checks. - :paramtype version: str - :keyword kind: The kind of content the metadata is for. Known values are: "DataConnector", - "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", - "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", - "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and - "AutomationRule". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.Kind - :keyword source: Source of the content. This is where/how it was created. - :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource - :keyword author: The creator of the content item. - :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor - :keyword support: Support information for the metadata - type, name, contact information. - :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport - :keyword dependencies: Dependencies for the content item, what other content items it requires - to work. Can describe more complex dependencies using a recursive/nested structure. For a - single dependency an id/kind/version can be supplied or operator/criteria for complex formats. - :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies - :keyword categories: Categories for the solution content item. - :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories - :keyword providers: Providers for the solution content item. - :paramtype providers: list[str] - :keyword first_publish_date: first publish date solution content item. - :paramtype first_publish_date: ~datetime.date - :keyword last_publish_date: last publish date for the solution content item. - :paramtype last_publish_date: ~datetime.date - :keyword custom_version: The custom version of the content. A optional free text. - :paramtype custom_version: str - :keyword content_schema_version: Schema version of the content. Can be used to distinguish - between different flow based on the schema version. - :paramtype content_schema_version: str - :keyword icon: the icon identifier. this id can later be fetched from the solution template. - :paramtype icon: str - :keyword threat_analysis_tactics: the tactics the resource covers. - :paramtype threat_analysis_tactics: list[str] - :keyword threat_analysis_techniques: the techniques the resource covers, these have to be - aligned with the tactics being used. - :paramtype threat_analysis_techniques: list[str] - :keyword preview_images: preview image file names. These will be taken from the solution - artifacts. - :paramtype preview_images: list[str] - :keyword preview_images_dark: preview image file names. These will be taken from the solution - artifacts. used for dark theme support. - :paramtype preview_images_dark: list[str] + :keyword importance: Device importance, determines if the device classified as 'crown jewel'. + Known values are: "Unknown", "Low", "Normal", and "High". + :paramtype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance """ - super().__init__(etag=etag, **kwargs) - self.content_id = content_id - self.parent_id = parent_id - self.version = version - self.kind = kind - self.source = source - self.author = author - self.support = support - self.dependencies = dependencies - self.categories = categories - self.providers = providers - self.first_publish_date = first_publish_date - self.last_publish_date = last_publish_date - self.custom_version = custom_version - self.content_schema_version = content_schema_version - self.icon = icon - self.threat_analysis_tactics = threat_analysis_tactics - self.threat_analysis_techniques = threat_analysis_techniques - self.preview_images = preview_images - self.preview_images_dark = preview_images_dark - - -class MetadataSource(_serialization.Model): - """The original source of the content item, where it comes from. + super().__init__(**kwargs) + self.kind: str = "IoTDevice" + self.additional_data = None + self.friendly_name = None + self.device_id = None + self.device_name = None + self.source = None + self.iot_security_agent_id = None + self.device_type = None + self.vendor = None + self.edge_id = None + self.mac_address = None + self.model = None + self.serial_number = None + self.firmware_version = None + self.operating_system = None + self.iot_hub_entity_id = None + self.host_entity_id = None + self.ip_address_entity_id = None + self.threat_intelligence = None + self.protocols = None + self.owners = None + self.nic_entity_ids = None + self.site = None + self.zone = None + self.sensor = None + self.device_sub_type = None + self.importance = importance + self.purdue_layer = None + self.is_authorized = None + self.is_programming = None + self.is_scanner = None - All required parameters must be populated in order to send to Azure. - :ivar kind: Source type of the content. Required. Known values are: "LocalWorkspace", - "Community", "Solution", and "SourceRepository". - :vartype kind: str or ~azure.mgmt.securityinsight.models.SourceKind - :ivar name: Name of the content source. The repo name, solution name, LA workspace name etc. - :vartype name: str - :ivar source_id: ID of the content source. The solution ID, workspace ID, etc. - :vartype source_id: str +class IoTDeviceEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """IoTDevice entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar device_id: The ID of the IoT Device in the IoT Hub. + :vartype device_id: str + :ivar device_name: The friendly name of the device. + :vartype device_name: str + :ivar source: The source of the device. + :vartype source: str + :ivar iot_security_agent_id: The ID of the security agent running on the device. + :vartype iot_security_agent_id: str + :ivar device_type: The type of the device. + :vartype device_type: str + :ivar vendor: The vendor of the device. + :vartype vendor: str + :ivar edge_id: The ID of the edge device. + :vartype edge_id: str + :ivar mac_address: The MAC address of the device. + :vartype mac_address: str + :ivar model: The model of the device. + :vartype model: str + :ivar serial_number: The serial number of the device. + :vartype serial_number: str + :ivar firmware_version: The firmware version of the device. + :vartype firmware_version: str + :ivar operating_system: The operating system of the device. + :vartype operating_system: str + :ivar iot_hub_entity_id: The AzureResource entity id of the IoT Hub. + :vartype iot_hub_entity_id: str + :ivar host_entity_id: The Host entity id of this device. + :vartype host_entity_id: str + :ivar ip_address_entity_id: The IP entity if of this device. + :vartype ip_address_entity_id: str + :ivar threat_intelligence: A list of TI contexts attached to the IoTDevice entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + :ivar protocols: A list of protocols of the IoTDevice entity. + :vartype protocols: list[str] + :ivar owners: A list of owners of the IoTDevice entity. + :vartype owners: list[str] + :ivar nic_entity_ids: A list of Nic entity ids of the IoTDevice entity. + :vartype nic_entity_ids: list[str] + :ivar site: The site of the device. + :vartype site: str + :ivar zone: The zone location of the device within a site. + :vartype zone: str + :ivar sensor: The sensor the device is monitored by. + :vartype sensor: str + :ivar device_sub_type: The subType of the device ('PLC', 'HMI', 'EWS', etc.). + :vartype device_sub_type: str + :ivar importance: Device importance, determines if the device classified as 'crown jewel'. + Known values are: "Unknown", "Low", "Normal", and "High". + :vartype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance + :ivar purdue_layer: The Purdue Layer of the device. + :vartype purdue_layer: str + :ivar is_authorized: Determines whether the device classified as authorized device. + :vartype is_authorized: bool + :ivar is_programming: Determines whether the device classified as programming device. + :vartype is_programming: bool + :ivar is_scanner: Is the device classified as a scanner device. + :vartype is_scanner: bool """ _validation = { - "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "device_id": {"readonly": True}, + "device_name": {"readonly": True}, + "source": {"readonly": True}, + "iot_security_agent_id": {"readonly": True}, + "device_type": {"readonly": True}, + "vendor": {"readonly": True}, + "edge_id": {"readonly": True}, + "mac_address": {"readonly": True}, + "model": {"readonly": True}, + "serial_number": {"readonly": True}, + "firmware_version": {"readonly": True}, + "operating_system": {"readonly": True}, + "iot_hub_entity_id": {"readonly": True}, + "host_entity_id": {"readonly": True}, + "ip_address_entity_id": {"readonly": True}, + "threat_intelligence": {"readonly": True}, + "protocols": {"readonly": True}, + "owners": {"readonly": True}, + "nic_entity_ids": {"readonly": True}, + "site": {"readonly": True}, + "zone": {"readonly": True}, + "sensor": {"readonly": True}, + "device_sub_type": {"readonly": True}, + "purdue_layer": {"readonly": True}, + "is_authorized": {"readonly": True}, + "is_programming": {"readonly": True}, + "is_scanner": {"readonly": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "source_id": {"key": "sourceId", "type": "str"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "device_id": {"key": "deviceId", "type": "str"}, + "device_name": {"key": "deviceName", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "iot_security_agent_id": {"key": "iotSecurityAgentId", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + "vendor": {"key": "vendor", "type": "str"}, + "edge_id": {"key": "edgeId", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + "model": {"key": "model", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "firmware_version": {"key": "firmwareVersion", "type": "str"}, + "operating_system": {"key": "operatingSystem", "type": "str"}, + "iot_hub_entity_id": {"key": "iotHubEntityId", "type": "str"}, + "host_entity_id": {"key": "hostEntityId", "type": "str"}, + "ip_address_entity_id": {"key": "ipAddressEntityId", "type": "str"}, + "threat_intelligence": {"key": "threatIntelligence", "type": "[ThreatIntelligence]"}, + "protocols": {"key": "protocols", "type": "[str]"}, + "owners": {"key": "owners", "type": "[str]"}, + "nic_entity_ids": {"key": "nicEntityIds", "type": "[str]"}, + "site": {"key": "site", "type": "str"}, + "zone": {"key": "zone", "type": "str"}, + "sensor": {"key": "sensor", "type": "str"}, + "device_sub_type": {"key": "deviceSubType", "type": "str"}, + "importance": {"key": "importance", "type": "str"}, + "purdue_layer": {"key": "purdueLayer", "type": "str"}, + "is_authorized": {"key": "isAuthorized", "type": "bool"}, + "is_programming": {"key": "isProgramming", "type": "bool"}, + "is_scanner": {"key": "isScanner", "type": "bool"}, } - def __init__( - self, - *, - kind: Union[str, "_models.SourceKind"], - name: Optional[str] = None, - source_id: Optional[str] = None, - **kwargs - ): + def __init__( # pylint: disable=too-many-locals + self, *, importance: Optional[Union[str, "_models.DeviceImportance"]] = None, **kwargs: Any + ) -> None: """ - :keyword kind: Source type of the content. Required. Known values are: "LocalWorkspace", - "Community", "Solution", and "SourceRepository". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.SourceKind - :keyword name: Name of the content source. The repo name, solution name, LA workspace name - etc. - :paramtype name: str - :keyword source_id: ID of the content source. The solution ID, workspace ID, etc. - :paramtype source_id: str + :keyword importance: Device importance, determines if the device classified as 'crown jewel'. + Known values are: "Unknown", "Low", "Normal", and "High". + :paramtype importance: str or ~azure.mgmt.securityinsight.models.DeviceImportance """ super().__init__(**kwargs) - self.kind = kind - self.name = name - self.source_id = source_id + self.device_id = None + self.device_name = None + self.source = None + self.iot_security_agent_id = None + self.device_type = None + self.vendor = None + self.edge_id = None + self.mac_address = None + self.model = None + self.serial_number = None + self.firmware_version = None + self.operating_system = None + self.iot_hub_entity_id = None + self.host_entity_id = None + self.ip_address_entity_id = None + self.threat_intelligence = None + self.protocols = None + self.owners = None + self.nic_entity_ids = None + self.site = None + self.zone = None + self.sensor = None + self.device_sub_type = None + self.importance = importance + self.purdue_layer = None + self.is_authorized = None + self.is_programming = None + self.is_scanner = None -class MetadataSupport(_serialization.Model): - """Support information for the content item. +class IpEntity(Entity): + """Represents an ip entity. + + 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 tier: Type of support for content item. Required. Known values are: "Microsoft", - "Partner", and "Community". - :vartype tier: str or ~azure.mgmt.securityinsight.models.SupportTier - :ivar name: Name of the support contact. Company or person. + :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 email: Email of support contact. - :vartype email: str - :ivar link: Link for support help, like to support page to open a ticket etc. - :vartype link: str - """ - - _validation = { - "tier": {"required": True}, - } - - _attribute_map = { - "tier": {"key": "tier", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "link": {"key": "link", "type": "str"}, - } - - def __init__( - self, - *, - tier: Union[str, "_models.SupportTier"], - name: Optional[str] = None, - email: Optional[str] = None, - link: Optional[str] = None, - **kwargs - ): - """ - :keyword tier: Type of support for content item. Required. Known values are: "Microsoft", - "Partner", and "Community". - :paramtype tier: str or ~azure.mgmt.securityinsight.models.SupportTier - :keyword name: Name of the support contact. Company or person. - :paramtype name: str - :keyword email: Email of support contact. - :paramtype email: str - :keyword link: Link for support help, like to support page to open a ticket etc. - :paramtype link: 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.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "address": {"readonly": True}, + "location": {"readonly": True}, + "threat_intelligence": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "address": {"key": "properties.address", "type": "str"}, + "location": {"key": "properties.location", "type": "GeoLocation"}, + "threat_intelligence": {"key": "properties.threatIntelligence", "type": "[ThreatIntelligence]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.tier = tier - self.name = name - self.email = email - self.link = link + self.kind: str = "Ip" + self.additional_data = None + self.friendly_name = None + self.address = None + self.location = None + self.threat_intelligence = None -class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes - """Represents MicrosoftSecurityIncidentCreation rule. +class IpEntityProperties(EntityCommonProperties): + """Ip entity property bag. 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 additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "address": {"readonly": True}, + "location": {"readonly": True}, + "threat_intelligence": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "address": {"key": "address", "type": "str"}, + "location": {"key": "location", "type": "GeoLocation"}, + "threat_intelligence": {"key": "threatIntelligence", "type": "[ThreatIntelligence]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.address = None + self.location = None + self.threat_intelligence = None + + +class Job(ResourceWithEtag): + """The assignment job. + + 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}. @@ -14145,32 +13870,17 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): # pylint: disable= :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. - :vartype display_names_filter: list[str] - :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :ivar severities_filter: the alerts' severities on which the cases will be generated. - :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. - :vartype alert_rule_template_name: str - :ivar description: The description of the alert rule. - :vartype description: str - :ivar display_name: The display name for alerts created by this alert rule. - :vartype display_name: str - :ivar enabled: Determines whether this alert rule is enabled or disabled. - :vartype enabled: bool - :ivar last_modified_utc: The last time that this alert has been modified. - :vartype last_modified_utc: ~datetime.datetime + :ivar end_time: The time the job completed. + :vartype end_time: ~datetime.datetime + :ivar items: List of items published by the job. + :vartype items: list[~azure.mgmt.securityinsight.models.JobItem] + :ivar provisioning_state: State of the job. Known values are: "Accepted", "InProgress", + "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.securityinsight.models.ProvisioningState + :ivar start_time: The time the job started. + :vartype start_time: ~datetime.datetime + :ivar error_message: Message to describe error, if an error exists. + :vartype error_message: str """ _validation = { @@ -14178,8 +13888,10 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): # pylint: disable= "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, - "last_modified_utc": {"readonly": True}, + "end_time": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "start_time": {"readonly": True}, + "error_message": {"readonly": True}, } _attribute_map = { @@ -14188,241 +13900,109 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): # pylint: disable= "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "display_names_filter": {"key": "properties.displayNamesFilter", "type": "[str]"}, - "display_names_exclude_filter": {"key": "properties.displayNamesExcludeFilter", "type": "[str]"}, - "product_filter": {"key": "properties.productFilter", "type": "str"}, - "severities_filter": {"key": "properties.severitiesFilter", "type": "[str]"}, - "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "items": {"key": "properties.items", "type": "[JobItem]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "error_message": {"key": "properties.errorMessage", "type": "str"}, } def __init__( - self, - *, - etag: Optional[str] = None, - display_names_filter: Optional[List[str]] = None, - display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - alert_rule_template_name: Optional[str] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): + self, *, etag: Optional[str] = None, items: Optional[List["_models.JobItem"]] = None, **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. - :paramtype display_names_filter: list[str] - :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :paramtype product_filter: str or - ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :keyword severities_filter: the alerts' severities on which the cases will be generated. - :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - :keyword alert_rule_template_name: The Name of the alert rule template used to create this - rule. - :paramtype alert_rule_template_name: str - :keyword description: The description of the alert rule. - :paramtype description: str - :keyword display_name: The display name for alerts created by this alert rule. - :paramtype display_name: str - :keyword enabled: Determines whether this alert rule is enabled or disabled. - :paramtype enabled: bool + :keyword items: List of items published by the job. + :paramtype items: list[~azure.mgmt.securityinsight.models.JobItem] """ super().__init__(etag=etag, **kwargs) - self.kind: str = "MicrosoftSecurityIncidentCreation" - self.display_names_filter = display_names_filter - self.display_names_exclude_filter = display_names_exclude_filter - self.product_filter = product_filter - self.severities_filter = severities_filter - self.alert_rule_template_name = alert_rule_template_name - self.description = description - self.display_name = display_name - self.enabled = enabled - self.last_modified_utc = None + self.end_time = None + self.items = items + self.provisioning_state = None + self.start_time = None + self.error_message = None -class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(_serialization.Model): - """MicrosoftSecurityIncidentCreation rule common property bag. +class JobItem(_serialization.Model): + """An entity describing the publish status of a content item. - 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 display_names_filter: the alerts' displayNames on which the cases will be generated. - :vartype display_names_filter: list[str] - :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Required. - Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced - Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for - IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat - Protection". - :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :ivar severities_filter: the alerts' severities on which the cases will be generated. - :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar resource_id: The resource id of the content item. + :vartype resource_id: str + :ivar status: Status of the item publication. Known values are: "New", "Active", "Closed", + "Backlog", "Approved", "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.securityinsight.models.Status + :ivar execution_time: The time the item publishing was completed. + :vartype execution_time: ~datetime.datetime + :ivar errors: The list of error descriptions if the item publication fails. + :vartype errors: list[~azure.mgmt.securityinsight.models.Error] """ _validation = { - "product_filter": {"required": True}, + "status": {"readonly": True}, + "execution_time": {"readonly": True}, } _attribute_map = { - "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, - "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, - "product_filter": {"key": "productFilter", "type": "str"}, - "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "execution_time": {"key": "executionTime", "type": "iso-8601"}, + "errors": {"key": "errors", "type": "[Error]"}, } def __init__( - self, - *, - product_filter: Union[str, "_models.MicrosoftSecurityProductName"], - display_names_filter: Optional[List[str]] = None, - display_names_exclude_filter: Optional[List[str]] = None, - severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - **kwargs - ): + self, *, resource_id: Optional[str] = None, errors: Optional[List["_models.Error"]] = None, **kwargs: Any + ) -> None: """ - :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. - :paramtype display_names_filter: list[str] - :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. - Required. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure - Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security - Center for IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced - Threat Protection". - :paramtype product_filter: str or - ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :keyword severities_filter: the alerts' severities on which the cases will be generated. - :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :keyword resource_id: The resource id of the content item. + :paramtype resource_id: str + :keyword errors: The list of error descriptions if the item publication fails. + :paramtype errors: list[~azure.mgmt.securityinsight.models.Error] """ super().__init__(**kwargs) - self.display_names_filter = display_names_filter - self.display_names_exclude_filter = display_names_exclude_filter - self.product_filter = product_filter - self.severities_filter = severities_filter - + self.resource_id = resource_id + self.status = None + self.execution_time = None + self.errors = errors -class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): - """MicrosoftSecurityIncidentCreation rule property bag. + +class JobList(_serialization.Model): + """List of all the jobs. 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 display_names_filter: the alerts' displayNames on which the cases will be generated. - :vartype display_names_filter: list[str] - :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Required. - Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced - Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for - IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat - Protection". - :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :ivar severities_filter: the alerts' severities on which the cases will be generated. - :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. - :vartype alert_rule_template_name: str - :ivar description: The description of the alert rule. - :vartype description: str - :ivar display_name: The display name for alerts created by this alert rule. Required. - :vartype display_name: str - :ivar enabled: Determines whether this alert rule is enabled or disabled. Required. - :vartype enabled: bool - :ivar last_modified_utc: The last time that this alert has been modified. - :vartype last_modified_utc: ~datetime.datetime + :ivar next_link: URL to fetch the next set of jobs. + :vartype next_link: str + :ivar value: Array of jobs. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Job] """ _validation = { - "product_filter": {"required": True}, - "display_name": {"required": True}, - "enabled": {"required": True}, - "last_modified_utc": {"readonly": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, - "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, - "product_filter": {"key": "productFilter", "type": "str"}, - "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, - "alert_rule_template_name": {"key": "alertRuleTemplateName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "last_modified_utc": {"key": "lastModifiedUtc", "type": "iso-8601"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Job]"}, } - def __init__( - self, - *, - product_filter: Union[str, "_models.MicrosoftSecurityProductName"], - display_name: str, - enabled: bool, - display_names_filter: Optional[List[str]] = None, - display_names_exclude_filter: Optional[List[str]] = None, - severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - alert_rule_template_name: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: """ - :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. - :paramtype display_names_filter: list[str] - :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. - Required. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure - Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security - Center for IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced - Threat Protection". - :paramtype product_filter: str or - ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :keyword severities_filter: the alerts' severities on which the cases will be generated. - :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - :keyword alert_rule_template_name: The Name of the alert rule template used to create this - rule. - :paramtype alert_rule_template_name: str - :keyword description: The description of the alert rule. - :paramtype description: str - :keyword display_name: The display name for alerts created by this alert rule. Required. - :paramtype display_name: str - :keyword enabled: Determines whether this alert rule is enabled or disabled. Required. - :paramtype enabled: bool + :keyword value: Array of jobs. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Job] """ - super().__init__( - display_names_filter=display_names_filter, - display_names_exclude_filter=display_names_exclude_filter, - product_filter=product_filter, - severities_filter=severities_filter, - **kwargs - ) - self.alert_rule_template_name = alert_rule_template_name - self.description = description - self.display_name = display_name - self.enabled = enabled - self.last_modified_utc = None + super().__init__(**kwargs) + self.next_link = None + self.value = value -class MicrosoftSecurityIncidentCreationAlertRuleTemplate( - AlertRuleTemplate -): # pylint: disable=too-many-instance-attributes - """Represents MicrosoftSecurityIncidentCreation rule template. +class MailboxEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a mailbox entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -14439,39 +14019,26 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate( :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar mailbox_primary_address: The mailbox's primary address. + :vartype mailbox_primary_address: str + :ivar display_name: The mailbox's display name. :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. - :vartype display_names_filter: list[str] - :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :ivar severities_filter: the alerts' severities on which the cases will be generated. - :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar upn: The mailbox's UPN. + :vartype upn: str + :ivar external_directory_object_id: The AzureAD identifier of mailbox. Similar to AadUserId in + account entity but this property is specific to mailbox object on office side. + :vartype external_directory_object_id: str """ _validation = { @@ -14480,8 +14047,12 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate( "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "mailbox_primary_address": {"readonly": True}, + "display_name": {"readonly": True}, + "upn": {"readonly": True}, + "external_directory_object_id": {"readonly": True}, } _attribute_map = { @@ -14490,194 +14061,77 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate( "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "kind": {"key": "kind", "type": "str"}, - "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "mailbox_primary_address": {"key": "properties.mailboxPrimaryAddress", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, - "required_data_connectors": { - "key": "properties.requiredDataConnectors", - "type": "[AlertRuleTemplateDataSource]", - }, - "status": {"key": "properties.status", "type": "str"}, - "display_names_filter": {"key": "properties.displayNamesFilter", "type": "[str]"}, - "display_names_exclude_filter": {"key": "properties.displayNamesExcludeFilter", "type": "[str]"}, - "product_filter": {"key": "properties.productFilter", "type": "str"}, - "severities_filter": {"key": "properties.severitiesFilter", "type": "[str]"}, + "upn": {"key": "properties.upn", "type": "str"}, + "external_directory_object_id": {"key": "properties.externalDirectoryObjectId", "type": "str"}, } - def __init__( - self, - *, - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - display_names_filter: Optional[List[str]] = None, - display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - **kwargs - ): - """ - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. - :paramtype display_name: str - :keyword required_data_connectors: The required data sources for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. - :paramtype display_names_filter: list[str] - :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :paramtype product_filter: str or - ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :keyword severities_filter: the alerts' severities on which the cases will be generated. - :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.kind: str = "MicrosoftSecurityIncidentCreation" - self.alert_rules_created_by_template_count = alert_rules_created_by_template_count - self.last_updated_date_utc = None - self.created_date_utc = None - self.description = description - self.display_name = display_name - self.required_data_connectors = required_data_connectors - self.status = status - self.display_names_filter = display_names_filter - self.display_names_exclude_filter = display_names_exclude_filter - self.product_filter = product_filter - self.severities_filter = severities_filter + self.kind: str = "Mailbox" + self.additional_data = None + self.friendly_name = None + self.mailbox_primary_address = None + self.display_name = None + self.upn = None + self.external_directory_object_id = None -class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties( - AlertRuleTemplatePropertiesBase -): # pylint: disable=too-many-instance-attributes - """MicrosoftSecurityIncidentCreation rule template properties. +class MailboxEntityProperties(EntityCommonProperties): + """Mailbox entity property bag. Variables are only populated by the server, and will be ignored when sending a request. - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. - :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. - :vartype display_names_filter: list[str] - :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :ivar severities_filter: the alerts' severities on which the cases will be generated. - :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar mailbox_primary_address: The mailbox's primary address. + :vartype mailbox_primary_address: str + :ivar display_name: The mailbox's display name. + :vartype display_name: str + :ivar upn: The mailbox's UPN. + :vartype upn: str + :ivar external_directory_object_id: The AzureAD identifier of mailbox. Similar to AadUserId in + account entity but this property is specific to mailbox object on office side. + :vartype external_directory_object_id: str """ _validation = { - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "mailbox_primary_address": {"readonly": True}, + "display_name": {"readonly": True}, + "upn": {"readonly": True}, + "external_directory_object_id": {"readonly": True}, } _attribute_map = { - "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, - "description": {"key": "description", "type": "str"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "mailbox_primary_address": {"key": "mailboxPrimaryAddress", "type": "str"}, "display_name": {"key": "displayName", "type": "str"}, - "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, - "status": {"key": "status", "type": "str"}, - "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, - "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, - "product_filter": {"key": "productFilter", "type": "str"}, - "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, + "upn": {"key": "upn", "type": "str"}, + "external_directory_object_id": {"key": "externalDirectoryObjectId", "type": "str"}, } - def __init__( - self, - *, - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - display_names_filter: Optional[List[str]] = None, - display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, - **kwargs - ): - """ - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. - :paramtype display_name: str - :keyword required_data_connectors: The required data sources for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. - :paramtype display_names_filter: list[str] - :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be - generated. - :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Known - values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat - Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", - "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". - :paramtype product_filter: str or - ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName - :keyword severities_filter: the alerts' severities on which the cases will be generated. - :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] - """ - super().__init__( - alert_rules_created_by_template_count=alert_rules_created_by_template_count, - description=description, - display_name=display_name, - required_data_connectors=required_data_connectors, - status=status, - **kwargs - ) - self.display_names_filter = display_names_filter - self.display_names_exclude_filter = display_names_exclude_filter - self.product_filter = product_filter - self.severities_filter = severities_filter + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.mailbox_primary_address = None + self.display_name = None + self.upn = None + self.external_directory_object_id = None -class MLBehaviorAnalyticsAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes - """Represents MLBehaviorAnalytics alert rule. +class MailClusterEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a mail cluster entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -14694,29 +14148,48 @@ class MLBehaviorAnalyticsAlertRule(AlertRule): # pylint: disable=too-many-insta :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. - :vartype alert_rule_template_name: str - :ivar description: The description of the alert rule. - :vartype description: str - :ivar display_name: The display name for alerts created by this alert rule. - :vartype display_name: str - :ivar enabled: Determines whether this alert rule is enabled or disabled. - :vartype enabled: bool - :ivar last_modified_utc: The last time that this alert rule has been modified. - :vartype last_modified_utc: ~datetime.datetime - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar network_message_ids: The mail message IDs that are part of the mail cluster. + :vartype network_message_ids: list[str] + :ivar count_by_delivery_status: Count of mail messages by DeliveryStatus string representation. + :vartype count_by_delivery_status: JSON + :ivar count_by_threat_type: Count of mail messages by ThreatType string representation. + :vartype count_by_threat_type: JSON + :ivar count_by_protection_status: Count of mail messages by ProtectionStatus string + representation. + :vartype count_by_protection_status: JSON + :ivar threats: The threats of mail messages that are part of the mail cluster. + :vartype threats: list[str] + :ivar query: The query that was used to identify the messages of the mail cluster. + :vartype query: str + :ivar query_time: The query time. + :vartype query_time: ~datetime.datetime + :ivar mail_count: The number of mail messages that are part of the mail cluster. + :vartype mail_count: int + :ivar is_volume_anomaly: Is this a volume anomaly mail cluster. + :vartype is_volume_anomaly: bool + :ivar source: The source of the mail cluster (default is 'O365 ATP'). + :vartype source: str + :ivar cluster_source_identifier: The id of the cluster source. + :vartype cluster_source_identifier: str + :ivar cluster_source_type: The type of the cluster source. + :vartype cluster_source_type: str + :ivar cluster_query_start_time: The cluster query start time. + :vartype cluster_query_start_time: ~datetime.datetime + :ivar cluster_query_end_time: The cluster query end time. + :vartype cluster_query_end_time: ~datetime.datetime + :ivar cluster_group: The cluster group. + :vartype cluster_group: str """ _validation = { @@ -14725,12 +14198,23 @@ class MLBehaviorAnalyticsAlertRule(AlertRule): # pylint: disable=too-many-insta "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "description": {"readonly": True}, - "display_name": {"readonly": True}, - "last_modified_utc": {"readonly": True}, - "severity": {"readonly": True}, - "tactics": {"readonly": True}, - "techniques": {"readonly": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "network_message_ids": {"readonly": True}, + "count_by_delivery_status": {"readonly": True}, + "count_by_threat_type": {"readonly": True}, + "count_by_protection_status": {"readonly": True}, + "threats": {"readonly": True}, + "query": {"readonly": True}, + "query_time": {"readonly": True}, + "mail_count": {"readonly": True}, + "is_volume_anomaly": {"readonly": True}, + "source": {"readonly": True}, + "cluster_source_identifier": {"readonly": True}, + "cluster_source_type": {"readonly": True}, + "cluster_query_start_time": {"readonly": True}, + "cluster_query_end_time": {"readonly": True}, + "cluster_group": {"readonly": True}, } _attribute_map = { @@ -14738,49 +14222,155 @@ class MLBehaviorAnalyticsAlertRule(AlertRule): # pylint: disable=too-many-insta "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, - "severity": {"key": "properties.severity", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "type": "[str]"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "network_message_ids": {"key": "properties.networkMessageIds", "type": "[str]"}, + "count_by_delivery_status": {"key": "properties.countByDeliveryStatus", "type": "object"}, + "count_by_threat_type": {"key": "properties.countByThreatType", "type": "object"}, + "count_by_protection_status": {"key": "properties.countByProtectionStatus", "type": "object"}, + "threats": {"key": "properties.threats", "type": "[str]"}, + "query": {"key": "properties.query", "type": "str"}, + "query_time": {"key": "properties.queryTime", "type": "iso-8601"}, + "mail_count": {"key": "properties.mailCount", "type": "int"}, + "is_volume_anomaly": {"key": "properties.isVolumeAnomaly", "type": "bool"}, + "source": {"key": "properties.source", "type": "str"}, + "cluster_source_identifier": {"key": "properties.clusterSourceIdentifier", "type": "str"}, + "cluster_source_type": {"key": "properties.clusterSourceType", "type": "str"}, + "cluster_query_start_time": {"key": "properties.clusterQueryStartTime", "type": "iso-8601"}, + "cluster_query_end_time": {"key": "properties.clusterQueryEndTime", "type": "iso-8601"}, + "cluster_group": {"key": "properties.clusterGroup", "type": "str"}, } - def __init__( - self, - *, - etag: Optional[str] = None, - alert_rule_template_name: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): - """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword alert_rule_template_name: The Name of the alert rule template used to create this - rule. - :paramtype alert_rule_template_name: str - :keyword enabled: Determines whether this alert rule is enabled or disabled. - :paramtype enabled: bool - """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "MLBehaviorAnalytics" - self.alert_rule_template_name = alert_rule_template_name - self.description = None - self.display_name = None - self.enabled = enabled - self.last_modified_utc = None - self.severity = None - self.tactics = None - self.techniques = None - - -class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes - """Represents MLBehaviorAnalytics alert rule template. + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "MailCluster" + self.additional_data = None + self.friendly_name = None + self.network_message_ids = None + self.count_by_delivery_status = None + self.count_by_threat_type = None + self.count_by_protection_status = None + self.threats = None + self.query = None + self.query_time = None + self.mail_count = None + self.is_volume_anomaly = None + self.source = None + self.cluster_source_identifier = None + self.cluster_source_type = None + self.cluster_query_start_time = None + self.cluster_query_end_time = None + self.cluster_group = None + + +class MailClusterEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """Mail cluster entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar network_message_ids: The mail message IDs that are part of the mail cluster. + :vartype network_message_ids: list[str] + :ivar count_by_delivery_status: Count of mail messages by DeliveryStatus string representation. + :vartype count_by_delivery_status: JSON + :ivar count_by_threat_type: Count of mail messages by ThreatType string representation. + :vartype count_by_threat_type: JSON + :ivar count_by_protection_status: Count of mail messages by ProtectionStatus string + representation. + :vartype count_by_protection_status: JSON + :ivar threats: The threats of mail messages that are part of the mail cluster. + :vartype threats: list[str] + :ivar query: The query that was used to identify the messages of the mail cluster. + :vartype query: str + :ivar query_time: The query time. + :vartype query_time: ~datetime.datetime + :ivar mail_count: The number of mail messages that are part of the mail cluster. + :vartype mail_count: int + :ivar is_volume_anomaly: Is this a volume anomaly mail cluster. + :vartype is_volume_anomaly: bool + :ivar source: The source of the mail cluster (default is 'O365 ATP'). + :vartype source: str + :ivar cluster_source_identifier: The id of the cluster source. + :vartype cluster_source_identifier: str + :ivar cluster_source_type: The type of the cluster source. + :vartype cluster_source_type: str + :ivar cluster_query_start_time: The cluster query start time. + :vartype cluster_query_start_time: ~datetime.datetime + :ivar cluster_query_end_time: The cluster query end time. + :vartype cluster_query_end_time: ~datetime.datetime + :ivar cluster_group: The cluster group. + :vartype cluster_group: str + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "network_message_ids": {"readonly": True}, + "count_by_delivery_status": {"readonly": True}, + "count_by_threat_type": {"readonly": True}, + "count_by_protection_status": {"readonly": True}, + "threats": {"readonly": True}, + "query": {"readonly": True}, + "query_time": {"readonly": True}, + "mail_count": {"readonly": True}, + "is_volume_anomaly": {"readonly": True}, + "source": {"readonly": True}, + "cluster_source_identifier": {"readonly": True}, + "cluster_source_type": {"readonly": True}, + "cluster_query_start_time": {"readonly": True}, + "cluster_query_end_time": {"readonly": True}, + "cluster_group": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "network_message_ids": {"key": "networkMessageIds", "type": "[str]"}, + "count_by_delivery_status": {"key": "countByDeliveryStatus", "type": "object"}, + "count_by_threat_type": {"key": "countByThreatType", "type": "object"}, + "count_by_protection_status": {"key": "countByProtectionStatus", "type": "object"}, + "threats": {"key": "threats", "type": "[str]"}, + "query": {"key": "query", "type": "str"}, + "query_time": {"key": "queryTime", "type": "iso-8601"}, + "mail_count": {"key": "mailCount", "type": "int"}, + "is_volume_anomaly": {"key": "isVolumeAnomaly", "type": "bool"}, + "source": {"key": "source", "type": "str"}, + "cluster_source_identifier": {"key": "clusterSourceIdentifier", "type": "str"}, + "cluster_source_type": {"key": "clusterSourceType", "type": "str"}, + "cluster_query_start_time": {"key": "clusterQueryStartTime", "type": "iso-8601"}, + "cluster_query_end_time": {"key": "clusterQueryEndTime", "type": "iso-8601"}, + "cluster_group": {"key": "clusterGroup", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.network_message_ids = None + self.count_by_delivery_status = None + self.count_by_threat_type = None + self.count_by_protection_status = None + self.threats = None + self.query = None + self.query_time = None + self.mail_count = None + self.is_volume_anomaly = None + self.source = None + self.cluster_source_identifier = None + self.cluster_source_type = None + self.cluster_query_start_time = None + self.cluster_query_end_time = None + self.cluster_group = None + + +class MailMessageEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a mail message entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -14797,34 +14387,73 @@ class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): # pylint: disabl :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. - :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar file_entity_ids: The File entity ids of this mail message's attachments. + :vartype file_entity_ids: list[str] + :ivar recipient: The recipient of this mail message. Note that in case of multiple recipients + the mail message is forked and each copy has one recipient. + :vartype recipient: str + :ivar urls: The Urls contained in this mail message. + :vartype urls: list[str] + :ivar threats: The threats of this mail message. + :vartype threats: list[str] + :ivar p1_sender: The p1 sender's email address. + :vartype p1_sender: str + :ivar p1_sender_display_name: The p1 sender's display name. + :vartype p1_sender_display_name: str + :ivar p1_sender_domain: The p1 sender's domain. + :vartype p1_sender_domain: str + :ivar sender_ip: The sender's IP address. + :vartype sender_ip: str + :ivar p2_sender: The p2 sender's email address. + :vartype p2_sender: str + :ivar p2_sender_display_name: The p2 sender's display name. + :vartype p2_sender_display_name: str + :ivar p2_sender_domain: The p2 sender's domain. + :vartype p2_sender_domain: str + :ivar receive_date: The receive date of this message. + :vartype receive_date: ~datetime.datetime + :ivar network_message_id: The network message id of this mail message. + :vartype network_message_id: str + :ivar internet_message_id: The internet message id of this mail message. + :vartype internet_message_id: str + :ivar subject: The subject of this mail message. + :vartype subject: str + :ivar language: The language of this mail message. + :vartype language: str + :ivar threat_detection_methods: The threat detection methods. + :vartype threat_detection_methods: list[str] + :ivar body_fingerprint_bin1: The bodyFingerprintBin1. + :vartype body_fingerprint_bin1: int + :ivar body_fingerprint_bin2: The bodyFingerprintBin2. + :vartype body_fingerprint_bin2: int + :ivar body_fingerprint_bin3: The bodyFingerprintBin3. + :vartype body_fingerprint_bin3: int + :ivar body_fingerprint_bin4: The bodyFingerprintBin4. + :vartype body_fingerprint_bin4: int + :ivar body_fingerprint_bin5: The bodyFingerprintBin5. + :vartype body_fingerprint_bin5: int + :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", + "Inbound", "Outbound", and "Intraorg". + :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection + :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and + "Replaced". + :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction + :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. + Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", + "Failed", "Dropped", and "Forwarded". + :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation """ _validation = { @@ -14833,8 +14462,25 @@ class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): # pylint: disabl "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "file_entity_ids": {"readonly": True}, + "recipient": {"readonly": True}, + "urls": {"readonly": True}, + "threats": {"readonly": True}, + "p1_sender": {"readonly": True}, + "p1_sender_display_name": {"readonly": True}, + "p1_sender_domain": {"readonly": True}, + "sender_ip": {"readonly": True}, + "p2_sender": {"readonly": True}, + "p2_sender_display_name": {"readonly": True}, + "p2_sender_domain": {"readonly": True}, + "receive_date": {"readonly": True}, + "network_message_id": {"readonly": True}, + "internet_message_id": {"readonly": True}, + "subject": {"readonly": True}, + "language": {"readonly": True}, + "threat_detection_methods": {"readonly": True}, } _attribute_map = { @@ -14843,18 +14489,2477 @@ class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): # pylint: disabl "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "kind": {"key": "kind", "type": "str"}, - "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "required_data_connectors": { - "key": "properties.requiredDataConnectors", - "type": "[AlertRuleTemplateDataSource]", - }, - "status": {"key": "properties.status", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "type": "[str]"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "file_entity_ids": {"key": "properties.fileEntityIds", "type": "[str]"}, + "recipient": {"key": "properties.recipient", "type": "str"}, + "urls": {"key": "properties.urls", "type": "[str]"}, + "threats": {"key": "properties.threats", "type": "[str]"}, + "p1_sender": {"key": "properties.p1Sender", "type": "str"}, + "p1_sender_display_name": {"key": "properties.p1SenderDisplayName", "type": "str"}, + "p1_sender_domain": {"key": "properties.p1SenderDomain", "type": "str"}, + "sender_ip": {"key": "properties.senderIP", "type": "str"}, + "p2_sender": {"key": "properties.p2Sender", "type": "str"}, + "p2_sender_display_name": {"key": "properties.p2SenderDisplayName", "type": "str"}, + "p2_sender_domain": {"key": "properties.p2SenderDomain", "type": "str"}, + "receive_date": {"key": "properties.receiveDate", "type": "iso-8601"}, + "network_message_id": {"key": "properties.networkMessageId", "type": "str"}, + "internet_message_id": {"key": "properties.internetMessageId", "type": "str"}, + "subject": {"key": "properties.subject", "type": "str"}, + "language": {"key": "properties.language", "type": "str"}, + "threat_detection_methods": {"key": "properties.threatDetectionMethods", "type": "[str]"}, + "body_fingerprint_bin1": {"key": "properties.bodyFingerprintBin1", "type": "int"}, + "body_fingerprint_bin2": {"key": "properties.bodyFingerprintBin2", "type": "int"}, + "body_fingerprint_bin3": {"key": "properties.bodyFingerprintBin3", "type": "int"}, + "body_fingerprint_bin4": {"key": "properties.bodyFingerprintBin4", "type": "int"}, + "body_fingerprint_bin5": {"key": "properties.bodyFingerprintBin5", "type": "int"}, + "antispam_direction": {"key": "properties.antispamDirection", "type": "str"}, + "delivery_action": {"key": "properties.deliveryAction", "type": "str"}, + "delivery_location": {"key": "properties.deliveryLocation", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + body_fingerprint_bin1: Optional[int] = None, + body_fingerprint_bin2: Optional[int] = None, + body_fingerprint_bin3: Optional[int] = None, + body_fingerprint_bin4: Optional[int] = None, + body_fingerprint_bin5: Optional[int] = None, + antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, + delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, + delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword body_fingerprint_bin1: The bodyFingerprintBin1. + :paramtype body_fingerprint_bin1: int + :keyword body_fingerprint_bin2: The bodyFingerprintBin2. + :paramtype body_fingerprint_bin2: int + :keyword body_fingerprint_bin3: The bodyFingerprintBin3. + :paramtype body_fingerprint_bin3: int + :keyword body_fingerprint_bin4: The bodyFingerprintBin4. + :paramtype body_fingerprint_bin4: int + :keyword body_fingerprint_bin5: The bodyFingerprintBin5. + :paramtype body_fingerprint_bin5: int + :keyword antispam_direction: The directionality of this mail message. Known values are: + "Unknown", "Inbound", "Outbound", and "Intraorg". + :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection + :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and + "Replaced". + :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction + :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder + etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", + "External", "Failed", "Dropped", and "Forwarded". + :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation + """ + super().__init__(**kwargs) + self.kind: str = "MailMessage" + self.additional_data = None + self.friendly_name = None + self.file_entity_ids = None + self.recipient = None + self.urls = None + self.threats = None + self.p1_sender = None + self.p1_sender_display_name = None + self.p1_sender_domain = None + self.sender_ip = None + self.p2_sender = None + self.p2_sender_display_name = None + self.p2_sender_domain = None + self.receive_date = None + self.network_message_id = None + self.internet_message_id = None + self.subject = None + self.language = None + self.threat_detection_methods = None + self.body_fingerprint_bin1 = body_fingerprint_bin1 + self.body_fingerprint_bin2 = body_fingerprint_bin2 + self.body_fingerprint_bin3 = body_fingerprint_bin3 + self.body_fingerprint_bin4 = body_fingerprint_bin4 + self.body_fingerprint_bin5 = body_fingerprint_bin5 + self.antispam_direction = antispam_direction + self.delivery_action = delivery_action + self.delivery_location = delivery_location + + +class MailMessageEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """Mail message entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar file_entity_ids: The File entity ids of this mail message's attachments. + :vartype file_entity_ids: list[str] + :ivar recipient: The recipient of this mail message. Note that in case of multiple recipients + the mail message is forked and each copy has one recipient. + :vartype recipient: str + :ivar urls: The Urls contained in this mail message. + :vartype urls: list[str] + :ivar threats: The threats of this mail message. + :vartype threats: list[str] + :ivar p1_sender: The p1 sender's email address. + :vartype p1_sender: str + :ivar p1_sender_display_name: The p1 sender's display name. + :vartype p1_sender_display_name: str + :ivar p1_sender_domain: The p1 sender's domain. + :vartype p1_sender_domain: str + :ivar sender_ip: The sender's IP address. + :vartype sender_ip: str + :ivar p2_sender: The p2 sender's email address. + :vartype p2_sender: str + :ivar p2_sender_display_name: The p2 sender's display name. + :vartype p2_sender_display_name: str + :ivar p2_sender_domain: The p2 sender's domain. + :vartype p2_sender_domain: str + :ivar receive_date: The receive date of this message. + :vartype receive_date: ~datetime.datetime + :ivar network_message_id: The network message id of this mail message. + :vartype network_message_id: str + :ivar internet_message_id: The internet message id of this mail message. + :vartype internet_message_id: str + :ivar subject: The subject of this mail message. + :vartype subject: str + :ivar language: The language of this mail message. + :vartype language: str + :ivar threat_detection_methods: The threat detection methods. + :vartype threat_detection_methods: list[str] + :ivar body_fingerprint_bin1: The bodyFingerprintBin1. + :vartype body_fingerprint_bin1: int + :ivar body_fingerprint_bin2: The bodyFingerprintBin2. + :vartype body_fingerprint_bin2: int + :ivar body_fingerprint_bin3: The bodyFingerprintBin3. + :vartype body_fingerprint_bin3: int + :ivar body_fingerprint_bin4: The bodyFingerprintBin4. + :vartype body_fingerprint_bin4: int + :ivar body_fingerprint_bin5: The bodyFingerprintBin5. + :vartype body_fingerprint_bin5: int + :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", + "Inbound", "Outbound", and "Intraorg". + :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection + :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and + "Replaced". + :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction + :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. + Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", + "Failed", "Dropped", and "Forwarded". + :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "file_entity_ids": {"readonly": True}, + "recipient": {"readonly": True}, + "urls": {"readonly": True}, + "threats": {"readonly": True}, + "p1_sender": {"readonly": True}, + "p1_sender_display_name": {"readonly": True}, + "p1_sender_domain": {"readonly": True}, + "sender_ip": {"readonly": True}, + "p2_sender": {"readonly": True}, + "p2_sender_display_name": {"readonly": True}, + "p2_sender_domain": {"readonly": True}, + "receive_date": {"readonly": True}, + "network_message_id": {"readonly": True}, + "internet_message_id": {"readonly": True}, + "subject": {"readonly": True}, + "language": {"readonly": True}, + "threat_detection_methods": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "file_entity_ids": {"key": "fileEntityIds", "type": "[str]"}, + "recipient": {"key": "recipient", "type": "str"}, + "urls": {"key": "urls", "type": "[str]"}, + "threats": {"key": "threats", "type": "[str]"}, + "p1_sender": {"key": "p1Sender", "type": "str"}, + "p1_sender_display_name": {"key": "p1SenderDisplayName", "type": "str"}, + "p1_sender_domain": {"key": "p1SenderDomain", "type": "str"}, + "sender_ip": {"key": "senderIP", "type": "str"}, + "p2_sender": {"key": "p2Sender", "type": "str"}, + "p2_sender_display_name": {"key": "p2SenderDisplayName", "type": "str"}, + "p2_sender_domain": {"key": "p2SenderDomain", "type": "str"}, + "receive_date": {"key": "receiveDate", "type": "iso-8601"}, + "network_message_id": {"key": "networkMessageId", "type": "str"}, + "internet_message_id": {"key": "internetMessageId", "type": "str"}, + "subject": {"key": "subject", "type": "str"}, + "language": {"key": "language", "type": "str"}, + "threat_detection_methods": {"key": "threatDetectionMethods", "type": "[str]"}, + "body_fingerprint_bin1": {"key": "bodyFingerprintBin1", "type": "int"}, + "body_fingerprint_bin2": {"key": "bodyFingerprintBin2", "type": "int"}, + "body_fingerprint_bin3": {"key": "bodyFingerprintBin3", "type": "int"}, + "body_fingerprint_bin4": {"key": "bodyFingerprintBin4", "type": "int"}, + "body_fingerprint_bin5": {"key": "bodyFingerprintBin5", "type": "int"}, + "antispam_direction": {"key": "antispamDirection", "type": "str"}, + "delivery_action": {"key": "deliveryAction", "type": "str"}, + "delivery_location": {"key": "deliveryLocation", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + body_fingerprint_bin1: Optional[int] = None, + body_fingerprint_bin2: Optional[int] = None, + body_fingerprint_bin3: Optional[int] = None, + body_fingerprint_bin4: Optional[int] = None, + body_fingerprint_bin5: Optional[int] = None, + antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, + delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, + delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword body_fingerprint_bin1: The bodyFingerprintBin1. + :paramtype body_fingerprint_bin1: int + :keyword body_fingerprint_bin2: The bodyFingerprintBin2. + :paramtype body_fingerprint_bin2: int + :keyword body_fingerprint_bin3: The bodyFingerprintBin3. + :paramtype body_fingerprint_bin3: int + :keyword body_fingerprint_bin4: The bodyFingerprintBin4. + :paramtype body_fingerprint_bin4: int + :keyword body_fingerprint_bin5: The bodyFingerprintBin5. + :paramtype body_fingerprint_bin5: int + :keyword antispam_direction: The directionality of this mail message. Known values are: + "Unknown", "Inbound", "Outbound", and "Intraorg". + :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection + :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", and + "Replaced". + :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction + :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder + etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", + "External", "Failed", "Dropped", and "Forwarded". + :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation + """ + super().__init__(**kwargs) + self.file_entity_ids = None + self.recipient = None + self.urls = None + self.threats = None + self.p1_sender = None + self.p1_sender_display_name = None + self.p1_sender_domain = None + self.sender_ip = None + self.p2_sender = None + self.p2_sender_display_name = None + self.p2_sender_domain = None + self.receive_date = None + self.network_message_id = None + self.internet_message_id = None + self.subject = None + self.language = None + self.threat_detection_methods = None + self.body_fingerprint_bin1 = body_fingerprint_bin1 + self.body_fingerprint_bin2 = body_fingerprint_bin2 + self.body_fingerprint_bin3 = body_fingerprint_bin3 + self.body_fingerprint_bin4 = body_fingerprint_bin4 + self.body_fingerprint_bin5 = body_fingerprint_bin5 + self.antispam_direction = antispam_direction + self.delivery_action = delivery_action + self.delivery_location = delivery_location + + +class MalwareEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a malware entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar category: The malware category by the vendor, e.g. Trojan. + :vartype category: str + :ivar file_entity_ids: List of linked file entity identifiers on which the malware was found. + :vartype file_entity_ids: list[str] + :ivar malware_name: The malware name by the vendor, e.g. Win32/Toga!rfn. + :vartype malware_name: str + :ivar process_entity_ids: List of linked process entity identifiers on which the malware was + found. + :vartype process_entity_ids: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "category": {"readonly": True}, + "file_entity_ids": {"readonly": True}, + "malware_name": {"readonly": True}, + "process_entity_ids": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "file_entity_ids": {"key": "properties.fileEntityIds", "type": "[str]"}, + "malware_name": {"key": "properties.malwareName", "type": "str"}, + "process_entity_ids": {"key": "properties.processEntityIds", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "Malware" + self.additional_data = None + self.friendly_name = None + self.category = None + self.file_entity_ids = None + self.malware_name = None + self.process_entity_ids = None + + +class MalwareEntityProperties(EntityCommonProperties): + """Malware entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar category: The malware category by the vendor, e.g. Trojan. + :vartype category: str + :ivar file_entity_ids: List of linked file entity identifiers on which the malware was found. + :vartype file_entity_ids: list[str] + :ivar malware_name: The malware name by the vendor, e.g. Win32/Toga!rfn. + :vartype malware_name: str + :ivar process_entity_ids: List of linked process entity identifiers on which the malware was + found. + :vartype process_entity_ids: list[str] + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "category": {"readonly": True}, + "file_entity_ids": {"readonly": True}, + "malware_name": {"readonly": True}, + "process_entity_ids": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "file_entity_ids": {"key": "fileEntityIds", "type": "[str]"}, + "malware_name": {"key": "malwareName", "type": "str"}, + "process_entity_ids": {"key": "processEntityIds", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.category = None + self.file_entity_ids = None + self.malware_name = None + self.process_entity_ids = None + + +class ManualTriggerRequestBody(_serialization.Model): + """ManualTriggerRequestBody. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: + :vartype tenant_id: str + :ivar logic_apps_resource_id: Required. + :vartype logic_apps_resource_id: str + """ + + _validation = { + "logic_apps_resource_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "logic_apps_resource_id": {"key": "logicAppsResourceId", "type": "str"}, + } + + def __init__(self, *, logic_apps_resource_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: + :paramtype tenant_id: str + :keyword logic_apps_resource_id: Required. + :paramtype logic_apps_resource_id: str + """ + super().__init__(**kwargs) + self.tenant_id = tenant_id + self.logic_apps_resource_id = logic_apps_resource_id + + +class MCASCheckRequirements(DataConnectorsCheckRequirements): + """Represents MCAS (Microsoft Cloud App Security) requirements check request. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.kind: str = "MicrosoftCloudAppSecurity" + self.tenant_id = tenant_id + + +class MCASCheckRequirementsProperties(DataConnectorTenantId): + """MCAS (Microsoft Cloud App Security) requirements check properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class MCASDataConnector(DataConnector): + """Represents MCAS (Microsoft Cloud App Security) data connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "MCASDataConnectorDataTypes"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.MCASDataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MicrosoftCloudAppSecurity" + self.tenant_id = tenant_id + self.data_types = data_types + + +class MCASDataConnectorDataTypes(AlertsDataTypeOfDataConnector): + """The available data types for MCAS (Microsoft Cloud App Security) data connector. + + All required parameters must be populated in order to send to Azure. + + :ivar alerts: Alerts data type connection. Required. + :vartype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar discovery_logs: Discovery log data type connection. + :vartype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + """ + + _validation = { + "alerts": {"required": True}, + } + + _attribute_map = { + "alerts": {"key": "alerts", "type": "DataConnectorDataTypeCommon"}, + "discovery_logs": {"key": "discoveryLogs", "type": "DataConnectorDataTypeCommon"}, + } + + def __init__( + self, + *, + alerts: "_models.DataConnectorDataTypeCommon", + discovery_logs: Optional["_models.DataConnectorDataTypeCommon"] = None, + **kwargs: Any + ) -> None: + """ + :keyword alerts: Alerts data type connection. Required. + :paramtype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :keyword discovery_logs: Discovery log data type connection. + :paramtype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + """ + super().__init__(alerts=alerts, **kwargs) + self.discovery_logs = discovery_logs + + +class MCASDataConnectorProperties(DataConnectorTenantId): + """MCAS (Microsoft Cloud App Security) data connector properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + """ + + _validation = { + "tenant_id": {"required": True}, + "data_types": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "MCASDataConnectorDataTypes"}, + } + + def __init__(self, *, tenant_id: str, data_types: "_models.MCASDataConnectorDataTypes", **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + """ + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class MDATPCheckRequirements(DataConnectorsCheckRequirements): + """Represents MDATP (Microsoft Defender Advanced Threat Protection) requirements check request. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.kind: str = "MicrosoftDefenderAdvancedThreatProtection" + self.tenant_id = tenant_id + + +class MDATPCheckRequirementsProperties(DataConnectorTenantId): + """MDATP (Microsoft Defender Advanced Threat Protection) requirements check properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class MDATPDataConnector(DataConnector): + """Represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MicrosoftDefenderAdvancedThreatProtection" + self.tenant_id = tenant_id + self.data_types = data_types + + +class MDATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): + """MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. + + All required parameters must be populated in order to send to Azure. + + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__( + self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any + ) -> None: + """ + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, data_types=data_types, **kwargs) + self.data_types = data_types + self.tenant_id = tenant_id + + +class MetadataAuthor(_serialization.Model): + """Publisher or creator of the content item. + + :ivar name: Name of the author. Company or person. + :vartype name: str + :ivar email: Email of author contact. + :vartype email: str + :ivar link: Link for author/vendor page. + :vartype link: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "email": {"key": "email", "type": "str"}, + "link": {"key": "link", "type": "str"}, + } + + def __init__( + self, *, name: Optional[str] = None, email: Optional[str] = None, link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the author. Company or person. + :paramtype name: str + :keyword email: Email of author contact. + :paramtype email: str + :keyword link: Link for author/vendor page. + :paramtype link: str + """ + super().__init__(**kwargs) + self.name = name + self.email = email + self.link = link + + +class MetadataCategories(_serialization.Model): + """ies for the solution content item. + + :ivar domains: domain for the solution content item. + :vartype domains: list[str] + :ivar verticals: Industry verticals for the solution content item. + :vartype verticals: list[str] + """ + + _attribute_map = { + "domains": {"key": "domains", "type": "[str]"}, + "verticals": {"key": "verticals", "type": "[str]"}, + } + + def __init__( + self, *, domains: Optional[List[str]] = None, verticals: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword domains: domain for the solution content item. + :paramtype domains: list[str] + :keyword verticals: Industry verticals for the solution content item. + :paramtype verticals: list[str] + """ + super().__init__(**kwargs) + self.domains = domains + self.verticals = verticals + + +class MetadataDependencies(_serialization.Model): + """Dependencies for the content item, what other content items it requires to work. Can describe + more complex dependencies using a recursive/nested structure. For a single dependency an + id/kind/version can be supplied or operator/criteria for complex dependencies. + + :ivar content_id: Id of the content item we depend on. + :vartype content_id: str + :ivar kind: Type of the content item we depend on. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar version: Version of the the content item we depend on. Can be blank, * or missing to + indicate any version fulfills the dependency. If version does not match our defined numeric + format then an exact match is required. + :vartype version: str + :ivar name: Name of the content item. + :vartype name: str + :ivar operator: Operator used for list of dependencies in criteria array. Known values are: + "AND", "OR", "AND", and "OR". + :vartype operator: str or ~azure.mgmt.securityinsight.models.Operator + :ivar criteria: This is the list of dependencies we must fulfill, according to the AND/OR + operator. + :vartype criteria: list[~azure.mgmt.securityinsight.models.MetadataDependencies] + """ + + _attribute_map = { + "content_id": {"key": "contentId", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operator": {"key": "operator", "type": "str"}, + "criteria": {"key": "criteria", "type": "[MetadataDependencies]"}, + } + + def __init__( + self, + *, + content_id: Optional[str] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + version: Optional[str] = None, + name: Optional[str] = None, + operator: Optional[Union[str, "_models.Operator"]] = None, + criteria: Optional[List["_models.MetadataDependencies"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_id: Id of the content item we depend on. + :paramtype content_id: str + :keyword kind: Type of the content item we depend on. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword version: Version of the the content item we depend on. Can be blank, * or missing to + indicate any version fulfills the dependency. If version does not match our defined numeric + format then an exact match is required. + :paramtype version: str + :keyword name: Name of the content item. + :paramtype name: str + :keyword operator: Operator used for list of dependencies in criteria array. Known values are: + "AND", "OR", "AND", and "OR". + :paramtype operator: str or ~azure.mgmt.securityinsight.models.Operator + :keyword criteria: This is the list of dependencies we must fulfill, according to the AND/OR + operator. + :paramtype criteria: list[~azure.mgmt.securityinsight.models.MetadataDependencies] + """ + super().__init__(**kwargs) + self.content_id = content_id + self.kind = kind + self.version = version + self.name = name + self.operator = operator + self.criteria = criteria + + +class MetadataList(_serialization.Model): + """List of all the metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Array of metadata. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.MetadataModel] + :ivar next_link: URL to fetch the next page of metadata. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MetadataModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.MetadataModel"], **kwargs: Any) -> None: + """ + :keyword value: Array of metadata. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.MetadataModel] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MetadataModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Metadata resource definition. + + 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar parent_id: Full parent resource ID of the content item the metadata is for. This is the + full resource ID including the scope (subscription and resource group). + :vartype parent_id: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar kind: The kind of content the metadata is for. + :vartype kind: str + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the metadata - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the solution content item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the solution content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date solution content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the solution content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the solution template. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "parent_id": {"key": "properties.parentId", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "kind": {"key": "properties.kind", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "custom_version": {"key": "properties.customVersion", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "icon": {"key": "properties.icon", "type": "str"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "properties.previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + etag: Optional[str] = None, + content_id: Optional[str] = None, + parent_id: Optional[str] = None, + version: Optional[str] = None, + kind: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword parent_id: Full parent resource ID of the content item the metadata is for. This is + the full resource ID including the scope (subscription and resource group). + :paramtype parent_id: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword kind: The kind of content the metadata is for. + :paramtype kind: str + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the metadata - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the solution content item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the solution content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date solution content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the solution content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the solution template. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + """ + super().__init__(etag=etag, **kwargs) + self.content_id = content_id + self.parent_id = parent_id + self.version = version + self.kind = kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + + +class MetadataPatch(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Metadata patch request body. + + 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar parent_id: Full parent resource ID of the content item the metadata is for. This is the + full resource ID including the scope (subscription and resource group). + :vartype parent_id: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar kind: The kind of content the metadata is for. + :vartype kind: str + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the metadata - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the solution content item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the solution content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date solution content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the solution content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the solution template. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "parent_id": {"key": "properties.parentId", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "kind": {"key": "properties.kind", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "custom_version": {"key": "properties.customVersion", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "icon": {"key": "properties.icon", "type": "str"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "properties.previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + etag: Optional[str] = None, + content_id: Optional[str] = None, + parent_id: Optional[str] = None, + version: Optional[str] = None, + kind: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword parent_id: Full parent resource ID of the content item the metadata is for. This is + the full resource ID including the scope (subscription and resource group). + :paramtype parent_id: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword kind: The kind of content the metadata is for. + :paramtype kind: str + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the metadata - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the solution content item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the solution content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date solution content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the solution content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the solution template. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + """ + super().__init__(etag=etag, **kwargs) + self.content_id = content_id + self.parent_id = parent_id + self.version = version + self.kind = kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + + +class MetadataSource(_serialization.Model): + """The original source of the content item, where it comes from. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Source type of the content. Required. Known values are: "LocalWorkspace", + "Community", "Solution", and "SourceRepository". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SourceKind + :ivar name: Name of the content source. The repo name, solution name, LA workspace name etc. + :vartype name: str + :ivar source_id: ID of the content source. The solution ID, workspace ID, etc. + :vartype source_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "source_id": {"key": "sourceId", "type": "str"}, + } + + def __init__( + self, + *, + kind: Union[str, "_models.SourceKind"], + name: Optional[str] = None, + source_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: Source type of the content. Required. Known values are: "LocalWorkspace", + "Community", "Solution", and "SourceRepository". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.SourceKind + :keyword name: Name of the content source. The repo name, solution name, LA workspace name + etc. + :paramtype name: str + :keyword source_id: ID of the content source. The solution ID, workspace ID, etc. + :paramtype source_id: str + """ + super().__init__(**kwargs) + self.kind = kind + self.name = name + self.source_id = source_id + + +class MetadataSupport(_serialization.Model): + """Support information for the content item. + + All required parameters must be populated in order to send to Azure. + + :ivar tier: Type of support for content item. Required. Known values are: "Microsoft", + "Partner", and "Community". + :vartype tier: str or ~azure.mgmt.securityinsight.models.SupportTier + :ivar name: Name of the support contact. Company or person. + :vartype name: str + :ivar email: Email of support contact. + :vartype email: str + :ivar link: Link for support help, like to support page to open a ticket etc. + :vartype link: str + """ + + _validation = { + "tier": {"required": True}, + } + + _attribute_map = { + "tier": {"key": "tier", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "email": {"key": "email", "type": "str"}, + "link": {"key": "link", "type": "str"}, + } + + def __init__( + self, + *, + tier: Union[str, "_models.SupportTier"], + name: Optional[str] = None, + email: Optional[str] = None, + link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tier: Type of support for content item. Required. Known values are: "Microsoft", + "Partner", and "Community". + :paramtype tier: str or ~azure.mgmt.securityinsight.models.SupportTier + :keyword name: Name of the support contact. Company or person. + :paramtype name: str + :keyword email: Email of support contact. + :paramtype email: str + :keyword link: Link for support help, like to support page to open a ticket etc. + :paramtype link: str + """ + super().__init__(**kwargs) + self.tier = tier + self.name = name + self.email = email + self.link = link + + +class MicrosoftPurviewInformationProtectionCheckRequirements(DataConnectorsCheckRequirements): + """Represents MicrosoftPurviewInformationProtection requirements check request. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.kind: str = "MicrosoftPurviewInformationProtection" + self.tenant_id = tenant_id + + +class MicrosoftPurviewInformationProtectionCheckRequirementsProperties(DataConnectorTenantId): + """MicrosoftPurviewInformationProtection requirements check properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class MicrosoftPurviewInformationProtectionConnectorDataTypes(_serialization.Model): + """The available data types for Microsoft Purview Information Protection data connector. + + All required parameters must be populated in order to send to Azure. + + :ivar logs: Logs data type. Required. + :vartype logs: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs + """ + + _validation = { + "logs": {"required": True}, + } + + _attribute_map = { + "logs": {"key": "logs", "type": "MicrosoftPurviewInformationProtectionConnectorDataTypesLogs"}, + } + + def __init__( + self, *, logs: "_models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs", **kwargs: Any + ) -> None: + """ + :keyword logs: Logs data type. Required. + :paramtype logs: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs + """ + super().__init__(**kwargs) + self.logs = logs + + +class MicrosoftPurviewInformationProtectionConnectorDataTypesLogs(DataConnectorDataTypeCommon): + """Logs data type. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: + """ + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super().__init__(state=state, **kwargs) + + +class MicrosoftPurviewInformationProtectionDataConnector(DataConnector): + """Represents Microsoft Purview Information Protection data connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": { + "key": "properties.dataTypes", + "type": "MicrosoftPurviewInformationProtectionConnectorDataTypes", + }, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.MicrosoftPurviewInformationProtectionConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypes + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MicrosoftPurviewInformationProtection" + self.tenant_id = tenant_id + self.data_types = data_types + + +class MicrosoftPurviewInformationProtectionDataConnectorProperties(DataConnectorTenantId): + """Microsoft Purview Information Protection data connector properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypes + """ + + _validation = { + "tenant_id": {"required": True}, + "data_types": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "MicrosoftPurviewInformationProtectionConnectorDataTypes"}, + } + + def __init__( + self, + *, + tenant_id: str, + data_types: "_models.MicrosoftPurviewInformationProtectionConnectorDataTypes", + **kwargs: Any + ) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: + ~azure.mgmt.securityinsight.models.MicrosoftPurviewInformationProtectionConnectorDataTypes + """ + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes + """Represents MicrosoftSecurityIncidentCreation rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :vartype display_names_exclude_filter: list[str] + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "last_modified_utc": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "display_names_filter": {"key": "properties.displayNamesFilter", "type": "[str]"}, + "display_names_exclude_filter": {"key": "properties.displayNamesExcludeFilter", "type": "[str]"}, + "product_filter": {"key": "properties.productFilter", "type": "str"}, + "severities_filter": {"key": "properties.severitiesFilter", "type": "[str]"}, + "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MicrosoftSecurityIncidentCreation" + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(_serialization.Model): + """MicrosoftSecurityIncidentCreation rule common property bag. + + All required parameters must be populated in order to send to Azure. + + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :vartype display_names_exclude_filter: list[str] + :ivar product_filter: The alerts' productName on which the cases will be generated. Required. + Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced + Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for + IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat + Protection". + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + "product_filter": {"required": True}, + } + + _attribute_map = { + "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, + "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, + "product_filter": {"key": "productFilter", "type": "str"}, + "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, + } + + def __init__( + self, + *, + product_filter: Union[str, "_models.MicrosoftSecurityProductName"], + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword product_filter: The alerts' productName on which the cases will be generated. + Required. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced + Threat Protection". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + super().__init__(**kwargs) + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + + +class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): + """MicrosoftSecurityIncidentCreation rule property bag. + + 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 display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :vartype display_names_exclude_filter: list[str] + :ivar product_filter: The alerts' productName on which the cases will be generated. Required. + Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced + Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for + IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat + Protection". + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. Required. + :vartype display_name: str + :ivar enabled: Determines whether this alert rule is enabled or disabled. Required. + :vartype enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + "product_filter": {"required": True}, + "display_name": {"required": True}, + "enabled": {"required": True}, + "last_modified_utc": {"readonly": True}, + } + + _attribute_map = { + "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, + "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, + "product_filter": {"key": "productFilter", "type": "str"}, + "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, + "alert_rule_template_name": {"key": "alertRuleTemplateName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + "last_modified_utc": {"key": "lastModifiedUtc", "type": "iso-8601"}, + } + + def __init__( + self, + *, + product_filter: Union[str, "_models.MicrosoftSecurityProductName"], + display_name: str, + enabled: bool, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword product_filter: The alerts' productName on which the cases will be generated. + Required. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT", "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced + Threat Protection". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: The display name for alerts created by this alert rule. Required. + :paramtype display_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. Required. + :paramtype enabled: bool + """ + super().__init__( + display_names_filter=display_names_filter, + display_names_exclude_filter=display_names_exclude_filter, + product_filter=product_filter, + severities_filter=severities_filter, + **kwargs + ) + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplate( + AlertRuleTemplate +): # pylint: disable=too-many-instance-attributes + """Represents MicrosoftSecurityIncidentCreation rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :vartype display_names_exclude_filter: list[str] + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "required_data_connectors": { + "key": "properties.requiredDataConnectors", + "type": "[AlertRuleTemplateDataSource]", + }, + "status": {"key": "properties.status", "type": "str"}, + "display_names_filter": {"key": "properties.displayNamesFilter", "type": "[str]"}, + "display_names_exclude_filter": {"key": "properties.displayNamesExcludeFilter", "type": "[str]"}, + "product_filter": {"key": "properties.productFilter", "type": "str"}, + "severities_filter": {"key": "properties.severitiesFilter", "type": "[str]"}, + } + + def __init__( + self, + *, + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data sources for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + super().__init__(**kwargs) + self.kind: str = "MicrosoftSecurityIncidentCreation" + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.last_updated_date_utc = None + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties( + AlertRuleTemplatePropertiesBase +): # pylint: disable=too-many-instance-attributes + """MicrosoftSecurityIncidentCreation rule template properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :vartype display_names_exclude_filter: list[str] + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"readonly": True}, + } + + _attribute_map = { + "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, + "description": {"key": "description", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, + "status": {"key": "status", "type": "str"}, + "display_names_filter": {"key": "displayNamesFilter", "type": "[str]"}, + "display_names_exclude_filter": {"key": "displayNamesExcludeFilter", "type": "[str]"}, + "product_filter": {"key": "productFilter", "type": "str"}, + "severities_filter": {"key": "severitiesFilter", "type": "[str]"}, + } + + def __init__( + self, + *, + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data sources for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", + "Office 365 Advanced Threat Protection", and "Microsoft Defender Advanced Threat Protection". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + super().__init__( + alert_rules_created_by_template_count=alert_rules_created_by_template_count, + description=description, + display_name=display_name, + required_data_connectors=required_data_connectors, + status=status, + **kwargs + ) + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + + +class MLBehaviorAnalyticsAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes + """Represents MLBehaviorAnalytics alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "description": {"readonly": True}, + "display_name": {"readonly": True}, + "last_modified_utc": {"readonly": True}, + "severity": {"readonly": True}, + "tactics": {"readonly": True}, + "techniques": {"readonly": True}, + "sub_techniques": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + "severity": {"key": "properties.severity", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + alert_rule_template_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MLBehaviorAnalytics" + self.alert_rule_template_name = alert_rule_template_name + self.description = None + self.display_name = None + self.enabled = enabled + self.last_modified_utc = None + self.severity = None + self.tactics = None + self.techniques = None + self.sub_techniques = None + + +class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes + """Represents MLBehaviorAnalytics alert rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "required_data_connectors": { + "key": "properties.requiredDataConnectors", + "type": "[AlertRuleTemplateDataSource]", + }, + "status": {"key": "properties.status", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, "severity": {"key": "properties.severity", "type": "str"}, } @@ -14868,9 +16973,110 @@ def __init__( status: Optional[Union[str, "_models.TemplateStatus"]] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - **kwargs - ): + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data sources for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the alert rule. + :paramtype techniques: list[str] + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + """ + super().__init__(**kwargs) + self.kind: str = "MLBehaviorAnalytics" + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.last_updated_date_utc = None + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.tactics = tactics + self.techniques = techniques + self.severity = severity + + +class MLBehaviorAnalyticsAlertRuleTemplateProperties(AlertRuleTemplateWithMitreProperties): + """MLBehaviorAnalytics alert rule template 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 alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar severity: The severity for alerts created by this alert rule. Required. Known values are: + "High", "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + """ + + _validation = { + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"readonly": True}, + "severity": {"required": True}, + } + + _attribute_map = { + "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, + "description": {"key": "description", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, + "status": {"key": "status", "type": "str"}, + "tactics": {"key": "tactics", "type": "[str]"}, + "techniques": {"key": "techniques", "type": "[str]"}, + "severity": {"key": "severity", "type": "str"}, + } + + def __init__( + self, + *, + severity: Union[str, "_models.AlertSeverity"], + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -14889,136 +17095,275 @@ def __init__( :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". + :keyword severity: The severity for alerts created by this alert rule. Required. Known values + are: "High", "Medium", "Low", and "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ - super().__init__(**kwargs) - self.kind: str = "MLBehaviorAnalytics" - self.alert_rules_created_by_template_count = alert_rules_created_by_template_count - self.last_updated_date_utc = None - self.created_date_utc = None - self.description = description - self.display_name = display_name - self.required_data_connectors = required_data_connectors - self.status = status - self.tactics = tactics - self.techniques = techniques + super().__init__( + alert_rules_created_by_template_count=alert_rules_created_by_template_count, + description=description, + display_name=display_name, + required_data_connectors=required_data_connectors, + status=status, + tactics=tactics, + techniques=techniques, + **kwargs + ) self.severity = severity -class MLBehaviorAnalyticsAlertRuleTemplateProperties(AlertRuleTemplateWithMitreProperties): - """MLBehaviorAnalytics alert rule template properties. +class MSTICheckRequirements(DataConnectorsCheckRequirements): + """Represents Microsoft Threat Intelligence requirements check request. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.kind: str = "MicrosoftThreatIntelligence" + self.tenant_id = tenant_id + + +class MSTICheckRequirementsProperties(DataConnectorTenantId): + """Microsoft Threat Intelligence requirements check properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class MSTIDataConnector(DataConnector): + """Represents Microsoft Threat Intelligence data connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "MSTIDataConnectorDataTypes"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.MSTIDataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "MicrosoftThreatIntelligence" + self.tenant_id = tenant_id + self.data_types = data_types + + +class MSTIDataConnectorDataTypes(_serialization.Model): + """The available data types for Microsoft Threat Intelligence Platforms data connector. + + All required parameters must be populated in order to send to Azure. + + :ivar microsoft_emerging_threat_feed: Data type for Microsoft Threat Intelligence Platforms + data connector. Required. + :vartype microsoft_emerging_threat_feed: + ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed + """ + + _validation = { + "microsoft_emerging_threat_feed": {"required": True}, + } + + _attribute_map = { + "microsoft_emerging_threat_feed": { + "key": "microsoftEmergingThreatFeed", + "type": "MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", + }, + } + + def __init__( + self, + *, + microsoft_emerging_threat_feed: "_models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", + **kwargs: Any + ) -> None: + """ + :keyword microsoft_emerging_threat_feed: Data type for Microsoft Threat Intelligence Platforms + data connector. Required. + :paramtype microsoft_emerging_threat_feed: + ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed + """ + super().__init__(**kwargs) + self.microsoft_emerging_threat_feed = microsoft_emerging_threat_feed + + +class MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed(DataConnectorDataTypeCommon): + """Data type for Microsoft Threat Intelligence Platforms data connector. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar lookback_period: The lookback period for the feed to be imported. Required. + :vartype lookback_period: str + """ + + _validation = { + "state": {"required": True}, + "lookback_period": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "lookback_period": {"key": "lookbackPeriod", "type": "str"}, + } - Variables are only populated by the server, and will be ignored when sending a request. + def __init__(self, *, state: Union[str, "_models.DataTypeState"], lookback_period: str, **kwargs: Any) -> None: + """ + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword lookback_period: The lookback period for the feed to be imported. Required. + :paramtype lookback_period: str + """ + super().__init__(state=state, **kwargs) + self.lookback_period = lookback_period + + +class MSTIDataConnectorProperties(DataConnectorTenantId): + """Microsoft Threat Intelligence data connector properties. All required parameters must be populated in order to send to Azure. - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. - :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] - :ivar severity: The severity for alerts created by this alert rule. Required. Known values are: - "High", "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes """ _validation = { - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, - "severity": {"required": True}, + "tenant_id": {"required": True}, + "data_types": {"required": True}, } _attribute_map = { - "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, - "description": {"key": "description", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, - "status": {"key": "status", "type": "str"}, - "tactics": {"key": "tactics", "type": "[str]"}, - "techniques": {"key": "techniques", "type": "[str]"}, - "severity": {"key": "severity", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "MSTIDataConnectorDataTypes"}, } - def __init__( - self, - *, - severity: Union[str, "_models.AlertSeverity"], - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, - techniques: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, tenant_id: str, data_types: "_models.MSTIDataConnectorDataTypes", **kwargs: Any) -> None: """ - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. - :paramtype display_name: str - :keyword required_data_connectors: The required data sources for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword tactics: The tactics of the alert rule. - :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :keyword techniques: The techniques of the alert rule. - :paramtype techniques: list[str] - :keyword severity: The severity for alerts created by this alert rule. Required. Known values - are: "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes """ - super().__init__( - alert_rules_created_by_template_count=alert_rules_created_by_template_count, - description=description, - display_name=display_name, - required_data_connectors=required_data_connectors, - status=status, - tactics=tactics, - techniques=techniques, - **kwargs - ) - self.severity = severity + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types -class MSTICheckRequirements(DataConnectorsCheckRequirements): - """Represents Microsoft Threat Intelligence requirements check request. +class MtpCheckRequirements(DataConnectorsCheckRequirements): + """Represents MTP (Microsoft Threat Protection) requirements check request. All required parameters must be populated in order to send to Azure. :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -15033,18 +17378,18 @@ class MSTICheckRequirements(DataConnectorsCheckRequirements): "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str """ super().__init__(**kwargs) - self.kind: str = "MicrosoftThreatIntelligence" + self.kind: str = "MicrosoftThreatProtection" self.tenant_id = tenant_id -class MSTICheckRequirementsProperties(DataConnectorTenantId): - """Microsoft Threat Intelligence requirements check properties. +class MTPCheckRequirementsProperties(DataConnectorTenantId): + """MTP (Microsoft Threat Protection) requirements check properties. All required parameters must be populated in order to send to Azure. @@ -15060,7 +17405,7 @@ class MSTICheckRequirementsProperties(DataConnectorTenantId): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -15068,8 +17413,8 @@ def __init__(self, *, tenant_id: str, **kwargs): super().__init__(tenant_id=tenant_id, **kwargs) -class MSTIDataConnector(DataConnector): - """Represents Microsoft Threat Intelligence data connector. +class MTPDataConnector(DataConnector): + """Represents MTP (Microsoft Threat Protection) data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -15091,15 +17436,17 @@ class MSTIDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes + :vartype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :ivar filtered_providers: The available filtered providers for the connector. + :vartype filtered_providers: ~azure.mgmt.securityinsight.models.MtpFilteredProviders """ _validation = { @@ -15118,7 +17465,8 @@ class MSTIDataConnector(DataConnector): "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "MSTIDataConnectorDataTypes"}, + "data_types": {"key": "properties.dataTypes", "type": "MTPDataConnectorDataTypes"}, + "filtered_providers": {"key": "properties.filteredProviders", "type": "MtpFilteredProviders"}, } def __init__( @@ -15126,239 +17474,518 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["_models.MSTIDataConnectorDataTypes"] = None, - **kwargs - ): + data_types: Optional["_models.MTPDataConnectorDataTypes"] = None, + filtered_providers: Optional["_models.MtpFilteredProviders"] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes + :paramtype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :keyword filtered_providers: The available filtered providers for the connector. + :paramtype filtered_providers: ~azure.mgmt.securityinsight.models.MtpFilteredProviders """ super().__init__(etag=etag, **kwargs) - self.kind: str = "MicrosoftThreatIntelligence" + self.kind: str = "MicrosoftThreatProtection" self.tenant_id = tenant_id self.data_types = data_types + self.filtered_providers = filtered_providers -class MSTIDataConnectorDataTypes(_serialization.Model): - """The available data types for Microsoft Threat Intelligence Platforms data connector. +class MTPDataConnectorDataTypes(_serialization.Model): + """The available data types for Microsoft Threat Protection Platforms data connector. All required parameters must be populated in order to send to Azure. - :ivar bing_safety_phishing_url: Data type for Microsoft Threat Intelligence Platforms data - connector. Required. - :vartype bing_safety_phishing_url: - ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesBingSafetyPhishingURL - :ivar microsoft_emerging_threat_feed: Data type for Microsoft Threat Intelligence Platforms - data connector. Required. - :vartype microsoft_emerging_threat_feed: - ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed + :ivar incidents: Incidents data type for Microsoft Threat Protection Platforms data connector. + Required. + :vartype incidents: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesIncidents + :ivar alerts: Alerts data type for Microsoft Threat Protection Platforms data connector. + :vartype alerts: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesAlerts """ _validation = { - "bing_safety_phishing_url": {"required": True}, - "microsoft_emerging_threat_feed": {"required": True}, + "incidents": {"required": True}, } _attribute_map = { - "bing_safety_phishing_url": { - "key": "bingSafetyPhishingURL", - "type": "MSTIDataConnectorDataTypesBingSafetyPhishingURL", - }, - "microsoft_emerging_threat_feed": { - "key": "microsoftEmergingThreatFeed", - "type": "MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", - }, + "incidents": {"key": "incidents", "type": "MTPDataConnectorDataTypesIncidents"}, + "alerts": {"key": "alerts", "type": "MTPDataConnectorDataTypesAlerts"}, } def __init__( self, *, - bing_safety_phishing_url: "_models.MSTIDataConnectorDataTypesBingSafetyPhishingURL", - microsoft_emerging_threat_feed: "_models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", - **kwargs - ): + incidents: "_models.MTPDataConnectorDataTypesIncidents", + alerts: Optional["_models.MTPDataConnectorDataTypesAlerts"] = None, + **kwargs: Any + ) -> None: """ - :keyword bing_safety_phishing_url: Data type for Microsoft Threat Intelligence Platforms data + :keyword incidents: Incidents data type for Microsoft Threat Protection Platforms data connector. Required. - :paramtype bing_safety_phishing_url: - ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesBingSafetyPhishingURL - :keyword microsoft_emerging_threat_feed: Data type for Microsoft Threat Intelligence Platforms - data connector. Required. - :paramtype microsoft_emerging_threat_feed: - ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed + :paramtype incidents: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesIncidents + :keyword alerts: Alerts data type for Microsoft Threat Protection Platforms data connector. + :paramtype alerts: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesAlerts """ super().__init__(**kwargs) - self.bing_safety_phishing_url = bing_safety_phishing_url - self.microsoft_emerging_threat_feed = microsoft_emerging_threat_feed + self.incidents = incidents + self.alerts = alerts -class MSTIDataConnectorDataTypesBingSafetyPhishingURL(DataConnectorDataTypeCommon): - """Data type for Microsoft Threat Intelligence Platforms data connector. +class MTPDataConnectorDataTypesAlerts(DataConnectorDataTypeCommon): + """Alerts data type for Microsoft Threat Protection Platforms data connector. All required parameters must be populated in order to send to Azure. :ivar state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState - :ivar lookback_period: lookback period. Required. - :vartype lookback_period: str """ _validation = { "state": {"required": True}, - "lookback_period": {"required": True}, } _attribute_map = { "state": {"key": "state", "type": "str"}, - "lookback_period": {"key": "lookbackPeriod", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], lookback_period: str, **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState - :keyword lookback_period: lookback period. Required. - :paramtype lookback_period: str """ super().__init__(state=state, **kwargs) - self.lookback_period = lookback_period -class MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed(DataConnectorDataTypeCommon): - """Data type for Microsoft Threat Intelligence Platforms data connector. +class MTPDataConnectorDataTypesIncidents(DataConnectorDataTypeCommon): + """Incidents data type for Microsoft Threat Protection Platforms data connector. All required parameters must be populated in order to send to Azure. :ivar state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState - :ivar lookback_period: lookback period. Required. - :vartype lookback_period: str """ _validation = { "state": {"required": True}, - "lookback_period": {"required": True}, } _attribute_map = { "state": {"key": "state", "type": "str"}, - "lookback_period": {"key": "lookbackPeriod", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], lookback_period: str, **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState - :keyword lookback_period: lookback period. Required. - :paramtype lookback_period: str """ super().__init__(state=state, **kwargs) - self.lookback_period = lookback_period -class MSTIDataConnectorProperties(DataConnectorTenantId): - """Microsoft Threat Intelligence data connector properties. +class MTPDataConnectorProperties(DataConnectorTenantId): + """MTP (Microsoft Threat Protection) data connector properties. All required parameters must be populated in order to send to Azure. :ivar tenant_id: The tenant id to connect to, and get the data from. Required. :vartype tenant_id: str :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes + :vartype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :ivar filtered_providers: The available filtered providers for the connector. + :vartype filtered_providers: ~azure.mgmt.securityinsight.models.MtpFilteredProviders + """ + + _validation = { + "tenant_id": {"required": True}, + "data_types": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "MTPDataConnectorDataTypes"}, + "filtered_providers": {"key": "filteredProviders", "type": "MtpFilteredProviders"}, + } + + def __init__( + self, + *, + tenant_id: str, + data_types: "_models.MTPDataConnectorDataTypes", + filtered_providers: Optional["_models.MtpFilteredProviders"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :keyword filtered_providers: The available filtered providers for the connector. + :paramtype filtered_providers: ~azure.mgmt.securityinsight.models.MtpFilteredProviders + """ + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + self.filtered_providers = filtered_providers + + +class MtpFilteredProviders(_serialization.Model): + """Represents the connector's Filtered providers. + + All required parameters must be populated in order to send to Azure. + + :ivar alerts: Alerts filtered providers. When filters are not applied, all alerts will stream + through the MTP pipeline, still in private preview for all products EXCEPT MDA and MDI, which + are in GA state. Required. + :vartype alerts: list[str or ~azure.mgmt.securityinsight.models.MtpProvider] + """ + + _validation = { + "alerts": {"required": True}, + } + + _attribute_map = { + "alerts": {"key": "alerts", "type": "[str]"}, + } + + def __init__(self, *, alerts: List[Union[str, "_models.MtpProvider"]], **kwargs: Any) -> None: + """ + :keyword alerts: Alerts filtered providers. When filters are not applied, all alerts will + stream through the MTP pipeline, still in private preview for all products EXCEPT MDA and MDI, + which are in GA state. Required. + :paramtype alerts: list[str or ~azure.mgmt.securityinsight.models.MtpProvider] + """ + super().__init__(**kwargs) + self.alerts = alerts + + +class NicEntity(Entity): + """Represents an network interface entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar mac_address: The MAC address of this network interface. + :vartype mac_address: str + :ivar ip_address_entity_id: The IP entity id of this network interface. + :vartype ip_address_entity_id: str + :ivar vlans: A list of VLANs of the network interface entity. + :vartype vlans: list[str] """ _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "mac_address": {"readonly": True}, + "ip_address_entity_id": {"readonly": True}, + "vlans": {"readonly": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "MSTIDataConnectorDataTypes"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "mac_address": {"key": "properties.macAddress", "type": "str"}, + "ip_address_entity_id": {"key": "properties.ipAddressEntityId", "type": "str"}, + "vlans": {"key": "properties.vlans", "type": "[str]"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.MSTIDataConnectorDataTypes", **kwargs): - """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MSTIDataConnectorDataTypes - """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "Nic" + self.additional_data = None + self.friendly_name = None + self.mac_address = None + self.ip_address_entity_id = None + self.vlans = None -class MtpCheckRequirements(DataConnectorsCheckRequirements): - """Represents MTP (Microsoft Threat Protection) requirements check request. +class NicEntityProperties(EntityCommonProperties): + """Nic entity property bag. - 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 kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar mac_address: The MAC address of this network interface. + :vartype mac_address: str + :ivar ip_address_entity_id: The IP entity id of this network interface. + :vartype ip_address_entity_id: str + :ivar vlans: A list of VLANs of the network interface entity. + :vartype vlans: list[str] """ _validation = { - "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "mac_address": {"readonly": True}, + "ip_address_entity_id": {"readonly": True}, + "vlans": {"readonly": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + "ip_address_entity_id": {"key": "ipAddressEntityId", "type": "str"}, + "vlans": {"key": "vlans", "type": "[str]"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): - """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.kind: str = "MicrosoftThreatProtection" - self.tenant_id = tenant_id + self.mac_address = None + self.ip_address_entity_id = None + self.vlans = None -class MTPCheckRequirementsProperties(DataConnectorTenantId): - """MTP (Microsoft Threat Protection) requirements check properties. +class NrtAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes + """Represents NRT alert rule. + + 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar template_version: The version of the alert rule template used to create this rule - in + format , where all are numbers, for example 0 <1.0.2>. + :vartype template_version: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar suppression_duration: The suppression (in ISO 8601 duration format) to wait since last + time this alert rule been triggered. + :vartype suppression_duration: ~datetime.timedelta + :ivar suppression_enabled: Determines whether the suppression for this alert rule is enabled or + disabled. + :vartype suppression_enabled: bool + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar incident_configuration: The settings of the incidents that created from alerts triggered + by this analytics rule. + :vartype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration + :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :vartype custom_details: dict[str, str] + :ivar entity_mappings: Array of the entity mappings of the alert rule. + :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :ivar alert_details_override: The alert details override settings. + :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar event_grouping_settings: The event grouping settings. + :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _validation = { - "tenant_id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "last_modified_utc": {"readonly": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, + "template_version": {"key": "properties.templateVersion", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "query": {"key": "properties.query", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, + "suppression_duration": {"key": "properties.suppressionDuration", "type": "duration"}, + "suppression_enabled": {"key": "properties.suppressionEnabled", "type": "bool"}, + "severity": {"key": "properties.severity", "type": "str"}, + "incident_configuration": {"key": "properties.incidentConfiguration", "type": "IncidentConfiguration"}, + "custom_details": {"key": "properties.customDetails", "type": "{str}"}, + "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, + "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, + "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__( # pylint: disable=too-many-locals + self, + *, + etag: Optional[str] = None, + alert_rule_template_name: Optional[str] = None, + template_version: Optional[str] = None, + description: Optional[str] = None, + query: Optional[str] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + sub_techniques: Optional[List[str]] = None, + display_name: Optional[str] = None, + enabled: Optional[bool] = None, + suppression_duration: Optional[datetime.timedelta] = None, + suppression_enabled: Optional[bool] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + incident_configuration: Optional["_models.IncidentConfiguration"] = None, + custom_details: Optional[Dict[str, str]] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword template_version: The version of the alert rule template used to create this rule - in + format , where all are numbers, for example 0 <1.0.2>. + :paramtype template_version: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the alert rule. + :paramtype techniques: list[str] + :keyword sub_techniques: The sub-techniques of the alert rule. + :paramtype sub_techniques: list[str] + :keyword display_name: The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + :keyword suppression_duration: The suppression (in ISO 8601 duration format) to wait since last + time this alert rule been triggered. + :paramtype suppression_duration: ~datetime.timedelta + :keyword suppression_enabled: Determines whether the suppression for this alert rule is enabled + or disabled. + :paramtype suppression_enabled: bool + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword incident_configuration: The settings of the incidents that created from alerts + triggered by this analytics rule. + :paramtype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration + :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :paramtype custom_details: dict[str, str] + :keyword entity_mappings: Array of the entity mappings of the alert rule. + :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :keyword alert_details_override: The alert details override settings. + :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword event_grouping_settings: The event grouping settings. + :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ - super().__init__(tenant_id=tenant_id, **kwargs) + super().__init__(etag=etag, **kwargs) + self.kind: str = "NRT" + self.alert_rule_template_name = alert_rule_template_name + self.template_version = template_version + self.description = description + self.query = query + self.tactics = tactics + self.techniques = techniques + self.sub_techniques = sub_techniques + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + self.suppression_duration = suppression_duration + self.suppression_enabled = suppression_enabled + self.severity = severity + self.incident_configuration = incident_configuration + self.custom_details = custom_details + self.entity_mappings = entity_mappings + self.alert_details_override = alert_details_override + self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings -class MTPDataConnector(DataConnector): - """Represents MTP (Microsoft Threat Protection) data connector. +class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes + """Represents NRT alert rule template. Variables are only populated by the server, and will be ignored when sending a request. @@ -15375,20 +18002,51 @@ class MTPDataConnector(DataConnector): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and + "NRT". + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :vartype version: str + :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :vartype custom_details: dict[str, str] + :ivar entity_mappings: Array of the entity mappings of the alert rule. + :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :ivar alert_details_override: The alert details override settings. + :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar event_grouping_settings: The event grouping settings. + :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ _validation = { @@ -15397,6 +18055,8 @@ class MTPDataConnector(DataConnector): "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"readonly": True}, } _attribute_map = { @@ -15404,435 +18064,478 @@ class MTPDataConnector(DataConnector): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "MTPDataConnectorDataTypes"}, + "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "required_data_connectors": { + "key": "properties.requiredDataConnectors", + "type": "[AlertRuleTemplateDataSource]", + }, + "status": {"key": "properties.status", "type": "str"}, + "tactics": {"key": "properties.tactics", "type": "[str]"}, + "techniques": {"key": "properties.techniques", "type": "[str]"}, + "query": {"key": "properties.query", "type": "str"}, + "severity": {"key": "properties.severity", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "custom_details": {"key": "properties.customDetails", "type": "{str}"}, + "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, + "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, + "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } def __init__( self, *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.MTPDataConnectorDataTypes"] = None, - **kwargs - ): - """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes - """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "MicrosoftThreatProtection" - self.tenant_id = tenant_id - self.data_types = data_types - - -class MTPDataConnectorDataTypes(_serialization.Model): - """The available data types for Microsoft Threat Protection Platforms data connector. - - All required parameters must be populated in order to send to Azure. - - :ivar incidents: Data type for Microsoft Threat Protection Platforms data connector. Required. - :vartype incidents: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesIncidents - """ - - _validation = { - "incidents": {"required": True}, - } - - _attribute_map = { - "incidents": {"key": "incidents", "type": "MTPDataConnectorDataTypesIncidents"}, - } - - def __init__(self, *, incidents: "_models.MTPDataConnectorDataTypesIncidents", **kwargs): + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + query: Optional[str] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + version: Optional[str] = None, + custom_details: Optional[Dict[str, str]] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, + **kwargs: Any + ) -> None: """ - :keyword incidents: Data type for Microsoft Threat Protection Platforms data connector. - Required. - :paramtype incidents: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypesIncidents + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data sources for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the alert rule. + :paramtype techniques: list[str] + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :paramtype version: str + :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :paramtype custom_details: dict[str, str] + :keyword entity_mappings: Array of the entity mappings of the alert rule. + :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :keyword alert_details_override: The alert details override settings. + :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword event_grouping_settings: The event grouping settings. + :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ super().__init__(**kwargs) - self.incidents = incidents - + self.kind: str = "NRT" + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.last_updated_date_utc = None + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.tactics = tactics + self.techniques = techniques + self.query = query + self.severity = severity + self.version = version + self.custom_details = custom_details + self.entity_mappings = entity_mappings + self.alert_details_override = alert_details_override + self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings -class MTPDataConnectorDataTypesIncidents(DataConnectorDataTypeCommon): - """Data type for Microsoft Threat Protection Platforms data connector. - All required parameters must be populated in order to send to Azure. +class QueryBasedAlertRuleTemplateProperties(_serialization.Model): + """Query based alert rule template base property bag. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :vartype version: str + :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :vartype custom_details: dict[str, str] + :ivar entity_mappings: Array of the entity mappings of the alert rule. + :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :ivar alert_details_override: The alert details override settings. + :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar event_grouping_settings: The event grouping settings. + :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ - _validation = { - "state": {"required": True}, - } - _attribute_map = { - "state": {"key": "state", "type": "str"}, + "query": {"key": "query", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "custom_details": {"key": "customDetails", "type": "{str}"}, + "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, + "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, + "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__( + self, + *, + query: Optional[str] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + version: Optional[str] = None, + custom_details: Optional[Dict[str, str]] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, + **kwargs: Any + ) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :paramtype version: str + :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :paramtype custom_details: dict[str, str] + :keyword entity_mappings: Array of the entity mappings of the alert rule. + :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :keyword alert_details_override: The alert details override settings. + :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword event_grouping_settings: The event grouping settings. + :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] """ - super().__init__(state=state, **kwargs) + super().__init__(**kwargs) + self.query = query + self.severity = severity + self.version = version + self.custom_details = custom_details + self.entity_mappings = entity_mappings + self.alert_details_override = alert_details_override + self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings -class MTPDataConnectorProperties(DataConnectorTenantId): - """MTP (Microsoft Threat Protection) data connector properties. +class NrtAlertRuleTemplateProperties( + AlertRuleTemplateWithMitreProperties, QueryBasedAlertRuleTemplateProperties +): # pylint: disable=too-many-instance-attributes + """NRT alert rule template 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", and "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :vartype version: str + :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :vartype custom_details: dict[str, str] + :ivar entity_mappings: Array of the entity mappings of the alert rule. + :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :ivar alert_details_override: The alert details override settings. + :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :ivar event_grouping_settings: The event grouping settings. + :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :vartype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :ivar alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :vartype alert_rules_created_by_template_count: int + :ivar last_updated_date_utc: The last time that this alert rule template has been updated. + :vartype last_updated_date_utc: ~datetime.datetime + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data sources for this template. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :ivar status: The alert rule template status. Known values are: "Installed", "Available", and + "NotAvailable". + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the alert rule. + :vartype techniques: list[str] """ _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, + "last_updated_date_utc": {"readonly": True}, + "created_date_utc": {"readonly": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "MTPDataConnectorDataTypes"}, + "query": {"key": "query", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "custom_details": {"key": "customDetails", "type": "{str}"}, + "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, + "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, + "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, + "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, + "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, + "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, + "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, + "description": {"key": "description", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, + "status": {"key": "status", "type": "str"}, + "tactics": {"key": "tactics", "type": "[str]"}, + "techniques": {"key": "techniques", "type": "[str]"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.MTPDataConnectorDataTypes", **kwargs): + def __init__( + self, + *, + query: Optional[str] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + version: Optional[str] = None, + custom_details: Optional[Dict[str, str]] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, + sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.MTPDataConnectorDataTypes + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword severity: The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", and "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword version: The version of this template - in format , where all are numbers. For + example <1.0.2>. + :paramtype version: str + :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the + alert. + :paramtype custom_details: dict[str, str] + :keyword entity_mappings: Array of the entity mappings of the alert rule. + :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] + :keyword alert_details_override: The alert details override settings. + :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride + :keyword event_grouping_settings: The event grouping settings. + :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings + :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. + :paramtype sentinel_entities_mappings: + list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data sources for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + and "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the alert rule. + :paramtype techniques: list[str] """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types - + super().__init__( + alert_rules_created_by_template_count=alert_rules_created_by_template_count, + description=description, + display_name=display_name, + required_data_connectors=required_data_connectors, + status=status, + tactics=tactics, + techniques=techniques, + query=query, + severity=severity, + version=version, + custom_details=custom_details, + entity_mappings=entity_mappings, + alert_details_override=alert_details_override, + event_grouping_settings=event_grouping_settings, + sentinel_entities_mappings=sentinel_entities_mappings, + **kwargs + ) + self.query = query + self.severity = severity + self.version = version + self.custom_details = custom_details + self.entity_mappings = entity_mappings + self.alert_details_override = alert_details_override + self.event_grouping_settings = event_grouping_settings + self.sentinel_entities_mappings = sentinel_entities_mappings + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.last_updated_date_utc = None + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.tactics = tactics + self.techniques = techniques -class NicEntity(Entity): - """Represents an network interface entity. - Variables are only populated by the server, and will be ignored when sending a request. +class Office365ProjectCheckRequirements(DataConnectorsCheckRequirements): + """Represents Office365 Project requirements check request. All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar mac_address: The MAC address of this network interface. - :vartype mac_address: str - :ivar ip_address_entity_id: The IP entity id of this network interface. - :vartype ip_address_entity_id: str - :ivar vlans: A list of VLANs of the network interface entity. - :vartype vlans: list[str] + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "mac_address": {"readonly": True}, - "ip_address_entity_id": {"readonly": True}, - "vlans": {"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"}, "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "mac_address": {"key": "properties.macAddress", "type": "str"}, - "ip_address_entity_id": {"key": "properties.ipAddressEntityId", "type": "str"}, - "vlans": {"key": "properties.vlans", "type": "[str]"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ super().__init__(**kwargs) - self.kind: str = "Nic" - self.additional_data = None - self.friendly_name = None - self.mac_address = None - self.ip_address_entity_id = None - self.vlans = None + self.kind: str = "Office365Project" + self.tenant_id = tenant_id -class NicEntityProperties(EntityCommonProperties): - """Nic entity property bag. +class Office365ProjectCheckRequirementsProperties(DataConnectorTenantId): + """Office365 Project requirements check 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 additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar mac_address: The MAC address of this network interface. - :vartype mac_address: str - :ivar ip_address_entity_id: The IP entity id of this network interface. - :vartype ip_address_entity_id: str - :ivar vlans: A list of VLANs of the network interface entity. - :vartype vlans: list[str] + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "mac_address": {"readonly": True}, - "ip_address_entity_id": {"readonly": True}, - "vlans": {"readonly": True}, + "tenant_id": {"required": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "mac_address": {"key": "macAddress", "type": "str"}, - "ip_address_entity_id": {"key": "ipAddressEntityId", "type": "str"}, - "vlans": {"key": "vlans", "type": "[str]"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.mac_address = None - self.ip_address_entity_id = None - self.vlans = None - + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) -class NrtAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes - """Represents NRT alert rule. - Variables are only populated by the server, and will be ignored when sending a request. +class Office365ProjectConnectorDataTypes(_serialization.Model): + """The available data types for Office Microsoft Project data connector. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. - :vartype alert_rule_template_name: str - :ivar template_version: The version of the alert rule template used to create this rule - in - format , where all are numbers, for example 0 <1.0.2>. - :vartype template_version: str - :ivar description: The description of the alert rule. - :vartype description: str - :ivar query: The query that creates alerts for this rule. - :vartype query: str - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] - :ivar display_name: The display name for alerts created by this alert rule. - :vartype display_name: str - :ivar enabled: Determines whether this alert rule is enabled or disabled. - :vartype enabled: bool - :ivar last_modified_utc: The last time that this alert rule has been modified. - :vartype last_modified_utc: ~datetime.datetime - :ivar suppression_duration: The suppression (in ISO 8601 duration format) to wait since last - time this alert rule been triggered. - :vartype suppression_duration: ~datetime.timedelta - :ivar suppression_enabled: Determines whether the suppression for this alert rule is enabled or - disabled. - :vartype suppression_enabled: bool - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar incident_configuration: The settings of the incidents that created from alerts triggered - by this analytics rule. - :vartype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration - :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :vartype custom_details: dict[str, str] - :ivar entity_mappings: Array of the entity mappings of the alert rule. - :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :ivar alert_details_override: The alert details override settings. - :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :ivar event_grouping_settings: The event grouping settings. - :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :vartype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :ivar logs: Logs data type. Required. + :vartype logs: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypesLogs """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "last_modified_utc": {"readonly": True}, + "logs": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "alert_rule_template_name": {"key": "properties.alertRuleTemplateName", "type": "str"}, - "template_version": {"key": "properties.templateVersion", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "query": {"key": "properties.query", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "type": "[str]"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "last_modified_utc": {"key": "properties.lastModifiedUtc", "type": "iso-8601"}, - "suppression_duration": {"key": "properties.suppressionDuration", "type": "duration"}, - "suppression_enabled": {"key": "properties.suppressionEnabled", "type": "bool"}, - "severity": {"key": "properties.severity", "type": "str"}, - "incident_configuration": {"key": "properties.incidentConfiguration", "type": "IncidentConfiguration"}, - "custom_details": {"key": "properties.customDetails", "type": "{str}"}, - "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, - "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, - "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, - "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, + "logs": {"key": "logs", "type": "Office365ProjectConnectorDataTypesLogs"}, } - def __init__( # pylint: disable=too-many-locals - self, - *, - etag: Optional[str] = None, - alert_rule_template_name: Optional[str] = None, - template_version: Optional[str] = None, - description: Optional[str] = None, - query: Optional[str] = None, - tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, - techniques: Optional[List[str]] = None, - display_name: Optional[str] = None, - enabled: Optional[bool] = None, - suppression_duration: Optional[datetime.timedelta] = None, - suppression_enabled: Optional[bool] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - incident_configuration: Optional["_models.IncidentConfiguration"] = None, - custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["_models.EntityMapping"]] = None, - alert_details_override: Optional["_models.AlertDetailsOverride"] = None, - event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, - sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - **kwargs - ): + def __init__(self, *, logs: "_models.Office365ProjectConnectorDataTypesLogs", **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword alert_rule_template_name: The Name of the alert rule template used to create this - rule. - :paramtype alert_rule_template_name: str - :keyword template_version: The version of the alert rule template used to create this rule - in - format , where all are numbers, for example 0 <1.0.2>. - :paramtype template_version: str - :keyword description: The description of the alert rule. - :paramtype description: str - :keyword query: The query that creates alerts for this rule. - :paramtype query: str - :keyword tactics: The tactics of the alert rule. - :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :keyword techniques: The techniques of the alert rule. - :paramtype techniques: list[str] - :keyword display_name: The display name for alerts created by this alert rule. - :paramtype display_name: str - :keyword enabled: Determines whether this alert rule is enabled or disabled. - :paramtype enabled: bool - :keyword suppression_duration: The suppression (in ISO 8601 duration format) to wait since last - time this alert rule been triggered. - :paramtype suppression_duration: ~datetime.timedelta - :keyword suppression_enabled: Determines whether the suppression for this alert rule is enabled - or disabled. - :paramtype suppression_enabled: bool - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword incident_configuration: The settings of the incidents that created from alerts - triggered by this analytics rule. - :paramtype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration - :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :paramtype custom_details: dict[str, str] - :keyword entity_mappings: Array of the entity mappings of the alert rule. - :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :keyword alert_details_override: The alert details override settings. - :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :keyword event_grouping_settings: The event grouping settings. - :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :paramtype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :keyword logs: Logs data type. Required. + :paramtype logs: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypesLogs + """ + super().__init__(**kwargs) + self.logs = logs + + +class Office365ProjectConnectorDataTypesLogs(DataConnectorDataTypeCommon): + """Logs data type. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "NRT" - self.alert_rule_template_name = alert_rule_template_name - self.template_version = template_version - self.description = description - self.query = query - self.tactics = tactics - self.techniques = techniques - self.display_name = display_name - self.enabled = enabled - self.last_modified_utc = None - self.suppression_duration = suppression_duration - self.suppression_enabled = suppression_enabled - self.severity = severity - self.incident_configuration = incident_configuration - self.custom_details = custom_details - self.entity_mappings = entity_mappings - self.alert_details_override = alert_details_override - self.event_grouping_settings = event_grouping_settings - self.sentinel_entities_mappings = sentinel_entities_mappings + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super().__init__(state=state, **kwargs) -class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes - """Represents NRT alert rule template. +class Office365ProjectDataConnector(DataConnector): + """Represents Office Microsoft Project data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -15849,51 +18552,20 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-insta :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the alert rule. Required. Known values are: "Scheduled", - "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", and - "NRT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. - :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] - :ivar query: The query that creates alerts for this rule. - :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :vartype version: str - :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :vartype custom_details: dict[str, str] - :ivar entity_mappings: Array of the entity mappings of the alert rule. - :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :ivar alert_details_override: The alert details override settings. - :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :ivar event_grouping_settings: The event grouping settings. - :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :vartype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes """ _validation = { @@ -15902,8 +18574,6 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-insta "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, } _attribute_map = { @@ -15911,403 +18581,211 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-insta "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "alert_rules_created_by_template_count": {"key": "properties.alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "properties.lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "properties.createdDateUTC", "type": "iso-8601"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "required_data_connectors": { - "key": "properties.requiredDataConnectors", - "type": "[AlertRuleTemplateDataSource]", - }, - "status": {"key": "properties.status", "type": "str"}, - "tactics": {"key": "properties.tactics", "type": "[str]"}, - "techniques": {"key": "properties.techniques", "type": "[str]"}, - "query": {"key": "properties.query", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "custom_details": {"key": "properties.customDetails", "type": "{str}"}, - "entity_mappings": {"key": "properties.entityMappings", "type": "[EntityMapping]"}, - "alert_details_override": {"key": "properties.alertDetailsOverride", "type": "AlertDetailsOverride"}, - "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, - "sentinel_entities_mappings": {"key": "properties.sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "Office365ProjectConnectorDataTypes"}, } def __init__( self, *, - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, - techniques: Optional[List[str]] = None, - query: Optional[str] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - version: Optional[str] = None, - custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["_models.EntityMapping"]] = None, - alert_details_override: Optional["_models.AlertDetailsOverride"] = None, - event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, - sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - **kwargs - ): + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.Office365ProjectConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: """ - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. - :paramtype display_name: str - :keyword required_data_connectors: The required data sources for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword tactics: The tactics of the alert rule. - :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :keyword techniques: The techniques of the alert rule. - :paramtype techniques: list[str] - :keyword query: The query that creates alerts for this rule. - :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :paramtype version: str - :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :paramtype custom_details: dict[str, str] - :keyword entity_mappings: Array of the entity mappings of the alert rule. - :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :keyword alert_details_override: The alert details override settings. - :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :keyword event_grouping_settings: The event grouping settings. - :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :paramtype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes """ - super().__init__(**kwargs) - self.kind: str = "NRT" - self.alert_rules_created_by_template_count = alert_rules_created_by_template_count - self.last_updated_date_utc = None - self.created_date_utc = None - self.description = description - self.display_name = display_name - self.required_data_connectors = required_data_connectors - self.status = status - self.tactics = tactics - self.techniques = techniques - self.query = query - self.severity = severity - self.version = version - self.custom_details = custom_details - self.entity_mappings = entity_mappings - self.alert_details_override = alert_details_override - self.event_grouping_settings = event_grouping_settings - self.sentinel_entities_mappings = sentinel_entities_mappings + super().__init__(etag=etag, **kwargs) + self.kind: str = "Office365Project" + self.tenant_id = tenant_id + self.data_types = data_types -class QueryBasedAlertRuleTemplateProperties(_serialization.Model): - """Query based alert rule template base property bag. +class Office365ProjectDataConnectorProperties(DataConnectorTenantId): + """Office Microsoft Project data connector properties. - :ivar query: The query that creates alerts for this rule. - :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :vartype version: str - :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :vartype custom_details: dict[str, str] - :ivar entity_mappings: Array of the entity mappings of the alert rule. - :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :ivar alert_details_override: The alert details override settings. - :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :ivar event_grouping_settings: The event grouping settings. - :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :vartype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + """ + + _validation = { + "tenant_id": {"required": True}, + "data_types": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "Office365ProjectConnectorDataTypes"}, + } + + def __init__( + self, *, tenant_id: str, data_types: "_models.Office365ProjectConnectorDataTypes", **kwargs: Any + ) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + """ + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class OfficeATPCheckRequirements(DataConnectorsCheckRequirements): + """Represents OfficeATP (Office 365 Advanced Threat Protection) requirements check request. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str """ + _validation = { + "kind": {"required": True}, + } + _attribute_map = { - "query": {"key": "query", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "custom_details": {"key": "customDetails", "type": "{str}"}, - "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, - "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, - "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, - "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__( - self, - *, - query: Optional[str] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - version: Optional[str] = None, - custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["_models.EntityMapping"]] = None, - alert_details_override: Optional["_models.AlertDetailsOverride"] = None, - event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, - sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - **kwargs - ): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword query: The query that creates alerts for this rule. - :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :paramtype version: str - :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :paramtype custom_details: dict[str, str] - :keyword entity_mappings: Array of the entity mappings of the alert rule. - :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :keyword alert_details_override: The alert details override settings. - :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :keyword event_grouping_settings: The event grouping settings. - :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :paramtype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str """ super().__init__(**kwargs) - self.query = query - self.severity = severity - self.version = version - self.custom_details = custom_details - self.entity_mappings = entity_mappings - self.alert_details_override = alert_details_override - self.event_grouping_settings = event_grouping_settings - self.sentinel_entities_mappings = sentinel_entities_mappings + self.kind: str = "OfficeATP" + self.tenant_id = tenant_id -class NrtAlertRuleTemplateProperties( - AlertRuleTemplateWithMitreProperties, QueryBasedAlertRuleTemplateProperties -): # pylint: disable=too-many-instance-attributes - """NRT alert rule template properties. +class OfficeATPCheckRequirementsProperties(DataConnectorTenantId): + """OfficeATP (Office 365 Advanced Threat Protection) requirements check 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 query: The query that creates alerts for this rule. - :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", - "Medium", "Low", and "Informational". - :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :vartype version: str - :ivar custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :vartype custom_details: dict[str, str] - :ivar entity_mappings: Array of the entity mappings of the alert rule. - :vartype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :ivar alert_details_override: The alert details override settings. - :vartype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :ivar event_grouping_settings: The event grouping settings. - :vartype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :ivar sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :vartype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] - :ivar alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :vartype alert_rules_created_by_template_count: int - :ivar last_updated_date_utc: The last time that this alert rule template has been updated. - :vartype last_updated_date_utc: ~datetime.datetime - :ivar created_date_utc: The time that this alert rule template has been added. - :vartype created_date_utc: ~datetime.datetime - :ivar description: The description of the alert rule template. - :vartype description: str - :ivar display_name: The display name for alert rule template. - :vartype display_name: str - :ivar required_data_connectors: The required data sources for this template. - :vartype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Known values are: "Installed", "Available", and - "NotAvailable". - :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar tactics: The tactics of the alert rule. - :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :ivar techniques: The techniques of the alert rule. - :vartype techniques: list[str] + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str """ _validation = { - "last_updated_date_utc": {"readonly": True}, - "created_date_utc": {"readonly": True}, + "tenant_id": {"required": True}, } _attribute_map = { - "query": {"key": "query", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "custom_details": {"key": "customDetails", "type": "{str}"}, - "entity_mappings": {"key": "entityMappings", "type": "[EntityMapping]"}, - "alert_details_override": {"key": "alertDetailsOverride", "type": "AlertDetailsOverride"}, - "event_grouping_settings": {"key": "eventGroupingSettings", "type": "EventGroupingSettings"}, - "sentinel_entities_mappings": {"key": "sentinelEntitiesMappings", "type": "[SentinelEntityMapping]"}, - "alert_rules_created_by_template_count": {"key": "alertRulesCreatedByTemplateCount", "type": "int"}, - "last_updated_date_utc": {"key": "lastUpdatedDateUTC", "type": "iso-8601"}, - "created_date_utc": {"key": "createdDateUTC", "type": "iso-8601"}, - "description": {"key": "description", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "required_data_connectors": {"key": "requiredDataConnectors", "type": "[AlertRuleTemplateDataSource]"}, - "status": {"key": "status", "type": "str"}, - "tactics": {"key": "tactics", "type": "[str]"}, - "techniques": {"key": "techniques", "type": "[str]"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__( - self, - *, - query: Optional[str] = None, - severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - version: Optional[str] = None, - custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["_models.EntityMapping"]] = None, - alert_details_override: Optional["_models.AlertDetailsOverride"] = None, - event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, - sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - alert_rules_created_by_template_count: Optional[int] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "_models.TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, - techniques: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ - :keyword query: The query that creates alerts for this rule. - :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Known values are: - "High", "Medium", "Low", and "Informational". - :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword version: The version of this template - in format , where all are numbers. For - example <1.0.2>. - :paramtype version: str - :keyword custom_details: Dictionary of string key-value pairs of columns to be attached to the - alert. - :paramtype custom_details: dict[str, str] - :keyword entity_mappings: Array of the entity mappings of the alert rule. - :paramtype entity_mappings: list[~azure.mgmt.securityinsight.models.EntityMapping] - :keyword alert_details_override: The alert details override settings. - :paramtype alert_details_override: ~azure.mgmt.securityinsight.models.AlertDetailsOverride - :keyword event_grouping_settings: The event grouping settings. - :paramtype event_grouping_settings: ~azure.mgmt.securityinsight.models.EventGroupingSettings - :keyword sentinel_entities_mappings: Array of the sentinel entity mappings of the alert rule. - :paramtype sentinel_entities_mappings: - list[~azure.mgmt.securityinsight.models.SentinelEntityMapping] - :keyword alert_rules_created_by_template_count: the number of alert rules that were created by - this template. - :paramtype alert_rules_created_by_template_count: int - :keyword description: The description of the alert rule template. - :paramtype description: str - :keyword display_name: The display name for alert rule template. - :paramtype display_name: str - :keyword required_data_connectors: The required data sources for this template. - :paramtype required_data_connectors: - list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Known values are: "Installed", "Available", - and "NotAvailable". - :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword tactics: The tactics of the alert rule. - :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] - :keyword techniques: The techniques of the alert rule. - :paramtype techniques: list[str] + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str """ - super().__init__( - alert_rules_created_by_template_count=alert_rules_created_by_template_count, - description=description, - display_name=display_name, - required_data_connectors=required_data_connectors, - status=status, - tactics=tactics, - techniques=techniques, - query=query, - severity=severity, - version=version, - custom_details=custom_details, - entity_mappings=entity_mappings, - alert_details_override=alert_details_override, - event_grouping_settings=event_grouping_settings, - sentinel_entities_mappings=sentinel_entities_mappings, - **kwargs - ) - self.query = query - self.severity = severity - self.version = version - self.custom_details = custom_details - self.entity_mappings = entity_mappings - self.alert_details_override = alert_details_override - self.event_grouping_settings = event_grouping_settings - self.sentinel_entities_mappings = sentinel_entities_mappings - self.alert_rules_created_by_template_count = alert_rules_created_by_template_count - self.last_updated_date_utc = None - self.created_date_utc = None - self.description = description - self.display_name = display_name - self.required_data_connectors = required_data_connectors - self.status = status - self.tactics = tactics - self.techniques = techniques + super().__init__(tenant_id=tenant_id, **kwargs) -class Office365ProjectCheckRequirements(DataConnectorsCheckRequirements): - """Represents Office365 Project requirements check request. +class OfficeATPDataConnector(DataConnector): + """Represents OfficeATP (Office 365 Advanced Threat Protection) data connector. + + 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 kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, + **kwargs: Any + ) -> None: """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ - super().__init__(**kwargs) - self.kind: str = "Office365Project" + super().__init__(etag=etag, **kwargs) + self.kind: str = "OfficeATP" self.tenant_id = tenant_id + self.data_types = data_types -class Office365ProjectCheckRequirementsProperties(DataConnectorTenantId): - """Office365 Project requirements check properties. +class OfficeATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): + """OfficeATP (Office 365 Advanced Threat Protection) data connector properties. All required parameters must be populated in order to send to Azure. + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector :ivar tenant_id: The tenant id to connect to, and get the data from. Required. :vartype tenant_id: str """ @@ -16317,72 +18795,109 @@ class Office365ProjectCheckRequirementsProperties(DataConnectorTenantId): } _attribute_map = { + "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__( + self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any + ) -> None: """ + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str """ - super().__init__(tenant_id=tenant_id, **kwargs) + super().__init__(tenant_id=tenant_id, data_types=data_types, **kwargs) + self.data_types = data_types + self.tenant_id = tenant_id -class Office365ProjectConnectorDataTypes(_serialization.Model): - """The available data types for Office Microsoft Project data connector. +class OfficeConsent(Resource): + """Consent for Office365 tenant that already made. - 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 logs: Logs data type. Required. - :vartype logs: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypesLogs + :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.securityinsight.models.SystemData + :ivar tenant_id: The tenantId of the Office365 with the consent. + :vartype tenant_id: str + :ivar consent_id: Help to easily cascade among the data layers. + :vartype consent_id: str """ _validation = { - "logs": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "logs": {"key": "logs", "type": "Office365ProjectConnectorDataTypesLogs"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "consent_id": {"key": "properties.consentId", "type": "str"}, } - def __init__(self, *, logs: "_models.Office365ProjectConnectorDataTypesLogs", **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, consent_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword logs: Logs data type. Required. - :paramtype logs: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypesLogs + :keyword tenant_id: The tenantId of the Office365 with the consent. + :paramtype tenant_id: str + :keyword consent_id: Help to easily cascade among the data layers. + :paramtype consent_id: str """ super().__init__(**kwargs) - self.logs = logs + self.tenant_id = tenant_id + self.consent_id = consent_id -class Office365ProjectConnectorDataTypesLogs(DataConnectorDataTypeCommon): - """Logs data type. +class OfficeConsentList(_serialization.Model): + """List of all the office365 consents. + + 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 state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar next_link: URL to fetch the next set of office consents. + :vartype next_link: str + :ivar value: Array of the consents. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] """ _validation = { - "state": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "state": {"key": "state", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OfficeConsent]"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, value: List["_models.OfficeConsent"], **kwargs: Any) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword value: Array of the consents. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] """ - super().__init__(state=state, **kwargs) + super().__init__(**kwargs) + self.next_link = None + self.value = value -class Office365ProjectDataConnector(DataConnector): - """Represents Office Microsoft Project data connector. +class OfficeDataConnector(DataConnector): + """Represents office data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -16404,15 +18919,15 @@ class Office365ProjectDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + :vartype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes """ _validation = { @@ -16431,7 +18946,7 @@ class Office365ProjectDataConnector(DataConnector): "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "Office365ProjectConnectorDataTypes"}, + "data_types": {"key": "properties.dataTypes", "type": "OfficeDataConnectorDataTypes"}, } def __init__( @@ -16439,32 +18954,161 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["_models.Office365ProjectConnectorDataTypes"] = None, - **kwargs - ): + data_types: Optional["_models.OfficeDataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "Office365" + self.tenant_id = tenant_id + self.data_types = data_types + + +class OfficeDataConnectorDataTypes(_serialization.Model): + """The available data types for office data connector. + + All required parameters must be populated in order to send to Azure. + + :ivar exchange: Exchange data type connection. Required. + :vartype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :ivar share_point: SharePoint data type connection. Required. + :vartype share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :ivar teams: Teams data type connection. Required. + :vartype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams + """ + + _validation = { + "exchange": {"required": True}, + "share_point": {"required": True}, + "teams": {"required": True}, + } + + _attribute_map = { + "exchange": {"key": "exchange", "type": "OfficeDataConnectorDataTypesExchange"}, + "share_point": {"key": "sharePoint", "type": "OfficeDataConnectorDataTypesSharePoint"}, + "teams": {"key": "teams", "type": "OfficeDataConnectorDataTypesTeams"}, + } + + def __init__( + self, + *, + exchange: "_models.OfficeDataConnectorDataTypesExchange", + share_point: "_models.OfficeDataConnectorDataTypesSharePoint", + teams: "_models.OfficeDataConnectorDataTypesTeams", + **kwargs: Any + ) -> None: + """ + :keyword exchange: Exchange data type connection. Required. + :paramtype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :keyword share_point: SharePoint data type connection. Required. + :paramtype share_point: + ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :keyword teams: Teams data type connection. Required. + :paramtype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams + """ + super().__init__(**kwargs) + self.exchange = exchange + self.share_point = share_point + self.teams = teams + + +class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): + """Exchange data type connection. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: + """ + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super().__init__(state=state, **kwargs) + + +class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): + """SharePoint data type connection. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: + """ + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super().__init__(state=state, **kwargs) + + +class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): + """Teams data type connection. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "Office365Project" - self.tenant_id = tenant_id - self.data_types = data_types + super().__init__(state=state, **kwargs) -class Office365ProjectDataConnectorProperties(DataConnectorTenantId): - """Office Microsoft Project data connector properties. +class OfficeDataConnectorProperties(DataConnectorTenantId): + """Office data connector properties. All required parameters must be populated in order to send to Azure. :ivar tenant_id: The tenant id to connect to, and get the data from. Required. :vartype tenant_id: str :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + :vartype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes """ _validation = { @@ -16474,32 +19118,32 @@ class Office365ProjectDataConnectorProperties(DataConnectorTenantId): _attribute_map = { "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "Office365ProjectConnectorDataTypes"}, + "data_types": {"key": "dataTypes", "type": "OfficeDataConnectorDataTypes"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.Office365ProjectConnectorDataTypes", **kwargs): + def __init__(self, *, tenant_id: str, data_types: "_models.OfficeDataConnectorDataTypes", **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.Office365ProjectConnectorDataTypes + :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes """ super().__init__(tenant_id=tenant_id, **kwargs) self.data_types = data_types -class OfficeATPCheckRequirements(DataConnectorsCheckRequirements): - """Represents OfficeATP (Office 365 Advanced Threat Protection) requirements check request. +class OfficeIRMCheckRequirements(DataConnectorsCheckRequirements): + """Represents OfficeIRM (Microsoft Insider Risk Management) requirements check request. All required parameters must be populated in order to send to Azure. :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -16514,18 +19158,18 @@ class OfficeATPCheckRequirements(DataConnectorsCheckRequirements): "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str """ super().__init__(**kwargs) - self.kind: str = "OfficeATP" + self.kind: str = "OfficeIRM" self.tenant_id = tenant_id -class OfficeATPCheckRequirementsProperties(DataConnectorTenantId): - """OfficeATP (Office 365 Advanced Threat Protection) requirements check properties. +class OfficeIRMCheckRequirementsProperties(DataConnectorTenantId): + """OfficeIRM (Microsoft Insider Risk Management) requirements check properties. All required parameters must be populated in order to send to Azure. @@ -16541,7 +19185,7 @@ class OfficeATPCheckRequirementsProperties(DataConnectorTenantId): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -16549,8 +19193,8 @@ def __init__(self, *, tenant_id: str, **kwargs): super().__init__(tenant_id=tenant_id, **kwargs) -class OfficeATPDataConnector(DataConnector): - """Represents OfficeATP (Office 365 Advanced Threat Protection) data connector. +class OfficeIRMDataConnector(DataConnector): + """Represents OfficeIRM (Microsoft Insider Risk Management) data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -16572,10 +19216,10 @@ class OfficeATPDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -16608,8 +19252,8 @@ def __init__( etag: Optional[str] = None, tenant_id: Optional[str] = None, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -16619,13 +19263,13 @@ def __init__( :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ super().__init__(etag=etag, **kwargs) - self.kind: str = "OfficeATP" + self.kind: str = "OfficeIRM" self.tenant_id = tenant_id self.data_types = data_types -class OfficeATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): - """OfficeATP (Office 365 Advanced Threat Protection) data connector properties. +class OfficeIRMDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): + """OfficeIRM (Microsoft Insider Risk Management) data connector properties. All required parameters must be populated in order to send to Azure. @@ -16645,8 +19289,8 @@ class OfficeATPDataConnectorProperties(DataConnectorTenantId, DataConnectorWithA } def __init__( - self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs - ): + self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs: Any + ) -> None: """ :keyword data_types: The available data types for the connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector @@ -16658,91 +19302,122 @@ def __init__( self.tenant_id = tenant_id -class OfficeConsent(Resource): - """Consent for Office365 tenant that already made. +class OfficePowerBICheckRequirements(DataConnectorsCheckRequirements): + """Represents Office PowerBI requirements check request. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar tenant_id: The tenantId of the Office365 with the consent. + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str - :ivar consent_id: Help to easily cascade among the data layers. - :vartype consent_id: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "kind": {"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"}, + "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "consent_id": {"key": "properties.consentId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, consent_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tenant_id: The tenantId of the Office365 with the consent. + :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str - :keyword consent_id: Help to easily cascade among the data layers. - :paramtype consent_id: str """ super().__init__(**kwargs) + self.kind: str = "OfficePowerBI" self.tenant_id = tenant_id - self.consent_id = consent_id -class OfficeConsentList(_serialization.Model): - """List of all the office365 consents. +class OfficePowerBICheckRequirementsProperties(DataConnectorTenantId): + """Office PowerBI requirements check 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 tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class OfficePowerBIConnectorDataTypes(_serialization.Model): + """The available data types for Office Microsoft PowerBI data connector. All required parameters must be populated in order to send to Azure. - :ivar next_link: URL to fetch the next set of office consents. - :vartype next_link: str - :ivar value: Array of the consents. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] + :ivar logs: Logs data type. Required. + :vartype logs: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypesLogs """ _validation = { - "next_link": {"readonly": True}, - "value": {"required": True}, + "logs": {"required": True}, } _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OfficeConsent]"}, + "logs": {"key": "logs", "type": "OfficePowerBIConnectorDataTypesLogs"}, } - def __init__(self, *, value: List["_models.OfficeConsent"], **kwargs): + def __init__(self, *, logs: "_models.OfficePowerBIConnectorDataTypesLogs", **kwargs: Any) -> None: """ - :keyword value: Array of the consents. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] + :keyword logs: Logs data type. Required. + :paramtype logs: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypesLogs """ super().__init__(**kwargs) - self.next_link = None - self.value = value + self.logs = logs -class OfficeDataConnector(DataConnector): - """Represents office data connector. +class OfficePowerBIConnectorDataTypesLogs(DataConnectorDataTypeCommon): + """Logs data type. + + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: + """ + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super().__init__(state=state, **kwargs) + + +class OfficePowerBIDataConnector(DataConnector): + """Represents Office Microsoft PowerBI data connector. Variables are only populated by the server, and will be ignored when sending a request. @@ -16764,15 +19439,15 @@ class OfficeDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + :vartype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes """ _validation = { @@ -16791,7 +19466,7 @@ class OfficeDataConnector(DataConnector): "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "OfficeDataConnectorDataTypes"}, + "data_types": {"key": "properties.dataTypes", "type": "OfficePowerBIConnectorDataTypes"}, } def __init__( @@ -16799,252 +19474,409 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["_models.OfficeDataConnectorDataTypes"] = None, - **kwargs - ): + data_types: Optional["_models.OfficePowerBIConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes """ super().__init__(etag=etag, **kwargs) - self.kind: str = "Office365" + self.kind: str = "OfficePowerBI" self.tenant_id = tenant_id self.data_types = data_types -class OfficeDataConnectorDataTypes(_serialization.Model): - """The available data types for office data connector. - - All required parameters must be populated in order to send to Azure. - - :ivar exchange: Exchange data type connection. Required. - :vartype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange - :ivar share_point: SharePoint data type connection. Required. - :vartype share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint - :ivar teams: Teams data type connection. Required. - :vartype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams - """ - - _validation = { - "exchange": {"required": True}, - "share_point": {"required": True}, - "teams": {"required": True}, - } - - _attribute_map = { - "exchange": {"key": "exchange", "type": "OfficeDataConnectorDataTypesExchange"}, - "share_point": {"key": "sharePoint", "type": "OfficeDataConnectorDataTypesSharePoint"}, - "teams": {"key": "teams", "type": "OfficeDataConnectorDataTypesTeams"}, - } - - def __init__( - self, - *, - exchange: "_models.OfficeDataConnectorDataTypesExchange", - share_point: "_models.OfficeDataConnectorDataTypesSharePoint", - teams: "_models.OfficeDataConnectorDataTypesTeams", - **kwargs - ): - """ - :keyword exchange: Exchange data type connection. Required. - :paramtype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange - :keyword share_point: SharePoint data type connection. Required. - :paramtype share_point: - ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint - :keyword teams: Teams data type connection. Required. - :paramtype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams - """ - super().__init__(**kwargs) - self.exchange = exchange - self.share_point = share_point - self.teams = teams - - -class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): - """Exchange data type connection. +class OfficePowerBIDataConnectorProperties(DataConnectorTenantId): + """Office Microsoft PowerBI data connector properties. All required parameters must be populated in order to send to Azure. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes """ _validation = { - "state": {"required": True}, + "tenant_id": {"required": True}, + "data_types": {"required": True}, } _attribute_map = { - "state": {"key": "state", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "OfficePowerBIConnectorDataTypes"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, tenant_id: str, data_types: "_models.OfficePowerBIConnectorDataTypes", **kwargs: Any) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes """ - super().__init__(state=state, **kwargs) - + super().__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types -class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): - """SharePoint data type connection. - All required parameters must be populated in order to send to Azure. +class Operation(_serialization.Model): + """Operation provided by provider. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar display: Properties of the operation. + :vartype display: ~azure.mgmt.securityinsight.models.OperationDisplay + :ivar name: Name of the operation. + :vartype name: str + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool """ - _validation = { - "state": {"required": True}, - } - _attribute_map = { - "state": {"key": "state", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "name": {"key": "name", "type": "str"}, + "origin": {"key": "origin", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + name: Optional[str] = None, + origin: Optional[str] = None, + is_data_action: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword display: Properties of the operation. + :paramtype display: ~azure.mgmt.securityinsight.models.OperationDisplay + :keyword name: Name of the operation. + :paramtype name: str + :keyword origin: The origin of the operation. + :paramtype origin: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool """ - super().__init__(state=state, **kwargs) - + super().__init__(**kwargs) + self.display = display + self.name = name + self.origin = origin + self.is_data_action = is_data_action -class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): - """Teams data type connection. - All required parameters must be populated in order to send to Azure. +class OperationDisplay(_serialization.Model): + """Properties of the operation. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar description: Description of the operation. + :vartype description: str + :ivar operation: Operation name. + :vartype operation: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str """ - _validation = { - "state": {"required": True}, - } - _attribute_map = { - "state": {"key": "state", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword description: Description of the operation. + :paramtype description: str + :keyword operation: Operation name. + :paramtype operation: str + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str """ - super().__init__(state=state, **kwargs) + super().__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource -class OfficeDataConnectorProperties(DataConnectorTenantId): - """Office data connector properties. +class OperationsList(_serialization.Model): + """Lists the operations available in the SecurityInsights RP. + + 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + :ivar next_link: URL to fetch the next set of operations. + :vartype next_link: str + :ivar value: Array of operations. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Operation] """ _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "OfficeDataConnectorDataTypes"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.OfficeDataConnectorDataTypes", **kwargs): + def __init__(self, *, value: List["_models.Operation"], **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + :keyword value: Array of operations. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Operation] """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types - + super().__init__(**kwargs) + self.next_link = None + self.value = value -class OfficeIRMCheckRequirements(DataConnectorsCheckRequirements): - """Represents OfficeIRM (Microsoft Insider Risk Management) requirements check request. - All required parameters must be populated in order to send to Azure. +class PackageBaseProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Describes package properties. - :ivar kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar content_id: The content id of the package. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :vartype content_product_id: str + :ivar content_kind: The package kind. Known values are: "Solution" and "Standalone". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar content_schema_version: The version of the content schema. + :vartype content_schema_version: str + :ivar is_new: Flag indicates if this is a newly published package. Known values are: "true" and + "false". + :vartype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :vartype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_featured: Flag indicates if this package is among the featured list. Known values are: + "true" and "false". + :vartype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar version: the latest version number of the package. + :vartype version: str + :ivar display_name: The display name of the package. + :vartype display_name: str + :ivar description: The description of the package. + :vartype description: str + :ivar publisher_display_name: The publisher display name of the package. + :vartype publisher_display_name: str + :ivar source: The source of the package. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The author of the package. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: The support tier of the package. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: The support tier of the package. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar providers: Providers for the package item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date package item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the package item. + :vartype last_publish_date: ~datetime.date + :ivar categories: The categories of the package. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str """ - _validation = { - "kind": {"required": True}, - } - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "is_new": {"key": "isNew", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "str"}, + "is_featured": {"key": "isFeatured", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "publisher_display_name": {"key": "publisherDisplayName", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "icon": {"key": "icon", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + content_kind: Optional[Union[str, "_models.PackageKind"]] = None, + content_schema_version: Optional[str] = None, + is_new: Optional[Union[str, "_models.Flag"]] = None, + is_preview: Optional[Union[str, "_models.Flag"]] = None, + is_featured: Optional[Union[str, "_models.Flag"]] = None, + is_deprecated: Optional[Union[str, "_models.Flag"]] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + publisher_display_name: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + categories: Optional["_models.MetadataCategories"] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + icon: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword content_id: The content id of the package. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :paramtype content_product_id: str + :keyword content_kind: The package kind. Known values are: "Solution" and "Standalone". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword content_schema_version: The version of the content schema. + :paramtype content_schema_version: str + :keyword is_new: Flag indicates if this is a newly published package. Known values are: "true" + and "false". + :paramtype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :paramtype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_featured: Flag indicates if this package is among the featured list. Known values + are: "true" and "false". + :paramtype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :paramtype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :keyword version: the latest version number of the package. + :paramtype version: str + :keyword display_name: The display name of the package. + :paramtype display_name: str + :keyword description: The description of the package. + :paramtype description: str + :keyword publisher_display_name: The publisher display name of the package. + :paramtype publisher_display_name: str + :keyword source: The source of the package. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The author of the package. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: The support tier of the package. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: The support tier of the package. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword providers: Providers for the package item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date package item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the package item. + :paramtype last_publish_date: ~datetime.date + :keyword categories: The categories of the package. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str """ super().__init__(**kwargs) - self.kind: str = "OfficeIRM" - self.tenant_id = tenant_id + self.content_id = content_id + self.content_product_id = content_product_id + self.content_kind = content_kind + self.content_schema_version = content_schema_version + self.is_new = is_new + self.is_preview = is_preview + self.is_featured = is_featured + self.is_deprecated = is_deprecated + self.version = version + self.display_name = display_name + self.description = description + self.publisher_display_name = publisher_display_name + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.categories = categories + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.icon = icon -class OfficeIRMCheckRequirementsProperties(DataConnectorTenantId): - """OfficeIRM (Microsoft Insider Risk Management) requirements check properties. +class PackageList(_serialization.Model): + """List available packages. + + 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar next_link: URL to fetch the next set of packages. + :vartype next_link: str + :ivar value: Array of packages. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.PackageModel] """ _validation = { - "tenant_id": {"required": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[PackageModel]"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, value: List["_models.PackageModel"], **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword value: Array of packages. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.PackageModel] """ - super().__init__(tenant_id=tenant_id, **kwargs) + super().__init__(**kwargs) + self.next_link = None + self.value = value -class OfficeIRMDataConnector(DataConnector): - """Represents OfficeIRM (Microsoft Insider Risk Management) data connector. +class PackageModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Represents a Package in Azure Security Insights. 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 @@ -17057,19 +19889,59 @@ class OfficeIRMDataConnector(DataConnector): information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :vartype etag: str + :ivar content_id: The content id of the package. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :vartype content_product_id: str + :ivar content_kind: The package kind. Known values are: "Solution" and "Standalone". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar content_schema_version: The version of the content schema. + :vartype content_schema_version: str + :ivar is_new: Flag indicates if this is a newly published package. Known values are: "true" and + "false". + :vartype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :vartype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_featured: Flag indicates if this package is among the featured list. Known values are: + "true" and "false". + :vartype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar version: the latest version number of the package. + :vartype version: str + :ivar display_name: The display name of the package. + :vartype display_name: str + :ivar description: The description of the package. + :vartype description: str + :ivar publisher_display_name: The publisher display name of the package. + :vartype publisher_display_name: str + :ivar source: The source of the package. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The author of the package. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: The support tier of the package. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: The support tier of the package. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar providers: Providers for the package item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date package item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the package item. + :vartype last_publish_date: ~datetime.date + :ivar categories: The categories of the package. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str """ _validation = { @@ -17077,7 +19949,6 @@ class OfficeIRMDataConnector(DataConnector): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, } _attribute_map = { @@ -17086,183 +19957,555 @@ class OfficeIRMDataConnector(DataConnector): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "AlertsDataTypeOfDataConnector"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "content_product_id": {"key": "properties.contentProductId", "type": "str"}, + "content_kind": {"key": "properties.contentKind", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "is_new": {"key": "properties.isNew", "type": "str"}, + "is_preview": {"key": "properties.isPreview", "type": "str"}, + "is_featured": {"key": "properties.isFeatured", "type": "str"}, + "is_deprecated": {"key": "properties.isDeprecated", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "publisher_display_name": {"key": "properties.publisherDisplayName", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "icon": {"key": "properties.icon", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, - **kwargs - ): + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + content_kind: Optional[Union[str, "_models.PackageKind"]] = None, + content_schema_version: Optional[str] = None, + is_new: Optional[Union[str, "_models.Flag"]] = None, + is_preview: Optional[Union[str, "_models.Flag"]] = None, + is_featured: Optional[Union[str, "_models.Flag"]] = None, + is_deprecated: Optional[Union[str, "_models.Flag"]] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + publisher_display_name: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + categories: Optional["_models.MetadataCategories"] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + icon: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword content_id: The content id of the package. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :paramtype content_product_id: str + :keyword content_kind: The package kind. Known values are: "Solution" and "Standalone". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword content_schema_version: The version of the content schema. + :paramtype content_schema_version: str + :keyword is_new: Flag indicates if this is a newly published package. Known values are: "true" + and "false". + :paramtype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :paramtype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_featured: Flag indicates if this package is among the featured list. Known values + are: "true" and "false". + :paramtype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :paramtype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :keyword version: the latest version number of the package. + :paramtype version: str + :keyword display_name: The display name of the package. + :paramtype display_name: str + :keyword description: The description of the package. + :paramtype description: str + :keyword publisher_display_name: The publisher display name of the package. + :paramtype publisher_display_name: str + :keyword source: The source of the package. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The author of the package. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: The support tier of the package. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: The support tier of the package. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword providers: Providers for the package item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date package item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the package item. + :paramtype last_publish_date: ~datetime.date + :keyword categories: The categories of the package. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str """ super().__init__(etag=etag, **kwargs) - self.kind: str = "OfficeIRM" - self.tenant_id = tenant_id - self.data_types = data_types - + self.content_id = content_id + self.content_product_id = content_product_id + self.content_kind = content_kind + self.content_schema_version = content_schema_version + self.is_new = is_new + self.is_preview = is_preview + self.is_featured = is_featured + self.is_deprecated = is_deprecated + self.version = version + self.display_name = display_name + self.description = description + self.publisher_display_name = publisher_display_name + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.categories = categories + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.icon = icon -class OfficeIRMDataConnectorProperties(DataConnectorTenantId, DataConnectorWithAlertsProperties): - """OfficeIRM (Microsoft Insider Risk Management) data connector properties. - All required parameters must be populated in order to send to Azure. +class PackageProperties(PackageBaseProperties): # pylint: disable=too-many-instance-attributes + """Describes package properties. - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar content_id: The content id of the package. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :vartype content_product_id: str + :ivar content_kind: The package kind. Known values are: "Solution" and "Standalone". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar content_schema_version: The version of the content schema. + :vartype content_schema_version: str + :ivar is_new: Flag indicates if this is a newly published package. Known values are: "true" and + "false". + :vartype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :vartype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_featured: Flag indicates if this package is among the featured list. Known values are: + "true" and "false". + :vartype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar version: the latest version number of the package. + :vartype version: str + :ivar display_name: The display name of the package. + :vartype display_name: str + :ivar description: The description of the package. + :vartype description: str + :ivar publisher_display_name: The publisher display name of the package. + :vartype publisher_display_name: str + :ivar source: The source of the package. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The author of the package. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: The support tier of the package. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: The support tier of the package. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar providers: Providers for the package item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date package item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the package item. + :vartype last_publish_date: ~datetime.date + :ivar categories: The categories of the package. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str """ - _validation = { - "tenant_id": {"required": True}, - } - _attribute_map = { - "data_types": {"key": "dataTypes", "type": "AlertsDataTypeOfDataConnector"}, - "tenant_id": {"key": "tenantId", "type": "str"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "is_new": {"key": "isNew", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "str"}, + "is_featured": {"key": "isFeatured", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "publisher_display_name": {"key": "publisherDisplayName", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "icon": {"key": "icon", "type": "str"}, } def __init__( - self, *, tenant_id: str, data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs - ): + self, + *, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + content_kind: Optional[Union[str, "_models.PackageKind"]] = None, + content_schema_version: Optional[str] = None, + is_new: Optional[Union[str, "_models.Flag"]] = None, + is_preview: Optional[Union[str, "_models.Flag"]] = None, + is_featured: Optional[Union[str, "_models.Flag"]] = None, + is_deprecated: Optional[Union[str, "_models.Flag"]] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + publisher_display_name: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + categories: Optional["_models.MetadataCategories"] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + icon: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword content_id: The content id of the package. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :paramtype content_product_id: str + :keyword content_kind: The package kind. Known values are: "Solution" and "Standalone". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword content_schema_version: The version of the content schema. + :paramtype content_schema_version: str + :keyword is_new: Flag indicates if this is a newly published package. Known values are: "true" + and "false". + :paramtype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :paramtype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_featured: Flag indicates if this package is among the featured list. Known values + are: "true" and "false". + :paramtype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :paramtype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :keyword version: the latest version number of the package. + :paramtype version: str + :keyword display_name: The display name of the package. + :paramtype display_name: str + :keyword description: The description of the package. + :paramtype description: str + :keyword publisher_display_name: The publisher display name of the package. + :paramtype publisher_display_name: str + :keyword source: The source of the package. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The author of the package. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: The support tier of the package. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: The support tier of the package. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword providers: Providers for the package item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date package item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the package item. + :paramtype last_publish_date: ~datetime.date + :keyword categories: The categories of the package. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str """ - super().__init__(tenant_id=tenant_id, data_types=data_types, **kwargs) - self.data_types = data_types - self.tenant_id = tenant_id - + super().__init__( + content_id=content_id, + content_product_id=content_product_id, + content_kind=content_kind, + content_schema_version=content_schema_version, + is_new=is_new, + is_preview=is_preview, + is_featured=is_featured, + is_deprecated=is_deprecated, + version=version, + display_name=display_name, + description=description, + publisher_display_name=publisher_display_name, + source=source, + author=author, + support=support, + dependencies=dependencies, + providers=providers, + first_publish_date=first_publish_date, + last_publish_date=last_publish_date, + categories=categories, + threat_analysis_tactics=threat_analysis_tactics, + threat_analysis_techniques=threat_analysis_techniques, + icon=icon, + **kwargs + ) -class OfficePowerBICheckRequirements(DataConnectorsCheckRequirements): - """Represents Office PowerBI requirements check request. - All required parameters must be populated in order to send to Azure. +class Permissions(_serialization.Model): + """Permissions required for the connector. - :ivar kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar resource_provider: Resource provider permissions required for the connector. + :vartype resource_provider: + list[~azure.mgmt.securityinsight.models.PermissionsResourceProviderItem] + :ivar customs: Customs permissions required for the connector. + :vartype customs: list[~azure.mgmt.securityinsight.models.PermissionsCustomsItem] """ - _validation = { - "kind": {"required": True}, - } - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "resource_provider": {"key": "resourceProvider", "type": "[PermissionsResourceProviderItem]"}, + "customs": {"key": "customs", "type": "[PermissionsCustomsItem]"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + resource_provider: Optional[List["_models.PermissionsResourceProviderItem"]] = None, + customs: Optional[List["_models.PermissionsCustomsItem"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword resource_provider: Resource provider permissions required for the connector. + :paramtype resource_provider: + list[~azure.mgmt.securityinsight.models.PermissionsResourceProviderItem] + :keyword customs: Customs permissions required for the connector. + :paramtype customs: list[~azure.mgmt.securityinsight.models.PermissionsCustomsItem] """ super().__init__(**kwargs) - self.kind: str = "OfficePowerBI" - self.tenant_id = tenant_id + self.resource_provider = resource_provider + self.customs = customs -class OfficePowerBICheckRequirementsProperties(DataConnectorTenantId): - """Office PowerBI requirements check properties. +class PermissionsCustomsItem(Customs): + """PermissionsCustomsItem. - All required parameters must be populated in order to send to Azure. + :ivar name: Customs permissions name. + :vartype name: str + :ivar description: Customs permissions description. + :vartype description: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Customs permissions name. + :paramtype name: str + :keyword description: Customs permissions description. + :paramtype description: str + """ + super().__init__(name=name, description=description, **kwargs) + + +class ResourceProvider(_serialization.Model): + """Resource provider permissions required for the connector. - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", + "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", + "Microsoft.OperationalInsights/workspaces/sharedKeys", and + "Microsoft.Authorization/policyAssignments". + :vartype provider: str or ~azure.mgmt.securityinsight.models.ProviderName + :ivar permissions_display_text: Permission description text. + :vartype permissions_display_text: str + :ivar provider_display_name: Permission provider display name. + :vartype provider_display_name: str + :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", and + "Workspace". + :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope + :ivar required_permissions: Required permissions for the connector. + :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions """ - _validation = { - "tenant_id": {"required": True}, - } - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "permissions_display_text": {"key": "permissionsDisplayText", "type": "str"}, + "provider_display_name": {"key": "providerDisplayName", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + "required_permissions": {"key": "requiredPermissions", "type": "RequiredPermissions"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__( + self, + *, + provider: Optional[Union[str, "_models.ProviderName"]] = None, + permissions_display_text: Optional[str] = None, + provider_display_name: Optional[str] = None, + scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, + required_permissions: Optional["_models.RequiredPermissions"] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", + "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", + "Microsoft.OperationalInsights/workspaces/sharedKeys", and + "Microsoft.Authorization/policyAssignments". + :paramtype provider: str or ~azure.mgmt.securityinsight.models.ProviderName + :keyword permissions_display_text: Permission description text. + :paramtype permissions_display_text: str + :keyword provider_display_name: Permission provider display name. + :paramtype provider_display_name: str + :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + and "Workspace". + :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope + :keyword required_permissions: Required permissions for the connector. + :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions """ - super().__init__(tenant_id=tenant_id, **kwargs) - + super().__init__(**kwargs) + self.provider = provider + self.permissions_display_text = permissions_display_text + self.provider_display_name = provider_display_name + self.scope = scope + self.required_permissions = required_permissions -class OfficePowerBIConnectorDataTypes(_serialization.Model): - """The available data types for Office Microsoft PowerBI data connector. - All required parameters must be populated in order to send to Azure. +class PermissionsResourceProviderItem(ResourceProvider): + """PermissionsResourceProviderItem. - :ivar logs: Logs data type. Required. - :vartype logs: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypesLogs + :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", + "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", + "Microsoft.OperationalInsights/workspaces/sharedKeys", and + "Microsoft.Authorization/policyAssignments". + :vartype provider: str or ~azure.mgmt.securityinsight.models.ProviderName + :ivar permissions_display_text: Permission description text. + :vartype permissions_display_text: str + :ivar provider_display_name: Permission provider display name. + :vartype provider_display_name: str + :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", and + "Workspace". + :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope + :ivar required_permissions: Required permissions for the connector. + :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions """ - _validation = { - "logs": {"required": True}, - } - _attribute_map = { - "logs": {"key": "logs", "type": "OfficePowerBIConnectorDataTypesLogs"}, + "provider": {"key": "provider", "type": "str"}, + "permissions_display_text": {"key": "permissionsDisplayText", "type": "str"}, + "provider_display_name": {"key": "providerDisplayName", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + "required_permissions": {"key": "requiredPermissions", "type": "RequiredPermissions"}, } - def __init__(self, *, logs: "_models.OfficePowerBIConnectorDataTypesLogs", **kwargs): + def __init__( + self, + *, + provider: Optional[Union[str, "_models.ProviderName"]] = None, + permissions_display_text: Optional[str] = None, + provider_display_name: Optional[str] = None, + scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, + required_permissions: Optional["_models.RequiredPermissions"] = None, + **kwargs: Any + ) -> None: """ - :keyword logs: Logs data type. Required. - :paramtype logs: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypesLogs + :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", + "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", + "Microsoft.OperationalInsights/workspaces/sharedKeys", and + "Microsoft.Authorization/policyAssignments". + :paramtype provider: str or ~azure.mgmt.securityinsight.models.ProviderName + :keyword permissions_display_text: Permission description text. + :paramtype permissions_display_text: str + :keyword provider_display_name: Permission provider display name. + :paramtype provider_display_name: str + :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + and "Workspace". + :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope + :keyword required_permissions: Required permissions for the connector. + :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions """ - super().__init__(**kwargs) - self.logs = logs + super().__init__( + provider=provider, + permissions_display_text=permissions_display_text, + provider_display_name=provider_display_name, + scope=scope, + required_permissions=required_permissions, + **kwargs + ) -class OfficePowerBIConnectorDataTypesLogs(DataConnectorDataTypeCommon): - """Logs data type. +class PlaybookActionProperties(_serialization.Model): + """PlaybookActionProperties. All required parameters must be populated in order to send to Azure. - :ivar state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar logic_app_resource_id: The resource id of the playbook resource. Required. + :vartype logic_app_resource_id: str + :ivar tenant_id: The tenant id of the playbook resource. + :vartype tenant_id: str """ _validation = { - "state": {"required": True}, + "logic_app_resource_id": {"required": True}, } _attribute_map = { - "state": {"key": "state", "type": "str"}, + "logic_app_resource_id": {"key": "logicAppResourceId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, logic_app_resource_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :keyword logic_app_resource_id: The resource id of the playbook resource. Required. + :paramtype logic_app_resource_id: str + :keyword tenant_id: The tenant id of the playbook resource. + :paramtype tenant_id: str """ - super().__init__(state=state, **kwargs) + super().__init__(**kwargs) + self.logic_app_resource_id = logic_app_resource_id + self.tenant_id = tenant_id -class OfficePowerBIDataConnector(DataConnector): - """Represents Office Microsoft PowerBI data connector. +class ProcessEntity(Entity): # pylint: disable=too-many-instance-attributes + """Represents a process entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -17279,20 +20522,36 @@ class OfficePowerBIDataConnector(DataConnector): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar account_entity_id: The account entity id running the processes. + :vartype account_entity_id: str + :ivar command_line: The command line used to create the process. + :vartype command_line: str + :ivar creation_time_utc: The time when the process started to run. + :vartype creation_time_utc: ~datetime.datetime + :ivar elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", and "Limited". + :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken + :ivar host_entity_id: The host entity id on which the process was running. + :vartype host_entity_id: str + :ivar host_logon_session_entity_id: The session entity id in which the process was running. + :vartype host_logon_session_entity_id: str + :ivar image_file_entity_id: Image file entity id. + :vartype image_file_entity_id: str + :ivar parent_process_entity_id: The parent process entity id. + :vartype parent_process_entity_id: str + :ivar process_id: The process ID. + :vartype process_id: str """ _validation = { @@ -17301,176 +20560,191 @@ class OfficePowerBIDataConnector(DataConnector): "type": {"readonly": True}, "system_data": {"readonly": True}, "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "account_entity_id": {"readonly": True}, + "command_line": {"readonly": True}, + "creation_time_utc": {"readonly": True}, + "host_entity_id": {"readonly": True}, + "host_logon_session_entity_id": {"readonly": True}, + "image_file_entity_id": {"readonly": True}, + "parent_process_entity_id": {"readonly": True}, + "process_id": {"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"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "OfficePowerBIConnectorDataTypes"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - data_types: Optional["_models.OfficePowerBIConnectorDataTypes"] = None, - **kwargs - ): - """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes - """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "OfficePowerBI" - self.tenant_id = tenant_id - self.data_types = data_types - - -class OfficePowerBIDataConnectorProperties(DataConnectorTenantId): - """Office Microsoft PowerBI data connector properties. - - All required parameters must be populated in order to send to Azure. - - :ivar tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes - """ - - _validation = { - "tenant_id": {"required": True}, - "data_types": {"required": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "OfficePowerBIConnectorDataTypes"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "account_entity_id": {"key": "properties.accountEntityId", "type": "str"}, + "command_line": {"key": "properties.commandLine", "type": "str"}, + "creation_time_utc": {"key": "properties.creationTimeUtc", "type": "iso-8601"}, + "elevation_token": {"key": "properties.elevationToken", "type": "str"}, + "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, + "host_logon_session_entity_id": {"key": "properties.hostLogonSessionEntityId", "type": "str"}, + "image_file_entity_id": {"key": "properties.imageFileEntityId", "type": "str"}, + "parent_process_entity_id": {"key": "properties.parentProcessEntityId", "type": "str"}, + "process_id": {"key": "properties.processId", "type": "str"}, } - def __init__(self, *, tenant_id: str, data_types: "_models.OfficePowerBIConnectorDataTypes", **kwargs): + def __init__( + self, *, elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficePowerBIConnectorDataTypes + :keyword elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", and "Limited". + :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.data_types = data_types + super().__init__(**kwargs) + self.kind: str = "Process" + self.additional_data = None + self.friendly_name = None + self.account_entity_id = None + self.command_line = None + self.creation_time_utc = None + self.elevation_token = elevation_token + self.host_entity_id = None + self.host_logon_session_entity_id = None + self.image_file_entity_id = None + self.parent_process_entity_id = None + self.process_id = None -class Operation(_serialization.Model): - """Operation provided by provider. +class ProcessEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes + """Process entity property bag. - :ivar display: Properties of the operation. - :vartype display: ~azure.mgmt.securityinsight.models.OperationDisplay - :ivar name: Name of the operation. - :vartype name: str - :ivar origin: The origin of the operation. - :vartype origin: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar account_entity_id: The account entity id running the processes. + :vartype account_entity_id: str + :ivar command_line: The command line used to create the process. + :vartype command_line: str + :ivar creation_time_utc: The time when the process started to run. + :vartype creation_time_utc: ~datetime.datetime + :ivar elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", and "Limited". + :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken + :ivar host_entity_id: The host entity id on which the process was running. + :vartype host_entity_id: str + :ivar host_logon_session_entity_id: The session entity id in which the process was running. + :vartype host_logon_session_entity_id: str + :ivar image_file_entity_id: Image file entity id. + :vartype image_file_entity_id: str + :ivar parent_process_entity_id: The parent process entity id. + :vartype parent_process_entity_id: str + :ivar process_id: The process ID. + :vartype process_id: str """ + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "account_entity_id": {"readonly": True}, + "command_line": {"readonly": True}, + "creation_time_utc": {"readonly": True}, + "host_entity_id": {"readonly": True}, + "host_logon_session_entity_id": {"readonly": True}, + "image_file_entity_id": {"readonly": True}, + "parent_process_entity_id": {"readonly": True}, + "process_id": {"readonly": True}, + } + _attribute_map = { - "display": {"key": "display", "type": "OperationDisplay"}, - "name": {"key": "name", "type": "str"}, - "origin": {"key": "origin", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "account_entity_id": {"key": "accountEntityId", "type": "str"}, + "command_line": {"key": "commandLine", "type": "str"}, + "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, + "elevation_token": {"key": "elevationToken", "type": "str"}, + "host_entity_id": {"key": "hostEntityId", "type": "str"}, + "host_logon_session_entity_id": {"key": "hostLogonSessionEntityId", "type": "str"}, + "image_file_entity_id": {"key": "imageFileEntityId", "type": "str"}, + "parent_process_entity_id": {"key": "parentProcessEntityId", "type": "str"}, + "process_id": {"key": "processId", "type": "str"}, } def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = None, - name: Optional[str] = None, - origin: Optional[str] = None, - is_data_action: Optional[bool] = None, - **kwargs - ): + self, *, elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs: Any + ) -> None: """ - :keyword display: Properties of the operation. - :paramtype display: ~azure.mgmt.securityinsight.models.OperationDisplay - :keyword name: Name of the operation. - :paramtype name: str - :keyword origin: The origin of the operation. - :paramtype origin: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool + :keyword elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", and "Limited". + :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken """ super().__init__(**kwargs) - self.display = display - self.name = name - self.origin = origin - self.is_data_action = is_data_action + self.account_entity_id = None + self.command_line = None + self.creation_time_utc = None + self.elevation_token = elevation_token + self.host_entity_id = None + self.host_logon_session_entity_id = None + self.image_file_entity_id = None + self.parent_process_entity_id = None + self.process_id = None -class OperationDisplay(_serialization.Model): - """Properties of the operation. +class ProductPackageAdditionalProperties(_serialization.Model): + """product package additional properties. - :ivar description: Description of the operation. - :vartype description: str - :ivar operation: Operation name. - :vartype operation: str - :ivar provider: Provider name. - :vartype provider: str - :ivar resource: Resource name. - :vartype resource: str + :ivar installed_version: The version of the installed package, null or absent means not + installed. + :vartype installed_version: str + :ivar metadata_resource_id: The metadata resource id. + :vartype metadata_resource_id: str + :ivar packaged_content: The json of the ARM template to deploy. Expandable. + :vartype packaged_content: JSON """ _attribute_map = { - "description": {"key": "description", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, + "installed_version": {"key": "installedVersion", "type": "str"}, + "metadata_resource_id": {"key": "metadataResourceId", "type": "str"}, + "packaged_content": {"key": "packagedContent", "type": "object"}, } def __init__( self, *, - description: Optional[str] = None, - operation: Optional[str] = None, - provider: Optional[str] = None, - resource: Optional[str] = None, - **kwargs - ): + installed_version: Optional[str] = None, + metadata_resource_id: Optional[str] = None, + packaged_content: Optional[JSON] = None, + **kwargs: Any + ) -> None: """ - :keyword description: Description of the operation. - :paramtype description: str - :keyword operation: Operation name. - :paramtype operation: str - :keyword provider: Provider name. - :paramtype provider: str - :keyword resource: Resource name. - :paramtype resource: str + :keyword installed_version: The version of the installed package, null or absent means not + installed. + :paramtype installed_version: str + :keyword metadata_resource_id: The metadata resource id. + :paramtype metadata_resource_id: str + :keyword packaged_content: The json of the ARM template to deploy. Expandable. + :paramtype packaged_content: JSON """ super().__init__(**kwargs) - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource + self.installed_version = installed_version + self.metadata_resource_id = metadata_resource_id + self.packaged_content = packaged_content -class OperationsList(_serialization.Model): - """Lists the operations available in the SecurityInsights RP. +class ProductPackageList(_serialization.Model): + """List available packages. 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 next_link: URL to fetch the next set of operations. + :ivar next_link: URL to fetch the next set of packages. :vartype next_link: str - :ivar value: Array of operations. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.Operation] + :ivar value: Array of packages. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.ProductPackageModel] """ _validation = { @@ -17480,238 +20754,565 @@ class OperationsList(_serialization.Model): _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Operation]"}, + "value": {"key": "value", "type": "[ProductPackageModel]"}, } - def __init__(self, *, value: List["_models.Operation"], **kwargs): + def __init__(self, *, value: List["_models.ProductPackageModel"], **kwargs: Any) -> None: """ - :keyword value: Array of operations. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.Operation] + :keyword value: Array of packages. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.ProductPackageModel] """ super().__init__(**kwargs) self.next_link = None self.value = value -class Permissions(_serialization.Model): - """Permissions required for the connector. - - :ivar resource_provider: Resource provider permissions required for the connector. - :vartype resource_provider: - list[~azure.mgmt.securityinsight.models.PermissionsResourceProviderItem] - :ivar customs: Customs permissions required for the connector. - :vartype customs: list[~azure.mgmt.securityinsight.models.PermissionsCustomsItem] - """ - - _attribute_map = { - "resource_provider": {"key": "resourceProvider", "type": "[PermissionsResourceProviderItem]"}, - "customs": {"key": "customs", "type": "[PermissionsCustomsItem]"}, - } - - def __init__( - self, - *, - resource_provider: Optional[List["_models.PermissionsResourceProviderItem"]] = None, - customs: Optional[List["_models.PermissionsCustomsItem"]] = None, - **kwargs - ): - """ - :keyword resource_provider: Resource provider permissions required for the connector. - :paramtype resource_provider: - list[~azure.mgmt.securityinsight.models.PermissionsResourceProviderItem] - :keyword customs: Customs permissions required for the connector. - :paramtype customs: list[~azure.mgmt.securityinsight.models.PermissionsCustomsItem] - """ - super().__init__(**kwargs) - self.resource_provider = resource_provider - self.customs = customs - +class ProductPackageModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Represents a Package in Azure Security Insights. -class PermissionsCustomsItem(Customs): - """PermissionsCustomsItem. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Customs permissions 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 description: Customs permissions description. - :vartype description: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs): - """ - :keyword name: Customs permissions name. - :paramtype name: str - :keyword description: Customs permissions description. - :paramtype description: str - """ - super().__init__(name=name, description=description, **kwargs) - - -class ResourceProvider(_serialization.Model): - """Resource provider permissions required for the connector. - - :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", - "Microsoft.OperationalInsights/workspaces", - "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", - "Microsoft.OperationalInsights/workspaces/sharedKeys", and - "Microsoft.Authorization/policyAssignments". - :vartype provider: str or ~azure.mgmt.securityinsight.models.ProviderName - :ivar permissions_display_text: Permission description text. - :vartype permissions_display_text: str - :ivar provider_display_name: Permission provider display name. - :vartype provider_display_name: str - :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", and - "Workspace". - :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope - :ivar required_permissions: Required permissions for the connector. - :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar content_id: The content id of the package. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :vartype content_product_id: str + :ivar content_kind: The package kind. Known values are: "Solution" and "Standalone". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar content_schema_version: The version of the content schema. + :vartype content_schema_version: str + :ivar is_new: Flag indicates if this is a newly published package. Known values are: "true" and + "false". + :vartype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :vartype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_featured: Flag indicates if this package is among the featured list. Known values are: + "true" and "false". + :vartype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar version: the latest version number of the package. + :vartype version: str + :ivar display_name: The display name of the package. + :vartype display_name: str + :ivar description: The description of the package. + :vartype description: str + :ivar publisher_display_name: The publisher display name of the package. + :vartype publisher_display_name: str + :ivar source: The source of the package. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The author of the package. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: The support tier of the package. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: The support tier of the package. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar providers: Providers for the package item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date package item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the package item. + :vartype last_publish_date: ~datetime.date + :ivar categories: The categories of the package. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar installed_version: The version of the installed package, null or absent means not + installed. + :vartype installed_version: str + :ivar metadata_resource_id: The metadata resource id. + :vartype metadata_resource_id: str + :ivar packaged_content: The json of the ARM template to deploy. Expandable. + :vartype packaged_content: JSON """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "permissions_display_text": {"key": "permissionsDisplayText", "type": "str"}, - "provider_display_name": {"key": "providerDisplayName", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "required_permissions": {"key": "requiredPermissions", "type": "RequiredPermissions"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "content_product_id": {"key": "properties.contentProductId", "type": "str"}, + "content_kind": {"key": "properties.contentKind", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "is_new": {"key": "properties.isNew", "type": "str"}, + "is_preview": {"key": "properties.isPreview", "type": "str"}, + "is_featured": {"key": "properties.isFeatured", "type": "str"}, + "is_deprecated": {"key": "properties.isDeprecated", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "publisher_display_name": {"key": "properties.publisherDisplayName", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "icon": {"key": "properties.icon", "type": "str"}, + "installed_version": {"key": "properties.installedVersion", "type": "str"}, + "metadata_resource_id": {"key": "properties.metadataResourceId", "type": "str"}, + "packaged_content": {"key": "properties.packagedContent", "type": "object"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - provider: Optional[Union[str, "_models.ProviderName"]] = None, - permissions_display_text: Optional[str] = None, - provider_display_name: Optional[str] = None, - scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, - required_permissions: Optional["_models.RequiredPermissions"] = None, - **kwargs - ): + etag: Optional[str] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + content_kind: Optional[Union[str, "_models.PackageKind"]] = None, + content_schema_version: Optional[str] = None, + is_new: Optional[Union[str, "_models.Flag"]] = None, + is_preview: Optional[Union[str, "_models.Flag"]] = None, + is_featured: Optional[Union[str, "_models.Flag"]] = None, + is_deprecated: Optional[Union[str, "_models.Flag"]] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + publisher_display_name: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + categories: Optional["_models.MetadataCategories"] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + icon: Optional[str] = None, + installed_version: Optional[str] = None, + metadata_resource_id: Optional[str] = None, + packaged_content: Optional[JSON] = None, + **kwargs: Any + ) -> None: """ - :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", - "Microsoft.OperationalInsights/workspaces", - "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", - "Microsoft.OperationalInsights/workspaces/sharedKeys", and - "Microsoft.Authorization/policyAssignments". - :paramtype provider: str or ~azure.mgmt.securityinsight.models.ProviderName - :keyword permissions_display_text: Permission description text. - :paramtype permissions_display_text: str - :keyword provider_display_name: Permission provider display name. - :paramtype provider_display_name: str - :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", - and "Workspace". - :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope - :keyword required_permissions: Required permissions for the connector. - :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword content_id: The content id of the package. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :paramtype content_product_id: str + :keyword content_kind: The package kind. Known values are: "Solution" and "Standalone". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword content_schema_version: The version of the content schema. + :paramtype content_schema_version: str + :keyword is_new: Flag indicates if this is a newly published package. Known values are: "true" + and "false". + :paramtype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :paramtype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_featured: Flag indicates if this package is among the featured list. Known values + are: "true" and "false". + :paramtype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :paramtype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :keyword version: the latest version number of the package. + :paramtype version: str + :keyword display_name: The display name of the package. + :paramtype display_name: str + :keyword description: The description of the package. + :paramtype description: str + :keyword publisher_display_name: The publisher display name of the package. + :paramtype publisher_display_name: str + :keyword source: The source of the package. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The author of the package. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: The support tier of the package. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: The support tier of the package. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword providers: Providers for the package item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date package item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the package item. + :paramtype last_publish_date: ~datetime.date + :keyword categories: The categories of the package. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword installed_version: The version of the installed package, null or absent means not + installed. + :paramtype installed_version: str + :keyword metadata_resource_id: The metadata resource id. + :paramtype metadata_resource_id: str + :keyword packaged_content: The json of the ARM template to deploy. Expandable. + :paramtype packaged_content: JSON """ - super().__init__(**kwargs) - self.provider = provider - self.permissions_display_text = permissions_display_text - self.provider_display_name = provider_display_name - self.scope = scope - self.required_permissions = required_permissions - + super().__init__(etag=etag, **kwargs) + self.content_id = content_id + self.content_product_id = content_product_id + self.content_kind = content_kind + self.content_schema_version = content_schema_version + self.is_new = is_new + self.is_preview = is_preview + self.is_featured = is_featured + self.is_deprecated = is_deprecated + self.version = version + self.display_name = display_name + self.description = description + self.publisher_display_name = publisher_display_name + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.categories = categories + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.icon = icon + self.installed_version = installed_version + self.metadata_resource_id = metadata_resource_id + self.packaged_content = packaged_content -class PermissionsResourceProviderItem(ResourceProvider): - """PermissionsResourceProviderItem. - :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", - "Microsoft.OperationalInsights/workspaces", - "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", - "Microsoft.OperationalInsights/workspaces/sharedKeys", and - "Microsoft.Authorization/policyAssignments". - :vartype provider: str or ~azure.mgmt.securityinsight.models.ProviderName - :ivar permissions_display_text: Permission description text. - :vartype permissions_display_text: str - :ivar provider_display_name: Permission provider display name. - :vartype provider_display_name: str - :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", and - "Workspace". - :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope - :ivar required_permissions: Required permissions for the connector. - :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions +class ProductPackageProperties( + PackageBaseProperties, ProductPackageAdditionalProperties +): # pylint: disable=too-many-instance-attributes + """Describes package properties. + + :ivar installed_version: The version of the installed package, null or absent means not + installed. + :vartype installed_version: str + :ivar metadata_resource_id: The metadata resource id. + :vartype metadata_resource_id: str + :ivar packaged_content: The json of the ARM template to deploy. Expandable. + :vartype packaged_content: JSON + :ivar content_id: The content id of the package. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :vartype content_product_id: str + :ivar content_kind: The package kind. Known values are: "Solution" and "Standalone". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar content_schema_version: The version of the content schema. + :vartype content_schema_version: str + :ivar is_new: Flag indicates if this is a newly published package. Known values are: "true" and + "false". + :vartype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :vartype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_featured: Flag indicates if this package is among the featured list. Known values are: + "true" and "false". + :vartype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar version: the latest version number of the package. + :vartype version: str + :ivar display_name: The display name of the package. + :vartype display_name: str + :ivar description: The description of the package. + :vartype description: str + :ivar publisher_display_name: The publisher display name of the package. + :vartype publisher_display_name: str + :ivar source: The source of the package. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The author of the package. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: The support tier of the package. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: The support tier of the package. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar providers: Providers for the package item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date package item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the package item. + :vartype last_publish_date: ~datetime.date + :ivar categories: The categories of the package. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str """ _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "permissions_display_text": {"key": "permissionsDisplayText", "type": "str"}, - "provider_display_name": {"key": "providerDisplayName", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "required_permissions": {"key": "requiredPermissions", "type": "RequiredPermissions"}, + "installed_version": {"key": "installedVersion", "type": "str"}, + "metadata_resource_id": {"key": "metadataResourceId", "type": "str"}, + "packaged_content": {"key": "packagedContent", "type": "object"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "is_new": {"key": "isNew", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "str"}, + "is_featured": {"key": "isFeatured", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "publisher_display_name": {"key": "publisherDisplayName", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "icon": {"key": "icon", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - provider: Optional[Union[str, "_models.ProviderName"]] = None, - permissions_display_text: Optional[str] = None, - provider_display_name: Optional[str] = None, - scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, - required_permissions: Optional["_models.RequiredPermissions"] = None, - **kwargs - ): - """ - :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", - "Microsoft.OperationalInsights/workspaces", - "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", - "Microsoft.OperationalInsights/workspaces/sharedKeys", and - "Microsoft.Authorization/policyAssignments". - :paramtype provider: str or ~azure.mgmt.securityinsight.models.ProviderName - :keyword permissions_display_text: Permission description text. - :paramtype permissions_display_text: str - :keyword provider_display_name: Permission provider display name. - :paramtype provider_display_name: str - :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", - and "Workspace". - :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope - :keyword required_permissions: Required permissions for the connector. - :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions + installed_version: Optional[str] = None, + metadata_resource_id: Optional[str] = None, + packaged_content: Optional[JSON] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + content_kind: Optional[Union[str, "_models.PackageKind"]] = None, + content_schema_version: Optional[str] = None, + is_new: Optional[Union[str, "_models.Flag"]] = None, + is_preview: Optional[Union[str, "_models.Flag"]] = None, + is_featured: Optional[Union[str, "_models.Flag"]] = None, + is_deprecated: Optional[Union[str, "_models.Flag"]] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + publisher_display_name: Optional[str] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + categories: Optional["_models.MetadataCategories"] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + icon: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword installed_version: The version of the installed package, null or absent means not + installed. + :paramtype installed_version: str + :keyword metadata_resource_id: The metadata resource id. + :paramtype metadata_resource_id: str + :keyword packaged_content: The json of the ARM template to deploy. Expandable. + :paramtype packaged_content: JSON + :keyword content_id: The content id of the package. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId, contentKind and the contentVersion of the package. + :paramtype content_product_id: str + :keyword content_kind: The package kind. Known values are: "Solution" and "Standalone". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword content_schema_version: The version of the content schema. + :paramtype content_schema_version: str + :keyword is_new: Flag indicates if this is a newly published package. Known values are: "true" + and "false". + :paramtype is_new: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_preview: Flag indicates if this package is in preview. Known values are: "true" and + "false". + :paramtype is_preview: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_featured: Flag indicates if this package is among the featured list. Known values + are: "true" and "false". + :paramtype is_featured: str or ~azure.mgmt.securityinsight.models.Flag + :keyword is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :paramtype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :keyword version: the latest version number of the package. + :paramtype version: str + :keyword display_name: The display name of the package. + :paramtype display_name: str + :keyword description: The description of the package. + :paramtype description: str + :keyword publisher_display_name: The publisher display name of the package. + :paramtype publisher_display_name: str + :keyword source: The source of the package. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The author of the package. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: The support tier of the package. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: The support tier of the package. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword providers: Providers for the package item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date package item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the package item. + :paramtype last_publish_date: ~datetime.date + :keyword categories: The categories of the package. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str """ super().__init__( - provider=provider, - permissions_display_text=permissions_display_text, - provider_display_name=provider_display_name, - scope=scope, - required_permissions=required_permissions, + content_id=content_id, + content_product_id=content_product_id, + content_kind=content_kind, + content_schema_version=content_schema_version, + is_new=is_new, + is_preview=is_preview, + is_featured=is_featured, + is_deprecated=is_deprecated, + version=version, + display_name=display_name, + description=description, + publisher_display_name=publisher_display_name, + source=source, + author=author, + support=support, + dependencies=dependencies, + providers=providers, + first_publish_date=first_publish_date, + last_publish_date=last_publish_date, + categories=categories, + threat_analysis_tactics=threat_analysis_tactics, + threat_analysis_techniques=threat_analysis_techniques, + icon=icon, + installed_version=installed_version, + metadata_resource_id=metadata_resource_id, + packaged_content=packaged_content, **kwargs ) + self.installed_version = installed_version + self.metadata_resource_id = metadata_resource_id + self.packaged_content = packaged_content + self.content_id = content_id + self.content_product_id = content_product_id + self.content_kind = content_kind + self.content_schema_version = content_schema_version + self.is_new = is_new + self.is_preview = is_preview + self.is_featured = is_featured + self.is_deprecated = is_deprecated + self.version = version + self.display_name = display_name + self.description = description + self.publisher_display_name = publisher_display_name + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.categories = categories + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.icon = icon -class PlaybookActionProperties(_serialization.Model): - """PlaybookActionProperties. +class ProductTemplateAdditionalProperties(_serialization.Model): + """additional properties of product template. - :ivar logic_app_resource_id: The resource id of the playbook resource. - :vartype logic_app_resource_id: str - :ivar tenant_id: The tenant id of the playbook resource. - :vartype tenant_id: str + :ivar packaged_content: The json of the ARM template to deploy. + :vartype packaged_content: JSON """ _attribute_map = { - "logic_app_resource_id": {"key": "logicAppResourceId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, + "packaged_content": {"key": "packagedContent", "type": "object"}, } - def __init__(self, *, logic_app_resource_id: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, packaged_content: Optional[JSON] = None, **kwargs: Any) -> None: """ - :keyword logic_app_resource_id: The resource id of the playbook resource. - :paramtype logic_app_resource_id: str - :keyword tenant_id: The tenant id of the playbook resource. - :paramtype tenant_id: str + :keyword packaged_content: The json of the ARM template to deploy. + :paramtype packaged_content: JSON """ super().__init__(**kwargs) - self.logic_app_resource_id = logic_app_resource_id - self.tenant_id = tenant_id + self.packaged_content = packaged_content -class ProcessEntity(Entity): # pylint: disable=too-many-instance-attributes - """Represents a process entity. +class ProductTemplateList(_serialization.Model): + """List of all the template. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. + :ivar value: Array of templates. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.ProductTemplateModel] + :ivar next_link: URL to fetch the next page of template. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ProductTemplateModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ProductTemplateModel"], **kwargs: Any) -> None: + """ + :keyword value: Array of templates. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.ProductTemplateModel] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProductTemplateModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Template resource definition. + + 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 @@ -17723,171 +21324,761 @@ class ProcessEntity(Entity): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar account_entity_id: The account entity id running the processes. - :vartype account_entity_id: str - :ivar command_line: The command line used to create the process. - :vartype command_line: str - :ivar creation_time_utc: The time when the process started to run. - :vartype creation_time_utc: ~datetime.datetime - :ivar elevation_token: The elevation token associated with the process. Known values are: - "Default", "Full", and "Limited". - :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken - :ivar host_entity_id: The host entity id on which the process was running. - :vartype host_entity_id: str - :ivar host_logon_session_entity_id: The session entity id in which the process was running. - :vartype host_logon_session_entity_id: str - :ivar image_file_entity_id: Image file entity id. - :vartype image_file_entity_id: str - :ivar parent_process_entity_id: The parent process entity id. - :vartype parent_process_entity_id: str - :ivar process_id: The process ID. - :vartype process_id: str + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :vartype content_product_id: str + :ivar package_version: Version of the package. Default and recommended format is numeric (e.g. + 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but + then we cannot guarantee any version checks. + :vartype package_version: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar display_name: The display name of the template. + :vartype display_name: str + :ivar content_kind: The kind of content the template is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the template - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + :ivar package_id: the package Id contains this template. + :vartype package_id: str + :ivar package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :vartype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar package_name: the name of the package contains this template. + :vartype package_name: str + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar packaged_content: The json of the ARM template to deploy. + :vartype packaged_content: JSON + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "is_deprecated": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "content_product_id": {"key": "properties.contentProductId", "type": "str"}, + "package_version": {"key": "properties.packageVersion", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "content_kind": {"key": "properties.contentKind", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "custom_version": {"key": "properties.customVersion", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "icon": {"key": "properties.icon", "type": "str"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "properties.previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + "package_id": {"key": "properties.packageId", "type": "str"}, + "package_kind": {"key": "properties.packageKind", "type": "str"}, + "package_name": {"key": "properties.packageName", "type": "str"}, + "is_deprecated": {"key": "properties.isDeprecated", "type": "str"}, + "packaged_content": {"key": "properties.packagedContent", "type": "object"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + etag: Optional[str] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + package_version: Optional[str] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + content_kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + package_id: Optional[str] = None, + package_kind: Optional[Union[str, "_models.PackageKind"]] = None, + package_name: Optional[str] = None, + packaged_content: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :paramtype content_product_id: str + :keyword package_version: Version of the package. Default and recommended format is numeric + (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, + but then we cannot guarantee any version checks. + :paramtype package_version: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword display_name: The display name of the template. + :paramtype display_name: str + :keyword content_kind: The kind of content the template is for. Known values are: + "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the template - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + :keyword package_id: the package Id contains this template. + :paramtype package_id: str + :keyword package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :paramtype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword package_name: the name of the package contains this template. + :paramtype package_name: str + :keyword packaged_content: The json of the ARM template to deploy. + :paramtype packaged_content: JSON + """ + super().__init__(etag=etag, **kwargs) + self.content_id = content_id + self.content_product_id = content_product_id + self.package_version = package_version + self.version = version + self.display_name = display_name + self.content_kind = content_kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + self.package_id = package_id + self.package_kind = package_kind + self.package_name = package_name + self.is_deprecated = None + self.packaged_content = packaged_content + + +class TemplateBaseProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Template property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :vartype content_product_id: str + :ivar package_version: Version of the package. Default and recommended format is numeric (e.g. + 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but + then we cannot guarantee any version checks. + :vartype package_version: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar display_name: The display name of the template. + :vartype display_name: str + :ivar content_kind: The kind of content the template is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the template - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + :ivar package_id: the package Id contains this template. + :vartype package_id: str + :ivar package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :vartype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar package_name: the name of the package contains this template. + :vartype package_name: str + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "account_entity_id": {"readonly": True}, - "command_line": {"readonly": True}, - "creation_time_utc": {"readonly": True}, - "host_entity_id": {"readonly": True}, - "host_logon_session_entity_id": {"readonly": True}, - "image_file_entity_id": {"readonly": True}, - "parent_process_entity_id": {"readonly": True}, - "process_id": {"readonly": True}, + "is_deprecated": {"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"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "account_entity_id": {"key": "properties.accountEntityId", "type": "str"}, - "command_line": {"key": "properties.commandLine", "type": "str"}, - "creation_time_utc": {"key": "properties.creationTimeUtc", "type": "iso-8601"}, - "elevation_token": {"key": "properties.elevationToken", "type": "str"}, - "host_entity_id": {"key": "properties.hostEntityId", "type": "str"}, - "host_logon_session_entity_id": {"key": "properties.hostLogonSessionEntityId", "type": "str"}, - "image_file_entity_id": {"key": "properties.imageFileEntityId", "type": "str"}, - "parent_process_entity_id": {"key": "properties.parentProcessEntityId", "type": "str"}, - "process_id": {"key": "properties.processId", "type": "str"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "package_version": {"key": "packageVersion", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "custom_version": {"key": "customVersion", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "icon": {"key": "icon", "type": "str"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "previewImagesDark", "type": "[str]"}, + "package_id": {"key": "packageId", "type": "str"}, + "package_kind": {"key": "packageKind", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, } - def __init__(self, *, elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs): + def __init__( # pylint: disable=too-many-locals + self, + *, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + package_version: Optional[str] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + content_kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + package_id: Optional[str] = None, + package_kind: Optional[Union[str, "_models.PackageKind"]] = None, + package_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword elevation_token: The elevation token associated with the process. Known values are: - "Default", "Full", and "Limited". - :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :paramtype content_product_id: str + :keyword package_version: Version of the package. Default and recommended format is numeric + (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, + but then we cannot guarantee any version checks. + :paramtype package_version: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword display_name: The display name of the template. + :paramtype display_name: str + :keyword content_kind: The kind of content the template is for. Known values are: + "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the template - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + :keyword package_id: the package Id contains this template. + :paramtype package_id: str + :keyword package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :paramtype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword package_name: the name of the package contains this template. + :paramtype package_name: str """ super().__init__(**kwargs) - self.kind: str = "Process" - self.additional_data = None - self.friendly_name = None - self.account_entity_id = None - self.command_line = None - self.creation_time_utc = None - self.elevation_token = elevation_token - self.host_entity_id = None - self.host_logon_session_entity_id = None - self.image_file_entity_id = None - self.parent_process_entity_id = None - self.process_id = None + self.content_id = content_id + self.content_product_id = content_product_id + self.package_version = package_version + self.version = version + self.display_name = display_name + self.content_kind = content_kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + self.package_id = package_id + self.package_kind = package_kind + self.package_name = package_name + self.is_deprecated = None -class ProcessEntityProperties(EntityCommonProperties): # pylint: disable=too-many-instance-attributes - """Process entity property bag. +class ProductTemplateProperties( + TemplateBaseProperties, ProductTemplateAdditionalProperties +): # pylint: disable=too-many-instance-attributes + """Template property bag. Variables are only populated by the server, and will be ignored when sending a request. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar account_entity_id: The account entity id running the processes. - :vartype account_entity_id: str - :ivar command_line: The command line used to create the process. - :vartype command_line: str - :ivar creation_time_utc: The time when the process started to run. - :vartype creation_time_utc: ~datetime.datetime - :ivar elevation_token: The elevation token associated with the process. Known values are: - "Default", "Full", and "Limited". - :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken - :ivar host_entity_id: The host entity id on which the process was running. - :vartype host_entity_id: str - :ivar host_logon_session_entity_id: The session entity id in which the process was running. - :vartype host_logon_session_entity_id: str - :ivar image_file_entity_id: Image file entity id. - :vartype image_file_entity_id: str - :ivar parent_process_entity_id: The parent process entity id. - :vartype parent_process_entity_id: str - :ivar process_id: The process ID. - :vartype process_id: str + :ivar packaged_content: The json of the ARM template to deploy. + :vartype packaged_content: JSON + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :vartype content_product_id: str + :ivar package_version: Version of the package. Default and recommended format is numeric (e.g. + 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but + then we cannot guarantee any version checks. + :vartype package_version: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar display_name: The display name of the template. + :vartype display_name: str + :ivar content_kind: The kind of content the template is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the template - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + :ivar package_id: the package Id contains this template. + :vartype package_id: str + :ivar package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :vartype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar package_name: the name of the package contains this template. + :vartype package_name: str + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag """ - _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "account_entity_id": {"readonly": True}, - "command_line": {"readonly": True}, - "creation_time_utc": {"readonly": True}, - "host_entity_id": {"readonly": True}, - "host_logon_session_entity_id": {"readonly": True}, - "image_file_entity_id": {"readonly": True}, - "parent_process_entity_id": {"readonly": True}, - "process_id": {"readonly": True}, - } - - _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "account_entity_id": {"key": "accountEntityId", "type": "str"}, - "command_line": {"key": "commandLine", "type": "str"}, - "creation_time_utc": {"key": "creationTimeUtc", "type": "iso-8601"}, - "elevation_token": {"key": "elevationToken", "type": "str"}, - "host_entity_id": {"key": "hostEntityId", "type": "str"}, - "host_logon_session_entity_id": {"key": "hostLogonSessionEntityId", "type": "str"}, - "image_file_entity_id": {"key": "imageFileEntityId", "type": "str"}, - "parent_process_entity_id": {"key": "parentProcessEntityId", "type": "str"}, - "process_id": {"key": "processId", "type": "str"}, + _validation = { + "is_deprecated": {"readonly": True}, } - def __init__(self, *, elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs): - """ - :keyword elevation_token: The elevation token associated with the process. Known values are: - "Default", "Full", and "Limited". - :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken + _attribute_map = { + "packaged_content": {"key": "packagedContent", "type": "object"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "package_version": {"key": "packageVersion", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "custom_version": {"key": "customVersion", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "icon": {"key": "icon", "type": "str"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "previewImagesDark", "type": "[str]"}, + "package_id": {"key": "packageId", "type": "str"}, + "package_kind": {"key": "packageKind", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + packaged_content: Optional[JSON] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + package_version: Optional[str] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + content_kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + package_id: Optional[str] = None, + package_kind: Optional[Union[str, "_models.PackageKind"]] = None, + package_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword packaged_content: The json of the ARM template to deploy. + :paramtype packaged_content: JSON + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :paramtype content_product_id: str + :keyword package_version: Version of the package. Default and recommended format is numeric + (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, + but then we cannot guarantee any version checks. + :paramtype package_version: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword display_name: The display name of the template. + :paramtype display_name: str + :keyword content_kind: The kind of content the template is for. Known values are: + "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the template - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + :keyword package_id: the package Id contains this template. + :paramtype package_id: str + :keyword package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :paramtype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword package_name: the name of the package contains this template. + :paramtype package_name: str """ - super().__init__(**kwargs) - self.account_entity_id = None - self.command_line = None - self.creation_time_utc = None - self.elevation_token = elevation_token - self.host_entity_id = None - self.host_logon_session_entity_id = None - self.image_file_entity_id = None - self.parent_process_entity_id = None - self.process_id = None + super().__init__( + content_id=content_id, + content_product_id=content_product_id, + package_version=package_version, + version=version, + display_name=display_name, + content_kind=content_kind, + source=source, + author=author, + support=support, + dependencies=dependencies, + categories=categories, + providers=providers, + first_publish_date=first_publish_date, + last_publish_date=last_publish_date, + custom_version=custom_version, + content_schema_version=content_schema_version, + icon=icon, + threat_analysis_tactics=threat_analysis_tactics, + threat_analysis_techniques=threat_analysis_techniques, + preview_images=preview_images, + preview_images_dark=preview_images_dark, + package_id=package_id, + package_kind=package_kind, + package_name=package_name, + packaged_content=packaged_content, + **kwargs + ) + self.packaged_content = packaged_content + self.content_id = content_id + self.content_product_id = content_product_id + self.package_version = package_version + self.version = version + self.display_name = display_name + self.content_kind = content_kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + self.package_id = package_id + self.package_kind = package_kind + self.package_name = package_name + self.is_deprecated = None class PropertyArrayChangedConditionProperties(AutomationRuleCondition): @@ -17919,8 +22110,8 @@ def __init__( self, *, condition_properties: Optional["_models.AutomationRulePropertyArrayChangedValuesCondition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword condition_properties: :paramtype condition_properties: @@ -17954,8 +22145,11 @@ class PropertyArrayConditionProperties(AutomationRuleCondition): } def __init__( - self, *, condition_properties: Optional["_models.AutomationRulePropertyArrayValuesCondition"] = None, **kwargs - ): + self, + *, + condition_properties: Optional["_models.AutomationRulePropertyArrayValuesCondition"] = None, + **kwargs: Any + ) -> None: """ :keyword condition_properties: :paramtype condition_properties: @@ -17989,8 +22183,11 @@ class PropertyChangedConditionProperties(AutomationRuleCondition): } def __init__( - self, *, condition_properties: Optional["_models.AutomationRulePropertyValuesChangedCondition"] = None, **kwargs - ): + self, + *, + condition_properties: Optional["_models.AutomationRulePropertyValuesChangedCondition"] = None, + **kwargs: Any + ) -> None: """ :keyword condition_properties: :paramtype condition_properties: @@ -18024,8 +22221,8 @@ class PropertyConditionProperties(AutomationRuleCondition): } def __init__( - self, *, condition_properties: Optional["_models.AutomationRulePropertyValuesCondition"] = None, **kwargs - ): + self, *, condition_properties: Optional["_models.AutomationRulePropertyValuesCondition"] = None, **kwargs: Any + ) -> None: """ :keyword condition_properties: :paramtype condition_properties: @@ -18036,6 +22233,35 @@ def __init__( self.condition_properties = condition_properties +class PullRequest(_serialization.Model): + """Information regarding pull request for protected branches. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar url: URL of pull request. + :vartype url: str + :ivar state: State of the pull request. Known values are: "Active", "Disabled", + "CompletedByUser", "CompletedByAction", and "Hidden". + :vartype state: str or ~azure.mgmt.securityinsight.models.State + """ + + _validation = { + "url": {"readonly": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.url = None + self.state = None + + class Recommendation(_serialization.Model): # pylint: disable=too-many-instance-attributes """Recommendation object. @@ -18148,8 +22374,8 @@ def __init__( hide_until_time_utc: Optional[datetime.datetime] = None, display_until_time_utc: Optional[datetime.datetime] = None, visible: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: id of recommendation. Required. :paramtype id: str @@ -18230,7 +22456,7 @@ class RecommendationList(_serialization.Model): "value": {"key": "value", "type": "[Recommendation]"}, } - def __init__(self, *, value: Optional[List["_models.Recommendation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Recommendation"]] = None, **kwargs: Any) -> None: """ :keyword value: An list of recommendations. :paramtype value: list[~azure.mgmt.securityinsight.models.Recommendation] @@ -18260,8 +22486,8 @@ def __init__( *, state: Optional[Union[str, "_models.State"]] = None, hide_until_time_utc: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: State of the recommendation. Known values are: "Active", "Disabled", "CompletedByUser", "CompletedByAction", and "Hidden". @@ -18300,8 +22526,8 @@ class RecommendedAction(_serialization.Model): } def __init__( - self, *, link_text: str, link_url: str, state: Optional[Union[str, "_models.Priority"]] = None, **kwargs - ): + self, *, link_text: str, link_url: str, state: Optional[Union[str, "_models.Priority"]] = None, **kwargs: Any + ) -> None: """ :keyword link_text: Text of the link to complete the action. Required. :paramtype link_text: str @@ -18338,7 +22564,7 @@ class RegistryKeyEntity(Entity): "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -18378,7 +22604,7 @@ class RegistryKeyEntity(Entity): "key": {"key": "properties.key", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "RegistryKey" @@ -18422,7 +22648,7 @@ class RegistryKeyEntityProperties(EntityCommonProperties): "key": {"key": "key", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.hive = None @@ -18451,7 +22677,7 @@ class RegistryValueEntity(Entity): # pylint: disable=too-many-instance-attribut "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -18498,7 +22724,7 @@ class RegistryValueEntity(Entity): # pylint: disable=too-many-instance-attribut "value_type": {"key": "properties.valueType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "RegistryValue" @@ -18551,7 +22777,7 @@ class RegistryValueEntityProperties(EntityCommonProperties): "value_type": {"key": "valueType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.key_entity_id = None @@ -18610,7 +22836,7 @@ class Relation(ResourceWithEtag): "related_resource_kind": {"key": "properties.relatedResourceKind", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, related_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, related_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -18647,7 +22873,7 @@ class RelationList(_serialization.Model): "value": {"key": "value", "type": "[Relation]"}, } - def __init__(self, *, value: List["_models.Relation"], **kwargs): + def __init__(self, *, value: List["_models.Relation"], **kwargs: Any) -> None: """ :keyword value: Array of relations. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.Relation] @@ -18664,6 +22890,8 @@ class Repo(_serialization.Model): :vartype url: str :ivar full_name: The name of the repository. :vartype full_name: str + :ivar installation_id: The installation id of the repository. + :vartype installation_id: int :ivar branches: Array of branches. :vartype branches: list[str] """ @@ -18671,6 +22899,7 @@ class Repo(_serialization.Model): _attribute_map = { "url": {"key": "url", "type": "str"}, "full_name": {"key": "fullName", "type": "str"}, + "installation_id": {"key": "installationId", "type": "int"}, "branches": {"key": "branches", "type": "[str]"}, } @@ -18679,20 +22908,24 @@ def __init__( *, url: Optional[str] = None, full_name: Optional[str] = None, + installation_id: Optional[int] = None, branches: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword url: The url to access the repository. :paramtype url: str :keyword full_name: The name of the repository. :paramtype full_name: str + :keyword installation_id: The installation id of the repository. + :paramtype installation_id: int :keyword branches: Array of branches. :paramtype branches: list[str] """ super().__init__(**kwargs) self.url = url self.full_name = full_name + self.installation_id = installation_id self.branches = branches @@ -18719,7 +22952,7 @@ class RepoList(_serialization.Model): "value": {"key": "value", "type": "[Repo]"}, } - def __init__(self, *, value: List["_models.Repo"], **kwargs): + def __init__(self, *, value: List["_models.Repo"], **kwargs: Any) -> None: """ :keyword value: Array of repositories. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.Repo] @@ -18732,59 +22965,194 @@ def __init__(self, *, value: List["_models.Repo"], **kwargs): class Repository(_serialization.Model): """metadata of a repository. - :ivar url: Url of repository. + 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 url: Url of repository. Required. :vartype url: str - :ivar branch: Branch name of repository. + :ivar branch: Branch name of repository. Required. :vartype branch: str :ivar display_url: Display url of repository. :vartype display_url: str :ivar deployment_logs_url: Url to access repository action logs. :vartype deployment_logs_url: str - :ivar path_mapping: Dictionary of source control content type and path mapping. - :vartype path_mapping: list[~azure.mgmt.securityinsight.models.ContentPathMap] """ + _validation = { + "url": {"required": True}, + "branch": {"required": True}, + "deployment_logs_url": {"readonly": True}, + } + _attribute_map = { "url": {"key": "url", "type": "str"}, "branch": {"key": "branch", "type": "str"}, "display_url": {"key": "displayUrl", "type": "str"}, "deployment_logs_url": {"key": "deploymentLogsUrl", "type": "str"}, - "path_mapping": {"key": "pathMapping", "type": "[ContentPathMap]"}, } - def __init__( - self, - *, - url: Optional[str] = None, - branch: Optional[str] = None, - display_url: Optional[str] = None, - deployment_logs_url: Optional[str] = None, - path_mapping: Optional[List["_models.ContentPathMap"]] = None, - **kwargs - ): + def __init__(self, *, url: str, branch: str, display_url: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword url: Url of repository. + :keyword url: Url of repository. Required. :paramtype url: str - :keyword branch: Branch name of repository. + :keyword branch: Branch name of repository. Required. :paramtype branch: str :keyword display_url: Display url of repository. :paramtype display_url: str - :keyword deployment_logs_url: Url to access repository action logs. - :paramtype deployment_logs_url: str - :keyword path_mapping: Dictionary of source control content type and path mapping. - :paramtype path_mapping: list[~azure.mgmt.securityinsight.models.ContentPathMap] """ super().__init__(**kwargs) self.url = url self.branch = branch self.display_url = display_url - self.deployment_logs_url = deployment_logs_url - self.path_mapping = path_mapping + self.deployment_logs_url = None + + +class RepositoryAccess(_serialization.Model): + """Credentials to access repository. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: The kind of repository access credentials. Required. Known values are: "OAuth", + "PAT", and "App". + :vartype kind: str or ~azure.mgmt.securityinsight.models.RepositoryAccessKind + :ivar code: OAuth Code. Required when ``kind`` is ``OAuth``. + :vartype code: str + :ivar state: OAuth State. Required when ``kind`` is ``OAuth``. + :vartype state: str + :ivar client_id: OAuth ClientId. Required when ``kind`` is ``OAuth``. + :vartype client_id: str + :ivar token: Personal Access Token. Required when ``kind`` is ``PAT``. + :vartype token: str + :ivar installation_id: Application installation ID. Required when ``kind`` is ``App``. + Supported by ``GitHub`` only. + :vartype installation_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "token": {"key": "token", "type": "str"}, + "installation_id": {"key": "installationId", "type": "str"}, + } + + def __init__( + self, + *, + kind: Union[str, "_models.RepositoryAccessKind"], + code: Optional[str] = None, + state: Optional[str] = None, + client_id: Optional[str] = None, + token: Optional[str] = None, + installation_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of repository access credentials. Required. Known values are: "OAuth", + "PAT", and "App". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.RepositoryAccessKind + :keyword code: OAuth Code. Required when ``kind`` is ``OAuth``. + :paramtype code: str + :keyword state: OAuth State. Required when ``kind`` is ``OAuth``. + :paramtype state: str + :keyword client_id: OAuth ClientId. Required when ``kind`` is ``OAuth``. + :paramtype client_id: str + :keyword token: Personal Access Token. Required when ``kind`` is ``PAT``. + :paramtype token: str + :keyword installation_id: Application installation ID. Required when ``kind`` is ``App``. + Supported by ``GitHub`` only. + :paramtype installation_id: str + """ + super().__init__(**kwargs) + self.kind = kind + self.code = code + self.state = state + self.client_id = client_id + self.token = token + self.installation_id = installation_id + + +class RepositoryAccessProperties(_serialization.Model): + """Credentials to access repository. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: The kind of repository access credentials. Required. Known values are: "OAuth", + "PAT", and "App". + :vartype kind: str or ~azure.mgmt.securityinsight.models.RepositoryAccessKind + :ivar code: OAuth Code. Required when ``kind`` is ``OAuth``. + :vartype code: str + :ivar state: OAuth State. Required when ``kind`` is ``OAuth``. + :vartype state: str + :ivar client_id: OAuth ClientId. Required when ``kind`` is ``OAuth``. + :vartype client_id: str + :ivar token: Personal Access Token. Required when ``kind`` is ``PAT``. + :vartype token: str + :ivar installation_id: Application installation ID. Required when ``kind`` is ``App``. + Supported by ``GitHub`` only. + :vartype installation_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "properties.repositoryAccess.kind", "type": "str"}, + "code": {"key": "properties.repositoryAccess.code", "type": "str"}, + "state": {"key": "properties.repositoryAccess.state", "type": "str"}, + "client_id": {"key": "properties.repositoryAccess.clientId", "type": "str"}, + "token": {"key": "properties.repositoryAccess.token", "type": "str"}, + "installation_id": {"key": "properties.repositoryAccess.installationId", "type": "str"}, + } + + def __init__( + self, + *, + kind: Union[str, "_models.RepositoryAccessKind"], + code: Optional[str] = None, + state: Optional[str] = None, + client_id: Optional[str] = None, + token: Optional[str] = None, + installation_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of repository access credentials. Required. Known values are: "OAuth", + "PAT", and "App". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.RepositoryAccessKind + :keyword code: OAuth Code. Required when ``kind`` is ``OAuth``. + :paramtype code: str + :keyword state: OAuth State. Required when ``kind`` is ``OAuth``. + :paramtype state: str + :keyword client_id: OAuth ClientId. Required when ``kind`` is ``OAuth``. + :paramtype client_id: str + :keyword token: Personal Access Token. Required when ``kind`` is ``PAT``. + :paramtype token: str + :keyword installation_id: Application installation ID. Required when ``kind`` is ``App``. + Supported by ``GitHub`` only. + :paramtype installation_id: str + """ + super().__init__(**kwargs) + self.kind = kind + self.code = code + self.state = state + self.client_id = client_id + self.token = token + self.installation_id = installation_id class RepositoryResourceInfo(_serialization.Model): """Resources created in user's repository for the source-control. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar webhook: The webhook object created for the source-control. :vartype webhook: ~azure.mgmt.securityinsight.models.Webhook :ivar git_hub_resource_info: Resources created in GitHub for this source-control. @@ -18794,34 +23162,26 @@ class RepositoryResourceInfo(_serialization.Model): ~azure.mgmt.securityinsight.models.AzureDevOpsResourceInfo """ + _validation = { + "git_hub_resource_info": {"readonly": True}, + "azure_dev_ops_resource_info": {"readonly": True}, + } + _attribute_map = { "webhook": {"key": "webhook", "type": "Webhook"}, "git_hub_resource_info": {"key": "gitHubResourceInfo", "type": "GitHubResourceInfo"}, "azure_dev_ops_resource_info": {"key": "azureDevOpsResourceInfo", "type": "AzureDevOpsResourceInfo"}, } - def __init__( - self, - *, - webhook: Optional["_models.Webhook"] = None, - git_hub_resource_info: Optional["_models.GitHubResourceInfo"] = None, - azure_dev_ops_resource_info: Optional["_models.AzureDevOpsResourceInfo"] = None, - **kwargs - ): + def __init__(self, *, webhook: Optional["_models.Webhook"] = None, **kwargs: Any) -> None: """ :keyword webhook: The webhook object created for the source-control. :paramtype webhook: ~azure.mgmt.securityinsight.models.Webhook - :keyword git_hub_resource_info: Resources created in GitHub for this source-control. - :paramtype git_hub_resource_info: ~azure.mgmt.securityinsight.models.GitHubResourceInfo - :keyword azure_dev_ops_resource_info: Resources created in Azure DevOps for this - source-control. - :paramtype azure_dev_ops_resource_info: - ~azure.mgmt.securityinsight.models.AzureDevOpsResourceInfo """ super().__init__(**kwargs) self.webhook = webhook - self.git_hub_resource_info = git_hub_resource_info - self.azure_dev_ops_resource_info = azure_dev_ops_resource_info + self.git_hub_resource_info = None + self.azure_dev_ops_resource_info = None class RequiredPermissions(_serialization.Model): @@ -18833,41 +23193,180 @@ class RequiredPermissions(_serialization.Model): :vartype write: bool :ivar read: read permission. :vartype read: bool - :ivar delete: delete permission. + :ivar delete: delete permission. + :vartype delete: bool + """ + + _attribute_map = { + "action": {"key": "action", "type": "bool"}, + "write": {"key": "write", "type": "bool"}, + "read": {"key": "read", "type": "bool"}, + "delete": {"key": "delete", "type": "bool"}, + } + + def __init__( + self, + *, + action: Optional[bool] = None, + write: Optional[bool] = None, + read: Optional[bool] = None, + delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword action: action permission. + :paramtype action: bool + :keyword write: write permission. + :paramtype write: bool + :keyword read: read permission. + :paramtype read: bool + :keyword delete: delete permission. + :paramtype delete: bool + """ + super().__init__(**kwargs) + self.action = action + self.write = write + self.read = read + self.delete = delete + + +class ResourceProviderRequiredPermissions(_serialization.Model): + """Required permissions for the connector resource provider that define in ResourceProviders. + For more information about the permissions see :code:`here`. + + :ivar read: Gets or sets a value indicating whether the permission is read action (GET). + :vartype read: bool + :ivar write: Gets or sets a value indicating whether the permission is write action (PUT or + PATCH). + :vartype write: bool + :ivar delete: Gets or sets a value indicating whether the permission is delete action (DELETE). :vartype delete: bool + :ivar action: Gets or sets a value indicating whether the permission is custom actions (POST). + :vartype action: bool """ _attribute_map = { - "action": {"key": "action", "type": "bool"}, - "write": {"key": "write", "type": "bool"}, "read": {"key": "read", "type": "bool"}, + "write": {"key": "write", "type": "bool"}, "delete": {"key": "delete", "type": "bool"}, + "action": {"key": "action", "type": "bool"}, } def __init__( self, *, - action: Optional[bool] = None, - write: Optional[bool] = None, read: Optional[bool] = None, + write: Optional[bool] = None, delete: Optional[bool] = None, - **kwargs - ): + action: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword action: action permission. - :paramtype action: bool - :keyword write: write permission. - :paramtype write: bool - :keyword read: read permission. + :keyword read: Gets or sets a value indicating whether the permission is read action (GET). :paramtype read: bool - :keyword delete: delete permission. + :keyword write: Gets or sets a value indicating whether the permission is write action (PUT or + PATCH). + :paramtype write: bool + :keyword delete: Gets or sets a value indicating whether the permission is delete action + (DELETE). :paramtype delete: bool + :keyword action: Gets or sets a value indicating whether the permission is custom actions + (POST). + :paramtype action: bool """ super().__init__(**kwargs) - self.action = action - self.write = write self.read = read + self.write = write self.delete = delete + self.action = action + + +class SampleQuery(_serialization.Model): + """The sample queries for the connector. + + All required parameters must be populated in order to send to Azure. + + :ivar description: Gets or sets the sample query description. Required. + :vartype description: str + :ivar query: Gets or sets the KQL sample query. Required. + :vartype query: str + """ + + _validation = { + "description": {"required": True}, + "query": {"required": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "query": {"key": "query", "type": "str"}, + } + + def __init__(self, *, description: str, query: str, **kwargs: Any) -> None: + """ + :keyword description: Gets or sets the sample query description. Required. + :paramtype description: str + :keyword query: Gets or sets the KQL sample query. Required. + :paramtype query: str + """ + super().__init__(**kwargs) + self.description = description + self.query = query + + +class SapSolutionUsageStatistic(BillingStatistic): + """Billing statistic about the Microsoft Sentinel solution for SAP Usage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar kind: The kind of the billing statistic. Required. "SapSolutionUsage" + :vartype kind: str or ~azure.mgmt.securityinsight.models.BillingStatisticKind + :ivar active_system_id_count: The latest count of active SAP system IDs under the Microsoft + Sentinel solution for SAP Usage. + :vartype active_system_id_count: int + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"readonly": True}, + "kind": {"required": True}, + "active_system_id_count": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "active_system_id_count": {"key": "properties.activeSystemIdCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "SapSolutionUsage" + self.active_system_id_count = None class ScheduledAlertRule(AlertRule): # pylint: disable=too-many-instance-attributes @@ -18943,6 +23442,8 @@ class ScheduledAlertRule(AlertRule): # pylint: disable=too-many-instance-attrib :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] :ivar incident_configuration: The settings of the incidents that created from alerts triggered by this analytics rule. :vartype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration @@ -18985,6 +23486,7 @@ class ScheduledAlertRule(AlertRule): # pylint: disable=too-many-instance-attrib "suppression_enabled": {"key": "properties.suppressionEnabled", "type": "bool"}, "tactics": {"key": "properties.tactics", "type": "[str]"}, "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, "incident_configuration": {"key": "properties.incidentConfiguration", "type": "IncidentConfiguration"}, } @@ -19012,9 +23514,10 @@ def __init__( # pylint: disable=too-many-locals suppression_enabled: Optional[bool] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, + sub_techniques: Optional[List[str]] = None, incident_configuration: Optional["_models.IncidentConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -19067,6 +23570,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] + :keyword sub_techniques: The sub-techniques of the alert rule. + :paramtype sub_techniques: list[str] :keyword incident_configuration: The settings of the incidents that created from alerts triggered by this analytics rule. :paramtype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration @@ -19094,6 +23599,7 @@ def __init__( # pylint: disable=too-many-locals self.suppression_enabled = suppression_enabled self.tactics = tactics self.techniques = techniques + self.sub_techniques = sub_techniques self.incident_configuration = incident_configuration @@ -19156,8 +23662,8 @@ def __init__( entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query: The query that creates alerts for this rule. :paramtype query: str @@ -19257,6 +23763,8 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): # pylin :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] :ivar incident_configuration: The settings of the incidents that created from alerts triggered by this analytics rule. :vartype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration @@ -19292,6 +23800,7 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): # pylin "suppression_enabled": {"key": "suppressionEnabled", "type": "bool"}, "tactics": {"key": "tactics", "type": "[str]"}, "techniques": {"key": "techniques", "type": "[str]"}, + "sub_techniques": {"key": "subTechniques", "type": "[str]"}, "incident_configuration": {"key": "incidentConfiguration", "type": "IncidentConfiguration"}, } @@ -19318,9 +23827,10 @@ def __init__( description: Optional[str] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, + sub_techniques: Optional[List[str]] = None, incident_configuration: Optional["_models.IncidentConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword query: The query that creates alerts for this rule. :paramtype query: str @@ -19371,6 +23881,8 @@ def __init__( :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] + :keyword sub_techniques: The sub-techniques of the alert rule. + :paramtype sub_techniques: list[str] :keyword incident_configuration: The settings of the incidents that created from alerts triggered by this analytics rule. :paramtype incident_configuration: ~azure.mgmt.securityinsight.models.IncidentConfiguration @@ -19399,6 +23911,7 @@ def __init__( self.suppression_enabled = suppression_enabled self.tactics = tactics self.techniques = techniques + self.sub_techniques = sub_techniques self.incident_configuration = incident_configuration @@ -19459,6 +23972,8 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] :ivar version: The version of this template - in format , where all are numbers. For example <1.0.2>. :vartype version: str @@ -19510,6 +24025,7 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many "trigger_threshold": {"key": "properties.triggerThreshold", "type": "int"}, "tactics": {"key": "properties.tactics", "type": "[str]"}, "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, "version": {"key": "properties.version", "type": "str"}, "event_grouping_settings": {"key": "properties.eventGroupingSettings", "type": "EventGroupingSettings"}, "custom_details": {"key": "properties.customDetails", "type": "{str}"}, @@ -19534,14 +24050,15 @@ def __init__( # pylint: disable=too-many-locals trigger_threshold: Optional[int] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, + sub_techniques: Optional[List[str]] = None, version: Optional[str] = None, event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, custom_details: Optional[Dict[str, str]] = None, entity_mappings: Optional[List["_models.EntityMapping"]] = None, alert_details_override: Optional["_models.AlertDetailsOverride"] = None, sentinel_entities_mappings: Optional[List["_models.SentinelEntityMapping"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -19575,6 +24092,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] + :keyword sub_techniques: The sub-techniques of the alert rule. + :paramtype sub_techniques: list[str] :keyword version: The version of this template - in format , where all are numbers. For example <1.0.2>. :paramtype version: str @@ -19608,6 +24127,7 @@ def __init__( # pylint: disable=too-many-locals self.trigger_threshold = trigger_threshold self.tactics = tactics self.techniques = techniques + self.sub_techniques = sub_techniques self.version = version self.event_grouping_settings = event_grouping_settings self.custom_details = custom_details @@ -19638,7 +24158,7 @@ class SecurityAlert(Entity): # pylint: disable=too-many-instance-attributes "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -19784,8 +24304,8 @@ class SecurityAlert(Entity): # pylint: disable=too-many-instance-attributes } def __init__( # pylint: disable=too-many-locals - self, *, severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs - ): + self, *, severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs: Any + ) -> None: """ :keyword severity: The severity of the alert. Known values are: "High", "Medium", "Low", and "Informational". @@ -19959,8 +24479,8 @@ class SecurityAlertProperties(EntityCommonProperties): # pylint: disable=too-ma } def __init__( # pylint: disable=too-many-locals - self, *, severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs - ): + self, *, severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs: Any + ) -> None: """ :keyword severity: The severity of the alert. Known values are: "High", "Medium", "Low", and "Informational". @@ -20015,7 +24535,7 @@ class SecurityAlertPropertiesConfidenceReasonsItem(_serialization.Model): "reason_type": {"key": "reasonType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.reason = None @@ -20100,8 +24620,8 @@ def __init__( product_name: Optional[str] = None, description: Optional[str] = None, techniques: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_resource_id: The alert azure resource id. Required. :paramtype azure_resource_id: str @@ -20162,7 +24682,7 @@ class SecurityGroupEntity(Entity): "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -20205,7 +24725,7 @@ class SecurityGroupEntity(Entity): "sid": {"key": "properties.sid", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "SecurityGroup" @@ -20253,7 +24773,7 @@ class SecurityGroupEntityProperties(EntityCommonProperties): "sid": {"key": "sid", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.distinguished_name = None @@ -20275,7 +24795,9 @@ class SecurityMLAnalyticsSettingsDataSource(_serialization.Model): "data_types": {"key": "dataTypes", "type": "[str]"}, } - def __init__(self, *, connector_id: Optional[str] = None, data_types: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, connector_id: Optional[str] = None, data_types: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword connector_id: The connector id that provides the following data types. :paramtype connector_id: str @@ -20310,7 +24832,7 @@ class SecurityMLAnalyticsSettingsList(_serialization.Model): "value": {"key": "value", "type": "[SecurityMLAnalyticsSetting]"}, } - def __init__(self, *, value: List["_models.SecurityMLAnalyticsSetting"], **kwargs): + def __init__(self, *, value: List["_models.SecurityMLAnalyticsSetting"], **kwargs: Any) -> None: """ :keyword value: Array of SecurityMLAnalyticsSettings. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting] @@ -20331,7 +24853,7 @@ class SentinelEntityMapping(_serialization.Model): "column_name": {"key": "columnName", "type": "str"}, } - def __init__(self, *, column_name: Optional[str] = None, **kwargs): + def __init__(self, *, column_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword column_name: the column name to be mapped to the SentinelEntities. :paramtype column_name: str @@ -20378,7 +24900,9 @@ class SentinelOnboardingState(ResourceWithEtag): "customer_managed_key": {"key": "properties.customerManagedKey", "type": "bool"}, } - def __init__(self, *, etag: Optional[str] = None, customer_managed_key: Optional[bool] = None, **kwargs): + def __init__( + self, *, etag: Optional[str] = None, customer_managed_key: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -20406,7 +24930,7 @@ class SentinelOnboardingStatesList(_serialization.Model): "value": {"key": "value", "type": "[SentinelOnboardingState]"}, } - def __init__(self, *, value: List["_models.SentinelOnboardingState"], **kwargs): + def __init__(self, *, value: List["_models.SentinelOnboardingState"], **kwargs: Any) -> None: """ :keyword value: Array of Sentinel onboarding states. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.SentinelOnboardingState] @@ -20415,6 +24939,46 @@ def __init__(self, *, value: List["_models.SentinelOnboardingState"], **kwargs): self.value = value +class ServicePrincipal(_serialization.Model): + """Service principal metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id of service principal. + :vartype id: str + :ivar tenant_id: Tenant id of service principal. + :vartype tenant_id: str + :ivar app_id: App id of service principal. + :vartype app_id: str + :ivar credentials_expire_on: Expiration time of service principal credentials. + :vartype credentials_expire_on: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "app_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "app_id": {"key": "appId", "type": "str"}, + "credentials_expire_on": {"key": "credentialsExpireOn", "type": "iso-8601"}, + } + + def __init__(self, *, credentials_expire_on: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword credentials_expire_on: Expiration time of service principal credentials. + :paramtype credentials_expire_on: ~datetime.datetime + """ + super().__init__(**kwargs) + self.id = None + self.tenant_id = None + self.app_id = None + self.credentials_expire_on = credentials_expire_on + + class SettingList(_serialization.Model): """List of all the settings. @@ -20432,7 +24996,7 @@ class SettingList(_serialization.Model): "value": {"key": "value", "type": "[Settings]"}, } - def __init__(self, *, value: List["_models.Settings"], **kwargs): + def __init__(self, *, value: List["_models.Settings"], **kwargs: Any) -> None: """ :keyword value: Array of settings. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.Settings] @@ -20446,6 +25010,8 @@ class SourceControl(ResourceWithEtag): # pylint: disable=too-many-instance-attr 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 @@ -20464,22 +25030,29 @@ class SourceControl(ResourceWithEtag): # pylint: disable=too-many-instance-attr :ivar version: The version number associated with the source control. Known values are: "V1" and "V2". :vartype version: str or ~azure.mgmt.securityinsight.models.Version - :ivar display_name: The display name of the source control. + :ivar display_name: The display name of the source control. Required. :vartype display_name: str :ivar description: A description of the source control. :vartype description: str - :ivar repo_type: The repository type of the source control. Known values are: "Github" and - "DevOps". + :ivar repo_type: The repository type of the source control. Required. Known values are: + "Github" and "AzureDevOps". :vartype repo_type: str or ~azure.mgmt.securityinsight.models.RepoType - :ivar content_types: Array of source control content types. + :ivar content_types: Array of source control content types. Required. :vartype content_types: list[str or ~azure.mgmt.securityinsight.models.ContentType] - :ivar repository: Repository metadata. + :ivar repository: Repository metadata. Required. :vartype repository: ~azure.mgmt.securityinsight.models.Repository + :ivar service_principal: Service principal metadata. + :vartype service_principal: ~azure.mgmt.securityinsight.models.ServicePrincipal + :ivar repository_access: Repository access credentials. This is write-only object and it never + returns back to a user. + :vartype repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccess :ivar repository_resource_info: Information regarding the resources created in user's repository. :vartype repository_resource_info: ~azure.mgmt.securityinsight.models.RepositoryResourceInfo :ivar last_deployment_info: Information regarding the latest deployment for the source control. :vartype last_deployment_info: ~azure.mgmt.securityinsight.models.DeploymentInfo + :ivar pull_request: Information regarding the pull request of the source control. + :vartype pull_request: ~azure.mgmt.securityinsight.models.PullRequest """ _validation = { @@ -20487,6 +25060,14 @@ class SourceControl(ResourceWithEtag): # pylint: disable=too-many-instance-attr "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "id_properties_id": {"readonly": True}, + "version": {"readonly": True}, + "display_name": {"required": True}, + "repo_type": {"required": True}, + "content_types": {"required": True}, + "repository": {"required": True}, + "last_deployment_info": {"readonly": True}, + "pull_request": {"readonly": True}, } _attribute_map = { @@ -20502,61 +25083,63 @@ class SourceControl(ResourceWithEtag): # pylint: disable=too-many-instance-attr "repo_type": {"key": "properties.repoType", "type": "str"}, "content_types": {"key": "properties.contentTypes", "type": "[str]"}, "repository": {"key": "properties.repository", "type": "Repository"}, + "service_principal": {"key": "properties.servicePrincipal", "type": "ServicePrincipal"}, + "repository_access": {"key": "properties.repositoryAccess", "type": "RepositoryAccess"}, "repository_resource_info": {"key": "properties.repositoryResourceInfo", "type": "RepositoryResourceInfo"}, "last_deployment_info": {"key": "properties.lastDeploymentInfo", "type": "DeploymentInfo"}, + "pull_request": {"key": "properties.pullRequest", "type": "PullRequest"}, } def __init__( self, *, + display_name: str, + repo_type: Union[str, "_models.RepoType"], + content_types: List[Union[str, "_models.ContentType"]], + repository: "_models.Repository", etag: Optional[str] = None, - id_properties_id: Optional[str] = None, - version: Optional[Union[str, "_models.Version"]] = None, - display_name: Optional[str] = None, description: Optional[str] = None, - repo_type: Optional[Union[str, "_models.RepoType"]] = None, - content_types: Optional[List[Union[str, "_models.ContentType"]]] = None, - repository: Optional["_models.Repository"] = None, + service_principal: Optional["_models.ServicePrincipal"] = None, + repository_access: Optional["_models.RepositoryAccess"] = None, repository_resource_info: Optional["_models.RepositoryResourceInfo"] = None, - last_deployment_info: Optional["_models.DeploymentInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword id_properties_id: The id (a Guid) of the source control. - :paramtype id_properties_id: str - :keyword version: The version number associated with the source control. Known values are: "V1" - and "V2". - :paramtype version: str or ~azure.mgmt.securityinsight.models.Version - :keyword display_name: The display name of the source control. + :keyword display_name: The display name of the source control. Required. :paramtype display_name: str :keyword description: A description of the source control. :paramtype description: str - :keyword repo_type: The repository type of the source control. Known values are: "Github" and - "DevOps". + :keyword repo_type: The repository type of the source control. Required. Known values are: + "Github" and "AzureDevOps". :paramtype repo_type: str or ~azure.mgmt.securityinsight.models.RepoType - :keyword content_types: Array of source control content types. + :keyword content_types: Array of source control content types. Required. :paramtype content_types: list[str or ~azure.mgmt.securityinsight.models.ContentType] - :keyword repository: Repository metadata. + :keyword repository: Repository metadata. Required. :paramtype repository: ~azure.mgmt.securityinsight.models.Repository + :keyword service_principal: Service principal metadata. + :paramtype service_principal: ~azure.mgmt.securityinsight.models.ServicePrincipal + :keyword repository_access: Repository access credentials. This is write-only object and it + never returns back to a user. + :paramtype repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccess :keyword repository_resource_info: Information regarding the resources created in user's repository. :paramtype repository_resource_info: ~azure.mgmt.securityinsight.models.RepositoryResourceInfo - :keyword last_deployment_info: Information regarding the latest deployment for the source - control. - :paramtype last_deployment_info: ~azure.mgmt.securityinsight.models.DeploymentInfo """ super().__init__(etag=etag, **kwargs) - self.id_properties_id = id_properties_id - self.version = version + self.id_properties_id = None + self.version = None self.display_name = display_name self.description = description self.repo_type = repo_type self.content_types = content_types self.repository = repository + self.service_principal = service_principal + self.repository_access = repository_access self.repository_resource_info = repository_resource_info - self.last_deployment_info = last_deployment_info + self.last_deployment_info = None + self.pull_request = None class SourceControlList(_serialization.Model): @@ -20582,7 +25165,7 @@ class SourceControlList(_serialization.Model): "value": {"key": "value", "type": "[SourceControl]"}, } - def __init__(self, *, value: List["_models.SourceControl"], **kwargs): + def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: """ :keyword value: Array of source controls. Required. :paramtype value: list[~azure.mgmt.securityinsight.models.SourceControl] @@ -20614,7 +25197,7 @@ class SubmissionMailEntity(Entity): # pylint: disable=too-many-instance-attribu "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -20684,7 +25267,7 @@ class SubmissionMailEntity(Entity): # pylint: disable=too-many-instance-attribu "report_type": {"key": "properties.reportType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind: str = "SubmissionMail" @@ -20766,7 +25349,7 @@ class SubmissionMailEntityProperties(EntityCommonProperties): # pylint: disable "report_type": {"key": "reportType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.network_message_id = None @@ -20818,8 +25401,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -20837,107 +25420,718 @@ def __init__( :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TeamInformation(_serialization.Model): + """Describes team information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar team_id: Team ID. + :vartype team_id: str + :ivar primary_channel_url: The primary channel URL of the team. + :vartype primary_channel_url: str + :ivar team_creation_time_utc: The time the team was created. + :vartype team_creation_time_utc: ~datetime.datetime + :ivar name: The name of the team. + :vartype name: str + :ivar description: The description of the team. + :vartype description: str + """ + + _validation = { + "team_id": {"readonly": True}, + "primary_channel_url": {"readonly": True}, + "team_creation_time_utc": {"readonly": True}, + "name": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "team_id": {"key": "teamId", "type": "str"}, + "primary_channel_url": {"key": "primaryChannelUrl", "type": "str"}, + "team_creation_time_utc": {"key": "teamCreationTimeUtc", "type": "iso-8601"}, + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.team_id = None + self.primary_channel_url = None + self.team_creation_time_utc = None + self.name = None + self.description = None + + +class TeamProperties(_serialization.Model): + """Describes team properties. + + All required parameters must be populated in order to send to Azure. + + :ivar team_name: The name of the team. Required. + :vartype team_name: str + :ivar team_description: The description of the team. + :vartype team_description: str + :ivar group_ids: List of group IDs to add their members to the team. + :vartype group_ids: list[str] + :ivar member_ids: List of member IDs to add to the team. + :vartype member_ids: list[str] + """ + + _validation = { + "team_name": {"required": True}, + } + + _attribute_map = { + "team_name": {"key": "teamName", "type": "str"}, + "team_description": {"key": "teamDescription", "type": "str"}, + "group_ids": {"key": "groupIds", "type": "[str]"}, + "member_ids": {"key": "memberIds", "type": "[str]"}, + } + + def __init__( + self, + *, + team_name: str, + team_description: Optional[str] = None, + group_ids: Optional[List[str]] = None, + member_ids: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword team_name: The name of the team. Required. + :paramtype team_name: str + :keyword team_description: The description of the team. + :paramtype team_description: str + :keyword group_ids: List of group IDs to add their members to the team. + :paramtype group_ids: list[str] + :keyword member_ids: List of member IDs to add to the team. + :paramtype member_ids: list[str] + """ + super().__init__(**kwargs) + self.team_name = team_name + self.team_description = team_description + self.group_ids = group_ids + self.member_ids = member_ids + + +class TemplateAdditionalProperties(_serialization.Model): + """additional properties of product template. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar main_template: The JSON of the ARM template to deploy active content. Expandable. + :vartype main_template: JSON + :ivar dependant_templates: Dependant templates. Expandable. + :vartype dependant_templates: list[~azure.mgmt.securityinsight.models.TemplateProperties] + """ + + _validation = { + "dependant_templates": {"readonly": True}, + } + + _attribute_map = { + "main_template": {"key": "mainTemplate", "type": "object"}, + "dependant_templates": {"key": "dependantTemplates", "type": "[TemplateProperties]"}, + } + + def __init__(self, *, main_template: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword main_template: The JSON of the ARM template to deploy active content. Expandable. + :paramtype main_template: JSON + """ + super().__init__(**kwargs) + self.main_template = main_template + self.dependant_templates = None + + +class TemplateList(_serialization.Model): + """List of all the template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Array of templates. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.TemplateModel] + :ivar next_link: URL to fetch the next page of template. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TemplateModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.TemplateModel"], **kwargs: Any) -> None: + """ + :keyword value: Array of templates. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.TemplateModel] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None -class TeamInformation(_serialization.Model): - """Describes team information. +class TemplateModel(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Template resource definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar team_id: Team ID. - :vartype team_id: str - :ivar primary_channel_url: The primary channel URL of the team. - :vartype primary_channel_url: str - :ivar team_creation_time_utc: The time the team was created. - :vartype team_creation_time_utc: ~datetime.datetime - :ivar name: The name of the team. + :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 description: The description of the team. - :vartype description: 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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :vartype content_product_id: str + :ivar package_version: Version of the package. Default and recommended format is numeric (e.g. + 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but + then we cannot guarantee any version checks. + :vartype package_version: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar display_name: The display name of the template. + :vartype display_name: str + :ivar content_kind: The kind of content the template is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the template - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + :ivar package_id: the package Id contains this template. + :vartype package_id: str + :ivar package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :vartype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar package_name: the name of the package contains this template. + :vartype package_name: str + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag + :ivar main_template: The JSON of the ARM template to deploy active content. Expandable. + :vartype main_template: JSON + :ivar dependant_templates: Dependant templates. Expandable. + :vartype dependant_templates: list[~azure.mgmt.securityinsight.models.TemplateProperties] """ _validation = { - "team_id": {"readonly": True}, - "primary_channel_url": {"readonly": True}, - "team_creation_time_utc": {"readonly": True}, + "id": {"readonly": True}, "name": {"readonly": True}, - "description": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "is_deprecated": {"readonly": True}, + "dependant_templates": {"readonly": True}, } _attribute_map = { - "team_id": {"key": "teamId", "type": "str"}, - "primary_channel_url": {"key": "primaryChannelUrl", "type": "str"}, - "team_creation_time_utc": {"key": "teamCreationTimeUtc", "type": "iso-8601"}, + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "content_id": {"key": "properties.contentId", "type": "str"}, + "content_product_id": {"key": "properties.contentProductId", "type": "str"}, + "package_version": {"key": "properties.packageVersion", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "content_kind": {"key": "properties.contentKind", "type": "str"}, + "source": {"key": "properties.source", "type": "MetadataSource"}, + "author": {"key": "properties.author", "type": "MetadataAuthor"}, + "support": {"key": "properties.support", "type": "MetadataSupport"}, + "dependencies": {"key": "properties.dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "properties.categories", "type": "MetadataCategories"}, + "providers": {"key": "properties.providers", "type": "[str]"}, + "first_publish_date": {"key": "properties.firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "properties.lastPublishDate", "type": "date"}, + "custom_version": {"key": "properties.customVersion", "type": "str"}, + "content_schema_version": {"key": "properties.contentSchemaVersion", "type": "str"}, + "icon": {"key": "properties.icon", "type": "str"}, + "threat_analysis_tactics": {"key": "properties.threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "properties.threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "properties.previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "properties.previewImagesDark", "type": "[str]"}, + "package_id": {"key": "properties.packageId", "type": "str"}, + "package_kind": {"key": "properties.packageKind", "type": "str"}, + "package_name": {"key": "properties.packageName", "type": "str"}, + "is_deprecated": {"key": "properties.isDeprecated", "type": "str"}, + "main_template": {"key": "properties.mainTemplate", "type": "object"}, + "dependant_templates": {"key": "properties.dependantTemplates", "type": "[TemplateProperties]"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.team_id = None - self.primary_channel_url = None - self.team_creation_time_utc = None - self.name = None - self.description = None + def __init__( # pylint: disable=too-many-locals + self, + *, + etag: Optional[str] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + package_version: Optional[str] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + content_kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + package_id: Optional[str] = None, + package_kind: Optional[Union[str, "_models.PackageKind"]] = None, + package_name: Optional[str] = None, + main_template: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :paramtype content_product_id: str + :keyword package_version: Version of the package. Default and recommended format is numeric + (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, + but then we cannot guarantee any version checks. + :paramtype package_version: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword display_name: The display name of the template. + :paramtype display_name: str + :keyword content_kind: The kind of content the template is for. Known values are: + "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the template - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + :keyword package_id: the package Id contains this template. + :paramtype package_id: str + :keyword package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :paramtype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword package_name: the name of the package contains this template. + :paramtype package_name: str + :keyword main_template: The JSON of the ARM template to deploy active content. Expandable. + :paramtype main_template: JSON + """ + super().__init__(etag=etag, **kwargs) + self.content_id = content_id + self.content_product_id = content_product_id + self.package_version = package_version + self.version = version + self.display_name = display_name + self.content_kind = content_kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + self.package_id = package_id + self.package_kind = package_kind + self.package_name = package_name + self.is_deprecated = None + self.main_template = main_template + self.dependant_templates = None -class TeamProperties(_serialization.Model): - """Describes team properties. +class TemplateProperties( + TemplateBaseProperties, TemplateAdditionalProperties +): # pylint: disable=too-many-instance-attributes + """Template property bag. - 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 team_name: The name of the team. Required. - :vartype team_name: str - :ivar team_description: The description of the team. - :vartype team_description: str - :ivar group_ids: List of group IDs to add their members to the team. - :vartype group_ids: list[str] - :ivar member_ids: List of member IDs to add to the team. - :vartype member_ids: list[str] + :ivar main_template: The JSON of the ARM template to deploy active content. Expandable. + :vartype main_template: JSON + :ivar dependant_templates: Dependant templates. Expandable. + :vartype dependant_templates: list[~azure.mgmt.securityinsight.models.TemplateProperties] + :ivar content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :vartype content_id: str + :ivar content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :vartype content_product_id: str + :ivar package_version: Version of the package. Default and recommended format is numeric (e.g. + 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but + then we cannot guarantee any version checks. + :vartype package_version: str + :ivar version: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, + 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + cannot guarantee any version checks. + :vartype version: str + :ivar display_name: The display name of the template. + :vartype display_name: str + :ivar content_kind: The kind of content the template is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :vartype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :ivar source: Source of the content. This is where/how it was created. + :vartype source: ~azure.mgmt.securityinsight.models.MetadataSource + :ivar author: The creator of the content item. + :vartype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :ivar support: Support information for the template - type, name, contact information. + :vartype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :ivar dependencies: Dependencies for the content item, what other content items it requires to + work. Can describe more complex dependencies using a recursive/nested structure. For a single + dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :vartype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :ivar categories: Categories for the item. + :vartype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :ivar providers: Providers for the content item. + :vartype providers: list[str] + :ivar first_publish_date: first publish date content item. + :vartype first_publish_date: ~datetime.date + :ivar last_publish_date: last publish date for the content item. + :vartype last_publish_date: ~datetime.date + :ivar custom_version: The custom version of the content. A optional free text. + :vartype custom_version: str + :ivar content_schema_version: Schema version of the content. Can be used to distinguish between + different flow based on the schema version. + :vartype content_schema_version: str + :ivar icon: the icon identifier. this id can later be fetched from the content metadata. + :vartype icon: str + :ivar threat_analysis_tactics: the tactics the resource covers. + :vartype threat_analysis_tactics: list[str] + :ivar threat_analysis_techniques: the techniques the resource covers, these have to be aligned + with the tactics being used. + :vartype threat_analysis_techniques: list[str] + :ivar preview_images: preview image file names. These will be taken from the solution + artifacts. + :vartype preview_images: list[str] + :ivar preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :vartype preview_images_dark: list[str] + :ivar package_id: the package Id contains this template. + :vartype package_id: str + :ivar package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :vartype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :ivar package_name: the name of the package contains this template. + :vartype package_name: str + :ivar is_deprecated: Flag indicates if this template is deprecated. Known values are: "true" + and "false". + :vartype is_deprecated: str or ~azure.mgmt.securityinsight.models.Flag """ _validation = { - "team_name": {"required": True}, + "dependant_templates": {"readonly": True}, + "is_deprecated": {"readonly": True}, } _attribute_map = { - "team_name": {"key": "teamName", "type": "str"}, - "team_description": {"key": "teamDescription", "type": "str"}, - "group_ids": {"key": "groupIds", "type": "[str]"}, - "member_ids": {"key": "memberIds", "type": "[str]"}, + "main_template": {"key": "mainTemplate", "type": "object"}, + "dependant_templates": {"key": "dependantTemplates", "type": "[TemplateProperties]"}, + "content_id": {"key": "contentId", "type": "str"}, + "content_product_id": {"key": "contentProductId", "type": "str"}, + "package_version": {"key": "packageVersion", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "content_kind": {"key": "contentKind", "type": "str"}, + "source": {"key": "source", "type": "MetadataSource"}, + "author": {"key": "author", "type": "MetadataAuthor"}, + "support": {"key": "support", "type": "MetadataSupport"}, + "dependencies": {"key": "dependencies", "type": "MetadataDependencies"}, + "categories": {"key": "categories", "type": "MetadataCategories"}, + "providers": {"key": "providers", "type": "[str]"}, + "first_publish_date": {"key": "firstPublishDate", "type": "date"}, + "last_publish_date": {"key": "lastPublishDate", "type": "date"}, + "custom_version": {"key": "customVersion", "type": "str"}, + "content_schema_version": {"key": "contentSchemaVersion", "type": "str"}, + "icon": {"key": "icon", "type": "str"}, + "threat_analysis_tactics": {"key": "threatAnalysisTactics", "type": "[str]"}, + "threat_analysis_techniques": {"key": "threatAnalysisTechniques", "type": "[str]"}, + "preview_images": {"key": "previewImages", "type": "[str]"}, + "preview_images_dark": {"key": "previewImagesDark", "type": "[str]"}, + "package_id": {"key": "packageId", "type": "str"}, + "package_kind": {"key": "packageKind", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "is_deprecated": {"key": "isDeprecated", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - team_name: str, - team_description: Optional[str] = None, - group_ids: Optional[List[str]] = None, - member_ids: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword team_name: The name of the team. Required. - :paramtype team_name: str - :keyword team_description: The description of the team. - :paramtype team_description: str - :keyword group_ids: List of group IDs to add their members to the team. - :paramtype group_ids: list[str] - :keyword member_ids: List of member IDs to add to the team. - :paramtype member_ids: list[str] + main_template: Optional[JSON] = None, + content_id: Optional[str] = None, + content_product_id: Optional[str] = None, + package_version: Optional[str] = None, + version: Optional[str] = None, + display_name: Optional[str] = None, + content_kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, + providers: Optional[List[str]] = None, + first_publish_date: Optional[datetime.date] = None, + last_publish_date: Optional[datetime.date] = None, + custom_version: Optional[str] = None, + content_schema_version: Optional[str] = None, + icon: Optional[str] = None, + threat_analysis_tactics: Optional[List[str]] = None, + threat_analysis_techniques: Optional[List[str]] = None, + preview_images: Optional[List[str]] = None, + preview_images_dark: Optional[List[str]] = None, + package_id: Optional[str] = None, + package_kind: Optional[Union[str, "_models.PackageKind"]] = None, + package_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword main_template: The JSON of the ARM template to deploy active content. Expandable. + :paramtype main_template: JSON + :keyword content_id: Static ID for the content. Used to identify dependencies and content from + solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic + for user-created. This is the resource name. + :paramtype content_id: str + :keyword content_product_id: Unique ID for the content. It should be generated based on the + contentId of the package, contentId of the template, contentKind of the template and the + contentVersion of the template. + :paramtype content_product_id: str + :keyword package_version: Version of the package. Default and recommended format is numeric + (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, + but then we cannot guarantee any version checks. + :paramtype package_version: str + :keyword version: Version of the content. Default and recommended format is numeric (e.g. 1, + 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then + we cannot guarantee any version checks. + :paramtype version: str + :keyword display_name: The display name of the template. + :paramtype display_name: str + :keyword content_kind: The kind of content the template is for. Known values are: + "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", + "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", and + "AutomationRule". + :paramtype content_kind: str or ~azure.mgmt.securityinsight.models.Kind + :keyword source: Source of the content. This is where/how it was created. + :paramtype source: ~azure.mgmt.securityinsight.models.MetadataSource + :keyword author: The creator of the content item. + :paramtype author: ~azure.mgmt.securityinsight.models.MetadataAuthor + :keyword support: Support information for the template - type, name, contact information. + :paramtype support: ~azure.mgmt.securityinsight.models.MetadataSupport + :keyword dependencies: Dependencies for the content item, what other content items it requires + to work. Can describe more complex dependencies using a recursive/nested structure. For a + single dependency an id/kind/version can be supplied or operator/criteria for complex formats. + :paramtype dependencies: ~azure.mgmt.securityinsight.models.MetadataDependencies + :keyword categories: Categories for the item. + :paramtype categories: ~azure.mgmt.securityinsight.models.MetadataCategories + :keyword providers: Providers for the content item. + :paramtype providers: list[str] + :keyword first_publish_date: first publish date content item. + :paramtype first_publish_date: ~datetime.date + :keyword last_publish_date: last publish date for the content item. + :paramtype last_publish_date: ~datetime.date + :keyword custom_version: The custom version of the content. A optional free text. + :paramtype custom_version: str + :keyword content_schema_version: Schema version of the content. Can be used to distinguish + between different flow based on the schema version. + :paramtype content_schema_version: str + :keyword icon: the icon identifier. this id can later be fetched from the content metadata. + :paramtype icon: str + :keyword threat_analysis_tactics: the tactics the resource covers. + :paramtype threat_analysis_tactics: list[str] + :keyword threat_analysis_techniques: the techniques the resource covers, these have to be + aligned with the tactics being used. + :paramtype threat_analysis_techniques: list[str] + :keyword preview_images: preview image file names. These will be taken from the solution + artifacts. + :paramtype preview_images: list[str] + :keyword preview_images_dark: preview image file names. These will be taken from the solution + artifacts. used for dark theme support. + :paramtype preview_images_dark: list[str] + :keyword package_id: the package Id contains this template. + :paramtype package_id: str + :keyword package_kind: the packageKind of the package contains this template. Known values are: + "Solution" and "Standalone". + :paramtype package_kind: str or ~azure.mgmt.securityinsight.models.PackageKind + :keyword package_name: the name of the package contains this template. + :paramtype package_name: str """ - super().__init__(**kwargs) - self.team_name = team_name - self.team_description = team_description - self.group_ids = group_ids - self.member_ids = member_ids + super().__init__( + content_id=content_id, + content_product_id=content_product_id, + package_version=package_version, + version=version, + display_name=display_name, + content_kind=content_kind, + source=source, + author=author, + support=support, + dependencies=dependencies, + categories=categories, + providers=providers, + first_publish_date=first_publish_date, + last_publish_date=last_publish_date, + custom_version=custom_version, + content_schema_version=content_schema_version, + icon=icon, + threat_analysis_tactics=threat_analysis_tactics, + threat_analysis_techniques=threat_analysis_techniques, + preview_images=preview_images, + preview_images_dark=preview_images_dark, + package_id=package_id, + package_kind=package_kind, + package_name=package_name, + main_template=main_template, + **kwargs + ) + self.main_template = main_template + self.dependant_templates = None + self.content_id = content_id + self.content_product_id = content_product_id + self.package_version = package_version + self.version = version + self.display_name = display_name + self.content_kind = content_kind + self.source = source + self.author = author + self.support = support + self.dependencies = dependencies + self.categories = categories + self.providers = providers + self.first_publish_date = first_publish_date + self.last_publish_date = last_publish_date + self.custom_version = custom_version + self.content_schema_version = content_schema_version + self.icon = icon + self.threat_analysis_tactics = threat_analysis_tactics + self.threat_analysis_techniques = threat_analysis_techniques + self.preview_images = preview_images + self.preview_images_dark = preview_images_dark + self.package_id = package_id + self.package_kind = package_kind + self.package_name = package_name + self.is_deprecated = None class ThreatIntelligence(_serialization.Model): @@ -20978,7 +26172,7 @@ class ThreatIntelligence(_serialization.Model): "threat_type": {"key": "threatType", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.confidence = None @@ -21030,6 +26224,8 @@ class ThreatIntelligenceAlertRule(AlertRule): # pylint: disable=too-many-instan :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] + :ivar sub_techniques: The sub-techniques of the alert rule. + :vartype sub_techniques: list[str] """ _validation = { @@ -21044,6 +26240,7 @@ class ThreatIntelligenceAlertRule(AlertRule): # pylint: disable=too-many-instan "severity": {"readonly": True}, "tactics": {"readonly": True}, "techniques": {"readonly": True}, + "sub_techniques": {"readonly": True}, } _attribute_map = { @@ -21061,6 +26258,7 @@ class ThreatIntelligenceAlertRule(AlertRule): # pylint: disable=too-many-instan "severity": {"key": "properties.severity", "type": "str"}, "tactics": {"key": "properties.tactics", "type": "[str]"}, "techniques": {"key": "properties.techniques", "type": "[str]"}, + "sub_techniques": {"key": "properties.subTechniques", "type": "[str]"}, } def __init__( @@ -21069,8 +26267,8 @@ def __init__( etag: Optional[str] = None, alert_rule_template_name: Optional[str] = None, enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -21090,6 +26288,7 @@ def __init__( self.severity = None self.tactics = None self.techniques = None + self.sub_techniques = None class ThreatIntelligenceAlertRuleTemplate(AlertRuleTemplate): # pylint: disable=too-many-instance-attributes @@ -21182,8 +26381,8 @@ def __init__( tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, severity: Optional[Union[str, "_models.AlertSeverity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -21283,8 +26482,8 @@ def __init__( status: Optional[Union[str, "_models.TemplateStatus"]] = None, tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword alert_rules_created_by_template_count: the number of alert rules that were created by this template. @@ -21331,7 +26530,7 @@ class ThreatIntelligenceAppendTags(_serialization.Model): "threat_intelligence_tags": {"key": "threatIntelligenceTags", "type": "[str]"}, } - def __init__(self, *, threat_intelligence_tags: Optional[List[str]] = None, **kwargs): + def __init__(self, *, threat_intelligence_tags: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword threat_intelligence_tags: List of tags to be appended. :paramtype threat_intelligence_tags: list[str] @@ -21371,8 +26570,8 @@ def __init__( source_name: Optional[str] = None, url: Optional[str] = None, hashes: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: External reference description. :paramtype description: str @@ -21456,8 +26655,8 @@ def __init__( ids: Optional[List[str]] = None, keywords: Optional[List[str]] = None, skip_token: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword page_size: Page size. :paramtype page_size: int @@ -21525,8 +26724,8 @@ def __init__( language: Optional[str] = None, marking_ref: Optional[int] = None, selectors: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword language: Language granular marking model. :paramtype language: str @@ -21565,7 +26764,7 @@ class ThreatIntelligenceInformation(ResourceWithEtag): :ivar etag: Etag of the azure resource. :vartype etag: str :ivar kind: The kind of the entity. Required. "indicator" - :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceKindEnum + :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceInnerKind """ _validation = { @@ -21587,7 +26786,7 @@ class ThreatIntelligenceInformation(ResourceWithEtag): _subtype_map = {"kind": {"indicator": "ThreatIntelligenceIndicatorModel"}} - def __init__(self, *, etag: Optional[str] = None, **kwargs): + def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -21617,7 +26816,7 @@ class ThreatIntelligenceIndicatorModel(ThreatIntelligenceInformation): # pylint :ivar etag: Etag of the azure resource. :vartype etag: str :ivar kind: The kind of the entity. Required. "indicator" - :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceKindEnum + :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceInnerKind :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. :vartype additional_data: dict[str, any] @@ -21770,8 +26969,8 @@ def __init__( # pylint: disable=too-many-locals created: Optional[str] = None, modified: Optional[str] = None, extensions: Optional[Dict[str, Any]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str @@ -22012,8 +27211,8 @@ def __init__( # pylint: disable=too-many-locals created: Optional[str] = None, modified: Optional[str] = None, extensions: Optional[Dict[str, Any]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword threat_intelligence_tags: List of tags. :paramtype threat_intelligence_tags: list[str] @@ -22107,297 +27306,667 @@ def __init__( # pylint: disable=too-many-locals self.extensions = extensions -class ThreatIntelligenceInformationList(_serialization.Model): - """List of all the threat intelligence information objects. +class ThreatIntelligenceInformationList(_serialization.Model): + """List of all the threat intelligence information objects. + + 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 next_link: URL to fetch the next set of information objects. + :vartype next_link: str + :ivar value: Array of threat intelligence information objects. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation] + """ + + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ThreatIntelligenceInformation]"}, + } + + def __init__(self, *, value: List["_models.ThreatIntelligenceInformation"], **kwargs: Any) -> None: + """ + :keyword value: Array of threat intelligence information objects. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation] + """ + super().__init__(**kwargs) + self.next_link = None + self.value = value + + +class ThreatIntelligenceKillChainPhase(_serialization.Model): + """Describes threat kill chain phase entity. + + :ivar kill_chain_name: Kill chainName name. + :vartype kill_chain_name: str + :ivar phase_name: Phase name. + :vartype phase_name: str + """ + + _attribute_map = { + "kill_chain_name": {"key": "killChainName", "type": "str"}, + "phase_name": {"key": "phaseName", "type": "str"}, + } + + def __init__( + self, *, kill_chain_name: Optional[str] = None, phase_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword kill_chain_name: Kill chainName name. + :paramtype kill_chain_name: str + :keyword phase_name: Phase name. + :paramtype phase_name: str + """ + super().__init__(**kwargs) + self.kill_chain_name = kill_chain_name + self.phase_name = phase_name + + +class ThreatIntelligenceMetric(_serialization.Model): + """Describes threat intelligence metric. + + :ivar last_updated_time_utc: Last updated indicator metric. + :vartype last_updated_time_utc: str + :ivar threat_type_metrics: Threat type metrics. + :vartype threat_type_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :ivar pattern_type_metrics: Pattern type metrics. + :vartype pattern_type_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :ivar source_metrics: Source metrics. + :vartype source_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + """ + + _attribute_map = { + "last_updated_time_utc": {"key": "lastUpdatedTimeUtc", "type": "str"}, + "threat_type_metrics": {"key": "threatTypeMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, + "pattern_type_metrics": {"key": "patternTypeMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, + "source_metrics": {"key": "sourceMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, + } + + def __init__( + self, + *, + last_updated_time_utc: Optional[str] = None, + threat_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, + pattern_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, + source_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_updated_time_utc: Last updated indicator metric. + :paramtype last_updated_time_utc: str + :keyword threat_type_metrics: Threat type metrics. + :paramtype threat_type_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :keyword pattern_type_metrics: Pattern type metrics. + :paramtype pattern_type_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :keyword source_metrics: Source metrics. + :paramtype source_metrics: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + """ + super().__init__(**kwargs) + self.last_updated_time_utc = last_updated_time_utc + self.threat_type_metrics = threat_type_metrics + self.pattern_type_metrics = pattern_type_metrics + self.source_metrics = source_metrics + + +class ThreatIntelligenceMetricEntity(_serialization.Model): + """Describes threat intelligence metric entity. + + :ivar metric_name: Metric name. + :vartype metric_name: str + :ivar metric_value: Metric value. + :vartype metric_value: int + """ + + _attribute_map = { + "metric_name": {"key": "metricName", "type": "str"}, + "metric_value": {"key": "metricValue", "type": "int"}, + } + + def __init__(self, *, metric_name: Optional[str] = None, metric_value: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword metric_name: Metric name. + :paramtype metric_name: str + :keyword metric_value: Metric value. + :paramtype metric_value: int + """ + super().__init__(**kwargs) + self.metric_name = metric_name + self.metric_value = metric_value + + +class ThreatIntelligenceMetrics(_serialization.Model): + """Threat intelligence metrics. + + :ivar properties: Threat intelligence metrics. + :vartype properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetric + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ThreatIntelligenceMetric"}, + } + + def __init__(self, *, properties: Optional["_models.ThreatIntelligenceMetric"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Threat intelligence metrics. + :paramtype properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetric + """ + super().__init__(**kwargs) + self.properties = properties + - Variables are only populated by the server, and will be ignored when sending a request. +class ThreatIntelligenceMetricsList(_serialization.Model): + """List of all the threat intelligence metric fields (type/threat type/source). All required parameters must be populated in order to send to Azure. - :ivar next_link: URL to fetch the next set of information objects. - :vartype next_link: str - :ivar value: Array of threat intelligence information objects. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation] + :ivar value: Array of threat intelligence metric fields (type/threat type/source). Required. + :vartype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetrics] """ _validation = { - "next_link": {"readonly": True}, "value": {"required": True}, } _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ThreatIntelligenceInformation]"}, + "value": {"key": "value", "type": "[ThreatIntelligenceMetrics]"}, } - def __init__(self, *, value: List["_models.ThreatIntelligenceInformation"], **kwargs): + def __init__(self, *, value: List["_models.ThreatIntelligenceMetrics"], **kwargs: Any) -> None: """ - :keyword value: Array of threat intelligence information objects. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation] + :keyword value: Array of threat intelligence metric fields (type/threat type/source). Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetrics] """ super().__init__(**kwargs) - self.next_link = None self.value = value -class ThreatIntelligenceKillChainPhase(_serialization.Model): +class ThreatIntelligenceParsedPattern(_serialization.Model): + """Describes parsed pattern entity. + + :ivar pattern_type_key: Pattern type key. + :vartype pattern_type_key: str + :ivar pattern_type_values: Pattern type keys. + :vartype pattern_type_values: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceParsedPatternTypeValue] + """ + + _attribute_map = { + "pattern_type_key": {"key": "patternTypeKey", "type": "str"}, + "pattern_type_values": {"key": "patternTypeValues", "type": "[ThreatIntelligenceParsedPatternTypeValue]"}, + } + + def __init__( + self, + *, + pattern_type_key: Optional[str] = None, + pattern_type_values: Optional[List["_models.ThreatIntelligenceParsedPatternTypeValue"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword pattern_type_key: Pattern type key. + :paramtype pattern_type_key: str + :keyword pattern_type_values: Pattern type keys. + :paramtype pattern_type_values: + list[~azure.mgmt.securityinsight.models.ThreatIntelligenceParsedPatternTypeValue] + """ + super().__init__(**kwargs) + self.pattern_type_key = pattern_type_key + self.pattern_type_values = pattern_type_values + + +class ThreatIntelligenceParsedPatternTypeValue(_serialization.Model): """Describes threat kill chain phase entity. - :ivar kill_chain_name: Kill chainName name. - :vartype kill_chain_name: str - :ivar phase_name: Phase name. - :vartype phase_name: str + :ivar value_type: Type of the value. + :vartype value_type: str + :ivar value: Value of parsed pattern. + :vartype value: str """ _attribute_map = { - "kill_chain_name": {"key": "killChainName", "type": "str"}, - "phase_name": {"key": "phaseName", "type": "str"}, + "value_type": {"key": "valueType", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__(self, *, kill_chain_name: Optional[str] = None, phase_name: Optional[str] = None, **kwargs): + def __init__(self, *, value_type: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword kill_chain_name: Kill chainName name. - :paramtype kill_chain_name: str - :keyword phase_name: Phase name. - :paramtype phase_name: str + :keyword value_type: Type of the value. + :paramtype value_type: str + :keyword value: Value of parsed pattern. + :paramtype value: str """ super().__init__(**kwargs) - self.kill_chain_name = kill_chain_name - self.phase_name = phase_name + self.value_type = value_type + self.value = value -class ThreatIntelligenceMetric(_serialization.Model): - """Describes threat intelligence metric. +class ThreatIntelligenceSortingCriteria(_serialization.Model): + """List of available columns for sorting. - :ivar last_updated_time_utc: Last updated indicator metric. - :vartype last_updated_time_utc: str - :ivar threat_type_metrics: Threat type metrics. - :vartype threat_type_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] - :ivar pattern_type_metrics: Pattern type metrics. - :vartype pattern_type_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] - :ivar source_metrics: Source metrics. - :vartype source_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :ivar item_key: Column name. + :vartype item_key: str + :ivar sort_order: Sorting order (ascending/descending/unsorted). Known values are: "unsorted", + "ascending", and "descending". + :vartype sort_order: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingOrder """ _attribute_map = { - "last_updated_time_utc": {"key": "lastUpdatedTimeUtc", "type": "str"}, - "threat_type_metrics": {"key": "threatTypeMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, - "pattern_type_metrics": {"key": "patternTypeMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, - "source_metrics": {"key": "sourceMetrics", "type": "[ThreatIntelligenceMetricEntity]"}, + "item_key": {"key": "itemKey", "type": "str"}, + "sort_order": {"key": "sortOrder", "type": "str"}, } def __init__( self, *, - last_updated_time_utc: Optional[str] = None, - threat_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, - pattern_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, - source_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, - **kwargs - ): + item_key: Optional[str] = None, + sort_order: Optional[Union[str, "_models.ThreatIntelligenceSortingOrder"]] = None, + **kwargs: Any + ) -> None: """ - :keyword last_updated_time_utc: Last updated indicator metric. - :paramtype last_updated_time_utc: str - :keyword threat_type_metrics: Threat type metrics. - :paramtype threat_type_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] - :keyword pattern_type_metrics: Pattern type metrics. - :paramtype pattern_type_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] - :keyword source_metrics: Source metrics. - :paramtype source_metrics: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricEntity] + :keyword item_key: Column name. + :paramtype item_key: str + :keyword sort_order: Sorting order (ascending/descending/unsorted). Known values are: + "unsorted", "ascending", and "descending". + :paramtype sort_order: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingOrder """ super().__init__(**kwargs) - self.last_updated_time_utc = last_updated_time_utc - self.threat_type_metrics = threat_type_metrics - self.pattern_type_metrics = pattern_type_metrics - self.source_metrics = source_metrics + self.item_key = item_key + self.sort_order = sort_order + + +class TICheckRequirements(DataConnectorsCheckRequirements): + """Threat Intelligence Platforms data connector check requirements. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Describes the kind of connector to be checked. Required. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + """ + + _validation = { + "kind": {"required": True}, + } + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.kind: str = "ThreatIntelligence" + self.tenant_id = tenant_id + + +class TICheckRequirementsProperties(DataConnectorTenantId): + """Threat Intelligence Platforms data connector required properties. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + """ + + _validation = { + "tenant_id": {"required": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + """ + super().__init__(tenant_id=tenant_id, **kwargs) + + +class TIDataConnector(DataConnector): + """Represents threat intelligence data connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", + "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar tip_lookback_period: The lookback period for the feed to be imported. + :vartype tip_lookback_period: ~datetime.datetime + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "tip_lookback_period": {"key": "properties.tipLookbackPeriod", "type": "iso-8601"}, + "data_types": {"key": "properties.dataTypes", "type": "TIDataConnectorDataTypes"}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + tenant_id: Optional[str] = None, + tip_lookback_period: Optional[datetime.datetime] = None, + data_types: Optional["_models.TIDataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword tip_lookback_period: The lookback period for the feed to be imported. + :paramtype tip_lookback_period: ~datetime.datetime + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + """ + super().__init__(etag=etag, **kwargs) + self.kind: str = "ThreatIntelligence" + self.tenant_id = tenant_id + self.tip_lookback_period = tip_lookback_period + self.data_types = data_types -class ThreatIntelligenceMetricEntity(_serialization.Model): - """Describes threat intelligence metric entity. +class TIDataConnectorDataTypes(_serialization.Model): + """The available data types for TI (Threat Intelligence) data connector. - :ivar metric_name: Metric name. - :vartype metric_name: str - :ivar metric_value: Metric value. - :vartype metric_value: int + All required parameters must be populated in order to send to Azure. + + :ivar indicators: Data type for indicators connection. Required. + :vartype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators """ + _validation = { + "indicators": {"required": True}, + } + _attribute_map = { - "metric_name": {"key": "metricName", "type": "str"}, - "metric_value": {"key": "metricValue", "type": "int"}, + "indicators": {"key": "indicators", "type": "TIDataConnectorDataTypesIndicators"}, } - def __init__(self, *, metric_name: Optional[str] = None, metric_value: Optional[int] = None, **kwargs): + def __init__(self, *, indicators: "_models.TIDataConnectorDataTypesIndicators", **kwargs: Any) -> None: """ - :keyword metric_name: Metric name. - :paramtype metric_name: str - :keyword metric_value: Metric value. - :paramtype metric_value: int + :keyword indicators: Data type for indicators connection. Required. + :paramtype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators """ super().__init__(**kwargs) - self.metric_name = metric_name - self.metric_value = metric_value + self.indicators = indicators -class ThreatIntelligenceMetrics(_serialization.Model): - """Threat intelligence metrics. +class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): + """Data type for indicators connection. - :ivar properties: Threat intelligence metrics. - :vartype properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetric + All required parameters must be populated in order to send to Azure. + + :ivar state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ + _validation = { + "state": {"required": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "ThreatIntelligenceMetric"}, + "state": {"key": "state", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.ThreatIntelligenceMetric"] = None, **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ - :keyword properties: Threat intelligence metrics. - :paramtype properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetric + :keyword state: Describe whether this data type connection is enabled or not. Required. Known + values are: "Enabled" and "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ - super().__init__(**kwargs) - self.properties = properties + super().__init__(state=state, **kwargs) -class ThreatIntelligenceMetricsList(_serialization.Model): - """List of all the threat intelligence metric fields (type/threat type/source). +class TIDataConnectorProperties(DataConnectorTenantId): + """TI (Threat Intelligence) data connector properties. All required parameters must be populated in order to send to Azure. - :ivar value: Array of threat intelligence metric fields (type/threat type/source). Required. - :vartype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetrics] + :ivar tenant_id: The tenant id to connect to, and get the data from. Required. + :vartype tenant_id: str + :ivar tip_lookback_period: The lookback period for the feed to be imported. + :vartype tip_lookback_period: ~datetime.datetime + :ivar data_types: The available data types for the connector. Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes """ _validation = { - "value": {"required": True}, + "tenant_id": {"required": True}, + "data_types": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ThreatIntelligenceMetrics]"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "tip_lookback_period": {"key": "tipLookbackPeriod", "type": "iso-8601"}, + "data_types": {"key": "dataTypes", "type": "TIDataConnectorDataTypes"}, } - def __init__(self, *, value: List["_models.ThreatIntelligenceMetrics"], **kwargs): + def __init__( + self, + *, + tenant_id: str, + data_types: "_models.TIDataConnectorDataTypes", + tip_lookback_period: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Array of threat intelligence metric fields (type/threat type/source). Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.ThreatIntelligenceMetrics] + :keyword tenant_id: The tenant id to connect to, and get the data from. Required. + :paramtype tenant_id: str + :keyword tip_lookback_period: The lookback period for the feed to be imported. + :paramtype tip_lookback_period: ~datetime.datetime + :keyword data_types: The available data types for the connector. Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes """ - super().__init__(**kwargs) - self.value = value + super().__init__(tenant_id=tenant_id, **kwargs) + self.tip_lookback_period = tip_lookback_period + self.data_types = data_types -class ThreatIntelligenceParsedPattern(_serialization.Model): - """Describes parsed pattern entity. +class TimelineAggregation(_serialization.Model): + """timeline aggregation information per kind. - :ivar pattern_type_key: Pattern type key. - :vartype pattern_type_key: str - :ivar pattern_type_values: Pattern type keys. - :vartype pattern_type_values: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceParsedPatternTypeValue] + All required parameters must be populated in order to send to Azure. + + :ivar count: the total items found for a kind. Required. + :vartype count: int + :ivar kind: the query kind. Required. Known values are: "Activity", "Bookmark", + "SecurityAlert", and "Anomaly". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind """ + _validation = { + "count": {"required": True}, + "kind": {"required": True}, + } + _attribute_map = { - "pattern_type_key": {"key": "patternTypeKey", "type": "str"}, - "pattern_type_values": {"key": "patternTypeValues", "type": "[ThreatIntelligenceParsedPatternTypeValue]"}, + "count": {"key": "count", "type": "int"}, + "kind": {"key": "kind", "type": "str"}, } - def __init__( - self, - *, - pattern_type_key: Optional[str] = None, - pattern_type_values: Optional[List["_models.ThreatIntelligenceParsedPatternTypeValue"]] = None, - **kwargs - ): + def __init__(self, *, count: int, kind: Union[str, "_models.EntityTimelineKind"], **kwargs: Any) -> None: """ - :keyword pattern_type_key: Pattern type key. - :paramtype pattern_type_key: str - :keyword pattern_type_values: Pattern type keys. - :paramtype pattern_type_values: - list[~azure.mgmt.securityinsight.models.ThreatIntelligenceParsedPatternTypeValue] + :keyword count: the total items found for a kind. Required. + :paramtype count: int + :keyword kind: the query kind. Required. Known values are: "Activity", "Bookmark", + "SecurityAlert", and "Anomaly". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind """ super().__init__(**kwargs) - self.pattern_type_key = pattern_type_key - self.pattern_type_values = pattern_type_values + self.count = count + self.kind = kind -class ThreatIntelligenceParsedPatternTypeValue(_serialization.Model): - """Describes threat kill chain phase entity. +class TimelineError(_serialization.Model): + """Timeline Query Errors. - :ivar value_type: Type of the value. - :vartype value_type: str - :ivar value: Value of parsed pattern. - :vartype value: str + All required parameters must be populated in order to send to Azure. + + :ivar kind: the query kind. Required. Known values are: "Activity", "Bookmark", + "SecurityAlert", and "Anomaly". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind + :ivar query_id: the query id. + :vartype query_id: str + :ivar error_message: the error message. Required. + :vartype error_message: str """ + _validation = { + "kind": {"required": True}, + "error_message": {"required": True}, + } + _attribute_map = { - "value_type": {"key": "valueType", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "query_id": {"key": "queryId", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, } - def __init__(self, *, value_type: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + kind: Union[str, "_models.EntityTimelineKind"], + error_message: str, + query_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value_type: Type of the value. - :paramtype value_type: str - :keyword value: Value of parsed pattern. - :paramtype value: str + :keyword kind: the query kind. Required. Known values are: "Activity", "Bookmark", + "SecurityAlert", and "Anomaly". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind + :keyword query_id: the query id. + :paramtype query_id: str + :keyword error_message: the error message. Required. + :paramtype error_message: str """ super().__init__(**kwargs) - self.value_type = value_type - self.value = value + self.kind = kind + self.query_id = query_id + self.error_message = error_message -class ThreatIntelligenceSortingCriteria(_serialization.Model): - """List of available columns for sorting. +class TimelineResultsMetadata(_serialization.Model): + """Expansion result metadata. - :ivar item_key: Column name. - :vartype item_key: str - :ivar sort_order: Sorting order (ascending/descending/unsorted). Known values are: "unsorted", - "ascending", and "descending". - :vartype sort_order: str or - ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingCriteriaEnum + All required parameters must be populated in order to send to Azure. + + :ivar total_count: the total items found for the timeline request. Required. + :vartype total_count: int + :ivar aggregations: timeline aggregation per kind. Required. + :vartype aggregations: list[~azure.mgmt.securityinsight.models.TimelineAggregation] + :ivar errors: information about the failure queries. + :vartype errors: list[~azure.mgmt.securityinsight.models.TimelineError] """ + _validation = { + "total_count": {"required": True}, + "aggregations": {"required": True}, + } + _attribute_map = { - "item_key": {"key": "itemKey", "type": "str"}, - "sort_order": {"key": "sortOrder", "type": "str"}, + "total_count": {"key": "totalCount", "type": "int"}, + "aggregations": {"key": "aggregations", "type": "[TimelineAggregation]"}, + "errors": {"key": "errors", "type": "[TimelineError]"}, } def __init__( self, *, - item_key: Optional[str] = None, - sort_order: Optional[Union[str, "_models.ThreatIntelligenceSortingCriteriaEnum"]] = None, - **kwargs - ): + total_count: int, + aggregations: List["_models.TimelineAggregation"], + errors: Optional[List["_models.TimelineError"]] = None, + **kwargs: Any + ) -> None: """ - :keyword item_key: Column name. - :paramtype item_key: str - :keyword sort_order: Sorting order (ascending/descending/unsorted). Known values are: - "unsorted", "ascending", and "descending". - :paramtype sort_order: str or - ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingCriteriaEnum + :keyword total_count: the total items found for the timeline request. Required. + :paramtype total_count: int + :keyword aggregations: timeline aggregation per kind. Required. + :paramtype aggregations: list[~azure.mgmt.securityinsight.models.TimelineAggregation] + :keyword errors: information about the failure queries. + :paramtype errors: list[~azure.mgmt.securityinsight.models.TimelineError] """ super().__init__(**kwargs) - self.item_key = item_key - self.sort_order = sort_order + self.total_count = total_count + self.aggregations = aggregations + self.errors = errors -class TICheckRequirements(DataConnectorsCheckRequirements): - """Threat Intelligence Platforms data connector check requirements. +class TiTaxiiCheckRequirements(DataConnectorsCheckRequirements): + """Threat Intelligence TAXII data connector check requirements. All required parameters must be populated in order to send to Azure. :ivar kind: Describes the kind of connector to be checked. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "Office365Project", "MicrosoftPurviewInformationProtection", "OfficePowerBI", + "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -22412,18 +27981,18 @@ class TICheckRequirements(DataConnectorsCheckRequirements): "tenant_id": {"key": "properties.tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, tenant_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str """ super().__init__(**kwargs) - self.kind: str = "ThreatIntelligence" + self.kind: str = "ThreatIntelligenceTaxii" self.tenant_id = tenant_id -class TICheckRequirementsProperties(DataConnectorTenantId): - """Threat Intelligence Platforms data connector required properties. +class TiTaxiiCheckRequirementsProperties(DataConnectorTenantId): + """Threat Intelligence TAXII data connector required properties. All required parameters must be populated in order to send to Azure. @@ -22439,7 +28008,7 @@ class TICheckRequirementsProperties(DataConnectorTenantId): "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__(self, *, tenant_id: str, **kwargs: Any) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str @@ -22447,8 +28016,8 @@ def __init__(self, *, tenant_id: str, **kwargs): super().__init__(tenant_id=tenant_id, **kwargs) -class TIDataConnector(DataConnector): - """Represents threat intelligence data connector. +class TiTaxiiDataConnector(DataConnector): # pylint: disable=too-many-instance-attributes + """Data connector to pull Threat intelligence data from TAXII 2.0/2.1 server. Variables are only populated by the server, and will be ignored when sending a request. @@ -22470,17 +28039,32 @@ class TIDataConnector(DataConnector): :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". + "MicrosoftPurviewInformationProtection", "OfficePowerBI", "AmazonWebServicesCloudTrail", + "AmazonWebServicesS3", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", + "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT", and "GCP". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str - :ivar tip_lookback_period: The lookback period for the feed to be imported. - :vartype tip_lookback_period: ~datetime.datetime - :ivar data_types: The available data types for the connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + :ivar workspace_id: The workspace id. + :vartype workspace_id: str + :ivar friendly_name: The friendly name for the TAXII server. + :vartype friendly_name: str + :ivar taxii_server: The API root for the TAXII server. + :vartype taxii_server: str + :ivar collection_id: The collection id of the TAXII server. + :vartype collection_id: str + :ivar user_name: The userName for the TAXII server. + :vartype user_name: str + :ivar password: The password for the TAXII server. + :vartype password: str + :ivar taxii_lookback_period: The lookback period for the TAXII server. + :vartype taxii_lookback_period: ~datetime.datetime + :ivar polling_frequency: The polling frequency for the TAXII server. Known values are: + "OnceAMinute", "OnceAnHour", and "OnceADay". + :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency + :ivar data_types: The available data types for Threat Intelligence TAXII data connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes """ _validation = { @@ -22499,8 +28083,15 @@ class TIDataConnector(DataConnector): "etag": {"key": "etag", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "tip_lookback_period": {"key": "properties.tipLookbackPeriod", "type": "iso-8601"}, - "data_types": {"key": "properties.dataTypes", "type": "TIDataConnectorDataTypes"}, + "workspace_id": {"key": "properties.workspaceId", "type": "str"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "taxii_server": {"key": "properties.taxiiServer", "type": "str"}, + "collection_id": {"key": "properties.collectionId", "type": "str"}, + "user_name": {"key": "properties.userName", "type": "str"}, + "password": {"key": "properties.password", "type": "str"}, + "taxii_lookback_period": {"key": "properties.taxiiLookbackPeriod", "type": "iso-8601"}, + "polling_frequency": {"key": "properties.pollingFrequency", "type": "str"}, + "data_types": {"key": "properties.dataTypes", "type": "TiTaxiiDataConnectorDataTypes"}, } def __init__( @@ -22508,55 +28099,86 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - tip_lookback_period: Optional[datetime.datetime] = None, - data_types: Optional["_models.TIDataConnectorDataTypes"] = None, - **kwargs - ): + workspace_id: Optional[str] = None, + friendly_name: Optional[str] = None, + taxii_server: Optional[str] = None, + collection_id: Optional[str] = None, + user_name: Optional[str] = None, + password: Optional[str] = None, + taxii_lookback_period: Optional[datetime.datetime] = None, + polling_frequency: Optional[Union[str, "_models.PollingFrequency"]] = None, + data_types: Optional["_models.TiTaxiiDataConnectorDataTypes"] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str :keyword tenant_id: The tenant id to connect to, and get the data from. :paramtype tenant_id: str - :keyword tip_lookback_period: The lookback period for the feed to be imported. - :paramtype tip_lookback_period: ~datetime.datetime - :keyword data_types: The available data types for the connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + :keyword workspace_id: The workspace id. + :paramtype workspace_id: str + :keyword friendly_name: The friendly name for the TAXII server. + :paramtype friendly_name: str + :keyword taxii_server: The API root for the TAXII server. + :paramtype taxii_server: str + :keyword collection_id: The collection id of the TAXII server. + :paramtype collection_id: str + :keyword user_name: The userName for the TAXII server. + :paramtype user_name: str + :keyword password: The password for the TAXII server. + :paramtype password: str + :keyword taxii_lookback_period: The lookback period for the TAXII server. + :paramtype taxii_lookback_period: ~datetime.datetime + :keyword polling_frequency: The polling frequency for the TAXII server. Known values are: + "OnceAMinute", "OnceAnHour", and "OnceADay". + :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency + :keyword data_types: The available data types for Threat Intelligence TAXII data connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes """ super().__init__(etag=etag, **kwargs) - self.kind: str = "ThreatIntelligence" + self.kind: str = "ThreatIntelligenceTaxii" self.tenant_id = tenant_id - self.tip_lookback_period = tip_lookback_period + self.workspace_id = workspace_id + self.friendly_name = friendly_name + self.taxii_server = taxii_server + self.collection_id = collection_id + self.user_name = user_name + self.password = password + self.taxii_lookback_period = taxii_lookback_period + self.polling_frequency = polling_frequency self.data_types = data_types -class TIDataConnectorDataTypes(_serialization.Model): - """The available data types for TI (Threat Intelligence) data connector. +class TiTaxiiDataConnectorDataTypes(_serialization.Model): + """The available data types for Threat Intelligence TAXII data connector. All required parameters must be populated in order to send to Azure. - :ivar indicators: Data type for indicators connection. Required. - :vartype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators + :ivar taxii_client: Data type for TAXII connector. Required. + :vartype taxii_client: + ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypesTaxiiClient """ _validation = { - "indicators": {"required": True}, + "taxii_client": {"required": True}, } _attribute_map = { - "indicators": {"key": "indicators", "type": "TIDataConnectorDataTypesIndicators"}, + "taxii_client": {"key": "taxiiClient", "type": "TiTaxiiDataConnectorDataTypesTaxiiClient"}, } - def __init__(self, *, indicators: "_models.TIDataConnectorDataTypesIndicators", **kwargs): + def __init__(self, *, taxii_client: "_models.TiTaxiiDataConnectorDataTypesTaxiiClient", **kwargs: Any) -> None: """ - :keyword indicators: Data type for indicators connection. Required. - :paramtype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators + :keyword taxii_client: Data type for TAXII connector. Required. + :paramtype taxii_client: + ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypesTaxiiClient """ super().__init__(**kwargs) - self.indicators = indicators + self.taxii_client = taxii_client -class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): - """Data type for indicators connection. +class TiTaxiiDataConnectorDataTypesTaxiiClient(DataConnectorDataTypeCommon): + """Data type for TAXII connector. All required parameters must be populated in order to send to Azure. @@ -22573,7 +28195,7 @@ class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): "state": {"key": "state", "type": "str"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): + def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs: Any) -> None: """ :keyword state: Describe whether this data type connection is enabled or not. Required. Known values are: "Enabled" and "Disabled". @@ -22582,243 +28204,294 @@ def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): super().__init__(state=state, **kwargs) -class TIDataConnectorProperties(DataConnectorTenantId): - """TI (Threat Intelligence) data connector properties. +class TiTaxiiDataConnectorProperties(DataConnectorTenantId): + """Threat Intelligence TAXII data connector properties. All required parameters must be populated in order to send to Azure. :ivar tenant_id: The tenant id to connect to, and get the data from. Required. :vartype tenant_id: str - :ivar tip_lookback_period: The lookback period for the feed to be imported. - :vartype tip_lookback_period: ~datetime.datetime - :ivar data_types: The available data types for the connector. Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + :ivar workspace_id: The workspace id. + :vartype workspace_id: str + :ivar friendly_name: The friendly name for the TAXII server. + :vartype friendly_name: str + :ivar taxii_server: The API root for the TAXII server. + :vartype taxii_server: str + :ivar collection_id: The collection id of the TAXII server. + :vartype collection_id: str + :ivar user_name: The userName for the TAXII server. + :vartype user_name: str + :ivar password: The password for the TAXII server. + :vartype password: str + :ivar taxii_lookback_period: The lookback period for the TAXII server. + :vartype taxii_lookback_period: ~datetime.datetime + :ivar polling_frequency: The polling frequency for the TAXII server. Required. Known values + are: "OnceAMinute", "OnceAnHour", and "OnceADay". + :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency + :ivar data_types: The available data types for Threat Intelligence TAXII data connector. + Required. + :vartype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes """ _validation = { "tenant_id": {"required": True}, + "polling_frequency": {"required": True}, "data_types": {"required": True}, } _attribute_map = { "tenant_id": {"key": "tenantId", "type": "str"}, - "tip_lookback_period": {"key": "tipLookbackPeriod", "type": "iso-8601"}, - "data_types": {"key": "dataTypes", "type": "TIDataConnectorDataTypes"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "taxii_server": {"key": "taxiiServer", "type": "str"}, + "collection_id": {"key": "collectionId", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "taxii_lookback_period": {"key": "taxiiLookbackPeriod", "type": "iso-8601"}, + "polling_frequency": {"key": "pollingFrequency", "type": "str"}, + "data_types": {"key": "dataTypes", "type": "TiTaxiiDataConnectorDataTypes"}, } def __init__( self, *, tenant_id: str, - data_types: "_models.TIDataConnectorDataTypes", - tip_lookback_period: Optional[datetime.datetime] = None, - **kwargs - ): + polling_frequency: Union[str, "_models.PollingFrequency"], + data_types: "_models.TiTaxiiDataConnectorDataTypes", + workspace_id: Optional[str] = None, + friendly_name: Optional[str] = None, + taxii_server: Optional[str] = None, + collection_id: Optional[str] = None, + user_name: Optional[str] = None, + password: Optional[str] = None, + taxii_lookback_period: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ :keyword tenant_id: The tenant id to connect to, and get the data from. Required. :paramtype tenant_id: str - :keyword tip_lookback_period: The lookback period for the feed to be imported. - :paramtype tip_lookback_period: ~datetime.datetime - :keyword data_types: The available data types for the connector. Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + :keyword workspace_id: The workspace id. + :paramtype workspace_id: str + :keyword friendly_name: The friendly name for the TAXII server. + :paramtype friendly_name: str + :keyword taxii_server: The API root for the TAXII server. + :paramtype taxii_server: str + :keyword collection_id: The collection id of the TAXII server. + :paramtype collection_id: str + :keyword user_name: The userName for the TAXII server. + :paramtype user_name: str + :keyword password: The password for the TAXII server. + :paramtype password: str + :keyword taxii_lookback_period: The lookback period for the TAXII server. + :paramtype taxii_lookback_period: ~datetime.datetime + :keyword polling_frequency: The polling frequency for the TAXII server. Required. Known values + are: "OnceAMinute", "OnceAnHour", and "OnceADay". + :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency + :keyword data_types: The available data types for Threat Intelligence TAXII data connector. + Required. + :paramtype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes """ super().__init__(tenant_id=tenant_id, **kwargs) - self.tip_lookback_period = tip_lookback_period - self.data_types = data_types - - -class TimelineAggregation(_serialization.Model): - """timeline aggregation information per kind. - - All required parameters must be populated in order to send to Azure. - - :ivar count: the total items found for a kind. Required. - :vartype count: int - :ivar kind: the query kind. Required. Known values are: "Activity", "Bookmark", - "SecurityAlert", and "Anomaly". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind - """ - - _validation = { - "count": {"required": True}, - "kind": {"required": True}, - } - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - "kind": {"key": "kind", "type": "str"}, - } - - def __init__(self, *, count: int, kind: Union[str, "_models.EntityTimelineKind"], **kwargs): - """ - :keyword count: the total items found for a kind. Required. - :paramtype count: int - :keyword kind: the query kind. Required. Known values are: "Activity", "Bookmark", - "SecurityAlert", and "Anomaly". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind - """ - super().__init__(**kwargs) - self.count = count - self.kind = kind - - -class TimelineError(_serialization.Model): - """Timeline Query Errors. - - All required parameters must be populated in order to send to Azure. - - :ivar kind: the query kind. Required. Known values are: "Activity", "Bookmark", - "SecurityAlert", and "Anomaly". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind - :ivar query_id: the query id. - :vartype query_id: str - :ivar error_message: the error message. Required. - :vartype error_message: str - """ - - _validation = { - "kind": {"required": True}, - "error_message": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "query_id": {"key": "queryId", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - kind: Union[str, "_models.EntityTimelineKind"], - error_message: str, - query_id: Optional[str] = None, - **kwargs - ): - """ - :keyword kind: the query kind. Required. Known values are: "Activity", "Bookmark", - "SecurityAlert", and "Anomaly". - :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind - :keyword query_id: the query id. - :paramtype query_id: str - :keyword error_message: the error message. Required. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.kind = kind - self.query_id = query_id - self.error_message = error_message + self.workspace_id = workspace_id + self.friendly_name = friendly_name + self.taxii_server = taxii_server + self.collection_id = collection_id + self.user_name = user_name + self.password = password + self.taxii_lookback_period = taxii_lookback_period + self.polling_frequency = polling_frequency + self.data_types = data_types -class TimelineResultsMetadata(_serialization.Model): - """Expansion result metadata. +class TriggeredAnalyticsRuleRun(ResourceWithEtag): + """The triggered analytics rule run. + + 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 total_count: the total items found for the timeline request. Required. - :vartype total_count: int - :ivar aggregations: timeline aggregation per kind. Required. - :vartype aggregations: list[~azure.mgmt.securityinsight.models.TimelineAggregation] - :ivar errors: information about the failure queries. - :vartype errors: list[~azure.mgmt.securityinsight.models.TimelineError] + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar execution_time_utc: Required. + :vartype execution_time_utc: ~datetime.datetime + :ivar rule_id: Required. + :vartype rule_id: str + :ivar triggered_analytics_rule_run_id: Required. + :vartype triggered_analytics_rule_run_id: str + :ivar provisioning_state: The triggered analytics rule run provisioning state. Required. Known + values are: "Accepted", "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.securityinsight.models.ProvisioningState + :ivar rule_run_additional_data: Dictionary of :code:``. + :vartype rule_run_additional_data: dict[str, any] """ _validation = { - "total_count": {"required": True}, - "aggregations": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "execution_time_utc": {"required": True}, + "rule_id": {"required": True}, + "triggered_analytics_rule_run_id": {"required": True}, + "provisioning_state": {"required": True}, } _attribute_map = { - "total_count": {"key": "totalCount", "type": "int"}, - "aggregations": {"key": "aggregations", "type": "[TimelineAggregation]"}, - "errors": {"key": "errors", "type": "[TimelineError]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "execution_time_utc": {"key": "properties.executionTimeUtc", "type": "iso-8601"}, + "rule_id": {"key": "properties.ruleId", "type": "str"}, + "triggered_analytics_rule_run_id": {"key": "properties.triggeredAnalyticsRuleRunId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "rule_run_additional_data": {"key": "properties.ruleRunAdditionalData", "type": "{object}"}, } def __init__( self, *, - total_count: int, - aggregations: List["_models.TimelineAggregation"], - errors: Optional[List["_models.TimelineError"]] = None, - **kwargs - ): + execution_time_utc: datetime.datetime, + rule_id: str, + triggered_analytics_rule_run_id: str, + provisioning_state: Union[str, "_models.ProvisioningState"], + etag: Optional[str] = None, + rule_run_additional_data: Optional[Dict[str, Any]] = None, + **kwargs: Any + ) -> None: """ - :keyword total_count: the total items found for the timeline request. Required. - :paramtype total_count: int - :keyword aggregations: timeline aggregation per kind. Required. - :paramtype aggregations: list[~azure.mgmt.securityinsight.models.TimelineAggregation] - :keyword errors: information about the failure queries. - :paramtype errors: list[~azure.mgmt.securityinsight.models.TimelineError] + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword execution_time_utc: Required. + :paramtype execution_time_utc: ~datetime.datetime + :keyword rule_id: Required. + :paramtype rule_id: str + :keyword triggered_analytics_rule_run_id: Required. + :paramtype triggered_analytics_rule_run_id: str + :keyword provisioning_state: The triggered analytics rule run provisioning state. Required. + Known values are: "Accepted", "InProgress", "Succeeded", "Failed", and "Canceled". + :paramtype provisioning_state: str or ~azure.mgmt.securityinsight.models.ProvisioningState + :keyword rule_run_additional_data: Dictionary of :code:``. + :paramtype rule_run_additional_data: dict[str, any] """ - super().__init__(**kwargs) - self.total_count = total_count - self.aggregations = aggregations - self.errors = errors + super().__init__(etag=etag, **kwargs) + self.execution_time_utc = execution_time_utc + self.rule_id = rule_id + self.triggered_analytics_rule_run_id = triggered_analytics_rule_run_id + self.provisioning_state = provisioning_state + self.rule_run_additional_data = rule_run_additional_data -class TiTaxiiCheckRequirements(DataConnectorsCheckRequirements): - """Threat Intelligence TAXII data connector check requirements. +class TriggeredAnalyticsRuleRuns(_serialization.Model): + """The triggered analytics rule run array. + + 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 kind: Describes the kind of connector to be checked. Required. Known values are: - "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", - "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str + :ivar value: Required. + :vartype value: list[~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun] + :ivar next_link: + :vartype next_link: str """ _validation = { - "kind": {"required": True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "value": {"key": "value", "type": "[TriggeredAnalyticsRuleRun]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, tenant_id: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.TriggeredAnalyticsRuleRun"], **kwargs: Any) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str + :keyword value: Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun] """ super().__init__(**kwargs) - self.kind: str = "ThreatIntelligenceTaxii" - self.tenant_id = tenant_id + self.value = value + self.next_link = None -class TiTaxiiCheckRequirementsProperties(DataConnectorTenantId): - """Threat Intelligence TAXII data connector required properties. +class Ueba(Settings): + """Settings with single toggle. + + 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str + :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.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", + "EntityAnalytics", and "Ueba". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar data_sources: The relevant data sources that enriched by ueba. + :vartype data_sources: list[str or ~azure.mgmt.securityinsight.models.UebaDataSources] """ _validation = { - "tenant_id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "data_sources": {"key": "properties.dataSources", "type": "[str]"}, } - def __init__(self, *, tenant_id: str, **kwargs): + def __init__( + self, + *, + etag: Optional[str] = None, + data_sources: Optional[List[Union[str, "_models.UebaDataSources"]]] = None, + **kwargs: Any + ) -> None: """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword data_sources: The relevant data sources that enriched by ueba. + :paramtype data_sources: list[str or ~azure.mgmt.securityinsight.models.UebaDataSources] """ - super().__init__(tenant_id=tenant_id, **kwargs) + super().__init__(etag=etag, **kwargs) + self.kind: str = "Ueba" + self.data_sources = data_sources -class TiTaxiiDataConnector(DataConnector): # pylint: disable=too-many-instance-attributes - """Data connector to pull Threat intelligence data from TAXII 2.0/2.1 server. +class UrlEntity(Entity): + """Represents a url entity. Variables are only populated by the server, and will be ignored when sending a request. @@ -22835,282 +28508,216 @@ class TiTaxiiDataConnector(DataConnector): # pylint: disable=too-many-instance- :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. - :vartype etag: str - :ivar kind: The data connector kind. Required. Known values are: "AzureActiveDirectory", - "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", - "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", - "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", - "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", and - "IOT". - :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :ivar tenant_id: The tenant id to connect to, and get the data from. - :vartype tenant_id: str - :ivar workspace_id: The workspace id. - :vartype workspace_id: str - :ivar friendly_name: The friendly name for the TAXII server. + :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", + "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", + "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. :vartype friendly_name: str - :ivar taxii_server: The API root for the TAXII server. - :vartype taxii_server: str - :ivar collection_id: The collection id of the TAXII server. - :vartype collection_id: str - :ivar user_name: The userName for the TAXII server. - :vartype user_name: str - :ivar password: The password for the TAXII server. - :vartype password: str - :ivar taxii_lookback_period: The lookback period for the TAXII server. - :vartype taxii_lookback_period: ~datetime.datetime - :ivar polling_frequency: The polling frequency for the TAXII server. Known values are: - "OnceAMinute", "OnceAnHour", and "OnceADay". - :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency - :ivar data_types: The available data types for Threat Intelligence TAXII data connector. - :vartype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes + :ivar url: A full URL the entity points to. + :vartype url: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "kind": {"required": True}, + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "url": {"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"}, + "kind": {"key": "kind", "type": "str"}, + "additional_data": {"key": "properties.additionalData", "type": "{object}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "url": {"key": "properties.url", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.kind: str = "Url" + self.additional_data = None + self.friendly_name = None + self.url = None + + +class UrlEntityProperties(EntityCommonProperties): + """Url entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, any] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar url: A full URL the entity points to. + :vartype url: str + """ + + _validation = { + "additional_data": {"readonly": True}, + "friendly_name": {"readonly": True}, + "url": {"readonly": True}, + } + + _attribute_map = { + "additional_data": {"key": "additionalData", "type": "{object}"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "url": {"key": "url", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.url = None + + +class UserInfo(_serialization.Model): + """User information that made some action. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar email: The email of the user. + :vartype email: str + :ivar name: The name of the user. + :vartype name: str + :ivar object_id: The object id of the user. + :vartype object_id: str """ _validation = { - "id": {"readonly": True}, + "email": {"readonly": True}, "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "kind": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + "email": {"key": "email", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "taxii_server": {"key": "properties.taxiiServer", "type": "str"}, - "collection_id": {"key": "properties.collectionId", "type": "str"}, - "user_name": {"key": "properties.userName", "type": "str"}, - "password": {"key": "properties.password", "type": "str"}, - "taxii_lookback_period": {"key": "properties.taxiiLookbackPeriod", "type": "iso-8601"}, - "polling_frequency": {"key": "properties.pollingFrequency", "type": "str"}, - "data_types": {"key": "properties.dataTypes", "type": "TiTaxiiDataConnectorDataTypes"}, + "object_id": {"key": "objectId", "type": "str"}, } - def __init__( - self, - *, - etag: Optional[str] = None, - tenant_id: Optional[str] = None, - workspace_id: Optional[str] = None, - friendly_name: Optional[str] = None, - taxii_server: Optional[str] = None, - collection_id: Optional[str] = None, - user_name: Optional[str] = None, - password: Optional[str] = None, - taxii_lookback_period: Optional[datetime.datetime] = None, - polling_frequency: Optional[Union[str, "_models.PollingFrequency"]] = None, - data_types: Optional["_models.TiTaxiiDataConnectorDataTypes"] = None, - **kwargs - ): + def __init__(self, *, object_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword tenant_id: The tenant id to connect to, and get the data from. - :paramtype tenant_id: str - :keyword workspace_id: The workspace id. - :paramtype workspace_id: str - :keyword friendly_name: The friendly name for the TAXII server. - :paramtype friendly_name: str - :keyword taxii_server: The API root for the TAXII server. - :paramtype taxii_server: str - :keyword collection_id: The collection id of the TAXII server. - :paramtype collection_id: str - :keyword user_name: The userName for the TAXII server. - :paramtype user_name: str - :keyword password: The password for the TAXII server. - :paramtype password: str - :keyword taxii_lookback_period: The lookback period for the TAXII server. - :paramtype taxii_lookback_period: ~datetime.datetime - :keyword polling_frequency: The polling frequency for the TAXII server. Known values are: - "OnceAMinute", "OnceAnHour", and "OnceADay". - :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency - :keyword data_types: The available data types for Threat Intelligence TAXII data connector. - :paramtype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes + :keyword object_id: The object id of the user. + :paramtype object_id: str """ - super().__init__(etag=etag, **kwargs) - self.kind: str = "ThreatIntelligenceTaxii" - self.tenant_id = tenant_id - self.workspace_id = workspace_id - self.friendly_name = friendly_name - self.taxii_server = taxii_server - self.collection_id = collection_id - self.user_name = user_name - self.password = password - self.taxii_lookback_period = taxii_lookback_period - self.polling_frequency = polling_frequency - self.data_types = data_types + super().__init__(**kwargs) + self.email = None + self.name = None + self.object_id = object_id -class TiTaxiiDataConnectorDataTypes(_serialization.Model): - """The available data types for Threat Intelligence TAXII data connector. +class ValidationError(_serialization.Model): + """Describes an error encountered in the file during validation. - 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 taxii_client: Data type for TAXII connector. Required. - :vartype taxii_client: - ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypesTaxiiClient + :ivar record_index: The number of the record that has the error. + :vartype record_index: int + :ivar error_messages: A list of descriptions of the error. + :vartype error_messages: list[str] """ _validation = { - "taxii_client": {"required": True}, + "error_messages": {"readonly": True}, } _attribute_map = { - "taxii_client": {"key": "taxiiClient", "type": "TiTaxiiDataConnectorDataTypesTaxiiClient"}, + "record_index": {"key": "recordIndex", "type": "int"}, + "error_messages": {"key": "errorMessages", "type": "[str]"}, } - def __init__(self, *, taxii_client: "_models.TiTaxiiDataConnectorDataTypesTaxiiClient", **kwargs): + def __init__(self, *, record_index: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword taxii_client: Data type for TAXII connector. Required. - :paramtype taxii_client: - ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypesTaxiiClient + :keyword record_index: The number of the record that has the error. + :paramtype record_index: int """ super().__init__(**kwargs) - self.taxii_client = taxii_client + self.record_index = record_index + self.error_messages = None -class TiTaxiiDataConnectorDataTypesTaxiiClient(DataConnectorDataTypeCommon): - """Data type for TAXII connector. +class Warning(_serialization.Model): + """Warning response structure. - 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 state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + :ivar warning: Warning data. + :vartype warning: ~azure.mgmt.securityinsight.models.WarningBody """ _validation = { - "state": {"required": True}, + "warning": {"readonly": True}, } _attribute_map = { - "state": {"key": "state", "type": "str"}, + "warning": {"key": "warning", "type": "WarningBody"}, } - def __init__(self, *, state: Union[str, "_models.DataTypeState"], **kwargs): - """ - :keyword state: Describe whether this data type connection is enabled or not. Required. Known - values are: "Enabled" and "Disabled". - :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState - """ - super().__init__(state=state, **kwargs) + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.warning = None -class TiTaxiiDataConnectorProperties(DataConnectorTenantId): - """Threat Intelligence TAXII data connector properties. +class WarningBody(_serialization.Model): + """Warning details. - 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 tenant_id: The tenant id to connect to, and get the data from. Required. - :vartype tenant_id: str - :ivar workspace_id: The workspace id. - :vartype workspace_id: str - :ivar friendly_name: The friendly name for the TAXII server. - :vartype friendly_name: str - :ivar taxii_server: The API root for the TAXII server. - :vartype taxii_server: str - :ivar collection_id: The collection id of the TAXII server. - :vartype collection_id: str - :ivar user_name: The userName for the TAXII server. - :vartype user_name: str - :ivar password: The password for the TAXII server. - :vartype password: str - :ivar taxii_lookback_period: The lookback period for the TAXII server. - :vartype taxii_lookback_period: ~datetime.datetime - :ivar polling_frequency: The polling frequency for the TAXII server. Required. Known values - are: "OnceAMinute", "OnceAnHour", and "OnceADay". - :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency - :ivar data_types: The available data types for Threat Intelligence TAXII data connector. - Required. - :vartype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes + :ivar code: An identifier for the warning. Codes are invariant and are intended to be consumed + programmatically. Known values are: "SourceControlWarning_DeleteServicePrincipal", + "SourceControlWarning_DeletePipelineFromAzureDevOps", + "SourceControlWarning_DeleteWorkflowAndSecretFromGitHub", + "SourceControlWarning_DeleteRoleAssignment", and "SourceControl_DeletedWithWarnings". + :vartype code: str or ~azure.mgmt.securityinsight.models.WarningCode + :ivar message: A message describing the warning, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar details: + :vartype details: list[~azure.mgmt.securityinsight.models.WarningBody] """ _validation = { - "tenant_id": {"required": True}, - "polling_frequency": {"required": True}, - "data_types": {"required": True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "details": {"readonly": True}, } _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "workspace_id": {"key": "workspaceId", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "taxii_server": {"key": "taxiiServer", "type": "str"}, - "collection_id": {"key": "collectionId", "type": "str"}, - "user_name": {"key": "userName", "type": "str"}, - "password": {"key": "password", "type": "str"}, - "taxii_lookback_period": {"key": "taxiiLookbackPeriod", "type": "iso-8601"}, - "polling_frequency": {"key": "pollingFrequency", "type": "str"}, - "data_types": {"key": "dataTypes", "type": "TiTaxiiDataConnectorDataTypes"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[WarningBody]"}, } - def __init__( - self, - *, - tenant_id: str, - polling_frequency: Union[str, "_models.PollingFrequency"], - data_types: "_models.TiTaxiiDataConnectorDataTypes", - workspace_id: Optional[str] = None, - friendly_name: Optional[str] = None, - taxii_server: Optional[str] = None, - collection_id: Optional[str] = None, - user_name: Optional[str] = None, - password: Optional[str] = None, - taxii_lookback_period: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword tenant_id: The tenant id to connect to, and get the data from. Required. - :paramtype tenant_id: str - :keyword workspace_id: The workspace id. - :paramtype workspace_id: str - :keyword friendly_name: The friendly name for the TAXII server. - :paramtype friendly_name: str - :keyword taxii_server: The API root for the TAXII server. - :paramtype taxii_server: str - :keyword collection_id: The collection id of the TAXII server. - :paramtype collection_id: str - :keyword user_name: The userName for the TAXII server. - :paramtype user_name: str - :keyword password: The password for the TAXII server. - :paramtype password: str - :keyword taxii_lookback_period: The lookback period for the TAXII server. - :paramtype taxii_lookback_period: ~datetime.datetime - :keyword polling_frequency: The polling frequency for the TAXII server. Required. Known values - are: "OnceAMinute", "OnceAnHour", and "OnceADay". - :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency - :keyword data_types: The available data types for Threat Intelligence TAXII data connector. - Required. - :paramtype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes - """ - super().__init__(tenant_id=tenant_id, **kwargs) - self.workspace_id = workspace_id - self.friendly_name = friendly_name - self.taxii_server = taxii_server - self.collection_id = collection_id - self.user_name = user_name - self.password = password - self.taxii_lookback_period = taxii_lookback_period - self.polling_frequency = polling_frequency - self.data_types = data_types + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.details = None -class Ueba(Settings): - """Settings with single toggle. +class Watchlist(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Represents a Watchlist in Azure Security Insights. 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 @@ -23124,11 +28731,55 @@ class Ueba(Settings): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: The kind of the setting. Required. Known values are: "Anomalies", "EyesOn", - "EntityAnalytics", and "Ueba". - :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind - :ivar data_sources: The relevant data sources that enriched by ueba. - :vartype data_sources: list[str or ~azure.mgmt.securityinsight.models.UebaDataSources] + :ivar watchlist_id: The id (a Guid) of the watchlist. + :vartype watchlist_id: str + :ivar display_name: The display name of the watchlist. + :vartype display_name: str + :ivar provider: The provider of the watchlist. + :vartype provider: str + :ivar source: The filename of the watchlist, called 'source'. + :vartype source: str + :ivar source_type: The sourceType of the watchlist. Known values are: "Local file" and "Remote + storage". + :vartype source_type: str or ~azure.mgmt.securityinsight.models.SourceType + :ivar created: The time the watchlist was created. + :vartype created: ~datetime.datetime + :ivar updated: The last time the watchlist was updated. + :vartype updated: ~datetime.datetime + :ivar created_by: Describes a user that created the watchlist. + :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar updated_by: Describes a user that updated the watchlist. + :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar description: A description of the watchlist. + :vartype description: str + :ivar watchlist_type: The type of the watchlist. + :vartype watchlist_type: str + :ivar watchlist_alias: The alias of the watchlist. + :vartype watchlist_alias: str + :ivar is_deleted: A flag that indicates if the watchlist is deleted or not. + :vartype is_deleted: bool + :ivar labels: List of labels relevant to this watchlist. + :vartype labels: list[str] + :ivar default_duration: The default duration of a watchlist (in ISO 8601 duration format). + :vartype default_duration: ~datetime.timedelta + :ivar tenant_id: The tenantId where the watchlist belongs to. + :vartype tenant_id: str + :ivar number_of_lines_to_skip: The number of lines in a csv/tsv content to skip before the + header. + :vartype number_of_lines_to_skip: int + :ivar raw_content: The raw content that represents to watchlist items to create. In case of + csv/tsv content type, it's the content of the file that will parsed by the endpoint. + :vartype raw_content: str + :ivar items_search_key: The search key is used to optimize query performance when using + watchlists for joins with other data. For example, enable a column with IP addresses to be the + designated SearchKey field, then use this field as the key field when joining to other event + data by IP address. + :vartype items_search_key: str + :ivar content_type: The content type of the raw content. Example : text/csv or text/tsv. + :vartype content_type: str + :ivar upload_status: The status of the Watchlist upload : New, InProgress or Complete. Pls note + : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. + :vartype upload_status: str """ _validation = { @@ -23136,7 +28787,6 @@ class Ueba(Settings): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, } _attribute_map = { @@ -23145,35 +28795,138 @@ class Ueba(Settings): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "data_sources": {"key": "properties.dataSources", "type": "[str]"}, + "watchlist_id": {"key": "properties.watchlistId", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "provider": {"key": "properties.provider", "type": "str"}, + "source": {"key": "properties.source", "type": "str"}, + "source_type": {"key": "properties.sourceType", "type": "str"}, + "created": {"key": "properties.created", "type": "iso-8601"}, + "updated": {"key": "properties.updated", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, + "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, + "description": {"key": "properties.description", "type": "str"}, + "watchlist_type": {"key": "properties.watchlistType", "type": "str"}, + "watchlist_alias": {"key": "properties.watchlistAlias", "type": "str"}, + "is_deleted": {"key": "properties.isDeleted", "type": "bool"}, + "labels": {"key": "properties.labels", "type": "[str]"}, + "default_duration": {"key": "properties.defaultDuration", "type": "duration"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "number_of_lines_to_skip": {"key": "properties.numberOfLinesToSkip", "type": "int"}, + "raw_content": {"key": "properties.rawContent", "type": "str"}, + "items_search_key": {"key": "properties.itemsSearchKey", "type": "str"}, + "content_type": {"key": "properties.contentType", "type": "str"}, + "upload_status": {"key": "properties.uploadStatus", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, etag: Optional[str] = None, - data_sources: Optional[List[Union[str, "_models.UebaDataSources"]]] = None, - **kwargs - ): + watchlist_id: Optional[str] = None, + display_name: Optional[str] = None, + provider: Optional[str] = None, + source: Optional[str] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, + created: Optional[datetime.datetime] = None, + updated: Optional[datetime.datetime] = None, + created_by: Optional["_models.UserInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, + description: Optional[str] = None, + watchlist_type: Optional[str] = None, + watchlist_alias: Optional[str] = None, + is_deleted: Optional[bool] = None, + labels: Optional[List[str]] = None, + default_duration: Optional[datetime.timedelta] = None, + tenant_id: Optional[str] = None, + number_of_lines_to_skip: Optional[int] = None, + raw_content: Optional[str] = None, + items_search_key: Optional[str] = None, + content_type: Optional[str] = None, + upload_status: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword data_sources: The relevant data sources that enriched by ueba. - :paramtype data_sources: list[str or ~azure.mgmt.securityinsight.models.UebaDataSources] + :keyword watchlist_id: The id (a Guid) of the watchlist. + :paramtype watchlist_id: str + :keyword display_name: The display name of the watchlist. + :paramtype display_name: str + :keyword provider: The provider of the watchlist. + :paramtype provider: str + :keyword source: The filename of the watchlist, called 'source'. + :paramtype source: str + :keyword source_type: The sourceType of the watchlist. Known values are: "Local file" and + "Remote storage". + :paramtype source_type: str or ~azure.mgmt.securityinsight.models.SourceType + :keyword created: The time the watchlist was created. + :paramtype created: ~datetime.datetime + :keyword updated: The last time the watchlist was updated. + :paramtype updated: ~datetime.datetime + :keyword created_by: Describes a user that created the watchlist. + :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword updated_by: Describes a user that updated the watchlist. + :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword description: A description of the watchlist. + :paramtype description: str + :keyword watchlist_type: The type of the watchlist. + :paramtype watchlist_type: str + :keyword watchlist_alias: The alias of the watchlist. + :paramtype watchlist_alias: str + :keyword is_deleted: A flag that indicates if the watchlist is deleted or not. + :paramtype is_deleted: bool + :keyword labels: List of labels relevant to this watchlist. + :paramtype labels: list[str] + :keyword default_duration: The default duration of a watchlist (in ISO 8601 duration format). + :paramtype default_duration: ~datetime.timedelta + :keyword tenant_id: The tenantId where the watchlist belongs to. + :paramtype tenant_id: str + :keyword number_of_lines_to_skip: The number of lines in a csv/tsv content to skip before the + header. + :paramtype number_of_lines_to_skip: int + :keyword raw_content: The raw content that represents to watchlist items to create. In case of + csv/tsv content type, it's the content of the file that will parsed by the endpoint. + :paramtype raw_content: str + :keyword items_search_key: The search key is used to optimize query performance when using + watchlists for joins with other data. For example, enable a column with IP addresses to be the + designated SearchKey field, then use this field as the key field when joining to other event + data by IP address. + :paramtype items_search_key: str + :keyword content_type: The content type of the raw content. Example : text/csv or text/tsv. + :paramtype content_type: str + :keyword upload_status: The status of the Watchlist upload : New, InProgress or Complete. Pls + note : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. + :paramtype upload_status: str """ super().__init__(etag=etag, **kwargs) - self.kind: str = "Ueba" - self.data_sources = data_sources + self.watchlist_id = watchlist_id + self.display_name = display_name + self.provider = provider + self.source = source + self.source_type = source_type + self.created = created + self.updated = updated + self.created_by = created_by + self.updated_by = updated_by + self.description = description + self.watchlist_type = watchlist_type + self.watchlist_alias = watchlist_alias + self.is_deleted = is_deleted + self.labels = labels + self.default_duration = default_duration + self.tenant_id = tenant_id + self.number_of_lines_to_skip = number_of_lines_to_skip + self.raw_content = raw_content + self.items_search_key = items_search_key + self.content_type = content_type + self.upload_status = upload_status -class UrlEntity(Entity): - """Represents a url entity. +class WatchlistItem(ResourceWithEtag): # pylint: disable=too-many-instance-attributes + """Represents a Watchlist item in Azure Security Insights. 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 @@ -23185,19 +28938,28 @@ class UrlEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: The kind of the entity. Required. Known values are: "Account", "Host", "File", - "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", "Process", - "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", - "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail", and "Nic". - :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar url: A full URL the entity points to. - :vartype url: str + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar watchlist_item_type: The type of the watchlist item. + :vartype watchlist_item_type: str + :ivar watchlist_item_id: The id (a Guid) of the watchlist item. + :vartype watchlist_item_id: str + :ivar tenant_id: The tenantId to which the watchlist item belongs to. + :vartype tenant_id: str + :ivar is_deleted: A flag that indicates if the watchlist item is deleted or not. + :vartype is_deleted: bool + :ivar created: The time the watchlist item was created. + :vartype created: ~datetime.datetime + :ivar updated: The last time the watchlist item was updated. + :vartype updated: ~datetime.datetime + :ivar created_by: Describes a user that created the watchlist item. + :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar updated_by: Describes a user that updated the watchlist item. + :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar items_key_value: key-value pairs for a watchlist item. + :vartype items_key_value: dict[str, any] + :ivar entity_mapping: key-value pairs for a watchlist item entity mapping. + :vartype entity_mapping: dict[str, any] """ _validation = { @@ -23205,10 +28967,6 @@ class UrlEntity(Entity): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "kind": {"required": True}, - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "url": {"readonly": True}, } _attribute_map = { @@ -23216,121 +28974,181 @@ class UrlEntity(Entity): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "kind": {"key": "kind", "type": "str"}, - "additional_data": {"key": "properties.additionalData", "type": "{object}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "url": {"key": "properties.url", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "watchlist_item_type": {"key": "properties.watchlistItemType", "type": "str"}, + "watchlist_item_id": {"key": "properties.watchlistItemId", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "is_deleted": {"key": "properties.isDeleted", "type": "bool"}, + "created": {"key": "properties.created", "type": "iso-8601"}, + "updated": {"key": "properties.updated", "type": "iso-8601"}, + "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, + "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, + "items_key_value": {"key": "properties.itemsKeyValue", "type": "{object}"}, + "entity_mapping": {"key": "properties.entityMapping", "type": "{object}"}, } - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.kind: str = "Url" - self.additional_data = None - self.friendly_name = None - self.url = None + def __init__( + self, + *, + etag: Optional[str] = None, + watchlist_item_type: Optional[str] = None, + watchlist_item_id: Optional[str] = None, + tenant_id: Optional[str] = None, + is_deleted: Optional[bool] = None, + created: Optional[datetime.datetime] = None, + updated: Optional[datetime.datetime] = None, + created_by: Optional["_models.UserInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, + items_key_value: Optional[Dict[str, Any]] = None, + entity_mapping: Optional[Dict[str, Any]] = None, + **kwargs: Any + ) -> None: + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword watchlist_item_type: The type of the watchlist item. + :paramtype watchlist_item_type: str + :keyword watchlist_item_id: The id (a Guid) of the watchlist item. + :paramtype watchlist_item_id: str + :keyword tenant_id: The tenantId to which the watchlist item belongs to. + :paramtype tenant_id: str + :keyword is_deleted: A flag that indicates if the watchlist item is deleted or not. + :paramtype is_deleted: bool + :keyword created: The time the watchlist item was created. + :paramtype created: ~datetime.datetime + :keyword updated: The last time the watchlist item was updated. + :paramtype updated: ~datetime.datetime + :keyword created_by: Describes a user that created the watchlist item. + :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword updated_by: Describes a user that updated the watchlist item. + :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword items_key_value: key-value pairs for a watchlist item. + :paramtype items_key_value: dict[str, any] + :keyword entity_mapping: key-value pairs for a watchlist item entity mapping. + :paramtype entity_mapping: dict[str, any] + """ + super().__init__(etag=etag, **kwargs) + self.watchlist_item_type = watchlist_item_type + self.watchlist_item_id = watchlist_item_id + self.tenant_id = tenant_id + self.is_deleted = is_deleted + self.created = created + self.updated = updated + self.created_by = created_by + self.updated_by = updated_by + self.items_key_value = items_key_value + self.entity_mapping = entity_mapping -class UrlEntityProperties(EntityCommonProperties): - """Url entity property bag. +class WatchlistItemList(_serialization.Model): + """List all the watchlist items. Variables are only populated by the server, and will be ignored when sending a request. - :ivar additional_data: A bag of custom fields that should be part of the entity and will be - presented to the user. - :vartype additional_data: dict[str, any] - :ivar friendly_name: The graph item display name which is a short humanly readable description - of the graph item instance. This property is optional and might be system generated. - :vartype friendly_name: str - :ivar url: A full URL the entity points to. - :vartype url: str + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of watchlist item. + :vartype next_link: str + :ivar value: Array of watchlist items. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.WatchlistItem] """ _validation = { - "additional_data": {"readonly": True}, - "friendly_name": {"readonly": True}, - "url": {"readonly": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "additional_data": {"key": "additionalData", "type": "{object}"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "url": {"key": "url", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WatchlistItem]"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, value: List["_models.WatchlistItem"], **kwargs: Any) -> None: + """ + :keyword value: Array of watchlist items. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.WatchlistItem] + """ super().__init__(**kwargs) - self.url = None + self.next_link = None + self.value = value -class UserInfo(_serialization.Model): - """User information that made some action. +class WatchlistList(_serialization.Model): + """List all the watchlists. Variables are only populated by the server, and will be ignored when sending a request. - :ivar email: The email of the user. - :vartype email: str - :ivar name: The name of the user. - :vartype name: str - :ivar object_id: The object id of the user. - :vartype object_id: str + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of watchlists. + :vartype next_link: str + :ivar value: Array of watchlist. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.Watchlist] """ _validation = { - "email": {"readonly": True}, - "name": {"readonly": True}, + "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "email": {"key": "email", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Watchlist]"}, } - def __init__(self, *, object_id: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Watchlist"], **kwargs: Any) -> None: """ - :keyword object_id: The object id of the user. - :paramtype object_id: str + :keyword value: Array of watchlist. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.Watchlist] """ super().__init__(**kwargs) - self.email = None - self.name = None - self.object_id = object_id + self.next_link = None + self.value = value -class ValidationError(_serialization.Model): - """Describes an error encountered in the file during validation. +class Webhook(_serialization.Model): + """Detail about the webhook object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar record_index: The number of the record that has the error. - :vartype record_index: int - :ivar error_messages: A list of descriptions of the error. - :vartype error_messages: list[str] + :ivar webhook_id: Unique identifier for the webhook. + :vartype webhook_id: str + :ivar webhook_url: URL that gets invoked by the webhook. + :vartype webhook_url: str + :ivar webhook_secret_update_time: Time when the webhook secret was updated. + :vartype webhook_secret_update_time: ~datetime.datetime + :ivar rotate_webhook_secret: A flag to instruct the backend service to rotate webhook secret. + :vartype rotate_webhook_secret: bool """ _validation = { - "error_messages": {"readonly": True}, + "webhook_id": {"readonly": True}, + "webhook_url": {"readonly": True}, + "webhook_secret_update_time": {"readonly": True}, } _attribute_map = { - "record_index": {"key": "recordIndex", "type": "int"}, - "error_messages": {"key": "errorMessages", "type": "[str]"}, + "webhook_id": {"key": "webhookId", "type": "str"}, + "webhook_url": {"key": "webhookUrl", "type": "str"}, + "webhook_secret_update_time": {"key": "webhookSecretUpdateTime", "type": "iso-8601"}, + "rotate_webhook_secret": {"key": "rotateWebhookSecret", "type": "bool"}, } - def __init__(self, *, record_index: Optional[int] = None, **kwargs): + def __init__(self, *, rotate_webhook_secret: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword record_index: The number of the record that has the error. - :paramtype record_index: int + :keyword rotate_webhook_secret: A flag to instruct the backend service to rotate webhook + secret. + :paramtype rotate_webhook_secret: bool """ super().__init__(**kwargs) - self.record_index = record_index - self.error_messages = None + self.webhook_id = None + self.webhook_url = None + self.webhook_secret_update_time = None + self.rotate_webhook_secret = rotate_webhook_secret -class Watchlist(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """Represents a Watchlist in Azure Security Insights. +class WorkspaceManagerAssignment(AzureEntityResource): + """The workspace manager assignment. Variables are only populated by the server, and will be ignored when sending a request. @@ -23345,57 +29163,19 @@ class Watchlist(ResourceWithEtag): # pylint: disable=too-many-instance-attribut :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. + :ivar etag: Resource Etag. :vartype etag: str - :ivar watchlist_id: The id (a Guid) of the watchlist. - :vartype watchlist_id: str - :ivar display_name: The display name of the watchlist. - :vartype display_name: str - :ivar provider: The provider of the watchlist. - :vartype provider: str - :ivar source: The filename of the watchlist, called 'source'. - :vartype source: str - :ivar source_type: The sourceType of the watchlist. Known values are: "Local file" and "Remote - storage". - :vartype source_type: str or ~azure.mgmt.securityinsight.models.SourceType - :ivar created: The time the watchlist was created. - :vartype created: ~datetime.datetime - :ivar updated: The last time the watchlist was updated. - :vartype updated: ~datetime.datetime - :ivar created_by: Describes a user that created the watchlist. - :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar updated_by: Describes a user that updated the watchlist. - :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar description: A description of the watchlist. - :vartype description: str - :ivar watchlist_type: The type of the watchlist. - :vartype watchlist_type: str - :ivar watchlist_alias: The alias of the watchlist. - :vartype watchlist_alias: str - :ivar is_deleted: A flag that indicates if the watchlist is deleted or not. - :vartype is_deleted: bool - :ivar labels: List of labels relevant to this watchlist. - :vartype labels: list[str] - :ivar default_duration: The default duration of a watchlist (in ISO 8601 duration format). - :vartype default_duration: ~datetime.timedelta - :ivar tenant_id: The tenantId where the watchlist belongs to. - :vartype tenant_id: str - :ivar number_of_lines_to_skip: The number of lines in a csv/tsv content to skip before the - header. - :vartype number_of_lines_to_skip: int - :ivar raw_content: The raw content that represents to watchlist items to create. In case of - csv/tsv content type, it's the content of the file that will parsed by the endpoint. - :vartype raw_content: str - :ivar items_search_key: The search key is used to optimize query performance when using - watchlists for joins with other data. For example, enable a column with IP addresses to be the - designated SearchKey field, then use this field as the key field when joining to other event - data by IP address. - :vartype items_search_key: str - :ivar content_type: The content type of the raw content. Example : text/csv or text/tsv. - :vartype content_type: str - :ivar upload_status: The status of the Watchlist upload : New, InProgress or Complete. Pls note - : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. - :vartype upload_status: str + :ivar target_resource_name: The resource name of the workspace manager group targeted by the + workspace manager assignment. + :vartype target_resource_name: str + :ivar last_job_end_time: The time the last job associated to this assignment ended at. + :vartype last_job_end_time: ~datetime.datetime + :ivar last_job_provisioning_state: State of the last job associated to this assignment. Known + values are: "Accepted", "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype last_job_provisioning_state: str or + ~azure.mgmt.securityinsight.models.ProvisioningState + :ivar items: List of resources included in this workspace manager assignment. + :vartype items: list[~azure.mgmt.securityinsight.models.AssignmentItem] """ _validation = { @@ -23403,6 +29183,9 @@ class Watchlist(ResourceWithEtag): # pylint: disable=too-many-instance-attribut "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "etag": {"readonly": True}, + "last_job_end_time": {"readonly": True}, + "last_job_provisioning_state": {"readonly": True}, } _attribute_map = { @@ -23411,135 +29194,68 @@ class Watchlist(ResourceWithEtag): # pylint: disable=too-many-instance-attribut "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "watchlist_id": {"key": "properties.watchlistId", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "provider": {"key": "properties.provider", "type": "str"}, - "source": {"key": "properties.source", "type": "str"}, - "source_type": {"key": "properties.sourceType", "type": "str"}, - "created": {"key": "properties.created", "type": "iso-8601"}, - "updated": {"key": "properties.updated", "type": "iso-8601"}, - "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, - "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, - "description": {"key": "properties.description", "type": "str"}, - "watchlist_type": {"key": "properties.watchlistType", "type": "str"}, - "watchlist_alias": {"key": "properties.watchlistAlias", "type": "str"}, - "is_deleted": {"key": "properties.isDeleted", "type": "bool"}, - "labels": {"key": "properties.labels", "type": "[str]"}, - "default_duration": {"key": "properties.defaultDuration", "type": "duration"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "number_of_lines_to_skip": {"key": "properties.numberOfLinesToSkip", "type": "int"}, - "raw_content": {"key": "properties.rawContent", "type": "str"}, - "items_search_key": {"key": "properties.itemsSearchKey", "type": "str"}, - "content_type": {"key": "properties.contentType", "type": "str"}, - "upload_status": {"key": "properties.uploadStatus", "type": "str"}, + "target_resource_name": {"key": "properties.targetResourceName", "type": "str"}, + "last_job_end_time": {"key": "properties.lastJobEndTime", "type": "iso-8601"}, + "last_job_provisioning_state": {"key": "properties.lastJobProvisioningState", "type": "str"}, + "items": {"key": "properties.items", "type": "[AssignmentItem]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - etag: Optional[str] = None, - watchlist_id: Optional[str] = None, - display_name: Optional[str] = None, - provider: Optional[str] = None, - source: Optional[str] = None, - source_type: Optional[Union[str, "_models.SourceType"]] = None, - created: Optional[datetime.datetime] = None, - updated: Optional[datetime.datetime] = None, - created_by: Optional["_models.UserInfo"] = None, - updated_by: Optional["_models.UserInfo"] = None, - description: Optional[str] = None, - watchlist_type: Optional[str] = None, - watchlist_alias: Optional[str] = None, - is_deleted: Optional[bool] = None, - labels: Optional[List[str]] = None, - default_duration: Optional[datetime.timedelta] = None, - tenant_id: Optional[str] = None, - number_of_lines_to_skip: Optional[int] = None, - raw_content: Optional[str] = None, - items_search_key: Optional[str] = None, - content_type: Optional[str] = None, - upload_status: Optional[str] = None, - **kwargs - ): + target_resource_name: Optional[str] = None, + items: Optional[List["_models.AssignmentItem"]] = None, + **kwargs: Any + ) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword watchlist_id: The id (a Guid) of the watchlist. - :paramtype watchlist_id: str - :keyword display_name: The display name of the watchlist. - :paramtype display_name: str - :keyword provider: The provider of the watchlist. - :paramtype provider: str - :keyword source: The filename of the watchlist, called 'source'. - :paramtype source: str - :keyword source_type: The sourceType of the watchlist. Known values are: "Local file" and - "Remote storage". - :paramtype source_type: str or ~azure.mgmt.securityinsight.models.SourceType - :keyword created: The time the watchlist was created. - :paramtype created: ~datetime.datetime - :keyword updated: The last time the watchlist was updated. - :paramtype updated: ~datetime.datetime - :keyword created_by: Describes a user that created the watchlist. - :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword updated_by: Describes a user that updated the watchlist. - :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword description: A description of the watchlist. - :paramtype description: str - :keyword watchlist_type: The type of the watchlist. - :paramtype watchlist_type: str - :keyword watchlist_alias: The alias of the watchlist. - :paramtype watchlist_alias: str - :keyword is_deleted: A flag that indicates if the watchlist is deleted or not. - :paramtype is_deleted: bool - :keyword labels: List of labels relevant to this watchlist. - :paramtype labels: list[str] - :keyword default_duration: The default duration of a watchlist (in ISO 8601 duration format). - :paramtype default_duration: ~datetime.timedelta - :keyword tenant_id: The tenantId where the watchlist belongs to. - :paramtype tenant_id: str - :keyword number_of_lines_to_skip: The number of lines in a csv/tsv content to skip before the - header. - :paramtype number_of_lines_to_skip: int - :keyword raw_content: The raw content that represents to watchlist items to create. In case of - csv/tsv content type, it's the content of the file that will parsed by the endpoint. - :paramtype raw_content: str - :keyword items_search_key: The search key is used to optimize query performance when using - watchlists for joins with other data. For example, enable a column with IP addresses to be the - designated SearchKey field, then use this field as the key field when joining to other event - data by IP address. - :paramtype items_search_key: str - :keyword content_type: The content type of the raw content. Example : text/csv or text/tsv. - :paramtype content_type: str - :keyword upload_status: The status of the Watchlist upload : New, InProgress or Complete. Pls - note : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. - :paramtype upload_status: str + :keyword target_resource_name: The resource name of the workspace manager group targeted by the + workspace manager assignment. + :paramtype target_resource_name: str + :keyword items: List of resources included in this workspace manager assignment. + :paramtype items: list[~azure.mgmt.securityinsight.models.AssignmentItem] + """ + super().__init__(**kwargs) + self.target_resource_name = target_resource_name + self.last_job_end_time = None + self.last_job_provisioning_state = None + self.items = items + + +class WorkspaceManagerAssignmentList(_serialization.Model): + """List of all the workspace manager assignments. + + 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 next_link: URL to fetch the next set of workspace manager assignments. + :vartype next_link: str + :ivar value: Array of workspace manager assignments. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment] + """ + + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WorkspaceManagerAssignment]"}, + } + + def __init__(self, *, value: List["_models.WorkspaceManagerAssignment"], **kwargs: Any) -> None: """ - super().__init__(etag=etag, **kwargs) - self.watchlist_id = watchlist_id - self.display_name = display_name - self.provider = provider - self.source = source - self.source_type = source_type - self.created = created - self.updated = updated - self.created_by = created_by - self.updated_by = updated_by - self.description = description - self.watchlist_type = watchlist_type - self.watchlist_alias = watchlist_alias - self.is_deleted = is_deleted - self.labels = labels - self.default_duration = default_duration - self.tenant_id = tenant_id - self.number_of_lines_to_skip = number_of_lines_to_skip - self.raw_content = raw_content - self.items_search_key = items_search_key - self.content_type = content_type - self.upload_status = upload_status + :keyword value: Array of workspace manager assignments. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment] + """ + super().__init__(**kwargs) + self.next_link = None + self.value = value -class WatchlistItem(ResourceWithEtag): # pylint: disable=too-many-instance-attributes - """Represents a Watchlist item in Azure Security Insights. +class WorkspaceManagerConfiguration(AzureEntityResource): + """The workspace manager configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -23554,28 +29270,11 @@ class WatchlistItem(ResourceWithEtag): # pylint: disable=too-many-instance-attr :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar etag: Etag of the azure resource. + :ivar etag: Resource Etag. :vartype etag: str - :ivar watchlist_item_type: The type of the watchlist item. - :vartype watchlist_item_type: str - :ivar watchlist_item_id: The id (a Guid) of the watchlist item. - :vartype watchlist_item_id: str - :ivar tenant_id: The tenantId to which the watchlist item belongs to. - :vartype tenant_id: str - :ivar is_deleted: A flag that indicates if the watchlist item is deleted or not. - :vartype is_deleted: bool - :ivar created: The time the watchlist item was created. - :vartype created: ~datetime.datetime - :ivar updated: The last time the watchlist item was updated. - :vartype updated: ~datetime.datetime - :ivar created_by: Describes a user that created the watchlist item. - :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar updated_by: Describes a user that updated the watchlist item. - :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :ivar items_key_value: key-value pairs for a watchlist item. - :vartype items_key_value: dict[str, any] - :ivar entity_mapping: key-value pairs for a watchlist item entity mapping. - :vartype entity_mapping: dict[str, any] + :ivar mode: The current mode of the workspace manager configuration. Known values are: + "Enabled" and "Disabled". + :vartype mode: str or ~azure.mgmt.securityinsight.models.Mode """ _validation = { @@ -23583,6 +29282,7 @@ class WatchlistItem(ResourceWithEtag): # pylint: disable=too-many-instance-attr "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "etag": {"readonly": True}, } _attribute_map = { @@ -23591,82 +29291,30 @@ class WatchlistItem(ResourceWithEtag): # pylint: disable=too-many-instance-attr "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "etag": {"key": "etag", "type": "str"}, - "watchlist_item_type": {"key": "properties.watchlistItemType", "type": "str"}, - "watchlist_item_id": {"key": "properties.watchlistItemId", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "is_deleted": {"key": "properties.isDeleted", "type": "bool"}, - "created": {"key": "properties.created", "type": "iso-8601"}, - "updated": {"key": "properties.updated", "type": "iso-8601"}, - "created_by": {"key": "properties.createdBy", "type": "UserInfo"}, - "updated_by": {"key": "properties.updatedBy", "type": "UserInfo"}, - "items_key_value": {"key": "properties.itemsKeyValue", "type": "{object}"}, - "entity_mapping": {"key": "properties.entityMapping", "type": "{object}"}, + "mode": {"key": "properties.mode", "type": "str"}, } - def __init__( - self, - *, - etag: Optional[str] = None, - watchlist_item_type: Optional[str] = None, - watchlist_item_id: Optional[str] = None, - tenant_id: Optional[str] = None, - is_deleted: Optional[bool] = None, - created: Optional[datetime.datetime] = None, - updated: Optional[datetime.datetime] = None, - created_by: Optional["_models.UserInfo"] = None, - updated_by: Optional["_models.UserInfo"] = None, - items_key_value: Optional[Dict[str, Any]] = None, - entity_mapping: Optional[Dict[str, Any]] = None, - **kwargs - ): + def __init__(self, *, mode: Optional[Union[str, "_models.Mode"]] = None, **kwargs: Any) -> None: """ - :keyword etag: Etag of the azure resource. - :paramtype etag: str - :keyword watchlist_item_type: The type of the watchlist item. - :paramtype watchlist_item_type: str - :keyword watchlist_item_id: The id (a Guid) of the watchlist item. - :paramtype watchlist_item_id: str - :keyword tenant_id: The tenantId to which the watchlist item belongs to. - :paramtype tenant_id: str - :keyword is_deleted: A flag that indicates if the watchlist item is deleted or not. - :paramtype is_deleted: bool - :keyword created: The time the watchlist item was created. - :paramtype created: ~datetime.datetime - :keyword updated: The last time the watchlist item was updated. - :paramtype updated: ~datetime.datetime - :keyword created_by: Describes a user that created the watchlist item. - :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword updated_by: Describes a user that updated the watchlist item. - :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo - :keyword items_key_value: key-value pairs for a watchlist item. - :paramtype items_key_value: dict[str, any] - :keyword entity_mapping: key-value pairs for a watchlist item entity mapping. - :paramtype entity_mapping: dict[str, any] + :keyword mode: The current mode of the workspace manager configuration. Known values are: + "Enabled" and "Disabled". + :paramtype mode: str or ~azure.mgmt.securityinsight.models.Mode """ - super().__init__(etag=etag, **kwargs) - self.watchlist_item_type = watchlist_item_type - self.watchlist_item_id = watchlist_item_id - self.tenant_id = tenant_id - self.is_deleted = is_deleted - self.created = created - self.updated = updated - self.created_by = created_by - self.updated_by = updated_by - self.items_key_value = items_key_value - self.entity_mapping = entity_mapping + super().__init__(**kwargs) + self.mode = mode -class WatchlistItemList(_serialization.Model): - """List all the watchlist items. +class WorkspaceManagerConfigurationList(_serialization.Model): + """List all the workspace manager configurations for the 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 Azure. - :ivar next_link: URL to fetch the next set of watchlist item. + :ivar next_link: URL to fetch the next set of workspace manager configurations. :vartype next_link: str - :ivar value: Array of watchlist items. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.WatchlistItem] + :ivar value: Array of workspace manager configurations. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration] """ _validation = { @@ -23676,30 +29324,99 @@ class WatchlistItemList(_serialization.Model): _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[WatchlistItem]"}, + "value": {"key": "value", "type": "[WorkspaceManagerConfiguration]"}, } - def __init__(self, *, value: List["_models.WatchlistItem"], **kwargs): + def __init__(self, *, value: List["_models.WorkspaceManagerConfiguration"], **kwargs: Any) -> None: """ - :keyword value: Array of watchlist items. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.WatchlistItem] + :keyword value: Array of workspace manager configurations. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration] """ super().__init__(**kwargs) self.next_link = None self.value = value -class WatchlistList(_serialization.Model): - """List all the watchlists. +class WorkspaceManagerGroup(AzureEntityResource): + """The workspace manager group. + + 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.securityinsight.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar description: The description of the workspace manager group. + :vartype description: str + :ivar display_name: The display name of the workspace manager group. + :vartype display_name: str + :ivar member_resource_names: The names of the workspace manager members participating in this + group. + :vartype member_resource_names: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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"}, + "etag": {"key": "etag", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "member_resource_names": {"key": "properties.memberResourceNames", "type": "[str]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + display_name: Optional[str] = None, + member_resource_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The description of the workspace manager group. + :paramtype description: str + :keyword display_name: The display name of the workspace manager group. + :paramtype display_name: str + :keyword member_resource_names: The names of the workspace manager members participating in + this group. + :paramtype member_resource_names: list[str] + """ + super().__init__(**kwargs) + self.description = description + self.display_name = display_name + self.member_resource_names = member_resource_names + + +class WorkspaceManagerGroupList(_serialization.Model): + """List of all the workspace manager groups. 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 next_link: URL to fetch the next set of watchlists. + :ivar next_link: URL to fetch the next set of workspace manager groups. :vartype next_link: str - :ivar value: Array of watchlist. Required. - :vartype value: list[~azure.mgmt.securityinsight.models.Watchlist] + :ivar value: Array of workspace manager groups. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerGroup] """ _validation = { @@ -23709,61 +29426,111 @@ class WatchlistList(_serialization.Model): _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Watchlist]"}, + "value": {"key": "value", "type": "[WorkspaceManagerGroup]"}, } - def __init__(self, *, value: List["_models.Watchlist"], **kwargs): + def __init__(self, *, value: List["_models.WorkspaceManagerGroup"], **kwargs: Any) -> None: """ - :keyword value: Array of watchlist. Required. - :paramtype value: list[~azure.mgmt.securityinsight.models.Watchlist] + :keyword value: Array of workspace manager groups. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerGroup] """ super().__init__(**kwargs) self.next_link = None self.value = value -class Webhook(_serialization.Model): - """Detail about the webhook object. +class WorkspaceManagerMember(AzureEntityResource): + """The workspace manager member. - :ivar webhook_id: Unique identifier for the webhook. - :vartype webhook_id: str - :ivar webhook_url: URL that gets invoked by the webhook. - :vartype webhook_url: str - :ivar webhook_secret_update_time: Time when the webhook secret was updated. - :vartype webhook_secret_update_time: str - :ivar rotate_webhook_secret: A flag to instruct the backend service to rotate webhook secret. - :vartype rotate_webhook_secret: bool + 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.securityinsight.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar target_workspace_resource_id: Fully qualified resource ID of the target Sentinel + workspace joining the given Sentinel workspace manager. + :vartype target_workspace_resource_id: str + :ivar target_workspace_tenant_id: Tenant id of the target Sentinel workspace joining the given + Sentinel workspace manager. + :vartype target_workspace_tenant_id: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"readonly": True}, + } + _attribute_map = { - "webhook_id": {"key": "webhookId", "type": "str"}, - "webhook_url": {"key": "webhookUrl", "type": "str"}, - "webhook_secret_update_time": {"key": "webhookSecretUpdateTime", "type": "str"}, - "rotate_webhook_secret": {"key": "rotateWebhookSecret", "type": "bool"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "target_workspace_resource_id": {"key": "properties.targetWorkspaceResourceId", "type": "str"}, + "target_workspace_tenant_id": {"key": "properties.targetWorkspaceTenantId", "type": "str"}, } def __init__( self, *, - webhook_id: Optional[str] = None, - webhook_url: Optional[str] = None, - webhook_secret_update_time: Optional[str] = None, - rotate_webhook_secret: Optional[bool] = None, - **kwargs - ): - """ - :keyword webhook_id: Unique identifier for the webhook. - :paramtype webhook_id: str - :keyword webhook_url: URL that gets invoked by the webhook. - :paramtype webhook_url: str - :keyword webhook_secret_update_time: Time when the webhook secret was updated. - :paramtype webhook_secret_update_time: str - :keyword rotate_webhook_secret: A flag to instruct the backend service to rotate webhook - secret. - :paramtype rotate_webhook_secret: bool + target_workspace_resource_id: Optional[str] = None, + target_workspace_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_workspace_resource_id: Fully qualified resource ID of the target Sentinel + workspace joining the given Sentinel workspace manager. + :paramtype target_workspace_resource_id: str + :keyword target_workspace_tenant_id: Tenant id of the target Sentinel workspace joining the + given Sentinel workspace manager. + :paramtype target_workspace_tenant_id: str """ super().__init__(**kwargs) - self.webhook_id = webhook_id - self.webhook_url = webhook_url - self.webhook_secret_update_time = webhook_secret_update_time - self.rotate_webhook_secret = rotate_webhook_secret + self.target_workspace_resource_id = target_workspace_resource_id + self.target_workspace_tenant_id = target_workspace_tenant_id + + +class WorkspaceManagerMembersList(_serialization.Model): + """List of workspace manager members. + + 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 next_link: URL to fetch the next set of workspace manager members. + :vartype next_link: str + :ivar value: Array of workspace manager members. Required. + :vartype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerMember] + """ + + _validation = { + "next_link": {"readonly": True}, + "value": {"required": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WorkspaceManagerMember]"}, + } + + def __init__(self, *, value: List["_models.WorkspaceManagerMember"], **kwargs: Any) -> None: + """ + :keyword value: Array of workspace manager members. Required. + :paramtype value: list[~azure.mgmt.securityinsight.models.WorkspaceManagerMember] + """ + super().__init__(**kwargs) + self.next_link = None + self.value = value diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py index 455b7f96600f..7ad992f85b85 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py @@ -13,44 +13,46 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the automation rule action.""" - #: Modify an object's properties MODIFY_PROPERTIES = "ModifyProperties" - #: Run a playbook on an object + """Modify an object's properties""" RUN_PLAYBOOK = "RunPlaybook" - #: Add a task to an incident object + """Run a playbook on an object""" ADD_INCIDENT_TASK = "AddIncidentTask" + """Add a task to an incident object""" class AlertDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Alert detail.""" - #: Alert display name DISPLAY_NAME = "DisplayName" - #: Alert severity + """Alert display name""" SEVERITY = "Severity" + """Alert severity""" class AlertProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The V3 alert property.""" - #: Alert's link ALERT_LINK = "AlertLink" - #: Confidence level property + """Alert's link""" CONFIDENCE_LEVEL = "ConfidenceLevel" - #: Confidence score + """Confidence level property""" CONFIDENCE_SCORE = "ConfidenceScore" - #: Extended links to the alert + """Confidence score""" EXTENDED_LINKS = "ExtendedLinks" - #: Product name alert property + """Extended links to the alert""" PRODUCT_NAME = "ProductName" - #: Provider name alert property + """Product name alert property""" PROVIDER_NAME = "ProviderName" - #: Product component name alert property + """Provider name alert property""" PRODUCT_COMPONENT_NAME = "ProductComponentName" - #: Remediation steps alert property + """Product component name alert property""" REMEDIATION_STEPS = "RemediationSteps" - #: Techniques alert property + """Remediation steps alert property""" TECHNIQUES = "Techniques" + """Techniques alert property""" + SUB_TECHNIQUES = "SubTechniques" + """SubTechniques alert property""" class AlertRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -67,42 +69,42 @@ class AlertRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The severity of the alert.""" - #: High severity HIGH = "High" - #: Medium severity + """High severity""" MEDIUM = "Medium" - #: Low severity + """Medium severity""" LOW = "Low" - #: Informational severity + """Low severity""" INFORMATIONAL = "Informational" + """Informational severity""" class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The lifecycle status of the alert.""" - #: Unknown value UNKNOWN = "Unknown" - #: New alert + """Unknown value""" NEW = "New" - #: Alert closed after handling + """New alert""" RESOLVED = "Resolved" - #: Alert dismissed as false positive + """Alert closed after handling""" DISMISSED = "Dismissed" - #: Alert is being handled + """Alert dismissed as false positive""" IN_PROGRESS = "InProgress" + """Alert is being handled""" class AntispamMailDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The directionality of this mail message.""" - #: Unknown UNKNOWN = "Unknown" - #: Inbound + """Unknown""" INBOUND = "Inbound" - #: Outbound + """Inbound""" OUTBOUND = "Outbound" - #: Intraorg + """Outbound""" INTRAORG = "Intraorg" + """Intraorg""" class AttackTactic(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -130,249 +132,259 @@ class AttackTactic(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AutomationRuleBooleanConditionSupportedOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRuleBooleanConditionSupportedOperator.""" - #: Evaluates as true if all the item conditions are evaluated as true AND = "And" - #: Evaluates as true if at least one of the item conditions are evaluated as true + """Evaluates as true if all the item conditions are evaluated as true""" OR = "Or" + """Evaluates as true if at least one of the item conditions are evaluated as true""" + AND_ENUM = "And" + """Evaluates as true if all the item conditions are evaluated as true""" + OR_ENUM = "Or" + """Evaluates as true if at least one of the item conditions are evaluated as true""" class AutomationRulePropertyArrayChangedConditionSupportedArrayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyArrayChangedConditionSupportedArrayType.""" - #: Evaluate the condition on the alerts ALERTS = "Alerts" - #: Evaluate the condition on the labels + """Evaluate the condition on the alerts""" LABELS = "Labels" - #: Evaluate the condition on the tactics + """Evaluate the condition on the labels""" TACTICS = "Tactics" - #: Evaluate the condition on the comments + """Evaluate the condition on the tactics""" COMMENTS = "Comments" + """Evaluate the condition on the comments""" class AutomationRulePropertyArrayChangedConditionSupportedChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyArrayChangedConditionSupportedChangeType.""" - #: Evaluate the condition on items added to the array ADDED = "Added" + """Evaluate the condition on items added to the array""" class AutomationRulePropertyArrayConditionSupportedArrayConditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyArrayConditionSupportedArrayConditionType.""" - #: Evaluate the condition as true if any item fulfills it ANY_ITEM = "AnyItem" + """Evaluate the condition as true if any item fulfills it""" class AutomationRulePropertyArrayConditionSupportedArrayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyArrayConditionSupportedArrayType.""" - #: Evaluate the condition on the custom detail keys CUSTOM_DETAILS = "CustomDetails" - #: Evaluate the condition on a custom detail's values + """Evaluate the condition on the custom detail keys""" CUSTOM_DETAIL_VALUES = "CustomDetailValues" + """Evaluate the condition on a custom detail's values""" class AutomationRulePropertyChangedConditionSupportedChangedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyChangedConditionSupportedChangedType.""" - #: Evaluate the condition on the previous value of the property CHANGED_FROM = "ChangedFrom" - #: Evaluate the condition on the updated value of the property + """Evaluate the condition on the previous value of the property""" CHANGED_TO = "ChangedTo" + """Evaluate the condition on the updated value of the property""" class AutomationRulePropertyChangedConditionSupportedPropertyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyChangedConditionSupportedPropertyType.""" - #: Evaluate the condition on the incident severity INCIDENT_SEVERITY = "IncidentSeverity" - #: Evaluate the condition on the incident status + """Evaluate the condition on the incident severity""" INCIDENT_STATUS = "IncidentStatus" - #: Evaluate the condition on the incident owner + """Evaluate the condition on the incident status""" INCIDENT_OWNER = "IncidentOwner" + """Evaluate the condition on the incident owner""" class AutomationRulePropertyConditionSupportedOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutomationRulePropertyConditionSupportedOperator.""" - #: Evaluates if the property equals at least one of the condition values EQUALS = "Equals" - #: Evaluates if the property does not equal any of the condition values + """Evaluates if the property equals at least one of the condition values""" NOT_EQUALS = "NotEquals" - #: Evaluates if the property contains at least one of the condition values + """Evaluates if the property does not equal any of the condition values""" CONTAINS = "Contains" - #: Evaluates if the property does not contain any of the condition values + """Evaluates if the property contains at least one of the condition values""" NOT_CONTAINS = "NotContains" - #: Evaluates if the property starts with any of the condition values + """Evaluates if the property does not contain any of the condition values""" STARTS_WITH = "StartsWith" - #: Evaluates if the property does not start with any of the condition values + """Evaluates if the property starts with any of the condition values""" NOT_STARTS_WITH = "NotStartsWith" - #: Evaluates if the property ends with any of the condition values + """Evaluates if the property does not start with any of the condition values""" ENDS_WITH = "EndsWith" - #: Evaluates if the property does not end with any of the condition values + """Evaluates if the property ends with any of the condition values""" NOT_ENDS_WITH = "NotEndsWith" + """Evaluates if the property does not end with any of the condition values""" class AutomationRulePropertyConditionSupportedProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The property to evaluate in an automation rule property condition.""" - #: The title of the incident INCIDENT_TITLE = "IncidentTitle" - #: The description of the incident + """The title of the incident""" INCIDENT_DESCRIPTION = "IncidentDescription" - #: The severity of the incident + """The description of the incident""" INCIDENT_SEVERITY = "IncidentSeverity" - #: The status of the incident + """The severity of the incident""" INCIDENT_STATUS = "IncidentStatus" - #: The related Analytic rule ids of the incident + """The status of the incident""" INCIDENT_RELATED_ANALYTIC_RULE_IDS = "IncidentRelatedAnalyticRuleIds" - #: The tactics of the incident + """The related Analytic rule ids of the incident""" INCIDENT_TACTICS = "IncidentTactics" - #: The labels of the incident + """The tactics of the incident""" INCIDENT_LABEL = "IncidentLabel" - #: The provider name of the incident + """The labels of the incident""" INCIDENT_PROVIDER_NAME = "IncidentProviderName" - #: The update source of the incident + """The provider name of the incident""" INCIDENT_UPDATED_BY_SOURCE = "IncidentUpdatedBySource" - #: The incident custom detail key + """The update source of the incident""" INCIDENT_CUSTOM_DETAILS_KEY = "IncidentCustomDetailsKey" - #: The incident custom detail value + """The incident custom detail key""" INCIDENT_CUSTOM_DETAILS_VALUE = "IncidentCustomDetailsValue" - #: The account Azure Active Directory tenant id + """The incident custom detail value""" ACCOUNT_AAD_TENANT_ID = "AccountAadTenantId" - #: The account Azure Active Directory user id + """The account Azure Active Directory tenant id""" ACCOUNT_AAD_USER_ID = "AccountAadUserId" - #: The account name + """The account Azure Active Directory user id""" ACCOUNT_NAME = "AccountName" - #: The account NetBIOS domain name + """The account name""" ACCOUNT_NT_DOMAIN = "AccountNTDomain" - #: The account Azure Active Directory Passport User ID + """The account NetBIOS domain name""" ACCOUNT_PUID = "AccountPUID" - #: The account security identifier + """The account Azure Active Directory Passport User ID""" ACCOUNT_SID = "AccountSid" - #: The account unique identifier + """The account security identifier""" ACCOUNT_OBJECT_GUID = "AccountObjectGuid" - #: The account user principal name suffix + """The account unique identifier""" ACCOUNT_UPN_SUFFIX = "AccountUPNSuffix" - #: The name of the product of the alert + """The account user principal name suffix""" ALERT_PRODUCT_NAMES = "AlertProductNames" - #: The analytic rule ids of the alert + """The name of the product of the alert""" ALERT_ANALYTIC_RULE_IDS = "AlertAnalyticRuleIds" - #: The Azure resource id + """The analytic rule ids of the alert""" AZURE_RESOURCE_RESOURCE_ID = "AzureResourceResourceId" - #: The Azure resource subscription id + """The Azure resource id""" AZURE_RESOURCE_SUBSCRIPTION_ID = "AzureResourceSubscriptionId" - #: The cloud application identifier + """The Azure resource subscription id""" CLOUD_APPLICATION_APP_ID = "CloudApplicationAppId" - #: The cloud application name + """The cloud application identifier""" CLOUD_APPLICATION_APP_NAME = "CloudApplicationAppName" - #: The dns record domain name + """The cloud application name""" DNS_DOMAIN_NAME = "DNSDomainName" - #: The file directory full path + """The dns record domain name""" FILE_DIRECTORY = "FileDirectory" - #: The file name without path + """The file directory full path""" FILE_NAME = "FileName" - #: The file hash value + """The file name without path""" FILE_HASH_VALUE = "FileHashValue" - #: The host Azure resource id + """The file hash value""" HOST_AZURE_ID = "HostAzureID" - #: The host name without domain + """The host Azure resource id""" HOST_NAME = "HostName" - #: The host NetBIOS name + """The host name without domain""" HOST_NET_BIOS_NAME = "HostNetBiosName" - #: The host NT domain + """The host NetBIOS name""" HOST_NT_DOMAIN = "HostNTDomain" - #: The host operating system + """The host NT domain""" HOST_OS_VERSION = "HostOSVersion" - #: "The IoT device id + """The host operating system""" IO_T_DEVICE_ID = "IoTDeviceId" - #: The IoT device name + """"The IoT device id""" IO_T_DEVICE_NAME = "IoTDeviceName" - #: The IoT device type + """The IoT device name""" IO_T_DEVICE_TYPE = "IoTDeviceType" - #: The IoT device vendor + """The IoT device type""" IO_T_DEVICE_VENDOR = "IoTDeviceVendor" - #: The IoT device model + """The IoT device vendor""" IO_T_DEVICE_MODEL = "IoTDeviceModel" - #: The IoT device operating system + """The IoT device model""" IO_T_DEVICE_OPERATING_SYSTEM = "IoTDeviceOperatingSystem" - #: The IP address + """The IoT device operating system""" IP_ADDRESS = "IPAddress" - #: The mailbox display name + """The IP address""" MAILBOX_DISPLAY_NAME = "MailboxDisplayName" - #: The mailbox primary address + """The mailbox display name""" MAILBOX_PRIMARY_ADDRESS = "MailboxPrimaryAddress" - #: The mailbox user principal name + """The mailbox primary address""" MAILBOX_UPN = "MailboxUPN" - #: The mail message delivery action + """The mailbox user principal name""" MAIL_MESSAGE_DELIVERY_ACTION = "MailMessageDeliveryAction" - #: The mail message delivery location + """The mail message delivery action""" MAIL_MESSAGE_DELIVERY_LOCATION = "MailMessageDeliveryLocation" - #: The mail message recipient + """The mail message delivery location""" MAIL_MESSAGE_RECIPIENT = "MailMessageRecipient" - #: The mail message sender IP address + """The mail message recipient""" MAIL_MESSAGE_SENDER_IP = "MailMessageSenderIP" - #: The mail message subject + """The mail message sender IP address""" MAIL_MESSAGE_SUBJECT = "MailMessageSubject" - #: The mail message P1 sender + """The mail message subject""" MAIL_MESSAGE_P1_SENDER = "MailMessageP1Sender" - #: The mail message P2 sender + """The mail message P1 sender""" MAIL_MESSAGE_P2_SENDER = "MailMessageP2Sender" - #: The malware category + """The mail message P2 sender""" MALWARE_CATEGORY = "MalwareCategory" - #: The malware name + """The malware category""" MALWARE_NAME = "MalwareName" - #: The process execution command line + """The malware name""" PROCESS_COMMAND_LINE = "ProcessCommandLine" - #: The process id + """The process execution command line""" PROCESS_ID = "ProcessId" - #: The registry key path + """The process id""" REGISTRY_KEY = "RegistryKey" - #: The registry key value in string formatted representation + """The registry key path""" REGISTRY_VALUE_DATA = "RegistryValueData" - #: The url + """The registry key value in string formatted representation""" URL = "Url" + """The url""" + + +class BillingStatisticKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of the billing statistic.""" + + SAP_SOLUTION_USAGE = "SapSolutionUsage" class Category(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Categories of recommendations.""" - #: Onboarding recommendation. ONBOARDING = "Onboarding" - #: New feature recommendation. + """Onboarding recommendation.""" NEW_FEATURE = "NewFeature" - #: Soc Efficiency recommendation. + """New feature recommendation.""" SOC_EFFICIENCY = "SocEfficiency" - #: Cost optimization recommendation. + """Soc Efficiency recommendation.""" COST_OPTIMIZATION = "CostOptimization" - #: Demo recommendation. + """Cost optimization recommendation.""" DEMO = "Demo" + """Demo recommendation.""" class ConditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ConditionType.""" - #: Evaluate an object property value PROPERTY = "Property" - #: Evaluate an object array property value + """Evaluate an object property value""" PROPERTY_ARRAY = "PropertyArray" - #: Evaluate an object property changed value + """Evaluate an object array property value""" PROPERTY_CHANGED = "PropertyChanged" - #: Evaluate an object array property changed value + """Evaluate an object property changed value""" PROPERTY_ARRAY_CHANGED = "PropertyArrayChanged" - #: Apply a boolean operator (e.g AND, OR) to conditions + """Evaluate an object array property changed value""" BOOLEAN = "Boolean" + """Apply a boolean operator (e.g AND, OR) to conditions""" class ConfidenceLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The confidence level of this alert.""" - #: Unknown confidence, the is the default value UNKNOWN = "Unknown" - #: Low confidence, meaning we have some doubts this is indeed malicious or part of an attack + """Unknown confidence, the is the default value""" LOW = "Low" - #: High confidence that the alert is true positive malicious + """Low confidence, meaning we have some doubts this is indeed malicious or part of an attack""" HIGH = "High" + """High confidence that the alert is true positive malicious""" class ConfidenceScoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -380,15 +392,15 @@ class ConfidenceScoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): this alert, not applicable or final. """ - #: Score will not be calculated for this alert as it is not supported by virtual analyst NOT_APPLICABLE = "NotApplicable" - #: No score was set yet and calculation is in progress + """Score will not be calculated for this alert as it is not supported by virtual analyst""" IN_PROCESS = "InProcess" - #: Score is calculated and shown as part of the alert, but may be updated again at a later time - #: following the processing of additional data + """No score was set yet and calculation is in progress""" NOT_FINAL = "NotFinal" - #: Final score was calculated and available + """Score is calculated and shown as part of the alert, but may be updated again at a later time + #: following the processing of additional data""" FINAL = "Final" + """Final score was calculated and available""" class ConnectAuthKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -409,20 +421,24 @@ class ContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The content type of a source control path.""" ANALYTIC_RULE = "AnalyticRule" + AUTOMATION_RULE = "AutomationRule" + HUNTING_QUERY = "HuntingQuery" + PARSER = "Parser" + PLAYBOOK = "Playbook" WORKBOOK = "Workbook" class Context(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Context of recommendation.""" - #: Analytics context. ANALYTICS = "Analytics" - #: Incidents context. + """Analytics context.""" INCIDENTS = "Incidents" - #: Overview context. + """Incidents context.""" OVERVIEW = "Overview" - #: No context. + """Overview context.""" NONE = "None" + """No context.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -447,6 +463,12 @@ class DataConnectorAuthorizationState(str, Enum, metaclass=CaseInsensitiveEnumMe INVALID = "Invalid" +class DataConnectorDefinitionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of the data connector definitions.""" + + CUSTOMIZABLE = "Customizable" + + class DataConnectorKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the data connector.""" @@ -459,6 +481,7 @@ class DataConnectorKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): OFFICE_ATP = "OfficeATP" OFFICE_IRM = "OfficeIRM" OFFICE365_PROJECT = "Office365Project" + MICROSOFT_PURVIEW_INFORMATION_PROTECTION = "MicrosoftPurviewInformationProtection" OFFICE_POWER_BI = "OfficePowerBI" AMAZON_WEB_SERVICES_CLOUD_TRAIL = "AmazonWebServicesCloudTrail" AMAZON_WEB_SERVICES_S3 = "AmazonWebServicesS3" @@ -470,6 +493,7 @@ class DataConnectorKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): GENERIC_UI = "GenericUI" API_POLLING = "APIPolling" IOT = "IOT" + GCP = "GCP" class DataConnectorLicenseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -490,50 +514,50 @@ class DataTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DeleteStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether the file was deleted from the storage account.""" - #: The file was deleted. DELETED = "Deleted" - #: The file was not deleted. + """The file was deleted.""" NOT_DELETED = "NotDeleted" - #: Unspecified + """The file was not deleted.""" UNSPECIFIED = "Unspecified" + """Unspecified""" class DeliveryAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The delivery action of this mail message like Delivered, Blocked, Replaced etc.""" - #: Unknown UNKNOWN = "Unknown" - #: DeliveredAsSpam + """Unknown""" DELIVERED_AS_SPAM = "DeliveredAsSpam" - #: Delivered + """DeliveredAsSpam""" DELIVERED = "Delivered" - #: Blocked + """Delivered""" BLOCKED = "Blocked" - #: Replaced + """Blocked""" REPLACED = "Replaced" + """Replaced""" class DeliveryLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The delivery location of this mail message like Inbox, JunkFolder etc.""" - #: Unknown UNKNOWN = "Unknown" - #: Inbox + """Unknown""" INBOX = "Inbox" - #: JunkFolder + """Inbox""" JUNK_FOLDER = "JunkFolder" - #: DeletedFolder + """JunkFolder""" DELETED_FOLDER = "DeletedFolder" - #: Quarantine + """DeletedFolder""" QUARANTINE = "Quarantine" - #: External + """Quarantine""" EXTERNAL = "External" - #: Failed + """External""" FAILED = "Failed" - #: Dropped + """Failed""" DROPPED = "Dropped" - #: Forwarded + """Dropped""" FORWARDED = "Forwarded" + """Forwarded""" class DeploymentFetchStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -564,122 +588,122 @@ class DeploymentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DeviceImportance(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Device importance, determines if the device classified as 'crown jewel'.""" - #: Unknown - Default value UNKNOWN = "Unknown" - #: Low + """Unknown - Default value""" LOW = "Low" - #: Normal + """Low""" NORMAL = "Normal" - #: High + """Normal""" HIGH = "High" + """High""" class ElevationToken(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elevation token associated with the process.""" - #: Default elevation token DEFAULT = "Default" - #: Full elevation token + """Default elevation token""" FULL = "Full" - #: Limited elevation token + """Full elevation token""" LIMITED = "Limited" + """Limited elevation token""" class EntityItemQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """EntityItemQueryKind.""" - #: insight INSIGHT = "Insight" + """insight""" -class EntityKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class EntityKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the entity.""" - #: Entity represents account in the system. ACCOUNT = "Account" - #: Entity represents host in the system. + """Entity represents account in the system.""" HOST = "Host" - #: Entity represents file in the system. + """Entity represents host in the system.""" FILE = "File" - #: Entity represents azure resource in the system. + """Entity represents file in the system.""" AZURE_RESOURCE = "AzureResource" - #: Entity represents cloud application in the system. + """Entity represents azure resource in the system.""" CLOUD_APPLICATION = "CloudApplication" - #: Entity represents dns resolution in the system. + """Entity represents cloud application in the system.""" DNS_RESOLUTION = "DnsResolution" - #: Entity represents file hash in the system. + """Entity represents dns resolution in the system.""" FILE_HASH = "FileHash" - #: Entity represents ip in the system. + """Entity represents file hash in the system.""" IP = "Ip" - #: Entity represents malware in the system. + """Entity represents ip in the system.""" MALWARE = "Malware" - #: Entity represents process in the system. + """Entity represents malware in the system.""" PROCESS = "Process" - #: Entity represents registry key in the system. + """Entity represents process in the system.""" REGISTRY_KEY = "RegistryKey" - #: Entity represents registry value in the system. + """Entity represents registry key in the system.""" REGISTRY_VALUE = "RegistryValue" - #: Entity represents security group in the system. + """Entity represents registry value in the system.""" SECURITY_GROUP = "SecurityGroup" - #: Entity represents url in the system. + """Entity represents security group in the system.""" URL = "Url" - #: Entity represents IoT device in the system. + """Entity represents url in the system.""" IO_T_DEVICE = "IoTDevice" - #: Entity represents security alert in the system. + """Entity represents IoT device in the system.""" SECURITY_ALERT = "SecurityAlert" - #: Entity represents bookmark in the system. + """Entity represents security alert in the system.""" BOOKMARK = "Bookmark" - #: Entity represents mail cluster in the system. + """Entity represents bookmark in the system.""" MAIL_CLUSTER = "MailCluster" - #: Entity represents mail message in the system. + """Entity represents mail cluster in the system.""" MAIL_MESSAGE = "MailMessage" - #: Entity represents mailbox in the system. + """Entity represents mail message in the system.""" MAILBOX = "Mailbox" - #: Entity represents submission mail in the system. + """Entity represents mailbox in the system.""" SUBMISSION_MAIL = "SubmissionMail" - #: Entity represents network interface in the system. + """Entity represents submission mail in the system.""" NIC = "Nic" + """Entity represents network interface in the system.""" class EntityMappingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The V3 type of the mapped entity.""" - #: User account entity type ACCOUNT = "Account" - #: Host entity type + """User account entity type""" HOST = "Host" - #: IP address entity type + """Host entity type""" IP = "IP" - #: Malware entity type + """IP address entity type""" MALWARE = "Malware" - #: System file entity type + """Malware entity type""" FILE = "File" - #: Process entity type + """System file entity type""" PROCESS = "Process" - #: Cloud app entity type + """Process entity type""" CLOUD_APPLICATION = "CloudApplication" - #: DNS entity type + """Cloud app entity type""" DNS = "DNS" - #: Azure resource entity type + """DNS entity type""" AZURE_RESOURCE = "AzureResource" - #: File-hash entity type + """Azure resource entity type""" FILE_HASH = "FileHash" - #: Registry key entity type + """File-hash entity type""" REGISTRY_KEY = "RegistryKey" - #: Registry value entity type + """Registry key entity type""" REGISTRY_VALUE = "RegistryValue" - #: Security group entity type + """Registry value entity type""" SECURITY_GROUP = "SecurityGroup" - #: URL entity type + """Security group entity type""" URL = "URL" - #: Mailbox entity type + """URL entity type""" MAILBOX = "Mailbox" - #: Mail cluster entity type + """Mailbox entity type""" MAIL_CLUSTER = "MailCluster" - #: Mail message entity type + """Mail cluster entity type""" MAIL_MESSAGE = "MailMessage" - #: Submission mail entity type + """Mail message entity type""" SUBMISSION_MAIL = "SubmissionMail" + """Submission mail entity type""" class EntityProviders(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -706,74 +730,74 @@ class EntityQueryTemplateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EntityTimelineKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The entity query kind.""" - #: activity ACTIVITY = "Activity" - #: bookmarks + """activity""" BOOKMARK = "Bookmark" - #: security alerts + """bookmarks""" SECURITY_ALERT = "SecurityAlert" - #: anomaly + """security alerts""" ANOMALY = "Anomaly" + """anomaly""" class EntityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the entity.""" - #: Entity represents account in the system. ACCOUNT = "Account" - #: Entity represents host in the system. + """Entity represents account in the system.""" HOST = "Host" - #: Entity represents file in the system. + """Entity represents host in the system.""" FILE = "File" - #: Entity represents azure resource in the system. + """Entity represents file in the system.""" AZURE_RESOURCE = "AzureResource" - #: Entity represents cloud application in the system. + """Entity represents azure resource in the system.""" CLOUD_APPLICATION = "CloudApplication" - #: Entity represents dns in the system. + """Entity represents cloud application in the system.""" DNS = "DNS" - #: Entity represents file hash in the system. + """Entity represents dns in the system.""" FILE_HASH = "FileHash" - #: Entity represents ip in the system. + """Entity represents file hash in the system.""" IP = "IP" - #: Entity represents malware in the system. + """Entity represents ip in the system.""" MALWARE = "Malware" - #: Entity represents process in the system. + """Entity represents malware in the system.""" PROCESS = "Process" - #: Entity represents registry key in the system. + """Entity represents process in the system.""" REGISTRY_KEY = "RegistryKey" - #: Entity represents registry value in the system. + """Entity represents registry key in the system.""" REGISTRY_VALUE = "RegistryValue" - #: Entity represents security group in the system. + """Entity represents registry value in the system.""" SECURITY_GROUP = "SecurityGroup" - #: Entity represents url in the system. + """Entity represents security group in the system.""" URL = "URL" - #: Entity represents IoT device in the system. + """Entity represents url in the system.""" IO_T_DEVICE = "IoTDevice" - #: Entity represents security alert in the system. + """Entity represents IoT device in the system.""" SECURITY_ALERT = "SecurityAlert" - #: Entity represents HuntingBookmark in the system. + """Entity represents security alert in the system.""" HUNTING_BOOKMARK = "HuntingBookmark" - #: Entity represents mail cluster in the system. + """Entity represents HuntingBookmark in the system.""" MAIL_CLUSTER = "MailCluster" - #: Entity represents mail message in the system. + """Entity represents mail cluster in the system.""" MAIL_MESSAGE = "MailMessage" - #: Entity represents mailbox in the system. + """Entity represents mail message in the system.""" MAILBOX = "Mailbox" - #: Entity represents submission mail in the system. + """Entity represents mailbox in the system.""" SUBMISSION_MAIL = "SubmissionMail" - #: Entity represents network interface in the system. + """Entity represents submission mail in the system.""" NIC = "Nic" + """Entity represents network interface in the system.""" -class Enum13(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum13.""" +class Enum20(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum20.""" EXPANSION = "Expansion" ACTIVITY = "Activity" -class Enum15(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum15.""" +class Enum22(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum22.""" ACTIVITY = "Activity" @@ -788,58 +812,65 @@ class EventGroupingAggregationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta) class FileFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The format of the file.""" - #: A CSV file. CSV = "CSV" - #: A JSON file. + """A CSV file.""" JSON = "JSON" - #: A file of other format. + """A JSON file.""" UNSPECIFIED = "Unspecified" + """A file of other format.""" class FileHashAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The hash algorithm type.""" - #: Unknown hash algorithm UNKNOWN = "Unknown" - #: MD5 hash type + """Unknown hash algorithm""" MD5 = "MD5" - #: SHA1 hash type + """MD5 hash type""" SHA1 = "SHA1" - #: SHA256 hash type + """SHA1 hash type""" SHA256 = "SHA256" - #: SHA256 Authenticode hash type + """SHA256 hash type""" SHA256_AC = "SHA256AC" + """SHA256 Authenticode hash type""" class FileImportContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The content type of this file.""" - #: File containing records with the core fields of an indicator, plus the observables to construct - #: the STIX pattern. BASIC_INDICATOR = "BasicIndicator" - #: File containing STIX indicators. + """File containing records with the core fields of an indicator, plus the observables to construct + #: the STIX pattern.""" STIX_INDICATOR = "StixIndicator" - #: File containing other records. + """File containing STIX indicators.""" UNSPECIFIED = "Unspecified" + """File containing other records.""" class FileImportState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of the file import.""" - #: A fatal error has occurred while ingesting the file. FATAL_ERROR = "FatalError" - #: The file has been ingested. + """A fatal error has occurred while ingesting the file.""" INGESTED = "Ingested" - #: The file has been ingested with errors. + """The file has been ingested.""" INGESTED_WITH_ERRORS = "IngestedWithErrors" - #: The file ingestion is in progress. + """The file has been ingested with errors.""" IN_PROGRESS = "InProgress" - #: The file is invalid. + """The file ingestion is in progress.""" INVALID = "Invalid" - #: Waiting for the file to be uploaded. + """The file is invalid.""" WAITING_FOR_UPLOAD = "WaitingForUpload" - #: Unspecified state. + """Waiting for the file to be uploaded.""" UNSPECIFIED = "Unspecified" + """Unspecified state.""" + + +class Flag(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The boolean value the metadata is for.""" + + TRUE = "true" + FALSE = "false" class GetInsightsError(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -848,156 +879,164 @@ class GetInsightsError(str, Enum, metaclass=CaseInsensitiveEnumMeta): INSIGHT = "Insight" +class HypothesisStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The hypothesis status of the hunt.""" + + UNKNOWN = "Unknown" + INVALIDATED = "Invalidated" + VALIDATED = "Validated" + + class IncidentClassification(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason the incident was closed.""" - #: Incident classification was undetermined UNDETERMINED = "Undetermined" - #: Incident was true positive + """Incident classification was undetermined""" TRUE_POSITIVE = "TruePositive" - #: Incident was benign positive + """Incident was true positive""" BENIGN_POSITIVE = "BenignPositive" - #: Incident was false positive + """Incident was benign positive""" FALSE_POSITIVE = "FalsePositive" + """Incident was false positive""" class IncidentClassificationReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The classification reason the incident was closed with.""" - #: Classification reason was suspicious activity SUSPICIOUS_ACTIVITY = "SuspiciousActivity" - #: Classification reason was suspicious but expected + """Classification reason was suspicious activity""" SUSPICIOUS_BUT_EXPECTED = "SuspiciousButExpected" - #: Classification reason was incorrect alert logic + """Classification reason was suspicious but expected""" INCORRECT_ALERT_LOGIC = "IncorrectAlertLogic" - #: Classification reason was inaccurate data + """Classification reason was incorrect alert logic""" INACCURATE_DATA = "InaccurateData" + """Classification reason was inaccurate data""" class IncidentLabelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the label.""" - #: Label manually created by a user USER = "User" - #: Label automatically created by the system + """Label manually created by a user""" AUTO_ASSIGNED = "AutoAssigned" + """Label automatically created by the system""" class IncidentSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The severity of the incident.""" - #: High severity HIGH = "High" - #: Medium severity + """High severity""" MEDIUM = "Medium" - #: Low severity + """Medium severity""" LOW = "Low" - #: Informational severity + """Low severity""" INFORMATIONAL = "Informational" + """Informational severity""" class IncidentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the incident.""" - #: An active incident which isn't being handled currently NEW = "New" - #: An active incident which is being handled + """An active incident which isn't being handled currently""" ACTIVE = "Active" - #: A non-active incident + """An active incident which is being handled""" CLOSED = "Closed" + """A non-active incident""" class IncidentTaskStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """IncidentTaskStatus.""" - #: A new task NEW = "New" - #: A completed task + """A new task""" COMPLETED = "Completed" + """A completed task""" class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how to ingest the records in the file.""" - #: No records should be ingested when invalid records are detected. INGEST_ONLY_IF_ALL_ARE_VALID = "IngestOnlyIfAllAreValid" - #: Valid records should still be ingested when invalid records are detected. + """No records should be ingested when invalid records are detected.""" INGEST_ANY_VALID_RECORDS = "IngestAnyValidRecords" - #: Unspecified + """Valid records should still be ingested when invalid records are detected.""" UNSPECIFIED = "Unspecified" + """Unspecified""" class KillChainIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intent of the alert.""" - #: The default value. UNKNOWN = "Unknown" - #: Probing could be an attempt to access a certain resource regardless of a malicious intent or a + """The default value.""" + PROBING = "Probing" + """Probing could be an attempt to access a certain resource regardless of a malicious intent or a #: failed attempt to gain access to a target system to gather information prior to exploitation. #: This step is usually detected as an attempt originating from outside the network in attempt to - #: scan the target system and find a way in. - PROBING = "Probing" - #: Exploitation is the stage where an attacker manage to get foothold on the attacked resource. + #: scan the target system and find a way in.""" + EXPLOITATION = "Exploitation" + """Exploitation is the stage where an attacker manage to get foothold on the attacked resource. #: This stage is applicable not only for compute hosts, but also for resources such as user #: accounts, certificates etc. Adversaries will often be able to control the resource after this - #: stage. - EXPLOITATION = "Exploitation" - #: Persistence is any access, action, or configuration change to a system that gives an adversary + #: stage.""" + PERSISTENCE = "Persistence" + """Persistence is any access, action, or configuration change to a system that gives an adversary #: a persistent presence on that system. Adversaries will often need to maintain access to systems #: through interruptions such as system restarts, loss of credentials, or other failures that - #: would require a remote access tool to restart or alternate backdoor for them to regain access. - PERSISTENCE = "Persistence" - #: Privilege escalation is the result of actions that allow an adversary to obtain a higher level + #: would require a remote access tool to restart or alternate backdoor for them to regain access.""" + PRIVILEGE_ESCALATION = "PrivilegeEscalation" + """Privilege escalation is the result of actions that allow an adversary to obtain a higher level #: of permissions on a system or network. Certain tools or actions require a higher level of #: privilege to work and are likely necessary at many points throughout an operation. User #: accounts with permissions to access specific systems or perform specific functions necessary - #: for adversaries to achieve their objective may also be considered an escalation of privilege. - PRIVILEGE_ESCALATION = "PrivilegeEscalation" - #: Defense evasion consists of techniques an adversary may use to evade detection or avoid other - #: defenses. Sometimes these actions are the same as or variations of techniques in other - #: categories that have the added benefit of subverting a particular defense or mitigation. + #: for adversaries to achieve their objective may also be considered an escalation of privilege.""" DEFENSE_EVASION = "DefenseEvasion" - #: Credential access represents techniques resulting in access to or control over system, domain, + """Defense evasion consists of techniques an adversary may use to evade detection or avoid other + #: defenses. Sometimes these actions are the same as or variations of techniques in other + #: categories that have the added benefit of subverting a particular defense or mitigation.""" + CREDENTIAL_ACCESS = "CredentialAccess" + """Credential access represents techniques resulting in access to or control over system, domain, #: or service credentials that are used within an enterprise environment. Adversaries will likely #: attempt to obtain legitimate credentials from users or administrator accounts (local system #: administrator or domain users with administrator access) to use within the network. With #: sufficient access within a network, an adversary can create accounts for later use within the - #: environment. - CREDENTIAL_ACCESS = "CredentialAccess" - #: Discovery consists of techniques that allow the adversary to gain knowledge about the system - #: and internal network. When adversaries gain access to a new system, they must orient themselves - #: to what they now have control of and what benefits operating from that system give to their - #: current objective or overall goals during the intrusion. The operating system provides many - #: native tools that aid in this post-compromise information-gathering phase. + #: environment.""" DISCOVERY = "Discovery" - #: Lateral movement consists of techniques that enable an adversary to access and control remote + """Discovery consists of techniques that allow the adversary to gain knowledge about the system + #: and internal network. When adversaries gain access to a new system, they must navigate + #: themselves to what they now have control of and what benefits operating from that system give + #: to their current objective or overall goals during the intrusion. The operating system provides + #: many native tools that aid in this post-compromise information-gathering phase.""" + LATERAL_MOVEMENT = "LateralMovement" + """Lateral movement consists of techniques that enable an adversary to access and control remote #: systems on a network and could, but does not necessarily, include execution of tools on remote #: systems. The lateral movement techniques could allow an adversary to gather information from a #: system without needing additional tools, such as a remote access tool. An adversary can use #: lateral movement for many purposes, including remote Execution of tools, pivoting to additional #: systems, access to specific information or files, access to additional credentials, or to cause - #: an effect. - LATERAL_MOVEMENT = "LateralMovement" - #: The execution tactic represents techniques that result in execution of adversary-controlled - #: code on a local or remote system. This tactic is often used in conjunction with lateral - #: movement to expand access to remote systems on a network. + #: an effect.""" EXECUTION = "Execution" - #: Collection consists of techniques used to identify and gather information, such as sensitive - #: files, from a target network prior to exfiltration. This category also covers locations on a - #: system or network where the adversary may look for information to exfiltrate. + """The execution tactic represents techniques that result in execution of adversary-controlled + #: code on a local or remote system. This tactic is often used in conjunction with lateral + #: movement to expand access to remote systems on a network.""" COLLECTION = "Collection" - #: Exfiltration refers to techniques and attributes that result or aid in the adversary removing - #: files and information from a target network. This category also covers locations on a system or - #: network where the adversary may look for information to exfiltrate. + """Collection consists of techniques used to identify and gather information, such as sensitive + #: files, from a target network prior to exfiltration. This category also covers locations on a + #: system or network where the adversary may look for information to exfiltrate.""" EXFILTRATION = "Exfiltration" - #: The command and control tactic represents how adversaries communicate with systems under their - #: control within a target network. + """Exfiltration refers to techniques and attributes that result or aid in the adversary removing + #: files and information from a target network. This category also covers locations on a system or + #: network where the adversary may look for information to exfiltrate.""" COMMAND_AND_CONTROL = "CommandAndControl" - #: The impact intent primary objective is to directly reduce the availability or integrity of a + """The command and control tactic represents how adversaries communicate with systems under their + #: control within a target network.""" + IMPACT = "Impact" + """The impact intent primary objective is to directly reduce the availability or integrity of a #: system, service, or network; including manipulation of data to impact a business or operational #: process. This would often refer to techniques such as ransom-ware, defacement, data - #: manipulation and others. - IMPACT = "Impact" + #: manipulation and others.""" class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1027,13 +1066,13 @@ class MatchingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): groupByAlertDetails, groupByCustomDetails must be provided and not empty. """ - #: Grouping alerts into a single incident if all the entities match ALL_ENTITIES = "AllEntities" - #: Grouping any alerts triggered by this rule into a single incident + """Grouping alerts into a single incident if all the entities match""" ANY_ALERT = "AnyAlert" - #: Grouping alerts into a single incident if the selected entities, custom details and alert - #: details match + """Grouping any alerts triggered by this rule into a single incident""" SELECTED = "Selected" + """Grouping alerts into a single incident if the selected entities, custom details and alert + #: details match""" class MicrosoftSecurityProductName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1048,26 +1087,44 @@ class MicrosoftSecurityProductName(str, Enum, metaclass=CaseInsensitiveEnumMeta) MICROSOFT_DEFENDER_ADVANCED_THREAT_PROTECTION = "Microsoft Defender Advanced Threat Protection" +class Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current mode of the workspace manager configuration.""" + + ENABLED = "Enabled" + """The workspace manager configuration is enabled""" + DISABLED = "Disabled" + """The workspace manager configuration is disabled""" + + +class MtpProvider(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The available data providers.""" + + MICROSOFT_DEFENDER_FOR_CLOUD_APPS = "microsoftDefenderForCloudApps" + MICROSOFT_DEFENDER_FOR_IDENTITY = "microsoftDefenderForIdentity" + + class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operator used for list of dependencies in criteria array.""" AND = "AND" OR = "OR" + AND_ENUM = "AND" + OR_ENUM = "OR" class OSFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type.""" - #: Host with Linux operating system. LINUX = "Linux" - #: Host with Windows operating system. + """Host with Linux operating system.""" WINDOWS = "Windows" - #: Host with Android operating system. + """Host with Windows operating system.""" ANDROID = "Android" - #: Host with IOS operating system. + """Host with Android operating system.""" IOS = "IOS" - #: Host with Unknown operating system. + """Host with IOS operating system.""" UNKNOWN = "Unknown" + """Host with Unknown operating system.""" class OutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1080,14 +1137,21 @@ class OutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class OwnerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the owner the incident is assigned to.""" + """The type of the owner the hunt is assigned to.""" - #: The incident owner type is unknown UNKNOWN = "Unknown" - #: The incident owner type is an AAD user + """The hunt owner type is unknown""" USER = "User" - #: The incident owner type is an AAD group + """The hunt owner type is an AAD user""" GROUP = "Group" + """The hunt owner type is an AAD group""" + + +class PackageKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The package kind.""" + + SOLUTION = "Solution" + STANDALONE = "Standalone" class PermissionProviderScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1101,23 +1165,23 @@ class PermissionProviderScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PollingFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The polling frequency for the TAXII server.""" - #: Once a minute ONCE_A_MINUTE = "OnceAMinute" - #: Once an hour + """Once a minute""" ONCE_AN_HOUR = "OnceAnHour" - #: Once a day + """Once an hour""" ONCE_A_DAY = "OnceADay" + """Once a day""" class Priority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Priority of recommendation.""" - #: Low priority for recommendation. LOW = "Low" - #: Medium priority for recommendation. + """Low priority for recommendation.""" MEDIUM = "Medium" - #: High priority for recommendation. + """Medium priority for recommendation.""" HIGH = "High" + """High priority for recommendation.""" class ProviderName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1131,29 +1195,47 @@ class ProviderName(str, Enum, metaclass=CaseInsensitiveEnumMeta): MICROSOFT_AUTHORIZATION_POLICY_ASSIGNMENTS = "Microsoft.Authorization/policyAssignments" +class ProviderPermissionsScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The scope on which the user should have permissions, in order to be able to create connections.""" + + SUBSCRIPTION = "Subscription" + RESOURCE_GROUP = "ResourceGroup" + WORKSPACE = "Workspace" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The triggered analytics rule run provisioning state.""" + + ACCEPTED = "Accepted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + + class RegistryHive(str, Enum, metaclass=CaseInsensitiveEnumMeta): """the hive that holds the registry key.""" - #: HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE = "HKEY_LOCAL_MACHINE" - #: HKEY_CLASSES_ROOT + """HKEY_LOCAL_MACHINE""" HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT" - #: HKEY_CURRENT_CONFIG + """HKEY_CLASSES_ROOT""" HKEY_CURRENT_CONFIG = "HKEY_CURRENT_CONFIG" - #: HKEY_USERS + """HKEY_CURRENT_CONFIG""" HKEY_USERS = "HKEY_USERS" - #: HKEY_CURRENT_USER_LOCAL_SETTINGS + """HKEY_USERS""" HKEY_CURRENT_USER_LOCAL_SETTINGS = "HKEY_CURRENT_USER_LOCAL_SETTINGS" - #: HKEY_PERFORMANCE_DATA + """HKEY_CURRENT_USER_LOCAL_SETTINGS""" HKEY_PERFORMANCE_DATA = "HKEY_PERFORMANCE_DATA" - #: HKEY_PERFORMANCE_NLSTEXT + """HKEY_PERFORMANCE_DATA""" HKEY_PERFORMANCE_NLSTEXT = "HKEY_PERFORMANCE_NLSTEXT" - #: HKEY_PERFORMANCE_TEXT + """HKEY_PERFORMANCE_NLSTEXT""" HKEY_PERFORMANCE_TEXT = "HKEY_PERFORMANCE_TEXT" - #: HKEY_A + """HKEY_PERFORMANCE_TEXT""" HKEY_A = "HKEY_A" - #: HKEY_CURRENT_USER + """HKEY_A""" HKEY_CURRENT_USER = "HKEY_CURRENT_USER" + """HKEY_CURRENT_USER""" class RegistryValueKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1161,29 +1243,37 @@ class RegistryValueKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): type of a value in the registry. """ - #: None NONE = "None" - #: Unknown value type + """None""" UNKNOWN = "Unknown" - #: String value type + """Unknown value type""" STRING = "String" - #: ExpandString value type + """String value type""" EXPAND_STRING = "ExpandString" - #: Binary value type + """ExpandString value type""" BINARY = "Binary" - #: DWord value type + """Binary value type""" D_WORD = "DWord" - #: MultiString value type + """DWord value type""" MULTI_STRING = "MultiString" - #: QWord value type + """MultiString value type""" Q_WORD = "QWord" + """QWord value type""" + + +class RepositoryAccessKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of repository access credentials.""" + + O_AUTH = "OAuth" + PAT = "PAT" + APP = "App" class RepoType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of repository.""" GITHUB = "Github" - DEV_OPS = "DevOps" + AZURE_DEV_OPS = "AzureDevOps" class SecurityMLAnalyticsSettingsKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1204,10 +1294,10 @@ class SettingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SettingsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The anomaly SecurityMLAnalyticsSettings status.""" - #: Anomaly settings status in Production mode PRODUCTION = "Production" - #: Anomaly settings status in Flighting mode + """Anomaly settings status in Production mode""" FLIGHTING = "Flighting" + """Anomaly settings status in Flighting mode""" class SettingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1237,16 +1327,29 @@ class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of recommendation.""" - #: Recommendation is active. ACTIVE = "Active" - #: Recommendation is disabled. + """Recommendation is active.""" DISABLED = "Disabled" - #: Recommendation has been completed by user. + """Recommendation is disabled.""" COMPLETED_BY_USER = "CompletedByUser" - #: Recommendation has been completed by action. + """Recommendation has been completed by user.""" COMPLETED_BY_ACTION = "CompletedByAction" - #: Recommendation is hidden. + """Recommendation has been completed by action.""" HIDDEN = "Hidden" + """Recommendation is hidden.""" + + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the hunt.""" + + NEW = "New" + ACTIVE = "Active" + CLOSED = "Closed" + BACKLOG = "Backlog" + APPROVED = "Approved" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + IN_PROGRESS = "InProgress" class SupportTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1260,22 +1363,22 @@ class SupportTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TemplateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The alert rule template status.""" - #: Alert rule template installed. and can not use more then once INSTALLED = "Installed" - #: Alert rule template is available. + """Alert rule template installed. and can not use more then once""" AVAILABLE = "Available" - #: Alert rule template is not available + """Alert rule template is available.""" NOT_AVAILABLE = "NotAvailable" + """Alert rule template is not available""" -class ThreatIntelligenceResourceKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class ThreatIntelligenceResourceInnerKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the threat intelligence entity.""" - #: Entity represents threat intelligence indicator in the system. INDICATOR = "indicator" + """Entity represents threat intelligence indicator in the system.""" -class ThreatIntelligenceSortingCriteriaEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class ThreatIntelligenceSortingOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sorting order (ascending/descending/unsorted).""" UNSORTED = "unsorted" @@ -1295,19 +1398,19 @@ class TriggerOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TriggersOn(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TriggersOn.""" - #: Trigger on Incidents INCIDENTS = "Incidents" - #: Trigger on Alerts + """Trigger on Incidents""" ALERTS = "Alerts" + """Trigger on Alerts""" class TriggersWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TriggersWhen.""" - #: Trigger on created objects CREATED = "Created" - #: Trigger on updated objects + """Trigger on created objects""" UPDATED = "Updated" + """Trigger on updated objects""" class UebaDataSources(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1324,3 +1427,15 @@ class Version(str, Enum, metaclass=CaseInsensitiveEnumMeta): V1 = "V1" V2 = "V2" + + +class WarningCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of repository.""" + + SOURCE_CONTROL_WARNING_DELETE_SERVICE_PRINCIPAL = "SourceControlWarning_DeleteServicePrincipal" + SOURCE_CONTROL_WARNING_DELETE_PIPELINE_FROM_AZURE_DEV_OPS = "SourceControlWarning_DeletePipelineFromAzureDevOps" + SOURCE_CONTROL_WARNING_DELETE_WORKFLOW_AND_SECRET_FROM_GIT_HUB = ( + "SourceControlWarning_DeleteWorkflowAndSecretFromGitHub" + ) + SOURCE_CONTROL_WARNING_DELETE_ROLE_ASSIGNMENT = "SourceControlWarning_DeleteRoleAssignment" + SOURCE_CONTROL_DELETED_WITH_WARNINGS = "SourceControl_DeletedWithWarnings" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py index 802d895ef601..3cef9c159131 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py @@ -10,19 +10,31 @@ from ._actions_operations import ActionsOperations from ._alert_rule_templates_operations import AlertRuleTemplatesOperations from ._automation_rules_operations import AutomationRulesOperations +from ._entities_operations import EntitiesOperations from ._incidents_operations import IncidentsOperations +from ._billing_statistics_operations import BillingStatisticsOperations from ._bookmarks_operations import BookmarksOperations from ._bookmark_relations_operations import BookmarkRelationsOperations from ._bookmark_operations import BookmarkOperations +from ._content_packages_operations import ContentPackagesOperations +from ._content_package_operations import ContentPackageOperations +from ._product_packages_operations import ProductPackagesOperations +from ._product_package_operations import ProductPackageOperations +from ._product_templates_operations import ProductTemplatesOperations +from ._product_template_operations import ProductTemplateOperations +from ._content_templates_operations import ContentTemplatesOperations +from ._content_template_operations import ContentTemplateOperations from ._ip_geodata_operations import IPGeodataOperations from ._domain_whois_operations import DomainWhoisOperations -from ._entities_operations import EntitiesOperations from ._entities_get_timeline_operations import EntitiesGetTimelineOperations from ._entities_relations_operations import EntitiesRelationsOperations from ._entity_relations_operations import EntityRelationsOperations from ._entity_queries_operations import EntityQueriesOperations from ._entity_query_templates_operations import EntityQueryTemplatesOperations from ._file_imports_operations import FileImportsOperations +from ._hunts_operations import HuntsOperations +from ._hunt_relations_operations import HuntRelationsOperations +from ._hunt_comments_operations import HuntCommentsOperations from ._incident_comments_operations import IncidentCommentsOperations from ._incident_relations_operations import IncidentRelationsOperations from ._incident_tasks_operations import IncidentTasksOperations @@ -39,8 +51,17 @@ from ._threat_intelligence_indicator_operations import ThreatIntelligenceIndicatorOperations from ._threat_intelligence_indicators_operations import ThreatIntelligenceIndicatorsOperations from ._threat_intelligence_indicator_metrics_operations import ThreatIntelligenceIndicatorMetricsOperations +from ._triggered_analytics_rule_run_operations import TriggeredAnalyticsRuleRunOperations +from ._get_triggered_analytics_rule_runs_operations import GetTriggeredAnalyticsRuleRunsOperations +from ._alert_rule_operations import AlertRuleOperations from ._watchlists_operations import WatchlistsOperations from ._watchlist_items_operations import WatchlistItemsOperations +from ._workspace_manager_assignments_operations import WorkspaceManagerAssignmentsOperations +from ._workspace_manager_assignment_jobs_operations import WorkspaceManagerAssignmentJobsOperations +from ._workspace_manager_configurations_operations import WorkspaceManagerConfigurationsOperations +from ._workspace_manager_groups_operations import WorkspaceManagerGroupsOperations +from ._workspace_manager_members_operations import WorkspaceManagerMembersOperations +from ._data_connector_definitions_operations import DataConnectorDefinitionsOperations from ._data_connectors_operations import DataConnectorsOperations from ._data_connectors_check_requirements_operations import DataConnectorsCheckRequirementsOperations from ._operations import Operations @@ -54,19 +75,31 @@ "ActionsOperations", "AlertRuleTemplatesOperations", "AutomationRulesOperations", + "EntitiesOperations", "IncidentsOperations", + "BillingStatisticsOperations", "BookmarksOperations", "BookmarkRelationsOperations", "BookmarkOperations", + "ContentPackagesOperations", + "ContentPackageOperations", + "ProductPackagesOperations", + "ProductPackageOperations", + "ProductTemplatesOperations", + "ProductTemplateOperations", + "ContentTemplatesOperations", + "ContentTemplateOperations", "IPGeodataOperations", "DomainWhoisOperations", - "EntitiesOperations", "EntitiesGetTimelineOperations", "EntitiesRelationsOperations", "EntityRelationsOperations", "EntityQueriesOperations", "EntityQueryTemplatesOperations", "FileImportsOperations", + "HuntsOperations", + "HuntRelationsOperations", + "HuntCommentsOperations", "IncidentCommentsOperations", "IncidentRelationsOperations", "IncidentTasksOperations", @@ -83,8 +116,17 @@ "ThreatIntelligenceIndicatorOperations", "ThreatIntelligenceIndicatorsOperations", "ThreatIntelligenceIndicatorMetricsOperations", + "TriggeredAnalyticsRuleRunOperations", + "GetTriggeredAnalyticsRuleRunsOperations", + "AlertRuleOperations", "WatchlistsOperations", "WatchlistItemsOperations", + "WorkspaceManagerAssignmentsOperations", + "WorkspaceManagerAssignmentJobsOperations", + "WorkspaceManagerConfigurationsOperations", + "WorkspaceManagerGroupsOperations", + "WorkspaceManagerMembersOperations", + "DataConnectorDefinitionsOperations", "DataConnectorsOperations", "DataConnectorsCheckRequirementsOperations", "Operations", diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py index a26c034dbc69..c3d54e17a6c6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_by_alert_rule_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +67,7 @@ def build_list_by_alert_rule_request( "ruleId": _SERIALIZER.url("rule_id", rule_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") @@ -90,9 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +109,7 @@ def build_get_request( "actionId": _SERIALIZER.url("action_id", action_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") @@ -134,9 +126,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +152,7 @@ def build_create_or_update_request( "actionId": _SERIALIZER.url("action_id", action_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") @@ -181,9 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +196,7 @@ def build_delete_request( "actionId": _SERIALIZER.url("action_id", action_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") @@ -259,9 +247,7 @@ def list_by_alert_rule( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActionsList] = kwargs.pop("cls", None) error_map = { @@ -316,8 +302,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,9 +351,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActionResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -383,8 +368,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +479,7 @@ def create_or_update( :type rule_id: str :param action_id: Action ID. Required. :type action_id: str - :param action: The action. Is either a model type or a IO type. Required. + :param action: The action. Is either a ActionRequest type or a IO type. Required. :type action: ~azure.mgmt.securityinsight.models.ActionRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -514,16 +500,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ActionResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(action, (IO, bytes)): + if isinstance(action, (IOBase, bytes)): _content = action else: _json = self._serialize.body(action, "ActionRequest") @@ -545,8 +529,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,9 +586,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -620,8 +603,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_operations.py new file mode 100644 index 000000000000..f3092df6818d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_operations.py @@ -0,0 +1,334 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_trigger_rule_run_request( + resource_group_name: str, workspace_name: str, rule_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "ruleId": _SERIALIZER.url("rule_id", rule_id, "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 AlertRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`alert_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") + + def _trigger_rule_run_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: Union[_models.AnalyticsRuleRunTrigger, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(analytics_rule_run_trigger_parameter, (IOBase, bytes)): + _content = analytics_rule_run_trigger_parameter + else: + _json = self._serialize.body(analytics_rule_run_trigger_parameter, "AnalyticsRuleRunTrigger") + + request = build_trigger_rule_run_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._trigger_rule_run_initial.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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_rule_run_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun" + } + + @overload + def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: _models.AnalyticsRuleRunTrigger, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. + Required. + :type analytics_rule_run_trigger_parameter: + ~azure.mgmt.securityinsight.models.AnalyticsRuleRunTrigger + :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: + """ + + @overload + def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. + Required. + :type analytics_rule_run_trigger_parameter: 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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_rule_run( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + analytics_rule_run_trigger_parameter: Union[_models.AnalyticsRuleRunTrigger, IO], + **kwargs: Any + ) -> LROPoller[None]: + """triggers analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_id: Alert rule ID. Required. + :type rule_id: str + :param analytics_rule_run_trigger_parameter: The Analytics Rule Run Trigger parameter. Is + either a AnalyticsRuleRunTrigger type or a IO type. Required. + :type analytics_rule_run_trigger_parameter: + ~azure.mgmt.securityinsight.models.AnalyticsRuleRunTrigger 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 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._trigger_rule_run_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + analytics_rule_run_trigger_parameter=analytics_rule_run_trigger_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_trigger_rule_run.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py index 938d7e565001..874ef86ec770 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +65,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") @@ -89,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +106,7 @@ def build_get_request( "alertRuleTemplateId": _SERIALIZER.url("alert_rule_template_id", alert_rule_template_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") @@ -164,9 +155,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRuleTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -220,8 +209,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -266,9 +256,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRuleTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -284,8 +272,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py index 911942febd7a..e1ca9169ce18 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +66,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") @@ -89,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_get_request( "ruleId": _SERIALIZER.url("rule_id", rule_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,9 +124,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +149,7 @@ def build_create_or_update_request( "ruleId": _SERIALIZER.url("rule_id", rule_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") @@ -178,9 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +192,7 @@ def build_delete_request( "ruleId": _SERIALIZER.url("rule_id", rule_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") @@ -251,9 +239,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRulesList] = kwargs.pop("cls", None) error_map = { @@ -307,8 +293,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,9 +338,7 @@ def get(self, resource_group_name: str, workspace_name: str, rule_id: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AlertRule] = kwargs.pop("cls", None) request = build_get_request( @@ -369,8 +354,9 @@ def get(self, resource_group_name: str, workspace_name: str, rule_id: str, **kwa 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +456,7 @@ def create_or_update( :type workspace_name: str :param rule_id: Alert rule ID. Required. :type rule_id: str - :param alert_rule: The alert rule. Is either a model type or a IO type. Required. + :param alert_rule: The alert rule. Is either a AlertRule type or a IO type. Required. :type alert_rule: ~azure.mgmt.securityinsight.models.AlertRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -491,16 +477,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AlertRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_rule, (IO, bytes)): + if isinstance(alert_rule, (IOBase, bytes)): _content = alert_rule else: _json = self._serialize.body(alert_rule, "AlertRule") @@ -521,8 +505,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,9 +560,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -593,8 +576,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py index bb9e386f6773..60b57cb9d2f0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload import urllib.parse @@ -28,16 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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 -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +73,7 @@ def build_get_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_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") @@ -95,9 +90,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +115,7 @@ def build_create_or_update_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_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") @@ -141,9 +134,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +158,7 @@ def build_delete_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_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") @@ -184,9 +175,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +198,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") @@ -268,9 +257,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationRule] = kwargs.pop("cls", None) request = build_get_request( @@ -286,8 +273,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,8 +375,8 @@ def create_or_update( :type workspace_name: str :param automation_rule_id: Automation rule ID. Required. :type automation_rule_id: str - :param automation_rule_to_upsert: The automation rule. Is either a model type or a IO type. - Default value is None. + :param automation_rule_to_upsert: The automation rule. Is either a AutomationRule type or a IO + type. Default value is None. :type automation_rule_to_upsert: ~azure.mgmt.securityinsight.models.AutomationRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -409,16 +397,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AutomationRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation_rule_to_upsert, (IO, bytes)): + if isinstance(automation_rule_to_upsert, (IOBase, bytes)): _content = automation_rule_to_upsert else: if automation_rule_to_upsert is not None: @@ -442,8 +428,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,9 +481,7 @@ def delete(self, resource_group_name: str, workspace_name: str, automation_rule_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[JSON] = kwargs.pop("cls", None) request = build_delete_request( @@ -512,8 +497,9 @@ def delete(self, resource_group_name: str, workspace_name: str, automation_rule_ 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,9 +540,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutomationRulesList] = kwargs.pop("cls", None) error_map = { @@ -610,8 +594,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_billing_statistics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_billing_statistics_operations.py new file mode 100644 index 000000000000..6c65b37f110b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_billing_statistics_operations.py @@ -0,0 +1,299 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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_get_request( + resource_group_name: str, workspace_name: str, billing_statistic_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics/{billingStatisticName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "billingStatisticName": _SERIALIZER.url( + "billing_statistic_name", billing_statistic_name, "str", pattern=r"^[A-Za-z0-9][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) + + +class BillingStatisticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`billing_statistics` 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.BillingStatistic"]: + """Gets all Microsoft Sentinel billing statistics. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 BillingStatistic or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.BillingStatistic] + :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.BillingStatisticList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BillingStatisticList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, billing_statistic_name: str, **kwargs: Any + ) -> _models.BillingStatistic: + """Gets a billing statistic. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param billing_statistic_name: The name of the billing statistic. Required. + :type billing_statistic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BillingStatistic or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.BillingStatistic + :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.BillingStatistic] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + billing_statistic_name=billing_statistic_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("BillingStatistic", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics/{billingStatisticName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py index 493b78b645ee..9ccc7dbeb650 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_expand_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72,7 +66,7 @@ def build_expand_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_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") @@ -187,7 +181,7 @@ def expand( :param bookmark_id: Bookmark ID. Required. :type bookmark_id: str :param parameters: The parameters required to execute an expand operation on the given - bookmark. Is either a model type or a IO type. Required. + bookmark. Is either a BookmarkExpandParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.BookmarkExpandParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -208,16 +202,14 @@ def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.BookmarkExpandResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BookmarkExpandParameters") @@ -238,8 +230,9 @@ def expand( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py index ea17c2058589..6d86fc5738a4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,9 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +76,7 @@ def build_list_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_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") @@ -112,9 +106,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +131,7 @@ def build_get_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -161,9 +153,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +179,7 @@ def build_create_or_update_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -213,9 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +228,7 @@ def build_delete_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -311,9 +299,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -372,8 +358,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,9 +407,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_request( @@ -439,8 +424,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,7 +535,7 @@ def create_or_update( :type bookmark_id: str :param relation_name: Relation Name. Required. :type relation_name: str - :param relation: The relation model. Is either a model type or a IO type. Required. + :param relation: The relation model. Is either a Relation type or a IO type. Required. :type relation: ~azure.mgmt.securityinsight.models.Relation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -570,16 +556,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Relation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(relation, (IO, bytes)): + if isinstance(relation, (IOBase, bytes)): _content = relation else: _json = self._serialize.body(relation, "Relation") @@ -601,8 +585,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,9 +642,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -676,8 +659,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py index 3f7b2f8ad3de..8099f2bcbfb9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +66,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") @@ -89,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_get_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_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,9 +124,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +149,7 @@ def build_create_or_update_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_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") @@ -178,9 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +192,7 @@ def build_delete_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_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") @@ -251,9 +239,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BookmarkList] = kwargs.pop("cls", None) error_map = { @@ -307,8 +293,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,9 +338,7 @@ def get(self, resource_group_name: str, workspace_name: str, bookmark_id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Bookmark] = kwargs.pop("cls", None) request = build_get_request( @@ -369,8 +354,9 @@ def get(self, resource_group_name: str, workspace_name: str, bookmark_id: str, * 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +456,7 @@ def create_or_update( :type workspace_name: str :param bookmark_id: Bookmark ID. Required. :type bookmark_id: str - :param bookmark: The bookmark. Is either a model type or a IO type. Required. + :param bookmark: The bookmark. Is either a Bookmark type or a IO type. Required. :type bookmark: ~azure.mgmt.securityinsight.models.Bookmark or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -491,16 +477,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Bookmark] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(bookmark, (IO, bytes)): + if isinstance(bookmark, (IOBase, bytes)): _content = bookmark else: _json = self._serialize.body(bookmark, "Bookmark") @@ -521,8 +505,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,9 +560,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -593,8 +576,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_package_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_package_operations.py new file mode 100644 index 000000000000..3c5e344b97ef --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_package_operations.py @@ -0,0 +1,359 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_install_request( + resource_group_name: str, workspace_name: str, package_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "packageId": _SERIALIZER.url("package_id", package_id, "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_uninstall_request( + resource_group_name: str, workspace_name: str, package_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "packageId": _SERIALIZER.url("package_id", package_id, "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) + + +class ContentPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`content_package` 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 install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: _models.PackageModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Required. + :type package_installation_properties: ~azure.mgmt.securityinsight.models.PackageModel + :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: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Required. + :type package_installation_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def install( + self, + resource_group_name: str, + workspace_name: str, + package_id: str, + package_installation_properties: Union[_models.PackageModel, IO], + **kwargs: Any + ) -> _models.PackageModel: + """Install a package to 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :param package_installation_properties: Package installation properties. Is either a + PackageModel type or a IO type. Required. + :type package_installation_properties: ~azure.mgmt.securityinsight.models.PackageModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.PackageModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(package_installation_properties, (IOBase, bytes)): + _content = package_installation_properties + else: + _json = self._serialize.body(package_installation_properties, "PackageModel") + + request = build_install_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.install.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PackageModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + install.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } + + @distributed_trace + def uninstall( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> None: + """Uninstall a package from 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: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_uninstall_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.uninstall.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + uninstall.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_packages_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_packages_operations.py new file mode 100644 index 000000000000..5be759f5e15f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_packages_operations.py @@ -0,0 +1,357 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if search is not None: + _params["$search"] = _SERIALIZER.query("search", search, "str") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, package_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "packageId": _SERIALIZER.url("package_id", package_id, "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) + + +class ContentPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`content_packages` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.PackageModel"]: + """Gets all installed packages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PackageModel or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.PackageModel] + :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.PackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PackageList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> _models.PackageModel: + """Gets an installed packages by its id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.PackageModel + :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.PackageModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_template_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_template_operations.py new file mode 100644 index 000000000000..1d4fe96e86ef --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_template_operations.py @@ -0,0 +1,472 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_install_request( + resource_group_name: str, workspace_name: str, template_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "templateId": _SERIALIZER.url("template_id", template_id, "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_get_request( + resource_group_name: str, workspace_name: str, template_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "templateId": _SERIALIZER.url("template_id", template_id, "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_delete_request( + resource_group_name: str, workspace_name: str, template_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "templateId": _SERIALIZER.url("template_id", template_id, "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) + + +class ContentTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`content_template` 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 install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: _models.TemplateModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Required. + :type template_installation_properties: ~azure.mgmt.securityinsight.models.TemplateModel + :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: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Required. + :type template_installation_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def install( + self, + resource_group_name: str, + workspace_name: str, + template_id: str, + template_installation_properties: Union[_models.TemplateModel, IO], + **kwargs: Any + ) -> _models.TemplateModel: + """Install a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :param template_installation_properties: Template installation properties. Is either a + TemplateModel type or a IO type. Required. + :type template_installation_properties: ~azure.mgmt.securityinsight.models.TemplateModel or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.TemplateModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(template_installation_properties, (IOBase, bytes)): + _content = template_installation_properties + else: + _json = self._serialize.body(template_installation_properties, "TemplateModel") + + request = build_install_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.install.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + install.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> _models.TemplateModel: + """Gets a template byt its identifier. + Expandable properties: + + + * properties/mainTemplate + * properties/dependantTemplates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TemplateModel + :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.TemplateModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> None: + """Delete an installed template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + template_id=template_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_templates_operations.py new file mode 100644 index 000000000000..83909c4ab1ac --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_content_templates_operations.py @@ -0,0 +1,262 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + expand: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if search is not None: + _params["$search"] = _SERIALIZER.query("search", search, "str") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContentTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`content_templates` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + expand: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TemplateModel"]: + """Gets all installed templates. + Expandable properties: + + + * properties/mainTemplate + * properties/dependantTemplates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param expand: Expands the object with optional fiends that are not included by default. + Optional. Default value is None. + :type expand: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TemplateModel or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.TemplateModel] + :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.TemplateList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + expand=expand, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TemplateList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connector_definitions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connector_definitions_operations.py new file mode 100644 index 000000000000..6ac8ca4d5ba1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connector_definitions_operations.py @@ -0,0 +1,621 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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_get_request( + resource_group_name: str, + workspace_name: str, + data_connector_definition_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "dataConnectorDefinitionName": _SERIALIZER.url( + "data_connector_definition_name", data_connector_definition_name, "str", pattern=r"^[a-z0-9A-Z-_]*$" + ), + } + + _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, + data_connector_definition_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-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "dataConnectorDefinitionName": _SERIALIZER.url( + "data_connector_definition_name", data_connector_definition_name, "str", pattern=r"^[a-z0-9A-Z-_]*$" + ), + } + + _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_delete_request( + resource_group_name: str, + workspace_name: str, + data_connector_definition_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "dataConnectorDefinitionName": _SERIALIZER.url( + "data_connector_definition_name", data_connector_definition_name, "str", pattern=r"^[a-z0-9A-Z-_]*$" + ), + } + + _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) + + +class DataConnectorDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`data_connector_definitions` 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.DataConnectorDefinition"]: + """Gets all data connector definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 DataConnectorDefinition or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.DataConnectorDefinition] + :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.DataConnectorDefinitionArmCollectionWrapper] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataConnectorDefinitionArmCollectionWrapper", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, data_connector_definition_name: str, **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Gets a data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :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.DataConnectorDefinition] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_definition_name=data_connector_definition_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataConnectorDefinition", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: _models.DataConnectorDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Required. + :type connector_definition_input: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :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: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Required. + :type connector_definition_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_definition_name: str, + connector_definition_input: Union[_models.DataConnectorDefinition, IO], + **kwargs: Any + ) -> _models.DataConnectorDefinition: + """Creates or updates the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_name: str + :param connector_definition_input: The data connector definition. Is either a + DataConnectorDefinition type or a IO type. Required. + :type connector_definition_input: ~azure.mgmt.securityinsight.models.DataConnectorDefinition or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorDefinition or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.DataConnectorDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connector_definition_input, (IOBase, bytes)): + _content = connector_definition_input + else: + _json = self._serialize.body(connector_definition_input, "DataConnectorDefinition") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_definition_name=data_connector_definition_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DataConnectorDefinition", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DataConnectorDefinition", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, data_connector_definition_name: str, **kwargs: Any + ) -> None: + """Delete the data connector definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param data_connector_definition_name: The data connector definition name. Required. + :type data_connector_definition_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, + data_connector_definition_name=data_connector_definition_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py index a443aede96d7..5309fe02d32d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_post_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71,7 +65,7 @@ def build_post_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") @@ -178,7 +172,7 @@ def post( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param data_connectors_check_requirements: The parameters for requirements check message. Is - either a model type or a IO type. Required. + either a DataConnectorsCheckRequirements type or a IO type. Required. :type data_connectors_check_requirements: ~azure.mgmt.securityinsight.models.DataConnectorsCheckRequirements or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -200,16 +194,14 @@ def post( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataConnectorRequirementsState] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_connectors_check_requirements, (IO, bytes)): + if isinstance(data_connectors_check_requirements, (IOBase, bytes)): _content = data_connectors_check_requirements else: _json = self._serialize.body(data_connectors_check_requirements, "DataConnectorsCheckRequirements") @@ -229,8 +221,9 @@ def post( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py index d0adeeadb0c8..2f9375da6b99 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +66,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") @@ -89,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_get_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_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,9 +124,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +149,7 @@ def build_create_or_update_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_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") @@ -178,9 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +192,7 @@ def build_delete_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_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") @@ -221,9 +209,7 @@ def build_connect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -248,7 +234,7 @@ def build_connect_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_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") @@ -267,9 +253,7 @@ def build_disconnect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,7 +277,7 @@ def build_disconnect_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_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") @@ -340,9 +324,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataConnectorList] = kwargs.pop("cls", None) error_map = { @@ -396,8 +378,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,9 +425,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -460,8 +441,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,7 +543,8 @@ def create_or_update( :type workspace_name: str :param data_connector_id: Connector ID. Required. :type data_connector_id: str - :param data_connector: The data connector. Is either a model type or a IO type. Required. + :param data_connector: The data connector. Is either a DataConnector type or a IO type. + Required. :type data_connector: ~azure.mgmt.securityinsight.models.DataConnector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -582,16 +565,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_connector, (IO, bytes)): + if isinstance(data_connector, (IOBase, bytes)): _content = data_connector else: _json = self._serialize.body(data_connector, "DataConnector") @@ -612,8 +593,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -666,9 +648,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -684,8 +664,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -781,7 +762,8 @@ def connect( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param data_connector_id: Connector ID. Required. :type data_connector_id: str - :param connect_body: The data connector. Is either a model type or a IO type. Required. + :param connect_body: The data connector. Is either a DataConnectorConnectBody type or a IO + type. Required. :type connect_body: ~azure.mgmt.securityinsight.models.DataConnectorConnectBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -802,16 +784,14 @@ def connect( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(connect_body, (IO, bytes)): + if isinstance(connect_body, (IOBase, bytes)): _content = connect_body else: _json = self._serialize.body(connect_body, "DataConnectorConnectBody") @@ -832,8 +812,9 @@ def connect( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -878,9 +859,7 @@ def disconnect( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_disconnect_request( @@ -896,8 +875,9 @@ def disconnect( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py index ce39a050336d..84096256a649 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,9 +38,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, domain: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +53,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, domain: ), } - _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,9 +109,7 @@ def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnrichmentDomainWhois] = kwargs.pop("cls", None) request = build_get_request( @@ -133,8 +124,9 @@ def get(self, resource_group_name: str, domain: str, **kwargs: Any) -> _models.E 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py index 0cdd1ffdd887..16172c0cbaea 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -72,7 +66,7 @@ def build_list_request( "entityId": _SERIALIZER.url("entity_id", entity_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") @@ -187,7 +181,7 @@ def list( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute an timeline operation on the given - entity. Is either a model type or a IO type. Required. + entity. Is either a EntityTimelineParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityTimelineParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -208,16 +202,14 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityTimelineResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityTimelineParameters") @@ -238,8 +230,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py index 7a25ea360d46..65ce2611d9e8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,15 +37,57 @@ _SERIALIZER.client_side_validation = False +def build_run_playbook_request( + resource_group_name: str, workspace_name: str, entity_identifier: 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-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityIdentifier}/runPlaybook", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "entityIdentifier": _SERIALIZER.url("entity_identifier", entity_identifier, "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_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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +110,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") @@ -89,9 +127,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +151,7 @@ def build_get_request( "entityId": _SERIALIZER.url("entity_id", entity_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,9 +168,7 @@ def build_expand_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +193,7 @@ def build_expand_request( "entityId": _SERIALIZER.url("entity_id", entity_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") @@ -184,9 +218,7 @@ def build_queries_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +242,7 @@ def build_queries_request( "entityId": _SERIALIZER.url("entity_id", entity_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") @@ -228,9 +260,7 @@ def build_get_insights_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -255,7 +285,7 @@ def build_get_insights_request( "entityId": _SERIALIZER.url("entity_id", entity_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") @@ -287,6 +317,159 @@ def __init__(self, *args, **kwargs): 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 run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[_models.EntityManualTriggerRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Default + value is None. + :type request_body: ~azure.mgmt.securityinsight.models.EntityManualTriggerRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Default + value is None. + :type request_body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def run_playbook( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + entity_identifier: str, + request_body: Optional[Union[_models.EntityManualTriggerRequestBody, IO]] = None, + **kwargs: Any + ) -> None: + """Triggers playbook on a specific entity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param entity_identifier: Entity identifier. Required. + :type entity_identifier: str + :param request_body: Describes the request body for triggering a playbook on an entity. Is + either a EntityManualTriggerRequestBody type or a IO type. Default value is None. + :type request_body: ~azure.mgmt.securityinsight.models.EntityManualTriggerRequestBody or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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(request_body, (IOBase, bytes)): + _content = request_body + else: + if request_body is not None: + _json = self._serialize.body(request_body, "EntityManualTriggerRequestBody") + else: + _json = None + + request = build_run_playbook_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + entity_identifier=entity_identifier, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.run_playbook.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + run_playbook.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityIdentifier}/runPlaybook" + } + @distributed_trace def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> Iterable["_models.Entity"]: """Gets all entities. @@ -304,9 +487,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityList] = kwargs.pop("cls", None) error_map = { @@ -360,8 +541,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -404,9 +586,7 @@ def get(self, resource_group_name: str, workspace_name: str, entity_id: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Entity] = kwargs.pop("cls", None) request = build_get_request( @@ -422,8 +602,9 @@ def get(self, resource_group_name: str, workspace_name: str, entity_id: str, **k 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,7 +707,7 @@ def expand( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute an expand operation on the given entity. - Is either a model type or a IO type. Required. + Is either a EntityExpandParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityExpandParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -547,16 +728,14 @@ def expand( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityExpandResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityExpandParameters") @@ -577,8 +756,9 @@ def expand( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,9 +814,7 @@ def queries( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GetQueriesResponse] = kwargs.pop("cls", None) request = build_queries_request( @@ -653,8 +831,9 @@ def queries( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,7 +934,7 @@ def get_insights( :param entity_id: entity ID. Required. :type entity_id: str :param parameters: The parameters required to execute insights on the given entity. Is either a - model type or a IO type. Required. + EntityGetInsightsParameters type or a IO type. Required. :type parameters: ~azure.mgmt.securityinsight.models.EntityGetInsightsParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -776,16 +955,14 @@ def get_insights( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityGetInsightsResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EntityGetInsightsParameters") @@ -806,8 +983,9 @@ def get_insights( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py index e160a77e83f7..43fe6cb1af31 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,9 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +75,7 @@ def build_list_request( "entityId": _SERIALIZER.url("entity_id", entity_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") @@ -161,9 +154,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -222,8 +213,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py index 89f9d636c466..82dfc4ec2114 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,15 +42,13 @@ def build_list_request( workspace_name: str, subscription_id: str, *, - kind: Optional[Union[str, _models.Enum13]] = None, + kind: Optional[Union[str, _models.Enum20]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,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 if kind is not None: @@ -96,9 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +114,7 @@ def build_get_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_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") @@ -139,9 +131,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +156,7 @@ def build_create_or_update_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_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") @@ -185,9 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +199,7 @@ def build_delete_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_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") @@ -246,7 +234,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, _models.Enum13]] = None, + kind: Optional[Union[str, _models.Enum20]] = None, **kwargs: Any ) -> Iterable["_models.EntityQuery"]: """Gets all entity queries. @@ -258,7 +246,7 @@ def list( :type workspace_name: str :param kind: The entity query kind we want to fetch. Known values are: "Expansion" and "Activity". Default value is None. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum13 + :type kind: str or ~azure.mgmt.securityinsight.models.Enum20 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQuery or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.EntityQuery] @@ -267,9 +255,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryList] = kwargs.pop("cls", None) error_map = { @@ -324,8 +310,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,9 +357,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQuery] = kwargs.pop("cls", None) request = build_get_request( @@ -388,8 +373,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,8 +475,8 @@ def create_or_update( :type workspace_name: str :param entity_query_id: entity query ID. Required. :type entity_query_id: str - :param entity_query: The entity query we want to create or update. Is either a model type or a - IO type. Required. + :param entity_query: The entity query we want to create or update. Is either a + CustomEntityQuery type or a IO type. Required. :type entity_query: ~azure.mgmt.securityinsight.models.CustomEntityQuery or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -511,16 +497,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.EntityQuery] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(entity_query, (IO, bytes)): + if isinstance(entity_query, (IOBase, bytes)): _content = entity_query else: _json = self._serialize.body(entity_query, "CustomEntityQuery") @@ -541,8 +525,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -595,9 +580,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -613,8 +596,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py index cd961f94a317..8272140d9d1f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar, Union import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,15 +41,13 @@ def build_list_request( workspace_name: str, subscription_id: str, *, - kind: Optional[Union[str, _models.Enum15]] = None, + kind: Optional[Union[str, _models.Enum22]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,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 if kind is not None: @@ -96,9 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +113,7 @@ def build_get_request( "entityQueryTemplateId": _SERIALIZER.url("entity_query_template_id", entity_query_template_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") @@ -157,7 +148,7 @@ def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, _models.Enum15]] = None, + kind: Optional[Union[str, _models.Enum22]] = None, **kwargs: Any ) -> Iterable["_models.EntityQueryTemplate"]: """Gets all entity query templates. @@ -168,7 +159,7 @@ def list( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param kind: The entity template query kind we want to fetch. "Activity" Default value is None. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum15 + :type kind: str or ~azure.mgmt.securityinsight.models.Enum22 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryTemplate or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.EntityQueryTemplate] @@ -177,9 +168,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryTemplateList] = kwargs.pop("cls", None) error_map = { @@ -234,8 +223,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,9 +270,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EntityQueryTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -298,8 +286,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py index 676e478cc9d2..dc3558362843 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,9 +45,7 @@ def build_get_relation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +70,7 @@ def build_get_relation_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -138,9 +131,7 @@ def get_relation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_relation_request( @@ -157,8 +148,9 @@ def get_relation( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py index 156bf96f7654..bc6576df1c4e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_file_imports_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,9 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +76,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") @@ -107,9 +101,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +125,7 @@ def build_get_request( "fileImportId": _SERIALIZER.url("file_import_id", file_import_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") @@ -150,9 +142,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -177,7 +167,7 @@ def build_create_request( "fileImportId": _SERIALIZER.url("file_import_id", file_import_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") @@ -196,9 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +210,7 @@ def build_delete_request( "fileImportId": _SERIALIZER.url("file_import_id", file_import_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") @@ -290,9 +278,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImportList] = kwargs.pop("cls", None) error_map = { @@ -350,8 +336,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,9 +383,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImport] = kwargs.pop("cls", None) request = build_get_request( @@ -414,8 +399,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +501,7 @@ def create( :type workspace_name: str :param file_import_id: File import ID. Required. :type file_import_id: str - :param file_import: The file import. Is either a model type or a IO type. Required. + :param file_import: The file import. Is either a FileImport type or a IO type. Required. :type file_import: ~azure.mgmt.securityinsight.models.FileImport or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -536,16 +522,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.FileImport] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(file_import, (IO, bytes)): + if isinstance(file_import, (IOBase, bytes)): _content = file_import else: _json = self._serialize.body(file_import, "FileImport") @@ -566,8 +550,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,9 +586,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.FileImport]] = kwargs.pop("cls", None) request = build_delete_request( @@ -619,8 +602,9 @@ def _delete_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,9 +654,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileImport] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py index 8d495ea329ef..400e691fbe4a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_single_recommendation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +64,7 @@ def build_single_recommendation_request( "recommendationId": _SERIALIZER.url("recommendation_id", recommendation_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") @@ -130,9 +123,7 @@ def single_recommendation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Recommendation] = kwargs.pop("cls", None) request = build_single_recommendation_request( @@ -148,8 +139,9 @@ def single_recommendation( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py index a6e5f145a99f..c029dea5fada 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_recommendations_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,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") @@ -125,9 +118,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecommendationList] = kwargs.pop("cls", None) request = build_list_request( @@ -142,8 +133,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_triggered_analytics_rule_runs_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_triggered_analytics_rule_runs_operations.py new file mode 100644 index 000000000000..fb3523d9aa5d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_get_triggered_analytics_rule_runs_operations.py @@ -0,0 +1,189 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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) + + +class GetTriggeredAnalyticsRuleRunsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`get_triggered_analytics_rule_runs` 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.TriggeredAnalyticsRuleRun"]: + """Gets the triggered analytics rule runs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the 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 TriggeredAnalyticsRuleRun or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun] + :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.TriggeredAnalyticsRuleRuns] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TriggeredAnalyticsRuleRuns", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_comments_operations.py new file mode 100644 index 000000000000..ecc506271661 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_comments_operations.py @@ -0,0 +1,678 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + hunt_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + hunt_id: str, + hunt_comment_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntCommentId": _SERIALIZER.url("hunt_comment_id", hunt_comment_id, "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_delete_request( + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntCommentId": _SERIALIZER.url("hunt_comment_id", hunt_comment_id, "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_create_or_update_request( + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntCommentId": _SERIALIZER.url("hunt_comment_id", hunt_comment_id, "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 HuntCommentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`hunt_comments` 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, + hunt_id: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.HuntComment"]: + """Gets all hunt comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HuntComment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.HuntComment] + :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.HuntCommentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("HuntCommentList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_comment_id: str, **kwargs: Any + ) -> _models.HuntComment: + """Gets a hunt comment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :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.HuntComment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HuntComment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_comment_id: str, **kwargs: Any + ) -> None: + """Delete a hunt comment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: _models.HuntComment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Required. + :type hunt_comment: ~azure.mgmt.securityinsight.models.HuntComment + :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: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Required. + :type hunt_comment: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_comment_id: str, + hunt_comment: Union[_models.HuntComment, IO], + **kwargs: Any + ) -> _models.HuntComment: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_comment_id: The hunt comment id (GUID). Required. + :type hunt_comment_id: str + :param hunt_comment: The hunt comment. Is either a HuntComment type or a IO type. Required. + :type hunt_comment: ~azure.mgmt.securityinsight.models.HuntComment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntComment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.HuntComment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt_comment, (IOBase, bytes)): + _content = hunt_comment + else: + _json = self._serialize.body(hunt_comment, "HuntComment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_comment_id=hunt_comment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HuntComment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HuntComment", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_relations_operations.py new file mode 100644 index 000000000000..43b0e8923549 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunt_relations_operations.py @@ -0,0 +1,678 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + hunt_id: str, + subscription_id: str, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + hunt_id: str, + hunt_relation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntRelationId": _SERIALIZER.url("hunt_relation_id", hunt_relation_id, "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_delete_request( + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntRelationId": _SERIALIZER.url("hunt_relation_id", hunt_relation_id, "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_create_or_update_request( + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "str"), + "huntRelationId": _SERIALIZER.url("hunt_relation_id", hunt_relation_id, "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 HuntRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`hunt_relations` 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, + hunt_id: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.HuntRelation"]: + """Gets all hunt relations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HuntRelation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.HuntRelation] + :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.HuntRelationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("HuntRelationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_relation_id: str, **kwargs: Any + ) -> _models.HuntRelation: + """Gets a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :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.HuntRelation] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HuntRelation", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt_relation_id: str, **kwargs: Any + ) -> None: + """Delete a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: _models.HuntRelation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Required. + :type hunt_relation: ~azure.mgmt.securityinsight.models.HuntRelation + :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: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Required. + :type hunt_relation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt_relation_id: str, + hunt_relation: Union[_models.HuntRelation, IO], + **kwargs: Any + ) -> _models.HuntRelation: + """Creates or updates a hunt relation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt_relation_id: The hunt relation id (GUID). Required. + :type hunt_relation_id: str + :param hunt_relation: The hunt relation. Is either a HuntRelation type or a IO type. Required. + :type hunt_relation: ~azure.mgmt.securityinsight.models.HuntRelation or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HuntRelation or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.HuntRelation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.HuntRelation] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt_relation, (IOBase, bytes)): + _content = hunt_relation + else: + _json = self._serialize.body(hunt_relation, "HuntRelation") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + hunt_relation_id=hunt_relation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("HuntRelation", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HuntRelation", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunts_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunts_operations.py new file mode 100644 index 000000000000..3aa122b1ea6b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_hunts_operations.py @@ -0,0 +1,631 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, hunt_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "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_delete_request( + resource_group_name: str, workspace_name: str, hunt_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "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_create_or_update_request( + resource_group_name: str, workspace_name: str, hunt_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "huntId": _SERIALIZER.url("hunt_id", hunt_id, "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 HuntsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`hunts` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Hunt"]: + """Gets all hunts, without relations and comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Hunt or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.Hunt] + :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.HuntList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("HuntList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts" + } + + @distributed_trace + def get(self, resource_group_name: str, workspace_name: str, hunt_id: str, **kwargs: Any) -> _models.Hunt: + """Gets a hunt, without relations and comments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :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.Hunt] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Hunt", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, hunt_id: str, **kwargs: Any + ) -> None: + """Delete a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt: _models.Hunt, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Required. + :type hunt: ~azure.mgmt.securityinsight.models.Hunt + :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: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + hunt_id: str, + hunt: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Required. + :type hunt: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, workspace_name: str, hunt_id: str, hunt: Union[_models.Hunt, IO], **kwargs: Any + ) -> _models.Hunt: + """Create or update a hunt. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param hunt_id: The hunt id (GUID). Required. + :type hunt_id: str + :param hunt: The hunt. Is either a Hunt type or a IO type. Required. + :type hunt: ~azure.mgmt.securityinsight.models.Hunt or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Hunt or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Hunt + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.Hunt] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(hunt, (IOBase, bytes)): + _content = hunt + else: + _json = self._serialize.body(hunt, "Hunt") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + hunt_id=hunt_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Hunt", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Hunt", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py index 8b63ffbf0831..5a131f23db9a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,9 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +76,7 @@ def build_list_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -112,9 +106,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +131,7 @@ def build_get_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_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") @@ -161,9 +153,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +179,7 @@ def build_create_or_update_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_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") @@ -213,9 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +228,7 @@ def build_delete_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_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") @@ -311,9 +299,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentCommentList] = kwargs.pop("cls", None) error_map = { @@ -372,8 +358,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,9 +407,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentComment] = kwargs.pop("cls", None) request = build_get_request( @@ -439,8 +424,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,7 +535,8 @@ def create_or_update( :type incident_id: str :param incident_comment_id: Incident comment ID. Required. :type incident_comment_id: str - :param incident_comment: The incident comment. Is either a model type or a IO type. Required. + :param incident_comment: The incident comment. Is either a IncidentComment type or a IO type. + Required. :type incident_comment: ~azure.mgmt.securityinsight.models.IncidentComment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -570,16 +557,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.IncidentComment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident_comment, (IO, bytes)): + if isinstance(incident_comment, (IOBase, bytes)): _content = incident_comment else: _json = self._serialize.body(incident_comment, "IncidentComment") @@ -601,8 +586,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,9 +643,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -676,8 +660,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py index 4c9164691097..cf5328b44f1d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,9 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +76,7 @@ def build_list_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -112,9 +106,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +131,7 @@ def build_get_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -161,9 +153,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +179,7 @@ def build_create_or_update_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -213,9 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +228,7 @@ def build_delete_request( "relationName": _SERIALIZER.url("relation_name", relation_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") @@ -311,9 +299,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RelationList] = kwargs.pop("cls", None) error_map = { @@ -372,8 +358,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,9 +407,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Relation] = kwargs.pop("cls", None) request = build_get_request( @@ -439,8 +424,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,7 +535,7 @@ def create_or_update( :type incident_id: str :param relation_name: Relation Name. Required. :type relation_name: str - :param relation: The relation model. Is either a model type or a IO type. Required. + :param relation: The relation model. Is either a Relation type or a IO type. Required. :type relation: ~azure.mgmt.securityinsight.models.Relation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -570,16 +556,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Relation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(relation, (IO, bytes)): + if isinstance(relation, (IOBase, bytes)): _content = relation else: _json = self._serialize.body(relation, "Relation") @@ -601,8 +585,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,9 +642,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -676,8 +659,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_tasks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_tasks_operations.py index 95ff858a910f..7495e88aae95 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_tasks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_tasks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +67,7 @@ def build_list_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -95,9 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +114,7 @@ def build_get_request( "incidentTaskId": _SERIALIZER.url("incident_task_id", incident_task_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") @@ -144,9 +136,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +162,7 @@ def build_create_or_update_request( "incidentTaskId": _SERIALIZER.url("incident_task_id", incident_task_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") @@ -196,9 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -223,7 +211,7 @@ def build_delete_request( "incidentTaskId": _SERIALIZER.url("incident_task_id", incident_task_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") @@ -274,9 +262,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentTaskList] = kwargs.pop("cls", None) error_map = { @@ -331,8 +317,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,9 +366,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentTask] = kwargs.pop("cls", None) request = build_get_request( @@ -398,8 +383,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -508,7 +494,7 @@ def create_or_update( :type incident_id: str :param incident_task_id: Incident task ID. Required. :type incident_task_id: str - :param incident_task: The incident task. Is either a model type or a IO type. Required. + :param incident_task: The incident task. Is either a IncidentTask type or a IO type. Required. :type incident_task: ~azure.mgmt.securityinsight.models.IncidentTask or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -529,16 +515,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.IncidentTask] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident_task, (IO, bytes)): + if isinstance(incident_task, (IOBase, bytes)): _content = incident_task else: _json = self._serialize.body(incident_task, "IncidentTask") @@ -560,8 +544,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,9 +601,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -635,8 +618,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py index fcbe3e15a34c..d420acf6b86d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py @@ -6,6 +6,7 @@ # 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, Optional, TypeVar, Union, overload import urllib.parse @@ -28,16 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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 -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +49,7 @@ def build_run_playbook_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -79,7 +74,7 @@ def build_run_playbook_request( "incidentIdentifier": _SERIALIZER.url("incident_identifier", incident_identifier, "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") @@ -106,9 +101,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +124,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") @@ -156,9 +149,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +173,7 @@ def build_get_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -199,9 +190,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -226,7 +215,7 @@ def build_create_or_update_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -245,9 +234,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,7 +258,7 @@ def build_delete_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -288,9 +275,7 @@ def build_create_team_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -315,7 +300,7 @@ def build_create_team_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -334,9 +319,7 @@ def build_list_alerts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -360,7 +343,7 @@ def build_list_alerts_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -377,9 +360,7 @@ def build_list_bookmarks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -403,7 +384,7 @@ def build_list_bookmarks_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -420,9 +401,7 @@ def build_list_entities_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -446,7 +425,7 @@ def build_list_entities_request( "incidentId": _SERIALIZER.url("incident_id", incident_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") @@ -556,7 +535,8 @@ def run_playbook( :type workspace_name: str :param incident_identifier: Required. :type incident_identifier: str - :param request_body: Is either a model type or a IO type. Default value is None. + :param request_body: Is either a ManualTriggerRequestBody type or a IO type. Default value is + None. :type request_body: ~azure.mgmt.securityinsight.models.ManualTriggerRequestBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -577,16 +557,14 @@ def run_playbook( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(request_body, (IO, bytes)): + if isinstance(request_body, (IOBase, bytes)): _content = request_body else: if request_body is not None: @@ -610,8 +588,9 @@ def run_playbook( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,9 +648,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentList] = kwargs.pop("cls", None) error_map = { @@ -729,8 +706,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,9 +751,7 @@ def get(self, resource_group_name: str, workspace_name: str, incident_id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Incident] = kwargs.pop("cls", None) request = build_get_request( @@ -791,8 +767,9 @@ def get(self, resource_group_name: str, workspace_name: str, incident_id: str, * 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -892,7 +869,7 @@ def create_or_update( :type workspace_name: str :param incident_id: Incident ID. Required. :type incident_id: str - :param incident: The incident. Is either a model type or a IO type. Required. + :param incident: The incident. Is either a Incident type or a IO type. Required. :type incident: ~azure.mgmt.securityinsight.models.Incident or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -913,16 +890,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Incident] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(incident, (IO, bytes)): + if isinstance(incident, (IOBase, bytes)): _content = incident else: _json = self._serialize.body(incident, "Incident") @@ -943,8 +918,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -997,9 +973,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -1015,8 +989,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1115,7 +1090,8 @@ def create_team( :type workspace_name: str :param incident_id: Incident ID. Required. :type incident_id: str - :param team_properties: Team properties. Is either a model type or a IO type. Required. + :param team_properties: Team properties. Is either a TeamInformation type or a IO type. + Required. :type team_properties: ~azure.mgmt.securityinsight.models.TeamInformation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1136,16 +1112,14 @@ def create_team( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.TeamInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(team_properties, (IO, bytes)): + if isinstance(team_properties, (IOBase, bytes)): _content = team_properties else: _json = self._serialize.body(team_properties, "TeamInformation") @@ -1166,8 +1140,9 @@ def create_team( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1216,9 +1191,7 @@ def list_alerts( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentAlertList] = kwargs.pop("cls", None) request = build_list_alerts_request( @@ -1234,8 +1207,9 @@ def list_alerts( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1284,9 +1258,7 @@ def list_bookmarks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentBookmarkList] = kwargs.pop("cls", None) request = build_list_bookmarks_request( @@ -1302,8 +1274,9 @@ def list_bookmarks( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1352,9 +1325,7 @@ def list_entities( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.IncidentEntitiesResponse] = kwargs.pop("cls", None) request = build_list_entities_request( @@ -1370,8 +1341,9 @@ def list_entities( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py index 89c8e309e108..380410bde714 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,9 +38,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, ip_addr _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +53,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, *, ip_addr ), } - _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,9 +109,7 @@ def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnrichmentIpGeodata] = kwargs.pop("cls", None) request = build_get_request( @@ -133,8 +124,9 @@ def get(self, resource_group_name: str, ip_address: str, **kwargs: Any) -> _mode 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py index 532bea1e8db1..53e86cc53eb5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,9 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,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") @@ -105,9 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,10 +120,10 @@ def build_get_request( min_length=1, pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", ), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str", pattern=r"^\S+$"), } - _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") @@ -148,9 +140,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,10 +161,10 @@ def build_delete_request( min_length=1, pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", ), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str", pattern=r"^\S+$"), } - _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") @@ -191,9 +181,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -215,10 +203,10 @@ def build_create_request( min_length=1, pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", ), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str", pattern=r"^\S+$"), } - _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,9 +225,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -261,10 +247,10 @@ def build_update_request( min_length=1, pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", ), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str", pattern=r"^\S+$"), } - _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,9 +318,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataList] = kwargs.pop("cls", None) error_map = { @@ -392,8 +376,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,9 +423,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetadataModel] = kwargs.pop("cls", None) request = build_get_request( @@ -456,8 +439,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -506,9 +490,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -524,8 +506,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -621,7 +604,7 @@ def create( :type workspace_name: str :param metadata_name: The Metadata name. Required. :type metadata_name: str - :param metadata: Metadata resource. Is either a model type or a IO type. Required. + :param metadata: Metadata resource. Is either a MetadataModel type or a IO type. Required. :type metadata: ~azure.mgmt.securityinsight.models.MetadataModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -642,16 +625,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MetadataModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(metadata, (IO, bytes)): + if isinstance(metadata, (IOBase, bytes)): _content = metadata else: _json = self._serialize.body(metadata, "MetadataModel") @@ -672,8 +653,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -777,7 +759,8 @@ def update( :type workspace_name: str :param metadata_name: The Metadata name. Required. :type metadata_name: str - :param metadata_patch: Partial metadata request. Is either a model type or a IO type. Required. + :param metadata_patch: Partial metadata request. Is either a MetadataPatch type or a IO type. + Required. :type metadata_patch: ~azure.mgmt.securityinsight.models.MetadataPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -798,16 +781,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MetadataModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(metadata_patch, (IO, bytes)): + if isinstance(metadata_patch, (IOBase, bytes)): _content = metadata_patch else: _json = self._serialize.body(metadata_patch, "MetadataPatch") @@ -828,8 +809,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py index 6c185d8b07ac..5ca615ff7d3b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +65,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") @@ -89,9 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +106,7 @@ def build_get_request( "consentId": _SERIALIZER.url("consent_id", consent_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,9 +123,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +147,7 @@ def build_delete_request( "consentId": _SERIALIZER.url("consent_id", consent_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") @@ -205,9 +194,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OfficeConsentList] = kwargs.pop("cls", None) error_map = { @@ -261,8 +248,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,9 +295,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OfficeConsent] = kwargs.pop("cls", None) request = build_get_request( @@ -325,8 +311,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,9 +362,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -393,8 +378,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py index e74ff2e56de3..f363ca1e4fee 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_package_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_package_operations.py new file mode 100644 index 000000000000..bad8f6e768cc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_package_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, workspace_name: str, package_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages/{packageId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "packageId": _SERIALIZER.url("package_id", package_id, "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) + + +class ProductPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`product_package` 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( + self, resource_group_name: str, workspace_name: str, package_id: str, **kwargs: Any + ) -> _models.ProductPackageModel: + """Gets a package by its identifier from the catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param package_id: package Id. Required. + :type package_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductPackageModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ProductPackageModel + :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.ProductPackageModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + package_id=package_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductPackageModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages/{packageId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_packages_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_packages_operations.py new file mode 100644 index 000000000000..384e843f1dfe --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_packages_operations.py @@ -0,0 +1,231 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProductPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`product_packages` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ProductPackageModel"]: + """Gets all packages from the catalog. + Expandable properties: + + + * properties/installed + * properties/packagedContent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProductPackageModel or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.ProductPackageModel] + :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.ProductPackageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProductPackageList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py index 86def718fd40..76313ea59d67 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,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") @@ -87,9 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +105,7 @@ def build_get_request( "settingsName": _SERIALIZER.url("settings_name", settings_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") @@ -130,9 +122,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +146,7 @@ def build_delete_request( "settingsName": _SERIALIZER.url("settings_name", settings_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") @@ -173,9 +163,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -200,7 +188,7 @@ def build_update_request( "settingsName": _SERIALIZER.url("settings_name", settings_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") @@ -257,9 +245,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SettingList] = kwargs.pop("cls", None) request = build_list_request( @@ -274,8 +260,9 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +310,7 @@ def get(self, resource_group_name: str, workspace_name: str, settings_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Settings] = kwargs.pop("cls", None) request = build_get_request( @@ -341,8 +326,9 @@ def get(self, resource_group_name: str, workspace_name: str, settings_name: str, 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,9 +378,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -410,8 +394,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -510,7 +495,7 @@ def update( :param settings_name: The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. Required. :type settings_name: str - :param settings: The setting. Is either a model type or a IO type. Required. + :param settings: The setting. Is either a Settings type or a IO type. Required. :type settings: ~azure.mgmt.securityinsight.models.Settings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -531,16 +516,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Settings] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(settings, (IO, bytes)): + if isinstance(settings, (IOBase, bytes)): _content = settings else: _json = self._serialize.body(settings, "Settings") @@ -561,8 +544,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_template_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_template_operations.py new file mode 100644 index 000000000000..a06708766660 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_template_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, workspace_name: str, template_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentproducttemplates/{templateId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "templateId": _SERIALIZER.url("template_id", template_id, "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) + + +class ProductTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`product_template` 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( + self, resource_group_name: str, workspace_name: str, template_id: str, **kwargs: Any + ) -> _models.ProductTemplateModel: + """Gets a template by its identifier. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param template_id: template Id. Required. + :type template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProductTemplateModel or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ProductTemplateModel + :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.ProductTemplateModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_id=template_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductTemplateModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentproducttemplates/{templateId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_templates_operations.py new file mode 100644 index 000000000000..0a4f0a712dab --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_templates_operations.py @@ -0,0 +1,250 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductTemplates", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if search is not None: + _params["$search"] = _SERIALIZER.query("search", search, "str") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProductTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`product_templates` 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, + filter: Optional[str] = None, + orderby: Optional[str] = None, + search: Optional[str] = None, + count: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ProductTemplateModel"]: + """Gets all templates in the catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. + :type filter: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param search: Searches for a substring in the response. Optional. Default value is None. + :type search: str + :param count: Instructs the server to return only object count without actual body. Optional. + Default value is None. + :type count: bool + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the + next page of results if there are any left. Default value is None. + :type skip: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProductTemplateModel or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.ProductTemplateModel] + :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.ProductTemplateList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + filter=filter, + orderby=orderby, + search=search, + count=count, + top=top, + skip=skip, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProductTemplateList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductTemplates" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py index 67f7732a0682..9cb5042f63f7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +66,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") @@ -89,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_get_request( "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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") @@ -132,9 +124,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +149,7 @@ def build_create_or_update_request( "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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") @@ -178,9 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +192,7 @@ def build_delete_request( "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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") @@ -255,9 +243,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityMLAnalyticsSettingsList] = kwargs.pop("cls", None) error_map = { @@ -311,8 +297,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,9 +344,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityMLAnalyticsSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -375,8 +360,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,8 +463,8 @@ def create_or_update( :type workspace_name: str :param settings_resource_name: Security ML Analytics Settings resource name. Required. :type settings_resource_name: str - :param security_ml_analytics_setting: The security ML Analytics setting. Is either a model type - or a IO type. Required. + :param security_ml_analytics_setting: The security ML Analytics setting. Is either a + SecurityMLAnalyticsSetting type or a IO type. Required. :type security_ml_analytics_setting: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -500,16 +486,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SecurityMLAnalyticsSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_ml_analytics_setting, (IO, bytes)): + if isinstance(security_ml_analytics_setting, (IOBase, bytes)): _content = security_ml_analytics_setting else: _json = self._serialize.body(security_ml_analytics_setting, "SecurityMLAnalyticsSetting") @@ -530,8 +514,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -584,9 +569,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -602,8 +585,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py index dede32ea1345..de6bbbaf7aff 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +71,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") @@ -98,9 +92,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +119,7 @@ def build_create_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") @@ -150,9 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +168,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") @@ -195,9 +185,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +208,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") @@ -280,9 +268,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SentinelOnboardingState] = kwargs.pop("cls", None) request = build_get_request( @@ -298,8 +284,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -406,7 +393,7 @@ def create( Required. :type sentinel_onboarding_state_name: str :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. Is either - a model type or a IO type. Default value is None. + a SentinelOnboardingState type or a IO type. Default value is None. :type sentinel_onboarding_state_parameter: ~azure.mgmt.securityinsight.models.SentinelOnboardingState or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -428,16 +415,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SentinelOnboardingState] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sentinel_onboarding_state_parameter, (IO, bytes)): + if isinstance(sentinel_onboarding_state_parameter, (IOBase, bytes)): _content = sentinel_onboarding_state_parameter else: if sentinel_onboarding_state_parameter is not None: @@ -461,8 +446,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,9 +502,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -534,8 +518,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,9 +563,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SentinelOnboardingStatesList] = kwargs.pop("cls", None) request = build_list_request( @@ -595,8 +578,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py index 4a4957b10d8d..e6100cd34ef8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py @@ -6,8 +6,8 @@ # 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, TypeVar, Union +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,19 +38,12 @@ def build_list_repositories_request( - resource_group_name: str, - workspace_name: str, - subscription_id: str, - *, - json: Union[str, _models.RepoType], - **kwargs: Any + 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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -78,7 +67,7 @@ def build_list_repositories_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 +77,7 @@ def build_list_repositories_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, json=json, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) class SourceControlOperations: @@ -110,9 +99,69 @@ def __init__(self, *args, **kwargs): 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 list_repositories( + self, + resource_group_name: str, + workspace_name: str, + repository_access: _models.RepositoryAccessProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.Repo"]: + """Gets a list of repositories metadata. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param repository_access: The repository access credentials. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties + :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: An iterator like instance of either Repo or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.Repo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_repositories( + self, + resource_group_name: str, + workspace_name: str, + repository_access: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.Repo"]: + """Gets a list of repositories metadata. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param repository_access: The repository access credentials. Required. + :type repository_access: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Repo or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.Repo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace def list_repositories( - self, resource_group_name: str, workspace_name: str, repo_type: Union[str, _models.RepoType], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + repository_access: Union[_models.RepositoryAccessProperties, IO], + **kwargs: Any ) -> Iterable["_models.Repo"]: """Gets a list of repositories metadata. @@ -121,8 +170,12 @@ def list_repositories( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param repo_type: The repo type. Known values are: "Github" and "DevOps". Required. - :type repo_type: str or ~azure.mgmt.securityinsight.models.RepoType + :param repository_access: The repository access credentials. Is either a + RepositoryAccessProperties type or a IO type. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Repo or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.Repo] @@ -131,10 +184,8 @@ def list_repositories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + 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.RepoList] = kwargs.pop("cls", None) error_map = { @@ -144,10 +195,16 @@ def list_repositories( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(repository_access, (IOBase, bytes)): + _content = repository_access + else: + _json = self._serialize.body(repository_access, "RepositoryAccessProperties") def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(repo_type, "str") request = build_list_repositories_request( resource_group_name=resource_group_name, @@ -156,6 +213,7 @@ def prepare_request(next_link=None): api_version=api_version, content_type=content_type, json=_json, + content=_content, template_url=self.list_repositories.metadata["url"], headers=_headers, params=_params, @@ -191,8 +249,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py index e4f8c1291dc3..54ebabad7249 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +66,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") @@ -89,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +107,7 @@ def build_get_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_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") @@ -126,15 +118,14 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_request( resource_group_name: str, workspace_name: str, source_control_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,33 +149,33 @@ def build_delete_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_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") # 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) -def build_create_request( +def build_delete_request( resource_group_name: str, workspace_name: str, source_control_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -202,7 +193,7 @@ def build_create_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_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") @@ -212,7 +203,7 @@ def build_create_request( _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="POST", url=_url, params=_params, headers=_headers, **kwargs) class SourceControlsOperations: @@ -251,9 +242,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlList] = kwargs.pop("cls", None) error_map = { @@ -307,8 +296,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,9 +343,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) request = build_get_request( @@ -371,8 +359,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,11 +381,78 @@ def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" } + @overload + def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: _models.SourceControl, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param source_control_id: Source control Id. Required. + :type source_control_id: str + :param source_control: The SourceControl. Required. + :type source_control: ~azure.mgmt.securityinsight.models.SourceControl + :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: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param source_control_id: Source control Id. Required. + :type source_control_id: str + :param source_control: The SourceControl. Required. + :type source_control: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, source_control_id: str, **kwargs: Any - ) -> None: - """Delete a source control. + def create( + self, + resource_group_name: str, + workspace_name: str, + source_control_id: str, + source_control: Union[_models.SourceControl, IO], + **kwargs: Any + ) -> _models.SourceControl: + """Creates a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -405,9 +461,15 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str + :param source_control: The SourceControl. Is either a SourceControl type or a IO type. + Required. + :type source_control: ~azure.mgmt.securityinsight.models.SourceControl or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: SourceControl or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -418,56 +480,75 @@ 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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.SourceControl] = kwargs.pop("cls", None) - request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(source_control, (IOBase, bytes)): + _content = source_control + else: + _json = self._serialize.body(source_control, "SourceControl") + + request = build_create_request( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + 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) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code == 200: + deserialized = self._deserialize("SourceControl", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SourceControl", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - delete.metadata = { + return deserialized # type: ignore + + create.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" } @overload - def create( + def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: _models.SourceControl, + repository_access: _models.RepositoryAccessProperties, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -476,29 +557,29 @@ def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Required. - :type source_control: ~azure.mgmt.securityinsight.models.SourceControl + :param repository_access: The repository access credentials. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties :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: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( + def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: IO, + repository_access: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -507,27 +588,27 @@ def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Required. - :type source_control: IO + :param repository_access: The repository access credentials. Required. + :type repository_access: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create( + def delete( self, resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: Union[_models.SourceControl, IO], + repository_access: Union[_models.RepositoryAccessProperties, IO], **kwargs: Any - ) -> _models.SourceControl: - """Creates a source control. + ) -> _models.Warning: + """Delete a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -536,14 +617,15 @@ def create( :type workspace_name: str :param source_control_id: Source control Id. Required. :type source_control_id: str - :param source_control: The SourceControl. Is either a model type or a IO type. Required. - :type source_control: ~azure.mgmt.securityinsight.models.SourceControl or IO + :param repository_access: The repository access credentials. Is either a + RepositoryAccessProperties type or a IO type. Required. + :type repository_access: ~azure.mgmt.securityinsight.models.RepositoryAccessProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceControl or the result of cls(response) - :rtype: ~azure.mgmt.securityinsight.models.SourceControl + :return: Warning or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Warning :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -557,21 +639,19 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[_models.Warning] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(source_control, (IO, bytes)): - _content = source_control + if isinstance(repository_access, (IOBase, bytes)): + _content = repository_access else: - _json = self._serialize.body(source_control, "SourceControl") + _json = self._serialize.body(repository_access, "RepositoryAccessProperties") - request = build_create_request( + request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, @@ -580,34 +660,31 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], + 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("Warning", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete" } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py index 282e791e6ca8..6ac9fd3b2ef2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py @@ -6,7 +6,6 @@ # 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, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,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") @@ -127,9 +120,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceMetricsList] = kwargs.pop("cls", None) request = build_list_request( @@ -144,8 +135,9 @@ def list( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py index 6800898f0f65..ec651c884dc4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_indicator_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -73,7 +67,7 @@ def build_create_indicator_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") @@ -92,9 +86,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +110,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") @@ -135,9 +127,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +152,7 @@ def build_create_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,9 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +195,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") @@ -224,9 +212,7 @@ def build_query_indicators_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -250,7 +236,7 @@ def build_query_indicators_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") @@ -269,9 +255,7 @@ def build_append_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -296,7 +280,7 @@ def build_append_tags_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") @@ -315,9 +299,7 @@ def build_replace_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -342,7 +324,7 @@ def build_replace_tags_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") @@ -449,7 +431,7 @@ def create_indicator( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param threat_intelligence_properties: Properties of threat intelligence indicators to create - and update. Is either a model type or a IO type. Required. + and update. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -471,16 +453,14 @@ def create_indicator( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_properties, (IO, bytes)): + if isinstance(threat_intelligence_properties, (IOBase, bytes)): _content = threat_intelligence_properties else: _json = self._serialize.body(threat_intelligence_properties, "ThreatIntelligenceIndicatorModel") @@ -500,8 +480,9 @@ def create_indicator( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,9 +535,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceInformation] = kwargs.pop("cls", None) request = build_get_request( @@ -572,8 +551,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -677,7 +657,7 @@ def create( :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_properties: Properties of threat intelligence indicators to create - and update. Is either a model type or a IO type. Required. + and update. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_properties: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -699,16 +679,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_properties, (IO, bytes)): + if isinstance(threat_intelligence_properties, (IOBase, bytes)): _content = threat_intelligence_properties else: _json = self._serialize.body(threat_intelligence_properties, "ThreatIntelligenceIndicatorModel") @@ -729,8 +707,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -783,9 +762,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -801,8 +778,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -897,7 +875,8 @@ def query_indicators( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param threat_intelligence_filtering_criteria: Filtering criteria for querying threat - intelligence indicators. Is either a model type or a IO type. Required. + intelligence indicators. Is either a ThreatIntelligenceFilteringCriteria type or a IO type. + Required. :type threat_intelligence_filtering_criteria: ~azure.mgmt.securityinsight.models.ThreatIntelligenceFilteringCriteria or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -913,9 +892,7 @@ def query_indicators( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformationList] = kwargs.pop("cls", None) @@ -929,7 +906,7 @@ def query_indicators( content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_filtering_criteria, (IO, bytes)): + if isinstance(threat_intelligence_filtering_criteria, (IOBase, bytes)): _content = threat_intelligence_filtering_criteria else: _json = self._serialize.body(threat_intelligence_filtering_criteria, "ThreatIntelligenceFilteringCriteria") @@ -980,8 +957,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1081,7 +1059,7 @@ def append_tags( # pylint: disable=inconsistent-return-statements :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_append_tags: The threat intelligence append tags request body. Is - either a model type or a IO type. Required. + either a ThreatIntelligenceAppendTags type or a IO type. Required. :type threat_intelligence_append_tags: ~azure.mgmt.securityinsight.models.ThreatIntelligenceAppendTags or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1103,16 +1081,14 @@ def append_tags( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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(threat_intelligence_append_tags, (IO, bytes)): + if isinstance(threat_intelligence_append_tags, (IOBase, bytes)): _content = threat_intelligence_append_tags else: _json = self._serialize.body(threat_intelligence_append_tags, "ThreatIntelligenceAppendTags") @@ -1133,8 +1109,9 @@ def append_tags( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1234,7 +1211,7 @@ def replace_tags( :param name: Threat intelligence indicator name field. Required. :type name: str :param threat_intelligence_replace_tags: Tags in the threat intelligence indicator to be - replaced. Is either a model type or a IO type. Required. + replaced. Is either a ThreatIntelligenceIndicatorModel type or a IO type. Required. :type threat_intelligence_replace_tags: ~azure.mgmt.securityinsight.models.ThreatIntelligenceIndicatorModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1256,16 +1233,14 @@ def replace_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ThreatIntelligenceInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(threat_intelligence_replace_tags, (IO, bytes)): + if isinstance(threat_intelligence_replace_tags, (IOBase, bytes)): _content = threat_intelligence_replace_tags else: _json = self._serialize.body(threat_intelligence_replace_tags, "ThreatIntelligenceIndicatorModel") @@ -1286,8 +1261,9 @@ def replace_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py index 8353884e05ce..e43922a70e5a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,9 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +73,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") @@ -158,9 +151,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ThreatIntelligenceInformationList] = kwargs.pop("cls", None) error_map = { @@ -218,8 +209,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_triggered_analytics_rule_run_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_triggered_analytics_rule_run_operations.py new file mode 100644 index 000000000000..414e61abf3c8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_triggered_analytics_rule_run_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, workspace_name: str, rule_run_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns/{ruleRunId}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "ruleRunId": _SERIALIZER.url("rule_run_id", rule_run_id, "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) + + +class TriggeredAnalyticsRuleRunOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`triggered_analytics_rule_run` 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( + self, resource_group_name: str, workspace_name: str, rule_run_id: str, **kwargs: Any + ) -> _models.TriggeredAnalyticsRuleRun: + """Gets the triggered analytics rule run. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param rule_run_id: the triggered rule id. Required. + :type rule_run_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TriggeredAnalyticsRuleRun or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.TriggeredAnalyticsRuleRun + :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.TriggeredAnalyticsRuleRun] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_run_id=rule_run_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) + + _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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TriggeredAnalyticsRuleRun", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns/{ruleRunId}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py index b35219b0a81e..f367ea1e3a7b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_update_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_recommendation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74,7 +68,7 @@ def build_recommendation_request( "recommendationId": _SERIALIZER.url("recommendation_id", recommendation_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") @@ -125,16 +119,14 @@ def _recommendation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Recommendation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(recommendation_patch, (IO, bytes)): + if isinstance(recommendation_patch, (IOBase, bytes)): _content = recommendation_patch else: _json = self._serialize.body(recommendation_patch, "[RecommendationPatch]") @@ -155,8 +147,9 @@ def _recommendation_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,8 +265,8 @@ def begin_recommendation( :type workspace_name: str :param recommendation_id: Recommendation Id. Required. :type recommendation_id: str - :param recommendation_patch: Recommendation Fields to Update. Is either a list type or a IO - type. Required. + :param recommendation_patch: Recommendation Fields to Update. Is either a [RecommendationPatch] + type or a IO type. Required. :type recommendation_patch: list[~azure.mgmt.securityinsight.models.RecommendationPatch] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -294,9 +287,7 @@ def begin_recommendation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Recommendation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py index 1139c4e49331..29ab04439b61 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,9 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +73,7 @@ def build_list_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, "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") @@ -103,9 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +122,7 @@ def build_get_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_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") @@ -152,9 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +169,7 @@ def build_delete_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_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") @@ -201,9 +191,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -229,7 +217,7 @@ def build_create_or_update_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_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") @@ -292,9 +280,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistItemList] = kwargs.pop("cls", None) error_map = { @@ -350,8 +336,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,9 +385,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistItem] = kwargs.pop("cls", None) request = build_get_request( @@ -417,8 +402,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -469,9 +455,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -488,8 +472,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -594,7 +579,8 @@ def create_or_update( :type watchlist_alias: str :param watchlist_item_id: Watchlist Item Id (GUID). Required. :type watchlist_item_id: str - :param watchlist_item: The watchlist item. Is either a model type or a IO type. Required. + :param watchlist_item: The watchlist item. Is either a WatchlistItem type or a IO type. + Required. :type watchlist_item: ~azure.mgmt.securityinsight.models.WatchlistItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -615,16 +601,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.WatchlistItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(watchlist_item, (IO, bytes)): + if isinstance(watchlist_item, (IOBase, bytes)): _content = watchlist_item else: _json = self._serialize.body(watchlist_item, "WatchlistItem") @@ -646,8 +630,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py index c675404d4edb..1ff2a790a720 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,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") @@ -96,9 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +114,7 @@ def build_get_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, "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,9 +131,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +155,7 @@ def build_delete_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, "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") @@ -182,9 +172,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: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-12-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +197,7 @@ def build_create_or_update_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, "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,9 +253,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WatchlistList] = kwargs.pop("cls", None) error_map = { @@ -322,8 +308,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -368,9 +355,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Watchlist] = kwargs.pop("cls", None) request = build_get_request( @@ -386,8 +371,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,9 +422,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -454,8 +438,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,7 +557,7 @@ def create_or_update( :type workspace_name: str :param watchlist_alias: Watchlist Alias. Required. :type watchlist_alias: str - :param watchlist: The watchlist. Is either a model type or a IO type. Required. + :param watchlist: The watchlist. Is either a Watchlist type or a IO type. Required. :type watchlist: ~azure.mgmt.securityinsight.models.Watchlist or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -593,16 +578,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-12-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Watchlist] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(watchlist, (IO, bytes)): + if isinstance(watchlist, (IOBase, bytes)): _content = watchlist else: _json = self._serialize.body(watchlist, "Watchlist") @@ -623,8 +606,9 @@ def create_or_update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignment_jobs_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignment_jobs_operations.py new file mode 100644 index 000000000000..78ee1331d9e2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignment_jobs_operations.py @@ -0,0 +1,604 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + workspace_manager_assignment_name: str, + subscription_id: str, + *, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][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 orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + workspace_manager_assignment_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[A-Za-z0-9][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_delete_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[A-Za-z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspaceManagerAssignmentJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`workspace_manager_assignment_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Job"]: + """Get all jobs for the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Job or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.Job] + :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.JobList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs" + } + + @distributed_trace + def create( + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> _models.Job: + """Create a job for the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Job + :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.Job] = kwargs.pop("cls", None) + + request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create.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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_name: str, + **kwargs: Any + ) -> _models.Job: + """Gets a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param job_name: The job name. Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Job + :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.Job] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_name, + job_name=job_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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + job_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified job from the specified workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param job_name: The job name. Required. + :type job_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, + workspace_manager_assignment_name=workspace_manager_assignment_name, + job_name=job_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignments_operations.py new file mode 100644 index 000000000000..32df03e2d3ba --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_assignments_operations.py @@ -0,0 +1,671 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + workspace_manager_assignment_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][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_or_update_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_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-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerAssignmentName": _SERIALIZER.url( + "workspace_manager_assignment_name", + workspace_manager_assignment_name, + "str", + pattern=r"^[A-Za-z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspaceManagerAssignmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`workspace_manager_assignments` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.WorkspaceManagerAssignment"]: + """Get all workspace manager assignments for the Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerAssignment or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment] + :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.WorkspaceManagerAssignmentList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerAssignmentList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Gets a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :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.WorkspaceManagerAssignment] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_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("WorkspaceManagerAssignment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: _models.WorkspaceManagerAssignment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Required. + :type workspace_manager_assignment: + ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :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: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Required. + :type workspace_manager_assignment: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_assignment_name: str, + workspace_manager_assignment: Union[_models.WorkspaceManagerAssignment, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerAssignment: + """Creates or updates a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_name: str + :param workspace_manager_assignment: The workspace manager assignment. Is either a + WorkspaceManagerAssignment type or a IO type. Required. + :type workspace_manager_assignment: + ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerAssignment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerAssignment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerAssignment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_assignment, (IOBase, bytes)): + _content = workspace_manager_assignment + else: + _json = self._serialize.body(workspace_manager_assignment, "WorkspaceManagerAssignment") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_assignment_name=workspace_manager_assignment_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerAssignment", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerAssignment", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_assignment_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_assignment_name: The name of the workspace manager assignment. + Required. + :type workspace_manager_assignment_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, + workspace_manager_assignment_name=workspace_manager_assignment_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_configurations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_configurations_operations.py new file mode 100644 index 000000000000..954ed88e2a08 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_configurations_operations.py @@ -0,0 +1,671 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + workspace_manager_configuration_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerConfigurationName": _SERIALIZER.url( + "workspace_manager_configuration_name", + workspace_manager_configuration_name, + "str", + pattern=r"^[A-Za-z0-9][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_delete_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerConfigurationName": _SERIALIZER.url( + "workspace_manager_configuration_name", + workspace_manager_configuration_name, + "str", + pattern=r"^[A-Za-z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_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-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerConfigurationName": _SERIALIZER.url( + "workspace_manager_configuration_name", + workspace_manager_configuration_name, + "str", + pattern=r"^[A-Za-z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspaceManagerConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`workspace_manager_configurations` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.WorkspaceManagerConfiguration"]: + """Gets all workspace manager configurations for a Sentinel 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: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration] + :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.WorkspaceManagerConfigurationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerConfigurationList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_configuration_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Gets a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :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.WorkspaceManagerConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_configuration_name=workspace_manager_configuration_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("WorkspaceManagerConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_configuration_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_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, + workspace_manager_configuration_name=workspace_manager_configuration_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: _models.WorkspaceManagerConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Required. + :type workspace_manager_configuration: + ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :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: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Required. + :type workspace_manager_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_configuration_name: str, + workspace_manager_configuration: Union[_models.WorkspaceManagerConfiguration, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerConfiguration: + """Creates or updates a workspace manager configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_configuration_name: The name of the workspace manager configuration. + Required. + :type workspace_manager_configuration_name: str + :param workspace_manager_configuration: The workspace manager configuration. Is either a + WorkspaceManagerConfiguration type or a IO type. Required. + :type workspace_manager_configuration: + ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_configuration, (IOBase, bytes)): + _content = workspace_manager_configuration + else: + _json = self._serialize.body(workspace_manager_configuration, "WorkspaceManagerConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_configuration_name=workspace_manager_configuration_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerConfiguration", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_groups_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_groups_operations.py new file mode 100644 index 000000000000..e7ac0d3a2396 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_groups_operations.py @@ -0,0 +1,663 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + workspace_manager_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", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerGroupName": _SERIALIZER.url( + "workspace_manager_group_name", + workspace_manager_group_name, + "str", + pattern=r"^[A-Za-z0-9][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_or_update_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_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", "2023-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerGroupName": _SERIALIZER.url( + "workspace_manager_group_name", + workspace_manager_group_name, + "str", + pattern=r"^[A-Za-z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_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", "2023-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerGroupName": _SERIALIZER.url( + "workspace_manager_group_name", + workspace_manager_group_name, + "str", + pattern=r"^[A-Za-z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspaceManagerGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`workspace_manager_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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.WorkspaceManagerGroup"]: + """Gets all workspace manager groups in the Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerGroup or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerGroup] + :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.WorkspaceManagerGroupList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerGroupList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_group_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Gets a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :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.WorkspaceManagerGroup] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_group_name=workspace_manager_group_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("WorkspaceManagerGroup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: _models.WorkspaceManagerGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Required. + :type workspace_manager_group: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :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: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Required. + :type workspace_manager_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_group_name: str, + workspace_manager_group: Union[_models.WorkspaceManagerGroup, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerGroup: + """Creates or updates a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_name: str + :param workspace_manager_group: The workspace manager group object. Is either a + WorkspaceManagerGroup type or a IO type. Required. + :type workspace_manager_group: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerGroup or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_group, (IOBase, bytes)): + _content = workspace_manager_group + else: + _json = self._serialize.body(workspace_manager_group, "WorkspaceManagerGroup") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_group_name=workspace_manager_group_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerGroup", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerGroup", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_group_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager 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: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_group_name: The name of the workspace manager group. Required. + :type workspace_manager_group_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, + workspace_manager_group_name=workspace_manager_group_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_members_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_members_operations.py new file mode 100644 index 000000000000..7efa15309c39 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_workspace_manager_members_operations.py @@ -0,0 +1,663 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + *, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: 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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][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 orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, + workspace_manager_member_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerMemberName": _SERIALIZER.url( + "workspace_manager_member_name", + workspace_manager_member_name, + "str", + pattern=r"^[A-Za-z0-9][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_or_update_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_member_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-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerMemberName": _SERIALIZER.url( + "workspace_manager_member_name", + workspace_manager_member_name, + "str", + pattern=r"^[A-Za-z0-9][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + workspace_name: str, + workspace_manager_member_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-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}", + ) # 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", + max_length=90, + min_length=1, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$", + ), + "workspaceManagerMemberName": _SERIALIZER.url( + "workspace_manager_member_name", + workspace_manager_member_name, + "str", + pattern=r"^[A-Za-z0-9][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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkspaceManagerMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`workspace_manager_members` 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, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.WorkspaceManagerMember"]: + """Gets all workspace manager members that exist for the given Sentinel workspace manager. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param orderby: Sorts the results. Optional. Default value is None. + :type orderby: str + :param top: Returns only the first n results. Optional. Default value is None. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceManagerMember or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WorkspaceManagerMember] + :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.WorkspaceManagerMembersList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + orderby=orderby, + top=top, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceManagerMembersList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/" + } + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, workspace_manager_member_name: str, **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Gets a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :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.WorkspaceManagerMember] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_member_name=workspace_manager_member_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("WorkspaceManagerMember", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: _models.WorkspaceManagerMember, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Required. + :type workspace_manager_member: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :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: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Required. + :type workspace_manager_member: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_manager_member_name: str, + workspace_manager_member: Union[_models.WorkspaceManagerMember, IO], + **kwargs: Any + ) -> _models.WorkspaceManagerMember: + """Creates or updates a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_name: str + :param workspace_manager_member: The workspace manager member object. Is either a + WorkspaceManagerMember type or a IO type. Required. + :type workspace_manager_member: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceManagerMember or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.WorkspaceManagerMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.WorkspaceManagerMember] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workspace_manager_member, (IOBase, bytes)): + _content = workspace_manager_member + else: + _json = self._serialize.body(workspace_manager_member, "WorkspaceManagerMember") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_manager_member_name=workspace_manager_member_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.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("WorkspaceManagerMember", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("WorkspaceManagerMember", pipeline_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, workspace_manager_member_name: str, **kwargs: Any + ) -> None: + """Deletes a workspace manager member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param workspace_manager_member_name: The name of the workspace manager member. Required. + :type workspace_manager_member_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, + workspace_manager_member_name=workspace_manager_member_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.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}" + } diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_action_of_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/create_action_of_alert_rule.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_action_of_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/create_action_of_alert_rule.py index 805f96e8a4ec..06b206de0809 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_action_of_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/create_action_of_alert_rule.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/actions/CreateActionOfAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/actions/CreateActionOfAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_action_of_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/delete_action_of_alert_rule.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_action_of_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/delete_action_of_alert_rule.py index 01907457a01d..6810f478152f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_action_of_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/delete_action_of_alert_rule.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.actions.delete( + client.actions.delete( resource_group_name="myRg", workspace_name="myWorkspace", rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", action_id="912bec42-cb66-4c03-ac63-1761b6898c3e", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/actions/DeleteActionOfAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/actions/DeleteActionOfAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_action_of_alert_rule_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_action_of_alert_rule_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_action_of_alert_rule_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_action_of_alert_rule_by_id.py index 6bf9693e038f..34ba662497a2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_action_of_alert_rule_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_action_of_alert_rule_by_id.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/actions/GetActionOfAlertRuleById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/actions/GetActionOfAlertRuleById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_by_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_all_actions_by_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_by_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_all_actions_by_alert_rule.py index 71e28322c8e7..4f79a3b4eb07 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_actions_by_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/actions/get_all_actions_by_alert_rule.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/actions/GetAllActionsByAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/actions/GetAllActionsByAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_template_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_template_by_id.py index 1d18bbcb0164..f4bf1b96fd7e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_template_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_template_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplateById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplateById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_templates.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_templates.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_templates.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_templates.py index 4f232d8a66d2..9b2caf0b7cc2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_alert_rule_templates.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rule_templates/get_alert_rule_templates.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule.py similarity index 99% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule.py index 7f4268b32cbc..1e4e4f33afa9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule.py @@ -174,6 +174,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/CreateFusionAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/CreateFusionAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule_with_fusion_scenario_exclusion.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule_with_fusion_scenario_exclusion.py similarity index 99% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule_with_fusion_scenario_exclusion.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule_with_fusion_scenario_exclusion.py index cea2c133fe51..d8a322dd9c31 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_fusion_alert_rule_with_fusion_scenario_exclusion.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_fusion_alert_rule_with_fusion_scenario_exclusion.py @@ -174,6 +174,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_microsoft_security_incident_creation_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_microsoft_security_incident_creation_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_microsoft_security_incident_creation_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_microsoft_security_incident_creation_alert_rule.py index f1dae6d1fced..bedc73129e05 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_microsoft_security_incident_creation_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_microsoft_security_incident_creation_alert_rule.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_nrt_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_nrt_alert_rule.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_nrt_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_nrt_alert_rule.py index b52313895455..47683b6d0a2a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_nrt_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_nrt_alert_rule.py @@ -63,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/CreateNrtAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/CreateNrtAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_scheduled_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_scheduled_alert_rule.py similarity index 98% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_scheduled_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_scheduled_alert_rule.py index 41f7815cc6e8..65d3d2bbb1cb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_scheduled_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/create_scheduled_alert_rule.py @@ -84,6 +84,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/CreateScheduledAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/CreateScheduledAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/delete_alert_rule.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/delete_alert_rule.py index e8eccd69f4ac..f3a6f94f4b12 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/delete_alert_rule.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.alert_rules.delete( + client.alert_rules.delete( resource_group_name="myRg", workspace_name="myWorkspace", rule_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/DeleteAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/DeleteAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_all_alert_rules.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_all_alert_rules.py index 6bfe39da69fe..18dcf2715417 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_alert_rules.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_all_alert_rules.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/GetAllAlertRules.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/GetAllAlertRules.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_fusion_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_fusion_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_fusion_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_fusion_alert_rule.py index 20bbac08277f..039aea007b8e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_fusion_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_fusion_alert_rule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/GetFusionAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/GetFusionAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_security_incident_creation_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_microsoft_security_incident_creation_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_security_incident_creation_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_microsoft_security_incident_creation_alert_rule.py index fd1493e29bb6..6c0258359105 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_security_incident_creation_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_microsoft_security_incident_creation_alert_rule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_nrt_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_nrt_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_nrt_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_nrt_alert_rule.py index e3ffcd9605df..8c68b2530424 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_nrt_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_nrt_alert_rule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/GetNrtAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/GetNrtAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_scheduled_alert_rule.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_scheduled_alert_rule.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_scheduled_alert_rule.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_scheduled_alert_rule.py index fe0d97781a54..d0e72fbcffd1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_scheduled_alert_rule.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/alert_rules/get_scheduled_alert_rule.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/alertRules/GetScheduledAlertRule.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/alertRules/GetScheduledAlertRule.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_create_or_update.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_create_or_update.py index 41e25ad33c82..feca149f3e3d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_create_or_update.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/automationRules/AutomationRules_CreateOrUpdate.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/automationRules/AutomationRules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_delete.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_delete.py index 5425a32f6ccd..3f81ec4239fe 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_delete.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/automationRules/AutomationRules_Delete.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/automationRules/AutomationRules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_get.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_get.py index 56075cbd2de2..f4206eacf8a5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_get.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/automationRules/AutomationRules_Get.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/automationRules/AutomationRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_list.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_list.py index 5916a50c7a2a..373c84b20718 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules_list.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/automation_rules/automation_rules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/automationRules/AutomationRules_List.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/automationRules/AutomationRules_List.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_all_billing_statistics.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_all_billing_statistics.py new file mode 100644 index 000000000000..08cdf621e6a3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_all_billing_statistics.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_billing_statistics.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.billing_statistics.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/billingStatistics/GetAllBillingStatistics.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_source_control.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_billing_statistic.py similarity index 84% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_source_control.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_billing_statistic.py index b39bed43c896..23f138276611 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_source_control.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/billing_statistics/get_billing_statistic.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-securityinsight # USAGE - python delete_source_control.py + python get_billing_statistic.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, @@ -29,14 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.source_controls.delete( + response = client.billing_statistics.get( resource_group_name="myRg", workspace_name="myWorkspace", - source_control_id="789e0c1f-4a3d-43ad-809c-e713b677b04a", + billing_statistic_name="sapSolutionUsage", ) print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/sourcecontrols/DeleteSourceControl.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/billingStatistics/GetBillingStatistic.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/create_bookmark.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/create_bookmark.py index 44e578eca8d0..27923c7a0d59 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/create_bookmark.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/CreateBookmark.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/CreateBookmark.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/delete_bookmark.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/delete_bookmark.py index 5f63071b1758..02a24c7a017c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/delete_bookmark.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.bookmarks.delete( + client.bookmarks.delete( resource_group_name="myRg", workspace_name="myWorkspace", bookmark_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/DeleteBookmark.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/DeleteBookmark.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_bookmark.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/expand/post_expand_bookmark.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_bookmark.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/expand/post_expand_bookmark.py index 49329bae179a..256f3686829d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_bookmark.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/expand/post_expand_bookmark.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/expand/PostExpandBookmark.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/expand/PostExpandBookmark.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmark_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmark_by_id.py index 8e87468ceb1e..c718afb88ce1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmark_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/GetBookmarkById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/GetBookmarkById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmarks.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmarks.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmarks.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmarks.py index 3bfe6238bf16..62ceb7be7e44 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmarks.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/get_bookmarks.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/GetBookmarks.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/GetBookmarks.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/create_bookmark_relation.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark_relation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/create_bookmark_relation.py index fa4c8433745e..bc9e68235600 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_bookmark_relation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/create_bookmark_relation.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/relations/CreateBookmarkRelation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/relations/CreateBookmarkRelation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/delete_bookmark_relation.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark_relation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/delete_bookmark_relation.py index 940f286c435e..9ae6138217ee 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_bookmark_relation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/delete_bookmark_relation.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.bookmark_relations.delete( + client.bookmark_relations.delete( resource_group_name="myRg", workspace_name="myWorkspace", bookmark_id="2216d0e1-91e3-4902-89fd-d2df8c535096", relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/relations/DeleteBookmarkRelation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/relations/DeleteBookmarkRelation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_all_bookmark_relations.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_all_bookmark_relations.py index dd257f859112..67685a840d04 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_bookmark_relations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_all_bookmark_relations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/relations/GetAllBookmarkRelations.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/relations/GetAllBookmarkRelations.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_relation_by_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_bookmark_relation_by_name.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_relation_by_name.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_bookmark_relation_by_name.py index 7426af196f31..774a5a559934 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_bookmark_relation_by_name.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/bookmarks/relations/get_bookmark_relation_by_name.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/bookmarks/relations/GetBookmarkRelationByName.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/bookmarks/relations/GetBookmarkRelationByName.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_package_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_package_by_id.py new file mode 100644 index 000000000000..f46256a09b53 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_package_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_package_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_packages.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + package_id="str.azure-sentinel-solution-str", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/GetPackageById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_packages.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_packages.py new file mode 100644 index 000000000000..ba3fc5625222 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_packages.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_packages.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_packages.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/GetPackages.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_package_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_package_by_id.py new file mode 100644 index 000000000000..c80e00619223 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_package_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_product_package_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.product_package.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + package_id="str.azure-sentinel-solution-str", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/GetProductPackageById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_packages.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_packages.py new file mode 100644 index 000000000000..7f39c9bd9f3f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/get_product_packages.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_product_packages.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.product_packages.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/GetProductPackages.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/install_package.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/install_package.py new file mode 100644 index 000000000000..602625818dd9 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/install_package.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python install_package.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_package.install( + resource_group_name="myRg", + workspace_name="myWorkspace", + package_id="str.azure-sentinel-solution-str", + package_installation_properties={ + "properties": { + "contentId": "str.azure-sentinel-solution-str", + "contentKind": "Solution", + "contentProductId": "str.azure-sentinel-solution-str-sl-igl6jawr4gwmu", + "displayName": "str", + "version": "2.0.0", + }, + "tags": {"tag1": "str"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/InstallPackage.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/uninstall_package.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/uninstall_package.py new file mode 100644 index 000000000000..fa45205e2076 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_packages/uninstall_package.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python uninstall_package.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + client.content_package.uninstall( + resource_group_name="myRg", + workspace_name="myWorkspace", + package_id="str.azure-sentinel-solution-str", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentPackages/UninstallPackage.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/delete_template.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/delete_template.py new file mode 100644 index 000000000000..857f06a0c128 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/delete_template.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_template.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + client.content_template.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + template_id="8365ebfe-a381-45b7-ad08-7d818070e11f", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/DeleteTemplate.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_template_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_template_by_id.py new file mode 100644 index 000000000000..04e8053cd050 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_template_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_product_template_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.product_template.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + template_id="8365ebfe-a381-45b7-ad08-7d818070e11f", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/GetProductTemplateById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_templates.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_templates.py new file mode 100644 index 000000000000..70387b552e46 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_product_templates.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_product_templates.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.product_templates.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/GetProductTemplates.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_template_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_template_by_id.py new file mode 100644 index 000000000000..6eaf70d44801 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_template_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_template_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_template.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + template_id="8365ebfe-a381-45b7-ad08-7d818070e11f", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/GetTemplateById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_templates.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_templates.py new file mode 100644 index 000000000000..8b3f90dd2dc3 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/get_templates.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_templates.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_templates.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/GetTemplates.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/install_template.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/install_template.py new file mode 100644 index 000000000000..9067e8c72a74 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/content_templates/install_template.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python install_template.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfeab2-9ae0-4464-9919-dccaee2e48f0", + ) + + response = client.content_template.install( + resource_group_name="myRg", + workspace_name="myWorkspace", + template_id="str.azure-sentinel-solution-str", + template_installation_properties={ + "properties": { + "author": {"email": "support@microsoft.com", "name": "Microsoft"}, + "contentId": "8365ebfe-a381-45b7-ad08-7d818070e11f", + "contentKind": "AnalyticsRule", + "contentProductId": "str.azure-sentinel-solution-str-ar-cbfe4fndz66bi", + "displayName": "API Protection workbook template", + "mainTemplate": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.1", + "resources": [ + { + "apiVersion": "2022-04-01-preview", + "kind": "Scheduled", + "location": "[parameters('workspace-location')]", + "name": "8365ebfe-a381-45b7-ad08-7d818070e11f", + "properties": { + "description": "Creates an incident when a large number of Critical/High severity CrowdStrike Falcon sensor detections is triggered by a single user", + "displayName": "Critical or High Severity Detections by User", + "enabled": False, + "query": "...", + "queryFrequency": "PT1H", + "queryPeriod": "PT1H", + "severity": "High", + "status": "Available", + "suppressionDuration": "PT1H", + "suppressionEnabled": False, + "triggerOperator": "GreaterThan", + "triggerThreshold": 0, + }, + "type": "Microsoft.SecurityInsights/AlertRuleTemplates", + }, + { + "apiVersion": "2022-01-01-preview", + "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split([resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)],'/'))))]", + "properties": { + "author": {"email": "support@microsoft.com", "name": "Microsoft"}, + "contentId": "4465ebde-b381-45f7-ad08-7d818070a11c", + "description": "CrowdStrike Falcon Endpoint Protection Analytics Rule 1", + "kind": "AnalyticsRule", + "parentId": "[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)]", + "source": { + "kind": "Solution", + "name": "str", + "sourceId": "str.azure-sentinel-solution-str", + }, + "support": { + "email": "support@microsoft.com", + "link": "https://support.microsoft.com/", + "name": "Microsoft Corporation", + "tier": "Microsoft", + }, + "version": "1.0.0", + }, + "type": "Microsoft.OperationalInsights/workspaces/providers/metadata", + }, + ], + }, + "packageId": "str.azure-sentinel-solution-str", + "packageKind": "Solution", + "packageName": "str", + "packageVersion": "1.0.0", + "source": {"kind": "Solution", "name": "str", "sourceId": "str.azure-sentinel-solution-str"}, + "support": { + "email": "support@microsoft.com", + "link": "https://support.microsoft.com/", + "name": "Microsoft Corporation", + "tier": "Microsoft", + }, + "version": "1.0.1", + }, + "tags": {"tag1": "str"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/contentTemplates/InstallTemplate.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/create_customizable_data_connector_definition.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/create_customizable_data_connector_definition.py new file mode 100644 index 000000000000..413d0f82300e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/create_customizable_data_connector_definition.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_customizable_data_connector_definition.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connector_definitions.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_definition_name="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + connector_definition_input={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "Customizable", + "properties": { + "connectorUiConfig": { + "availability": {"isPreview": False, "status": 1}, + "connectivityCriteria": [ + { + "type": "IsConnectedQuery", + "value": [ + "GitHubAuditLogPolling_CL \n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)" + ], + } + ], + "dataTypes": [ + { + "lastDataReceivedQuery": "GitHubAuditLogPolling_CL \n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)", + "name": "GitHubAuditLogPolling_CL", + } + ], + "descriptionMarkdown": "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.", + "graphQueries": [ + { + "baseQuery": "GitHubAuditLogPolling_CL", + "legend": "GitHub audit log events", + "metricName": "Total events received", + } + ], + "instructionSteps": [ + { + "description": "Enable GitHub audit Logs. \n Follow `this `_ to create or find your personal key", + "instructions": [ + { + "parameters": { + "clientIdLabel": "Client ID", + "clientSecretLabel": "Client Secret", + "connectButtonLabel": "Connect", + "disconnectButtonLabel": "Disconnect", + }, + "type": "OAuthForm", + } + ], + "title": "Connect GitHub Enterprise Audit Log to Azure Sentinel", + } + ], + "permissions": { + "customs": [ + { + "description": "You need access to GitHub personal token, the key should have 'admin:org' scope", + "name": "GitHub API personal token Key", + } + ], + "resourceProvider": [ + { + "permissionsDisplayText": "read and write permissions are required.", + "provider": "Microsoft.OperationalInsights/workspaces", + "providerDisplayName": "Workspace", + "requiredPermissions": {"action": False, "delete": False, "read": False, "write": True}, + "scope": "Workspace", + } + ], + }, + "publisher": "GitHub", + "sampleQueries": [{"description": "All logs", "query": "GitHubAuditLogPolling_CL \n | take 10"}], + "title": "GitHub Enterprise Audit Log", + } + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectorDefinitions/CreateCustomizableDataConnectorDefinition.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/delete_data_connector_definition_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/delete_data_connector_definition_by_id.py new file mode 100644 index 000000000000..0054a0467ee4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/delete_data_connector_definition_by_id.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_data_connector_definition_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.data_connector_definitions.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_definition_name="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectorDefinitions/DeleteDataConnectorDefinitionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_customizable_data_connectoe_definition_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_customizable_data_connectoe_definition_by_id.py new file mode 100644 index 000000000000..9a4c1106f470 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_customizable_data_connectoe_definition_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_customizable_data_connectoe_definition_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connector_definitions.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_definition_name="763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectorDefinitions/GetCustomizableDataConnectoeDefinitionById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_data_connector_definitions.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_data_connector_definitions.py new file mode 100644 index 000000000000..a69c8d167c8f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connector_definitions/get_data_connector_definitions.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_data_connector_definitions.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connector_definitions.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectorDefinitions/GetDataConnectorDefinitions.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory.py new file mode 100644 index 000000000000..4363cad4741c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_azure_active_directory.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "AzureActiveDirectory", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectory.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_authorization.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_authorization.py new file mode 100644 index 000000000000..21c61bf9a2fc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_authorization.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_azure_active_directory_no_authorization.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "AzureActiveDirectory", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectoryNoAuthorization.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_license.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_license.py new file mode 100644 index 000000000000..8c2f1f2cf867 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_active_directory_no_license.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_azure_active_directory_no_license.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "AzureActiveDirectory", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectoryNoLicense.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_security_center.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_security_center.py new file mode 100644 index 000000000000..85f1cf3689ba --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_azure_security_center.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_azure_security_center.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "AzureSecurityCenter", + "properties": {"subscriptionId": "c0688291-89d7-4bed-87a2-a7b1bff43f4c"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsAzureSecurityCenter.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_dynamics365.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_dynamics365.py new file mode 100644 index 000000000000..4bb541c39bad --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_dynamics365.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_dynamics365.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "Dynamics365", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsDynamics365.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_io_t.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_io_t.py new file mode 100644 index 000000000000..07410000f9ed --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_io_t.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_io_t.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "IOT", + "properties": {"subscriptionId": "c0688291-89d7-4bed-87a2-a7b1bff43f4c"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsIoT.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_mdatp.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_mdatp.py new file mode 100644 index 000000000000..6b4ec5354d5c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_mdatp.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_mdatp.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "MicrosoftCloudAppSecurity", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsMdatp.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_cloud_app_security.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_cloud_app_security.py new file mode 100644 index 000000000000..17cd116ffca2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_cloud_app_security.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_microsoft_cloud_app_security.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "MicrosoftCloudAppSecurity", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftCloudAppSecurity.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_purview_information_protection.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_purview_information_protection.py new file mode 100644 index 000000000000..b4a9e85886d0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_purview_information_protection.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_microsoft_purview_information_protection.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "MicrosoftPurviewInformationProtection", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftPurviewInformationProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_intelligence.py new file mode 100644 index 000000000000..172cf6a10a62 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_intelligence.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_microsoft_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "MicrosoftThreatIntelligence", + "properties": {"tenantId": "06b3ccb8-1384-4bcc-aec7-852f6d57161b"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_protection.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_protection.py new file mode 100644 index 000000000000..72e36f804b3c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_microsoft_threat_protection.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_microsoft_threat_protection.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "MicrosoftThreatProtection", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftThreatProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office365_project.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office365_project.py new file mode 100644 index 000000000000..f1f44401f116 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office365_project.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_office365_project.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "Office365Project", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsOffice365Project.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_atp.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_atp.py new file mode 100644 index 000000000000..36e7daafb9c0 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_atp.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_office_atp.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "OfficeATP", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsOfficeATP.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_irm.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_irm.py new file mode 100644 index 000000000000..426582492c71 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_irm.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_office_irm.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "OfficeIRM", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsOfficeIRM.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_power_bi.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_power_bi.py new file mode 100644 index 000000000000..2be33ee84d0b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_office_power_bi.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_office_power_bi.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "OfficePowerBI", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsOfficePowerBI.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence.py new file mode 100644 index 000000000000..a247a80201a9 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "ThreatIntelligence", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence_taxii.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence_taxii.py new file mode 100644 index 000000000000..25e6164d2f90 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/check_requirements_threat_intelligence_taxii.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python check_requirements_threat_intelligence_taxii.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors_check_requirements.post( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connectors_check_requirements={ + "kind": "ThreatIntelligenceTaxii", + "properties": {"tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CheckRequirementsThreatIntelligenceTaxii.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling.py similarity index 93% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling.py index 2a05669c46df..ebcb765a49b5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling.py @@ -29,7 +29,7 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.connect( + client.data_connectors.connect( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", @@ -46,9 +46,8 @@ def main(): ], }, ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/ConnectAPIPolling.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/ConnectAPIPolling.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling_v2_logs.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling_v2_logs.py similarity index 94% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling_v2_logs.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling_v2_logs.py index f63f252194af..abc7017a441c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/connect_api_polling_v2_logs.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/connect_api_polling_v2_logs.py @@ -29,7 +29,7 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.connect( + client.data_connectors.connect( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", @@ -49,9 +49,8 @@ def main(): ], }, ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/ConnectAPIPollingV2Logs.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/ConnectAPIPollingV2Logs.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_api_polling.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_api_polling.py similarity index 99% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_api_polling.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_api_polling.py index ceceb21be0af..054fb870af96 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_api_polling.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_api_polling.py @@ -121,6 +121,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateAPIPolling.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateAPIPolling.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_dynamics365_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_dynamics365_data_connetor.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_dynamics365_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_dynamics365_data_connetor.py index 14c0e141de06..f4cf9b091142 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_dynamics365_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_dynamics365_data_connetor.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateDynamics365DataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateDynamics365DataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_generic_ui.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_generic_ui.py similarity index 99% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_generic_ui.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_generic_ui.py index b28a4a25f666..1953aaed21a9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_generic_ui.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_generic_ui.py @@ -156,6 +156,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateGenericUI.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateGenericUI.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_google_cloud_platform.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_google_cloud_platform.py new file mode 100644 index 000000000000..da8d4e654156 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_google_cloud_platform.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_google_cloud_platform.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + data_connector={ + "kind": "GCP", + "properties": { + "auth": { + "projectNumber": "123456789012", + "serviceAccountEmail": "sentinel-service-account@project-id.iam.gserviceaccount.com", + "type": "GCP", + "workloadIdentityProviderId": "sentinel-identity-provider", + }, + "connectorDefinitionName": "GcpConnector", + "dcrConfig": { + "dataCollectionEndpoint": "https://microsoft-sentinel-datacollectionendpoint-123m.westeurope-1.ingest.monitor.azure.com", + "dataCollectionRuleImmutableId": "dcr-de21b053bd5a44beb99a256c9db85023", + "streamName": "SENTINEL_GCP_AUDIT_LOGS", + }, + "request": {"projectId": "project-id", "subscriptionNames": ["sentinel-subscription"]}, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateGoogleCloudPlatform.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_purview_information_protection_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_purview_information_protection_data_connetor.py new file mode 100644 index 000000000000..2bb3854d1e4e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_purview_information_protection_data_connetor.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_microsoft_purview_information_protection_data_connetor.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "MicrosoftPurviewInformationProtection", + "properties": { + "dataTypes": {"logs": {"state": "Enabled"}}, + "tenantId": "2070ecc9-b4d5-4ae4-adaa-936fa1954fa8", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateMicrosoftPurviewInformationProtectionDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_intelligence_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_intelligence_data_connector.py new file mode 100644 index 000000000000..d932997cb4b4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_intelligence_data_connector.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_microsoft_threat_intelligence_data_connector.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + data_connector={ + "kind": "MicrosoftThreatIntelligence", + "properties": { + "dataTypes": { + "microsoftEmergingThreatFeed": {"lookbackPeriod": "1970-01-01T00:00:00.000Z", "state": "Enabled"} + }, + "tenantId": "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateMicrosoftThreatIntelligenceDataConnector.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_protection_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_protection_data_connetor.py new file mode 100644 index 000000000000..bb31a9d43602 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_microsoft_threat_protection_data_connetor.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_microsoft_threat_protection_data_connetor.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + data_connector={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "kind": "MicrosoftThreatProtection", + "properties": { + "dataTypes": {"alerts": {"state": "Enabled"}, "incidents": {"state": "Disabled"}}, + "filteredProviders": {"alerts": ["microsoftDefenderForCloudApps"]}, + "tenantId": "178265c4-3136-4ff6-8ed1-b5b62b4cb5f5", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateMicrosoftThreatProtectionDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office365_project_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office365_project_data_connetor.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office365_project_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office365_project_data_connetor.py index 17400d2e0bbe..d84397b229a3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office365_project_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office365_project_data_connetor.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateOffice365ProjectDataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateOffice365ProjectDataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_data_connetor.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_data_connetor.py index e64dbac15d70..16798130badb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_data_connetor.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateOfficeDataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateOfficeDataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_power_bi_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_power_bi_data_connector.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_power_bi_data_connector.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_power_bi_data_connector.py index c2c0e69ee1c2..d0aa39e6226f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_office_power_bi_data_connector.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_office_power_bi_data_connector.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateOfficePowerBIDataConnector.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateOfficePowerBIDataConnector.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_data_connector.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_data_connector.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_data_connector.py index e58c78df5816..e07fbe9b67b2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_data_connector.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_data_connector.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateThreatIntelligenceDataConnector.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateThreatIntelligenceDataConnector.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_taxii_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_taxii_data_connector.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_taxii_data_connector.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_taxii_data_connector.py index 1b4a4587c163..fff315cb5c64 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_threat_intelligence_taxii_data_connector.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/create_threat_intelligence_taxii_data_connector.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_api_polling.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_api_polling.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_api_polling.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_api_polling.py index 49864982ae30..3858c9964c73 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_api_polling.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_api_polling.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.delete( + client.data_connectors.delete( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DeleteAPIPolling.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteAPIPolling.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_generic_ui.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_generic_ui.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_generic_ui.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_generic_ui.py index b73a6e33886e..e4ae9a5691f5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_generic_ui.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_generic_ui.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.delete( + client.data_connectors.delete( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DeleteGenericUI.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteGenericUI.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_google_cloud_platform.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_google_cloud_platform.py new file mode 100644 index 000000000000..2cab58688b68 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_google_cloud_platform.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_google_cloud_platform.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteGoogleCloudPlatform.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_purview_information_protection_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_purview_information_protection_data_connetor.py new file mode 100644 index 000000000000..8e5345481098 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_purview_information_protection_data_connetor.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_microsoft_purview_information_protection_data_connetor.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteMicrosoftPurviewInformationProtectionDataConnetor.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_threat_intelligence_data_connector.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_threat_intelligence_data_connector.py new file mode 100644 index 000000000000..1ccdd355ec43 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_microsoft_threat_intelligence_data_connector.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_microsoft_threat_intelligence_data_connector.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.data_connectors.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteMicrosoftThreatIntelligenceDataConnector.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office365_project_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office365_project_data_connetor.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office365_project_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office365_project_data_connetor.py index 8b565c226eb2..fbe5242d3180 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office365_project_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office365_project_data_connetor.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.delete( + client.data_connectors.delete( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DeleteOffice365ProjectDataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteOffice365ProjectDataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_data_connetor.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_data_connetor.py index ea1346bce56e..0bc540084960 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_data_connetor.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.delete( + client.data_connectors.delete( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DeleteOfficeDataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteOfficeDataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_power_bi_data_connetor.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_power_bi_data_connetor.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_power_bi_data_connetor.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_power_bi_data_connetor.py index 9e48c8e08851..55695f22b161 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_power_bi_data_connetor.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/delete_office_power_bi_data_connetor.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.delete( + client.data_connectors.delete( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DeleteOfficePowerBIDataConnetor.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DeleteOfficePowerBIDataConnetor.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_api_polling.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/disconnect_api_polling.py similarity index 91% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_api_polling.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/disconnect_api_polling.py index 86acefb3218e..a7d28174e8c7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/disconnect_api_polling.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/disconnect_api_polling.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.data_connectors.disconnect( + client.data_connectors.disconnect( resource_group_name="myRg", workspace_name="myWorkspace", data_connector_id="316ec55e-7138-4d63-ab18-90c8a60fd1c8", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/DisconnectAPIPolling.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/DisconnectAPIPolling.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_cloud_trail_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_cloud_trail_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_cloud_trail_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_cloud_trail_by_id.py index 763052e052f7..12b8da6bdd02 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_cloud_trail_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_cloud_trail_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAmazonWebServicesCloudTrailById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAmazonWebServicesCloudTrailById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_s3_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_s3_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_s3_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_s3_by_id.py index 6738b3b06f21..88be91898c77 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_amazon_web_services_s3_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_amazon_web_services_s3_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAmazonWebServicesS3ById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAmazonWebServicesS3ById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_api_polling.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_api_polling.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_api_polling.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_api_polling.py index e36510675dde..979bad68b4b5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_api_polling.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_api_polling.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAPIPolling.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAPIPolling.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_active_directory_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_active_directory_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_active_directory_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_active_directory_by_id.py index 6fce52a1fd6c..bfcc4c00cdf0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_active_directory_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_active_directory_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAzureActiveDirectoryById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAzureActiveDirectoryById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_advanced_threat_protection_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_advanced_threat_protection_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_advanced_threat_protection_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_advanced_threat_protection_by_id.py index b6d603f21861..8a98c4c81c52 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_advanced_threat_protection_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_advanced_threat_protection_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAzureAdvancedThreatProtectionById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAzureAdvancedThreatProtectionById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_security_center_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_security_center_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_security_center_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_security_center_by_id.py index efd0ea37571e..a32e2392eacc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_security_center_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_azure_security_center_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetAzureSecurityCenterById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetAzureSecurityCenterById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_data_connectors.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_data_connectors.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_data_connectors.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_data_connectors.py index 3427dc2447ff..330795ca5086 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_data_connectors.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_data_connectors.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetDataConnectors.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetDataConnectors.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dynamics365_data_connector_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_dynamics365_data_connector_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dynamics365_data_connector_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_dynamics365_data_connector_by_id.py index 7b5578864e8a..45a6d598b461 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dynamics365_data_connector_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_dynamics365_data_connector_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetDynamics365DataConnectorById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetDynamics365DataConnectorById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_generic_ui.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_generic_ui.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_generic_ui.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_generic_ui.py index 3d93903adcd8..50251db50cf2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_generic_ui.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_generic_ui.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetGenericUI.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetGenericUI.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_google_cloud_platform_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_google_cloud_platform_by_id.py new file mode 100644 index 000000000000..4617f1af0865 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_google_cloud_platform_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_google_cloud_platform_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetGoogleCloudPlatformById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tby_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_io_tby_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tby_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_io_tby_id.py index 2862942122ce..61a1188c666b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tby_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_io_tby_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetIoTById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetIoTById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_cloud_app_security_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_cloud_app_security_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_cloud_app_security_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_cloud_app_security_by_id.py index 31c5ac11df7d..845d3aeddf71 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_cloud_app_security_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_cloud_app_security_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetMicrosoftCloudAppSecurityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftCloudAppSecurityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_defender_advanced_threat_protection_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_defender_advanced_threat_protection_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_defender_advanced_threat_protection_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_defender_advanced_threat_protection_by_id.py index b1d6154e90aa..45a5e564c6e4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_defender_advanced_threat_protection_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_defender_advanced_threat_protection_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_insider_risk_management_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_insider_risk_management_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_insider_risk_management_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_insider_risk_management_by_id.py index 51ae83893b7d..140d39e2263f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_insider_risk_management_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_insider_risk_management_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetMicrosoftInsiderRiskManagementById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftInsiderRiskManagementById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_purview_information_protection_data_connetor_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_purview_information_protection_data_connetor_by_id.py new file mode 100644 index 000000000000..71eb5b1c8ef4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_purview_information_protection_data_connetor_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_microsoft_purview_information_protection_data_connetor_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftPurviewInformationProtectionDataConnetorById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_intelligence_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_intelligence_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_intelligence_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_intelligence_by_id.py index 404e3265f958..7412796f4a11 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_intelligence_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_intelligence_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetMicrosoftThreatIntelligenceById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftThreatIntelligenceById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_protection_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_protection_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_protection_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_protection_by_id.py index d97c5ff04218..251c3f9db69c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_microsoft_threat_protection_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_microsoft_threat_protection_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetMicrosoftThreatProtectionById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetMicrosoftThreatProtectionById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_advanced_threat_protection_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_advanced_threat_protection_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_advanced_threat_protection_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_advanced_threat_protection_by_id.py index ce52eaf4847f..03db88e91eb9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_advanced_threat_protection_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_advanced_threat_protection_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetOffice365AdvancedThreatProtectionById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetOffice365AdvancedThreatProtectionById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_project_data_connetor_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_project_data_connetor_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_project_data_connetor_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_project_data_connetor_by_id.py index 5486268cc6f0..7015c2e02306 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office365_project_data_connetor_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office365_project_data_connetor_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetOffice365ProjectDataConnetorById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetOffice365ProjectDataConnetorById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_data_connetor_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_data_connetor_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_data_connetor_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_data_connetor_by_id.py index 0a4e4319b4f7..8dc1ba318013 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_data_connetor_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_data_connetor_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetOfficeDataConnetorById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetOfficeDataConnetorById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_power_bi_data_connetor_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_power_bi_data_connetor_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_power_bi_data_connetor_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_power_bi_data_connetor_by_id.py index 6136caf31c43..c4c173f78ed9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_power_bi_data_connetor_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_office_power_bi_data_connetor_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetOfficePowerBIDataConnetorById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetOfficePowerBIDataConnetorById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_by_id.py new file mode 100644 index 000000000000..4bf6a10149c1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_threat_intelligence_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.data_connectors.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + data_connector_id="c345bf40-8509-4ed2-b947-50cb773aaf04", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetThreatIntelligenceById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_taxii_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_taxii_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_taxii_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_taxii_by_id.py index 52cb79c118e1..d878a50a3f8d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_taxii_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/data_connectors/get_threat_intelligence_taxii_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/dataConnectors/GetThreatIntelligenceTaxiiById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/dataConnectors/GetThreatIntelligenceTaxiiById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_by_ip.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_geodata_by_ip.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_by_ip.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_geodata_by_ip.py index 93496f23f2d7..62ca37cffd99 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_geodata_by_ip.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_geodata_by_ip.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/enrichment/GetGeodataByIp.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/enrichment/GetGeodataByIp.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_by_domain_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_whois_by_domain_name.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_by_domain_name.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_whois_by_domain_name.py index 53f54bfb1d25..397f1111dfa4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_whois_by_domain_name.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/enrichment/get_whois_by_domain_name.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/enrichment/GetWhoisByDomainName.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/enrichment/GetWhoisByDomainName.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_entity.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/expand/post_expand_entity.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_entity.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/expand/post_expand_entity.py index 6419a34d794d..54dd2f9b28e6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_expand_entity.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/expand/post_expand_entity.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/expand/PostExpandEntity.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/expand/PostExpandEntity.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_account_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_account_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_account_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_account_entity_by_id.py index 4cdf7445de26..ef0ea85c27bb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_account_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_account_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetAccountEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetAccountEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_resource_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_azure_resource_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_resource_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_azure_resource_entity_by_id.py index b050cca4c7c5..747bb6b33e25 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_azure_resource_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_azure_resource_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetAzureResourceEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetAzureResourceEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_cloud_application_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_cloud_application_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_cloud_application_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_cloud_application_entity_by_id.py index 6f0e16b2e736..2df6b391722a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_cloud_application_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_cloud_application_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetCloudApplicationEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetCloudApplicationEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dns_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_dns_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dns_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_dns_entity_by_id.py index d12e56266b46..4cf46f8423a6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_dns_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_dns_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetDnsEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetDnsEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entities.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_entities.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entities.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_entities.py index 7497dda7be87..7a9f91797fa7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entities.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_entities.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetEntities.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetEntities.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_entity_by_id.py index 91f2d212d0ef..d7fb584e31e0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetFileEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetFileEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_hash_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_hash_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_hash_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_hash_entity_by_id.py index e3191f6d250b..923c7d171ce4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_hash_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_file_hash_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetFileHashEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetFileHashEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_host_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_host_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_host_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_host_entity_by_id.py index da73796bf50e..c7e3e1acf9da 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_host_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_host_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetHostEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetHostEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tdevice_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_io_tdevice_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tdevice_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_io_tdevice_entity_by_id.py index eb492445a610..dfdc9aee55ff 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_io_tdevice_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_io_tdevice_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetIoTDeviceEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetIoTDeviceEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_ip_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_ip_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_ip_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_ip_entity_by_id.py index 0df0f6826bed..45143ed83aab 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_ip_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_ip_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetIpEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetIpEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_cluster_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_cluster_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_cluster_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_cluster_entity_by_id.py index f43526065efd..fd766cd028e7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_cluster_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_cluster_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetMailClusterEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetMailClusterEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_message_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_message_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_message_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_message_entity_by_id.py index 5d9c55a18e9f..ffeb3589f6d9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mail_message_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mail_message_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetMailMessageEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetMailMessageEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mailbox_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mailbox_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mailbox_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mailbox_entity_by_id.py index ab443b71cfd7..33091515c26d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_mailbox_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_mailbox_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetMailboxEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetMailboxEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_malware_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_malware_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_malware_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_malware_entity_by_id.py index 5c8a14d51428..3aaaf231a805 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_malware_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_malware_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetMalwareEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetMalwareEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_process_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_process_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_process_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_process_entity_by_id.py index f00cd0a7d744..96327f4ae34e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_process_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_process_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetProcessEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetProcessEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_queries.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_queries.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_queries.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_queries.py index eb816400aa67..2dd21d6277fd 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_queries.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_queries.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetQueries.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetQueries.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_key_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_key_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_key_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_key_entity_by_id.py index cb4e42df61ca..303e57c41b46 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_key_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_key_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetRegistryKeyEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetRegistryKeyEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_value_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_value_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_value_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_value_entity_by_id.py index 5081e924eae9..31f720e25bba 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_registry_value_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_registry_value_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetRegistryValueEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetRegistryValueEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_alert_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_alert_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_alert_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_alert_entity_by_id.py index d97f34e82268..d503f6cdb5a4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_alert_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_alert_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetSecurityAlertEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetSecurityAlertEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_group_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_group_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_group_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_group_entity_by_id.py index 4dbc57ea7730..546b39504682 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_security_group_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_security_group_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetSecurityGroupEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetSecurityGroupEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_submission_mail_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_submission_mail_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_submission_mail_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_submission_mail_entity_by_id.py index 3ee652535e57..ea8d591a679a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_submission_mail_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_submission_mail_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetSubmissionMailEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetSubmissionMailEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_url_entity_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_url_entity_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_url_entity_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_url_entity_by_id.py index fb4d819a677e..3d3cc5f48515 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_url_entity_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/get_url_entity_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/GetUrlEntityById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/GetUrlEntityById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_get_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/insights/post_get_insights.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_get_insights.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/insights/post_get_insights.py index 4e210c82efb3..6190e686a462 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_get_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/insights/post_get_insights.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/insights/PostGetInsights.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/insights/PostGetInsights.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_relations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_all_entity_relations.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_relations.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_all_entity_relations.py index 292751766fbf..d6ceed38767b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_entity_relations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_all_entity_relations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/relations/GetAllEntityRelations.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/relations/GetAllEntityRelations.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_relation_by_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_entity_relation_by_name.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_relation_by_name.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_entity_relation_by_name.py index 9f6da60a51c1..2421372e22af 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_relation_by_name.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/relations/get_entity_relation_by_name.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/relations/GetEntityRelationByName.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/relations/GetEntityRelationByName.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_timeline_entity.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/timeline/post_timeline_entity.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_timeline_entity.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/timeline/post_timeline_entity.py index 8d224b26250a..aed4e4834d6b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/post_timeline_entity.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entities/timeline/post_timeline_entity.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entities/timeline/PostTimelineEntity.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entities/timeline/PostTimelineEntity.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_entity_query_activity.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/create_entity_query_activity.py similarity index 98% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_entity_query_activity.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/create_entity_query_activity.py index 0d31fbd40726..6bcfab14ad09 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_entity_query_activity.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/create_entity_query_activity.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueries/CreateEntityQueryActivity.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueries/CreateEntityQueryActivity.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_entity_query.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/delete_entity_query.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_entity_query.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/delete_entity_query.py index a65893898988..a4d402f881ed 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_entity_query.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/delete_entity_query.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.entity_queries.delete( + client.entity_queries.delete( resource_group_name="myRg", workspace_name="myWorkspace", entity_query_id="07da3cc8-c8ad-4710-a44e-334cdcb7882b", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueries/DeleteEntityQuery.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueries/DeleteEntityQuery.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_activity_entity_query_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_activity_entity_query_by_id.py index 627d89dee6b5..b54196366300 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_activity_entity_query_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueries/GetActivityEntityQueryById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueries/GetActivityEntityQueryById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_queries.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_entity_queries.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_queries.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_entity_queries.py index 8cee24ba1398..51635b808b63 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_queries.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_entity_queries.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueries/GetEntityQueries.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueries/GetEntityQueries.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_expansion_entity_query_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_expansion_entity_query_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_expansion_entity_query_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_expansion_entity_query_by_id.py index b602cd4c4c5f..79198b179f1c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_expansion_entity_query_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_queries/get_expansion_entity_query_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueries/GetExpansionEntityQueryById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueries/GetExpansionEntityQueryById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_template_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_activity_entity_query_template_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_template_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_activity_entity_query_template_by_id.py index 8535ed42977e..e859a1d6e828 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_activity_entity_query_template_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_activity_entity_query_template_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueryTemplates/GetActivityEntityQueryTemplateById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueryTemplates/GetActivityEntityQueryTemplateById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query_templates.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_entity_query_templates.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query_templates.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_entity_query_templates.py index 9891a363b78b..6fe6ad1e6313 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_entity_query_templates.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/entity_query_templates/get_entity_query_templates.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/entityQueryTemplates/GetEntityQueryTemplates.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/entityQueryTemplates/GetEntityQueryTemplates.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_file_import.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/create_file_import.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_file_import.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/create_file_import.py index 9a9744fd6ec9..0a91f6190116 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_file_import.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/create_file_import.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/fileImports/CreateFileImport.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/fileImports/CreateFileImport.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_file_import.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/delete_file_import.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_file_import.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/delete_file_import.py index 3b966a3523f3..782b53e2208c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_file_import.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/delete_file_import.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/fileImports/DeleteFileImport.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/fileImports/DeleteFileImport.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_import_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_import_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_import_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_import_by_id.py index 31cca3f33ca3..113019a52f63 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_import_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_import_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/fileImports/GetFileImportById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/fileImports/GetFileImportById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_imports.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_imports.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_imports.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_imports.py index 453ebae65bdc..eee0808f1840 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_file_imports.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/file_imports/get_file_imports.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/fileImports/GetFileImports.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/fileImports/GetFileImports.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt.py new file mode 100644 index 000000000000..9b49001b1075 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_hunt.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunts.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt={ + "properties": { + "attackTactics": ["Reconnaissance"], + "attackTechniques": ["T1595"], + "description": "Log4J Hunt Description", + "displayName": "Log4J new hunt", + "hypothesisStatus": "Unknown", + "labels": ["Label1", "Label2"], + "owner": {"objectId": "873b5263-5d34-4149-b356-ad341b01e123"}, + "status": "New", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/CreateHunt.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_comment.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_comment.py new file mode 100644 index 000000000000..c497ea400418 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_comment.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_hunt_comment.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_comments.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_comment_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + hunt_comment={"properties": {"message": "This is a test comment."}}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/CreateHuntComment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_relation.py new file mode 100644 index 000000000000..32b410627c9a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/create_hunt_relation.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_hunt_relation.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_relations.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_relation_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + hunt_relation={ + "properties": { + "labels": ["Test Label"], + "relatedResourceId": "/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/mms-eus/providers/Microsoft.OperationalInsights/workspaces/avdvirint/providers/Microsoft.SecurityInsights/Bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/CreateHuntRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt.py new file mode 100644 index 000000000000..c28578a81cce --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_hunt.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + client.hunts.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/DeleteHunt.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_comment.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_comment.py new file mode 100644 index 000000000000..3cc639ffb749 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_comment.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_hunt_comment.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + client.hunt_comments.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_comment_id="2216d0e1-91e3-4902-89fd-d2df8c123456", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/DeleteHuntComment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_relation.py new file mode 100644 index 000000000000..728d66a10afd --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/delete_hunt_relation.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_hunt_relation.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + client.hunt_relations.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_relation_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/DeleteHuntRelation.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_by_id.py new file mode 100644 index 000000000000..72a876ec327b --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunt_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunts.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHuntById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comment_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comment_by_id.py new file mode 100644 index 000000000000..71245fcb58db --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comment_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunt_comment_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_comments.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_comment_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHuntCommentById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comments.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comments.py new file mode 100644 index 000000000000..5b687aa84a71 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_comments.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunt_comments.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_comments.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHuntComments.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relation_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relation_by_id.py new file mode 100644 index 000000000000..fbbb9f003c91 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relation_by_id.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunt_relation_by_id.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_relations.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + hunt_relation_id="2216d0e1-91e3-4902-89fd-d2df8c535096", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHuntRelationById.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relations.py new file mode 100644 index 000000000000..97face2173dc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunt_relations.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunt_relations.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunt_relations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + hunt_id="163e7b2a-a2ec-4041-aaba-d878a38f265f", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHuntRelations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunts.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunts.py new file mode 100644 index 000000000000..3c60911f02ce --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/hunts/get_hunts.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_hunts.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.hunts.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/hunts/GetHunts.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_alerts.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_alerts/incidents_list_alerts.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_alerts.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_alerts/incidents_list_alerts.py index a62de178a146..b3341616216e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_alerts.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_alerts/incidents_list_alerts.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentAlerts/Incidents_ListAlerts.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentAlerts/Incidents_ListAlerts.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_bookmarks.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_bookmarks/incidents_list_bookmarks.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_bookmarks.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_bookmarks/incidents_list_bookmarks.py index b931f0ff5499..cd7ee2487ace 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_bookmarks.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_bookmarks/incidents_list_bookmarks.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentBookmarks/Incidents_ListBookmarks.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentBookmarks/Incidents_ListBookmarks.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_create_or_update.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_create_or_update.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_create_or_update.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_create_or_update.py index 76b762bca38f..f492dc3c9936 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_create_or_update.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_create_or_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentComments/IncidentComments_CreateOrUpdate.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentComments/IncidentComments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_delete.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_delete.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_delete.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_delete.py index 41de0f2f027c..9b1e328ef10a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_delete.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_delete.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.incident_comments.delete( + client.incident_comments.delete( resource_group_name="myRg", workspace_name="myWorkspace", incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", incident_comment_id="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentComments/IncidentComments_Delete.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentComments/IncidentComments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_get.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_get.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_get.py index 376e884be9ca..861a178b886d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_get.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentComments/IncidentComments_Get.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentComments/IncidentComments_Get.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_list.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_list.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_list.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_list.py index 7fce290b89df..3df59c6944ab 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_comments_list.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_comments/incident_comments_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentComments/IncidentComments_List.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentComments/IncidentComments_List.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_entities.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_entities/incidents_list_entities.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_entities.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_entities/incidents_list_entities.py index 93dbebcc10c5..29359f81231c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list_entities.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_entities/incidents_list_entities.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentEntities/Incidents_ListEntities.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentEntities/Incidents_ListEntities.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_create_or_update.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_create_or_update.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_create_or_update.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_create_or_update.py index 358cd15f754e..ef7c117a23b9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_create_or_update.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_create_or_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_CreateOrUpdate.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_delete.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_delete.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_delete.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_delete.py index 4e742bfbd432..d1b98806d933 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_delete.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_delete.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.incident_tasks.delete( + client.incident_tasks.delete( resource_group_name="myRg", workspace_name="myWorkspace", incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", incident_task_id="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_Delete.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_get.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_get.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_get.py index e825d109fd60..9ff3d1badc6b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_get.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_Get.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_Get.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_list.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_list.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_list.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_list.py index 371a20ddd697..521e33e33fc5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incident_tasks_list.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_tasks/incident_tasks_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_List.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentTasks/IncidentTasks_List.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_team.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_team/incidents_create_team.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_team.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_team/incidents_create_team.py index 6f3462eb2a73..b85a47b479a4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_team.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incident_team/incidents_create_team.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/IncidentTeam/Incidents_CreateTeam.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/IncidentTeam/Incidents_CreateTeam.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_or_update.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_create_or_update.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_or_update.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_create_or_update.py index 99dd33a78950..051132c030ed 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_create_or_update.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_create_or_update.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/Incidents_CreateOrUpdate.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/Incidents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_delete.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_delete.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_delete.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_delete.py index 46d6ef624106..4cef130095ce 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_delete.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.incidents.delete( + client.incidents.delete( resource_group_name="myRg", workspace_name="myWorkspace", incident_id="73e01a99-5cd7-4139-a149-9f2736ff2ab5", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/Incidents_Delete.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/Incidents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_get.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_get.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_get.py index 159a603b2460..ebb4f952ba5a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_get.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/Incidents_Get.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/Incidents_Get.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_list.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_list.py index 92ad2ea10b6b..b451ca591ad9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_list.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/incidents_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/Incidents_List.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/Incidents_List.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_incident_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/create_incident_relation.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_incident_relation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/create_incident_relation.py index 18684885840e..ba6d34af03cb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_incident_relation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/create_incident_relation.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/relations/CreateIncidentRelation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/relations/CreateIncidentRelation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_incident_relation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/delete_incident_relation.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_incident_relation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/delete_incident_relation.py index 78337555b97a..002dad89f5b2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_incident_relation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/delete_incident_relation.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.incident_relations.delete( + client.incident_relations.delete( resource_group_name="myRg", workspace_name="myWorkspace", incident_id="afbd324f-6c48-459c-8710-8d1e1cd03812", relation_name="4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/relations/DeleteIncidentRelation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/relations/DeleteIncidentRelation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_all_incident_relations.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_all_incident_relations.py index d51befaed744..62850201d610 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_incident_relations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_all_incident_relations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/relations/GetAllIncidentRelations.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/relations/GetAllIncidentRelations.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_incident_relation_by_name.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_incident_relation_by_name.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_incident_relation_by_name.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_incident_relation_by_name.py index 56607932ef56..133e1c1881f2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_incident_relation_by_name.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents/relations/get_incident_relation_by_name.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/incidents/relations/GetIncidentRelationByName.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/incidents/relations/GetIncidentRelationByName.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/entities_run_playbook.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/entities_run_playbook.py new file mode 100644 index 000000000000..beae41beb77c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/entities_run_playbook.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python entities_run_playbook.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.entities.run_playbook( + resource_group_name="myRg", + workspace_name="myWorkspace", + entity_identifier="72e01a22-5cd2-4139-a149-9f2736ff2ar2", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/manualTrigger/Entities_RunPlaybook.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/incidents_run_playbook.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/incidents_run_playbook.py index eeccd2e1694d..4242001f0e9f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/incidents_run_playbook.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/manual_trigger/incidents_run_playbook.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/manualTrigger/Incidents_RunPlaybook.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/manualTrigger/Incidents_RunPlaybook.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/delete_metadata.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/delete_metadata.py index 49bd06ba9428..f9cb5f1a9967 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_metadata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/delete_metadata.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.metadata.delete( + client.metadata.delete( resource_group_name="myRg", workspace_name="myWorkspace", metadata_name="metadataName", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/DeleteMetadata.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/DeleteMetadata.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata.py index 7db4cc0f8c28..b66c65eac940 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/GetAllMetadata.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/GetAllMetadata.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_odata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata_odata.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_odata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata_odata.py index 5b4257bac619..8f673936c46a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_metadata_odata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_all_metadata_odata.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/GetAllMetadataOData.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/GetAllMetadataOData.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_metadata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_metadata.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_metadata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_metadata.py index e8d786700ebb..983d55d286fe 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_metadata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/get_metadata.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/GetMetadata.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/GetMetadata.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_metadata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/patch_metadata.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_metadata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/patch_metadata.py index 7cbdf1b8fb56..844e9ee026f2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_metadata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/patch_metadata.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/PatchMetadata.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/PatchMetadata.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata.py similarity index 98% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata.py index 62ff77bced8a..2186aac57958 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata.py @@ -90,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/PutMetadata.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/PutMetadata.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata_minimal.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata_minimal.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata_minimal.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata_minimal.py index 10215a694f1a..4dd3b4b926f8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/put_metadata_minimal.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/metadata/put_metadata_minimal.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/metadata/PutMetadataMinimal.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/metadata/PutMetadataMinimal.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_consents.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/delete_office_consents.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_consents.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/delete_office_consents.py index d66ae4ac7351..554cba25c5e2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_office_consents.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/delete_office_consents.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.office_consents.delete( + client.office_consents.delete( resource_group_name="myRg", workspace_name="myWorkspace", consent_id="04e5fd05-ff86-4b97-b8d2-1c20933cb46c", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/officeConsents/DeleteOfficeConsents.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/officeConsents/DeleteOfficeConsents.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents.py index 047adb41a559..f4bb443f9ae1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/officeConsents/GetOfficeConsents.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/officeConsents/GetOfficeConsents.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents_by_id.py index 07d171e85fe9..b68166619ee6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_office_consents_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/office_consents/get_office_consents_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/officeConsents/GetOfficeConsentsById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/officeConsents/GetOfficeConsentsById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/create_sentinel_onboarding_state.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/create_sentinel_onboarding_state.py index 5c8fe53f325f..8d0fcaa61eaf 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_sentinel_onboarding_state.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/create_sentinel_onboarding_state.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/onboardingStates/CreateSentinelOnboardingState.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/onboardingStates/CreateSentinelOnboardingState.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/delete_sentinel_onboarding_state.py similarity index 91% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/delete_sentinel_onboarding_state.py index 7efd7e514297..df372b4bb784 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_sentinel_onboarding_state.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/delete_sentinel_onboarding_state.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.sentinel_onboarding_states.delete( + client.sentinel_onboarding_states.delete( resource_group_name="myRg", workspace_name="myWorkspace", sentinel_onboarding_state_name="default", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/onboardingStates/DeleteSentinelOnboardingState.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/onboardingStates/DeleteSentinelOnboardingState.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_all_sentinel_onboarding_states.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_all_sentinel_onboarding_states.py index 50414b351665..ebe3e6596e7c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_sentinel_onboarding_states.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_all_sentinel_onboarding_states.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/onboardingStates/GetAllSentinelOnboardingStates.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/onboardingStates/GetAllSentinelOnboardingStates.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_sentinel_onboarding_state.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_sentinel_onboarding_state.py index 9913163dbb50..a4ad8855b0f2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_sentinel_onboarding_state.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/onboarding_states/get_sentinel_onboarding_state.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/onboardingStates/GetSentinelOnboardingState.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/onboardingStates/GetSentinelOnboardingState.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/list_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/operations/list_operations.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/list_operations.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/operations/list_operations.py index c5bdf9face9c..8cba4bb9fe56 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/list_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/operations/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/operations/ListOperations.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/operations/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendation.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendation.py index 10ce219569fc..2ea6616e53cf 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendation.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/recommendations/GetRecommendation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/recommendations/GetRecommendation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendations.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendations.py index 049b5a6b8a82..34a119a9da04 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_recommendations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/get_recommendations.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/recommendations/GetRecommendations.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/recommendations/GetRecommendations.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_recommendation.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/patch_recommendation.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_recommendation.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/patch_recommendation.py index 42ed7cf1e6ac..5bdde71bf47a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/patch_recommendation.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/recommendations/patch_recommendation.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/recommendations/PatchRecommendation.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/recommendations/PatchRecommendation.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repositories.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/repositories/get_repositories.py similarity index 77% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repositories.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/repositories/get_repositories.py index a79ba4b95ce1..9168cd8d7dc4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_repositories.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/repositories/get_repositories.py @@ -32,12 +32,22 @@ def main(): response = client.source_control.list_repositories( resource_group_name="myRg", workspace_name="myWorkspace", - repo_type="Github", + repository_access={ + "etag": '"0300bf09-0000-0000-0000-5c37296e0000"', + "properties": { + "repositoryAccess": { + "clientId": "54b3c2c0-1f48-4a1c-af9f-6399c3240b73", + "code": "939fd7c6caf754f4f41f", + "kind": "OAuth", + "state": "state", + } + }, + }, ) for item in response: print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/repositories/GetRepositories.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/repositories/GetRepositories.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/create_anomaly_security_ml_analytics_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/create_anomaly_security_ml_analytics_setting.py new file mode 100644 index 000000000000..485ee9ea3306 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/create_anomaly_security_ml_analytics_setting.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_anomaly_security_ml_analytics_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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.security_ml_analytics_settings.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + settings_resource_name="f209187f-1d17-4431-94af-c141bf5f23db", + security_ml_analytics_setting={ + "etag": '"260090e2-0000-0d00-0000-5d6fb8670000"', + "kind": "Anomaly", + "properties": { + "anomalySettingsVersion": 0, + "anomalyVersion": "1.0.5", + "customizableObservations": { + "multiSelectObservations": None, + "prioritizeExcludeObservations": None, + "singleSelectObservations": [ + { + "description": "Select device vendor of network connection logs from CommonSecurityLog", + "name": "Device vendor", + "rerun": "RerunAlways", + "sequenceNumber": 1, + "supportedValues": ["Palo Alto Networks", "Fortinet", "Check Point"], + "supportedValuesKql": None, + "value": ["Palo Alto Networks"], + "valuesKql": None, + } + ], + "singleValueObservations": None, + "thresholdObservations": [ + { + "description": "Suppress anomalies when daily data transfered (in MB) per hour is less than the chosen value", + "maximum": "100", + "minimum": "1", + "name": "Daily data transfer threshold in MB", + "rerun": "RerunAlways", + "sequenceNumber": 1, + "value": "25", + }, + { + "description": "Triggers anomalies when number of standard deviations is greater than the chosen value", + "maximum": "10", + "minimum": "2", + "name": "Number of standard deviations", + "rerun": "RerunAlways", + "sequenceNumber": 2, + "value": "3", + }, + ], + }, + "description": "When account logs from a source region that has rarely been logged in from during the last 14 days, an anomaly is triggered.", + "displayName": "Login from unusual region", + "enabled": True, + "frequency": "PT1H", + "isDefaultSettings": True, + "requiredDataConnectors": [{"connectorId": "AWS", "dataTypes": ["AWSCloudTrail"]}], + "settingsDefinitionId": "f209187f-1d17-4431-94af-c141bf5f23db", + "settingsStatus": "Production", + "tactics": ["Exfiltration", "CommandAndControl"], + "techniques": ["T1037", "T1021"], + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_security_ml_analytics_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/delete_security_ml_analytics_setting.py similarity index 91% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_security_ml_analytics_setting.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/delete_security_ml_analytics_setting.py index 10c84d42cbb3..01ed49b679e1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_security_ml_analytics_setting.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/delete_security_ml_analytics_setting.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.security_ml_analytics_settings.delete( + client.security_ml_analytics_settings.delete( resource_group_name="myRg", workspace_name="myWorkspace", settings_resource_name="f209187f-1d17-4431-94af-c141bf5f23db", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_all_security_ml_analytics_settings.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_all_security_ml_analytics_settings.py index 1a674b133d69..f34933df247d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_security_ml_analytics_settings.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_all_security_ml_analytics_settings.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_anomaly_security_ml_analytics_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_anomaly_security_ml_analytics_setting.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_anomaly_security_ml_analytics_setting.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_anomaly_security_ml_analytics_setting.py index 58c9a9583e24..4e9ef5e9c72f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_anomaly_security_ml_analytics_setting.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/security_ml_analytics_settings/get_anomaly_security_ml_analytics_setting.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/delete_eyes_on_setting.py similarity index 91% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_setting.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/delete_eyes_on_setting.py index 599eaa20379e..12e297a0546d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_eyes_on_setting.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/delete_eyes_on_setting.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.product_settings.delete( + client.product_settings.delete( resource_group_name="myRg", workspace_name="myWorkspace", settings_name="EyesOn", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/settings/DeleteEyesOnSetting.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/settings/DeleteEyesOnSetting.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_all_settings.py similarity index 95% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_all_settings.py index 9686f64f3e57..fae5823ba70a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_all_settings.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_all_settings.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/settings/GetAllSettings.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/settings/GetAllSettings.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_eyes_on_setting.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_setting.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_eyes_on_setting.py index 631125a81101..4feaf09edd82 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_eyes_on_setting.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/get_eyes_on_setting.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/settings/GetEyesOnSetting.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/settings/GetEyesOnSetting.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_setting.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/update_eyes_on_setting.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_setting.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/update_eyes_on_setting.py index 9f10f20bb113..d159c006154f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/update_eyes_on_setting.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/settings/update_eyes_on_setting.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/settings/UpdateEyesOnSetting.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/settings/UpdateEyesOnSetting.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_source_control.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/create_source_control.py similarity index 87% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_source_control.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/create_source_control.py index e4ba898e9ea7..350a6ce51c4c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_source_control.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/create_source_control.py @@ -43,18 +43,20 @@ def main(): "repository": { "branch": "master", "displayUrl": "https://github.com/user/repo", - "pathMapping": [ - {"contentType": "AnalyticRules", "path": "path/to/rules"}, - {"contentType": "Workbook", "path": "path/to/workbooks"}, - ], "url": "https://github.com/user/repo", }, + "repositoryAccess": { + "clientId": "54b3c2c0-1f48-4a1c-af9f-6399c3240b73", + "code": "939fd7c6caf754f4f41f", + "kind": "OAuth", + "state": "state", + }, }, }, ) print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/sourcecontrols/CreateSourceControl.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/sourcecontrols/CreateSourceControl.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/delete_source_control.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/delete_source_control.py new file mode 100644 index 000000000000..ec2fb1b19cf8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/delete_source_control.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_source_control.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.source_controls.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + source_control_id="789e0c1f-4a3d-43ad-809c-e713b677b04a", + repository_access={ + "properties": { + "repositoryAccess": { + "clientId": "54b3c2c0-1f48-4a1c-af9f-6399c3240b73", + "code": "939fd7c6caf754f4f41f", + "kind": "OAuth", + "state": "state", + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/sourcecontrols/DeleteSourceControl.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_control_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_control_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_control_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_control_by_id.py index 340237ce6a45..91f73add6e74 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_control_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_control_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/sourcecontrols/GetSourceControlById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/sourcecontrols/GetSourceControlById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_controls.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_controls.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_controls.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_controls.py index ceb9628d252b..93148b146165 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_source_controls.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/sourcecontrols/get_source_controls.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/sourcecontrols/GetSourceControls.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/sourcecontrols/GetSourceControls.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/append_tags_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/append_tags_threat_intelligence.py new file mode 100644 index 000000000000..674f91930cad --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/append_tags_threat_intelligence.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python append_tags_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + client.threat_intelligence_indicator.append_tags( + resource_group_name="myRg", + workspace_name="myWorkspace", + name="d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + threat_intelligence_append_tags={"threatIntelligenceTags": ["tag1", "tag2"]}, + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/AppendTagsThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/collect_threat_intelligence_metrics.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/collect_threat_intelligence_metrics.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/collect_threat_intelligence_metrics.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/collect_threat_intelligence_metrics.py index a75c2fbfdef1..8718e367c3aa 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/collect_threat_intelligence_metrics.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/collect_threat_intelligence_metrics.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/threatintelligence/CollectThreatIntelligenceMetrics.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/CollectThreatIntelligenceMetrics.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/create_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/create_threat_intelligence.py new file mode 100644 index 000000000000..6f7874c58337 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/create_threat_intelligence.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.create_indicator( + resource_group_name="myRg", + workspace_name="myWorkspace", + threat_intelligence_properties={ + "kind": "indicator", + "properties": { + "confidence": 78, + "createdByRef": "contoso@contoso.com", + "description": "debugging indicators", + "displayName": "new schema", + "externalReferences": [], + "granularMarkings": [], + "killChainPhases": [], + "labels": [], + "modified": "", + "pattern": "[url:value = 'https://www.contoso.com']", + "patternType": "url", + "revoked": False, + "source": "Azure Sentinel", + "threatIntelligenceTags": ["new schema"], + "threatTypes": ["compromised"], + "validFrom": "2021-09-15T17:44:00.114052Z", + "validUntil": "", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/CreateThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/delete_threat_intelligence.py similarity index 91% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_threat_intelligence.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/delete_threat_intelligence.py index 254248e2572d..897ade61d32a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_threat_intelligence.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/delete_threat_intelligence.py @@ -29,14 +29,13 @@ def main(): subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", ) - response = client.threat_intelligence_indicator.delete( + client.threat_intelligence_indicator.delete( resource_group_name="myRg", workspace_name="myWorkspace", name="d9cd6f0b-96b9-3984-17cd-a779d1e15a93", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/threatintelligence/DeleteThreatIntelligence.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/DeleteThreatIntelligence.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence.py index 6dc9762759ac..7960adc8bdc1 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/threatintelligence/GetThreatIntelligence.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/GetThreatIntelligence.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence_by_id.py index 41e6c872c5ee..a46310596280 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_threat_intelligence_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/get_threat_intelligence_by_id.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/threatintelligence/GetThreatIntelligenceById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/GetThreatIntelligenceById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/query_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/query_threat_intelligence.py new file mode 100644 index 000000000000..c126aa9dbb05 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/query_threat_intelligence.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python query_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.query_indicators( + resource_group_name="myRg", + workspace_name="myWorkspace", + threat_intelligence_filtering_criteria={ + "maxConfidence": 80, + "maxValidUntil": "2021-04-25T17:44:00.114052Z", + "minConfidence": 25, + "minValidUntil": "2021-04-05T17:44:00.114052Z", + "pageSize": 100, + "sortBy": [{"itemKey": "lastUpdatedTimeUtc", "sortOrder": "descending"}], + "sources": ["Azure Sentinel"], + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/QueryThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/replace_tags_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/replace_tags_threat_intelligence.py new file mode 100644 index 000000000000..feea70d1eb4a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/replace_tags_threat_intelligence.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python replace_tags_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.replace_tags( + resource_group_name="myRg", + workspace_name="myWorkspace", + name="d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + threat_intelligence_replace_tags={ + "etag": '"0000262c-0000-0800-0000-5e9767060000"', + "kind": "indicator", + "properties": {"threatIntelligenceTags": ["patching tags"]}, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/ReplaceTagsThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/update_threat_intelligence.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/update_threat_intelligence.py new file mode 100644 index 000000000000..9b82f073ef4e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/threatintelligence/update_threat_intelligence.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python update_threat_intelligence.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="bd794837-4d29-4647-9105-6339bfdb4e6a", + ) + + response = client.threat_intelligence_indicator.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + name="d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + threat_intelligence_properties={ + "kind": "indicator", + "properties": { + "confidence": 78, + "createdByRef": "contoso@contoso.com", + "description": "debugging indicators", + "displayName": "new schema", + "externalReferences": [], + "granularMarkings": [], + "killChainPhases": [], + "labels": [], + "modified": "", + "pattern": "[url:value = 'https://www.contoso.com']", + "patternType": "url", + "revoked": False, + "source": "Azure Sentinel", + "threatIntelligenceTags": ["new schema"], + "threatTypes": ["compromised"], + "validFrom": "2020-04-15T17:44:00.114052Z", + "validUntil": "", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/threatintelligence/UpdateThreatIntelligence.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/trigger_rule_run_post.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/trigger_rule_run_post.py new file mode 100644 index 000000000000..39f16513ba9c --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/trigger_rule_run_post.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python trigger_rule_run_post.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.alert_rule.begin_trigger_rule_run( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_id="65360bb0-8986-4ade-a89d-af3cf44d28aa", + analytics_rule_run_trigger_parameter={"properties": {"executionTimeUtc": "2022-12-22T15:37:03.074Z"}}, + ).result() + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/triggeredAnalyticsRuleRuns/triggerRuleRun_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_run_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_run_get.py new file mode 100644 index 000000000000..75d5ecb237bc --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_run_get.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python triggered_analytics_rule_run_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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.triggered_analytics_rule_run.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + rule_run_id="65360bb0-8986-4ade-a89d-af3cf44d28aa", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRun_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_runs_get.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_runs_get.py new file mode 100644 index 000000000000..5838dfa82217 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/triggered_analytics_rule_runs/triggered_analytics_rule_runs_get.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python triggered_analytics_rule_runs_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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.get_triggered_analytics_rule_runs.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRuns_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist.py index 47b0e922392f..e42f1bf37c8e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/CreateWatchlist.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/CreateWatchlist.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_and_watchlist_items.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_and_watchlist_items.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_and_watchlist_items.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_and_watchlist_items.py index 96205b46222e..cd0664d6b417 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_and_watchlist_items.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_and_watchlist_items.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/CreateWatchlistAndWatchlistItems.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/CreateWatchlistAndWatchlistItems.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_item.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_item.py similarity index 97% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_item.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_item.py index f527c1dbf8eb..349f66f5235b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/create_watchlist_item.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/create_watchlist_item.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/CreateWatchlistItem.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/CreateWatchlistItem.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist.py index 657798684a34..fe2c53ee3ecd 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist.py @@ -29,14 +29,13 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.watchlists.delete( + client.watchlists.delete( resource_group_name="myRg", workspace_name="myWorkspace", watchlist_alias="highValueAsset", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/DeleteWatchlist.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/DeleteWatchlist.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist_item.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist_item.py similarity index 92% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist_item.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist_item.py index d22cdfb7f9df..5a2bc58ecbac 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/delete_watchlist_item.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/delete_watchlist_item.py @@ -29,15 +29,14 @@ def main(): subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", ) - response = client.watchlist_items.delete( + client.watchlist_items.delete( resource_group_name="myRg", workspace_name="myWorkspace", watchlist_alias="highValueAsset", watchlist_item_id="4008512e-1d30-48b2-9ee2-d3612ed9d3ea", ) - print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/DeleteWatchlistItem.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/DeleteWatchlistItem.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_by_alias.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_by_alias.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_by_alias.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_by_alias.py index 52d3b745e293..b0cf3a07363c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_by_alias.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_by_alias.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/GetWatchlistByAlias.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/GetWatchlistByAlias.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_item_by_id.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_item_by_id.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_item_by_id.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_item_by_id.py index 412ba40fef43..2cc062e21aad 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_item_by_id.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_item_by_id.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/GetWatchlistItemById.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/GetWatchlistItemById.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_items.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_items.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_items.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_items.py index ca7c80699b5b..88323530ecce 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlist_items.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlist_items.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/GetWatchlistItems.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/GetWatchlistItems.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlists.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlists.py similarity index 96% rename from sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlists.py rename to sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlists.py index 2546e29b6ff9..f00dfab9b061 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/get_watchlists.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/watchlists/get_watchlists.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-12-01-preview/examples/watchlists/GetWatchlists.json +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/watchlists/GetWatchlists.json if __name__ == "__main__": main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_job.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_job.py new file mode 100644 index 000000000000..98b07d5c796a --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_job.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_job.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignment_jobs.create( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/CreateJob.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_or_update_workspace_manager_assignment.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_or_update_workspace_manager_assignment.py new file mode 100644 index 000000000000..2f2a5a2e2338 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/create_or_update_workspace_manager_assignment.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_or_update_workspace_manager_assignment.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignments.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + workspace_manager_assignment={ + "properties": { + "items": [ + { + "resourceId": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleOne" + }, + { + "resourceId": "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleTwo" + }, + ], + "targetResourceName": "37207a7a-3b8a-438f-a559-c7df400e1b96", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/CreateOrUpdateWorkspaceManagerAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_job.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_job.py new file mode 100644 index 000000000000..3f74b9d02fe6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_job.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_job.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.workspace_manager_assignment_jobs.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + job_name="cfbe1338-8276-4d5d-8b96-931117f9fa0e", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/DeleteJob.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_workspace_manager_assignment.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_workspace_manager_assignment.py new file mode 100644 index 000000000000..1c9d534929ff --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/delete_workspace_manager_assignment.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_workspace_manager_assignment.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.workspace_manager_assignments.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/DeleteWorkspaceManagerAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_jobs.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_jobs.py new file mode 100644 index 000000000000..f6ddd98e6f2d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_jobs.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_jobs.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignment_jobs.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/GetAllJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_workspace_manager_assignments.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_workspace_manager_assignments.py new file mode 100644 index 000000000000..8640ba1142a2 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_all_workspace_manager_assignments.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_workspace_manager_assignments.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignments.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/GetAllWorkspaceManagerAssignments.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_job.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_job.py new file mode 100644 index 000000000000..90aed5f1c807 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_job.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_job.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignment_jobs.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + job_name="cfbe1338-8276-4d5d-8b96-931117f9fa0e", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/GetJob.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_workspace_manager_assignment.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_workspace_manager_assignment.py new file mode 100644 index 000000000000..6d43ed31a7b7 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_assignments/get_workspace_manager_assignment.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_workspace_manager_assignment.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_assignments.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_assignment_name="47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerAssignments/GetWorkspaceManagerAssignment.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/create_or_update_workspace_manager_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/create_or_update_workspace_manager_configuration.py new file mode 100644 index 000000000000..a89f6efd086f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/create_or_update_workspace_manager_configuration.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_or_update_workspace_manager_configuration.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_configurations.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_configuration_name="default", + workspace_manager_configuration={"properties": {"mode": "Enabled"}}, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerConfigurations/CreateOrUpdateWorkspaceManagerConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/delete_workspace_manager_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/delete_workspace_manager_configuration.py new file mode 100644 index 000000000000..523a37c26396 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/delete_workspace_manager_configuration.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_workspace_manager_configuration.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.workspace_manager_configurations.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_configuration_name="default", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerConfigurations/DeleteWorkspaceManagerConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_all_workspace_manager_configurations.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_all_workspace_manager_configurations.py new file mode 100644 index 000000000000..3e652fde5a0d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_all_workspace_manager_configurations.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_workspace_manager_configurations.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_configurations.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerConfigurations/GetAllWorkspaceManagerConfigurations.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_workspace_manager_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_workspace_manager_configuration.py new file mode 100644 index 000000000000..de1e474afb0f --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_configurations/get_workspace_manager_configuration.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_workspace_manager_configuration.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_configurations.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_configuration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerConfigurations/GetWorkspaceManagerConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/create_or_update_workspace_manager_group.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/create_or_update_workspace_manager_group.py new file mode 100644 index 000000000000..78967102065d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/create_or_update_workspace_manager_group.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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_or_update_workspace_manager_group.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_groups.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_group_name="37207a7a-3b8a-438f-a559-c7df400e1b96", + workspace_manager_group={ + "properties": { + "description": "Group of all financial and banking institutions", + "displayName": "Banks", + "memberResourceNames": ["afbd324f-6c48-459c-8710-8d1e1cd03812", "f5fa104e-c0e3-4747-9182-d342dc048a9e"], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerGroups/CreateOrUpdateWorkspaceManagerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/delete_workspace_manager_group.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/delete_workspace_manager_group.py new file mode 100644 index 000000000000..be3065a468a6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/delete_workspace_manager_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_workspace_manager_group.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.workspace_manager_groups.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_group_name="37207a7a-3b8a-438f-a559-c7df400e1b96", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerGroups/DeleteWorkspaceManagerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_all_workspace_manager_groups.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_all_workspace_manager_groups.py new file mode 100644 index 000000000000..65c28742f1b5 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_all_workspace_manager_groups.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_workspace_manager_groups.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_groups.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerGroups/GetAllWorkspaceManagerGroups.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_workspace_manager_group.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_workspace_manager_group.py new file mode 100644 index 000000000000..1332a154a42e --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_groups/get_workspace_manager_group.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_workspace_manager_group.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_groups.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_group_name="37207a7a-3b8a-438f-a559-c7df400e1b96", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerGroups/GetWorkspaceManagerGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/create_or_update_workspace_manager_member.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/create_or_update_workspace_manager_member.py new file mode 100644 index 000000000000..229912af06aa --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/create_or_update_workspace_manager_member.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python create_or_update_workspace_manager_member.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_members.create_or_update( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_member_name="afbd324f-6c48-459c-8710-8d1e1cd03812", + workspace_manager_member={ + "properties": { + "targetWorkspaceResourceId": "/subscriptions/7aef9d48-814f-45ad-b644-b0343316e174/resourceGroups/otherRg/providers/Microsoft.OperationalInsights/workspaces/Example_Workspace", + "targetWorkspaceTenantId": "f676d436-8d16-42db-81b7-ab578e110ccd", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerMembers/CreateOrUpdateWorkspaceManagerMember.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/delete_workspace_manager_member.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/delete_workspace_manager_member.py new file mode 100644 index 000000000000..06eb72e65cf8 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/delete_workspace_manager_member.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python delete_workspace_manager_member.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + client.workspace_manager_members.delete( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_member_name="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerMembers/DeleteWorkspaceManagerMember.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_all_workspace_manager_members.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_all_workspace_manager_members.py new file mode 100644 index 000000000000..b53f5af18ba6 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_all_workspace_manager_members.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_all_workspace_manager_members.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_members.list( + resource_group_name="myRg", + workspace_name="myWorkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerMembers/GetAllWorkspaceManagerMembers.json +if __name__ == "__main__": + main() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_workspace_manager_member.py b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_workspace_manager_member.py new file mode 100644 index 000000000000..dc8ce56aa862 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/generated_samples/workspace_manager_members/get_workspace_manager_member.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.securityinsight import SecurityInsights + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-securityinsight +# USAGE + python get_workspace_manager_member.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 = SecurityInsights( + credential=DefaultAzureCredential(), + subscription_id="d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", + ) + + response = client.workspace_manager_members.get( + resource_group_name="myRg", + workspace_name="myWorkspace", + workspace_manager_member_name="afbd324f-6c48-459c-8710-8d1e1cd03812", + ) + print(response) + + +# x-ms-original-file: specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2023-12-01-preview/examples/workspaceManagerMembers/GetWorkspaceManagerMember.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json index 05745ad61426..8ec544416685 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json +++ b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json @@ -1,11 +1,11 @@ { - "commit": "164375e67a1bffb207bcf603772c289dbe42d7b5", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/servicefabric/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/servicefabric/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicefabric/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py index 83f24ab50946..e5754a47ce68 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json index d48647ee79b3..0f0303f63cbe 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json @@ -1,11 +1,11 @@ { - "commit": "164375e67a1bffb207bcf603772c289dbe42d7b5", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/servicefabricmanagedclusters/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py index ce30b3333ca9..81840b87094d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration( :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py index 4e2c2099e772..3fd1a7eef612 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py @@ -89,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :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-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py index 6399a016fdd6..eae7c95b6fbd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b5" +VERSION = "0.1.0" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py index 0710224e0bbb..dcd67e072548 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration( :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py index f8bd3957c835..16d62d59fec0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py @@ -89,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :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-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py index f3ffee20aad3..1dcc39a435df 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py @@ -2233,6 +2233,13 @@ class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes :ivar upgrade_description: The policy to use when upgrading the cluster. :vartype upgrade_description: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy + :ivar http_gateway_token_auth_connection_port: The port used for token-auth based HTTPS + connections to the cluster. Cannot be set to the same port as HttpGatewayEndpoint. + :vartype http_gateway_token_auth_connection_port: int + :ivar enable_http_gateway_exclusive_auth_mode: If true, token-based authentication is not + allowed on the HttpGatewayEndpoint. This is required to support TLS versions 1.3 and above. If + token-based authentication is used, HttpGatewayTokenAuthConnectionPort must be defined. + :vartype enable_http_gateway_exclusive_auth_mode: bool """ _validation = { @@ -2301,6 +2308,14 @@ class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes "public_i_pv6_prefix_id": {"key": "properties.publicIPv6PrefixId", "type": "str"}, "ddos_protection_plan_id": {"key": "properties.ddosProtectionPlanId", "type": "str"}, "upgrade_description": {"key": "properties.upgradeDescription", "type": "ClusterUpgradePolicy"}, + "http_gateway_token_auth_connection_port": { + "key": "properties.httpGatewayTokenAuthConnectionPort", + "type": "int", + }, + "enable_http_gateway_exclusive_auth_mode": { + "key": "properties.enableHttpGatewayExclusiveAuthMode", + "type": "bool", + }, } def __init__( # pylint: disable=too-many-locals @@ -2339,6 +2354,8 @@ def __init__( # pylint: disable=too-many-locals public_i_pv6_prefix_id: Optional[str] = None, ddos_protection_plan_id: Optional[str] = None, upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, + http_gateway_token_auth_connection_port: Optional[int] = None, + enable_http_gateway_exclusive_auth_mode: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -2446,6 +2463,13 @@ def __init__( # pylint: disable=too-many-locals :keyword upgrade_description: The policy to use when upgrading the cluster. :paramtype upgrade_description: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy + :keyword http_gateway_token_auth_connection_port: The port used for token-auth based HTTPS + connections to the cluster. Cannot be set to the same port as HttpGatewayEndpoint. + :paramtype http_gateway_token_auth_connection_port: int + :keyword enable_http_gateway_exclusive_auth_mode: If true, token-based authentication is not + allowed on the HttpGatewayEndpoint. This is required to support TLS versions 1.3 and above. If + token-based authentication is used, HttpGatewayTokenAuthConnectionPort must be defined. + :paramtype enable_http_gateway_exclusive_auth_mode: bool """ super().__init__(location=location, tags=tags, **kwargs) self.sku = sku @@ -2486,6 +2510,8 @@ def __init__( # pylint: disable=too-many-locals self.public_i_pv6_prefix_id = public_i_pv6_prefix_id self.ddos_protection_plan_id = ddos_protection_plan_id self.upgrade_description = upgrade_description + self.http_gateway_token_auth_connection_port = http_gateway_token_auth_connection_port + self.enable_http_gateway_exclusive_auth_mode = enable_http_gateway_exclusive_auth_mode class ManagedClusterCodeVersionResult(_serialization.Model): diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py index 74c2a64d8e92..1b74be15cd3b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py @@ -50,7 +50,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +129,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +203,7 @@ def build_list_by_application_types_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py index a9ec3a68f2ac..2a7fb8f75ac1 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py @@ -45,7 +45,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +77,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -112,7 +112,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_list_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py index 77134993eb9f..c8099c1695e6 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py @@ -45,7 +45,7 @@ def build_read_upgrade_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +77,7 @@ def build_start_rollback_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_resume_upgrade_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +144,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +246,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +276,7 @@ def build_list_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py index 75a2e1539c41..01e7196d53e8 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py @@ -38,7 +38,7 @@ def build_post_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py index 8c4840d47fdd..7f0aba953e5b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py @@ -38,7 +38,7 @@ def build_get_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py index a7e55111d783..0753cccbc872 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py @@ -38,7 +38,7 @@ def build_get_request(location: str, cluster_version: str, subscription_id: str, _headers = case_insensitive_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_by_environment_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_list_by_environment_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py index 85e91f3819d2..87a0a2d4b48d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py @@ -43,7 +43,7 @@ def build_list_by_resource_group_request(resource_group_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +162,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +196,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py index e8afdfd1b81d..4a6e65b63854 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py @@ -38,7 +38,7 @@ def build_get_request(resource_group_name: str, cluster_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py index 35e969cdd412..f5c78c9e401c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py @@ -40,7 +40,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_get_request(location: str, vm_size: str, subscription_id: str, **kwarg _headers = case_insensitive_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py index e55cfc9af439..ae3d156ca4eb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py @@ -42,7 +42,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py index 2ddbc2a19bc2..c350941c8660 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py @@ -45,7 +45,7 @@ def build_list_by_managed_clusters_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -111,7 +111,7 @@ def build_reimage_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +146,7 @@ def build_delete_node_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -181,7 +181,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +213,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -248,7 +248,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -283,7 +283,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py index c6c9e780934a..6a275c82db76 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py @@ -38,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py index 3d352375735d..87a43a03c26e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py @@ -38,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py index 4b4519ef4e8d..e703892356a3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py @@ -40,7 +40,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py index f070d061c712..d205738d4926 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py @@ -50,7 +50,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +129,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +203,7 @@ def build_list_by_applications_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-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py index f9f4aec662fd..95148f494c37 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionGetUpgrade_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationActionGetUpgrade_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py index e286117ed31e..90251e3210cc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionResumeUpgrade_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationActionResumeUpgrade_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py index 62a1d53fcb52..3895a3964134 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionStartRollback_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationActionStartRollback_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py index 2ba707b0c71c..afbac5ebb338 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py index 9483153980f5..9e5288950026 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py index 9115c49aad42..ec15a519830f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py index 15abd2f3e240..779635556121 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py index 78183759b461..c38aa5d54b10 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py index 6d9fa5c725a4..9ccd40f4afab 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py index 8692a47001f1..c84fc1230009 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeNameDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py index d1c95625d91f..6496d7c86984 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeNameGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py index 506082e04653..b481a6c3be8d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeNameListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py index 26ddff61b224..6c4ad62af6a5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNamePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeNamePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py index f317bbaf922e..38f03dc129b0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNamePutOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeNamePutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py index 08bba12bed05..68ad1f90450a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeVersionDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py index fbe6c9d47699..b0ff830623ff 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeVersionGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py index d514455618a4..3be5e01bd9ee 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeVersionListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py index e5bb2bfe2cdf..abe11c538c91 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeVersionPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py index 840f2c8c367f..aa4f30796e26 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionPutOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ApplicationTypeVersionPutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py index c1fbae122771..30ba09bd7cdb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/DeleteNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/DeleteNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py index cc9e60e44dc0..6fafd12b294e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_result.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/Long_running_operation_result.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py index d63be16fbe00..007fb121220d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_status_failed.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/Long_running_operation_status_failed.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py index 409af10a80bc..74028d209c43 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_status_succeeded.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/Long_running_operation_status_succeeded.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py index c8702ac62610..e22e62e54f83 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedApplyMaintenanceWindowPost_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedApplyMaintenanceWindowPost_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py index fb1f79e4ec8b..d167c2966ac5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedAzResiliencyStatusGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/managedAzResiliencyStatusGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py index 31bd3a61731d..7723a961370f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py index 28cfdc3bc687..9de4f2cc6259 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py index 56f04b97bd82..abb5ca1f9c01 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterListByResourceGroupOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterListByResourceGroupOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py index 4b51875fa9ba..a0aa324aedb9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterListBySubscriptionOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterListBySubscriptionOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py index 795dfcbc1133..5e4036893c6c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py index d8fae1db94e9..a4a175e6c516 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py @@ -55,11 +55,13 @@ def main(): "ddosProtectionPlanId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/ddosProtectionPlans/myDDoSProtectionPlan", "dnsName": "myCluster", "enableAutoOSUpgrade": True, + "enableHttpGatewayExclusiveAuthMode": True, "enableIpv6": True, "fabricSettings": [ {"name": "ManagedIdentityTokenService", "parameters": [{"name": "IsEnabled", "value": "true"}]} ], "httpGatewayConnectionPort": 19080, + "httpGatewayTokenAuthConnectionPort": 19081, "ipTags": [{"ipTagType": "FirstPartyUsage", "tag": "SQL"}], "loadBalancingRules": [ { @@ -140,6 +142,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py index 87fde8d9b573..5a3eaf0f2d16 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py index bed3b8a07bd8..f2ffd8810c77 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionGetByEnvironment_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterVersionGetByEnvironment_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py index 5c17a9271bcf..9ac6d2e6e18f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterVersionGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py index fa8427c930ad..3b89aa0749a0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionListByEnvironment.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterVersionListByEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py index 29fa3a9ca679..780e5db69137 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionList_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedClusterVersionList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py index 8a735139954b..ada36ce92a03 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedMaintenanceWindowStatusGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ManagedMaintenanceWindowStatusGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py index b7533f0f2584..a726d1510fbd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedUnsupportedVMSizesGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/managedUnsupportedVMSizesGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py index 067c7430a690..8992ca8be4dd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedUnsupportedVMSizesList_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/managedUnsupportedVMSizesList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py index 914623c2e5ff..dd177152461e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypeDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py index 2051129e3803..835f35efb1d3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypeGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py index a1a85809f0b6..71752766b40b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypeListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py index a3d532f01413..8308a17174dc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePatchOperationAutoScale_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePatchOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py index 9200c7c84728..0742ee36d10c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py index bc7d6e378523..7d4fa1f4c06d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py @@ -85,6 +85,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationAutoScale_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py index 9caeb2bb579b..14fb748b8707 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationCustomImage_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationCustomImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py index 9335f6e84372..c348dda8ca05 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationCustomSharedGalleriesImage_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationCustomSharedGalleriesImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py index 4d6dd63fbe3d..9277811e5ade 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationDedicatedHost_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationDedicatedHost_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py index 59bd0c88e529..35c67424ea8a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py @@ -155,6 +155,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py index dfc956e23fb0..b527a7e0e2cd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py index d7abeec032cc..a2e29931aeba 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py @@ -64,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationStateless_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationStateless_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py index b91c29eae4d2..7ac8e72b02f4 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationVmImagePlan_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypePutOperationVmImagePlan_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py index 81a1acfa3c35..c7dd23745736 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeSkusListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/NodeTypeSkusListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py index 91d10ffe368e..7e10932128c4 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Operations_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/Operations_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py index 5d3fbc8e90b3..ce404352b9bb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ReimageNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ReimageNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py index 56d3125d6426..982c04d7f9fd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ReimageNodes_UD_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ReimageNodes_UD_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py index 4294c06c878e..208ab5cc3c64 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/RestartNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/RestartNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py index 98ed42e3756f..b2ac73b7d66d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServiceDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py index 9c7d1e18f3d6..47a00bc15610 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServiceGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py index 283bfc443950..fd2c23962daf 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServiceListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py index d5b47a6c998b..423b2565f71f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServicePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py index 816edcde0e52..3ff65168cee2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServicePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py index e2d534404918..5527510a6fa3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-12-01-preview/examples/ServicePutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json b/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json index 12617e3354f6..35a2dafc4ae9 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json @@ -1,11 +1,11 @@ { - "commit": "11bbc2b1df2e915a2227a6a1a48a27b9e67c3311", + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/servicenetworking/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/servicenetworking/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicenetworking/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/storageactions/azure-mgmt-storageactions/CHANGELOG.md b/sdk/storageactions/azure-mgmt-storageactions/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/storageactions/azure-mgmt-storageactions/LICENSE b/sdk/storageactions/azure-mgmt-storageactions/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/storageactions/azure-mgmt-storageactions/MANIFEST.in b/sdk/storageactions/azure-mgmt-storageactions/MANIFEST.in new file mode 100644 index 000000000000..a21d126244c4 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/storageactions/py.typed diff --git a/sdk/storageactions/azure-mgmt-storageactions/README.md b/sdk/storageactions/azure-mgmt-storageactions/README.md new file mode 100644 index 000000000000..c8a8638fde32 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-storageactions +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.storageactions import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/storageactions/azure-mgmt-storageactions/_meta.json b/sdk/storageactions/azure-mgmt-storageactions/_meta.json new file mode 100644 index 000000000000..6e1e05fb2406 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/storageactions/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/storageactions/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/__init__.py new file mode 100644 index 000000000000..cd7eb6ea163b --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._storage_actions_mgmt_client import StorageActionsMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "StorageActionsMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py new file mode 100644 index 000000000000..4644a32ff39f --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for StorageActionsMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-01-01". 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(StorageActionsMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-01-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-storageactions/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_patch.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py new file mode 100644 index 000000000000..ba3a846b360b --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import StorageActionsMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + Operations, + StorageTaskAssignmentOperations, + StorageTasksOperations, + StorageTasksReportOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class StorageActionsMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """The Azure Storage Actions Management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.storageactions.operations.Operations + :ivar storage_tasks: StorageTasksOperations operations + :vartype storage_tasks: azure.mgmt.storageactions.operations.StorageTasksOperations + :ivar storage_task_assignment: StorageTaskAssignmentOperations operations + :vartype storage_task_assignment: + azure.mgmt.storageactions.operations.StorageTaskAssignmentOperations + :ivar storage_tasks_report: StorageTasksReportOperations operations + :vartype storage_tasks_report: + azure.mgmt.storageactions.operations.StorageTasksReportOperations + :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. The value must be an UUID. 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-01-01". 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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageActionsMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.storage_tasks = StorageTasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_task_assignment = StorageTaskAssignmentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.storage_tasks_report = StorageTasksReportOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "StorageActionsMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_vendor.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_version.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/__init__.py new file mode 100644 index 000000000000..b1357fdfc85d --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._storage_actions_mgmt_client import StorageActionsMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "StorageActionsMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py new file mode 100644 index 000000000000..b6a5110cb1ed --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for StorageActionsMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-01-01". 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(StorageActionsMgmtClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-01-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-storageactions/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_patch.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py new file mode 100644 index 000000000000..e4da11ca2ec9 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import StorageActionsMgmtClientConfiguration +from .operations import ( + Operations, + StorageTaskAssignmentOperations, + StorageTasksOperations, + StorageTasksReportOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class StorageActionsMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """The Azure Storage Actions Management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.storageactions.aio.operations.Operations + :ivar storage_tasks: StorageTasksOperations operations + :vartype storage_tasks: azure.mgmt.storageactions.aio.operations.StorageTasksOperations + :ivar storage_task_assignment: StorageTaskAssignmentOperations operations + :vartype storage_task_assignment: + azure.mgmt.storageactions.aio.operations.StorageTaskAssignmentOperations + :ivar storage_tasks_report: StorageTasksReportOperations operations + :vartype storage_tasks_report: + azure.mgmt.storageactions.aio.operations.StorageTasksReportOperations + :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. The value must be an UUID. 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-01-01". 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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = StorageActionsMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.storage_tasks = StorageTasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.storage_task_assignment = StorageTaskAssignmentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.storage_tasks_report = StorageTasksReportOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "StorageActionsMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/__init__.py new file mode 100644 index 000000000000..3bcc0a8fa328 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._storage_tasks_operations import StorageTasksOperations +from ._storage_task_assignment_operations import StorageTaskAssignmentOperations +from ._storage_tasks_report_operations import StorageTasksReportOperations + +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", + "StorageTasksOperations", + "StorageTaskAssignmentOperations", + "StorageTasksReportOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py new file mode 100644 index 000000000000..221d10c050f4 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.aio.StorageActionsMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all of the available Storage Actions 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 Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.StorageActions/operations"} diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_patch.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py new file mode 100644 index 000000000000..4786ed2610a5 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_task_assignment_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StorageTaskAssignmentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.aio.StorageActionsMgmtClient`'s + :attr:`storage_task_assignment` 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, storage_task_name: str, maxpagesize: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.StorageTaskAssignment"]: + """Lists all the storage tasks available under the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be + included in the list response. Default value is None. + :type maxpagesize: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTaskAssignment or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTaskAssignment] + :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.StorageTaskAssignmentsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTaskAssignmentsListResult", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py new file mode 100644 index 000000000000..1400e7e209ec --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py @@ -0,0 +1,1034 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_tasks_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_preview_actions_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StorageTasksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.aio.StorageActionsMgmtClient`'s + :attr:`storage_tasks` 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 _create_initial( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTask, IO], + **kwargs: Any + ) -> Optional[_models.StorageTask]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTask]] = 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, "StorageTask") + + request = build_create_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("StorageTask", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StorageTask", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: _models.StorageTask, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask + :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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. 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 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTask, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. Is either a StorageTask type or a + IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTask] = 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, + storage_task_name=storage_task_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageTask", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_task_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, + storage_task_name=storage_task_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, storage_task_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the storage task resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_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, + storage_task_name=storage_task_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> _models.StorageTask: + """Get the storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTask or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTask + :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.StorageTask] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_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 = 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("StorageTask", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + async def _update_initial( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTaskUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.StorageTask]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTask]] = 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, "StorageTaskUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("StorageTask", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: _models.StorageTaskUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters + :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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. 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 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTaskUpdateParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. Is either a + StorageTaskUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTask] = 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, + storage_task_name=storage_task_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageTask", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StorageTask"]: + """Lists all the storage tasks available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTask or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTasksListResult] = 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, + 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("StorageTasksListResult", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.StorageTask"]: + """Lists all the storage tasks available under the given resource group. + + :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 StorageTask or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTasksListResult] = 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, + 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("StorageTasksListResult", 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.StorageActions/storageTasks" + } + + @overload + async def preview_actions( + self, + location: str, + parameters: _models.StorageTaskPreviewAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :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: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def preview_actions( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def preview_actions( + self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO], **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Is either a + StorageTaskPreviewAction type or a IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTaskPreviewAction] = 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, "StorageTaskPreviewAction") + + request = build_preview_actions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.preview_actions.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("StorageTaskPreviewAction", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + preview_actions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py new file mode 100644 index 000000000000..9314ac871220 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storage_tasks_report_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StorageTasksReportOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.aio.StorageActionsMgmtClient`'s + :attr:`storage_tasks_report` 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, + storage_task_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.StorageTaskReportInstance"]: + """Fetch the storage tasks run report summary for each assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be + included in the list response. Default value is None. + :type maxpagesize: str + :param filter: Optional. When specified, it can be used to query using reporting properties. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTaskReportInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTaskReportInstance] + :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.StorageTaskReportSummary] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTaskReportSummary", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/__init__.py new file mode 100644 index 000000000000..03ece32a27de --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/__init__.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import ElseCondition +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import IfCondition +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import StorageTask +from ._models_py3 import StorageTaskAction +from ._models_py3 import StorageTaskAssignment +from ._models_py3 import StorageTaskAssignmentsListResult +from ._models_py3 import StorageTaskOperation +from ._models_py3 import StorageTaskPreviewAction +from ._models_py3 import StorageTaskPreviewActionCondition +from ._models_py3 import StorageTaskPreviewActionIfCondition +from ._models_py3 import StorageTaskPreviewActionProperties +from ._models_py3 import StorageTaskPreviewBlobProperties +from ._models_py3 import StorageTaskPreviewContainerProperties +from ._models_py3 import StorageTaskPreviewKeyValueProperties +from ._models_py3 import StorageTaskProperties +from ._models_py3 import StorageTaskReportInstance +from ._models_py3 import StorageTaskReportProperties +from ._models_py3 import StorageTaskReportSummary +from ._models_py3 import StorageTaskUpdateParameters +from ._models_py3 import StorageTasksListResult +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity + +from ._storage_actions_mgmt_client_enums import ActionType +from ._storage_actions_mgmt_client_enums import CreatedByType +from ._storage_actions_mgmt_client_enums import ManagedServiceIdentityType +from ._storage_actions_mgmt_client_enums import MatchedBlockName +from ._storage_actions_mgmt_client_enums import Origin +from ._storage_actions_mgmt_client_enums import ProvisioningState +from ._storage_actions_mgmt_client_enums import RunResult +from ._storage_actions_mgmt_client_enums import RunStatusEnum +from ._storage_actions_mgmt_client_enums import StorageTaskOperationName +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ElseCondition", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "IfCondition", + "ManagedServiceIdentity", + "Operation", + "OperationDisplay", + "OperationListResult", + "ProxyResource", + "Resource", + "StorageTask", + "StorageTaskAction", + "StorageTaskAssignment", + "StorageTaskAssignmentsListResult", + "StorageTaskOperation", + "StorageTaskPreviewAction", + "StorageTaskPreviewActionCondition", + "StorageTaskPreviewActionIfCondition", + "StorageTaskPreviewActionProperties", + "StorageTaskPreviewBlobProperties", + "StorageTaskPreviewContainerProperties", + "StorageTaskPreviewKeyValueProperties", + "StorageTaskProperties", + "StorageTaskReportInstance", + "StorageTaskReportProperties", + "StorageTaskReportSummary", + "StorageTaskUpdateParameters", + "StorageTasksListResult", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "ActionType", + "CreatedByType", + "ManagedServiceIdentityType", + "MatchedBlockName", + "Origin", + "ProvisioningState", + "RunResult", + "RunStatusEnum", + "StorageTaskOperationName", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py new file mode 100644 index 000000000000..cdb153e331aa --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py @@ -0,0 +1,1395 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class ElseCondition(_serialization.Model): + """The else block of storage task operation. + + All required parameters must be populated in order to send to Azure. + + :ivar operations: List of operations to execute in the else block. Required. + :vartype operations: list[~azure.mgmt.storageactions.models.StorageTaskOperation] + """ + + _validation = { + "operations": {"required": True}, + } + + _attribute_map = { + "operations": {"key": "operations", "type": "[StorageTaskOperation]"}, + } + + def __init__(self, *, operations: List["_models.StorageTaskOperation"], **kwargs: Any) -> None: + """ + :keyword operations: List of operations to execute in the else block. Required. + :paramtype operations: list[~azure.mgmt.storageactions.models.StorageTaskOperation] + """ + super().__init__(**kwargs) + self.operations = operations + + +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.storageactions.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.storageactions.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.storageactions.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.storageactions.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class IfCondition(_serialization.Model): + """The if block of storage task operation. + + All required parameters must be populated in order to send to Azure. + + :ivar condition: The condition predicate which is composed of object properties, eg: blob and + container properties. Required. + :vartype condition: str + :ivar operations: List of operations to execute when the condition predicate satisfies. + Required. + :vartype operations: list[~azure.mgmt.storageactions.models.StorageTaskOperation] + """ + + _validation = { + "condition": {"required": True}, + "operations": {"required": True}, + } + + _attribute_map = { + "condition": {"key": "condition", "type": "str"}, + "operations": {"key": "operations", "type": "[StorageTaskOperation]"}, + } + + def __init__(self, *, condition: str, operations: List["_models.StorageTaskOperation"], **kwargs: Any) -> None: + """ + :keyword condition: The condition predicate which is composed of object properties, eg: blob + and container properties. Required. + :paramtype condition: str + :keyword operations: List of operations to execute when the condition predicate satisfies. + Required. + :paramtype operations: list[~azure.mgmt.storageactions.models.StorageTaskOperation] + """ + super().__init__(**kwargs) + self.condition = condition + self.operations = operations + + +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 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". + :vartype type: str or ~azure.mgmt.storageactions.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.storageactions.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.storageactions.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.storageactions.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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 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.storageactions.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.storageactions.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.storageactions.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.storageactions.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.storageactions.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.storageactions.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.storageactions.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + 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. E.g. + "/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.storageactions.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class StorageTask(TrackedResource): + """Represents Storage Task. + + 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. E.g. + "/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.storageactions.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: The managed service identity of the resource. + :vartype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity + :ivar properties: Properties of the storage task. + :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "StorageTaskProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.StorageTaskProperties"] = 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: The managed service identity of the resource. + :paramtype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity + :keyword properties: Properties of the storage task. + :paramtype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.properties = properties + + +class StorageTaskAction(_serialization.Model): + """The storage task action represents conditional statements and operations to be performed on + target objects. + + All required parameters must be populated in order to send to Azure. + + :ivar if_property: The if block of storage task operation. Required. + :vartype if_property: ~azure.mgmt.storageactions.models.IfCondition + :ivar else_property: The else block of storage task operation. + :vartype else_property: ~azure.mgmt.storageactions.models.ElseCondition + """ + + _validation = { + "if_property": {"required": True}, + } + + _attribute_map = { + "if_property": {"key": "if", "type": "IfCondition"}, + "else_property": {"key": "else", "type": "ElseCondition"}, + } + + def __init__( + self, + *, + if_property: "_models.IfCondition", + else_property: Optional["_models.ElseCondition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword if_property: The if block of storage task operation. Required. + :paramtype if_property: ~azure.mgmt.storageactions.models.IfCondition + :keyword else_property: The else block of storage task operation. + :paramtype else_property: ~azure.mgmt.storageactions.models.ElseCondition + """ + super().__init__(**kwargs) + self.if_property = if_property + self.else_property = else_property + + +class StorageTaskAssignment(_serialization.Model): + """Fetch the Storage task assignment ARM ids. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ARM Id of the storage task assignments, associated with the storage tasks. + :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 StorageTaskAssignmentsListResult(_serialization.Model): + """The response from the List Storage Tasks operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets the list of storage task assignment Ids. + :vartype value: list[~azure.mgmt.storageactions.models.StorageTaskAssignment] + :ivar next_link: Request URL that can be used to query next page of storage task assignment + Ids. Returned when total number of requested storage task assignment Ids exceed maximum page + size. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[StorageTaskAssignment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageTaskOperation(_serialization.Model): + """Represents an operation to be performed on the object. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The operation to be performed on the object. Required. Known values are: + "SetBlobTier", "SetBlobTags", "SetBlobImmutabilityPolicy", "SetBlobLegalHold", "SetBlobExpiry", + "DeleteBlob", and "UndeleteBlob". + :vartype name: str or ~azure.mgmt.storageactions.models.StorageTaskOperationName + :ivar parameters: Key-value parameters for the operation. + :vartype parameters: dict[str, str] + :ivar on_success: Action to be taken when the operation is successful for a object. Default + value is "continue". + :vartype on_success: str + :ivar on_failure: Action to be taken when the operation fails for a object. Default value is + "break". + :vartype on_failure: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "{str}"}, + "on_success": {"key": "onSuccess", "type": "str"}, + "on_failure": {"key": "onFailure", "type": "str"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.StorageTaskOperationName"], + parameters: Optional[Dict[str, str]] = None, + on_success: Optional[Literal["continue"]] = None, + on_failure: Optional[Literal["break"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The operation to be performed on the object. Required. Known values are: + "SetBlobTier", "SetBlobTags", "SetBlobImmutabilityPolicy", "SetBlobLegalHold", "SetBlobExpiry", + "DeleteBlob", and "UndeleteBlob". + :paramtype name: str or ~azure.mgmt.storageactions.models.StorageTaskOperationName + :keyword parameters: Key-value parameters for the operation. + :paramtype parameters: dict[str, str] + :keyword on_success: Action to be taken when the operation is successful for a object. Default + value is "continue". + :paramtype on_success: str + :keyword on_failure: Action to be taken when the operation fails for a object. Default value is + "break". + :paramtype on_failure: str + """ + super().__init__(**kwargs) + self.name = name + self.parameters = parameters + self.on_success = on_success + self.on_failure = on_failure + + +class StorageTaskPreviewAction(_serialization.Model): + """Storage Task Preview Action. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Properties of the storage task preview. Required. + :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionProperties + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "StorageTaskPreviewActionProperties"}, + } + + def __init__(self, *, properties: "_models.StorageTaskPreviewActionProperties", **kwargs: Any) -> None: + """ + :keyword properties: Properties of the storage task preview. Required. + :paramtype properties: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class StorageTaskPreviewActionCondition(_serialization.Model): + """Represents the storage task conditions to be tested for a match with container and blob + properties. + + All required parameters must be populated in order to send to Azure. + + :ivar if_property: The condition to be tested for a match with container and blob properties. + Required. + :vartype if_property: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionIfCondition + :ivar else_block_exists: Specify whether the else block is present in the condition. Required. + :vartype else_block_exists: bool + """ + + _validation = { + "if_property": {"required": True}, + "else_block_exists": {"required": True}, + } + + _attribute_map = { + "if_property": {"key": "if", "type": "StorageTaskPreviewActionIfCondition"}, + "else_block_exists": {"key": "elseBlockExists", "type": "bool"}, + } + + def __init__( + self, *, if_property: "_models.StorageTaskPreviewActionIfCondition", else_block_exists: bool, **kwargs: Any + ) -> None: + """ + :keyword if_property: The condition to be tested for a match with container and blob + properties. Required. + :paramtype if_property: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionIfCondition + :keyword else_block_exists: Specify whether the else block is present in the condition. + Required. + :paramtype else_block_exists: bool + """ + super().__init__(**kwargs) + self.if_property = if_property + self.else_block_exists = else_block_exists + + +class StorageTaskPreviewActionIfCondition(_serialization.Model): + """Represents storage task preview action condition. + + :ivar condition: Storage task condition to bes tested for a match. + :vartype condition: str + """ + + _attribute_map = { + "condition": {"key": "condition", "type": "str"}, + } + + def __init__(self, *, condition: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword condition: Storage task condition to bes tested for a match. + :paramtype condition: str + """ + super().__init__(**kwargs) + self.condition = condition + + +class StorageTaskPreviewActionProperties(_serialization.Model): + """Storage task preview action properties. + + All required parameters must be populated in order to send to Azure. + + :ivar container: Preview action container properties to be tested for a match with the provided + condition. Required. + :vartype container: ~azure.mgmt.storageactions.models.StorageTaskPreviewContainerProperties + :ivar blobs: Preview action container properties to be tested for a match with the provided + condition. Required. + :vartype blobs: list[~azure.mgmt.storageactions.models.StorageTaskPreviewBlobProperties] + :ivar action: Preview action container properties to be tested for a match with the provided + condition. Required. + :vartype action: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionCondition + """ + + _validation = { + "container": {"required": True}, + "blobs": {"required": True}, + "action": {"required": True}, + } + + _attribute_map = { + "container": {"key": "container", "type": "StorageTaskPreviewContainerProperties"}, + "blobs": {"key": "blobs", "type": "[StorageTaskPreviewBlobProperties]"}, + "action": {"key": "action", "type": "StorageTaskPreviewActionCondition"}, + } + + def __init__( + self, + *, + container: "_models.StorageTaskPreviewContainerProperties", + blobs: List["_models.StorageTaskPreviewBlobProperties"], + action: "_models.StorageTaskPreviewActionCondition", + **kwargs: Any + ) -> None: + """ + :keyword container: Preview action container properties to be tested for a match with the + provided condition. Required. + :paramtype container: ~azure.mgmt.storageactions.models.StorageTaskPreviewContainerProperties + :keyword blobs: Preview action container properties to be tested for a match with the provided + condition. Required. + :paramtype blobs: list[~azure.mgmt.storageactions.models.StorageTaskPreviewBlobProperties] + :keyword action: Preview action container properties to be tested for a match with the provided + condition. Required. + :paramtype action: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionCondition + """ + super().__init__(**kwargs) + self.container = container + self.blobs = blobs + self.action = action + + +class StorageTaskPreviewBlobProperties(_serialization.Model): + """Storage task preview container properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: property for the container name. + :vartype name: str + :ivar properties: properties key value pairs to be tested for a match against the provided + condition. + :vartype properties: + list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + :ivar metadata: metadata key value pairs to be tested for a match against the provided + condition. + :vartype metadata: list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + :ivar tags: tags key value pairs to be tested for a match against the provided condition. + :vartype tags: list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + :ivar matched_block: Represents the condition block name that matched blob properties. Known + values are: "If", "Else", "None", "If", and "Else". + :vartype matched_block: str or ~azure.mgmt.storageactions.models.MatchedBlockName + """ + + _validation = { + "matched_block": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "[StorageTaskPreviewKeyValueProperties]"}, + "metadata": {"key": "metadata", "type": "[StorageTaskPreviewKeyValueProperties]"}, + "tags": {"key": "tags", "type": "[StorageTaskPreviewKeyValueProperties]"}, + "matched_block": {"key": "matchedBlock", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional[List["_models.StorageTaskPreviewKeyValueProperties"]] = None, + metadata: Optional[List["_models.StorageTaskPreviewKeyValueProperties"]] = None, + tags: Optional[List["_models.StorageTaskPreviewKeyValueProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: property for the container name. + :paramtype name: str + :keyword properties: properties key value pairs to be tested for a match against the provided + condition. + :paramtype properties: + list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + :keyword metadata: metadata key value pairs to be tested for a match against the provided + condition. + :paramtype metadata: + list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + :keyword tags: tags key value pairs to be tested for a match against the provided condition. + :paramtype tags: list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + self.metadata = metadata + self.tags = tags + self.matched_block = None + + +class StorageTaskPreviewContainerProperties(_serialization.Model): + """Storage task preview container properties. + + :ivar name: property for the container name. + :vartype name: str + :ivar metadata: metadata key value pairs to be tested for a match against the provided + condition. + :vartype metadata: list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "metadata": {"key": "metadata", "type": "[StorageTaskPreviewKeyValueProperties]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + metadata: Optional[List["_models.StorageTaskPreviewKeyValueProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: property for the container name. + :paramtype name: str + :keyword metadata: metadata key value pairs to be tested for a match against the provided + condition. + :paramtype metadata: + list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] + """ + super().__init__(**kwargs) + self.name = name + self.metadata = metadata + + +class StorageTaskPreviewKeyValueProperties(_serialization.Model): + """Storage task preview object key value pair properties. + + :ivar key: Represents the key property of the pair. + :vartype key: str + :ivar value: Represents the value property of the pair. + :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: Represents the key property of the pair. + :paramtype key: str + :keyword value: Represents the value property of the pair. + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + +class StorageTaskProperties(_serialization.Model): + """Properties of the storage task. + + 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 task_version: Storage task version. + :vartype task_version: int + :ivar enabled: Storage Task is enabled when set to true and disabled when set to false. + Required. + :vartype enabled: bool + :ivar description: Text that describes the purpose of the storage task. Required. + :vartype description: str + :ivar action: The storage task action that is executed. Required. + :vartype action: ~azure.mgmt.storageactions.models.StorageTaskAction + :ivar provisioning_state: Represents the provisioning state of the storage task. Known values + are: "ValidateSubscriptionQuotaBegin", "ValidateSubscriptionQuotaEnd", "Creating", "Succeeded", + "Deleting", "Canceled", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.storageactions.models.ProvisioningState + :ivar creation_time_in_utc: The creation date and time of the storage task in UTC. + :vartype creation_time_in_utc: ~datetime.datetime + """ + + _validation = { + "task_version": {"readonly": True, "maximum": 1, "minimum": 1}, + "enabled": {"required": True}, + "description": {"required": True}, + "action": {"required": True}, + "provisioning_state": {"readonly": True}, + "creation_time_in_utc": {"readonly": True}, + } + + _attribute_map = { + "task_version": {"key": "taskVersion", "type": "int"}, + "enabled": {"key": "enabled", "type": "bool"}, + "description": {"key": "description", "type": "str"}, + "action": {"key": "action", "type": "StorageTaskAction"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "creation_time_in_utc": {"key": "creationTimeInUtc", "type": "iso-8601"}, + } + + def __init__(self, *, enabled: bool, description: str, action: "_models.StorageTaskAction", **kwargs: Any) -> None: + """ + :keyword enabled: Storage Task is enabled when set to true and disabled when set to false. + Required. + :paramtype enabled: bool + :keyword description: Text that describes the purpose of the storage task. Required. + :paramtype description: str + :keyword action: The storage task action that is executed. Required. + :paramtype action: ~azure.mgmt.storageactions.models.StorageTaskAction + """ + super().__init__(**kwargs) + self.task_version = None + self.enabled = enabled + self.description = description + self.action = action + self.provisioning_state = None + self.creation_time_in_utc = None + + +class StorageTaskReportInstance(ProxyResource): + """Storage Tasks run report instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.storageactions.models.SystemData + :ivar properties: Storage task execution report for a run instance. + :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskReportProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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": "StorageTaskReportProperties"}, + } + + def __init__(self, *, properties: Optional["_models.StorageTaskReportProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Storage task execution report for a run instance. + :paramtype properties: ~azure.mgmt.storageactions.models.StorageTaskReportProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class StorageTaskReportProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Storage task execution report for a run instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar task_assignment_id: Represents the Storage Task Assignment Id associated with the storage + task that provided an execution context. + :vartype task_assignment_id: str + :ivar storage_account_id: Represents the Storage Account Id where the storage task definition + was applied and executed. + :vartype storage_account_id: str + :ivar start_time: Start time of the run instance. Filter options such as startTime gt + '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for + DateTime properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype start_time: str + :ivar finish_time: End time of the run instance. Filter options such as startTime gt + '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for + DateTime properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype finish_time: str + :ivar objects_targeted_count: Total number of objects that meet the condition as defined in the + storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 + and other comparison operators can be used as described for Numerical properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype objects_targeted_count: str + :ivar objects_operated_on_count: Total number of objects that meet the storage tasks condition + and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other + comparison operators can be used as described for Numerical properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype objects_operated_on_count: str + :ivar object_failed_count: Total number of objects where task operation failed when was + attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be + used as described for Numerical properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype object_failed_count: str + :ivar objects_succeeded_count: Total number of objects where task operation succeeded when was + attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators + can be used as described for Numerical properties in + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + :vartype objects_succeeded_count: str + :ivar run_status_error: Well known Azure Storage error code that represents the error + encountered during execution of the run instance. + :vartype run_status_error: str + :ivar run_status_enum: Represents the status of the execution. Known values are: "InProgress" + and "Finished". + :vartype run_status_enum: str or ~azure.mgmt.storageactions.models.RunStatusEnum + :ivar summary_report_path: Full path to the verbose report stored in the reporting container as + specified in the assignment execution context for the storage account. + :vartype summary_report_path: str + :ivar task_id: Storage Task Arm Id. + :vartype task_id: str + :ivar task_version: Storage Task Version. + :vartype task_version: str + :ivar run_result: Represents the overall result of the execution for the run instance. Known + values are: "Succeeded" and "Failed". + :vartype run_result: str or ~azure.mgmt.storageactions.models.RunResult + """ + + _validation = { + "task_assignment_id": {"readonly": True}, + "storage_account_id": {"readonly": True}, + "start_time": {"readonly": True}, + "finish_time": {"readonly": True}, + "objects_targeted_count": {"readonly": True}, + "objects_operated_on_count": {"readonly": True}, + "object_failed_count": {"readonly": True}, + "objects_succeeded_count": {"readonly": True}, + "run_status_error": {"readonly": True}, + "run_status_enum": {"readonly": True}, + "summary_report_path": {"readonly": True}, + "task_id": {"readonly": True}, + "task_version": {"readonly": True}, + "run_result": {"readonly": True}, + } + + _attribute_map = { + "task_assignment_id": {"key": "taskAssignmentId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "finish_time": {"key": "finishTime", "type": "str"}, + "objects_targeted_count": {"key": "objectsTargetedCount", "type": "str"}, + "objects_operated_on_count": {"key": "objectsOperatedOnCount", "type": "str"}, + "object_failed_count": {"key": "objectFailedCount", "type": "str"}, + "objects_succeeded_count": {"key": "objectsSucceededCount", "type": "str"}, + "run_status_error": {"key": "runStatusError", "type": "str"}, + "run_status_enum": {"key": "runStatusEnum", "type": "str"}, + "summary_report_path": {"key": "summaryReportPath", "type": "str"}, + "task_id": {"key": "taskId", "type": "str"}, + "task_version": {"key": "taskVersion", "type": "str"}, + "run_result": {"key": "runResult", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.task_assignment_id = None + self.storage_account_id = None + self.start_time = None + self.finish_time = None + self.objects_targeted_count = None + self.objects_operated_on_count = None + self.object_failed_count = None + self.objects_succeeded_count = None + self.run_status_error = None + self.run_status_enum = None + self.summary_report_path = None + self.task_id = None + self.task_version = None + self.run_result = None + + +class StorageTaskReportSummary(_serialization.Model): + """Fetch Storage Tasks Run Summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets storage tasks run result summary. + :vartype value: list[~azure.mgmt.storageactions.models.StorageTaskReportInstance] + :ivar next_link: Request URL that can be used to query next page of storage task run results + summary. Returned when the number of run instances and summary reports exceed maximum page + size. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[StorageTaskReportInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageTasksListResult(_serialization.Model): + """The response from the List Storage Tasks operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Gets the list of storage tasks and their properties. + :vartype value: list[~azure.mgmt.storageactions.models.StorageTask] + :ivar next_link: Request URL that can be used to query next page of storage tasks. Returned + when total number of requested storage tasks exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[StorageTask]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class StorageTaskUpdateParameters(_serialization.Model): + """Parameters of the storage task update request. + + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity + :ivar tags: Gets or sets a list of key value pairs that describe the resource. These tags can + be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags + can be provided for a resource. Each tag must have a key no greater in length than 128 + characters and a value no greater in length than 256 characters. + :vartype tags: dict[str, str] + :ivar properties: Properties of the storage task. + :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "StorageTaskProperties"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.StorageTaskProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity + :keyword tags: Gets or sets a list of key value pairs that describe the resource. These tags + can be used in viewing and grouping this resource (across resource groups). A maximum of 15 + tags can be provided for a resource. Each tag must have a key no greater in length than 128 + characters and a value no greater in length than 256 characters. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the storage task. + :paramtype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + self.properties = properties + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.storageactions.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.storageactions.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.storageactions.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.storageactions.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_patch.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py new file mode 100644 index 000000000000..cd74f9195a91 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.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. +# -------------------------------------------------------------------------- + +from enum import Enum +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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class MatchedBlockName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the condition block name that matched blob properties.""" + + IF = "If" + ELSE = "Else" + NONE = "None" + IF_ENUM = "If" + ELSE_ENUM = "Else" + + +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 ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the provisioning state of the storage task.""" + + VALIDATE_SUBSCRIPTION_QUOTA_BEGIN = "ValidateSubscriptionQuotaBegin" + VALIDATE_SUBSCRIPTION_QUOTA_END = "ValidateSubscriptionQuotaEnd" + CREATING = "Creating" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + CANCELED = "Canceled" + FAILED = "Failed" + + +class RunResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the overall result of the execution for the run instance.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class RunStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the status of the execution.""" + + IN_PROGRESS = "InProgress" + FINISHED = "Finished" + + +class StorageTaskOperationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operation to be performed on the object.""" + + SET_BLOB_TIER = "SetBlobTier" + SET_BLOB_TAGS = "SetBlobTags" + SET_BLOB_IMMUTABILITY_POLICY = "SetBlobImmutabilityPolicy" + SET_BLOB_LEGAL_HOLD = "SetBlobLegalHold" + SET_BLOB_EXPIRY = "SetBlobExpiry" + DELETE_BLOB = "DeleteBlob" + UNDELETE_BLOB = "UndeleteBlob" diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/__init__.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/__init__.py new file mode 100644 index 000000000000..3bcc0a8fa328 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._operations import Operations +from ._storage_tasks_operations import StorageTasksOperations +from ._storage_task_assignment_operations import StorageTaskAssignmentOperations +from ._storage_tasks_report_operations import StorageTasksReportOperations + +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", + "StorageTasksOperations", + "StorageTaskAssignmentOperations", + "StorageTasksReportOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py new file mode 100644 index 000000000000..0ac8f8eb0f21 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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(**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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.StorageActions/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.StorageActionsMgmtClient`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all of the available Storage Actions 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 Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.StorageActions/operations"} diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_patch.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py new file mode 100644 index 000000000000..89d7b73e2162 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py @@ -0,0 +1,197 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + storage_task_name: str, + subscription_id: str, + *, + maxpagesize: 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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "str") + _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 StorageTaskAssignmentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.StorageActionsMgmtClient`'s + :attr:`storage_task_assignment` 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, storage_task_name: str, maxpagesize: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.StorageTaskAssignment"]: + """Lists all the storage tasks available under the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be + included in the list response. Default value is None. + :type maxpagesize: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTaskAssignment or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTaskAssignment] + :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.StorageTaskAssignmentsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTaskAssignmentsListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py new file mode 100644 index 000000000000..e1c5bb318d6e --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py @@ -0,0 +1,1257 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, storage_task_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-01-01")) + 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.StorageActions/storageTasks/{storageTaskName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_delete_request( + resource_group_name: str, storage_task_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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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, storage_task_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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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, storage_task_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-01-01")) + 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.StorageActions/storageTasks/{storageTaskName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_subscription_request(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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_list_by_resource_group_request(resource_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", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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_preview_actions_request(location: 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-01-01")) + 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}/providers/Microsoft.StorageActions/locations/{location}/previewActions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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 StorageTasksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.StorageActionsMgmtClient`'s + :attr:`storage_tasks` 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 _create_initial( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTask, IO], + **kwargs: Any + ) -> Optional[_models.StorageTask]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTask]] = 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, "StorageTask") + + request = build_create_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("StorageTask", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StorageTask", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: _models.StorageTask, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask + :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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTask, IO], + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Asynchronously creates a new storage task resource with the specified parameters. If a storage + task is already created and a subsequent create request is issued with different properties, + the storage task properties will be updated. If a storage task is already created and a + subsequent create or update request is issued with the exact same set of properties, the + request will succeed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to create a Storage Task. Is either a StorageTask type or a + IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTask] = 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, + storage_task_name=storage_task_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageTask", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_task_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, + storage_task_name=storage_task_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete the storage task resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace + def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> _models.StorageTask: + """Get the storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTask or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTask + :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.StorageTask] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_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("StorageTask", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + def _update_initial( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTaskUpdateParameters, IO], + **kwargs: Any + ) -> Optional[_models.StorageTask]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTask]] = 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, "StorageTaskUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("StorageTask", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: _models.StorageTaskUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters + :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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_task_name: str, + parameters: Union[_models.StorageTaskUpdateParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.StorageTask]: + """Update storage task properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param parameters: The parameters to provide to update the storage task resource. Is either a + StorageTaskUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters 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 StorageTask or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTask] = 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, + storage_task_name=storage_task_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) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageTask", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.StorageTask"]: + """Lists all the storage tasks available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTask or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTasksListResult] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTasksListResult", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.StorageTask"]: + """Lists all the storage tasks available under the given resource group. + + :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 StorageTask or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTask] + :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.StorageTasksListResult] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTasksListResult", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks" + } + + @overload + def preview_actions( + self, + location: str, + parameters: _models.StorageTaskPreviewAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :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: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def preview_actions( + self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def preview_actions( + self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO], **kwargs: Any + ) -> _models.StorageTaskPreviewAction: + """Runs the input conditions against input object metadata properties and designates matched + objects in response. + + :param location: The location to perform preview of the actions. Required. + :type location: str + :param parameters: The parameters to preview action condition. Is either a + StorageTaskPreviewAction type or a IO type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageTaskPreviewAction or the result of cls(response) + :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.StorageTaskPreviewAction] = 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, "StorageTaskPreviewAction") + + request = build_preview_actions_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.preview_actions.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("StorageTaskPreviewAction", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + preview_actions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py new file mode 100644 index 000000000000..6b6290a56f0d --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py @@ -0,0 +1,210 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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, + storage_task_name: str, + subscription_id: str, + *, + maxpagesize: Optional[str] = None, + filter: 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-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "storageTaskName": _SERIALIZER.url( + "storage_task_name", storage_task_name, "str", max_length=18, min_length=3, pattern=r"^[a-z0-9]{3,18}$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _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 StorageTasksReportOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storageactions.StorageActionsMgmtClient`'s + :attr:`storage_tasks_report` 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, + storage_task_name: str, + maxpagesize: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.StorageTaskReportInstance"]: + """Fetch the storage tasks run report summary for each assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_task_name: The name of the storage task within the specified resource group. + Storage task names must be between 3 and 18 characters in length and use numbers and lower-case + letters only. Required. + :type storage_task_name: str + :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be + included in the list response. Default value is None. + :type maxpagesize: str + :param filter: Optional. When specified, it can be used to query using reporting properties. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageTaskReportInstance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTaskReportInstance] + :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.StorageTaskReportSummary] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + storage_task_name=storage_task_name, + subscription_id=self._config.subscription_id, + maxpagesize=maxpagesize, + filter=filter, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageTaskReportSummary", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports" + } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/py.typed b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py new file mode 100644 index 000000000000..d306e73989fc --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python operations_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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py new file mode 100644 index 000000000000..0e2174026143 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python perform_storage_task_actions_preview.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.preview_actions( + location="eastus", + parameters={ + "properties": { + "action": {"elseBlockExists": True, "if": {"condition": "[[equals(AccessTier, 'Hot')]]"}}, + "blobs": [ + { + "metadata": [{"key": "mKey1", "value": "mValue1"}], + "name": "folder1/file1.txt", + "properties": [ + {"key": "Creation-Time", "value": "Wed, 07 Jun 2023 05:23:29 GMT"}, + {"key": "Last-Modified", "value": "Wed, 07 Jun 2023 05:23:29 GMT"}, + {"key": "Etag", "value": "0x8DB67175454D36D"}, + {"key": "Content-Length", "value": "38619"}, + {"key": "Content-Type", "value": "text/xml"}, + {"key": "Content-Encoding", "value": ""}, + {"key": "Content-Language", "value": ""}, + {"key": "Content-CRC64", "value": ""}, + {"key": "Content-MD5", "value": "njr6iDrmU9+FC89WMK22EA=="}, + {"key": "Cache-Control", "value": ""}, + {"key": "Content-Disposition", "value": ""}, + {"key": "BlobType", "value": "BlockBlob"}, + {"key": "AccessTier", "value": "Hot"}, + {"key": "AccessTierInferred", "value": "true"}, + {"key": "LeaseStatus", "value": "unlocked"}, + {"key": "LeaseState", "value": "available"}, + {"key": "ServerEncrypted", "value": "true"}, + {"key": "TagCount", "value": "1"}, + ], + "tags": [{"key": "tKey1", "value": "tValue1"}], + }, + { + "metadata": [{"key": "mKey2", "value": "mValue2"}], + "name": "folder2/file1.txt", + "properties": [ + {"key": "Creation-Time", "value": "Wed, 06 Jun 2023 05:23:29 GMT"}, + {"key": "Last-Modified", "value": "Wed, 06 Jun 2023 05:23:29 GMT"}, + {"key": "Etag", "value": "0x6FB67175454D36D"}, + ], + "tags": [{"key": "tKey2", "value": "tValue2"}], + }, + ], + "container": { + "metadata": [{"key": "mContainerKey1", "value": "mContainerValue1"}], + "name": "firstContainer", + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py new file mode 100644 index 000000000000..7901765c23de --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python delete_storage_task.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + client.storage_tasks.begin_delete( + resource_group_name="res4228", + storage_task_name="mytask1", + ).result() + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py new file mode 100644 index 000000000000..ce611430da4e --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python get_storage_task.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.get( + resource_group_name="res4228", + storage_task_name="mytask1", + ) + print(response) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py new file mode 100644 index 000000000000..65ebd43dab95 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python patch_storage_task.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.begin_update( + resource_group_name="res4228", + storage_task_name="mytask1", + parameters={ + "properties": { + "action": { + "else": {"operations": [{"name": "DeleteBlob", "onFailure": "break", "onSuccess": "continue"}]}, + "if": { + "condition": "[[equals(AccessTier, 'Cool')]]", + "operations": [ + { + "name": "SetBlobTier", + "onFailure": "break", + "onSuccess": "continue", + "parameters": {"tier": "Hot"}, + } + ], + }, + }, + "description": "My Storage task", + "enabled": True, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py new file mode 100644 index 000000000000..13bf1632ebf1 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python put_storage_task.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.begin_create( + resource_group_name="res4228", + storage_task_name="mytask1", + parameters={ + "location": "westus", + "properties": { + "action": { + "else": {"operations": [{"name": "DeleteBlob", "onFailure": "break", "onSuccess": "continue"}]}, + "if": { + "condition": "[[equals(AccessTier, 'Cool')]]", + "operations": [ + { + "name": "SetBlobTier", + "onFailure": "break", + "onSuccess": "continue", + "parameters": {"tier": "Hot"}, + } + ], + }, + }, + "description": "My Storage task", + "enabled": True, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py new file mode 100644 index 000000000000..d7f24735f2b6 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python list_storage_task_assignment_ids.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_task_assignment.list( + resource_group_name="rgroup1", + storage_task_name="mytask1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py new file mode 100644 index 000000000000..368149b7c421 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python list_storage_tasks_by_resource_group.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.list_by_resource_group( + resource_group_name="res6117", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py new file mode 100644 index 000000000000..83d2312d83fa --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python list_storage_tasks_by_subscription.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py new file mode 100644 index 000000000000..2f1fbc4a7b52 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.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.storageactions import StorageActionsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storageactions +# USAGE + python list_storage_tasks_run_report_summary.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 = StorageActionsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="1f31ba14-ce16-4281-b9b4-3e78da6e1616", + ) + + response = client.storage_tasks_report.list( + resource_group_name="rgroup1", + storage_task_name="mytask1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json +if __name__ == "__main__": + main() diff --git a/sdk/storageactions/azure-mgmt-storageactions/sdk_packaging.toml b/sdk/storageactions/azure-mgmt-storageactions/sdk_packaging.toml new file mode 100644 index 000000000000..9cc462da90c3 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-storageactions" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/storageactions/azure-mgmt-storageactions/setup.py b/sdk/storageactions/azure-mgmt-storageactions/setup.py new file mode 100644 index 000000000000..2de7d0ffb9ef --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/setup.py @@ -0,0 +1,82 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-storageactions" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/storageactions/ci.yml b/sdk/storageactions/ci.yml new file mode 100644 index 000000000000..3ff27eaccc24 --- /dev/null +++ b/sdk/storageactions/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/storageactions/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/storageactions/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storageactions + TestProxy: true + Artifacts: + - name: azure-mgmt-storageactions + safeName: azuremgmtstorageactions diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/CHANGELOG.md b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/LICENSE b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/MANIFEST.in b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/MANIFEST.in new file mode 100644 index 000000000000..945a7e53283f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/MANIFEST.in @@ -0,0 +1,9 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include azure/mgmt/workloads/__init__.py +include LICENSE +include azure/mgmt/workloads/sapvirtualinstance/py.typed diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/README.md b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/README.md new file mode 100644 index 000000000000..b892274cef95 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +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_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-workloads-sapvirtualinstance +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +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. diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/_meta.json b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/_meta.json new file mode 100644 index 000000000000..9733962fc45f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b88667d1b49b9a24ac9c4b166c52b7d14fde3f8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.7", + "use": [ + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" + ], + "autorest_command": "autorest specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md" +} \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/__init__.py new file mode 100644 index 000000000000..4ec1168b4c9a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._workloads_client import WorkloadsClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkloadsClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_configuration.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_configuration.py new file mode 100644 index 000000000000..59faf82d1c21 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for WorkloadsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-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(WorkloadsClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-workloads-sapvirtualinstance/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_patch.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_serialization.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_serialization.py new file mode 100644 index 000000000000..4bae2292227b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # 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 + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # 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("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: 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__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + 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. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + 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) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + 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) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # 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] + do_quote = not kwargs.get("skip_quote", False) + return str(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) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is AzureCoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **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) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + 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): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + 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) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + 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: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, 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:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_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:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + 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): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = 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 + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + 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) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + 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"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_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) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + 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: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + 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) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + 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) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + 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) + else: + return date_obj diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_vendor.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_vendor.py new file mode 100644 index 000000000000..90ebda4cf4c5 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_vendor.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import WorkloadsClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + + +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 + + +class WorkloadsClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: WorkloadsClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_version.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_workloads_client.py new file mode 100644 index 000000000000..5a541d7a9742 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/_workloads_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from ._configuration import WorkloadsClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + Operations, + SAPApplicationServerInstancesOperations, + SAPCentralInstancesOperations, + SAPDatabaseInstancesOperations, + SAPVirtualInstancesOperations, + WorkloadsClientOperationsMixin, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class WorkloadsClient(WorkloadsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Workloads client provides access to various workload operations. + + :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations + :vartype sap_virtual_instances: + azure.mgmt.workloads.sapvirtualinstance.operations.SAPVirtualInstancesOperations + :ivar sap_central_instances: SAPCentralInstancesOperations operations + :vartype sap_central_instances: + azure.mgmt.workloads.sapvirtualinstance.operations.SAPCentralInstancesOperations + :ivar sap_database_instances: SAPDatabaseInstancesOperations operations + :vartype sap_database_instances: + azure.mgmt.workloads.sapvirtualinstance.operations.SAPDatabaseInstancesOperations + :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations + :vartype sap_application_server_instances: + azure.mgmt.workloads.sapvirtualinstance.operations.SAPApplicationServerInstancesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.sapvirtualinstance.operations.Operations + :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-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = WorkloadsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.sap_virtual_instances = SAPVirtualInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_central_instances = SAPCentralInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_database_instances = SAPDatabaseInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "WorkloadsClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/__init__.py new file mode 100644 index 000000000000..6318f4d52711 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._workloads_client import WorkloadsClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkloadsClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_configuration.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_configuration.py new file mode 100644 index 000000000000..0b62bd119580 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for WorkloadsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-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(WorkloadsClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-workloads-sapvirtualinstance/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_patch.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_vendor.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_vendor.py new file mode 100644 index 000000000000..06d58dc0155e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import WorkloadsClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class WorkloadsClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: WorkloadsClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_workloads_client.py new file mode 100644 index 000000000000..f14f7931f6e7 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/_workloads_client.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. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import WorkloadsClientConfiguration +from .operations import ( + Operations, + SAPApplicationServerInstancesOperations, + SAPCentralInstancesOperations, + SAPDatabaseInstancesOperations, + SAPVirtualInstancesOperations, + WorkloadsClientOperationsMixin, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WorkloadsClient(WorkloadsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Workloads client provides access to various workload operations. + + :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations + :vartype sap_virtual_instances: + azure.mgmt.workloads.sapvirtualinstance.aio.operations.SAPVirtualInstancesOperations + :ivar sap_central_instances: SAPCentralInstancesOperations operations + :vartype sap_central_instances: + azure.mgmt.workloads.sapvirtualinstance.aio.operations.SAPCentralInstancesOperations + :ivar sap_database_instances: SAPDatabaseInstancesOperations operations + :vartype sap_database_instances: + azure.mgmt.workloads.sapvirtualinstance.aio.operations.SAPDatabaseInstancesOperations + :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations + :vartype sap_application_server_instances: + azure.mgmt.workloads.sapvirtualinstance.aio.operations.SAPApplicationServerInstancesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.sapvirtualinstance.aio.operations.Operations + :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-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = WorkloadsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.sap_virtual_instances = SAPVirtualInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_central_instances = SAPCentralInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_database_instances = SAPDatabaseInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WorkloadsClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/__init__.py new file mode 100644 index 000000000000..e7b2100cc5d3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/__init__.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. +# -------------------------------------------------------------------------- + +from ._workloads_client_operations import WorkloadsClientOperationsMixin +from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations +from ._sap_central_instances_operations import SAPCentralInstancesOperations +from ._sap_database_instances_operations import SAPDatabaseInstancesOperations +from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkloadsClientOperationsMixin", + "SAPVirtualInstancesOperations", + "SAPCentralInstancesOperations", + "SAPDatabaseInstancesOperations", + "SAPApplicationServerInstancesOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_operations.py new file mode 100644 index 000000000000..8b996845cc29 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_operations.py @@ -0,0 +1,135 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.aio.WorkloadsClient`'s + :attr:`operations` 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, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all the available API operations under this PR. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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.metadata = {"url": "/providers/Microsoft.Workloads/operations"} diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_patch.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py new file mode 100644 index 000000000000..f7c8fcc5d780 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py @@ -0,0 +1,1289 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_application_server_instances_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_start_instance_request, + build_stop_instance_request, + build_update_request, +) +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SAPApplicationServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.aio.WorkloadsClient`'s + :attr:`sap_application_server_instances` 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_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :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.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_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 = 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("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPApplicationServerInstance] = 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, "SAPApplicationServerInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.SAPApplicationServerInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :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 SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Is either a + SAPApplicationServerInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :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.SAPApplicationServerInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + :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: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Is either a + UpdateSAPApplicationInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPApplicationServerInstance] = 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, "UpdateSAPApplicationInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + 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) + + _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("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the SAP Application Server Instance resource. :code:`
`:code:`
`This operation + will be used by service only. Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPApplicationServerInstance"]: + """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPApplicationServerInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :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.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + 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("SAPApplicationServerInstanceList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" + } + + async def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Is either a StartRequest type + or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is either a StopRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_central_instances_operations.py new file mode 100644 index 000000000000..fd07cdf199c8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_central_instances_operations.py @@ -0,0 +1,1290 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_central_instances_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_start_instance_request, + build_stop_instance_request, + build_update_request, +) +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SAPCentralInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.aio.WorkloadsClient`'s + :attr:`sap_central_instances` 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_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Gets the SAP Central Services Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :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.SAPCentralServerInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_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 = 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("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPCentralServerInstance] = 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, "SAPCentralServerInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.SAPCentralServerInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :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 SAPCentralServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Is either a + SAPCentralServerInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :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.SAPCentralServerInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPCentralInstanceRequest + :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: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Is either a + UpdateSAPCentralInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPCentralInstanceRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPCentralServerInstance] = 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, "UpdateSAPCentralInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + 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) + + _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("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. Delete operation on this resource by end user will return a Bad Request error. + You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, + using the delete operation on it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPCentralServerInstance"]: + """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPCentralServerInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :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.SAPCentralInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + 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("SAPCentralInstanceList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" + } + + async def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Is either a StartRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is either a StopRequest type or a + IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_database_instances_operations.py new file mode 100644 index 000000000000..cbe30f5daeea --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_database_instances_operations.py @@ -0,0 +1,1287 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_database_instances_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_start_instance_request, + build_stop_instance_request, + build_update_request, +) +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SAPDatabaseInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.aio.WorkloadsClient`'s + :attr:`sap_database_instances` 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_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Gets the SAP Database Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :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.SAPDatabaseInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_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 = 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("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDatabaseInstance] = 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, "SAPDatabaseInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.SAPDatabaseInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :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 SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Is either a SAPDatabaseInstance + type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :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.SAPDatabaseInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest + :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: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Is either a + UpdateSAPDatabaseInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDatabaseInstance] = 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, "UpdateSAPDatabaseInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + 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) + + _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("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPDatabaseInstance"]: + """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPDatabaseInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :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.SAPDatabaseInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + 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("SAPDatabaseInstanceList", 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.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" + } + + async def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Is either a StartRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + async def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is either a StopRequest + type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py new file mode 100644 index 000000000000..857d3859a906 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py @@ -0,0 +1,1397 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_virtual_instances_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_start_request, + build_stop_request, + build_update_request, +) +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SAPVirtualInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.aio.WorkloadsClient`'s + :attr:`sap_virtual_instances` 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 _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPVirtualInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPVirtualInstance] = 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, "SAPVirtualInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.SAPVirtualInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance + :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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Is either a + SAPVirtualInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> _models.SAPVirtualInstance: + """Gets a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance + :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.SAPVirtualInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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 = 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("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + async def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPVirtualInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPVirtualInstance] = 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, "UpdateSAPVirtualInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + map_error(status_code=response.status_code, 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("SAPVirtualInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Default + value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceRequest + :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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Default + value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Is either a + UpdateSAPVirtualInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_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, + sap_virtual_instance_name=sap_virtual_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the + associated Central Services Instance, Application Server Instances and Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Resource Group. + + :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 SAPVirtualInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstanceList] = 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, + 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("SAPVirtualInstanceList", 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.Workloads/sapVirtualInstances" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstance or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstanceList] = 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, + 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("SAPVirtualInstanceList", 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_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" + } + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" + } + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Is either a + StartRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" + } + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" + } + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Is either a + StopRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_workloads_client_operations.py new file mode 100644 index 000000000000..6e2c6060199b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/aio/operations/_workloads_client_operations.py @@ -0,0 +1,587 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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._workloads_client_operations import ( + build_sap_availability_zone_details_request, + build_sap_disk_configurations_request, + build_sap_sizing_recommendations_request, + build_sap_supported_sku_request, +) +from .._vendor import WorkloadsClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WorkloadsClientOperationsMixin(WorkloadsClientMixinABC): + @overload + async def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationRequest + :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: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Is either a + SAPSizingRecommendationRequest type or a IO type. Default value is None. + :type sap_sizing_recommendation: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPSizingRecommendationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_sizing_recommendation, (IOBase, bytes)): + _content = sap_sizing_recommendation + else: + if sap_sizing_recommendation is not None: + _json = self._serialize.body(sap_sizing_recommendation, "SAPSizingRecommendationRequest") + else: + _json = None + + request = build_sap_sizing_recommendations_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_sizing_recommendations.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( # type: ignore # 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("SAPSizingRecommendationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_sizing_recommendations.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" + } + + @overload + async def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSkusRequest + :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: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Is either a SAPSupportedSkusRequest + type or a IO type. Default value is None. + :type sap_supported_sku: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSkusRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_supported_sku, (IOBase, bytes)): + _content = sap_supported_sku + else: + if sap_supported_sku is not None: + _json = self._serialize.body(sap_supported_sku, "SAPSupportedSkusRequest") + else: + _json = None + + request = build_sap_supported_sku_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_supported_sku.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( # type: ignore # 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("SAPSupportedResourceSkusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_supported_sku.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" + } + + @overload + async def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsRequest + :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: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Is either a + SAPDiskConfigurationsRequest type or a IO type. Default value is None. + :type sap_disk_configurations: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_disk_configurations, (IOBase, bytes)): + _content = sap_disk_configurations + else: + if sap_disk_configurations is not None: + _json = self._serialize.body(sap_disk_configurations, "SAPDiskConfigurationsRequest") + else: + _json = None + + request = build_sap_disk_configurations_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_disk_configurations.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( # type: ignore # 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("SAPDiskConfigurationsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_disk_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" + } + + @overload + async def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest + :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: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Is either a + SAPAvailabilityZoneDetailsRequest type or a IO type. Default value is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_availability_zone_details, (IOBase, bytes)): + _content = sap_availability_zone_details + else: + if sap_availability_zone_details is not None: + _json = self._serialize.body(sap_availability_zone_details, "SAPAvailabilityZoneDetailsRequest") + else: + _json = None + + request = build_sap_availability_zone_details_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_availability_zone_details.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( # type: ignore # 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("SAPAvailabilityZoneDetailsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_availability_zone_details.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/__init__.py new file mode 100644 index 000000000000..878179ce7d45 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/__init__.py @@ -0,0 +1,273 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 ._models_py3 import ApplicationServerConfiguration +from ._models_py3 import ApplicationServerFullResourceNames +from ._models_py3 import ApplicationServerVmDetails +from ._models_py3 import CentralServerConfiguration +from ._models_py3 import CentralServerFullResourceNames +from ._models_py3 import CentralServerVmDetails +from ._models_py3 import CreateAndMountFileShareConfiguration +from ._models_py3 import DatabaseConfiguration +from ._models_py3 import DatabaseServerFullResourceNames +from ._models_py3 import DatabaseVmDetails +from ._models_py3 import DeployerVmPackages +from ._models_py3 import DeploymentConfiguration +from ._models_py3 import DeploymentWithOSConfiguration +from ._models_py3 import DiscoveryConfiguration +from ._models_py3 import DiskConfiguration +from ._models_py3 import DiskDetails +from ._models_py3 import DiskSku +from ._models_py3 import DiskVolumeConfiguration +from ._models_py3 import EnqueueReplicationServerProperties +from ._models_py3 import EnqueueServerProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExternalInstallationSoftwareConfiguration +from ._models_py3 import FileShareConfiguration +from ._models_py3 import GatewayServerProperties +from ._models_py3 import HighAvailabilityConfiguration +from ._models_py3 import HighAvailabilitySoftwareConfiguration +from ._models_py3 import ImageReference +from ._models_py3 import InfrastructureConfiguration +from ._models_py3 import LinuxConfiguration +from ._models_py3 import LoadBalancerDetails +from ._models_py3 import LoadBalancerResourceNames +from ._models_py3 import ManagedRGConfiguration +from ._models_py3 import MessageServerProperties +from ._models_py3 import MountFileShareConfiguration +from ._models_py3 import NetworkConfiguration +from ._models_py3 import NetworkInterfaceResourceNames +from ._models_py3 import OSConfiguration +from ._models_py3 import OSProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusResult +from ._models_py3 import OsSapConfiguration +from ._models_py3 import Resource +from ._models_py3 import SAPApplicationServerInstance +from ._models_py3 import SAPApplicationServerInstanceList +from ._models_py3 import SAPApplicationServerProperties +from ._models_py3 import SAPAvailabilityZoneDetailsRequest +from ._models_py3 import SAPAvailabilityZoneDetailsResult +from ._models_py3 import SAPAvailabilityZonePair +from ._models_py3 import SAPCentralInstanceList +from ._models_py3 import SAPCentralServerInstance +from ._models_py3 import SAPCentralServerProperties +from ._models_py3 import SAPConfiguration +from ._models_py3 import SAPDatabaseInstance +from ._models_py3 import SAPDatabaseInstanceList +from ._models_py3 import SAPDatabaseProperties +from ._models_py3 import SAPDiskConfiguration +from ._models_py3 import SAPDiskConfigurationsRequest +from ._models_py3 import SAPDiskConfigurationsResult +from ._models_py3 import SAPInstallWithoutOSConfigSoftwareConfiguration +from ._models_py3 import SAPSizingRecommendationRequest +from ._models_py3 import SAPSizingRecommendationResult +from ._models_py3 import SAPSupportedResourceSkusResult +from ._models_py3 import SAPSupportedSku +from ._models_py3 import SAPSupportedSkusRequest +from ._models_py3 import SAPVirtualInstance +from ._models_py3 import SAPVirtualInstanceError +from ._models_py3 import SAPVirtualInstanceList +from ._models_py3 import SAPVirtualInstanceProperties +from ._models_py3 import ServiceInitiatedSoftwareConfiguration +from ._models_py3 import SharedStorageResourceNames +from ._models_py3 import SingleServerConfiguration +from ._models_py3 import SingleServerCustomResourceNames +from ._models_py3 import SingleServerFullResourceNames +from ._models_py3 import SingleServerRecommendationResult +from ._models_py3 import SkipFileShareConfiguration +from ._models_py3 import SoftwareConfiguration +from ._models_py3 import SshConfiguration +from ._models_py3 import SshKeyPair +from ._models_py3 import SshPublicKey +from ._models_py3 import StartRequest +from ._models_py3 import StopRequest +from ._models_py3 import StorageConfiguration +from ._models_py3 import StorageInformation +from ._models_py3 import SystemData +from ._models_py3 import ThreeTierConfiguration +from ._models_py3 import ThreeTierCustomResourceNames +from ._models_py3 import ThreeTierFullResourceNames +from ._models_py3 import ThreeTierRecommendationResult +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateSAPApplicationInstanceRequest +from ._models_py3 import UpdateSAPCentralInstanceRequest +from ._models_py3 import UpdateSAPDatabaseInstanceRequest +from ._models_py3 import UpdateSAPVirtualInstanceProperties +from ._models_py3 import UpdateSAPVirtualInstanceRequest +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedServiceIdentity +from ._models_py3 import VirtualMachineConfiguration +from ._models_py3 import VirtualMachineResourceNames +from ._models_py3 import WindowsConfiguration + +from ._workloads_client_enums import ActionType +from ._workloads_client_enums import ApplicationServerVirtualMachineType +from ._workloads_client_enums import CentralServerVirtualMachineType +from ._workloads_client_enums import ConfigurationType +from ._workloads_client_enums import CreatedByType +from ._workloads_client_enums import DiskSkuName +from ._workloads_client_enums import EnqueueReplicationServerType +from ._workloads_client_enums import ManagedResourcesNetworkAccessType +from ._workloads_client_enums import ManagedServiceIdentityType +from ._workloads_client_enums import NamingPatternType +from ._workloads_client_enums import OSType +from ._workloads_client_enums import Origin +from ._workloads_client_enums import SAPConfigurationType +from ._workloads_client_enums import SAPDatabaseScaleMethod +from ._workloads_client_enums import SAPDatabaseType +from ._workloads_client_enums import SAPDeploymentType +from ._workloads_client_enums import SAPEnvironmentType +from ._workloads_client_enums import SAPHealthState +from ._workloads_client_enums import SAPHighAvailabilityType +from ._workloads_client_enums import SAPProductType +from ._workloads_client_enums import SAPSoftwareInstallationType +from ._workloads_client_enums import SAPVirtualInstanceState +from ._workloads_client_enums import SAPVirtualInstanceStatus +from ._workloads_client_enums import SapVirtualInstanceProvisioningState +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationServerConfiguration", + "ApplicationServerFullResourceNames", + "ApplicationServerVmDetails", + "CentralServerConfiguration", + "CentralServerFullResourceNames", + "CentralServerVmDetails", + "CreateAndMountFileShareConfiguration", + "DatabaseConfiguration", + "DatabaseServerFullResourceNames", + "DatabaseVmDetails", + "DeployerVmPackages", + "DeploymentConfiguration", + "DeploymentWithOSConfiguration", + "DiscoveryConfiguration", + "DiskConfiguration", + "DiskDetails", + "DiskSku", + "DiskVolumeConfiguration", + "EnqueueReplicationServerProperties", + "EnqueueServerProperties", + "ErrorAdditionalInfo", + "ErrorDefinition", + "ErrorDetail", + "ErrorResponse", + "ExternalInstallationSoftwareConfiguration", + "FileShareConfiguration", + "GatewayServerProperties", + "HighAvailabilityConfiguration", + "HighAvailabilitySoftwareConfiguration", + "ImageReference", + "InfrastructureConfiguration", + "LinuxConfiguration", + "LoadBalancerDetails", + "LoadBalancerResourceNames", + "ManagedRGConfiguration", + "MessageServerProperties", + "MountFileShareConfiguration", + "NetworkConfiguration", + "NetworkInterfaceResourceNames", + "OSConfiguration", + "OSProfile", + "Operation", + "OperationDisplay", + "OperationListResult", + "OperationStatusResult", + "OsSapConfiguration", + "Resource", + "SAPApplicationServerInstance", + "SAPApplicationServerInstanceList", + "SAPApplicationServerProperties", + "SAPAvailabilityZoneDetailsRequest", + "SAPAvailabilityZoneDetailsResult", + "SAPAvailabilityZonePair", + "SAPCentralInstanceList", + "SAPCentralServerInstance", + "SAPCentralServerProperties", + "SAPConfiguration", + "SAPDatabaseInstance", + "SAPDatabaseInstanceList", + "SAPDatabaseProperties", + "SAPDiskConfiguration", + "SAPDiskConfigurationsRequest", + "SAPDiskConfigurationsResult", + "SAPInstallWithoutOSConfigSoftwareConfiguration", + "SAPSizingRecommendationRequest", + "SAPSizingRecommendationResult", + "SAPSupportedResourceSkusResult", + "SAPSupportedSku", + "SAPSupportedSkusRequest", + "SAPVirtualInstance", + "SAPVirtualInstanceError", + "SAPVirtualInstanceList", + "SAPVirtualInstanceProperties", + "ServiceInitiatedSoftwareConfiguration", + "SharedStorageResourceNames", + "SingleServerConfiguration", + "SingleServerCustomResourceNames", + "SingleServerFullResourceNames", + "SingleServerRecommendationResult", + "SkipFileShareConfiguration", + "SoftwareConfiguration", + "SshConfiguration", + "SshKeyPair", + "SshPublicKey", + "StartRequest", + "StopRequest", + "StorageConfiguration", + "StorageInformation", + "SystemData", + "ThreeTierConfiguration", + "ThreeTierCustomResourceNames", + "ThreeTierFullResourceNames", + "ThreeTierRecommendationResult", + "TrackedResource", + "UpdateSAPApplicationInstanceRequest", + "UpdateSAPCentralInstanceRequest", + "UpdateSAPDatabaseInstanceRequest", + "UpdateSAPVirtualInstanceProperties", + "UpdateSAPVirtualInstanceRequest", + "UserAssignedIdentity", + "UserAssignedServiceIdentity", + "VirtualMachineConfiguration", + "VirtualMachineResourceNames", + "WindowsConfiguration", + "ActionType", + "ApplicationServerVirtualMachineType", + "CentralServerVirtualMachineType", + "ConfigurationType", + "CreatedByType", + "DiskSkuName", + "EnqueueReplicationServerType", + "ManagedResourcesNetworkAccessType", + "ManagedServiceIdentityType", + "NamingPatternType", + "OSType", + "Origin", + "SAPConfigurationType", + "SAPDatabaseScaleMethod", + "SAPDatabaseType", + "SAPDeploymentType", + "SAPEnvironmentType", + "SAPHealthState", + "SAPHighAvailabilityType", + "SAPProductType", + "SAPSoftwareInstallationType", + "SAPVirtualInstanceState", + "SAPVirtualInstanceStatus", + "SapVirtualInstanceProvisioningState", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_models_py3.py new file mode 100644 index 000000000000..9d7350d371f3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_models_py3.py @@ -0,0 +1,4874 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class ApplicationServerConfiguration(_serialization.Model): + """Gets or sets the application server configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of app server instances. Required. + :vartype instance_count: int + """ + + _validation = { + "subnet_id": {"required": True}, + "virtual_machine_configuration": {"required": True}, + "instance_count": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + **kwargs: Any + ) -> None: + """ + :keyword subnet_id: The subnet id. Required. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. + Required. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :keyword instance_count: The number of app server instances. Required. + :paramtype instance_count: int + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + + +class ApplicationServerFullResourceNames(_serialization.Model): + """The full resource names object for application layer resources. The number of entries in this + list should be equal to the number VMs to be created for application layer. + + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-App-AvSet. + :vartype availability_set_name: str + """ + + _attribute_map = { + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + } + + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword virtual_machines: The list of virtual machine naming details. + :paramtype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-App-AvSet. + :paramtype availability_set_name: str + """ + super().__init__(**kwargs) + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name + + +class ApplicationServerVmDetails(_serialization.Model): + """The Application Server VM Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Defines the type of application server VM. Known values are: "Active", "Standby", + and "Unknown". + :vartype type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerVirtualMachineType + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the App Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloads.sapvirtualinstance.models.StorageInformation] + """ + + _validation = { + "type": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "storage_details": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.virtual_machine_id = None + self.storage_details = None + + +class CentralServerConfiguration(_serialization.Model): + """Gets or sets the central server configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of central server VMs. Required. + :vartype instance_count: int + """ + + _validation = { + "subnet_id": {"required": True}, + "virtual_machine_configuration": {"required": True}, + "instance_count": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + **kwargs: Any + ) -> None: + """ + :keyword subnet_id: The subnet id. Required. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. + Required. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :keyword instance_count: The number of central server VMs. Required. + :paramtype instance_count: int + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + + +class CentralServerFullResourceNames(_serialization.Model): + """The full resource names object for central server layer resources. + + :ivar virtual_machines: The list of names for all ASCS virtual machines to be deployed. The + number of entries in this list should be equal to the number VMs to be created for ASCS layer. + At maximum, there can be two virtual machines at this layer: ASCS and ERS. + :vartype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-ASCS-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerResourceNames + """ + + _validation = { + "virtual_machines": {"max_items": 2, "min_items": 0}, + } + + _attribute_map = { + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, + } + + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword virtual_machines: The list of names for all ASCS virtual machines to be deployed. The + number of entries in this list should be equal to the number VMs to be created for ASCS layer. + At maximum, there can be two virtual machines at this layer: ASCS and ERS. + :paramtype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-ASCS-AvSet. + :paramtype availability_set_name: str + :keyword load_balancer: The resource names object for load balancer and related resources. + :paramtype load_balancer: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerResourceNames + """ + super().__init__(**kwargs) + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name + self.load_balancer = load_balancer + + +class CentralServerVmDetails(_serialization.Model): + """The SAP Central Services Instance VM details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Defines the type of central server VM. Known values are: "Primary", "Secondary", + "Unknown", "ASCS", "ERSInactive", "ERS", and "Standby". + :vartype type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerVirtualMachineType + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the ASCS Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloads.sapvirtualinstance.models.StorageInformation] + """ + + _validation = { + "type": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "storage_details": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.virtual_machine_id = None + self.storage_details = None + + +class FileShareConfiguration(_serialization.Model): + """File Share configuration details, populated with information on storage configuration mounted + on the VIS. The createAndMount option is selected in case of missing input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateAndMountFileShareConfiguration, MountFileShareConfiguration, SkipFileShareConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ConfigurationType + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + } + + _subtype_map = { + "configuration_type": { + "CreateAndMount": "CreateAndMountFileShareConfiguration", + "Mount": "MountFileShareConfiguration", + "Skip": "SkipFileShareConfiguration", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.configuration_type: Optional[str] = None + + +class CreateAndMountFileShareConfiguration(FileShareConfiguration): + """Gets or sets the file share configuration where the transport directory fileshare is created + and mounted as a part of the create infra flow. Please pre-create the resource group you intend + to place the transport directory in. The storage account and fileshare will be auto-created by + the ACSS and doesn't need to be pre-created. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ConfigurationType + :ivar resource_group: The name of transport file share resource group. This should be pre + created by the customer. The app rg is used in case of missing input. + :vartype resource_group: str + :ivar storage_account_name: The name of file share storage account name . A custom name is used + in case of missing input. + :vartype storage_account_name: str + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + } + + def __init__( + self, *, resource_group: Optional[str] = None, storage_account_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resource_group: The name of transport file share resource group. This should be pre + created by the customer. The app rg is used in case of missing input. + :paramtype resource_group: str + :keyword storage_account_name: The name of file share storage account name . A custom name is + used in case of missing input. + :paramtype storage_account_name: str + """ + super().__init__(**kwargs) + self.configuration_type: str = "CreateAndMount" + self.resource_group = resource_group + self.storage_account_name = storage_account_name + + +class DatabaseConfiguration(_serialization.Model): + """Gets or sets the database configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar database_type: The database type. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of database VMs. Required. + :vartype instance_count: int + :ivar disk_configuration: Gets or sets the disk configuration. + :vartype disk_configuration: ~azure.mgmt.workloads.sapvirtualinstance.models.DiskConfiguration + """ + + _validation = { + "subnet_id": {"required": True}, + "virtual_machine_configuration": {"required": True}, + "instance_count": {"required": True}, + } + + _attribute_map = { + "database_type": {"key": "databaseType", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + "disk_configuration": {"key": "diskConfiguration", "type": "DiskConfiguration"}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, + disk_configuration: Optional["_models.DiskConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword database_type: The database type. Known values are: "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :keyword subnet_id: The subnet id. Required. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. + Required. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :keyword instance_count: The number of database VMs. Required. + :paramtype instance_count: int + :keyword disk_configuration: Gets or sets the disk configuration. + :paramtype disk_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskConfiguration + """ + super().__init__(**kwargs) + self.database_type = database_type + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + self.disk_configuration = disk_configuration + + +class DatabaseServerFullResourceNames(_serialization.Model): + """The full resource names object for database layer resources. The number of entries in this list + should be equal to the number VMs to be created for database layer. + + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-DB-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerResourceNames + """ + + _validation = { + "virtual_machines": {"max_items": 2, "min_items": 0}, + } + + _attribute_map = { + "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, + "availability_set_name": {"key": "availabilitySetName", "type": "str"}, + "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, + } + + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword virtual_machines: The list of virtual machine naming details. + :paramtype virtual_machines: + list[~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames] + :keyword availability_set_name: The full name for availability set. In case name is not + provided, it will be defaulted to {SID}-DB-AvSet. + :paramtype availability_set_name: str + :keyword load_balancer: The resource names object for load balancer and related resources. + :paramtype load_balancer: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerResourceNames + """ + super().__init__(**kwargs) + self.virtual_machines = virtual_machines + self.availability_set_name = availability_set_name + self.load_balancer = load_balancer + + +class DatabaseVmDetails(_serialization.Model): + """Database VM details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar storage_details: Storage details of all the Storage Accounts attached to the Database + Virtual Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloads.sapvirtualinstance.models.StorageInformation] + """ + + _validation = { + "virtual_machine_id": {"readonly": True}, + "status": {"readonly": True}, + "storage_details": {"readonly": True}, + } + + _attribute_map = { + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.virtual_machine_id = None + self.status = None + self.storage_details = None + + +class DeployerVmPackages(_serialization.Model): + """Defines the url and storage account ID where deployer VM packages are uploaded. + + :ivar url: The URL to the deployer VM packages file. + :vartype url: str + :ivar storage_account_id: The deployer VM packages storage account id. + :vartype storage_account_id: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__(self, *, url: Optional[str] = None, storage_account_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword url: The URL to the deployer VM packages file. + :paramtype url: str + :keyword storage_account_id: The deployer VM packages storage account id. + :paramtype storage_account_id: str + """ + super().__init__(**kwargs) + self.url = url + self.storage_account_id = storage_account_id + + +class SAPConfiguration(_serialization.Model): + """The SAP Configuration. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DeploymentConfiguration, DeploymentWithOSConfiguration, DiscoveryConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The configuration Type. Required. Known values are: "Deployment", + "Discovery", and "DeploymentWithOSConfig". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfigurationType + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + } + + _subtype_map = { + "configuration_type": { + "Deployment": "DeploymentConfiguration", + "DeploymentWithOSConfig": "DeploymentWithOSConfiguration", + "Discovery": "DiscoveryConfiguration", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.configuration_type: Optional[str] = None + + +class DeploymentConfiguration(SAPConfiguration): + """Deployment Configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The configuration Type. Required. Known values are: "Deployment", + "Discovery", and "DeploymentWithOSConfig". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfigurationType + :ivar app_location: The geo-location where the SAP system is to be created. + :vartype app_location: str + :ivar infrastructure_configuration: The infrastructure configuration. + :vartype infrastructure_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.SoftwareConfiguration + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "app_location": {"key": "appLocation", "type": "str"}, + "infrastructure_configuration": {"key": "infrastructureConfiguration", "type": "InfrastructureConfiguration"}, + "software_configuration": {"key": "softwareConfiguration", "type": "SoftwareConfiguration"}, + } + + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the SAP system is to be created. + :paramtype app_location: str + :keyword infrastructure_configuration: The infrastructure configuration. + :paramtype infrastructure_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.InfrastructureConfiguration + :keyword software_configuration: The software configuration. + :paramtype software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.SoftwareConfiguration + """ + super().__init__(**kwargs) + self.configuration_type: str = "Deployment" + self.app_location = app_location + self.infrastructure_configuration = infrastructure_configuration + self.software_configuration = software_configuration + + +class DeploymentWithOSConfiguration(SAPConfiguration): + """Deployment along with OS Configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The configuration Type. Required. Known values are: "Deployment", + "Discovery", and "DeploymentWithOSConfig". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfigurationType + :ivar app_location: The geo-location where the SAP system is to be created. + :vartype app_location: str + :ivar infrastructure_configuration: The infrastructure configuration. + :vartype infrastructure_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.SoftwareConfiguration + :ivar os_sap_configuration: The OS and SAP configuration. + :vartype os_sap_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.OsSapConfiguration + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "app_location": {"key": "appLocation", "type": "str"}, + "infrastructure_configuration": {"key": "infrastructureConfiguration", "type": "InfrastructureConfiguration"}, + "software_configuration": {"key": "softwareConfiguration", "type": "SoftwareConfiguration"}, + "os_sap_configuration": {"key": "osSapConfiguration", "type": "OsSapConfiguration"}, + } + + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, + os_sap_configuration: Optional["_models.OsSapConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the SAP system is to be created. + :paramtype app_location: str + :keyword infrastructure_configuration: The infrastructure configuration. + :paramtype infrastructure_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.InfrastructureConfiguration + :keyword software_configuration: The software configuration. + :paramtype software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.SoftwareConfiguration + :keyword os_sap_configuration: The OS and SAP configuration. + :paramtype os_sap_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.OsSapConfiguration + """ + super().__init__(**kwargs) + self.configuration_type: str = "DeploymentWithOSConfig" + self.app_location = app_location + self.infrastructure_configuration = infrastructure_configuration + self.software_configuration = software_configuration + self.os_sap_configuration = os_sap_configuration + + +class DiscoveryConfiguration(SAPConfiguration): + """Discovery Details. + + 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 configuration_type: The configuration Type. Required. Known values are: "Deployment", + "Discovery", and "DeploymentWithOSConfig". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfigurationType + :ivar central_server_vm_id: The virtual machine ID of the Central Server. + :vartype central_server_vm_id: str + :ivar managed_rg_storage_account_name: The custom storage account name for the storage account + created by the service in the managed resource group created as part of VIS + deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here + `_.:code:`
`:code:`
`If + not provided, the service will create the storage account with a random name. + :vartype managed_rg_storage_account_name: str + :ivar app_location: The geo-location where the SAP system exists. + :vartype app_location: str + """ + + _validation = { + "configuration_type": {"required": True}, + "managed_rg_storage_account_name": {"max_length": 24, "min_length": 3}, + "app_location": {"readonly": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, + "managed_rg_storage_account_name": {"key": "managedRgStorageAccountName", "type": "str"}, + "app_location": {"key": "appLocation", "type": "str"}, + } + + def __init__( + self, + *, + central_server_vm_id: Optional[str] = None, + managed_rg_storage_account_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword central_server_vm_id: The virtual machine ID of the Central Server. + :paramtype central_server_vm_id: str + :keyword managed_rg_storage_account_name: The custom storage account name for the storage + account created by the service in the managed resource group created as part of VIS + deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here + `_.:code:`
`:code:`
`If + not provided, the service will create the storage account with a random name. + :paramtype managed_rg_storage_account_name: str + """ + super().__init__(**kwargs) + self.configuration_type: str = "Discovery" + self.central_server_vm_id = central_server_vm_id + self.managed_rg_storage_account_name = managed_rg_storage_account_name + self.app_location = None + + +class DiskConfiguration(_serialization.Model): + """The Disk Configuration Details. + + :ivar disk_volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype disk_volume_configurations: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskVolumeConfiguration] + """ + + _attribute_map = { + "disk_volume_configurations": {"key": "diskVolumeConfigurations", "type": "{DiskVolumeConfiguration}"}, + } + + def __init__( + self, + *, + disk_volume_configurations: Optional[Dict[str, "_models.DiskVolumeConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword disk_volume_configurations: The disk configuration for the db volume. For HANA, + Required volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume + : ['backup']. + :paramtype disk_volume_configurations: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskVolumeConfiguration] + """ + super().__init__(**kwargs) + self.disk_volume_configurations = disk_volume_configurations + + +class DiskDetails(_serialization.Model): + """The supported disk size details for a disk type. + + :ivar sku: The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, + Premium_ZRS. + :vartype sku: ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSku + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar minimum_supported_disk_count: The minimum supported disk count. + :vartype minimum_supported_disk_count: int + :ivar maximum_supported_disk_count: The maximum supported disk count. + :vartype maximum_supported_disk_count: int + :ivar iops_read_write: The disk Iops. + :vartype iops_read_write: int + :ivar mbps_read_write: The disk provisioned throughput in MBps. + :vartype mbps_read_write: int + :ivar disk_tier: The disk tier, e.g. P10, E10. + :vartype disk_tier: str + """ + + _attribute_map = { + "sku": {"key": "sku", "type": "DiskSku"}, + "size_gb": {"key": "sizeGB", "type": "int"}, + "minimum_supported_disk_count": {"key": "minimumSupportedDiskCount", "type": "int"}, + "maximum_supported_disk_count": {"key": "maximumSupportedDiskCount", "type": "int"}, + "iops_read_write": {"key": "iopsReadWrite", "type": "int"}, + "mbps_read_write": {"key": "mbpsReadWrite", "type": "int"}, + "disk_tier": {"key": "diskTier", "type": "str"}, + } + + def __init__( + self, + *, + sku: Optional["_models.DiskSku"] = None, + size_gb: Optional[int] = None, + minimum_supported_disk_count: Optional[int] = None, + maximum_supported_disk_count: Optional[int] = None, + iops_read_write: Optional[int] = None, + mbps_read_write: Optional[int] = None, + disk_tier: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, + Premium_ZRS. + :paramtype sku: ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSku + :keyword size_gb: The disk size in GB. + :paramtype size_gb: int + :keyword minimum_supported_disk_count: The minimum supported disk count. + :paramtype minimum_supported_disk_count: int + :keyword maximum_supported_disk_count: The maximum supported disk count. + :paramtype maximum_supported_disk_count: int + :keyword iops_read_write: The disk Iops. + :paramtype iops_read_write: int + :keyword mbps_read_write: The disk provisioned throughput in MBps. + :paramtype mbps_read_write: int + :keyword disk_tier: The disk tier, e.g. P10, E10. + :paramtype disk_tier: str + """ + super().__init__(**kwargs) + self.sku = sku + self.size_gb = size_gb + self.minimum_supported_disk_count = minimum_supported_disk_count + self.maximum_supported_disk_count = maximum_supported_disk_count + self.iops_read_write = iops_read_write + self.mbps_read_write = mbps_read_write + self.disk_tier = disk_tier + + +class DiskSku(_serialization.Model): + """The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. + + :ivar name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype name: str or ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSkuName + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[Union[str, "_models.DiskSkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :paramtype name: str or ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSkuName + """ + super().__init__(**kwargs) + self.name = name + + +class DiskVolumeConfiguration(_serialization.Model): + """The disk configuration required for the selected volume. + + :ivar count: The total number of disks required for the concerned volume. + :vartype count: int + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar sku: The disk SKU details. + :vartype sku: ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSku + """ + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "size_gb": {"key": "sizeGB", "type": "int"}, + "sku": {"key": "sku", "type": "DiskSku"}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + size_gb: Optional[int] = None, + sku: Optional["_models.DiskSku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword count: The total number of disks required for the concerned volume. + :paramtype count: int + :keyword size_gb: The disk size in GB. + :paramtype size_gb: int + :keyword sku: The disk SKU details. + :paramtype sku: ~azure.mgmt.workloads.sapvirtualinstance.models.DiskSku + """ + super().__init__(**kwargs) + self.count = count + self.size_gb = size_gb + self.sku = sku + + +class EnqueueReplicationServerProperties(_serialization.Model): + """Defines the SAP Enqueue Replication Server (ERS) properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ers_version: Defines the type of Enqueue Replication Server. Known values are: + "EnqueueReplicator1" and "EnqueueReplicator2". + :vartype ers_version: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.EnqueueReplicationServerType + :ivar instance_no: ERS Instance Number. + :vartype instance_no: str + :ivar hostname: ERS SAP Hostname. + :vartype hostname: str + :ivar kernel_version: ERS SAP Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: ERS SAP Kernel Patch level. + :vartype kernel_patch: str + :ivar ip_address: ERS SAP IP Address. + :vartype ip_address: str + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + """ + + _validation = { + "ers_version": {"readonly": True}, + "instance_no": {"readonly": True}, + "hostname": {"readonly": True}, + "kernel_version": {"readonly": True}, + "kernel_patch": {"readonly": True}, + "ip_address": {"readonly": True}, + "health": {"readonly": True}, + } + + _attribute_map = { + "ers_version": {"key": "ersVersion", "type": "str"}, + "instance_no": {"key": "instanceNo", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "kernel_version": {"key": "kernelVersion", "type": "str"}, + "kernel_patch": {"key": "kernelPatch", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "health": {"key": "health", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ers_version = None + self.instance_no = None + self.hostname = None + self.kernel_version = None + self.kernel_patch = None + self.ip_address = None + self.health = None + + +class EnqueueServerProperties(_serialization.Model): + """Defines the SAP Enqueue Server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hostname: Enqueue Server SAP Hostname. + :vartype hostname: str + :ivar ip_address: Enqueue Server SAP IP Address. + :vartype ip_address: str + :ivar port: Enqueue Server Port. + :vartype port: int + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + """ + + _validation = { + "hostname": {"readonly": True}, + "ip_address": {"readonly": True}, + "port": {"readonly": True}, + "health": {"readonly": True}, + } + + _attribute_map = { + "hostname": {"key": "hostname", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "health": {"key": "health", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.hostname = None + self.ip_address = None + self.port = None + self.health = None + + +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 ErrorDefinition(_serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.workloads.sapvirtualinstance.models.ErrorDefinition] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDefinition]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.details = 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.workloads.sapvirtualinstance.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.workloads.sapvirtualinstance.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.workloads.sapvirtualinstance.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.workloads.sapvirtualinstance.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class SoftwareConfiguration(_serialization.Model): + """The SAP Software configuration Input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExternalInstallationSoftwareConfiguration, SAPInstallWithoutOSConfigSoftwareConfiguration, + ServiceInitiatedSoftwareConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: The SAP software installation Type. Required. Known values + are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSoftwareInstallationType + """ + + _validation = { + "software_installation_type": {"required": True}, + } + + _attribute_map = { + "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, + } + + _subtype_map = { + "software_installation_type": { + "External": "ExternalInstallationSoftwareConfiguration", + "SAPInstallWithoutOSConfig": "SAPInstallWithoutOSConfigSoftwareConfiguration", + "ServiceInitiated": "ServiceInitiatedSoftwareConfiguration", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.software_installation_type: Optional[str] = None + + +class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration): + """The SAP Software configuration Input when the software is installed externally outside the + service. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: The SAP software installation Type. Required. Known values + are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSoftwareInstallationType + :ivar central_server_vm_id: The resource ID of the virtual machine containing the central + server instance. + :vartype central_server_vm_id: str + """ + + _validation = { + "software_installation_type": {"required": True}, + } + + _attribute_map = { + "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, + "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, + } + + def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword central_server_vm_id: The resource ID of the virtual machine containing the central + server instance. + :paramtype central_server_vm_id: str + """ + super().__init__(**kwargs) + self.software_installation_type: str = "External" + self.central_server_vm_id = central_server_vm_id + + +class GatewayServerProperties(_serialization.Model): + """Defines the SAP Gateway Server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar port: Gateway Port. + :vartype port: int + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + """ + + _validation = { + "port": {"readonly": True}, + "health": {"readonly": True}, + } + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + "health": {"key": "health", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.port = None + self.health = None + + +class HighAvailabilityConfiguration(_serialization.Model): + """Gets or sets the high availability configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar high_availability_type: The high availability type. Required. Known values are: + "AvailabilitySet" and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + + _validation = { + "high_availability_type": {"required": True}, + } + + _attribute_map = { + "high_availability_type": {"key": "highAvailabilityType", "type": "str"}, + } + + def __init__(self, *, high_availability_type: Union[str, "_models.SAPHighAvailabilityType"], **kwargs: Any) -> None: + """ + :keyword high_availability_type: The high availability type. Required. Known values are: + "AvailabilitySet" and "AvailabilityZone". + :paramtype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + super().__init__(**kwargs) + self.high_availability_type = high_availability_type + + +class HighAvailabilitySoftwareConfiguration(_serialization.Model): + """Gets or sets the HA software configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar fencing_client_id: The fencing client id. Required. + :vartype fencing_client_id: str + :ivar fencing_client_password: The fencing client id secret/password. The secret should never + expire. This will be used pacemaker to start/stop the cluster VMs. Required. + :vartype fencing_client_password: str + """ + + _validation = { + "fencing_client_id": {"required": True}, + "fencing_client_password": {"required": True}, + } + + _attribute_map = { + "fencing_client_id": {"key": "fencingClientId", "type": "str"}, + "fencing_client_password": {"key": "fencingClientPassword", "type": "str"}, + } + + def __init__(self, *, fencing_client_id: str, fencing_client_password: str, **kwargs: Any) -> None: + """ + :keyword fencing_client_id: The fencing client id. Required. + :paramtype fencing_client_id: str + :keyword fencing_client_password: The fencing client id secret/password. The secret should + never expire. This will be used pacemaker to start/stop the cluster VMs. Required. + :paramtype fencing_client_password: str + """ + super().__init__(**kwargs) + self.fencing_client_id = fencing_client_id + self.fencing_client_password = fencing_client_password + + +class ImageReference(_serialization.Model): + """Specifies information about the image to use. You can specify information about platform + images, marketplace images, or virtual machine images. This element is required when you want + to use a platform image, marketplace image, or virtual machine image, but is not used in other + creation operations. NOTE: Image reference publisher and offer can only be set when you create + the scale set. + + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar offer: Specifies the offer of the platform image or marketplace image used to create the + virtual machine. + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: Specifies the version of the platform image or marketplace image used to create + the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and + Build are decimal numbers. Specify 'latest' to use the latest version of an image available at + deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + time even if a new version becomes available. + :vartype version: str + :ivar id: Specifies the ARM resource ID of the Azure Compute Gallery image version used for + creating ACSS VMs. You will need to provide this input when you choose to deploy virtual + machines in ACSS with OS image from the Azure Compute gallery. + :vartype id: str + """ + + _attribute_map = { + "publisher": {"key": "publisher", "type": "str"}, + "offer": {"key": "offer", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword version: Specifies the version of the platform image or marketplace image used to + create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, + Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image + available at deploy time. Even if you use 'latest', the VM image will not automatically update + after deploy time even if a new version becomes available. + :paramtype version: str + :keyword id: Specifies the ARM resource ID of the Azure Compute Gallery image version used for + creating ACSS VMs. You will need to provide this input when you choose to deploy virtual + machines in ACSS with OS image from the Azure Compute gallery. + :paramtype id: str + """ + super().__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + self.id = id + + +class InfrastructureConfiguration(_serialization.Model): + """Deploy SAP Infrastructure Details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerConfiguration, ThreeTierConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + """ + + _validation = { + "deployment_type": {"required": True}, + "app_resource_group": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + "app_resource_group": {"key": "appResourceGroup", "type": "str"}, + } + + _subtype_map = { + "deployment_type": {"SingleServer": "SingleServerConfiguration", "ThreeTier": "ThreeTierConfiguration"} + } + + def __init__(self, *, app_resource_group: str, **kwargs: Any) -> None: + """ + :keyword app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :paramtype app_resource_group: str + """ + super().__init__(**kwargs) + self.deployment_type: Optional[str] = None + self.app_resource_group = app_resource_group + + +class OSConfiguration(_serialization.Model): + """Defines the OS configuration. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LinuxConfiguration, WindowsConfiguration + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.OSType + """ + + _validation = { + "os_type": {"required": True}, + } + + _attribute_map = { + "os_type": {"key": "osType", "type": "str"}, + } + + _subtype_map = {"os_type": {"Linux": "LinuxConfiguration", "Windows": "WindowsConfiguration"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.os_type: Optional[str] = None + + +class LinuxConfiguration(OSConfiguration): + """Specifies the Linux operating system settings on the virtual machine. + :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.OSType + :ivar disable_password_authentication: Specifies whether password authentication should be + disabled. + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, + please use 'sshKeyPair' instead). + :vartype ssh: ~azure.mgmt.workloads.sapvirtualinstance.models.SshConfiguration + :ivar ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. + :vartype ssh_key_pair: ~azure.mgmt.workloads.sapvirtualinstance.models.SshKeyPair + """ + + _validation = { + "os_type": {"required": True}, + } + + _attribute_map = { + "os_type": {"key": "osType", "type": "str"}, + "disable_password_authentication": {"key": "disablePasswordAuthentication", "type": "bool"}, + "ssh": {"key": "ssh", "type": "SshConfiguration"}, + "ssh_key_pair": {"key": "sshKeyPair", "type": "SshKeyPair"}, + } + + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["_models.SshConfiguration"] = None, + ssh_key_pair: Optional["_models.SshKeyPair"] = None, + **kwargs: Any + ) -> None: + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, + please use 'sshKeyPair' instead). + :paramtype ssh: ~azure.mgmt.workloads.sapvirtualinstance.models.SshConfiguration + :keyword ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. + :paramtype ssh_key_pair: ~azure.mgmt.workloads.sapvirtualinstance.models.SshKeyPair + """ + super().__init__(**kwargs) + self.os_type: str = "Linux" + self.disable_password_authentication = disable_password_authentication + self.ssh = ssh + self.ssh_key_pair = ssh_key_pair + + +class LoadBalancerDetails(_serialization.Model): + """The Load Balancer details such as Load Balancer ID. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :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 LoadBalancerResourceNames(_serialization.Model): + """The resource names object for load balancer and related resources. + + :ivar load_balancer_name: The full resource name for load balancer. If this value is not + provided, load balancer will be name as {ASCS/DB}-loadBalancer. + :vartype load_balancer_name: str + :ivar frontend_ip_configuration_names: The list of frontend IP configuration names. If provided + as input, size of this list should be 2 for cs layer and should be 1 for database layer. + :vartype frontend_ip_configuration_names: list[str] + :ivar backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one + backend pool and hence, size of this list should be 1. + :vartype backend_pool_names: list[str] + :ivar health_probe_names: The list of health probe names. If provided as input, size of this + list should be 2 for cs layer and should be 1 for database layer. + :vartype health_probe_names: list[str] + """ + + _validation = { + "frontend_ip_configuration_names": {"max_items": 2, "min_items": 0}, + "backend_pool_names": {"max_items": 1, "min_items": 0}, + "health_probe_names": {"max_items": 2, "min_items": 0}, + } + + _attribute_map = { + "load_balancer_name": {"key": "loadBalancerName", "type": "str"}, + "frontend_ip_configuration_names": {"key": "frontendIpConfigurationNames", "type": "[str]"}, + "backend_pool_names": {"key": "backendPoolNames", "type": "[str]"}, + "health_probe_names": {"key": "healthProbeNames", "type": "[str]"}, + } + + def __init__( + self, + *, + load_balancer_name: Optional[str] = None, + frontend_ip_configuration_names: Optional[List[str]] = None, + backend_pool_names: Optional[List[str]] = None, + health_probe_names: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword load_balancer_name: The full resource name for load balancer. If this value is not + provided, load balancer will be name as {ASCS/DB}-loadBalancer. + :paramtype load_balancer_name: str + :keyword frontend_ip_configuration_names: The list of frontend IP configuration names. If + provided as input, size of this list should be 2 for cs layer and should be 1 for database + layer. + :paramtype frontend_ip_configuration_names: list[str] + :keyword backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one + backend pool and hence, size of this list should be 1. + :paramtype backend_pool_names: list[str] + :keyword health_probe_names: The list of health probe names. If provided as input, size of this + list should be 2 for cs layer and should be 1 for database layer. + :paramtype health_probe_names: list[str] + """ + super().__init__(**kwargs) + self.load_balancer_name = load_balancer_name + self.frontend_ip_configuration_names = frontend_ip_configuration_names + self.backend_pool_names = backend_pool_names + self.health_probe_names = health_probe_names + + +class ManagedRGConfiguration(_serialization.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :vartype name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Managed resource group name. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + +class MessageServerProperties(_serialization.Model): + """Defines the SAP message server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ms_port: message server port. + :vartype ms_port: int + :ivar internal_ms_port: message server internal MS port. + :vartype internal_ms_port: int + :ivar http_port: message server HTTP Port. + :vartype http_port: int + :ivar https_port: message server HTTPS Port. + :vartype https_port: int + :ivar hostname: message server SAP Hostname. + :vartype hostname: str + :ivar ip_address: message server IP Address. + :vartype ip_address: str + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + """ + + _validation = { + "ms_port": {"readonly": True}, + "internal_ms_port": {"readonly": True}, + "http_port": {"readonly": True}, + "https_port": {"readonly": True}, + "hostname": {"readonly": True}, + "ip_address": {"readonly": True}, + "health": {"readonly": True}, + } + + _attribute_map = { + "ms_port": {"key": "msPort", "type": "int"}, + "internal_ms_port": {"key": "internalMsPort", "type": "int"}, + "http_port": {"key": "httpPort", "type": "int"}, + "https_port": {"key": "httpsPort", "type": "int"}, + "hostname": {"key": "hostname", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "health": {"key": "health", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ms_port = None + self.internal_ms_port = None + self.http_port = None + self.https_port = None + self.hostname = None + self.ip_address = None + self.health = None + + +class MountFileShareConfiguration(FileShareConfiguration): + """Gets or sets the file share configuration where the transport directory fileshare already + exists, and user wishes to mount the fileshare as a part of the create infra flow. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ConfigurationType + :ivar id: The fileshare resource ID. Required. + :vartype id: str + :ivar private_endpoint_id: The private endpoint resource ID. Required. + :vartype private_endpoint_id: str + """ + + _validation = { + "configuration_type": {"required": True}, + "id": {"required": True}, + "private_endpoint_id": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "private_endpoint_id": {"key": "privateEndpointId", "type": "str"}, + } + + def __init__( + self, *, id: str, private_endpoint_id: str, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword id: The fileshare resource ID. Required. + :paramtype id: str + :keyword private_endpoint_id: The private endpoint resource ID. Required. + :paramtype private_endpoint_id: str + """ + super().__init__(**kwargs) + self.configuration_type: str = "Mount" + self.id = id + self.private_endpoint_id = private_endpoint_id + + +class NetworkConfiguration(_serialization.Model): + """Defines the network configuration type for SAP system infrastructure that is being deployed. + + :ivar is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to the + network interface on all VMs of the SAP system being deployed. + :vartype is_secondary_ip_enabled: bool + """ + + _attribute_map = { + "is_secondary_ip_enabled": {"key": "isSecondaryIpEnabled", "type": "bool"}, + } + + def __init__(self, *, is_secondary_ip_enabled: bool = False, **kwargs: Any) -> None: + """ + :keyword is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to + the network interface on all VMs of the SAP system being deployed. + :paramtype is_secondary_ip_enabled: bool + """ + super().__init__(**kwargs) + self.is_secondary_ip_enabled = is_secondary_ip_enabled + + +class NetworkInterfaceResourceNames(_serialization.Model): + """The resource names object for network interface and related resources. + + :ivar network_interface_name: The full name for network interface. If name is not provided, + service uses a default name based on the deployment type. For SingleServer, default name is + {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + with an incrementor at the end in case of more than 1 instance per layer. For distributed and + HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end + in case of more than 1 instance per layer. + :vartype network_interface_name: str + """ + + _attribute_map = { + "network_interface_name": {"key": "networkInterfaceName", "type": "str"}, + } + + def __init__(self, *, network_interface_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword network_interface_name: The full name for network interface. If name is not provided, + service uses a default name based on the deployment type. For SingleServer, default name is + {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + with an incrementor at the end in case of more than 1 instance per layer. For distributed and + HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end + in case of more than 1 instance per layer. + :paramtype network_interface_name: str + """ + super().__init__(**kwargs) + self.network_interface_name = network_interface_name + + +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 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.workloads.sapvirtualinstance.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.workloads.sapvirtualinstance.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.workloads.sapvirtualinstance.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "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, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.workloads.sapvirtualinstance.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +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 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 = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _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, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +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: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: + list[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.workloads.sapvirtualinstance.models.ErrorDetail + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[OperationStatusResult]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: + list[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.workloads.sapvirtualinstance.models.ErrorDetail + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class OSProfile(_serialization.Model): + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be + changed once VM is provisioned. + + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + This property cannot be updated after the VM is created. :code:`
`:code:`
` + **Windows-only restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length (Linux):** 1 character + :code:`
`:code:`
` **Max-length (Linux):** 64 characters :code:`
`:code:`
` + **Max-length (Windows):** 20 characters. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length (Windows):** 8 characters :code:`
`:code:`
` + **Minimum-length (Linux):** 6 characters :code:`
`:code:`
` **Max-length (Windows):** 123 + characters :code:`
`:code:`
` **Max-length (Linux):** 72 characters + :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
` Has lower characters :code:`
`Has upper characters :code:`
` Has a + digit :code:`
` Has a special character (Regex match [\W_]) :code:`
`:code:`
` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
`:code:`
` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ + :code:`
`:code:`
` For resetting root password, see `Manage users, SSH, and check or + repair disks on Azure Linux VMs using the VMAccess Extension + `_. + :vartype admin_password: str + :ivar os_configuration: Specifies Windows operating system settings on the virtual machine. + :vartype os_configuration: ~azure.mgmt.workloads.sapvirtualinstance.models.OSConfiguration + """ + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "os_configuration": {"key": "osConfiguration", "type": "OSConfiguration"}, + } + + def __init__( + self, + *, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + os_configuration: Optional["_models.OSConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` This property cannot be updated after the VM is created. + :code:`
`:code:`
` **Windows-only restriction:** Cannot end in "." + :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
`:code:`
` **Minimum-length (Linux):** 1 character :code:`
`:code:`
` + **Max-length (Linux):** 64 characters :code:`
`:code:`
` **Max-length (Windows):** 20 + characters. + :paramtype admin_username: str + :keyword admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length (Windows):** 8 characters :code:`
`:code:`
` + **Minimum-length (Linux):** 6 characters :code:`
`:code:`
` **Max-length (Windows):** 123 + characters :code:`
`:code:`
` **Max-length (Linux):** 72 characters + :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
` Has lower characters :code:`
`Has upper characters :code:`
` Has a + digit :code:`
` Has a special character (Regex match [\W_]) :code:`
`:code:`
` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
`:code:`
` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ + :code:`
`:code:`
` For resetting root password, see `Manage users, SSH, and check or + repair disks on Azure Linux VMs using the VMAccess Extension + `_. + :paramtype admin_password: str + :keyword os_configuration: Specifies Windows operating system settings on the virtual machine. + :paramtype os_configuration: ~azure.mgmt.workloads.sapvirtualinstance.models.OSConfiguration + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.os_configuration = os_configuration + + +class OsSapConfiguration(_serialization.Model): + """Defines the OS and SAP Configurations for Deployment. + + :ivar deployer_vm_packages: The url and storage account ID where deployer VM packages are + uploaded. + :vartype deployer_vm_packages: + ~azure.mgmt.workloads.sapvirtualinstance.models.DeployerVmPackages + :ivar sap_fqdn: The FQDN to set for the SAP system. + :vartype sap_fqdn: str + """ + + _attribute_map = { + "deployer_vm_packages": {"key": "deployerVmPackages", "type": "DeployerVmPackages"}, + "sap_fqdn": {"key": "sapFqdn", "type": "str"}, + } + + def __init__( + self, + *, + deployer_vm_packages: Optional["_models.DeployerVmPackages"] = None, + sap_fqdn: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword deployer_vm_packages: The url and storage account ID where deployer VM packages are + uploaded. + :paramtype deployer_vm_packages: + ~azure.mgmt.workloads.sapvirtualinstance.models.DeployerVmPackages + :keyword sap_fqdn: The FQDN to set for the SAP system. + :paramtype sap_fqdn: str + """ + super().__init__(**kwargs) + self.deployer_vm_packages = deployer_vm_packages + self.sap_fqdn = sap_fqdn + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + 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.workloads.sapvirtualinstance.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.sapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class SAPApplicationServerInstance(TrackedResource): + """Define the SAP Application Server Instance 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}. + :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.workloads.sapvirtualinstance.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 properties: Defines the SAP Application Server instance properties. + :vartype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "SAPApplicationServerProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPApplicationServerProperties"] = 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 properties: Defines the SAP Application Server instance properties. + :paramtype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class SAPApplicationServerInstanceList(_serialization.Model): + """Defines the collection of SAP Application Server Instance resources. + + :ivar value: Gets the list of SAP Application Server instance resources. + :vartype value: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SAPApplicationServerInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SAPApplicationServerInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets the list of SAP Application Server instance resources. + :paramtype value: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPApplicationServerProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Defines the SAP Application Server instance properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar instance_no: Application server Instance Number. + :vartype instance_no: str + :ivar subnet: Application server Subnet. + :vartype subnet: str + :ivar hostname: Application server instance SAP hostname. + :vartype hostname: str + :ivar kernel_version: Application server instance SAP Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: Application server instance SAP Kernel Patch level. + :vartype kernel_patch: str + :ivar ip_address: Application server instance SAP IP Address. + :vartype ip_address: str + :ivar gateway_port: Application server instance gateway Port. + :vartype gateway_port: int + :ivar icm_http_port: Application server instance ICM HTTP Port. + :vartype icm_http_port: int + :ivar icm_https_port: Application server instance ICM HTTPS Port. + :vartype icm_https_port: int + :ivar dispatcher_status: Application server instance dispatcher status. + :vartype dispatcher_status: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Application Server Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines. + :vartype vm_details: + list[~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Application Instance errors. + :vartype errors: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceError + """ + + _validation = { + "instance_no": {"readonly": True}, + "subnet": {"readonly": True}, + "hostname": {"readonly": True}, + "kernel_version": {"readonly": True}, + "kernel_patch": {"readonly": True}, + "ip_address": {"readonly": True}, + "gateway_port": {"readonly": True}, + "icm_http_port": {"readonly": True}, + "icm_https_port": {"readonly": True}, + "dispatcher_status": {"readonly": True}, + "load_balancer_details": {"readonly": True}, + "vm_details": {"readonly": True}, + "status": {"readonly": True}, + "health": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "errors": {"readonly": True}, + } + + _attribute_map = { + "instance_no": {"key": "instanceNo", "type": "str"}, + "subnet": {"key": "subnet", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "kernel_version": {"key": "kernelVersion", "type": "str"}, + "kernel_patch": {"key": "kernelPatch", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "gateway_port": {"key": "gatewayPort", "type": "int"}, + "icm_http_port": {"key": "icmHttpPort", "type": "int"}, + "icm_https_port": {"key": "icmHttpsPort", "type": "int"}, + "dispatcher_status": {"key": "dispatcherStatus", "type": "str"}, + "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, + "vm_details": {"key": "vmDetails", "type": "[ApplicationServerVmDetails]"}, + "status": {"key": "status", "type": "str"}, + "health": {"key": "health", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.instance_no = None + self.subnet = None + self.hostname = None + self.kernel_version = None + self.kernel_patch = None + self.ip_address = None + self.gateway_port = None + self.icm_http_port = None + self.icm_https_port = None + self.dispatcher_status = None + self.load_balancer_details = None + self.vm_details = None + self.status = None + self.health = None + self.provisioning_state = None + self.errors = None + + +class SAPAvailabilityZoneDetailsRequest(_serialization.Model): + """The SAP request to get list of availability zones. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: The geo-location where the SAP resources will be created. Required. + :vartype app_location: str + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + """ + + _validation = { + "app_location": {"required": True}, + "sap_product": {"required": True}, + "database_type": {"required": True}, + } + + _attribute_map = { + "app_location": {"key": "appLocation", "type": "str"}, + "sap_product": {"key": "sapProduct", "type": "str"}, + "database_type": {"key": "databaseType", "type": "str"}, + } + + def __init__( + self, + *, + app_location: str, + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the SAP resources will be created. Required. + :paramtype app_location: str + :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", + "S4HANA", and "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: + "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + """ + super().__init__(**kwargs) + self.app_location = app_location + self.sap_product = sap_product + self.database_type = database_type + + +class SAPAvailabilityZoneDetailsResult(_serialization.Model): + """The list of supported availability zone pairs which are part of SAP HA deployment. + + :ivar availability_zone_pairs: Gets the list of availability zone pairs. + :vartype availability_zone_pairs: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZonePair] + """ + + _attribute_map = { + "availability_zone_pairs": {"key": "availabilityZonePairs", "type": "[SAPAvailabilityZonePair]"}, + } + + def __init__( + self, *, availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, **kwargs: Any + ) -> None: + """ + :keyword availability_zone_pairs: Gets the list of availability zone pairs. + :paramtype availability_zone_pairs: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZonePair] + """ + super().__init__(**kwargs) + self.availability_zone_pairs = availability_zone_pairs + + +class SAPAvailabilityZonePair(_serialization.Model): + """The SAP Availability Zone Pair. + + :ivar zone_a: The zone A. + :vartype zone_a: int + :ivar zone_b: The zone B. + :vartype zone_b: int + """ + + _attribute_map = { + "zone_a": {"key": "zoneA", "type": "int"}, + "zone_b": {"key": "zoneB", "type": "int"}, + } + + def __init__(self, *, zone_a: Optional[int] = None, zone_b: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword zone_a: The zone A. + :paramtype zone_a: int + :keyword zone_b: The zone B. + :paramtype zone_b: int + """ + super().__init__(**kwargs) + self.zone_a = zone_a + self.zone_b = zone_b + + +class SAPCentralInstanceList(_serialization.Model): + """Defines the collection of SAP Central Services Instance resources. + + :ivar value: Gets the list of SAP central services instance resources. + :vartype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SAPCentralServerInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SAPCentralServerInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets the list of SAP central services instance resources. + :paramtype value: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPCentralServerInstance(TrackedResource): + """Define the SAP Central Services Instance 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}. + :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.workloads.sapvirtualinstance.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 properties: Defines the SAP Central Services Instance properties. + :vartype properties: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "SAPCentralServerProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPCentralServerProperties"] = 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 properties: Defines the SAP Central Services Instance properties. + :paramtype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class SAPCentralServerProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Defines the SAP Central Services Instance properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar instance_no: The central services instance number. + :vartype instance_no: str + :ivar subnet: The central services instance subnet. + :vartype subnet: str + :ivar message_server_properties: Defines the SAP message server properties. + :vartype message_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.MessageServerProperties + :ivar enqueue_server_properties: Defines the SAP Enqueue Server properties. + :vartype enqueue_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.EnqueueServerProperties + :ivar gateway_server_properties: Defines the SAP Gateway Server properties. + :vartype gateway_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.GatewayServerProperties + :ivar enqueue_replication_server_properties: Defines the SAP Enqueue Replication Server (ERS) + properties. + :vartype enqueue_replication_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.EnqueueReplicationServerProperties + :ivar kernel_version: The central services instance Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: The central services instance Kernel Patch level. + :vartype kernel_patch: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to ASCS + Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines corresponding to the Central Services instance. + :vartype vm_details: + list[~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the errors related to SAP Central Services Instance resource. + :vartype errors: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceError + """ + + _validation = { + "instance_no": {"readonly": True}, + "subnet": {"readonly": True}, + "kernel_version": {"readonly": True}, + "kernel_patch": {"readonly": True}, + "load_balancer_details": {"readonly": True}, + "vm_details": {"readonly": True}, + "status": {"readonly": True}, + "health": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "errors": {"readonly": True}, + } + + _attribute_map = { + "instance_no": {"key": "instanceNo", "type": "str"}, + "subnet": {"key": "subnet", "type": "str"}, + "message_server_properties": {"key": "messageServerProperties", "type": "MessageServerProperties"}, + "enqueue_server_properties": {"key": "enqueueServerProperties", "type": "EnqueueServerProperties"}, + "gateway_server_properties": {"key": "gatewayServerProperties", "type": "GatewayServerProperties"}, + "enqueue_replication_server_properties": { + "key": "enqueueReplicationServerProperties", + "type": "EnqueueReplicationServerProperties", + }, + "kernel_version": {"key": "kernelVersion", "type": "str"}, + "kernel_patch": {"key": "kernelPatch", "type": "str"}, + "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, + "vm_details": {"key": "vmDetails", "type": "[CentralServerVmDetails]"}, + "status": {"key": "status", "type": "str"}, + "health": {"key": "health", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, + } + + def __init__( + self, + *, + message_server_properties: Optional["_models.MessageServerProperties"] = None, + enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = None, + gateway_server_properties: Optional["_models.GatewayServerProperties"] = None, + enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword message_server_properties: Defines the SAP message server properties. + :paramtype message_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.MessageServerProperties + :keyword enqueue_server_properties: Defines the SAP Enqueue Server properties. + :paramtype enqueue_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.EnqueueServerProperties + :keyword gateway_server_properties: Defines the SAP Gateway Server properties. + :paramtype gateway_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.GatewayServerProperties + :keyword enqueue_replication_server_properties: Defines the SAP Enqueue Replication Server + (ERS) properties. + :paramtype enqueue_replication_server_properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.EnqueueReplicationServerProperties + """ + super().__init__(**kwargs) + self.instance_no = None + self.subnet = None + self.message_server_properties = message_server_properties + self.enqueue_server_properties = enqueue_server_properties + self.gateway_server_properties = gateway_server_properties + self.enqueue_replication_server_properties = enqueue_replication_server_properties + self.kernel_version = None + self.kernel_patch = None + self.load_balancer_details = None + self.vm_details = None + self.status = None + self.health = None + self.provisioning_state = None + self.errors = None + + +class SAPDatabaseInstance(TrackedResource): + """Define the Database 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}. + :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.workloads.sapvirtualinstance.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 properties: Defines the Database properties. + :vartype properties: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + "properties": {"key": "properties", "type": "SAPDatabaseProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPDatabaseProperties"] = 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 properties: Defines the Database properties. + :paramtype properties: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class SAPDatabaseInstanceList(_serialization.Model): + """Defines the collection of SAP Database Instances. + + :ivar value: Gets the list of SAP Database instances. + :vartype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SAPDatabaseInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SAPDatabaseInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets the list of SAP Database instances. + :paramtype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPDatabaseProperties(_serialization.Model): + """Defines the Database properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subnet: Database subnet. + :vartype subnet: str + :ivar database_sid: Database SID name. + :vartype database_sid: str + :ivar database_type: Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or + MS SQL Server. + :vartype database_type: str + :ivar ip_address: Database IP Address. + :vartype ip_address: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Database Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines corresponding to the Database resource. + :vartype vm_details: list[~azure.mgmt.workloads.sapvirtualinstance.models.DatabaseVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the errors related to Database resource. + :vartype errors: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceError + """ + + _validation = { + "subnet": {"readonly": True}, + "database_sid": {"readonly": True}, + "database_type": {"readonly": True}, + "ip_address": {"readonly": True}, + "load_balancer_details": {"readonly": True}, + "vm_details": {"readonly": True}, + "status": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "errors": {"readonly": True}, + } + + _attribute_map = { + "subnet": {"key": "subnet", "type": "str"}, + "database_sid": {"key": "databaseSid", "type": "str"}, + "database_type": {"key": "databaseType", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, + "vm_details": {"key": "vmDetails", "type": "[DatabaseVmDetails]"}, + "status": {"key": "status", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.subnet = None + self.database_sid = None + self.database_type = None + self.ip_address = None + self.load_balancer_details = None + self.vm_details = None + self.status = None + self.provisioning_state = None + self.errors = None + + +class SAPDiskConfiguration(_serialization.Model): + """The SAP Disk Configuration contains 'recommended disk' details and list of supported disks + detail for a volume type. + + :ivar recommended_configuration: The recommended disk details for a given VM Sku. + :vartype recommended_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskVolumeConfiguration + :ivar supported_configurations: The list of supported disks for a given VM Sku. + :vartype supported_configurations: + list[~azure.mgmt.workloads.sapvirtualinstance.models.DiskDetails] + """ + + _attribute_map = { + "recommended_configuration": {"key": "recommendedConfiguration", "type": "DiskVolumeConfiguration"}, + "supported_configurations": {"key": "supportedConfigurations", "type": "[DiskDetails]"}, + } + + def __init__( + self, + *, + recommended_configuration: Optional["_models.DiskVolumeConfiguration"] = None, + supported_configurations: Optional[List["_models.DiskDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword recommended_configuration: The recommended disk details for a given VM Sku. + :paramtype recommended_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskVolumeConfiguration + :keyword supported_configurations: The list of supported disks for a given VM Sku. + :paramtype supported_configurations: + list[~azure.mgmt.workloads.sapvirtualinstance.models.DiskDetails] + """ + super().__init__(**kwargs) + self.recommended_configuration = recommended_configuration + self.supported_configurations = supported_configurations + + +class SAPDiskConfigurationsRequest(_serialization.Model): + """The SAP request to get list of disk configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: The geo-location where the SAP resources will be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar db_vm_sku: The VM SKU for database instance. Required. + :vartype db_vm_sku: str + """ + + _validation = { + "app_location": {"required": True}, + "environment": {"required": True}, + "sap_product": {"required": True}, + "database_type": {"required": True}, + "deployment_type": {"required": True}, + "db_vm_sku": {"required": True}, + } + + _attribute_map = { + "app_location": {"key": "appLocation", "type": "str"}, + "environment": {"key": "environment", "type": "str"}, + "sap_product": {"key": "sapProduct", "type": "str"}, + "database_type": {"key": "databaseType", "type": "str"}, + "deployment_type": {"key": "deploymentType", "type": "str"}, + "db_vm_sku": {"key": "dbVmSku", "type": "str"}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + db_vm_sku: str, + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the SAP resources will be created. Required. + :paramtype app_location: str + :keyword environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :paramtype environment: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", + "S4HANA", and "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: + "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known + values are: "SingleServer" and "ThreeTier". + :paramtype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :keyword db_vm_sku: The VM SKU for database instance. Required. + :paramtype db_vm_sku: str + """ + super().__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.database_type = database_type + self.deployment_type = deployment_type + self.db_vm_sku = db_vm_sku + + +class SAPDiskConfigurationsResult(_serialization.Model): + """The list of disk configuration for vmSku which are part of SAP deployment. + + :ivar volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype volume_configurations: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfiguration] + """ + + _attribute_map = { + "volume_configurations": {"key": "volumeConfigurations", "type": "{SAPDiskConfiguration}"}, + } + + def __init__( + self, *, volume_configurations: Optional[Dict[str, "_models.SAPDiskConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :paramtype volume_configurations: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfiguration] + """ + super().__init__(**kwargs) + self.volume_configurations = volume_configurations + + +class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration): + """The SAP Software configuration Input when the software is to be installed by service without OS + Configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: The SAP software installation Type. Required. Known values + are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSoftwareInstallationType + :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :vartype bom_url: str + :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. + :vartype sap_bits_storage_account_id: str + :ivar software_version: The software version to install. Required. + :vartype software_version: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + """ + + _validation = { + "software_installation_type": {"required": True}, + "bom_url": {"required": True}, + "sap_bits_storage_account_id": {"required": True}, + "software_version": {"required": True}, + } + + _attribute_map = { + "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, + "bom_url": {"key": "bomUrl", "type": "str"}, + "sap_bits_storage_account_id": {"key": "sapBitsStorageAccountId", "type": "str"}, + "software_version": {"key": "softwareVersion", "type": "str"}, + "high_availability_software_configuration": { + "key": "highAvailabilitySoftwareConfiguration", + "type": "HighAvailabilitySoftwareConfiguration", + }, + } + + def __init__( + self, + *, + bom_url: str, + sap_bits_storage_account_id: str, + software_version: str, + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :paramtype bom_url: str + :keyword sap_bits_storage_account_id: The SAP bits storage account id. Required. + :paramtype sap_bits_storage_account_id: str + :keyword software_version: The software version to install. Required. + :paramtype software_version: str + :keyword high_availability_software_configuration: Gets or sets the HA software configuration. + :paramtype high_availability_software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + """ + super().__init__(**kwargs) + self.software_installation_type: str = "SAPInstallWithoutOSConfig" + self.bom_url = bom_url + self.sap_bits_storage_account_id = sap_bits_storage_account_id + self.software_version = software_version + self.high_availability_software_configuration = high_availability_software_configuration + + +class SAPSizingRecommendationRequest(_serialization.Model): + """The SAP Sizing Recommendation request. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: The geo-location where the resource is to be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar saps: The SAP Application Performance Standard measurement. Required. + :vartype saps: int + :ivar db_memory: The database memory configuration. Required. + :vartype db_memory: int + :ivar database_type: The database type. Required. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :ivar db_scale_method: The DB scale method. "ScaleUp" + :vartype db_scale_method: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseScaleMethod + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" + and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + + _validation = { + "app_location": {"required": True}, + "environment": {"required": True}, + "sap_product": {"required": True}, + "deployment_type": {"required": True}, + "saps": {"required": True}, + "db_memory": {"required": True}, + "database_type": {"required": True}, + } + + _attribute_map = { + "app_location": {"key": "appLocation", "type": "str"}, + "environment": {"key": "environment", "type": "str"}, + "sap_product": {"key": "sapProduct", "type": "str"}, + "deployment_type": {"key": "deploymentType", "type": "str"}, + "saps": {"key": "saps", "type": "int"}, + "db_memory": {"key": "dbMemory", "type": "int"}, + "database_type": {"key": "databaseType", "type": "str"}, + "db_scale_method": {"key": "dbScaleMethod", "type": "str"}, + "high_availability_type": {"key": "highAvailabilityType", "type": "str"}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + saps: int, + db_memory: int, + database_type: Union[str, "_models.SAPDatabaseType"], + db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = None, + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the resource is to be created. Required. + :paramtype app_location: str + :keyword environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :paramtype environment: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", + "S4HANA", and "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known + values are: "SingleServer" and "ThreeTier". + :paramtype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :keyword saps: The SAP Application Performance Standard measurement. Required. + :paramtype saps: int + :keyword db_memory: The database memory configuration. Required. + :paramtype db_memory: int + :keyword database_type: The database type. Required. Known values are: "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :keyword db_scale_method: The DB scale method. "ScaleUp" + :paramtype db_scale_method: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseScaleMethod + :keyword high_availability_type: The high availability type. Known values are: + "AvailabilitySet" and "AvailabilityZone". + :paramtype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + super().__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.deployment_type = deployment_type + self.saps = saps + self.db_memory = db_memory + self.database_type = database_type + self.db_scale_method = db_scale_method + self.high_availability_type = high_availability_type + + +class SAPSizingRecommendationResult(_serialization.Model): + """The SAP sizing recommendation result. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerRecommendationResult, ThreeTierRecommendationResult + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + """ + + _validation = { + "deployment_type": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + } + + _subtype_map = { + "deployment_type": { + "SingleServer": "SingleServerRecommendationResult", + "ThreeTier": "ThreeTierRecommendationResult", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.deployment_type: Optional[str] = None + + +class SAPSupportedResourceSkusResult(_serialization.Model): + """The list of supported SKUs for different resources which are part of SAP deployment. + + :ivar supported_skus: Gets the list of SAP supported SKUs. + :vartype supported_skus: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSku] + """ + + _attribute_map = { + "supported_skus": {"key": "supportedSkus", "type": "[SAPSupportedSku]"}, + } + + def __init__(self, *, supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, **kwargs: Any) -> None: + """ + :keyword supported_skus: Gets the list of SAP supported SKUs. + :paramtype supported_skus: + list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSku] + """ + super().__init__(**kwargs) + self.supported_skus = supported_skus + + +class SAPSupportedSku(_serialization.Model): + """The SAP supported SKU. + + :ivar vm_sku: The VM Sku. + :vartype vm_sku: str + :ivar is_app_server_certified: True if the Sku is certified for App server in the SAP system. + :vartype is_app_server_certified: bool + :ivar is_database_certified: True if the Sku is certified for Database server in the SAP + system. + :vartype is_database_certified: bool + """ + + _attribute_map = { + "vm_sku": {"key": "vmSku", "type": "str"}, + "is_app_server_certified": {"key": "isAppServerCertified", "type": "bool"}, + "is_database_certified": {"key": "isDatabaseCertified", "type": "bool"}, + } + + def __init__( + self, + *, + vm_sku: Optional[str] = None, + is_app_server_certified: Optional[bool] = None, + is_database_certified: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword vm_sku: The VM Sku. + :paramtype vm_sku: str + :keyword is_app_server_certified: True if the Sku is certified for App server in the SAP + system. + :paramtype is_app_server_certified: bool + :keyword is_database_certified: True if the Sku is certified for Database server in the SAP + system. + :paramtype is_database_certified: bool + """ + super().__init__(**kwargs) + self.vm_sku = vm_sku + self.is_app_server_certified = is_app_server_certified + self.is_database_certified = is_database_certified + + +class SAPSupportedSkusRequest(_serialization.Model): + """The SAP request to get list of supported SKUs. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: The geo-location where the resource is to be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" + and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + + _validation = { + "app_location": {"required": True}, + "environment": {"required": True}, + "sap_product": {"required": True}, + "deployment_type": {"required": True}, + "database_type": {"required": True}, + } + + _attribute_map = { + "app_location": {"key": "appLocation", "type": "str"}, + "environment": {"key": "environment", "type": "str"}, + "sap_product": {"key": "sapProduct", "type": "str"}, + "deployment_type": {"key": "deploymentType", "type": "str"}, + "database_type": {"key": "databaseType", "type": "str"}, + "high_availability_type": {"key": "highAvailabilityType", "type": "str"}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + database_type: Union[str, "_models.SAPDatabaseType"], + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_location: The geo-location where the resource is to be created. Required. + :paramtype app_location: str + :keyword environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :paramtype environment: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", + "S4HANA", and "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known + values are: "SingleServer" and "ThreeTier". + :paramtype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: + "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :keyword high_availability_type: The high availability type. Known values are: + "AvailabilitySet" and "AvailabilityZone". + :paramtype high_availability_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHighAvailabilityType + """ + super().__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.deployment_type = deployment_type + self.database_type = database_type + self.high_availability_type = high_availability_type + + +class SAPVirtualInstance(TrackedResource): + """Define the Virtual Instance for SAP solutions 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}. + :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.workloads.sapvirtualinstance.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 (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedServiceIdentity + :ivar properties: Defines the Virtual Instance for SAP solutions resource properties. Required. + :vartype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceProperties + """ + + _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": "UserAssignedServiceIdentity"}, + "properties": {"key": "properties", "type": "SAPVirtualInstanceProperties"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.SAPVirtualInstanceProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = 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 (user assigned identities). + :paramtype identity: + ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedServiceIdentity + :keyword properties: Defines the Virtual Instance for SAP solutions resource properties. + Required. + :paramtype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.properties = properties + + +class SAPVirtualInstanceError(_serialization.Model): + """An error response from the Virtual Instance for SAP Workload service. + + :ivar properties: The Virtual Instance for SAP error body. + :vartype properties: ~azure.mgmt.workloads.sapvirtualinstance.models.ErrorDefinition + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ErrorDefinition"}, + } + + def __init__(self, *, properties: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The Virtual Instance for SAP error body. + :paramtype properties: ~azure.mgmt.workloads.sapvirtualinstance.models.ErrorDefinition + """ + super().__init__(**kwargs) + self.properties = properties + + +class SAPVirtualInstanceList(_serialization.Model): + """Defines the collection of Virtual Instance for SAP solutions resources. + + :ivar value: Gets the list of Virtual Instances for SAP solutions resources. + :vartype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SAPVirtualInstance]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SAPVirtualInstance"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Gets the list of Virtual Instances for SAP solutions resources. + :paramtype value: list[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPVirtualInstanceProperties(_serialization.Model): + """Defines the Virtual Instance for SAP solutions resource 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 environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :ivar managed_resources_network_access_type: Specifies the network access configuration for the + resources that will be deployed in the Managed Resource Group. The options to choose from are + Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled + on the subnets in which the SAP VMs exist. This is required for establishing connectivity + between VM extensions and the managed resource group storage account. This setting is currently + applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :vartype managed_resources_network_access_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedResourcesNetworkAccessType + :ivar configuration: Defines if the SAP system is being created using Azure Center for SAP + solutions (ACSS) or if an existing SAP system is being registered with ACSS. Required. + :vartype configuration: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfiguration + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedRGConfiguration + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPHealthState + :ivar state: Defines the Virtual Instance for SAP state. Known values are: + "InfrastructureDeploymentPending", "InfrastructureDeploymentInProgress", + "InfrastructureDeploymentFailed", "SoftwareInstallationPending", + "SoftwareInstallationInProgress", "SoftwareInstallationFailed", "SoftwareDetectionInProgress", + "SoftwareDetectionFailed", "DiscoveryPending", "DiscoveryInProgress", "DiscoveryFailed", + "RegistrationComplete", and "ACSSInstallationBlocked". + :vartype state: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Indicates any errors on the Virtual Instance for SAP solutions resource. + :vartype errors: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstanceError + """ + + _validation = { + "environment": {"required": True}, + "sap_product": {"required": True}, + "configuration": {"required": True}, + "status": {"readonly": True}, + "health": {"readonly": True}, + "state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "errors": {"readonly": True}, + } + + _attribute_map = { + "environment": {"key": "environment", "type": "str"}, + "sap_product": {"key": "sapProduct", "type": "str"}, + "managed_resources_network_access_type": {"key": "managedResourcesNetworkAccessType", "type": "str"}, + "configuration": {"key": "configuration", "type": "SAPConfiguration"}, + "managed_resource_group_configuration": { + "key": "managedResourceGroupConfiguration", + "type": "ManagedRGConfiguration", + }, + "status": {"key": "status", "type": "str"}, + "health": {"key": "health", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, + } + + def __init__( + self, + *, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + configuration: "_models.SAPConfiguration", + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :paramtype environment: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPEnvironmentType + :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", + "S4HANA", and "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPProductType + :keyword managed_resources_network_access_type: Specifies the network access configuration for + the resources that will be deployed in the Managed Resource Group. The options to choose from + are Public and Private. If 'Private' is chosen, the Storage Account service tag should be + enabled on the subnets in which the SAP VMs exist. This is required for establishing + connectivity between VM extensions and the managed resource group storage account. This setting + is currently applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :paramtype managed_resources_network_access_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedResourcesNetworkAccessType + :keyword configuration: Defines if the SAP system is being created using Azure Center for SAP + solutions (ACSS) or if an existing SAP system is being registered with ACSS. Required. + :paramtype configuration: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPConfiguration + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedRGConfiguration + """ + super().__init__(**kwargs) + self.environment = environment + self.sap_product = sap_product + self.managed_resources_network_access_type = managed_resources_network_access_type + self.configuration = configuration + self.managed_resource_group_configuration = managed_resource_group_configuration + self.status = None + self.health = None + self.state = None + self.provisioning_state = None + self.errors = None + + +class ServiceInitiatedSoftwareConfiguration(SoftwareConfiguration): + """The SAP Software configuration Input when the software is to be installed by service. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: The SAP software installation Type. Required. Known values + are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSoftwareInstallationType + :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :vartype bom_url: str + :ivar software_version: The software version to install. Required. + :vartype software_version: str + :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. + :vartype sap_bits_storage_account_id: str + :ivar sap_fqdn: The FQDN to set for the SAP system during install. Required. + :vartype sap_fqdn: str + :ivar ssh_private_key: The SSH private key. Required. + :vartype ssh_private_key: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + """ + + _validation = { + "software_installation_type": {"required": True}, + "bom_url": {"required": True}, + "software_version": {"required": True}, + "sap_bits_storage_account_id": {"required": True}, + "sap_fqdn": {"required": True}, + "ssh_private_key": {"required": True}, + } + + _attribute_map = { + "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, + "bom_url": {"key": "bomUrl", "type": "str"}, + "software_version": {"key": "softwareVersion", "type": "str"}, + "sap_bits_storage_account_id": {"key": "sapBitsStorageAccountId", "type": "str"}, + "sap_fqdn": {"key": "sapFqdn", "type": "str"}, + "ssh_private_key": {"key": "sshPrivateKey", "type": "str"}, + "high_availability_software_configuration": { + "key": "highAvailabilitySoftwareConfiguration", + "type": "HighAvailabilitySoftwareConfiguration", + }, + } + + def __init__( + self, + *, + bom_url: str, + software_version: str, + sap_bits_storage_account_id: str, + sap_fqdn: str, + ssh_private_key: str, + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :paramtype bom_url: str + :keyword software_version: The software version to install. Required. + :paramtype software_version: str + :keyword sap_bits_storage_account_id: The SAP bits storage account id. Required. + :paramtype sap_bits_storage_account_id: str + :keyword sap_fqdn: The FQDN to set for the SAP system during install. Required. + :paramtype sap_fqdn: str + :keyword ssh_private_key: The SSH private key. Required. + :paramtype ssh_private_key: str + :keyword high_availability_software_configuration: Gets or sets the HA software configuration. + :paramtype high_availability_software_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + """ + super().__init__(**kwargs) + self.software_installation_type: str = "ServiceInitiated" + self.bom_url = bom_url + self.software_version = software_version + self.sap_bits_storage_account_id = sap_bits_storage_account_id + self.sap_fqdn = sap_fqdn + self.ssh_private_key = ssh_private_key + self.high_availability_software_configuration = high_availability_software_configuration + + +class SharedStorageResourceNames(_serialization.Model): + """The resource names object for shared storage. + + :ivar shared_storage_account_name: The full name of the shared storage account. If it is not + provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + :vartype shared_storage_account_name: str + :ivar shared_storage_account_private_end_point_name: The full name of private end point for the + shared storage account. If it is not provided, it will be defaulted to {storageAccountName}_pe. + :vartype shared_storage_account_private_end_point_name: str + """ + + _attribute_map = { + "shared_storage_account_name": {"key": "sharedStorageAccountName", "type": "str"}, + "shared_storage_account_private_end_point_name": { + "key": "sharedStorageAccountPrivateEndPointName", + "type": "str", + }, + } + + def __init__( + self, + *, + shared_storage_account_name: Optional[str] = None, + shared_storage_account_private_end_point_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword shared_storage_account_name: The full name of the shared storage account. If it is not + provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + :paramtype shared_storage_account_name: str + :keyword shared_storage_account_private_end_point_name: The full name of private end point for + the shared storage account. If it is not provided, it will be defaulted to + {storageAccountName}_pe. + :paramtype shared_storage_account_private_end_point_name: str + """ + super().__init__(**kwargs) + self.shared_storage_account_name = shared_storage_account_name + self.shared_storage_account_private_end_point_name = shared_storage_account_private_end_point_name + + +class SingleServerConfiguration(InfrastructureConfiguration): + """Gets or sets the single server configuration. For prerequisites for creating the + infrastructure, please see `here + `_. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration for the server. + :vartype network_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.NetworkConfiguration + :ivar database_type: The database type. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :ivar db_disk_configuration: Gets or sets the disk configuration. + :vartype db_disk_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: + ~azure.mgmt.workloads.sapvirtualinstance.models.SingleServerCustomResourceNames + """ + + _validation = { + "deployment_type": {"required": True}, + "app_resource_group": {"required": True}, + "subnet_id": {"required": True}, + "virtual_machine_configuration": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + "app_resource_group": {"key": "appResourceGroup", "type": "str"}, + "network_configuration": {"key": "networkConfiguration", "type": "NetworkConfiguration"}, + "database_type": {"key": "databaseType", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "virtual_machine_configuration": {"key": "virtualMachineConfiguration", "type": "VirtualMachineConfiguration"}, + "db_disk_configuration": {"key": "dbDiskConfiguration", "type": "DiskConfiguration"}, + "custom_resource_names": {"key": "customResourceNames", "type": "SingleServerCustomResourceNames"}, + } + + def __init__( + self, + *, + app_resource_group: str, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, + db_disk_configuration: Optional["_models.DiskConfiguration"] = None, + custom_resource_names: Optional["_models.SingleServerCustomResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :paramtype app_resource_group: str + :keyword network_configuration: Network configuration for the server. + :paramtype network_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.NetworkConfiguration + :keyword database_type: The database type. Known values are: "HANA" and "DB2". + :paramtype database_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseType + :keyword subnet_id: The subnet id. Required. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. + Required. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineConfiguration + :keyword db_disk_configuration: Gets or sets the disk configuration. + :paramtype db_disk_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.DiskConfiguration + :keyword custom_resource_names: The set of custom names to be used for underlying azure + resources that are part of the SAP system. + :paramtype custom_resource_names: + ~azure.mgmt.workloads.sapvirtualinstance.models.SingleServerCustomResourceNames + """ + super().__init__(app_resource_group=app_resource_group, **kwargs) + self.deployment_type: str = "SingleServer" + self.network_configuration = network_configuration + self.database_type = database_type + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.db_disk_configuration = db_disk_configuration + self.custom_resource_names = custom_resource_names + + +class SingleServerCustomResourceNames(_serialization.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a single server SAP system. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerFullResourceNames + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.NamingPatternType + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + } + + _subtype_map = {"naming_pattern_type": {"FullResourceName": "SingleServerFullResourceNames"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.naming_pattern_type: Optional[str] = None + + +class SingleServerFullResourceNames(SingleServerCustomResourceNames): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a single server SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.NamingPatternType + :ivar virtual_machine: The resource names object for virtual machine and related resources. + :vartype virtual_machine: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + "virtual_machine": {"key": "virtualMachine", "type": "VirtualMachineResourceNames"}, + } + + def __init__( + self, *, virtual_machine: Optional["_models.VirtualMachineResourceNames"] = None, **kwargs: Any + ) -> None: + """ + :keyword virtual_machine: The resource names object for virtual machine and related resources. + :paramtype virtual_machine: + ~azure.mgmt.workloads.sapvirtualinstance.models.VirtualMachineResourceNames + """ + super().__init__(**kwargs) + self.naming_pattern_type: str = "FullResourceName" + self.virtual_machine = virtual_machine + + +class SingleServerRecommendationResult(SAPSizingRecommendationResult): + """The recommended configuration for a single server SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar vm_sku: The recommended VM SKU for single server. + :vartype vm_sku: str + """ + + _validation = { + "deployment_type": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + "vm_sku": {"key": "vmSku", "type": "str"}, + } + + def __init__(self, *, vm_sku: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword vm_sku: The recommended VM SKU for single server. + :paramtype vm_sku: str + """ + super().__init__(**kwargs) + self.deployment_type: str = "SingleServer" + self.vm_sku = vm_sku + + +class SkipFileShareConfiguration(FileShareConfiguration): + """Gets or sets the file share configuration for scenarios where transport directory fileshare is + not created or required. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", + "CreateAndMount", and "Mount". + :vartype configuration_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ConfigurationType + """ + + _validation = { + "configuration_type": {"required": True}, + } + + _attribute_map = { + "configuration_type": {"key": "configurationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.configuration_type: str = "Skip" + + +class SshConfiguration(_serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.workloads.sapvirtualinstance.models.SshPublicKey] + """ + + _attribute_map = { + "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, + } + + def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.workloads.sapvirtualinstance.models.SshPublicKey] + """ + super().__init__(**kwargs) + self.public_keys = public_keys + + +class SshKeyPair(_serialization.Model): + """The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in + ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux + and Mac for Linux VMs in Azure + `_. + + :ivar public_key: SSH public key. + :vartype public_key: str + :ivar private_key: SSH private key. + :vartype private_key: str + """ + + _attribute_map = { + "public_key": {"key": "publicKey", "type": "str"}, + "private_key": {"key": "privateKey", "type": "str"}, + } + + def __init__(self, *, public_key: Optional[str] = None, private_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword public_key: SSH public key. + :paramtype public_key: str + :keyword private_key: SSH private key. + :paramtype private_key: str + """ + super().__init__(**kwargs) + self.public_key = public_key + self.private_key = private_key + + +class SshPublicKey(_serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the + public key is placed. + + :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :vartype key_data: str + """ + + _attribute_map = { + "key_data": {"key": "keyData", "type": "str"}, + } + + def __init__(self, *, key_data: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :paramtype key_data: str + """ + super().__init__(**kwargs) + self.key_data = key_data + + +class StartRequest(_serialization.Model): + """Start SAP instance(s) request body. + + :ivar start_vm: The boolean value indicates whether to start the virtual machines before + starting the SAP instances. + :vartype start_vm: bool + """ + + _attribute_map = { + "start_vm": {"key": "startVm", "type": "bool"}, + } + + def __init__(self, *, start_vm: bool = False, **kwargs: Any) -> None: + """ + :keyword start_vm: The boolean value indicates whether to start the virtual machines before + starting the SAP instances. + :paramtype start_vm: bool + """ + super().__init__(**kwargs) + self.start_vm = start_vm + + +class StopRequest(_serialization.Model): + """Stop SAP instance(s) request body. + + :ivar soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft shutdown + waits until the RFC/HTTP clients no longer consider the server for calls with load balancing. + Value 0 means that the kernel does not wait, but goes directly into the next shutdown state, + i.e. hard stop. + :vartype soft_stop_timeout_seconds: int + :ivar deallocate_vm: The boolean value indicates whether to Stop and deallocate the virtual + machines along with the SAP instances. + :vartype deallocate_vm: bool + """ + + _attribute_map = { + "soft_stop_timeout_seconds": {"key": "softStopTimeoutSeconds", "type": "int"}, + "deallocate_vm": {"key": "deallocateVm", "type": "bool"}, + } + + def __init__(self, *, soft_stop_timeout_seconds: int = 0, deallocate_vm: bool = False, **kwargs: Any) -> None: + """ + :keyword soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft + shutdown waits until the RFC/HTTP clients no longer consider the server for calls with load + balancing. Value 0 means that the kernel does not wait, but goes directly into the next + shutdown state, i.e. hard stop. + :paramtype soft_stop_timeout_seconds: int + :keyword deallocate_vm: The boolean value indicates whether to Stop and deallocate the virtual + machines along with the SAP instances. + :paramtype deallocate_vm: bool + """ + super().__init__(**kwargs) + self.soft_stop_timeout_seconds = soft_stop_timeout_seconds + self.deallocate_vm = deallocate_vm + + +class StorageConfiguration(_serialization.Model): + """Gets or sets the storage configuration. + + :ivar transport_file_share_configuration: The properties of the transport directory attached to + the VIS. The default for transportFileShareConfiguration is the createAndMount flow if storage + configuration is missing. + :vartype transport_file_share_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.FileShareConfiguration + """ + + _attribute_map = { + "transport_file_share_configuration": { + "key": "transportFileShareConfiguration", + "type": "FileShareConfiguration", + }, + } + + def __init__( + self, *, transport_file_share_configuration: Optional["_models.FileShareConfiguration"] = None, **kwargs: Any + ) -> None: + """ + :keyword transport_file_share_configuration: The properties of the transport directory attached + to the VIS. The default for transportFileShareConfiguration is the createAndMount flow if + storage configuration is missing. + :paramtype transport_file_share_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.FileShareConfiguration + """ + super().__init__(**kwargs) + self.transport_file_share_configuration = transport_file_share_configuration + + +class StorageInformation(_serialization.Model): + """Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared + Storage. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :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 SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class ThreeTierConfiguration(InfrastructureConfiguration): + """Gets or sets the three tier SAP configuration. For prerequisites for creating the + infrastructure, please see `here + `_. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration common to all servers. + :vartype network_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.NetworkConfiguration + :ivar central_server: The central server configuration. Required. + :vartype central_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerConfiguration + :ivar application_server: The application server configuration. Required. + :vartype application_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerConfiguration + :ivar database_server: The database configuration. Required. + :vartype database_server: ~azure.mgmt.workloads.sapvirtualinstance.models.DatabaseConfiguration + :ivar high_availability_config: The high availability configuration. + :vartype high_availability_config: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilityConfiguration + :ivar storage_configuration: The storage configuration. + :vartype storage_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.StorageConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: + ~azure.mgmt.workloads.sapvirtualinstance.models.ThreeTierCustomResourceNames + """ + + _validation = { + "deployment_type": {"required": True}, + "app_resource_group": {"required": True}, + "central_server": {"required": True}, + "application_server": {"required": True}, + "database_server": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + "app_resource_group": {"key": "appResourceGroup", "type": "str"}, + "network_configuration": {"key": "networkConfiguration", "type": "NetworkConfiguration"}, + "central_server": {"key": "centralServer", "type": "CentralServerConfiguration"}, + "application_server": {"key": "applicationServer", "type": "ApplicationServerConfiguration"}, + "database_server": {"key": "databaseServer", "type": "DatabaseConfiguration"}, + "high_availability_config": {"key": "highAvailabilityConfig", "type": "HighAvailabilityConfiguration"}, + "storage_configuration": {"key": "storageConfiguration", "type": "StorageConfiguration"}, + "custom_resource_names": {"key": "customResourceNames", "type": "ThreeTierCustomResourceNames"}, + } + + def __init__( + self, + *, + app_resource_group: str, + central_server: "_models.CentralServerConfiguration", + application_server: "_models.ApplicationServerConfiguration", + database_server: "_models.DatabaseConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = None, + storage_configuration: Optional["_models.StorageConfiguration"] = None, + custom_resource_names: Optional["_models.ThreeTierCustomResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :paramtype app_resource_group: str + :keyword network_configuration: Network configuration common to all servers. + :paramtype network_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.NetworkConfiguration + :keyword central_server: The central server configuration. Required. + :paramtype central_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerConfiguration + :keyword application_server: The application server configuration. Required. + :paramtype application_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerConfiguration + :keyword database_server: The database configuration. Required. + :paramtype database_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.DatabaseConfiguration + :keyword high_availability_config: The high availability configuration. + :paramtype high_availability_config: + ~azure.mgmt.workloads.sapvirtualinstance.models.HighAvailabilityConfiguration + :keyword storage_configuration: The storage configuration. + :paramtype storage_configuration: + ~azure.mgmt.workloads.sapvirtualinstance.models.StorageConfiguration + :keyword custom_resource_names: The set of custom names to be used for underlying azure + resources that are part of the SAP system. + :paramtype custom_resource_names: + ~azure.mgmt.workloads.sapvirtualinstance.models.ThreeTierCustomResourceNames + """ + super().__init__(app_resource_group=app_resource_group, **kwargs) + self.deployment_type: str = "ThreeTier" + self.network_configuration = network_configuration + self.central_server = central_server + self.application_server = application_server + self.database_server = database_server + self.high_availability_config = high_availability_config + self.storage_configuration = storage_configuration + self.custom_resource_names = custom_resource_names + + +class ThreeTierCustomResourceNames(_serialization.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a three tier SAP system. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ThreeTierFullResourceNames + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.NamingPatternType + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + } + + _subtype_map = {"naming_pattern_type": {"FullResourceName": "ThreeTierFullResourceNames"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.naming_pattern_type: Optional[str] = None + + +class ThreeTierFullResourceNames(ThreeTierCustomResourceNames): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a three tier SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.NamingPatternType + :ivar central_server: The full resource names object for central server layer resources. + :vartype central_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerFullResourceNames + :ivar application_server: The full resource names object for application layer resources. The + number of entries in this list should be equal to the number VMs to be created for application + layer. + :vartype application_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerFullResourceNames + :ivar database_server: The full resource names object for database layer resources. The number + of entries in this list should be equal to the number VMs to be created for database layer. + :vartype database_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.DatabaseServerFullResourceNames + :ivar shared_storage: The resource names object for shared storage. + :vartype shared_storage: + ~azure.mgmt.workloads.sapvirtualinstance.models.SharedStorageResourceNames + """ + + _validation = { + "naming_pattern_type": {"required": True}, + } + + _attribute_map = { + "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, + "central_server": {"key": "centralServer", "type": "CentralServerFullResourceNames"}, + "application_server": {"key": "applicationServer", "type": "ApplicationServerFullResourceNames"}, + "database_server": {"key": "databaseServer", "type": "DatabaseServerFullResourceNames"}, + "shared_storage": {"key": "sharedStorage", "type": "SharedStorageResourceNames"}, + } + + def __init__( + self, + *, + central_server: Optional["_models.CentralServerFullResourceNames"] = None, + application_server: Optional["_models.ApplicationServerFullResourceNames"] = None, + database_server: Optional["_models.DatabaseServerFullResourceNames"] = None, + shared_storage: Optional["_models.SharedStorageResourceNames"] = None, + **kwargs: Any + ) -> None: + """ + :keyword central_server: The full resource names object for central server layer resources. + :paramtype central_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.CentralServerFullResourceNames + :keyword application_server: The full resource names object for application layer resources. + The number of entries in this list should be equal to the number VMs to be created for + application layer. + :paramtype application_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.ApplicationServerFullResourceNames + :keyword database_server: The full resource names object for database layer resources. The + number of entries in this list should be equal to the number VMs to be created for database + layer. + :paramtype database_server: + ~azure.mgmt.workloads.sapvirtualinstance.models.DatabaseServerFullResourceNames + :keyword shared_storage: The resource names object for shared storage. + :paramtype shared_storage: + ~azure.mgmt.workloads.sapvirtualinstance.models.SharedStorageResourceNames + """ + super().__init__(**kwargs) + self.naming_pattern_type: str = "FullResourceName" + self.central_server = central_server + self.application_server = application_server + self.database_server = database_server + self.shared_storage = shared_storage + + +class ThreeTierRecommendationResult(SAPSizingRecommendationResult): + """The recommended configuration for a three tier SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDeploymentType + :ivar db_vm_sku: The database VM SKU. + :vartype db_vm_sku: str + :ivar database_instance_count: The database server instance count. + :vartype database_instance_count: int + :ivar central_server_vm_sku: The central server VM SKU. + :vartype central_server_vm_sku: str + :ivar central_server_instance_count: The central server instance count. + :vartype central_server_instance_count: int + :ivar application_server_vm_sku: The application server VM SKU. + :vartype application_server_vm_sku: str + :ivar application_server_instance_count: The application server instance count. + :vartype application_server_instance_count: int + """ + + _validation = { + "deployment_type": {"required": True}, + } + + _attribute_map = { + "deployment_type": {"key": "deploymentType", "type": "str"}, + "db_vm_sku": {"key": "dbVmSku", "type": "str"}, + "database_instance_count": {"key": "databaseInstanceCount", "type": "int"}, + "central_server_vm_sku": {"key": "centralServerVmSku", "type": "str"}, + "central_server_instance_count": {"key": "centralServerInstanceCount", "type": "int"}, + "application_server_vm_sku": {"key": "applicationServerVmSku", "type": "str"}, + "application_server_instance_count": {"key": "applicationServerInstanceCount", "type": "int"}, + } + + def __init__( + self, + *, + db_vm_sku: Optional[str] = None, + database_instance_count: Optional[int] = None, + central_server_vm_sku: Optional[str] = None, + central_server_instance_count: Optional[int] = None, + application_server_vm_sku: Optional[str] = None, + application_server_instance_count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword db_vm_sku: The database VM SKU. + :paramtype db_vm_sku: str + :keyword database_instance_count: The database server instance count. + :paramtype database_instance_count: int + :keyword central_server_vm_sku: The central server VM SKU. + :paramtype central_server_vm_sku: str + :keyword central_server_instance_count: The central server instance count. + :paramtype central_server_instance_count: int + :keyword application_server_vm_sku: The application server VM SKU. + :paramtype application_server_vm_sku: str + :keyword application_server_instance_count: The application server instance count. + :paramtype application_server_instance_count: int + """ + super().__init__(**kwargs) + self.deployment_type: str = "ThreeTier" + self.db_vm_sku = db_vm_sku + self.database_instance_count = database_instance_count + self.central_server_vm_sku = central_server_vm_sku + self.central_server_instance_count = central_server_instance_count + self.application_server_vm_sku = application_server_vm_sku + self.application_server_instance_count = application_server_instance_count + + +class UpdateSAPApplicationInstanceRequest(_serialization.Model): + """Defines the request body for updating SAP Application Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class UpdateSAPCentralInstanceRequest(_serialization.Model): + """Defines the request body for updating SAP Central Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class UpdateSAPDatabaseInstanceRequest(_serialization.Model): + """Defines the request body for updating SAP Database Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class UpdateSAPVirtualInstanceProperties(_serialization.Model): + """Defines the properties to be updated for Virtual Instance for SAP. + + :ivar managed_resources_network_access_type: Specifies the network access configuration for the + resources that will be deployed in the Managed Resource Group. The options to choose from are + Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled + on the subnets in which the SAP VMs exist. This is required for establishing connectivity + between VM extensions and the managed resource group storage account. This setting is currently + applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :vartype managed_resources_network_access_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedResourcesNetworkAccessType + """ + + _attribute_map = { + "managed_resources_network_access_type": {"key": "managedResourcesNetworkAccessType", "type": "str"}, + } + + def __init__( + self, + *, + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword managed_resources_network_access_type: Specifies the network access configuration for + the resources that will be deployed in the Managed Resource Group. The options to choose from + are Public and Private. If 'Private' is chosen, the Storage Account service tag should be + enabled on the subnets in which the SAP VMs exist. This is required for establishing + connectivity between VM extensions and the managed resource group storage account. This setting + is currently applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :paramtype managed_resources_network_access_type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedResourcesNetworkAccessType + """ + super().__init__(**kwargs) + self.managed_resources_network_access_type = managed_resources_network_access_type + + +class UpdateSAPVirtualInstanceRequest(_serialization.Model): + """Defines the request body for updating Virtual Instance for SAP. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedServiceIdentity + :ivar properties: Defines the properties to be updated for Virtual Instance for SAP. + :vartype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "UserAssignedServiceIdentity"}, + "properties": {"key": "properties", "type": "UpdateSAPVirtualInstanceProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.UserAssignedServiceIdentity"] = None, + properties: Optional["_models.UpdateSAPVirtualInstanceProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: + ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedServiceIdentity + :keyword properties: Defines the properties to be updated for Virtual Instance for SAP. + :paramtype properties: + ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.properties = properties + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedServiceIdentity(_serialization.Model): + """Managed service identity (user assigned identities). + + All required parameters must be populated in order to send to Azure. + + :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". + :vartype type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedServiceIdentityType + :ivar user_assigned_identities: User assigned identities dictionary. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedIdentity] + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "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 manage identity. Required. Known values are: "None" and "UserAssigned". + :paramtype type: str or + ~azure.mgmt.workloads.sapvirtualinstance.models.ManagedServiceIdentityType + :keyword user_assigned_identities: User assigned identities dictionary. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.sapvirtualinstance.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class VirtualMachineConfiguration(_serialization.Model): + """Defines the virtual machine configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar vm_size: The virtual machine size. Required. + :vartype vm_size: str + :ivar image_reference: The image reference. Required. + :vartype image_reference: ~azure.mgmt.workloads.sapvirtualinstance.models.ImageReference + :ivar os_profile: The OS profile. Required. + :vartype os_profile: ~azure.mgmt.workloads.sapvirtualinstance.models.OSProfile + """ + + _validation = { + "vm_size": {"required": True}, + "image_reference": {"required": True}, + "os_profile": {"required": True}, + } + + _attribute_map = { + "vm_size": {"key": "vmSize", "type": "str"}, + "image_reference": {"key": "imageReference", "type": "ImageReference"}, + "os_profile": {"key": "osProfile", "type": "OSProfile"}, + } + + def __init__( + self, *, vm_size: str, image_reference: "_models.ImageReference", os_profile: "_models.OSProfile", **kwargs: Any + ) -> None: + """ + :keyword vm_size: The virtual machine size. Required. + :paramtype vm_size: str + :keyword image_reference: The image reference. Required. + :paramtype image_reference: ~azure.mgmt.workloads.sapvirtualinstance.models.ImageReference + :keyword os_profile: The OS profile. Required. + :paramtype os_profile: ~azure.mgmt.workloads.sapvirtualinstance.models.OSProfile + """ + super().__init__(**kwargs) + self.vm_size = vm_size + self.image_reference = image_reference + self.os_profile = os_profile + + +class VirtualMachineResourceNames(_serialization.Model): + """The resource names object for virtual machine and related resources. + + :ivar vm_name: The full name for virtual machine. The length of this field can be upto 64 + characters. If name is not provided, service uses a default name based on the deployment type. + For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer. + :vartype vm_name: str + :ivar host_name: The full name for virtual-machine's host (computer name). Currently, ACSS only + supports host names which are less than or equal to 13 characters long. If this value is not + provided, vmName will be used as host name. + :vartype host_name: str + :ivar network_interfaces: The list of network interface name objects for the selected virtual + machine. Currently, only one network interface is supported per virtual machine. + :vartype network_interfaces: + list[~azure.mgmt.workloads.sapvirtualinstance.models.NetworkInterfaceResourceNames] + :ivar os_disk_name: The full name for OS disk attached to the VM. If this value is not + provided, it will be named by ARM as per its default naming standards (prefixed with vm name). + There is only one OS disk attached per Virtual Machine. + :vartype os_disk_name: str + :ivar data_disk_names: The full resource names for virtual machine data disks. This is a + dictionary containing list of names of data disks per volume. Currently supported volumes for + database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For + application and cs layers, only 'default' volume is supported. + :vartype data_disk_names: dict[str, list[str]] + """ + + _validation = { + "network_interfaces": {"max_items": 1, "min_items": 0}, + } + + _attribute_map = { + "vm_name": {"key": "vmName", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceResourceNames]"}, + "os_disk_name": {"key": "osDiskName", "type": "str"}, + "data_disk_names": {"key": "dataDiskNames", "type": "{[str]}"}, + } + + def __init__( + self, + *, + vm_name: Optional[str] = None, + host_name: Optional[str] = None, + network_interfaces: Optional[List["_models.NetworkInterfaceResourceNames"]] = None, + os_disk_name: Optional[str] = None, + data_disk_names: Optional[Dict[str, List[str]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword vm_name: The full name for virtual machine. The length of this field can be upto 64 + characters. If name is not provided, service uses a default name based on the deployment type. + For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer. + :paramtype vm_name: str + :keyword host_name: The full name for virtual-machine's host (computer name). Currently, ACSS + only supports host names which are less than or equal to 13 characters long. If this value is + not provided, vmName will be used as host name. + :paramtype host_name: str + :keyword network_interfaces: The list of network interface name objects for the selected + virtual machine. Currently, only one network interface is supported per virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.workloads.sapvirtualinstance.models.NetworkInterfaceResourceNames] + :keyword os_disk_name: The full name for OS disk attached to the VM. If this value is not + provided, it will be named by ARM as per its default naming standards (prefixed with vm name). + There is only one OS disk attached per Virtual Machine. + :paramtype os_disk_name: str + :keyword data_disk_names: The full resource names for virtual machine data disks. This is a + dictionary containing list of names of data disks per volume. Currently supported volumes for + database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For + application and cs layers, only 'default' volume is supported. + :paramtype data_disk_names: dict[str, list[str]] + """ + super().__init__(**kwargs) + self.vm_name = vm_name + self.host_name = host_name + self.network_interfaces = network_interfaces + self.os_disk_name = os_disk_name + self.data_disk_names = data_disk_names + + +class WindowsConfiguration(OSConfiguration): + """Specifies Windows operating system settings on the virtual machine. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.sapvirtualinstance.models.OSType + """ + + _validation = { + "os_type": {"required": True}, + } + + _attribute_map = { + "os_type": {"key": "osType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.os_type: str = "Windows" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_patch.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_workloads_client_enums.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_workloads_client_enums.py new file mode 100644 index 000000000000..bdcd6e2f11b4 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/models/_workloads_client_enums.py @@ -0,0 +1,217 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 enum import Enum +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 ApplicationServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the type of application server VM.""" + + ACTIVE = "Active" + STANDBY = "Standby" + UNKNOWN = "Unknown" + + +class CentralServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the type of central server VM.""" + + PRIMARY = "Primary" + SECONDARY = "Secondary" + UNKNOWN = "Unknown" + ASCS = "ASCS" + ERS_INACTIVE = "ERSInactive" + ERS = "ERS" + STANDBY = "Standby" + + +class ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of file share config.""" + + SKIP = "Skip" + CREATE_AND_MOUNT = "CreateAndMount" + MOUNT = "Mount" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class DiskSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the disk sku name.""" + + STANDARD_LRS = "Standard_LRS" + PREMIUM_LRS = "Premium_LRS" + STANDARD_SSD_LRS = "StandardSSD_LRS" + ULTRA_SSD_LRS = "UltraSSD_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + PREMIUM_V2_LRS = "PremiumV2_LRS" + + +class EnqueueReplicationServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the type of Enqueue Replication Server.""" + + ENQUEUE_REPLICATOR1 = "EnqueueReplicator1" + ENQUEUE_REPLICATOR2 = "EnqueueReplicator2" + + +class ManagedResourcesNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the network access type for managed resources.""" + + PUBLIC = "Public" + PRIVATE = "Private" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (only None, UserAssigned types are allowed).""" + + NONE = "None" + USER_ASSIGNED = "UserAssigned" + + +class NamingPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pattern type to be used for resource naming.""" + + FULL_RESOURCE_NAME = "FullResourceName" + + +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): + """The OS Type.""" + + LINUX = "Linux" + WINDOWS = "Windows" + + +class SAPConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The configuration Type.""" + + DEPLOYMENT = "Deployment" + DISCOVERY = "Discovery" + DEPLOYMENT_WITH_OS_CONFIG = "DeploymentWithOSConfig" + + +class SAPDatabaseScaleMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The database scale method.""" + + SCALE_UP = "ScaleUp" + + +class SAPDatabaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the supported SAP Database types.""" + + HANA = "HANA" + DB2 = "DB2" + + +class SAPDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of SAP deployment, single server or Three tier.""" + + SINGLE_SERVER = "SingleServer" + THREE_TIER = "ThreeTier" + + +class SAPEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the environment type - Production/Non Production.""" + + NON_PROD = "NonProd" + PROD = "Prod" + + +class SAPHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the health of SAP Instances.""" + + UNKNOWN = "Unknown" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + DEGRADED = "Degraded" + + +class SAPHighAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The high availability type (AvailabilitySet or AvailabilityZone).""" + + AVAILABILITY_SET = "AvailabilitySet" + AVAILABILITY_ZONE = "AvailabilityZone" + + +class SAPProductType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the SAP Product type.""" + + ECC = "ECC" + S4_HANA = "S4HANA" + OTHER = "Other" + + +class SAPSoftwareInstallationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The SAP software installation Type.""" + + SERVICE_INITIATED = "ServiceInitiated" + SAP_INSTALL_WITHOUT_OS_CONFIG = "SAPInstallWithoutOSConfig" + EXTERNAL = "External" + + +class SapVirtualInstanceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the provisioning states.""" + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + CREATING = "Creating" + FAILED = "Failed" + DELETING = "Deleting" + CANCELED = "Canceled" + + +class SAPVirtualInstanceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the Virtual Instance for SAP state.""" + + INFRASTRUCTURE_DEPLOYMENT_PENDING = "InfrastructureDeploymentPending" + INFRASTRUCTURE_DEPLOYMENT_IN_PROGRESS = "InfrastructureDeploymentInProgress" + INFRASTRUCTURE_DEPLOYMENT_FAILED = "InfrastructureDeploymentFailed" + SOFTWARE_INSTALLATION_PENDING = "SoftwareInstallationPending" + SOFTWARE_INSTALLATION_IN_PROGRESS = "SoftwareInstallationInProgress" + SOFTWARE_INSTALLATION_FAILED = "SoftwareInstallationFailed" + SOFTWARE_DETECTION_IN_PROGRESS = "SoftwareDetectionInProgress" + SOFTWARE_DETECTION_FAILED = "SoftwareDetectionFailed" + DISCOVERY_PENDING = "DiscoveryPending" + DISCOVERY_IN_PROGRESS = "DiscoveryInProgress" + DISCOVERY_FAILED = "DiscoveryFailed" + REGISTRATION_COMPLETE = "RegistrationComplete" + ACSS_INSTALLATION_BLOCKED = "ACSSInstallationBlocked" + + +class SAPVirtualInstanceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the SAP Instance status.""" + + STARTING = "Starting" + RUNNING = "Running" + STOPPING = "Stopping" + OFFLINE = "Offline" + PARTIALLY_RUNNING = "PartiallyRunning" + UNAVAILABLE = "Unavailable" + SOFT_SHUTDOWN = "SoftShutdown" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/__init__.py new file mode 100644 index 000000000000..e7b2100cc5d3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/__init__.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. +# -------------------------------------------------------------------------- + +from ._workloads_client_operations import WorkloadsClientOperationsMixin +from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations +from ._sap_central_instances_operations import SAPCentralInstancesOperations +from ._sap_database_instances_operations import SAPDatabaseInstancesOperations +from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkloadsClientOperationsMixin", + "SAPVirtualInstancesOperations", + "SAPCentralInstancesOperations", + "SAPDatabaseInstancesOperations", + "SAPApplicationServerInstancesOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_operations.py new file mode 100644 index 000000000000..aa9a461526e5 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request + +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(**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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Workloads/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.WorkloadsClient`'s + :attr:`operations` 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, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all the available API operations under this PR. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.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.OperationListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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) + + list.metadata = {"url": "/providers/Microsoft.Workloads/operations"} diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_patch.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_application_server_instances_operations.py new file mode 100644 index 000000000000..d11c8a94f531 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_application_server_instances_operations.py @@ -0,0 +1,1581 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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, + sap_virtual_instance_name: str, + application_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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_update_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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_delete_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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_list_request( + resource_group_name: str, sap_virtual_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "applicationInstanceName": _SERIALIZER.url( + "application_instance_name", application_instance_name, "str", pattern=r"^.*" + ), + } + + _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 SAPApplicationServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.WorkloadsClient`'s + :attr:`sap_application_server_instances` 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( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :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.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_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("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPApplicationServerInstance] = 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, "SAPApplicationServerInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.SAPApplicationServerInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :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 SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by + service only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Is either a + SAPApplicationServerInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance 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 SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :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.SAPApplicationServerInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + :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: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Updates the SAP Application server instance resource. This can be used to update tags on the + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: The SAP Application Server Instance resource request body. Is either a + UpdateSAPApplicationInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPApplicationServerInstance] = 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, "UpdateSAPApplicationInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + 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) + + _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("SAPApplicationServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the SAP Application Server Instance resource. :code:`
`:code:`
`This operation + will be used by service only. Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPApplicationServerInstance"]: + """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPApplicationServerInstance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPApplicationServerInstance] + :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.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPApplicationServerInstanceList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" + } + + def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Is either a StartRequest type + or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is either a StopRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_central_instances_operations.py new file mode 100644 index 000000000000..53347b32d21a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_central_instances_operations.py @@ -0,0 +1,1570 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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, + sap_virtual_instance_name: str, + central_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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_update_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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_delete_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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_list_request( + resource_group_name: str, sap_virtual_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), + } + + _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 SAPCentralInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.WorkloadsClient`'s + :attr:`sap_central_instances` 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( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Gets the SAP Central Services Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :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.SAPCentralServerInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_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("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPCentralServerInstance] = 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, "SAPCentralServerInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.SAPCentralServerInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :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 SAPCentralServerInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance request body. Is either a + SAPCentralServerInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance 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 SAPCentralServerInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :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.SAPCentralServerInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPCentralInstanceRequest + :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: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: The SAP Central Services Instance resource request body. Is either a + UpdateSAPCentralInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPCentralInstanceRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPCentralServerInstance] = 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, "UpdateSAPCentralInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + 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) + + _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("SAPCentralServerInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used + by service only. Delete operation on this resource by end user will return a Bad Request error. + You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, + using the delete operation on it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPCentralServerInstance"]: + """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPCentralServerInstance or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPCentralServerInstance] + :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.SAPCentralInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPCentralInstanceList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" + } + + def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Is either a StartRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is either a StopRequest type or a + IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_database_instances_operations.py new file mode 100644 index 000000000000..13eaa1af71b4 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_database_instances_operations.py @@ -0,0 +1,1579 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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, + sap_virtual_instance_name: str, + database_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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_update_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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_delete_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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_list_request( + resource_group_name: str, sap_virtual_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_start_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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_stop_instance_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + "databaseInstanceName": _SERIALIZER.url( + "database_instance_name", database_instance_name, "str", pattern=r"^.*" + ), + } + + _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 SAPDatabaseInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.WorkloadsClient`'s + :attr:`sap_database_instances` 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( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Gets the SAP Database Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :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.SAPDatabaseInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_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("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDatabaseInstance] = 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, "SAPDatabaseInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.SAPDatabaseInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :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 SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. PUT by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Request body of Database resource of a SAP system. Is either a SAPDatabaseInstance + type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance 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 SAPDatabaseInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :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.SAPDatabaseInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest + :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: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database instance resource. This can be used to update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Database resource update request body. Is either a + UpdateSAPDatabaseInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDatabaseInstance] = 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, "UpdateSAPDatabaseInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + 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) + + _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("SAPDatabaseInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. + :code:`
`:code:`
`This will be used by service only. Delete by end user will return a Bad + Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPDatabaseInstance"]: + """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPDatabaseInstance or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPDatabaseInstance] + :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.SAPDatabaseInstanceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPDatabaseInstanceList", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" + } + + def _start_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Is either a StartRequest type or + a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" + } + + def _stop_instance_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_instance_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_instance_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_instance( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is either a StopRequest + type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_instance_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_virtual_instances_operations.py new file mode 100644 index 000000000000..2a1d2663e3cf --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_sap_virtual_instances_operations.py @@ -0,0 +1,1663 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import WorkloadsClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, sap_virtual_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_request( + resource_group_name: str, sap_virtual_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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, sap_virtual_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_delete_request( + resource_group_name: str, sap_virtual_instance_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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_list_by_resource_group_request(resource_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _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_list_by_subscription_request(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-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_start_request( + resource_group_name: str, sap_virtual_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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_stop_request( + resource_group_name: str, sap_virtual_instance_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-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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop", + ) # 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 + ), + "sapVirtualInstanceName": _SERIALIZER.url( + "sap_virtual_instance_name", sap_virtual_instance_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" + ), + } + + _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 SAPVirtualInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloads.sapvirtualinstance.WorkloadsClient`'s + :attr:`sap_virtual_instances` 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 _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, + **kwargs: Any + ) -> _models.SAPVirtualInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPVirtualInstance] = 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, "SAPVirtualInstance") + else: + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.SAPVirtualInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance + :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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Virtual Instance for SAP solutions resource request body. Is either a + SAPVirtualInstance type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance 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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> _models.SAPVirtualInstance: + """Gets a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance + :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.SAPVirtualInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_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("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPVirtualInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPVirtualInstance] = 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, "UpdateSAPVirtualInstanceRequest") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Default + value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceRequest + :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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Default + value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: Request body to update a Virtual Instance for SAP solutions resource. Is either a + UpdateSAPVirtualInstanceRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.UpdateSAPVirtualInstanceRequest 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 SAPVirtualInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstance] = 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sap_virtual_instance_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, + sap_virtual_instance_name=sap_virtual_instance_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) + + _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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the + associated Central Services Instance, Application Server Instances and Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" + } + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Resource Group. + + :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 SAPVirtualInstance or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstanceList] = 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, + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances" + } + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstance or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.sapvirtualinstance.models.SAPVirtualInstance] + :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.SAPVirtualInstanceList] = 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, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" + } + + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StartRequest") + else: + _json = None + + request = build_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._start_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" + } + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Is either a + StartRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StartRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" + } + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> Optional[_models.OperationStatusResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.OperationStatusResult]] = 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, "StopRequest") + else: + _json = None + + request = build_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" + } + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Is either a + StopRequest type or a IO type. Default value is None. + :type body: ~azure.mgmt.workloads.sapvirtualinstance.models.StopRequest 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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.sapvirtualinstance.models.OperationStatusResult] + :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.OperationStatusResult] = 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._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_workloads_client_operations.py new file mode 100644 index 000000000000..327d72fb740a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/operations/_workloads_client_operations.py @@ -0,0 +1,708 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 WorkloadsClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_sap_sizing_recommendations_request(location: 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-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}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_sap_supported_sku_request(location: 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-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}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_sap_disk_configurations_request(location: 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-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}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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_sap_availability_zone_details_request(location: 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-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}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _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 WorkloadsClientOperationsMixin(WorkloadsClientMixinABC): + @overload + def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationRequest + :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: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Get SAP sizing recommendations by providing input SAPS for application tier and memory required + for database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Is either a + SAPSizingRecommendationRequest type or a IO type. Default value is None. + :type sap_sizing_recommendation: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPSizingRecommendationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_sizing_recommendation, (IOBase, bytes)): + _content = sap_sizing_recommendation + else: + if sap_sizing_recommendation is not None: + _json = self._serialize.body(sap_sizing_recommendation, "SAPSizingRecommendationRequest") + else: + _json = None + + request = build_sap_sizing_recommendations_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_sizing_recommendations.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("SAPSizingRecommendationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_sizing_recommendations.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" + } + + @overload + def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSkusRequest + :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: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Is either a SAPSupportedSkusRequest + type or a IO type. Default value is None. + :type sap_supported_sku: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedSkusRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_supported_sku, (IOBase, bytes)): + _content = sap_supported_sku + else: + if sap_supported_sku is not None: + _json = self._serialize.body(sap_supported_sku, "SAPSupportedSkusRequest") + else: + _json = None + + request = build_sap_supported_sku_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_supported_sku.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("SAPSupportedResourceSkusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_supported_sku.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" + } + + @overload + def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsRequest + :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: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Is either a + SAPDiskConfigurationsRequest type or a IO type. Default value is None. + :type sap_disk_configurations: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_disk_configurations, (IOBase, bytes)): + _content = sap_disk_configurations + else: + if sap_disk_configurations is not None: + _json = self._serialize.body(sap_disk_configurations, "SAPDiskConfigurationsRequest") + else: + _json = None + + request = build_sap_disk_configurations_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_disk_configurations.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("SAPDiskConfigurationsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_disk_configurations.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" + } + + @overload + def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest + :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: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None, + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of Azure region. Required. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Is either a + SAPAvailabilityZoneDetailsRequest type or a IO type. Default value is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) + :rtype: ~azure.mgmt.workloads.sapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sap_availability_zone_details, (IOBase, bytes)): + _content = sap_availability_zone_details + else: + if sap_availability_zone_details is not None: + _json = self._serialize.body(sap_availability_zone_details, "SAPAvailabilityZoneDetailsRequest") + else: + _json = None + + request = build_sap_availability_zone_details_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.sap_availability_zone_details.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("SAPAvailabilityZoneDetailsResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_availability_zone_details.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" + } diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/py.typed b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/azure/mgmt/workloads/sapvirtualinstance/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/operations_list.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/operations_list.py new file mode 100644 index 000000000000..6a8780c1c735 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python operations_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py new file mode 100644 index 000000000000..c59e3d874c56 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py new file mode 100644 index 000000000000..c42530285176 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_create_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py new file mode 100644 index 000000000000..35463f39f535 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + client.sap_application_server_instances.begin_delete( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py new file mode 100644 index 000000000000..09183f90cc7c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.get( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py new file mode 100644 index 000000000000..b140704bab07 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.list( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_List.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py new file mode 100644 index 000000000000..5e4a7723823d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_start_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py new file mode 100644 index 000000000000..531786976220 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_start_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py new file mode 100644 index 000000000000..750c24d58a4d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_stop_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py new file mode 100644 index 000000000000..2954818cde2f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_stop_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_application_server_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py new file mode 100644 index 000000000000..2b648c53e410 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_application_server_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_application_server_instances.update( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + application_instance_name="app01", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py new file mode 100644 index 000000000000..2c17e1ecd871 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py new file mode 100644 index 000000000000..58ad7b24338a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_create_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py new file mode 100644 index 000000000000..3355a6496561 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + client.sap_central_instances.begin_delete( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py new file mode 100644 index 000000000000..dad20b7df622 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.get( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py new file mode 100644 index 000000000000..5ad845bb9bd6 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.list( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_List.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py new file mode 100644 index 000000000000..45c61fae5996 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_start_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py new file mode 100644 index 000000000000..c016c7675cd0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_start_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py new file mode 100644 index 000000000000..a50f915f3d7b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_stop_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py new file mode 100644 index 000000000000..28ad5a6ab5bd --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_stop_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_central_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py new file mode 100644 index 000000000000..0bd4bc1c1edb --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_central_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_central_instances.update( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py new file mode 100644 index 000000000000..1c24d5ff6562 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py new file mode 100644 index 000000000000..1ba70121ca87 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_create_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py new file mode 100644 index 000000000000..2d5ef3fecf33 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + client.sap_database_instances.begin_delete( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ).result() + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py new file mode 100644 index 000000000000..01617e1b44e1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.get( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py new file mode 100644 index 000000000000..f480f4df8c11 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.list( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_List.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py new file mode 100644 index 000000000000..2845e9363d3a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_start_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py new file mode 100644 index 000000000000..8697aa56ba39 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_start_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_start_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py new file mode 100644 index 000000000000..692803713625 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_stop_instance.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py new file mode 100644 index 000000000000..b2732e9e875b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_stop_instance_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_database_instances.begin_stop_instance( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py new file mode 100644 index 000000000000..81dc91795419 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_database_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_database_instances.update( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="databaseServer", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py new file mode 100644 index 000000000000..d70880d8af70 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_availability_zone_details_eastus.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_availability_zone_details( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py new file mode 100644 index 000000000000..a03c86c9cab3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_availability_zone_details_northeurope.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_availability_zone_details( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py new file mode 100644 index 000000000000..55e8e4d89d2e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_disk_configurations_non_prod.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_disk_configurations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py new file mode 100644 index 000000000000..ec897fbd4c43 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_disk_configurations_prod.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_disk_configurations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py new file mode 100644 index 000000000000..b4fbe46f9a7c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_sizing_recommendations_s4_hana_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_sizing_recommendations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py new file mode 100644 index 000000000000..932695b2ecee --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_sizing_recommendations_s4_hana_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_sizing_recommendations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py new file mode 100644 index 000000000000..d83b07081b01 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_sizing_recommendations_s4_hana_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_sizing_recommendations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py new file mode 100644 index 000000000000..e67c0efa9734 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_sizing_recommendations_s4_hana_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_sizing_recommendations( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py new file mode 100644 index 000000000000..633ceb9b6f87 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_supported_skus_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_supported_sku( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py new file mode 100644 index 000000000000..86341106d8fd --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_supported_skus_distributed_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_supported_sku( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py new file mode 100644 index 000000000000..142a28a9ddf9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_supported_skus_distributed_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_supported_sku( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py new file mode 100644 index 000000000000..12b4e2086c5b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_supported_skus_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_supported_sku( + location="centralus", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py new file mode 100644 index 000000000000..e10d1150e99d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py new file mode 100644 index 000000000000..dce6eb5a6e56 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py new file mode 100644 index 000000000000..a0ca959a38ea --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py new file mode 100644 index 000000000000..c7aa5e50a766 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_custom_full_resource_names_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py new file mode 100644 index 000000000000..09478f2b882d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_custom_image.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Custom_Image.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py new file mode 100644 index 000000000000..c458697edc29 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_discover.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py new file mode 100644 index 000000000000..3adc9fa846f0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_discover_custom_mrg_storage_account_name.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py new file mode 100644 index 000000000000..a4749c7e012a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_discover_trusted_access_enable.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_TrustedAccessEnable.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py new file mode 100644 index 000000000000..e4bb307f3f89 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_disk_details_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py new file mode 100644 index 000000000000..3becebd1bb6d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_disk_details_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py new file mode 100644 index 000000000000..acc69c65cc27 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_disk_details_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py new file mode 100644 index 000000000000..76664b44d263 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_disk_details_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py new file mode 100644 index 000000000000..9a532e0015e8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py new file mode 100644 index 000000000000..b43f7a48e787 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_distributed_create_transport.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py new file mode 100644 index 000000000000..4e760de1f7b3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_distributed_mount_transport.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py new file mode 100644 index 000000000000..7db33e48a44c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_distributed_skip_transport.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py new file mode 100644 index 000000000000..dc1710791ac2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py new file mode 100644 index 000000000000..4224f1ac26a0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py new file mode 100644 index 000000000000..5b73470a12d3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py new file mode 100644 index 000000000000..11b560b49355 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_with_os_config_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py new file mode 100644 index 000000000000..1f2cfd24005d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_with_os_config_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py new file mode 100644 index 000000000000..dbfc42ded17c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_with_os_config_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py new file mode 100644 index 000000000000..88c60c6e81b8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_with_os_config_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py new file mode 100644 index 000000000000..084232196d52 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_create_with_os_config_with_trusted_access.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_WithTrustedAccess.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py new file mode 100644 index 000000000000..16cbce326417 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + client.sap_virtual_instances.begin_delete( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py new file mode 100644 index 000000000000..01fd8822057e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_detect_installation_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py new file mode 100644 index 000000000000..e796f9de5af0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_detect_installation_ha_av_set.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py new file mode 100644 index 000000000000..d652cd6b71f5 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_detect_installation_ha_av_zone.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py new file mode 100644 index 000000000000..d33253b50e23 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_detect_installation_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py new file mode 100644 index 000000000000..deaabccd325a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.get( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py new file mode 100644 index 000000000000..46311a8e72c9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_get_acssinstallation_blocked.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.get( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ) + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get_ACSSInstallationBlocked.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py new file mode 100644 index 000000000000..2bf4b4ca32e0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_install_distributed.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py new file mode 100644 index 000000000000..fe9bcb7cd8e8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_install_single_server.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py new file mode 100644 index 000000000000..348cbc7177bd --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_list_by_resource_group.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_virtual_instances.list_by_resource_group( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py new file mode 100644 index 000000000000..da84ce5a5895 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_list_by_subscription.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + ) + + response = client.sap_virtual_instances.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py new file mode 100644 index 000000000000..4e2b3d969dbc --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_start.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_start( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py new file mode 100644 index 000000000000..d383420ac07e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_start_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_start( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py new file mode 100644 index 000000000000..aee3546d8336 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_stop.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py new file mode 100644 index 000000000000..8cc277c04c55 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_stop_with_infra_operations.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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop_WithInfraOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py new file mode 100644 index 000000000000..5449dac80890 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_trusted_access_enable_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_update( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_TrustedAccessEnable_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py new file mode 100644 index 000000000000..60445dda4b76 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.workloads.sapvirtualinstance import WorkloadsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloads-sapvirtualinstance +# USAGE + python sap_virtual_instances_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 = WorkloadsClient( + credential=DefaultAzureCredential(), + subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + ) + + response = client.sap_virtual_instances.begin_update( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/sdk_packaging.toml b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/sdk_packaging.toml new file mode 100644 index 000000000000..c675bbf5bc2e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-workloads-sapvirtualinstance" +package_nspkg = "azure-mgmt-workloads-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/setup.py b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/setup.py new file mode 100644 index 000000000000..4370e40a9c62 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads-sapvirtualinstance/setup.py @@ -0,0 +1,83 @@ +#!/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 +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-workloads-sapvirtualinstance" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +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) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +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", + 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.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", + "azure.mgmt.workloads", + ] + ), + include_package_data=True, + package_data={ + "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", + ], + python_requires=">=3.8", +) diff --git a/sdk/workloads/ci.yml b/sdk/workloads/ci.yml index 94b5fc091e01..a3384fdc0752 100644 --- a/sdk/workloads/ci.yml +++ b/sdk/workloads/ci.yml @@ -31,3 +31,5 @@ extends: Artifacts: - name: azure-mgmt-workloads safeName: azuremgmtworkloads + - name: azure-mgmt-workloads-sapvirtualinstance + safeName: azuremgmtworkloadssapvirtualinstance